quick-n-dirty display of min link length instead of portal level for zoom levels <= 14

fix detection of tiles per edge params - array was shorter than before
This commit is contained in:
Jon Atkins 2015-06-25 20:31:00 +01:00
parent 42d5eb4e2f
commit 58a512823f
2 changed files with 41 additions and 11 deletions

View File

@ -50,10 +50,10 @@ window.extractFromStock = function() {
}
if (justInts) {
// current lengths are: 17: ZOOM_TO_LEVEL, 16: TILES_PER_EDGE
// current lengths are: 17: ZOOM_TO_LEVEL, 14: TILES_PER_EDGE
// however, slightly longer or shorter are a possibility in the future
if (topObject.length >= 15 && topObject.length <= 18) {
if (topObject.length >= 13 && topObject.length <= 18) {
// a reasonable array length for tile parameters
// need to find two types:
// a. portal level limits. decreasing numbers, starting at 8
@ -74,7 +74,8 @@ window.extractFromStock = function() {
}
} // end if (topObject[0] == 8)
if (topObject[topObject.length-1] == 36000 || topObject[topObject.length-1] == 18000 || topObject[topObject.length-1] == 9000) {
// 2015-06-25 - changed to top value of 64000 - allow for them to double it just in case
if (topObject[topObject.length-1] >= 9000 && topObject[topObject.length-1] <= 128000) {
var increasing = true;
for (var i=1; i<topObject.length; i++) {
if (topObject[i-1] > topObject[i]) {

View File

@ -7,15 +7,44 @@ window.renderUpdateStatusTimer_ = undefined;
window.renderUpdateStatus = function() {
var progress = 1;
// portal level display
var t = '<span class="help portallevel" title="Indicates portal levels displayed. Zoom in to display lower level portals.">';
// portal/limk level display
var zoom = map.getZoom();
zoom = getDataZoomForMapZoom(zoom);
var minLinkLength;
if (zoom <= 4) minLinkLength = 200000;
else if (zoom <= 6) minLinkLength = 60000;
else if (zoom <= 7) minLinkLength = 10000;
else if (zoom <= 8) minLinkLength = 5000;
else if (zoom <= 10) minLinkLength = 2500;
else if (zoom <= 11) minLinkLength = 800;
else if (zoom <= 12) minLinkLength = 300;
else if (zoom <= 14) minLinkLength = 0; // 0 means 'all links, but not all portals'
else minLinkLength = -1; // -1 means 'all links and portals by min level'
var minlvl = getMinPortalLevel();
var t = '<span class="help portallevel" title="Indicates portal levels/link lengths displayed. Zoom in to display more.">';
if (minLinkLength == -1) {
if(!window.isSmartphone()) // space is valuable
t += '<b>portals</b>: ';
var minlvl = getMinPortalLevel();
if(minlvl === 0)
t+= '<span id="loadlevel">all</span>';
t += '<span id="loadlevel">all</span>';
else
t+= '<span id="loadlevel" style="background:'+COLORS_LVL[minlvl]+'">L'+minlvl+(minlvl<8?'+':'') + '</span>';
t += '<span id="loadlevel" style="background:'+COLORS_LVL[minlvl]+'">L'+minlvl+(minlvl<8?'+':'') + '</span>';
} else {
if(!window.isSmartphone()) // space is valuable
t += '<b>links</b>: ';
if (minLinkLength > 0)
t += '<span id="loadlevel">&gt;'+(minLinkLength>1000?minLinkLength/1000+'km':minLinkLength+'m')+'</span>';
else
t += '<span id="loadlevel">all links</span>';
}
t +='</span>';