[mapguide-users] Re: Ajax Viewer support for touch devices
psciga
scigalla at battefeld.com
Thu Oct 13 04:19:15 EDT 2011
Hi Nadja,
you are right, HTML is situable for all devices. But I want use some
hardware specifics like menue button or camera. For this I found no (simple)
HTML solutions. Thats's the reason for the Android App.
> ... Probably this solution require more work. ...
Not really. Less then 800 lines of source code (including a lot of comments)
in Basic4Android (B4A). If you are interested, take a look on their
http://www.basic4ppc.com homepage and the
http://www.basic4ppc.com/forum/index.php community . Sorry, it's "only"
Basic, but I like this language.
> ... Which API did you use for this function? Did you make the same with
> HTML solution? ...
In B4A I can use a spcific GPS library. In our browser based Application we
use the HTML 5 geolocation API, as Jackie answered. Here the Code:
###################################
//anfang GPS-Position holen
function getLocation() // called by the menue frame
{
navigator.geolocation.getCurrentPosition(showLocation, showError,
{timeout:40000, enableHighAccuracy:true});
}
function showError(error) {
alert(error.code + ' Fehler' + error.message);
}
function showLocation(position)
{
var hoehe = position.coords.altitude;
var lat = position.coords.latitude;
var lon = position.coords.longitude;
var praez = position.coords.accuracy;
if(navigator.appName.search("Microsoft") > -1)
{
resObjekt = new ActiveXObject("MSXML2.XMLHTTP");
}
else
{
resObjekt = new XMLHttpRequest();
sndReq(lat, lon);
}//if (navigator...)
}
function sndReq(lat,lon)
{
// Koordinaten holen
var link = '../autogis/EAAG_MOBIL_TRANS.PHP?x=' + lon + '&y=' + lat;
resObjekt.open('get', link, true);
resObjekt.onreadystatechange = handleResponse;
resObjekt.send(null);
}
function handleResponse()
{
if(resObjekt.readyState == 4)
{
var skalierung = top.ViewerFrame.mapFrame.GetScale();
var ergebnis = resObjekt.responseText;
var splitter = ergebnis.split("#");
var zx = splitter[0] * 1.0;
var zy = splitter[1] * 1.0;
alert (zx);
alert (zy);
top.ViewerFrame.mapFrame.ZoomToView(zx,zy,skalierung,false);
}
}
###################################
Calling of EAAG_MOBIL_TRANS.PHP is necessary for coordinate transforming,
because we are working in a specific german coordinate system.
Hope this help you a little bit.
Best Regards - Peter
-----
IBB INGENIEURBÜRO BATTEFELD
AutoGIS mit MapGuide Open Source
Bad English? German user.
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Ajax-Viewer-support-for-touch-devices-tp6163993p6888050.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list