forked from ifgi/historicmaps-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.js~
70 lines (50 loc) · 1.63 KB
/
map.js~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function init() {
var map = L.map('map').setView([0, 0], 4);
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
var info = L.control();
info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
this.update();
return this._div;
};
// method that we will use to update the control based on feature properties passed
info.update = function () {
var bounds = map.getBounds();
this._div.innerHTML = '<h4>BoundingBox</h4><hr><h5>NE:'
+bounds._northEast+'</h5><br/><h5>NE:'
+bounds._southWest+'</h5>';
};
info.addTo(map);
function updateBBox() {
info.update();
}
map.on('drag', updateBBox);
map.on('zoomend', updateBBox)
function getRdfClasses(rdfTxt){
var rdfClasses = rdfTxt.getElementsByTagName("owl:Class");
var classArray = new Array();
for(var i = 0 ; i < rdfClasses.length; i++){
var uri = rdfClasses[i].getAttribute("rdf:about");
var tmp = new Object();
tmp.type = "Class";
tmp.uri = uri;
tmp.name = getLastStringAfterHash(uri);
var childNodes = rdfClasses[i].childNodes;
var tmpParents = new Array();
for(var j = 0 ; j < childNodes.length; j++){
if(childNodes[j].nodeName == "rdfs:subClassOf"){
//alert(tmp.name + " - " + childNodes[j].getAttribute("rdf:resource"));
tmpParents.push(childNodes[j].getAttribute("rdf:resource"));
}
}
tmp.parents = tmpParents;
tmp.children = new Array();
classArray.push(tmp);
}
getChildrenClasses(classArray);
return classArray;
}
}