Add some testing fields, so that the latitude/longitude can be typed instead of found by geolocation

This commit is contained in:
mossroy 2013-11-26 18:13:02 +01:00
parent ccf3f80117
commit fa580e671f
3 changed files with 15 additions and 2 deletions

View File

@ -74,6 +74,7 @@
</span> </span>
</div> </div>
or <a href="#" id="btnArticlesNearby">Find articles around me (work in progress)</a><br/> or <a href="#" id="btnArticlesNearby">Find articles around me (work in progress)</a><br/>
longitude : <input type="text" id="longitude" /> latitude : <input type="text" id="latitude" /><br/>
<img id="searchingForTitles" src="img/spinner.gif" alt="Please wait..." style="display: none;"/> <img id="searchingForTitles" src="img/spinner.gif" alt="Please wait..." style="display: none;"/>
</form> </form>
</div> </div>

View File

@ -543,7 +543,17 @@ define(function(require) {
alert("Unable to geolocate your device : " + err.code + " : " + err.message); 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 { else {
alert("Geolocation is not supported (or disabled) on your device, or by your browser"); alert("Geolocation is not supported (or disabled) on your device, or by your browser");

View File

@ -839,7 +839,7 @@ define(function(require) {
// 0xFFFF = 65535 in decimal // 0xFFFF = 65535 in decimal
if (selector === 65535) { 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 center = readCoordinates(byteArray, 2);
var lensw = util.readIntegerFrom4Bytes(byteArray, 10); var lensw = util.readIntegerFrom4Bytes(byteArray, 10);
var lense = util.readIntegerFrom4Bytes(byteArray, 14); var lense = util.readIntegerFrom4Bytes(byteArray, 14);
@ -867,6 +867,8 @@ define(function(require) {
if (targetRect.intersect(rectNE)) { if (targetRect.intersect(rectNE)) {
LocalArchive.getTitlesInCoordsInt(localArchive, coordinateFileIndex, pos3, targetRect, rectNE, maxTitles, titlePositionsFound, callbackFunction, callbackGetTitlesInCoordsInt); 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 { else {
// This is a leaf node : let's see if its articles are in the // This is a leaf node : let's see if its articles are in the