diff --git a/code/map_data_request.js b/code/map_data_request.js index 00b8682b..4b37b308 100644 --- a/code/map_data_request.js +++ b/code/map_data_request.js @@ -177,6 +177,9 @@ window.MapDataRequest.prototype.refresh = function() { this.tileErrorCount = {}; // the 'set' of requested tile QKs + // NOTE: javascript does not guarantee any order to properties of an object. however, in all major implementations + // properties retain the order they are added in. IITC uses this to control the tile fetch order. if browsers change + // then fetch order isn't optimal, but it won't break things. this.queuedTiles = {}; @@ -228,6 +231,11 @@ window.MapDataRequest.prototype.refresh = function() { this.failedTileCount = 0; this.staleTileCount = 0; + var tilesToFetchDistance = {}; + + // map center point - for fetching center tiles first + var mapCenterPoint = map.project(map.getCenter(), zoom); + // y goes from left to right for (var y = y1; y <= y2; y++) { // x goes from bottom to top(?) @@ -255,13 +263,37 @@ window.MapDataRequest.prototype.refresh = function() { this.render.processTileData (old_data); } - // queue a request - this.queuedTiles[tile_id] = tile_id; + // tile needed. calculate the distance from the centre of the screen, to optimise the load order + + var latCenter = (latNorth+latSouth)/2; + var lngCenter = (lngEast+lngWest)/2; + var tileLatLng = L.latLng(latCenter,lngCenter); + + var tilePoint = map.project(tileLatLng, zoom); + + var delta = mapCenterPoint.subtract(tilePoint); + var distanceSquared = delta.x*delta.x + delta.y*delta.y; + + tilesToFetchDistance[tile_id] = distanceSquared; this.requestedTileCount += 1; } } } + // re-order the tile list by distance from the centre of the screen. this should load more relevant data first + var tilesToFetch = Object.keys(tilesToFetchDistance); + tilesToFetch.sort(function(a,b) { + return tilesToFetchDistance[a]-tilesToFetchDistance[b]; + }); + + for (var i in tilesToFetch) { + var qk = tilesToFetch[i]; + + this.queuedTiles[qk] = qk; + } + + + this.setStatus ('loading', undefined, -1); // technically a request hasn't actually finished - however, displayed portal data has been refreshed diff --git a/main.js b/main.js index 1e9bf0d6..24744885 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ // ==UserScript== // @id ingress-intel-total-conversion@jonatkins // @name IITC: Ingress intel map total conversion -// @version 0.16.2.@@DATETIMEVERSION@@ +// @version 0.16.3.@@DATETIMEVERSION@@ // @namespace https://github.com/jonatkins/ingress-intel-total-conversion // @updateURL @@UPDATEURL@@ // @downloadURL @@DOWNLOADURL@@ diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index 0e7dade4..1834beb9 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="64" + android:versionName="0.10.3"> "; + + if (msg == null || "".equals(msg)) { + msg = ""; + } else { + Matcher matcher = URL_PATTERN.matcher(msg); + if (matcher.matches()) { + msg = "<" + matcher.group(1) + "/" + matcher.group(2) + ">"; + } } - if ("".equals(msg)) msg = ""; msg += ":" + message.lineNumber() + ": " + message.message(); final Integer priority = CONSOLE_MAPPING.get(message.messageLevel()); diff --git a/website/page/faq.php b/website/page/faq.php index 2aa798be..e492cc35 100644 --- a/website/page/faq.php +++ b/website/page/faq.php @@ -175,6 +175,25 @@ Note: END ), +'offline-map-tiles' => Array ( "IITC Mobile: Is it possible to prefetch map tiles to reduce data traffic?", +<<<'END' +In fact, you don't have to care about tile caching. On mobile networks, IITCm +downloads tiles only if it's really needed. Tiles are updated only when +connected to WiFi. If you still want to prefetch tiles, go on reading: +
    +
  • Prefetching does only work for providers which follow the OpenStreetMap tile folder structure (for example: Google or Bing tiles don't work)
  • +
  • It is recommended to use the external storage for tile caching, so check it in IITCms settings. Otherwise, your storage is highly limited and you need root access
  • +
  • A recommended tool for downloading tiles can be found here
  • +
      +
    • A custom build including MapQuest tiles as default can be found here
    • +
    +
  • The easiest way is choosing a Bounding Box (Lat/Lon) via the Slippy Map chooser
  • +
  • On your smartphone, search for your providers tile directory. Mapquest should be in /Android/data/com.cradle.iitc_mobile/tiles/mpcdn.com/1.0.0/map/
  • +
  • Finally, copy the content of JTileDownloaders output folder to the appropriate directory on your smartphone
  • +
+END +), + 'debug-data-tiles' => Array ( "What do the colours mean in 'DEBUG Data Tiles'", <<<'END' The data from the Niantic server is download in square tiles. Sometimes requests fail. The colours show this status diff --git a/website/page/home.php b/website/page/home.php index 118bff1d..4d87937c 100644 --- a/website/page/home.php +++ b/website/page/home.php @@ -13,6 +13,17 @@ offers many more features. It is available for

Latest news

+

13th January 2014

+

+A new IITC release, 0.16.2 and IITC Mobile 0.10.2 have been released. These are needed to work with a change to the +standard intel site. +

+

+Additionally, the 'Compute AP Statistics' plugin has been brought back, the 'blank map' base layer has a new black option +to go with the white, and the 'Yandex' base map has had some bug fixes. Also, IITC Mobile features some changes to +the 'show my location' feature. You may need to turn this option on again for it to work. +

+

21st December 2013

Just in time for the holidays, another IITC update. IITC 0.16.1 and IITC Mobile 0.10.1 have just been released. diff --git a/website/page/news.php b/website/page/news.php index 23c1b48b..14164d50 100644 --- a/website/page/news.php +++ b/website/page/news.php @@ -1,5 +1,17 @@

News

+

13th January 2014

+

+A new IITC release, 0.16.2 and IITC Mobile 0.10.2 have been released. These are needed to work with a change to the +standard intel site. +

+

+Additionally, the 'Compute AP Statistics' plugin has been brought back, the 'blank map' base layer has a new black option +to go with the white, and the 'Yandex' base map has had some bug fixes. Also, IITC Mobile features some changes to +the 'show my location' feature. You may need to turn this option on again for it to work. +

+ +

21st December 2013

Just in time for the holidays, another IITC update. IITC 0.16.1 and IITC Mobile 0.10.1 have just been released.