From fa580e671f1aa8a4d379d2c97608b266b1cfcd38 Mon Sep 17 00:00:00 2001 From: mossroy Date: Tue, 26 Nov 2013 18:13:02 +0100 Subject: [PATCH] Add some testing fields, so that the latitude/longitude can be typed instead of found by geolocation --- index.html | 1 + js/app.js | 12 +++++++++++- js/lib/archive.js | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 62966652..10a1354a 100644 --- a/index.html +++ b/index.html @@ -74,6 +74,7 @@ or Find articles around me (work in progress)
+ longitude : latitude :
diff --git a/js/app.js b/js/app.js index 9a663b1c..5469f4ae 100644 --- a/js/app.js +++ b/js/app.js @@ -543,7 +543,17 @@ define(function(require) { alert("Unable to geolocate your device : " + err.code + " : " + err.message); }; - navigator.geolocation.getCurrentPosition(geo_success, geo_error, geo_options); + // TODO : for testing purpose + //navigator.geolocation.getCurrentPosition(geo_success, geo_error, geo_options); + var longitude = $('#longitude').val(); + var latitude = $('#latitude').val(); + var rectangle = new geometry.rect( + longitude - MAX_DISTANCE_ARTICLES_NEARBY, + latitude - MAX_DISTANCE_ARTICLES_NEARBY, + MAX_DISTANCE_ARTICLES_NEARBY * 2, + MAX_DISTANCE_ARTICLES_NEARBY * 2); + + localArchive.getTitlesInCoords(rectangle, MAX_SEARCH_RESULT_SIZE, populateListOfTitles); } else { alert("Geolocation is not supported (or disabled) on your device, or by your browser"); diff --git a/js/lib/archive.js b/js/lib/archive.js index 1a083d70..b2604ef7 100644 --- a/js/lib/archive.js +++ b/js/lib/archive.js @@ -839,7 +839,7 @@ define(function(require) { // 0xFFFF = 65535 in decimal if (selector === 65535) { - // This is an innernode : let's browse it subdivisions + // This is an innernode : let's browse its subdivisions var center = readCoordinates(byteArray, 2); var lensw = util.readIntegerFrom4Bytes(byteArray, 10); var lense = util.readIntegerFrom4Bytes(byteArray, 14); @@ -867,6 +867,8 @@ define(function(require) { if (targetRect.intersect(rectNE)) { LocalArchive.getTitlesInCoordsInt(localArchive, coordinateFileIndex, pos3, targetRect, rectNE, maxTitles, titlePositionsFound, callbackFunction, callbackGetTitlesInCoordsInt); } + // TODO : it seems possible that targetRect does not intersect any of the 4 rectangles + // Iis it normal? In this case, the callback is never called } else { // This is a leaf node : let's see if its articles are in the