/********************************************************************** * * $Id: startUp.js,v 1.8 2006/12/14 17:24:41 lbecchi Exp $ * * purpose: start up code to bootstrap initialization of kaMap within * the sample interface. Examples of using many parts of * the kaMap core api. * * purpose: This is the sample ka-Map interface. Feel free to use it * as the basis for your own applications or just to find out * how ka-Map works. * * author: Lorenzo Becchi and Andrea Cappugi (www.ominiverdi.org) * * ka-Explorer interface has been developer for Food and Agriculture * Organization of the United Nations (FAO-UN) * * ********************************************************************** * * Copyright (c) 2006 Food and Agriculture Organization of the United Nations (FAO-UN) * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * **********************************************************************/ /****************************************************************************** * * To customize startUp: * * 1) modify toolbar Layout * act on screen.css file and modify the funcion myMapInitialized(). * If you change pan and identifyer images edit switchMode() function too. * *****************************************************************************/ var myKaMap = myKaNavigator = myKaQuery = myScalebar = null; var queryParams = null; /** * parse the query string sent to this window into a global array of key = value pairs * this function should only be called once */ function parseQueryString() { queryParams = {}; var s=window.location.search; if (s!='') { s=s.substring( 1 ); var p=s.split('&'); for (var i=0;i

Latitude: ' + roundIt(position.y,8) + '

'; } function myMouseClick(positionx, positiony) { // Made by D10 ! var geopos = document.getElementById('geoPositionClick'); if(geopos) geopos.innerHTML = '

Clicked-Longitude: ' + roundIt(positionx,8) + '

Clicked-Latitude: ' + roundIt(positiony,8) + '

'; var geoposCopy = document.getElementById('geoPositionClickCopy'); if(geoposCopy) geoposCopy.innerHTML = '

Clicked-Longitude: ' + roundIt(positionx,8) + '

Clicked-Latitude: ' + roundIt(positiony,8) + '

'; } function myLayersChanged(eventID, map) { updateLinkToView(); } function updateLinkToView() { var port = (window.location.port)? window.location.port : 80; var url = window.location.protocol+'/'+'/'+window.location.host +':'+ port +''+window.location.pathname+'?'; var extents = myKaMap.getGeoExtents(); var cx = (extents[2] + extents[0])/2; var cy = (extents[3] + extents[1])/2; var cpsURL = 'cps='+cx+','+cy+','+myKaMap.getCurrentScale(); var mapURL = 'map=' + myKaMap.currentMap; var theMap = myKaMap.getCurrentMap(); var aLayers = theMap.getLayers(); var layersURL = 'layers='; var sep = ''; for (var i=0;i' + 'miny: ' + roundIt(extents[1],2) +'
' + 'maxx: ' + roundIt(extents[2],2) +'
' + 'maxy: ' + roundIt(extents[3],2) +'
'; } } function sendLinkToView(email,body) { var mySubject = myUrlEncode('Authomatic ka-Map mail'); var myBody = myUrlEncode(body); location.replace( 'mailto:' + email + '?subject=' + mySubject + '&body=' + body); } /** * called when kaMap tells us the scale has changed */ function myScaleChanged( eventID, scale ) { var oSelect = document.forms[0].scales; if(oSelect){ for (var i=0; i= 1000000) { scale = scale / 1000000; scale = scale + " Million"; } var outString = 'current scale 1:'+ scale; getRawObject('scale').innerHTML = outString; */ } /** * called when the user changes scales. This will cause the map to zoom to * the new scale and trigger a bunch of events, including: * KAMAP_SCALE_CHANGED * KAMAP_EXTENTS_CHANGED */ function mySetScale( scale ) { myKaMap.zoomToScale( scale ); } /** * called when the map selection changes due to the user selecting a new map. * By calling myKaMap.selectMap, this triggers the KAMAP_MAP_INITIALIZED event * after the new map is initialized which, in turn, causes myMapInitialized * to be called */ function mySetMap( name ) { myKaMap.selectMap( name ); } function myQuery( eventID, queryType, coords ) { var szLayers = ''; var layers = myKaMap.getCurrentMap().getQueryableLayers(); //hacked for Single click to query a point --h4rdy4ntz /*if(layers.length==0) { alert("No queryable layers at this scale and extent"); return; }*/ //end for (var i=0;i