0

Merge branches 'config-include', 'hashchange', 'poi-polylines', 'showlocationmarker' and 'signed-timestamps'

This commit is contained in:
Aaron Griffith
2013-05-20 20:56:40 -04:00
10 changed files with 109 additions and 22 deletions

View File

@@ -3,7 +3,9 @@ overviewer.util = {
// vars for callback
readyQueue: [],
isReady: false,
lastHash: null,
/* fuzz tester!
*/
'testMaths': function(t) {
@@ -138,8 +140,9 @@ overviewer.util = {
overviewer.mapView.render();
// Jump to the hash if given
// Jump to the hash if given (and do so for any further hash changes)
overviewer.util.initHash();
$(window).on('hashchange', function() { overviewer.util.initHash(); });
// create this control after initHash so it can correctly select the current world
var worldSelector = new overviewer.views.WorldSelectorView({tagName:'DIV'});
@@ -465,18 +468,23 @@ overviewer.util = {
});
},
'initHash': function() {
if(window.location.hash.split("/").length > 1) {
overviewer.util.goToHash();
// Clean up the hash.
overviewer.util.updateHash();
var newHash = window.location.hash;
if (overviewer.util.lastHash !== newHash) {
overviewer.util.lastHash = newHash;
if(newHash.split("/").length > 1) {
overviewer.util.goToHash();
// Clean up the hash.
overviewer.util.updateHash();
}
}
},
'setHash': function(x, y, z, zoom, w, maptype) {
// save this info is a nice easy to parse format
var currentWorldView = overviewer.mapModel.get("currentWorldView");
currentWorldView.options.lastViewport = [x,y,z,zoom];
window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype);
var newHash = "#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + w + "/" + maptype;
overviewer.util.lastHash = newHash; // this should not trigger initHash
window.location.replace(newHash);
},
'updateHash': function() {
var currTileset = overviewer.mapView.options.currentTileSet;

View File

@@ -474,6 +474,22 @@ overviewer.views.SignControlView = Backbone.View.extend({
}
}
dataRoot[i].markerObjs.push(marker);
// Polyline stuff added by FreakusGeekus. Probably needs work.
if (typeof entity['polyline'] != 'undefined') {
var polypath = new Array();
for (point in entity.polyline) {
polypath.push(overviewer.util.fromWorldToLatLng(entity.polyline[point].x, entity.polyline[point].y, entity.polyline[point].z, overviewer.mapView.options.currentTileSet));
}
var polyline = new google.maps.Polyline({
'path': polypath,
'clickable': false,
'map': overviewer.map,
'visible': false,
'strokeColor': entity['strokeColor']
});
dataRoot[i].markerObjs.push(polyline);
}
}
dataRoot[i].created = true;
}
@@ -571,7 +587,7 @@ overviewer.views.LocationIconView = Backbone.View.extend({
'icon': overviewerConfig.CONST.image.queryMarker,
'visible': false
});
overviewer.collections.locationMarker.setVisible(true);
overviewer.collections.locationMarker.setVisible(overviewer.mapView.options.currentTileSet.get("showlocationmarker"));
}
});