var colortype = new Array(); colortype[0] = {id:0, code:'000000'}; colortype[1] = {id:1, code:'FF0000'}; colortype[2] = {id:2, code:'00FF00'}; colortype[3] = {id:3, code:'0000FF'}; colortype[4] = {id:4, code:'FFFFFF'}; var transptype = new Array(); transptype[0] = {id:0, value:'0.5'}; transptype[1] = {id:1, value:'0.55'}; transptype[2] = {id:2, value:'0.6'}; transptype[3] = {id:3, value:'0.65'}; transptype[4] = {id:4, value:'0.7'}; transptype[5] = {id:5, value:'0.75'}; transptype[6] = {id:6, value:'1'}; var widthtype = new Array(); widthtype[0] = {id:0, value:3}; widthtype[1] = {id:1, value:4}; widthtype[2] = {id:2, value:5}; widthtype[3] = {id:3, value:6}; widthtype[4] = {id:4, value:7}; var callbacktype = { srchsidlosuccess:0, srchsidlocomplete:1, srchsidloerror:2, gpsheightsuccess:3, gpsheightcomplete:4, gpsheighterror:5, srchgeosuccess:6, srchgeocomplete:7, srchgeoerror:8, profilesuccess:9, profilecomplete:10, profileerror:11, profileresultsuccess:12, profileresultcomplete:13, profileresulterror:14, importresult:15, elevcalcsuccess:16, elevcalccomplete:17, elevcalcerror:18, elevtimeout:19, exportsuccess:46, exportcomplete:47, exporterror:48, isloggedinsuccess:20, isloggedincomplete:21, isloggedinerror:22, loginsuccess:23, logincomplete:24, loginerror:25, savesuccess:26, savecomplete:27, saveerror:28, loadtracksuccess:29, loadtrackcomplete:30, loadtrackerror:31, ratesuccess:32, ratecomplete:33, rateerror:34, csavesuccess:35, csavecomplete:36, csaveerror:37, crefreshsuccess:38, crefreshcomplete:39, crefresherror:40, reloadsuccess:41, reloadcomplete:42, reloaderror:43, searchfulltimeout:44, searchpartialtimeout:45, getauthbboxsuccess:49, getauthbboxcomplete:50, getauthbboxerror:51 }; var isShiftPressed = false; var callbackarray = new Array(); function addCallback(id, obj, meth) { callbackarray[id] = {id:id, obj:obj, meth:meth}; } function runCallback(id, data) { callbackarray[id].meth.call(callbackarray[id].obj, data); } function DtoDMS(a) { var res = Math.floor(a); res+= "°"; var b = (a - Math.floor(a)) * 60; res+= (Math.floor(b) < 10)?("0" + Math.floor(b)):(Math.floor(b)); res+= "'"; var c = (b - Math.floor(b)) * 60; res+= (Math.floor(c) < 10)?("0" + Math.floor(c)):(Math.floor(c)); res+= '"'; return res; } function evKeyDown(e) { if (e.shiftKey) { isShiftPressed = true; } else { isShiftPressed = false; } return true; } function evKeyUp(e) { if (e.shiftKey) { isShiftPressed = true; } else { isShiftPressed = false; } return true; } function HashControl () { this.idtrack = -1; this.lat = -999; this.lng = -999; this.zoom = -1; this.maptype = -1; this.onsearch = false; this.processHash = processHash; function processHash() { var h = window.location.hash; if (h.substring(0, 1) == '#') h = h.substring(1); hpts = h.split('@'); for (var ti = 0; ti < hpts.length; ti++) { if (hpts[ti].substring(0, 5) == 'track') { this.idtrack = hpts[ti].substring(5); } else if (hpts[ti].substring(0, 3) == 'lat') { this.lat = hpts[ti].substring(3); } else if (hpts[ti].substring(0, 3) == 'lng') { this.lng = hpts[ti].substring(3); } else if (hpts[ti].substring(0, 1) == 'z') { this.zoom = hpts[ti].substring(1); } else if (hpts[ti].substring(0, 2) == 'mt') { this.maptype = hpts[ti].substring(2); } else if (hpts[ti].substring(0, 6) == 'strack') { this.onsearch = true; } } } this.resetHash = resetHash; function resetHash() { this.idtrack = -1; this.lat = -999; this.lng = -999; this.zoom = -1; this.maptype = -1; } this.updateHash = updateHash; function updateHash() { var nstr = ''; if (this.idtrack != -1) { if (nstr.length > 0) nstr+= '@'; nstr+= 'track' + this.idtrack.toString(); } if (this.lat != -999) { if (nstr.length > 0) nstr+= '@'; nstr+= 'lat' + this.lat.toFixed(6); } if (this.lng != -999) { if (nstr.length > 0) nstr+= '@'; nstr+= 'lng' + this.lng.toFixed(6); } if (this.zoom != -1) { if (nstr.length > 0) nstr+= '@'; nstr+= 'z' + this.zoom.toString(); } if (this.maptype != -1) { if (nstr.length > 0) nstr+= '@'; nstr+= 'mt' + this.maptype.toString(); } if (nstr.length > 0) window.location.hash = '#' + nstr; else window.location.hash = ''; } this.positionChange = positionChange; function positionChange(lat, lng, zoom) { this.lat = lat; this.lng = lng; this.zoom = zoom; this.updateHash(); } } var hashControl = new HashControl();