Merge branch 'master' into release

This commit is contained in:
Jon Atkins 2014-01-14 11:50:07 +00:00
commit 06df8c91f9
7 changed files with 87 additions and 9 deletions

View File

@ -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

View File

@ -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@@

View File

@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cradle.iitc_mobile"
android:installLocation="auto"
android:versionCode="63"
android:versionName="0.10.2">
android:versionCode="64"
android:versionName="0.10.3">
<uses-sdk
android:minSdkVersion="14"

View File

@ -142,12 +142,16 @@ public final class Log {
public static boolean log(ConsoleMessage message) {
String msg = message.sourceId();
Matcher matcher = URL_PATTERN.matcher(msg);
if (matcher.matches()) {
msg = "<" + matcher.group(1) + "/" + matcher.group(2) + ">";
if (msg == null || "".equals(msg)) {
msg = "<no source>";
} else {
Matcher matcher = URL_PATTERN.matcher(msg);
if (matcher.matches()) {
msg = "<" + matcher.group(1) + "/" + matcher.group(2) + ">";
}
}
if ("".equals(msg)) msg = "<no source>";
msg += ":" + message.lineNumber() + ": " + message.message();
final Integer priority = CONSOLE_MAPPING.get(message.messageLevel());

View File

@ -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:
<ul>
<li>Prefetching does only work for providers which follow the OpenStreetMap tile folder structure (for example: Google or Bing tiles don't work)</li>
<li>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</li>
<li>A recommended tool for downloading tiles can be found <a href="http://wiki.openstreetmap.org/wiki/JTileDownloader">here</a></li>
<ul>
<li>A custom build including MapQuest tiles as default can be found <a href="http://iitcm.code-noobs.org/jTileDownloader-0-6-1-iitc.jar">here</a></li>
</ul>
<li>The easiest way is choosing a Bounding Box (Lat/Lon) via the Slippy Map chooser</li>
<li>On your smartphone, search for your providers tile directory. Mapquest should be in <home directory>/Android/data/com.cradle.iitc_mobile/tiles/mpcdn.com/1.0.0/map/</li>
<li>Finally, copy the content of JTileDownloaders output folder to the appropriate directory on your smartphone</li>
</ul>
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

View File

@ -13,6 +13,17 @@ offers many more features. It is available for
<h3>Latest news</h3>
<h4>13th January 2014</h4>
<p>
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.
</p>
<p>
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.
</p>
<h4>21st December 2013</h4>
<p>
Just in time for the holidays, another IITC update. IITC 0.16.1 and IITC Mobile 0.10.1 have just been released.

View File

@ -1,5 +1,17 @@
<h2>News</h2>
<h4>13th January 2014</h4>
<p>
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.
</p>
<p>
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.
</p>
<h4>21st December 2013</h4>
<p>
Just in time for the holidays, another IITC update. IITC 0.16.1 and IITC Mobile 0.10.1 have just been released.