//Pete Giencke //pgiencke@glc.org //09.05.05 function loslrs( oKaMap ) { var zoomingInProgress = 0; var startx = null; var starty = null; var endx = null; var endy = null; if(queryThis == 0) //pan cursor { this.cursor = 'move'; } else if (queryThis == 1) //single-click query cursor { this.cursor = 'help'; } else { this.cursor = 'default' //zoombox cursor } kaNavigator.apply( this, [oKaMap] ); this.name = 'loslrs'; this.ID = 'loslrs'; this.gX=null; this.gY=null; /* overload function prototypes */ this.onmousemove = loslrs_onmousemove; this.onmouseout = loslrs_onmouseout; this.onmousedown = loslrs_onmousedown; this.onmouseup = loslrs_onmouseup; } function loslrs_onmouseout(e) { e = (e)?e:((event)?event:null); if (!e.target) e.target = e.srcElement; if (e.target.id == this.kaMap.domObj.id) { this.bMouseDown = false; return kaTool_onmouseout.apply(this, [e]); } } function loslrs_onmousemove(e) { e = (e)?e:((event)?event:null); if(zoomBoxOn == 1 && zoomingInProgress == 1) //grow or shrink the zoombox { if (document.all) { var r = document.all.boundingBox; r.style.width = e.x - r.style.pixelLeft + 38; r.style.height = e.y - r.style.pixelTop + 29; } else if (document.getElementById) { var r = document.getElementById('boundingBox'); r.style.width = e.clientX - parseInt(r.style.left) - 10 + "px"; r.style.height = e.clientY - parseInt(r.style.top) - 10 + "px"; } if (!this.bMouseDown) { return false; } } else { if (!this.bMouseDown) { return false; } if (!this.kaMap.layersHidden) this.kaMap.hideLayers(); var newTop = safeParseInt(this.kaMap.theInsideLayer.style.top); var newLeft = safeParseInt(this.kaMap.theInsideLayer.style.left); newTop = newTop - this.lasty + e.clientY; newLeft = newLeft - this.lastx + e.clientX; this.kaMap.theInsideLayer.style.top=newTop + 'px'; this.kaMap.theInsideLayer.style.left=newLeft + 'px'; kaMap_checkWrap.apply(this.kaMap, []); this.lastx=e.clientX; this.lasty=e.clientY; return false; } } function loslrs_onmousedown(e) { e = (e)?e:((event)?event:null); if (e.button==2) { return this.cancelEvent(e); } if(queryThis == 1) //single-click query { document.getElementById("boundingBox").style.visibility = "hidden"; var aPixPos = this.adjustPixPosition( e.clientX, e.clientY ); var geoCoo= this.kaMap.pixToGeo(aPixPos[0],aPixPos[1]); this.gX = geoCoo[0]; this.gY = geoCoo[1]; this.gX= (parseInt(this.gX*100))/100; this.gY= (parseInt(this.gY*100))/100; var vLayers = getVisibleLayer(); var extent = this.kaMap.getGeoExtents(); var params='x='+this.gX+'&y='+this.gY+'&layer='+vLayers+'&extent='+extent[0]+'|'+extent[1]+'|'+extent[2]+'|'+extent[3]; toSendLink = "showResults3.php?" + params; document.getElementById("dWin").style.visibility = "visible"; document.getElementById("dWin").src = toSendLink; return this.cancelEvent(e); } else if(zoomBoxOn == 1) //start zoomBox { zoomingInProgress = 1; this.cursor = 'default'; if (document.all) { var r = document.all.boundingBox; r.style.width = 0; r.style.height = 0; r.style.pixelLeft = e.x; r.style.pixelTop = e.y; r.style.visibility = 'visible'; } else if (document.getElementById) { var r = document.getElementById("boundingBox"); r.style.width = 0; r.style.height = 0; r.style.left = e.clientX + 'px'; r.style.top = e.clientY + 'px'; r.style.visibility = 'visible'; } startx = e.clientX; starty = e.clientY; return this.cancelEvent(e); } else { if (isIE4) document.onkeydown = kaTool_redirect_onkeypress; document.onkeypress = kaTool_redirect_onkeypress; this.bMouseDown=true; this.lastx=e.clientX; this.lasty=e.clientY; e.cancelBubble = true; e.returnValue = false; if (e.stopPropogation) e.stopPropogation(); if (e.preventDefault) e.preventDefault(); return false; } } function loslrs_onmouseup(e) { e = (e)?e:((event)?event:null); //alert(queryThis); if(zoomBoxOn == 1) //end zoombox { zoomingInProgress = 0; endx = e.clientX; endy = e.clientY; ///////////////////// var aPixPos = this.adjustPixPosition(startx, starty); var geoCoo= this.kaMap.pixToGeo(aPixPos[0],aPixPos[1]); startx = geoCoo[0]; starty = geoCoo[1]; startx = (parseInt(startx*100))/100; starty = (parseInt(starty*100))/100; aPixPos = this.adjustPixPosition(endx, endy); geoCoo= this.kaMap.pixToGeo(aPixPos[0],aPixPos[1]); endx = geoCoo[0]; endy = geoCoo[1]; endx = (parseInt(endx*100))/100; endy = (parseInt(endy*100))/100; //alert(startx + " , " + starty + " , " + endx + " , " + endy); myKaMap.zoomToExtents(startx, starty, endx, endy); //submit zoombox coordinates to the zoomToExtents function document.getElementById("boundingBox").style.visibility = "hidden"; queryThis = 0; return false; } else { this.bMouseDown=false; this.lastx=null; this.lasty=null; this.kaMap.showLayers(); this.kaMap.triggerEvent(KAMAP_EXTENTS_CHANGED, this.kaMap.getGeoExtents()); return false; } } function getVisibleLayer() //rischio { var inputList = document.getElementsByTagName('input'); var a=new Array(); var layerList=""; var n=0; for(i=0;i