the position anchor tag now uses rendermode name, not label
This commit is contained in:
@@ -124,7 +124,11 @@ var overviewer = {
|
|||||||
for (i in overviewerConfig.mapTypes) {
|
for (i in overviewerConfig.mapTypes) {
|
||||||
var view = overviewerConfig.mapTypes[i];
|
var view = overviewerConfig.mapTypes[i];
|
||||||
var imageFormat = view.imgformat ? view.imgformat : 'png';
|
var imageFormat = view.imgformat ? view.imgformat : 'png';
|
||||||
mapOptions[view.label] = {
|
|
||||||
|
if (view.shortname == null)
|
||||||
|
view.shortname = view.label.replace(/\s+/g, "");
|
||||||
|
|
||||||
|
mapOptions[view.shortname] = {
|
||||||
'getTileUrl': overviewer.gmap.getTileUrlGenerator(view.path,
|
'getTileUrl': overviewer.gmap.getTileUrlGenerator(view.path,
|
||||||
view.base, imageFormat),
|
view.base, imageFormat),
|
||||||
'tileSize': new google.maps.Size(
|
'tileSize': new google.maps.Size(
|
||||||
@@ -134,19 +138,20 @@ var overviewer = {
|
|||||||
'minZoom': overviewerConfig.map.minZoom,
|
'minZoom': overviewerConfig.map.minZoom,
|
||||||
'isPng': imageFormat.toLowerCase() == 'png'
|
'isPng': imageFormat.toLowerCase() == 'png'
|
||||||
}
|
}
|
||||||
overviewer.collections.mapTypes[view.label] = new google.maps.ImageMapType(
|
overviewer.collections.mapTypes[view.shortname] = new google.maps.ImageMapType(
|
||||||
mapOptions[view.label]);
|
mapOptions[view.shortname]);
|
||||||
overviewer.collections.mapTypes[view.label].name = view.label;
|
overviewer.collections.mapTypes[view.shortname].name = view.label;
|
||||||
overviewer.collections.mapTypes[view.label].alt = 'Minecraft ' +
|
overviewer.collections.mapTypes[view.shortname].shortname = view.shortname;
|
||||||
|
overviewer.collections.mapTypes[view.shortname].alt = 'Minecraft ' +
|
||||||
view.label + ' Map';
|
view.label + ' Map';
|
||||||
overviewer.collections.mapTypes[view.label].projection =
|
overviewer.collections.mapTypes[view.shortname].projection =
|
||||||
new overviewer.classes.MapProjection();
|
new overviewer.classes.MapProjection();
|
||||||
if (view.overlay) {
|
if (view.overlay) {
|
||||||
overviewer.collections.overlays.push(
|
overviewer.collections.overlays.push(
|
||||||
overviewer.collections.mapTypes[view.label]);
|
overviewer.collections.mapTypes[view.shortname]);
|
||||||
} else {
|
} else {
|
||||||
overviewer.collections.mapTypeIds.push(
|
overviewer.collections.mapTypeIds.push(
|
||||||
overviewerConfig.CONST.mapDivId + view.label);
|
overviewerConfig.CONST.mapDivId + view.shortname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -245,7 +250,7 @@ var overviewer = {
|
|||||||
// Now attach the coordinate map type to the map's registry
|
// Now attach the coordinate map type to the map's registry
|
||||||
for (i in overviewer.collections.mapTypes) {
|
for (i in overviewer.collections.mapTypes) {
|
||||||
overviewer.map.mapTypes.set(overviewerConfig.CONST.mapDivId +
|
overviewer.map.mapTypes.set(overviewerConfig.CONST.mapDivId +
|
||||||
overviewer.collections.mapTypes[i].name,
|
overviewer.collections.mapTypes[i].shortname,
|
||||||
overviewer.collections.mapTypes[i]);
|
overviewer.collections.mapTypes[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +484,7 @@ var overviewer = {
|
|||||||
'getMapTypeBackgroundColor': function(mapTypeId) {
|
'getMapTypeBackgroundColor': function(mapTypeId) {
|
||||||
for(i in overviewerConfig.mapTypes) {
|
for(i in overviewerConfig.mapTypes) {
|
||||||
if( overviewerConfig.CONST.mapDivId +
|
if( overviewerConfig.CONST.mapDivId +
|
||||||
overviewerConfig.mapTypes[i].label == mapTypeId ) {
|
overviewerConfig.mapTypes[i].shortname == mapTypeId ) {
|
||||||
overviewer.util.debug('Found background color for: ' +
|
overviewer.util.debug('Found background color for: ' +
|
||||||
overviewerConfig.mapTypes[i].bg_color);
|
overviewerConfig.mapTypes[i].bg_color);
|
||||||
return overviewerConfig.mapTypes[i].bg_color;
|
return overviewerConfig.mapTypes[i].bg_color;
|
||||||
@@ -971,6 +976,11 @@ var overviewer = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'setHash': function(x, y, z, zoom, maptype) {
|
'setHash': function(x, y, z, zoom, maptype) {
|
||||||
|
// remove the div prefix from the maptype (looks better)
|
||||||
|
if (maptype)
|
||||||
|
{
|
||||||
|
maptype = maptype.replace(overviewerConfig.CONST.mapDivId, "");
|
||||||
|
}
|
||||||
window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + maptype);
|
window.location.replace("#/" + Math.floor(x) + "/" + Math.floor(y) + "/" + Math.floor(z) + "/" + zoom + "/" + maptype);
|
||||||
},
|
},
|
||||||
'updateHash': function() {
|
'updateHash': function() {
|
||||||
@@ -1020,7 +1030,20 @@ var overviewer = {
|
|||||||
// We can now set the map to use the 'coordinate' map type
|
// We can now set the map to use the 'coordinate' map type
|
||||||
overviewer.map.setMapTypeId(overviewer.util.getDefaultMapTypeId());
|
overviewer.map.setMapTypeId(overviewer.util.getDefaultMapTypeId());
|
||||||
} else {
|
} else {
|
||||||
overviewer.map.setMapTypeId(maptype);
|
// normalize the map type (this supports old-style,
|
||||||
|
// 'mcmapLabel' style map types, converts them to 'shortname'
|
||||||
|
if (maptype.lastIndexOf(overviewerConfig.CONST.mapDivId, 0) === 0) {
|
||||||
|
maptype = maptype.replace(overviewerConfig.CONST.mapDivId, "");
|
||||||
|
for (i in overviewer.collections.mapTypes) {
|
||||||
|
var type = overviewer.collections.mapTypes[i];
|
||||||
|
if (type.name == maptype) {
|
||||||
|
maptype = type.shortname;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
overviewer.map.setMapTypeId(overviewerConfig.CONST.mapDivId + maptype);
|
||||||
}
|
}
|
||||||
|
|
||||||
overviewer.map.setCenter(latlngcoords);
|
overviewer.map.setCenter(latlngcoords);
|
||||||
|
|||||||
@@ -172,6 +172,10 @@ var overviewerConfig = {
|
|||||||
* the js/html server.
|
* the js/html server.
|
||||||
* imgformat : string. File extension used for these tiles. Defaults to png.
|
* imgformat : string. File extension used for these tiles. Defaults to png.
|
||||||
* overlay : bool. If true, this tile set will be treated like an overlay
|
* overlay : bool. If true, this tile set will be treated like an overlay
|
||||||
|
* bg_color : string. A #RRGGBB format background color.
|
||||||
|
* shortname : string. Used in the dynamic anchor link mechanism. If not
|
||||||
|
* present, label is used instead.
|
||||||
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* 'mapTypes': [
|
* 'mapTypes': [
|
||||||
* {'label': 'Day', 'path': 'lighting/tiles'},
|
* {'label': 'Day', 'path': 'lighting/tiles'},
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ class MapGen(object):
|
|||||||
|
|
||||||
# create generated map type data, from given quadtrees
|
# create generated map type data, from given quadtrees
|
||||||
maptypedata = map(lambda q: {'label' : get_render_mode_label(q.rendermode),
|
maptypedata = map(lambda q: {'label' : get_render_mode_label(q.rendermode),
|
||||||
|
'shortname' : q.rendermode,
|
||||||
'path' : q.tiledir,
|
'path' : q.tiledir,
|
||||||
'bg_color': self.bg_color,
|
'bg_color': self.bg_color,
|
||||||
'overlay' : 'overlay' in get_render_mode_inheritance(q.rendermode),
|
'overlay' : 'overlay' in get_render_mode_inheritance(q.rendermode),
|
||||||
|
|||||||
Reference in New Issue
Block a user