From 58a512823fc31c268ab7498abd5a31f499550eb3 Mon Sep 17 00:00:00 2001 From: Jon Atkins Date: Thu, 25 Jun 2015 20:31:00 +0100 Subject: [PATCH] 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 --- code/extract_niantic_parameters.js | 7 +++-- code/status_bar.js | 45 ++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/code/extract_niantic_parameters.js b/code/extract_niantic_parameters.js index d28bbbaf..92049c61 100644 --- a/code/extract_niantic_parameters.js +++ b/code/extract_niantic_parameters.js @@ -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[i]) { diff --git a/code/status_bar.js b/code/status_bar.js index 8aef2bb3..10dd8858 100644 --- a/code/status_bar.js +++ b/code/status_bar.js @@ -7,15 +7,44 @@ window.renderUpdateStatusTimer_ = undefined; window.renderUpdateStatus = function() { var progress = 1; - // portal level display - var t = ''; - if(!window.isSmartphone()) // space is valuable - t += '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(); - if(minlvl === 0) - t+= 'all'; - else - t+= 'L'+minlvl+(minlvl<8?'+':'') + ''; + + + var t = ''; + + if (minLinkLength == -1) { + if(!window.isSmartphone()) // space is valuable + t += 'portals: '; + if(minlvl === 0) + t += 'all'; + else + t += 'L'+minlvl+(minlvl<8?'+':'') + ''; + } else { + if(!window.isSmartphone()) // space is valuable + t += 'links: '; + + if (minLinkLength > 0) + t += '>'+(minLinkLength>1000?minLinkLength/1000+'km':minLinkLength+'m')+''; + else + t += 'all links'; + } + t +='';