fixes from testing
This commit is contained in:
@@ -7,6 +7,7 @@ var overviewer = {
|
|||||||
'regions': {},
|
'regions': {},
|
||||||
'overlays': [],
|
'overlays': [],
|
||||||
'mapTypes': {},
|
'mapTypes': {},
|
||||||
|
'mapTypeIds': [],
|
||||||
'infoWindow': null
|
'infoWindow': null
|
||||||
},
|
},
|
||||||
'util': {
|
'util': {
|
||||||
@@ -35,10 +36,10 @@ var overviewer = {
|
|||||||
var div = ownerDocument.createElement('DIV');
|
var div = ownerDocument.createElement('DIV');
|
||||||
div.innerHTML = '(' + coord.x + ', ' + coord.y + ', ' + zoom + ')';
|
div.innerHTML = '(' + coord.x + ', ' + coord.y + ', ' + zoom + ')';
|
||||||
div.innerHTML += '<br />';
|
div.innerHTML += '<br />';
|
||||||
div.innerHTML += overviewer.collections.mapTypes[0].getTileUrl(coord, zoom);
|
//div.innerHTML += overviewer.collections.mapTypes[0].getTileUrl(coord, zoom);
|
||||||
div.style.width = this.tileSize.width + 'px';
|
div.style.width = this.tileSize.width + 'px';
|
||||||
div.style.height = this.tileSize.height + 'px';
|
div.style.height = this.tileSize.height + 'px';
|
||||||
div.style.fontSize = '10';
|
div.style.fontSize = '10px';
|
||||||
div.style.borderStyle = 'solid';
|
div.style.borderStyle = 'solid';
|
||||||
div.style.borderWidth = '1px';
|
div.style.borderWidth = '1px';
|
||||||
div.style.borderColor = '#AAAAAA';
|
div.style.borderColor = '#AAAAAA';
|
||||||
@@ -80,7 +81,7 @@ var overviewer = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'initilizeMap': function() {
|
'initializeMap': function() {
|
||||||
var defaultCenter = overviewer.util.fromWorldToLatLng(
|
var defaultCenter = overviewer.util.fromWorldToLatLng(
|
||||||
overviewerConfig.map.center[0], overviewerConfig.map.center[1],
|
overviewerConfig.map.center[0], overviewerConfig.map.center[1],
|
||||||
overviewerConfig.map.center[2]);
|
overviewerConfig.map.center[2]);
|
||||||
@@ -142,7 +143,7 @@ var overviewer = {
|
|||||||
|
|
||||||
if (overviewerConfig.map.debug) {
|
if (overviewerConfig.map.debug) {
|
||||||
overviewer.map.overlayMapTypes.insertAt(0,
|
overviewer.map.overlayMapTypes.insertAt(0,
|
||||||
new CoordMapType(new google.maps.Size(
|
new overviewer.classes.CoordMapType(new google.maps.Size(
|
||||||
overviewerConfig.CONST.tileSize,
|
overviewerConfig.CONST.tileSize,
|
||||||
overviewerConfig.CONST.tileSize)));
|
overviewerConfig.CONST.tileSize)));
|
||||||
google.maps.event.addListener(overviewer.map, 'click', function(event) {
|
google.maps.event.addListener(overviewer.map, 'click', function(event) {
|
||||||
@@ -150,8 +151,10 @@ var overviewer = {
|
|||||||
', ' + event.latLng.lng() + ')');
|
', ' + event.latLng.lng() + ')');
|
||||||
var pnt = overviewer.map.getProjection().fromLatLngToPoint(event.latLng);
|
var pnt = overviewer.map.getProjection().fromLatLngToPoint(event.latLng);
|
||||||
overviewer.util.debug('point: ' + pnt);
|
overviewer.util.debug('point: ' + pnt);
|
||||||
var pxx = pnt.x * config.tileSize * Math.pow(2, config.maxZoom);
|
var pxx = pnt.x * overviewerConfig.CONST.tileSize *
|
||||||
var pxy = pnt.y * config.tileSize * Math.pow(2, config.maxZoom);
|
Math.pow(2, overviewerConfig.map.maxZoom);
|
||||||
|
var pxy = pnt.y * overviewerConfig.CONST.tileSize *
|
||||||
|
Math.pow(2, overviewerConfig.map.maxZoom);
|
||||||
overviewer.util.debug('pixel: (' + pxx + ', ' + pxy + ')');
|
overviewer.util.debug('pixel: (' + pxx + ', ' + pxy + ')');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -186,9 +189,11 @@ var overviewer = {
|
|||||||
},
|
},
|
||||||
'initializeMarkers': function() {
|
'initializeMarkers': function() {
|
||||||
//first, give all collections an empty array to work with
|
//first, give all collections an empty array to work with
|
||||||
for (i in overviewerConfig.objectGroups.markers) {
|
for (i in overviewerConfig.objectGroups.signs) {
|
||||||
|
overviewer.util.debug('Found sign group: ' +
|
||||||
|
overviewerConfig.objectGroups.signs[i].label);
|
||||||
overviewer.collections.markers[
|
overviewer.collections.markers[
|
||||||
overviewerConfig.objectGroups.markers[i].label] = [];
|
overviewerConfig.objectGroups.signs[i].label] = [];
|
||||||
}
|
}
|
||||||
for (i in overviewer.collections.markerDatas) {
|
for (i in overviewer.collections.markerDatas) {
|
||||||
var markerData = overviewer.collections.markerDatas[i];
|
var markerData = overviewer.collections.markerDatas[i];
|
||||||
@@ -236,7 +241,6 @@ var overviewer = {
|
|||||||
if (signGroup.icon) {
|
if (signGroup.icon) {
|
||||||
iconURL = signGroup.icon;
|
iconURL = signGroup.icon;
|
||||||
}
|
}
|
||||||
var converted = fromWorldToLatLng(item.x, item.y, item.z);
|
|
||||||
var marker = new google.maps.Marker({
|
var marker = new google.maps.Marker({
|
||||||
'position': overviewer.util.fromWorldToLatLng(item.x,
|
'position': overviewer.util.fromWorldToLatLng(item.x,
|
||||||
item.y, item.z),
|
item.y, item.z),
|
||||||
@@ -245,6 +249,7 @@ var overviewer = {
|
|||||||
'icon': iconURL,
|
'icon': iconURL,
|
||||||
'visible': false
|
'visible': false
|
||||||
});
|
});
|
||||||
|
overviewer.util.debug(label);
|
||||||
overviewer.collections.markers[label].push(marker);
|
overviewer.collections.markers[label].push(marker);
|
||||||
if (item.type == 'sign') {
|
if (item.type == 'sign') {
|
||||||
overviewer.util.createMarkerInfoWindow(marker);
|
overviewer.util.createMarkerInfoWindow(marker);
|
||||||
@@ -258,7 +263,7 @@ var overviewer = {
|
|||||||
if (item.type == 'sign') {
|
if (item.type == 'sign') {
|
||||||
iconURL = overviewerConfig.CONST.image.signMarker;
|
iconURL = overviewerConfig.CONST.image.signMarker;
|
||||||
}
|
}
|
||||||
var marker = new google.maps.Marker({position: converted,
|
var marker = new google.maps.Marker({
|
||||||
'position': overviewer.util.fromWorldToLatLng(item.x,
|
'position': overviewer.util.fromWorldToLatLng(item.x,
|
||||||
item.y, item.z),
|
item.y, item.z),
|
||||||
'map': overviewer.map,
|
'map': overviewer.map,
|
||||||
@@ -457,7 +462,7 @@ var overviewer = {
|
|||||||
var viewStateDiv = document.createElement('DIV');
|
var viewStateDiv = document.createElement('DIV');
|
||||||
viewStateDiv.id='link';
|
viewStateDiv.id='link';
|
||||||
// add it to the map, bottom left.
|
// add it to the map, bottom left.
|
||||||
map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push(viewStateDiv);
|
overviewer.map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push(viewStateDiv);
|
||||||
|
|
||||||
// compass rose, in the top right corner
|
// compass rose, in the top right corner
|
||||||
var compassDiv = document.createElement('DIV');
|
var compassDiv = document.createElement('DIV');
|
||||||
@@ -467,7 +472,7 @@ var overviewer = {
|
|||||||
compassDiv.appendChild(compassImg);
|
compassDiv.appendChild(compassImg);
|
||||||
compassDiv.index = 0;
|
compassDiv.index = 0;
|
||||||
// add it to the map, top right.
|
// add it to the map, top right.
|
||||||
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(compassDiv);
|
overviewer.map.controls[google.maps.ControlPosition.TOP_RIGHT].push(compassDiv);
|
||||||
|
|
||||||
// Spawn button
|
// Spawn button
|
||||||
var homeControlDiv = document.createElement('DIV');
|
var homeControlDiv = document.createElement('DIV');
|
||||||
@@ -493,7 +498,7 @@ var overviewer = {
|
|||||||
'icon': iconURL,
|
'icon': iconURL,
|
||||||
'action': function(n, item, checked) {
|
'action': function(n, item, checked) {
|
||||||
jQuery.each(overviewer.collections.markers[item.label],
|
jQuery.each(overviewer.collections.markers[item.label],
|
||||||
function(i,elem) {
|
function(i, elem) {
|
||||||
elem.setVisible(checked);
|
elem.setVisible(checked);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -518,8 +523,7 @@ var overviewer = {
|
|||||||
function(i,elem) {
|
function(i,elem) {
|
||||||
// Thanks to LeastWeasel for this line!
|
// Thanks to LeastWeasel for this line!
|
||||||
elem.setMap(checked ? overviewer.map : null);
|
elem.setMap(checked ? overviewer.map : null);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -541,7 +545,9 @@ var overviewer = {
|
|||||||
} else {
|
} else {
|
||||||
var idx_to_delete = -1;
|
var idx_to_delete = -1;
|
||||||
overviewer.map.overlayMapTypes.forEach(function(e, j) {
|
overviewer.map.overlayMapTypes.forEach(function(e, j) {
|
||||||
if (e == item.overlay) { idx_to_delete = j; }
|
if (e == item.overlay) {
|
||||||
|
idx_to_delete = j;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (idx_to_delete >= 0) {
|
if (idx_to_delete >= 0) {
|
||||||
overviewer.map.overlayMapTypes.removeAt(idx_to_delete);
|
overviewer.map.overlayMapTypes.removeAt(idx_to_delete);
|
||||||
@@ -662,7 +668,7 @@ var overviewer = {
|
|||||||
// Setup the click event listeners: simply set the map to map center
|
// Setup the click event listeners: simply set the map to map center
|
||||||
// as definned below
|
// as definned below
|
||||||
google.maps.event.addDomListener(control, 'click', function() {
|
google.maps.event.addDomListener(control, 'click', function() {
|
||||||
overviewer.map.panTo(fromWorldToLatLng(
|
overviewer.map.panTo(overviewer.util.fromWorldToLatLng(
|
||||||
overviewerConfig.map.center[0],
|
overviewerConfig.map.center[0],
|
||||||
overviewerConfig.map.center[1],
|
overviewerConfig.map.center[1],
|
||||||
overviewerConfig.map.center[2]));
|
overviewerConfig.map.center[2]));
|
||||||
|
|||||||
@@ -32,7 +32,15 @@ var overviewerConfig = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'regions': []
|
'regions': [
|
||||||
|
{
|
||||||
|
'label': 'All',
|
||||||
|
'clickable':true,
|
||||||
|
'match': function(region) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
'mapTypes': {maptypedata}
|
'mapTypes': {maptypedata}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user