var site = 'RPI65';var project = 'Mirante'; var sid = '75a7c84c-ad1c-4385-ae84-09b32cc918b2'; var map = '461'; var loadDefaultMap = false; var projectTitle = ''; var projectWelcometext = ''; var rpwebPath = ''; var lang = 'pt-PT'; var ovOpen = null; var gotoX = null; var gotoY = null; var gotoLat = null; var gotoLon = null; var gotoScale = null; var showResultPin = 0; var vFeatures = null; var meetingpoint = null; var meetingpointX = null; var meetingpointY = null; var meetingpointLat = null; var meetingpointLng = null; var queryNr = ''; var currPanel = 0; var p1 = ''; var p2 = ''; var p3 = ''; var p4 = ''; var p5 = ''; var p6 = ''; var p7 = ''; var p8 = ''; var p9 = ''; var p10 = ''; var p101 = ''; var lang_messen_flaeche = 'Área' var lang_messen_RW = 'M' var lang_messen_HW = 'P' var lang_messen_SegmentLaenge = 'Extensão do segmento' var lang_messen_Gesamtlaenge = 'Extensão total' var lang_messen_Messergebnis = 'Resultado medição' var lang_drucken_Druckoptionen = '' var lang_msg_GM1 = 'As coordenadas est\343o fora dos limites do mapa. O mapa ir\341 ser movido para o centro.' var lang_msg_KoordAusserhalb = 'As coordenadas est\343o fora dos limites do mapa' var lang_msg_RequestWirdVerarbeitet = 'J\341 existe um procedimento em execu\347\343o' var lang_msg_KleinsteZoomStufe = 'Atingiu a escala m\341xima' var lang_msg_GroessteZoomStufe = 'Atingiu a escala m\355nima' var projectLeft = 0; var projectTop = 0; var projectRight = 0; var projectBottom = 0; var projectCoordSystem = "GKZ2"; var loadMapFunctions = true; var pageProperties = null; var headerHeight = 110; //inklusive footer padding zwischen header und content var mapFunctionsHeight = 36; //inklusive rahmen etc.. var panelWidth = 265; var panelPadding = 25; var panelActionWidth = 25; //var panelHeaderHeight = 30; var panelHeaderHeight = 36; var panelBorder = 0; var panelContentContainerPadding = 10; var mapBottomPadding = 5; var mapLeftPadding = 5; var mapRightPadding = 10; //var mapRightPadding = 50; var webserviceTimeout = 30000; var MEASUREpointColor = "#ff0000"; var MEASURElineColor = "#ff0000"; var MEASUREpointWidth = 6; // in px var MEASURElineWidth = 1; // in px var MEASUREfillColor = "#0000ff"; var MEASUREopacity = 50; // in percent //var MEASUREShowPointResultGeografic = true; //var MEASUREPointCoordSystemText = ""; var MEASUREAreaUnit = 3; /*anzeigen von punktmessergebnis in meter und geografisch*/ var MEASUREShowPointResult_Format = "Projectadas (ETRS 89)
{METER}

Geográficas (Long/Lat)
{GEO}"; //{METER} = Meterkoordinate, {GEO} = Geografische Koordinaten var QueryStandardscale = 500; var print_showUsagerequirement = true; /* druckeinstellungen querformat */ var allow_l_print = true; var print_l_width = 1020; var print_l_height = 570; var print_l_info_width = 570; var print_l_info_height = 570; var print_l_doc = "printQuer.aspx"; /* druckeinstellungen hochformat */ var allow_p_print = true; var print_p_width = 760; var print_p_height = 1060; var print_p_info_width = 760; var print_p_info_height = 760; var print_p_doc = "printHoch.aspx"; var print_url_extension = ""; /* class PANEL */ function PANEL() {} PANEL.PanelIsHide = false; PANEL.CurrentPanel = null; PANEL.PanelCount = 0; PANEL.PanelHideCount = 0; PANEL.CurrentPanelID = null; PANEL.HidePanel = function() { step = panelWidth - panelPadding; if (PANEL.PanelIsHide) { $("panelContent").style.display = "block"; //$("panelAction").style.left = (panelWidth-panelActionWidth) + "px"; $("panelAction").style.left = (panelWidth+panelPadding/2) + "px"; //$("mapAreaCollection").style.left = (panelWidth+mapLeftPadding) + "px"; $("mapAreaCollection").style.left = (panelWidth+panelActionWidth+panelPadding/2+mapLeftPadding) + "px"; $("ifPlaceHolderPanel").style.display = "none"; PANEL.PanelIsHide = false; } else { $("panelContent").style.display = "none"; $("panelAction").style.left = "0px"; $("mapAreaCollection").style.left = (panelActionWidth+mapLeftPadding) + "px"; $("ifPlaceHolderPanel").style.display = ""; PANEL.PanelIsHide = true; } InitializeContent(false, false); } PANEL.Open = function (headerId, panelId) { //if(PANEL.CurrentPanel != null && PANEL.CurrentPanel != panelId && headerId == 0) if(PANEL.CurrentPanel != null && headerId == 0) { PANEL.CurrentPanel = null; INGRPT.RefreshPanels(true); } QUERIES.SpeechBubbleClose(); MAP.SetStandard(); this.CloseAll(headerId); this.CurrentPanelID = headerId; this.CurrentPanel = panelId; $(panelId).style.display = "block"; $("panelHeaderLink" + headerId).parentNode.className = "header current"; var headerSize = headerHeight + panelBorder + panelContentContainerPadding; var panelSize = (this.PanelCount - this.PanelHideCount) * panelHeaderHeight; //GUI.SetObjHeight($(panelId), ((pageProperties._height-(headerHeight+panelBorder+panelContentContainerPadding))-1)-(this.PanelCount*panelHeaderHeight)); GUI.SetObjHeight($(panelId), ((pageProperties._height - headerSize) - 1) - panelSize); } PANEL.CloseAll = function (headerId) { this.PanelCount = 0; for (i = 0; i < 15; i++) { if ($("panelContent" + i) != null) { this.PanelCount++; $("panelContent" + i).style.display = "none"; $("panelHeaderLink" + i).parentNode.className = "header"; } } } /* class GUI */ function GUI() {} // set page properties like bodywidth or bodyheight GUI.PageProperties = function() { //screensize without taskbar this._availHeight = screen.availHeight; this._availWidth = screen.availWidth; var x,y; if (self.innerHeight) // all except Explorer { x = self.innerWidth; y = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode { x = document.documentElement.clientWidth; y = document.documentElement.clientHeight; } else if (document.body) // other Explorers { x = document.body.clientWidth; y = document.body.clientHeight; } this._width = x; // body width this._height = y; // body height } //set the width of an object GUI.SetObjWidth = function (obj, nValue) { try { if (parseInt(nValue) < 0) nValue = 0; if (obj != null) obj.style.width = nValue + "px"; } catch (e) { //alert("GUI.SetObjWidth " + obj.id); } } //set the height of an object GUI.SetObjHeight = function (obj, nValue) { try { if (parseInt(nValue) < 0) nValue = 0; if (obj != null) obj.style.height = nValue + "px"; } catch (e) { //alert("GUI.SetObjHeight " + obj.id); } } //returns the width of an object GUI.GetObjWidth = function (obj) { if (obj != null) return parseInt(obj.style.width+0); return -1; } //returns the height of an object GUI.GetObjHeight = function (obj) { if (obj != null) return parseInt(obj.style.height+0); return -1; } GUI.GetMapPixelLeft = function () { //mapLeft = panelWidth; mapLeft = panelWidth + panelActionWidth + panelPadding/2; if (PANEL.PanelIsHide) mapLeft = panelActionWidth; //mapLeft = panelPadding; return mapLeft; } /* class GENERAL */ function GENERAL() {} GENERAL.GetFullMilliseconds = function() { // millisekunden seit dem 1. Januar 1970, 0:00:00 var now = new Date(); return String(now.getTime()); } //if ie return true otherwise return false GENERAL.IsIE = function() { if(typeof ActiveXObject != "undefined") return true; return false; } GENERAL.IsIElt7 = function() { if (GENERAL.IsIE()) if (navigator.appVersion.toUpperCase().indexOf("MSIE 7") == "-1") return true; return false; } GENERAL.IsVML = function() { if(typeof ActiveXObject != "undefined") return true; return false; } GENERAL.HTMLEncode = function(text) { var i,t,c; t=''; c=''; for (i=0;i<=text.length;i++) { c=text.charAt(i); if (c=='<') c='<'; if (c=='>') c='>'; if (c=="'") c='’'; if (c=='ä') c='ä'; if (c=='ö') c='ö'; if (c=='ü') c='ü'; if (c=='Ä') c='Ä'; if (c=='Ö') c='Ö'; if (c=='Ü') c='Ü'; if (c=='&') c='&'; if (c=='_') c=' '; t=t+c; } return t; } GENERAL.IsInArray = function(arr, find) { for (idx9999 = 0; idx9999 < arr.length; idx9999++) { if (arr[idx9999] == find) return true; } return false; } GENERAL.DeleteFromArray = function(arr, needle) { nArray = new Array(); for (idx = 0; idx < arr.length; idx++) { if (arr[idx] != needle) nArray.push(arr[idx]); } return nArray; } GENERAL.LeftPad = function(stringToPad, stringCount, fillCharacter) { var newString = ""; //wenn stringToPad groesser als stringCount dann beschneiden if (stringToPad.length > stringCount) { newString = stringToPad.substring(stringToPad.length-stringCount, stringToPad.length); return newString; } var sb = new StringBuilder(); for (var i = 0; i < stringCount-stringToPad.length; i++) sb.append(fillCharacter); return sb.toString()+stringToPad; } GENERAL.RightPad = function(stringToPad, stringCount, fillCharacter) { var newString = ""; //wenn stringToPad groesser als stringCount dann beschneiden if (stringToPad.length > stringCount) { newString = stringToPad.substring(0, stringCount); return newString; } var sb = new StringBuilder(); for (var i = 0; i < stringCount-stringToPad.length; i++) sb.append(fillCharacter); return stringToPad+sb.toString(); } GENERAL.VersionRequest = null; GENERAL.GetVersion = function() { try { if (this.VersionRequest != null) this.VersionRequest.abort(); reqBody = ""; this.VersionRequest = zXmlHttp.createRequest(); this.VersionRequest.open("POST", "RPWeb_Services.asmx/GetVersion", true); this.VersionRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); this.VersionRequest.onreadystatechange = function () { if (GENERAL.VersionRequest.readyState == 4) { if(GENERAL.VersionRequest.status == 200) ; // do nothing } } this.VersionRequest.send(reqBody); } catch (e) { alert("Error loading Version (1)!\n" + Err.GetErrorMessage(e)); this.VersionRequest = null; } } GENERAL.DynJsRequest = null; GENERAL.LoadJsScript = function(srcUrl) { try { if (this.DynJsRequest != null) this.DynJsRequest.abort(); this.DynJsRequest = zXmlHttp.createRequest(); this.DynJsRequest.open("GET", srcUrl, false); this.DynJsRequest.setRequestHeader("Connection", "close"); this.DynJsRequest.send(); if(this.DynJsRequest.status == 200) alert(this.DynJsRequest.responseText); } catch (e) { alert("Fehler beim Laden der JS-Datei (1)!\n" + Err.GetErrorMessage(e)); this.DynJsRequest = null; } } GENERAL.checkEmail = function(nEmail) { var regex = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/; if (regex.test(nEmail)) return true; else return false; } GENERAL.addToFavorites = function() { if (window.external) { var pageName = document.title; var url = GENERAL.BuildUrl()+"&lang=" + lang; if (window.sidebar) // Mozilla Firefox Bookmark window.sidebar.addPanel(pageName, url,""); else if( window.external ) // IE Favorite window.external.AddFavorite( url, pageName); //window.external.AddFavorite(GENERAL.BuildUrl()+"&lang=" + lang, pageName); } else alert("Sorry! Your browser doesn't support this function."); } GENERAL.BuildUrl = function() { var baseUrl = location.href; if (baseUrl.indexOf("?") > -1) baseUrl = baseUrl.split('?')[0]; else baseUrl += "index.aspx"; return baseUrl + "?project=" +project + "&site=" + site + "&map=" + map + "&x=" + MAP.CenterX + "&y=" + MAP.CenterY + "&scale=" + MAP.arrZoomRanges[MAP.currentZoomRangeIndex] + "&p101=" + p101; } GENERAL.GetObjectcoords = function(ev) { var x; var y; var which; if (GENERAL.IsIE()) { //ie this.x = window.event.offsetX; this.y = window.event.offsetY; this.which = window.event.button; } else { //ns, mozilla this.x = ev.layerX; this.y = ev.layerY; this.which = ev.which; } } GENERAL.GetQueryValue = function(field) { var queryString = window.location.search.substring(1); var queryPairs = queryString.split("&"); for (var i = 0; i < queryPairs.length; i++) { var thisPair = queryPairs[i].split("="); if (thisPair[0] == field) { return thisPair[1]; } } return false; } /* returns checked radiobutton value */ GENERAL.CheckRadiobutton = function (feld) { for (i=0; i"; soapBody += " "; soapBody += " <" + method+ " xmlns=\"" + defaultNamespace + "\">"; for (i = 0; i < parameters.length; i++) soapBody += " <" + parameters[i] + ">" + values[i] + ""; soapBody += " "; soapBody += " "; soapBody += ""; return soapBody; } catch(e) { throw e; } } XmlHelper.GetResultFromSoapRequest = function (defaultNamespace, method, parameters, values, serviceName) { try { soapBody = XmlHelper.GetSoapXml(defaultNamespace, method, parameters, values); oXmlHttp = zXmlHttp.createRequest(); sSoapActionHeader = defaultNamespace + "/" + method; oXmlHttp.open("POST", serviceName, false); oXmlHttp.setRequestHeader("Content-Type", "text/xml"); oXmlHttp.setRequestHeader("SOAPAction", sSoapActionHeader); oXmlHttp.send(soapBody); if(oXmlHttp.status == 200) return oXmlHttp; else throw oXmlHttp.statusText; } catch(e) { throw e; } } XmlHelper.GetResultFromTextFile = function (url) { try { oXmlHttpText = zXmlHttp.createRequest(); oXmlHttpText.open("GET", url, false); //oXmlHttpText.setRequestHeader("Content-Type", "text/html"); oXmlHttpText.send(); if(oXmlHttpText.status == 200) return oXmlHttpText; else throw oXmlHttpText.statusText; } catch(e) { throw e; } } function XmlHelperObj() { this.soapBody = null; this.objXmlHttp = null; } XmlHelperObj.prototype.GetResultFromSoapRequest = function (defaultNamespace, method, parameters, values, serviceName) { try { this.soapBody = this.GetSoapXml(defaultNamespace, method, parameters, values); this.objXmlHttp = zXmlHttp.createRequest(); sSoapActionHeader = defaultNamespace + "/" + method; this.objXmlHttp.open("POST", serviceName, false); this.objXmlHttp.setRequestHeader("Content-Type", "text/xml"); this.objXmlHttp.setRequestHeader("SOAPAction", sSoapActionHeader); this.objXmlHttp.send(this.soapBody); if(this.objXmlHttp.status == 200) return this.objXmlHttp; else throw this.objXmlHttp.statusText; } catch(e) { throw e; } } XmlHelperObj.prototype.GetSoapXml = function (defaultNamespace, method, parameters, values) { try { soapBody = ""; soapBody += " "; soapBody += " <" + method+ " xmlns=\"" + defaultNamespace + "\">"; for (i = 0; i < parameters.length; i++) soapBody += " <" + parameters[i] + ">" + values[i] + ""; soapBody += " "; soapBody += " "; soapBody += ""; return soapBody; } catch(e) { throw e; } } XmlHelperObj.prototype.GetElementValue = function (result, elementname) { try { return result.responseXML.documentElement.getElementsByTagName(elementname)[0].firstChild.data; } catch(e) { return ""; } } function JSON () {} JSON.GetEvalString = function(resultChilds) { //resultChilds = result.responseXML.documentElement.firstChild.firstChild.childNodes[0].childNodes; evalString = ""; for (iResultChilds = 0; iResultChilds < resultChilds.length; iResultChilds++) evalString += resultChilds[iResultChilds].nodeValue; return evalString; } //return some element as object //if no object like e then return null function $(e) { return document.getElementById(e); } // Initializes a new instance of the StringBuilder class // and appends the given value if supplied function StringBuilder(value) { this.strings = new Array(""); this.append(value); } // Appends the given value to the end of this instance. StringBuilder.prototype.append = function (value) { if (value) { this.strings.push(value); } } // Clears the string buffer StringBuilder.prototype.clear = function () { this.strings.length = 1; } // Converts this instance to a String. StringBuilder.prototype.toString = function () { return this.strings.join(""); } function Str() { } Str.IsNullOrEmpty = function(value) { if (value != null && value.length > 0) return false; return true; } /* class Err */ function Err() {} Err.GetErrorMessage = function (e) { return (typeof(e) == "string" ? e : e.message); } // 'Ermittle Nachkommaanteil 131203' function getFrac(num) { num=""+num; return parseFloat("0."+num.substring(num.length-((num.indexOf(".")>=0)?num.length-num.indexOf(".")-1:0),num.length)); } // 'Zahlenumwandlung 131203' (benoetigt getFrac()) function stringInt(num,base,size) { var i, q, sign, result="", baseTable="0123456789ABCDEF"; num=parseInt(num); sign=(num<0)?"-":""; base=parseInt(base); size=(size)?size:0; if(!base || base<=1 || base>baseTable.length) { base=10; } while(true) { q=num/base; result=baseTable.charAt(parseInt(getFrac(q)*base))+result; num=parseInt(q); if(num==0) { break; } } q=""; size-=result.length; for(i=0;i0) { pos=Math.pow(10,pos); return Math.round(num*pos)/pos; } else { return Math.round(num); } } // 'Formatierte Zahlenausgabe 021203' // Formatierung des Integerbereichs function dezInt(num,size,prefix) { prefix=(prefix)?prefix:"0"; var minus=(num<0)?"-":"", result=(prefix=="0")?minus:""; num=Math.abs(parseInt(num,10)); size-=(""+num).length; for(var i=1;i<=size;i++) { result+=""+prefix; } result+=((prefix!="0")?minus:"")+num; return result; } // Formatierung des Fliesskommabereichs (benoetigt getFrac()) function dezFrac(num,size,postfix) { postfix=(postfix)?postfix:"0"; var i, result=getFrac(Math.abs(num)); result=(result)?""+result:""; if(result) { result=result.substring(2,result.length); } size-=result.length; for(i=1;i<=size;i++) { result+=postfix; } return result; } // Formatierung realer Zahlen (benoetigt dezInt() & dezFrac()) function dez(num,presize,postsize,prefix,postfix,fracSign) { fracSign=(fracSign)?fracSign:"."; var result=dezInt(num,presize,prefix)+fracSign+dezFrac(num,postsize,postfix); result=(result.substring(result.length-1,result.length)==fracSign)?result.substring(0,result.length-1):result; return result; } // 'Natuerliche Zufallszahl 130703' (1<=Zahl<=max) function rnd(max) { if(Math.random) { return Math.ceil(Math.max(1,max)*Math.random()); } else { return max; } } // 'Ganze Zufallszahl 060104' (min<=Zahl<=max) function rand(min,max) { var range=max-min+1; if(range>0) { if(Math.random) { return Math.ceil(range*Math.random())+min-1; } else { return max; } } else { return "undefined"; } } function formatZahlTausendertrennzeichen(zahl, trennzeichen,k) { if(!k) k = 0; var neu = ''; // Runden var f = Math.pow(10, k); zahl = '' + parseInt( zahl * f + (.5 * (zahl > 0 ? 1 : -1)) ) / f ; // Komma ermittlen var idx = zahl.indexOf('.'); // Nachkommastellen ermittlen idx = zahl.indexOf('.'); if( idx == -1) idx = zahl.length; else neu = ',' + zahl.substr(idx + 1, k); // Tausendertrennzeichen while(idx > 0) { if(idx - 3 > 0) neu = trennzeichen + zahl.substring( idx - 3, idx) + neu; else neu = zahl.substring(0, idx) + neu; idx -= 3; } return neu; } /*------------------------------------------------------------------------------ * JavaScript zXml Library * Version 1.0.1 * by Nicholas C. Zakas, http://www.nczonline.net/ * Copyright (c) 2004-2005 Nicholas C. Zakas. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *------------------------------------------------------------------------------ */ var zXml = { useActiveX: (typeof ActiveXObject != "undefined"), useDom: document.implementation && document.implementation.createDocument, useXmlHttp: (typeof XMLHttpRequest != "undefined") }; zXml.ARR_XMLHTTP_VERS = ["MSXML2.XmlHttp.5.0", "MSXML2.XmlHttp.4.0", "MSXML2.XmlHttp.3.0", "MSXML2.XmlHttp", "Microsoft.XmlHttp"]; zXml.ARR_DOM_VERS = ["MSXML2.DOMDocument.5.0", "MSXML2.DOMDocument.4.0", "MSXML2.DOMDocument.3.0", "MSXML2.DOMDocument", "Microsoft.XmlDom"]; /** * Static class for handling XMLHttp creation. * @class */ function zXmlHttp() { } /** * Creates an XMLHttp object. * @return An XMLHttp object. */ zXmlHttp.createRequest = function ()/*:XMLHttp*/ { if (zXml.useXmlHttp) { return new XMLHttpRequest(); } else if (zXml.useActiveX) { if (!zXml.XMLHTTP_VER) { for (var i=0; i < zXml.ARR_XMLHTTP_VERS.length; i++) { try { new ActiveXObject(zXml.ARR_XMLHTTP_VERS[i]); zXml.XMLHTTP_VER = zXml.ARR_XMLHTTP_VERS[i]; break; } catch (oError) { } } } if (zXml.XMLHTTP_VER) { return new ActiveXObject(zXml.XMLHTTP_VER); } else { throw new Error("Could not create XML HTTP Request."); } } else { throw new Error("Your browser doesn't support an XML HTTP Request."); } }; /** * Indicates if XMLHttp is available. * @return True if XMLHttp is available, false if not. */ zXmlHttp.isSupported = function ()/*:Boolean*/ { return zXml.useXmlHttp || zXml.useActiveX; }; /** * Static class for handling XML DOM creation. * @class */ function zXmlDom() { } /** * Creates an XML DOM document. * @return An XML DOM document. */ zXmlDom.createDocument = function () /*:XMLDocument*/{ if (zXml.useDom) { var oXmlDom = document.implementation.createDocument("","",null); oXmlDom.parseError = { valueOf: function () { return this.errorCode; }, toString: function () { return this.errorCode.toString() } }; oXmlDom.__initError__(); oXmlDom.addEventListener("load", function () { this.__checkForErrors__(); this.__changeReadyState__(4); }, false); return oXmlDom; } else if (zXml.useActiveX) { if (!zXml.DOM_VER) { for (var i=0; i < zXml.ARR_DOM_VERS.length; i++) { try { new ActiveXObject(zXml.ARR_DOM_VERS[i]); zXml.DOM_VER = zXml.ARR_DOM_VERS[i]; break; } catch (oError) { } } } if (zXml.DOM_VER) { return new ActiveXObject(zXml.DOM_VER); } else { throw new Error("Could not create XML DOM document."); } } else { throw new Error("Your browser doesn't support an XML DOM document."); } }; /** * Indicates if an XML DOM is available. * @return True if XML DOM is available, false if not. */ zXmlDom.isSupported = function ()/*:Boolean*/ { return zXml.useDom || zXml.useActiveX; }; //Code to make Mozilla DOM documents act more like MS DOM documents. var oMozDocument = null; if (typeof XMLDocument != "undefined") { oMozDocument = XMLDocument; } else if (typeof Document != "undefined") { oMozDocument = Document; } if (oMozDocument && !window.opera) { /*oMozDocument.prototype.readyState = 0; oMozDocument.prototype.onreadystatechange = null;*/ oMozDocument.prototype.__changeReadyState__ = function (iReadyState) { this.readyState = iReadyState; if (typeof this.onreadystatechange == "function") { this.onreadystatechange(); } }; oMozDocument.prototype.__initError__ = function () { this.parseError.errorCode = 0; this.parseError.filepos = -1; this.parseError.line = -1; this.parseError.linepos = -1; this.parseError.reason = null; this.parseError.srcText = null; this.parseError.url = null; }; oMozDocument.prototype.__checkForErrors__ = function () { if (this.documentElement.tagName == "parsererror") { var reError = />([\s\S]*?)Location:([\s\S]*?)Line Number (\d+), Column (\d+):([\s\S]*?)(?:\-*\^)/; reError.test(this.xml); this.parseError.errorCode = -999999; this.parseError.reason = RegExp.$1; this.parseError.url = RegExp.$2; this.parseError.line = parseInt(RegExp.$3); this.parseError.linepos = parseInt(RegExp.$4); this.parseError.srcText = RegExp.$5; } }; oMozDocument.prototype.loadXML = function (sXml) { this.__initError__(); this.__changeReadyState__(1); var oParser = new DOMParser(); var oXmlDom = oParser.parseFromString(sXml, "text/xml"); while (this.firstChild) { this.removeChild(this.firstChild); } for (var i=0; i < oXmlDom.childNodes.length; i++) { var oNewNode = this.importNode(oXmlDom.childNodes[i], true); this.appendChild(oNewNode); } this.__checkForErrors__(); this.__changeReadyState__(4); }; oMozDocument.prototype.__load__ = oMozDocument.prototype.load; oMozDocument.prototype.load = function (sURL) { this.__initError__(); this.__changeReadyState__(1); this.__load__(sURL); }; Node.prototype.__defineGetter__("xml", function () { var oSerializer = new XMLSerializer(); return oSerializer.serializeToString(this, "text/xml"); }); Node.prototype.__defineGetter__("text", function () { var sText = ""; for (var i = 0; i < this.childNodes.length; i++) { if (this.childNodes[i].hasChildNodes()) { sText += this.childNodes[i].text; } else { sText += this.childNodes[i].nodeValue; } } return sText; }); } /** * Static class for handling XSLT transformations. * @class */ function zXslt() { } /** * Transforms an XML DOM to text using an XSLT DOM. * @param oXml The XML DOM to transform. * @param oXslt The XSLT DOM to use for the transformation. * @return The transformed version of the string. */ zXslt.transformToText = function (oXml /*:XMLDocument*/, oXslt /*:XMLDocument*/)/*:String*/ { if (typeof XSLTProcessor != "undefined") { var oProcessor = new XSLTProcessor(); oProcessor.importStylesheet(oXslt); var oResultDom = oProcessor.transformToDocument(oXml); var sResult = oResultDom.xml; if (sResult.indexOf(" -1) { sResult = sResult.substring(sResult.indexOf(">") + 1, sResult.lastIndexOf("<")); } return sResult; } else if (zXml.useActiveX) { return oXml.transformNode(oXslt); } else { throw new Error("No XSLT engine found."); } }; /** * Static class for handling XPath evaluation. * @class */ function zXPath() { } /** * Selects the first node matching a given XPath expression. * @param oRefNode The node from which to evaluate the expression. * @param sXPath The XPath expression. * @param oXmlNs An object containing the namespaces used in the expression. Optional. * @return An XML node matching the expression or null if no matches found. */ zXPath.selectNodes = function (oRefNode, sXPath, oXmlNs) { if (typeof XPathEvaluator != "undefined") { oXmlNs = oXmlNs || {}; var nsResolver = function (sPrefix) { return oXmlNs[sPrefix]; }; var oEvaluator = new XPathEvaluator(); var oResult = oEvaluator.evaluate(sXPath, oRefNode, nsResolver, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); var aNodes = new Array; if (oResult != null) { var oElement = oResult.iterateNext(); while(oElement) { aNodes.push(oElement); oElement = oResult.iterateNext(); } } return aNodes; } else if (zXml.useActiveX) { if (oXmlNs) { var sXmlNs = ""; for (var sProp in oXmlNs) { sXmlNs += "xmlns:" + sProp + "=\'" + oXmlNs[sProp] + "\' "; } oRefNode.ownerDocument.setProperty("SelectionNamespaces", sXmlNs); } return oRefNode.selectNodes(sXPath); } else { throw new Error("No XPath engine found."); } }; /** * Selects the first node matching a given XPath expression. * @param oRefNode The node from which to evaluate the expression. * @param sXPath The XPath expression. * @param oXmlNs An object containing the namespaces used in the expression. * @return An XML node matching the expression or null if no matches found. */ zXPath.selectSingleNode = function (oRefNode, sXPath, oXmlNs) { if (typeof XPathEvaluator != "undefined") { oXmlNs = oXmlNs || {}; var nsResolver = function (sPrefix) { return oXmlNs[sPrefix]; }; var oEvaluator = new XPathEvaluator(); var oResult = oEvaluator.evaluate(sXPath, oRefNode, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null); if (oResult != null) { return oResult.singleNodeValue; } else { return null; } } else if (zXml.useActiveX) { if (oXmlNs) { var sXmlNs = ""; for (var sProp in oXmlNs) { sXmlNs += "xmlns:" + sProp + "=\'" + oXmlNs[sProp] + "\' "; } oRefNode.ownerDocument.setProperty("SelectionNamespaces", sXmlNs); } return oRefNode.selectSingleNode(sXPath); } else { throw new Error("No XPath engine found.") } }; /** * General purpose XML serializer. * @class */ function zXMLSerializer() { } /** * Serializes the given XML node into an XML string. * @param oNode The XML node to serialize. * @return An XML string. */ zXMLSerializer.prototype.serializeToString = function (oNode /*:Node*/)/*:String*/ { var sXml = ""; switch (oNode.nodeType) { case 1: //element sXml = "<" + oNode.tagName; for (var i=0; i < oNode.attributes.length; i++) { sXml += " " + oNode.attributes[i].name + "=\"" + oNode.attributes[i].value + "\""; } sXml += ">"; for (var i=0; i < oNode.childNodes.length; i++){ sXml += this.serializeToString(oNode.childNodes[i]); } sXml += ""; break; case 3: //text node sXml = oNode.nodeValue; break; case 4: //cdata sXml = ""; break; case 7: //processing instruction sXml = ""; break; case 8: //comment sXml = ""; break; case 9: //document for (var i=0; i < oNode.childNodes.length; i++){ sXml += this.serializeToString(oNode.childNodes[i]); } break; } return sXml; };var MapAction = { click:"CLICK", zoom:"ZOOM", move:"MOVE", mapChanged:"MAPCHANGED", mapChangedBefore:"MAPCHANGEDBEFORE", isClick : false, isZoom : false, isMove : false, isMapChanged : false, isMeasure : false, isMeetingPlace : false } MapAction.ClickActions = []; MapAction.ZoomActions = []; MapAction.MoveActions = []; MapAction.MapChangedActions = []; MapAction.MapChangedBeforeActions = []; /* class MAP */ function MAP() { } MAP.strLeft = 0; MAP.strTop = 0; MAP.strRight = 0; MAP.strBottom = 0; MAP.strLeftOld = 0; MAP.strTopOld = 0; MAP.strRightOld = 0; MAP.strBottomOld = 0; MAP.arrZoomRanges = new Array(); MAP.currentZoomRangeIndex = null; MAP.outputWidth = null; MAP.outputHeight = null; MAP.Width = null; MAP.Height = null; MAP.resolutionX = null; MAP.resolutionY = null; MAP.CenterX = null; MAP.CenterY = null; MAP.CenterPixelX = null; MAP.CenterPixelY = null; MAP.Scale = null; MAP.mapCount = 0; MAP.ARR_MAP_LOADER = new Array(); // ["0","-1", "2"]; //maps which schould be loaded // 0...Rasterblaster, 1...WebMap, 2...POI, 4...GoogleMaps MAP.Current_VE_GM_Preloaded = null; MAP.layer0_currImgId = null; MAP.layer0_oldImgId = null; MAP.layer1_currImgId = null; MAP.layer1_oldImgId = null; MAP.layer2_currImgId = null; MAP.layer2_oldImgId = null; MAP.layerWMS_currImgId = null; MAP.layerWMS_oldImgId = null; MAP._loadGoogleMap = false; MAP._loadVE = false; MAP._mapsToLoad = 0; MAP._mapsLoaded = 0; MAP.screenX = 0; MAP.screenY = 0; MAP.ClickedX = 0; MAP.ClickedY = 0; MAP.ClickedXOld = 0; MAP.ClickedYOld = 0; MAP.MovedX = 0; MAP.MovedY = 0; MAP.GoogleMap = null; MAP.VE = null; MAP.VE_Tiles = null; MAP.P = 0.26316 / 1000; //pixelfaktor MAP.LoadInterval = null; MAP.IsLoading = false; MAP.IsShowQuery = false; MAP.GoogleMapIsCurrent = false; MAP.VEIsCurrent = false; MAP.VETileLayerMapLoader = null; MAP.mouseIsOverMap = false; MAP.firstRequestIsBack = false; MAP.firstRequestIsBackDone = false; MAP.isFirstStarted = false; MAP.LoaderCount = 0; MAP.Infoquery_Query = null; MAP.Infoquery_Feature = null; MAP.Translucency_Rasterblaster = null; MAP.IsGoogleOrVirtualEarth = false; MAP.AdaptMapList = function (strMaps) { arrMaps = strMaps.split(","); count = $(mapListName).length; for (i = count; i >= 0; i--) { $(mapListName).options[i] = null; } oldMapIsInclude = false; counter = 0; selCounter = -1; for (i = 0; i < arrMaps.length; i++) { if (typeof(MapTypes[arrMaps[i]]) == "string") { sel = false; if (parseInt(arrMaps[i]) == parseInt(map)) { sel = true; oldMapIsInclude = true; selCounter = counter; } $(mapListName).options[counter] = new Option(MapTypes[arrMaps[i]], arrMaps[i], false, sel); counter++; } } $(mapListName).selectedIndex = selCounter; if (!oldMapIsInclude) { $(mapListName).selectedIndex = 0; MAP.ChangeMap(arrMaps[0]); } } MAP.RemoveOldMaps = function() { //delete always not using layers for (idx = 0; idx < $("maps").childNodes.length-6; idx++) { var nodeRemove = $("maps").childNodes[0]; nNode = $("maps").removeChild(nodeRemove); } for (idx = 0; idx < $("pois").childNodes.length-6; idx++) { var nodeRemove = $("pois").childNodes[0]; nNode = $("pois").removeChild(nodeRemove); } } MAP.RemovePOIs = function () { if ($(MAP.layer2_currImgId) != null) $(MAP.layer2_currImgId).innerHTML = ""; } MAP.Clear = function() { $("maps").innerHTML = ""; MAP.LoadGoogleMap(false); MAP.LoadVE(false); } MAP.ClearOverlays = function() { try { QUERIES.SpeechBubbleClose(); $("dSymbols").innerHTML = ""; } catch(e) {} } MAP.poisAvail = false; MAP.LoadMaps = function() { if(MAP.GetLoaderMessage()) return; if (MAP.LoadInterval != null) window.clearInterval(MAP.LoadInterval); //messen ggf nbeu zeichnen MEASURE.Redraw(); MAP.LoadInterval = window.setInterval("MAP.DoLoadMaps()", 400); MAP.DrawZoomRanges(); } MAP.DoLoadMaps = function() { if (MAP.LoadInterval != null) window.clearInterval(MAP.LoadInterval); MAP.AbortAllMapRequests(); MAP.IsLoading = MAP.GetMapIsLoading(); MAP.firstRequestIsBack = false; MAP.firstRequestIsBackDone = false; MAP.InitializeMembers(); if (MAP.arrZoomRanges[MAP.currentZoomRangeIndex]) MAP.SetRangeForScale(MAP.CenterX, MAP.CenterY, MAP.arrZoomRanges[MAP.currentZoomRangeIndex]); MAP.poisAvail = false; this._mapsToLoad = 0; this._mapsLoaded = 0; MAP.isFirstStarted = true; MAP.IsGoogleOrVirtualEarth = false; for (i = 0; i < this.ARR_MAP_LOADER.length; i++) { if(parseInt(this.ARR_MAP_LOADER[i]) == 4 || parseInt(this.ARR_MAP_LOADER[i]) == 5) MAP.IsGoogleOrVirtualEarth = true; } if(MAP.IsGoogleOrVirtualEarth) { $("toolbar").style.display = "none"; $("scaleBar").style.display = "none"; } else { $("toolbar").style.display = "block"; $("scaleBar").style.display = "block"; } if (MAP._loadGoogleMap) { this.LoadMap(4); } else { hasVEMap = GENERAL.IsInArray(this.ARR_MAP_LOADER, 5); for (i = 0; i < this.ARR_MAP_LOADER.length; i++) { if (parseInt(this.ARR_MAP_LOADER[i]) != 2) //not POIS { if (hasVEMap) { if(parseInt(this.ARR_MAP_LOADER[i]) != 5 && parseInt(this.ARR_MAP_LOADER[i]) != 6) this.VETileLayerMapLoader = this.ARR_MAP_LOADER[i]; else this.LoadMap(this.ARR_MAP_LOADER[i]); } else { this._mapsToLoad++; this.LoadMap(this.ARR_MAP_LOADER[i]); } } else MAP.poisAvail = true; } MAP.IsShowQuery = false; } if (MAP.poisAvail) MAP.Handler_LoadPois(); MAP.Handler_LoadOverview(); MAP.LoaderCount++; } MAP.Handler_LoadPois = function() { if(MAP.GoogleMapIsCurrent || MAP.VEIsCurrent) return; if (!MAP.GetMapIsLoading()) { this.LoadMap(2); } else setTimeout("MAP.Handler_LoadPois()", 100); } MAP.Handler_LoadOverview = function() { if(MAP.GoogleMapIsCurrent || MAP.VEIsCurrent) return; if (!MAP.GetMapIsLoading()) { //laden der overview Overview.Load(); } else setTimeout("MAP.Handler_LoadOverview()", 100); } MAP.GetMapIsLoading = function() { if (MAP._mapsToLoad == MAP._mapsLoaded) return false; return true; } MAP.GetLoaderMessage = function() { if (MAP.GetMapIsLoading()) { alert(lang_msg_RequestWirdVerarbeitet); return true; } return false; } MAP.mapRequest0 = null; MAP.mapRequest1 = null; MAP.mapRequest2 = null; MAP.LoadMap = function(which) { this.mapCount++; //return; this.outputWidth = GUI.GetObjWidth($("mapArea")); this.outputHeight = GUI.GetObjHeight($("mapArea")); MAP.GoogleMapIsCurrent = false; MAP.VEIsCurrent = false; if(which == 0) // vektor - cgmcache { this.Loading(true, which); //Sys.Net.WebRequestManager.add_invokingRequest(On_InvokingRequest_0); Intergraph.Respublica.Web.Service.RPWeb_Services.GetMap(sid, project, site, map, this.outputWidth, this.outputHeight, this.strLeft, this.strTop, this.strRight, this.strBottom, which, MAP.MapRequestComplete, OnError0); // Sys.Net.WebRequestManager.remove_invokingRequest(On_InvokingRequest_0); } else if(which == 1 || which == 10) // raster webmap { this.Loading(true, which); Intergraph.Respublica.Web.Service.RPWeb_Services.GetMap(sid, project, site, map, this.outputWidth, this.outputHeight, this.strLeft, this.strTop, this.strRight, this.strBottom, which, MAP.MapRequestComplete, OnError1); } else if(which == 2) // poi { this.Loading(true, which); try { if (this.mapRequest2 != null) this.mapRequest2.abort(); reqBody = "sid=" + sid + "&project=" + project + "&site=" + site + "&map=" + map + "&px=" + this.outputWidth + "&py=" + this.outputHeight + "&left=" + MAP.strLeft + "&top=" + MAP.strTop + "&right=" + MAP.strRight + "&bottom=" + MAP.strBottom + "&type=" + which; this.mapRequest2 = zXmlHttp.createRequest(); this.mapRequest2.open("POST", "RPWeb_Services.asmx/GetPois", true); this.mapRequest2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); this.mapRequest2.onreadystatechange = function () { if (MAP.mapRequest2.readyState == 4) { if(MAP.mapRequest2.status == 200) MAP.POIRequestComplete(MAP.mapRequest2.responseXML); else { if (MAP.mapRequest2.status == 0) { //setTimeout("MAP.LoadMap(2)", 1000); } else { //alert(MAP.mapRequest2.responseText); alert("Error loading POIs (2)!\n" + MAP.mapRequest2.statusText); MAP.Loading(false, 2); } } } } this.mapRequest2.send(reqBody); } catch(e) { this.Loading(false, 2); alert("Error loading POIs (1)!\n" + Err.GetErrorMessage(e)); } } else if(which == 4) // google maps { $("showResult").innerHTML = ""; //MAP.LoadGoogleMap(true); this._mapsToLoad = 0; this._mapsLoaded = 0; MAP.GoogleMapIsCurrent = true; req = GIS2.Server.GeocodeService.GeoCode.GetCoordsForGoogle(MAP.CenterX +","+ MAP.CenterY, projectCoordSystem, MAP.Scale, MAP.Handler_LoadGoogleMap,OnTimeout); } else if(which == 5) // virtual earth { //alert(MAP.LoaderCount); $("showResult").innerHTML = ""; this._mapsToLoad = 0; this._mapsLoaded = 0; MAP.VEIsCurrent = true; //prompt("", MAP.CenterX + " - " + MAP.CenterY + " - " + projectCoordSystem + " - " + MAP.Scale); req = GIS2.Server.GeocodeService.GeoCode.GetCoordsForVE(MAP.CenterX +","+ MAP.CenterY, projectCoordSystem, (MAP.LoaderCount == 0 ? standardScale : MAP.Scale), MAP.Handler_LoadVE,OnTimeout); } } function On_InvokingRequest_0(executor, eventArgs) { AbortExecutor0 = eventArgs.get_webRequest().get_executor(); } MAP.Handler_LoadGoogleMap = function (result) { MAP.LoadGoogleMap(true, result); } MAP.GooglePin = null; MAP.LoadGoogleMap = function (show, coordPair) { if (show) { //alert(parseInt(coordPair.Zoomlevel) + "\n" + MAP.Scale); MAP.GoogleMap = new GMap2(document.getElementById("othermaps")); GEvent.addListener(MAP.GoogleMap, "moveend", function() { var center = MAP.GoogleMap.getCenter().toString().replace("(","").replace(")",""); //alert("hh" + center.toString()); GM.Latitude = center.toString().split(",")[0]; GM.Longitude = center.toString().split(",")[1]; GM.MapChanged_Handler(); }); MAP.GoogleMap.addControl(new GLargeMapControl()); MAP.GoogleMap.addControl(new GOverviewMapControl()); MAP.GoogleMap.addControl(new GScaleControl()); //alert(parseFloat(coordPair.Latitude) + "\n" + parseFloat(coordPair.Longitude) + "\n" + parseInt(coordPair.Zoomlevel)); MAP.GoogleMap.setCenter(new GLatLng(parseFloat(coordPair.Latitude), parseFloat(coordPair.Longitude)), parseInt(coordPair.Zoomlevel)); if (MAP.Current_VE_GM_Preloaded == null || MAP.Current_VE_GM_Preloaded < 2) { MAP.GoogleMap.addMapType(G_PHYSICAL_MAP); MAP.GoogleMap.addControl(new GMapTypeControl()); } else { switch (MAP.Current_VE_GM_Preloaded) { case "2": MAP.GoogleMap.setMapType(G_NORMAL_MAP); break; case "3": MAP.GoogleMap.setMapType(G_SATELLITE_MAP); break; case "4": MAP.GoogleMap.setMapType(G_HYBRID_MAP); break; case "5": MAP.GoogleMap.setMapType(G_PHYSICAL_MAP); break; } } if (meetingpoint != null) { MAP.GoogleMap.setCenter(new GLatLng(parseFloat(meetingpointLat), parseFloat(meetingpointLng)), parseInt(coordPair.Zoomlevel)); meetingpointLng = null; meetingpointLat = null; meetingpoint = null; MeetingPlace.DrawSymbol(); } if (QUERIES.CurrentPinRW != 0 && QUERIES.CurrentPinHW != 0 && QUERIES.Displaybehavior != "0") { imgPin = new Image(); imgPin.src = (QUERIES.CurrentPinImage == null || QUERIES.CurrentPinImage == "" ? "images/standardPin.gif" : QUERIES.CurrentPinImage); imgPinWidth = imgPin.width; imgPinHeight = imgPin.height; var icon = new GIcon(); icon.image = imgPin.src; icon.iconSize = new GSize(imgPinWidth, imgPinHeight); icon.iconAnchor = new GPoint(imgPinWidth/2, imgPinHeight/2); if(MAP.GooglePin) MAP.GoogleMap.removeOverlay(MAP.GooglePin); // MAP.GooglePin = new GMarker(new GLatLng(parseFloat(coordPair.Latitude), parseFloat(coordPair.Longitude)), icon); MAP.GooglePin = new GMarker(new GLatLng(parseFloat(coordPair.Latitude), parseFloat(coordPair.Longitude)), {icon:icon, zIndexProcess:GM.orderOfCreation300}); MAP.GoogleMap.addOverlay(MAP.GooglePin); } if (QUERIES.GoogleMapInfoWindow != null) { //(id, query_id, hasActions, nMarker, primaryKeyColumn, point) GM.GetMarkerDetailinfos(QUERIES.GoogleMapInfoWindow.rel.split("|")[2], QUERIES.GoogleMapInfoWindow.rel.split("|")[3], false, null, QUERIES.GoogleMapInfoWindow.rel.split("|")[4], new GLatLng(parseFloat(coordPair.Latitude), parseFloat(coordPair.Longitude))); QUERIES.GoogleMapInfoWindow = null; } $("othermaps").style.visibility = "visible"; $("uc_map_toolbarContainer").style.display = "none"; if (MapAction.isMapChanged) { MAP.mapChanged(); MapAction.isMapChanged = false; } } else { $("othermaps").style.visibility = "hidden"; $("uc_map_toolbarContainer").style.display = "block"; if (loadMapFunctions) $("mapFunctionsContainer").style.display = "block"; MAP.GoogleMap = null; } } MAP.Handler_LoadVE = function (result) { MAP.LoadVE(true, result); } MAP.LoadVE = function (show, coordPair) { if (show) { coordsLatLon = new VELatLong(parseFloat(coordPair.Latitude), parseFloat(coordPair.Longitude)); //einstiegs koordinaten if (gotoLat != null && gotoLon != null) coordsLatLon = new VELatLong(parseFloat(gotoLat), parseFloat(gotoLon)); // alert(parseInt(coordPair.Zoomlevel)); // alert(coordsLatLon); if (MAP.VE != null) { MAP.VE.SetCenter(coordsLatLon, parseInt(coordPair.Zoomlevel)); center = MAP.VE.GetCenter(); MAP.VE.SetZoomLevel(parseInt(coordPair.Zoomlevel)); mVE.Latitude = center.Latitude; mVE.Longitude = center.Longitude; mVE.MapChanged_Handler(); return; } MAP.VE = new VEMap("othermaps"); if (ve_token != "") MAP.VE.SetClientToken(ve_token); var options = new VEMapOptions(); if(ve_disableBirdseye) options.EnableBirdseye = false; MAP.VE.LoadMap(coordsLatLon, parseInt(coordPair.Zoomlevel), null, null, null, null, null, options); MAP.VE.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers); //var bounds = [new VELatLongRectangle(new VELatLong(49,-123),new VELatLong(47,-121))]; /* var tileSourceSpec = new VETileSourceSpecification("coverage1", "VE_Tiles/coverage1/%4.png"); tileSourceSpec.NumServers = 1; tileSourceSpec.Bounds = bounds; tileSourceSpec.MinZoomLevel = 10; tileSourceSpec.MaxZoomLevel = 18; tileSourceSpec.Opacity = opacity; tileSourceSpec.ZIndex = 100; tileSourceSpec.Opacity = 0.5; MAP.VE.AddTileLayer(tileSourceSpec, false); */ if (MAP.VE_Tiles != null) { for (i = 0; i < MAP.VE_Tiles.length; i++) { tileSourceSpec = new VETileSourceSpecification(MAP.VE_Tiles[i].Name, MAP.VE_Tiles[i].Url); if (MAP.VE_Tiles[i].Opacity != "") tileSourceSpec.Opacity = parseInt(MAP.VE_Tiles[i].Opacity)/100; MAP.VE.AddTileLayer(tileSourceSpec, MAP.VE_Tiles[i].Preloaded == "1" ? true : false); } } if (MAP.Current_VE_GM_Preloaded == null || MAP.Current_VE_GM_Preloaded < 2) { //MAP.GoogleMap.addMapType(G_PHYSICAL_MAP); //MAP.GoogleMap.addControl(new GMapTypeControl()); } else { switch (MAP.Current_VE_GM_Preloaded) { case "2": MAP.VE.SetMapStyle(VEMapStyle.Road); break; case "3": MAP.VE.SetMapStyle(VEMapStyle.Aerial); break; case "4": MAP.VE.SetMapStyle(VEMapStyle.Hybrid); break; case "5": MAP.VE.SetMapStyle(VEMapStyle.Shaded); break; case "6": MAP.VE.AttachEvent("onobliqueenter", MAP.OnObliqueEnterHandler); break; } } center = MAP.VE.GetCenter(); mVE.Latitude = center.Latitude; mVE.Longitude = center.Longitude; mVE.MapChanged_Handler(); MAP.VE.AttachEvent("onendzoom", function() { center = MAP.VE.GetCenter(); mVE.Latitude = center.Latitude; mVE.Longitude = center.Longitude; mVE.MapChanged_Handler(); MAP.HideVEPopupMenu(); }) MAP.VE.AttachEvent("onendpan", function() { center = MAP.VE.GetCenter(); mVE.Latitude = center.Latitude; mVE.Longitude = center.Longitude; mVE.MapChanged_Handler(); MAP.HideVEPopupMenu(); }) MAP.VE.AttachEvent("onclick", MAP.ShowVEPopupMenu) control = document.createElement("div"); control.id = "myControl1"; control.style.top ="70px"; control.style.left = "100px"; control.style.border = "2px solid black"; control.style.background = "White"; control.innerHTML = "clear
"; //MAP.VE.AddControl(control); control = document.createElement("div"); control.id = "myControl"; control.style.top ="100px"; control.style.left = "100px"; control.style.border = "2px solid black"; control.style.background = "White"; control.innerHTML = "my control"; //MAP.VE.AddControl(control); $("othermaps").style.visibility = "visible"; $("uc_map_toolbarContainer").style.display = "none"; if (MapAction.isMapChanged) { MAP.mapChanged(); MapAction.isMapChanged = false; } } else { $("othermaps").innerHTML = ""; $("othermaps").style.visibility = "hidden"; $("uc_map_toolbarContainer").style.display = "block"; if (loadMapFunctions) $("mapFunctionsContainer").style.display = "block"; MAP.VE = null; } } MAP.OnObliqueEnterHandler = function () { if (MAP.VE.IsBirdseyeAvailable()) { MAP.VE.SetMapStyle(VEMapStyle.Birdseye); // So we don't repeatedly reset map style MAP.VE.DetachEvent("onobliqueenter", MAP.OnObliqueEnterHandler); } } MAP.VE_RightClickedLL = null; MAP.ShowVEPopupMenu = function(e) { var x = e.mapX; var y = e.mapY; pixel = new VEPixel(x, y); var LL = MAP.VE.PixelToLatLong(pixel); if (e.rightMouseButton) { MAP.VE_RightClickedLL = LL; var x = MAP.VE.GetLeft(); var y = MAP.VE.GetTop(); var menu = document.getElementById('VEpopupmenu'); menu.style.display='block'; //Showing the menu menu.style.left = (e.mapX) + "px"; //Positioning the menu menu.style.top = (e.mapY) + "px"; } } MAP.HideVEPopupMenu = function() { document.getElementById('VEpopupmenu').style.display='none'; } MAP.Loading = function (load, mapType) { if (!load) $("cogs" + mapType).style.display = "none"; else $("cogs" + mapType).style.display = "block"; } MAP.loaderRequest = null; MAP.scaleLastMap = null; MAP.ClearSessionFeatures = true; MAP.ChangeMap = function (nMap) { document.body.focus(); if (nMap!='301') { $("usagerequirement").style.display = 'block'; $("usagerequirement").innerHTML = 'GeoEye'; } //gm einschraenken if(MAP.GoogleMap != null) { if (MAP.CenterX < projectLeft || MAP.CenterX > projectRight || MAP.CenterY > projectTop || MAP.CenterY < projectBottom) { x = projectLeft + ((projectRight-projectLeft)/2); y = projectBottom + ((projectTop-projectBottom)/2); alert(lang_msg_GM1); MAP.strLeft = Math.round(parseInt(x) - (MAP.outputWidth/2)); MAP.strRight = Math.round(parseInt(x) + (MAP.outputWidth/2)); MAP.strTop = Math.round(parseInt(y) + (MAP.outputHeight/2)); MAP.strBottom = Math.round(parseInt(y) - (MAP.outputHeight/2)); MAP.InitializeMembers(); } //alert(MAP.CenterX); //alert(MAP.CenterY); } $("LInfoButton").style.display = "none"; MAP.mapChangedBefore(); MAP.AbortAllMapRequests(); MAP.RemovePOIs(); MAP.ClearOverlays(); MAP.Clear(); MAP.HideVEPopupMenu(); MAP.scaleLastMap = MAP.arrZoomRanges[MAP.currentZoomRangeIndex]; if (vFeatures == null && MAP.ClearSessionFeatures) MAP.ClearSessionfilter("MAP.VISIBLE.FEATURES." + map); if (nMap == null) nMap = map; map = nMap; // set new map //quieries zur map if ($("panel_queries_map_id") != null) { $("panel_queries_map_id").value = map; AspAjaxExtend.PostBackHiddenField("HiddenFieldUpdatePanelRefreshClientId"); } MapAction.isMapChanged = true; if (MAP.loaderRequest != null) MAP.loaderRequest.abort(); MAP.loaderRequest = Intergraph.Respublica.Web.Service.RPWeb_Services.GetMapLoader("", site, project, nMap, MAP.InitializeMaps, OnError); if (nMap!=null) { //setTimeout("INGRPT.HidePanelsByMap(" + nMap + ")", 1000); setTimeout("INGRPT.DisablePanelsByMap(" + nMap + ")", 1000); } } MAP.LoadOverviewConfiguration = function() { //overview konfiguration laden try { var xmlOvProperties = new XmlHelperObj(); resultOvProperties = xmlOvProperties.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetOverviewProperties", ["sid", "project", "site", "map"], [sid, project, site, map], "RPWeb_Services.asmx"); Overview.ImgUrl = resultOvProperties.responseXML.documentElement.getElementsByTagName("overviewUrl")[0].firstChild.data; Overview.Zoomranges = resultOvProperties.responseXML.documentElement.getElementsByTagName("overviewZoomrange")[0].firstChild.data; Overview.Map = resultOvProperties.responseXML.documentElement.getElementsByTagName("overviewMap")[0].firstChild.data; Overview.MapType = resultOvProperties.responseXML.documentElement.getElementsByTagName("overviewMapType")[0].firstChild.data; if (String(Overview.Zoomranges) == "-1") { Overview.IsStatic = true; Overview.Left = projectLeft; Overview.Top = projectTop; Overview.Right = projectRight; Overview.Bottom = projectBottom; nWidth = Overview.Right - Overview.Left; nHeight = Overview.Top - Overview.Bottom; if (nWidth < nHeight) { Overview.Left = (Overview.Left+Overview.Right)/2 - (nHeight/2); Overview.Right = (Overview.Left+Overview.Right)/2 + (nHeight/2); } else { Overview.Top = (Overview.Top + Overview.Bottom)/2 + (nWidth/2); Overview.Bottom = (Overview.Top + Overview.Bottom)/2 - (nWidth/2); } } else { Overview.IsStatic = false; } } catch(e) { //alert("Error config Overview." + e.message); } } MAP.GetOneImageForCurrentMapItems = function() { //overview konfiguration laden try { var MapXmlHelperObj = new XmlHelperObj(); resultMap = MapXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetOneImageForCurrentMap", ["sid", "project", "site", "px", "py", "left", "top", "right", "bottom", "map", "returnServerPath"], [sid, project, site, MAP.outputWidth, MAP.outputHeight, MAP.strLeft, MAP.strTop, MAP.strRight, MAP.strBottom, map, "false"], "RPWeb_Services.asmx"); return resultMap.responseXML.documentElement.getElementsByTagName("GetOneImageForCurrentMapResult")[0].firstChild.data; } catch(e) { } } MAP.SetSessionfilter = function(key, value) { try { var SfXmlHelperObj = new XmlHelperObj(); SfXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", "SetSessionfilter", ["sid", "site", "key", "value"], [sid, site, key, value], "RPWeb_Services.asmx"); } catch(e) { alert(e.message); } } MAP.ClearSessionfilter = function(key) { try { var SfXmlHelperObj = new XmlHelperObj(); SfXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", "ClearSessionfilter", ["sid", "site", "key"], [sid, site, key], "RPWeb_Services.asmx"); } catch(e) { } } MAP.GetOneImageForCurrentMapItems = function() { //overview konfiguration laden try { var MapXmlHelperObj = new XmlHelperObj(); resultMap = MapXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetOneImageForCurrentMap", ["sid", "project", "site", "px", "py", "left", "top", "right", "bottom", "map", "returnServerPath"], [sid, project, site, MAP.outputWidth, MAP.outputHeight, MAP.strLeft, MAP.strTop, MAP.strRight, MAP.strBottom, map, "false"], "RPWeb_Services.asmx"); return resultMap.responseXML.documentElement.getElementsByTagName("GetOneImageForCurrentMapResult")[0].firstChild.data; } catch(e) { } } MAP.AbortAllMapRequests = function() { MAP.Loading(false, 0); MAP.Loading(false, 1); MAP.Loading(false, 2); } //array get filled with all loaders MAP.InitializeMaps = function(result) { QUERIES.ResetPin(); MAP.Infoquery_Query = null; MAP.Infoquery_Feature = null; MAP.Translucency_Rasterblaster = null; MAP.VE_Tiles = null; isStart = false; if (MAP.ARR_MAP_LOADER.length == 0) isStart = true; MAP.ARR_MAP_LOADER = new Array(); MAP.Current_VE_GM_Preloaded = null; hasGoogleMap = false; hasVE = false; for (i = 0; i < result.length; i ++) { MAP.ARR_MAP_LOADER.push(result[i].Type); if (!hasGoogleMap && result[i].Type == 4) hasGoogleMap = true; if (!hasVE && result[i].Type == 5) hasVE = true; if (result[i].Type == 4 || result[i].Type == 5) MAP.Current_VE_GM_Preloaded = result[i].Preloaded; //ve tiles if (result[i].Type == 6) { evString = "(" + result[i].JSON + ")"; MAP.VE_Tiles = eval(evString); } if (result[i].Infoquery_Query != "") MAP.Infoquery_Query = result[i].Infoquery_Query; if (result[i].Infoquery_Feature != "") MAP.Infoquery_Feature = result[i].Infoquery_Feature; if (result[i].Translucency_Rasterblaster != "") MAP.Translucency_Rasterblaster = result[i].Translucency_Rasterblaster; } if (MAP.Infoquery_Feature != null && MAP.Infoquery_Query != null) $("LInfoButton").style.display = "block"; MAP._loadGoogleMap = false; MAP._loadVE = false; MAP.GoogleMap = null; MAP.VE = null; if (MAP.ARR_MAP_LOADER.length == 0) MAP._loadGoogleMap = true; MAP.InitializeZoomRanges(map); if (!isStart) MAP.LoadMaps(); else { //erster start FirstStart(); } if(!hasGoogleMap) MAP.LoadOverviewConfiguration(); } MAP.SetRangeForScale = function (x, y, scale) { MAP.strLeft = Math.round(parseInt(x) - (scale*MAP.P*MAP.outputWidth/2)); MAP.strRight = Math.round(parseInt(x) + (scale*MAP.P*MAP.outputWidth/2)); MAP.strTop = Math.round(parseInt(y) + (scale*MAP.P*MAP.outputHeight/2)); MAP.strBottom = Math.round(parseInt(y) - (scale*MAP.P*MAP.outputHeight/2)); //MAP.CorrectRange(); MAP.InitializeMembers(); //set current zoom index for (i = 0; i 0) { MAP.currentZoomRangeIndex = MAP.arrZoomRanges.length-1 MAP.SetRangeForScale(MAP.CenterX, MAP.CenterY, MAP.arrZoomRanges[MAP.currentZoomRangeIndex]); } MAP.DrawZoomRanges(); } catch(e) { msg = (typeof(e) == "string" ? e : e.message); alert("An error occurred please refresh Page. (MAP.InitializeZoomRanges)\n" + msg); } } MAP.DrawZoomRanges = function () { strHtmlRanges = ""; for (i = 0; i < MAP.arrZoomRanges.length; i++) { strHtmlRanges += "\"M"; } $("dZoomRanges").innerHTML = strHtmlRanges; } MAP.GotoScale = function(scale, checkCurrentScale) { if (checkCurrentScale) { //aalves 07/09/2010 - Colocação do GeoEye nos mapas à escala 130000 e 100000 if (scale =='130000' || scale =='100000' ) { $("usagerequirement").style.display = 'block'; $("usagerequirement").innerHTML = 'GeoEye'; } else { $("usagerequirement").style.display = 'none'; } if (scale == MAP.arrZoomRanges[MAP.currentZoomRangeIndex]) return; } MAP.RemovePOIs(); MAP.ZoomToXY(MAP.CenterX, MAP.CenterY, scale, false); MAP.ClearOverlays(); } MAP.MapRequestComplete = function(result) { MAP._mapsLoaded++; MAP.strLeft = parseInt(result.mapLeft); MAP.strTop = parseInt(result.mapTop); MAP.strRight = parseInt(result.mapRight); MAP.strBottom = parseInt(result.mapBottom); MAP.InitializeMembers(); if (MapAction.isZoom) { MAP.zoom(); MapAction.isZoom = false; } else { MAP.mapMoved(); if ((QUERIES.Displaybehavior == "0" || QUERIES.Displaybehavior == "1") && $("showResult").style.display == "block") QUERIES.ResetPin(); } if (MapAction.isMapChanged) { MAP.mapChanged(); MapAction.isMapChanged = false; } if (MapAction.isMeasure) { //MEASURE.Reset(true); //MapAction.isMeasure = false; } setTimeout("MAP.ShowResultPin()", 200); //window.status = MAP.strLeft + " | " + MAP.strTop + " | " + MAP.strRight + " | " + MAP.strBottom + " Karte: " + MAP.outputWidth + "px * " + MAP.outputHeight + "px"; window.status = MAP.strLeft + " | " + MAP.strTop + " | " + MAP.strRight + " | " + MAP.strBottom; mapType = parseInt(result.mapType); if (!MAP.firstRequestIsBack && !MAP.firstRequestIsBackDone) MAP.firstRequestIsBack = true; if (mapType == 0) { MAP.layer0_oldImgId = MAP.layer0_currImgId; MAP.layer0_currImgId = "map_" + MAP.mapCount + "_" + GENERAL.GetFullMilliseconds(); MAP.setImageSrc(result.url, MAP.layer0_currImgId, mapType); $(MAP.layer0_currImgId).style.left = "0px"; $(MAP.layer0_currImgId).style.top = "0px"; MAP.mapRequest0 = null; } else if (mapType == 1 || mapType == 10) { MAP.layer1_oldImgId = MAP.layer1_currImgId; MAP.layer1_currImgId = "map_" + MAP.mapCount + "_" + GENERAL.GetFullMilliseconds(); MAP.setImageSrc(result.url, MAP.layer1_currImgId, mapType); $(MAP.layer1_currImgId).style.left = "0px"; $(MAP.layer1_currImgId).style.top = "0px"; MAP.mapRequest1 = null; } //window.status = "finish"; MAP.Loading(false, mapType); } MAP.AddWMSLayer = function(url) { MAP.layerWMS_oldImgId = MAP.layerWMS_currImgId; MAP.layerWMS_currImgId = "map_20_" + GENERAL.GetFullMilliseconds(); MAP.setImageSrc(url, MAP.layerWMS_currImgId, 20); $(MAP.layerWMS_currImgId).style.left = "0px"; $(MAP.layerWMS_currImgId).style.top = "0px"; } var gmarkers=[]; MAP.POIRequestComplete = function(result) { try { poiList = result.documentElement.getElementsByTagName("POI"); if(MAP.GoogleMap != null) { //alle marker löschen for (i = 0; i < gmarkers.length; i++) MAP.GoogleMap.removeOverlay(gmarkers[i]); gmarkers = []; //MAP.GoogleMap.clearOverlays(); for (i = 0; i < poiList.length; i++) { arrImgDetail = poiList[i].firstChild.data.split("||"); //if (i==0) // alert(arrImgDetail); if (arrImgDetail[5] != "") { var imgChk = new Image(); imgChk.src = arrImgDetail[4]; poiW = imgChk.width; poiH = imgChk.height; var icon = new GIcon(); icon.image = arrImgDetail[4]; icon.iconSize = new GSize(poiW, poiH); icon.iconAnchor = new GPoint(poiW/2, poiH/2); icon.infoWindowAnchor = new GPoint(poiW/2, poiH/2); var point = new GLatLng(arrImgDetail[5],arrImgDetail[6]); newMarker = GM.CreateMarker(point, icon, arrImgDetail[0], arrImgDetail[4], arrImgDetail[7], arrImgDetail[8], arrImgDetail[9], arrImgDetail[1]); gmarkers.push(newMarker); MAP.GoogleMap.addOverlay(newMarker); } } } else if (MAP.VE != null) { if (mVE.poiLayer != null) MAP.VE.DeleteShapeLayer(mVE.poiLayer); mVE.poiLayer = new VEShapeLayer(); MAP.VE.AddShapeLayer(mVE.poiLayer); var poi_i = null; var poiShapes = new Array(); //$("myControl").innerHTML += "pois: " + poiList.length+ "
"; for (i = 0; i < poiList.length; i++) { arrImgDetail = poiList[i].firstChild.data.split("||"); einsetzpunkt = 5; if (arrImgDetail.length > 10) einsetzpunkt = parseInt(arrImgDetail[10], 10); poiImg = new Image(); poiImg.src = arrImgDetail[4]; poiLatLng = new VELatLong(parseFloat(arrImgDetail[5]), parseFloat(arrImgDetail[6])); poiLatLngPixel = MAP.VE.LatLongToPixel(poiLatLng); poiLatLngPixel.x = poiLatLngPixel.x-14; poiLatLngPixel.y = poiLatLngPixel.y-14; if (poiImg.width == 0) poiImg.width = 20; if (poiImg.height == 0) poiImg.height = 20; switch (einsetzpunkt) { case 1: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x+poiImg.width, poiLatLngPixel.y+poiImg.height)); break; case 2: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x+(poiImg.width/2), poiLatLngPixel.y+poiImg.height)); break; case 3: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x, poiLatLngPixel.y+poiImg.height)); break; case 4: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x+poiImg.width, poiLatLngPixel.y+(poiImg.height/2))); break; case 6: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x, poiLatLngPixel.y+(poiImg.height/2))); break; case 7: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x+poiImg.width, poiLatLngPixel.y)); break; case 8: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x+(poiImg.width/2), poiLatLngPixel.y)); break; case 9: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x, poiLatLngPixel.y)); break; default: poiLatLngEinsetzpunkt = MAP.VE.PixelToLatLong(new VEPixel(poiLatLngPixel.x + (poiImg.width/2), poiLatLngPixel.y+ (poiImg.height/2))); //standard = 5; } poi_i = new VEShape(VEShapeType.Pushpin, poiLatLngEinsetzpunkt); poi_i.SetTitle(arrImgDetail[1]); poi_i.SetCustomIcon(""); poi_i.SetZIndex = 200; poiShapes.push(poi_i); } mVE.poiLayer.AddShape(poiShapes); } else { MAP.layer2_oldImgId = MAP.layer2_currImgId; MAP.layer2_currImgId = "map_" + MAP.mapCount + "_" + GENERAL.GetFullMilliseconds(); zIndex = 3; for (i = 0; i < MAP.ARR_MAP_LOADER.length; i++) if (MAP.ARR_MAP_LOADER[i] == 2) zIndex = i+1; sbPoi = new StringBuilder() sbPoi.append("
"); currImgSrc = ""; poiW = 0; poiH = 0; for (i = 0; i < poiList.length; i++) { arrImgDetail = poiList[i].firstChild.data.split("||"); if (currImgSrc != arrImgDetail[4]) { imgChk = new Image(); imgChk.src = arrImgDetail[4]; poiW = imgChk.width; poiH = imgChk.height; currImgSrc = arrImgDetail[4]; } sbPoi.append("" + arrImgDetail[1] + ""); } sbPoi.append("
"); $("pois").innerHTML += sbPoi.toString(); if ($(MAP.layer2_oldImgId) != null) $(MAP.layer2_oldImgId).style.display = "none"; } } catch(e) { //alert("Error loading POIs!\n" + Err.GetErrorMessage(e)); } MAP.mapRequest2 = null; MAP.Loading(false, 2); } MAP.setImageSrc = function(imgSrc, imgId, mapType) { zIndex = 0; /* for (i = 0; i < this.ARR_MAP_LOADER.length; i++) if (this.ARR_MAP_LOADER[i] == mapType) zIndex = i; */ /* if (mapType == 0) //Rasterblaster { setTimeout("MAP.HideMap('" + this.layer0_oldImgId + "')", 0); if ($(this.layer0_oldImgId) != null) $(this.layer0_oldImgId).style.zIndex = "3"; } else if (mapType == 1 || mapType == 10) //webmap { setTimeout("MAP.HideMap('" + this.layer1_oldImgId + "')", 0); if ($(this.layer1_oldImgId) != null) $(this.layer1_oldImgId).style.zIndex = "1"; } */ if (MAP.firstRequestIsBack && !MAP.firstRequestIsBackDone) { setTimeout("MAP.HideMap('" + this.layer0_oldImgId + "')", 0); setTimeout("MAP.HideMap('" + this.layer1_oldImgId + "')", 0); setTimeout("MAP.HideMap('" + this.layerWMS_oldImgId + "')", 0); MAP.firstRequestIsBackDone = true; if(mapType == 0) setTimeout("MAP.HideMap('" + this.layer1_currImgId + "')", 0); else setTimeout("MAP.HideMap('" + this.layer0_currImgId + "')", 0); } //MAP.Translucency_Rasterblaster styleTranslucency = ""; if (mapType == 1 || mapType == 10) { zIndex = 1; } else if(mapType == 20) { zIndex = 2; } else { zIndex = 5; if (MAP.Translucency_Rasterblaster != null && MAP.Translucency_Rasterblaster != "") styleTranslucency = "filter:Alpha(opacity: " + MAP.Translucency_Rasterblaster + ");-moz-opacity: " + (MAP.Translucency_Rasterblaster/100)+ ";"; } strHtml = ''; $("maps").innerHTML += strHtml; this.RemoveOldMaps(); } MAP.HideMap = function(elem) { if ($(elem) != null) $(elem).style.display = "none"; } MAP.GetPixelXFromWorldCoord = function (coordX) { return (Math.round((coordX - MAP.strLeft) / MAP.resolutionX)); } MAP.GetPixelYFromWorldCoord = function (coordY) { return (Math.round((MAP.strTop - coordY) / MAP.resolutionY)); } MAP.GetPixelFromMeterX = function (distance) { return Math.round(distance / MAP.resolutionX); } MAP.GetPixelFromMeterY = function (distance) { return Math.round(distance / MAP.resolutionY); } MAP.GetMeterFromPixelX = function (coordX) { return Math.round(MAP.strLeft+(coordX * MAP.resolutionX)); } MAP.GetMeterFromPixelY = function (coordY) { return Math.round(MAP.strTop-(coordY * MAP.resolutionY)); } MAP.GetMeterForPixelX = function (coordX) { return Math.round(coordX * MAP.resolutionX); } MAP.GetMeterForPixelY = function (coordY) { return Math.round(coordY * MAP.resolutionY); } //------------Adicionado 13-01-2010 (Henrique Souto)--------------------- MAP.GetMeterFromPixelXMeas = function (coordX) { return Math.round((MAP.strLeft+(coordX * MAP.resolutionX))*1000)/1000; } MAP.GetMeterFromPixelYMeas = function (coordY) { return Math.round((MAP.strTop-(coordY * MAP.resolutionY))*1000)/1000; } //----------------------------------------------------------------------- MAP.InitializeMembers = function () { MAP.outputWidth = GUI.GetObjWidth($("mapArea")); MAP.outputHeight = GUI.GetObjHeight($("mapArea")); MAP.Width = MAP.strRight - MAP.strLeft; MAP.Height = MAP.strTop - MAP.strBottom; MAP.resolutionX = MAP.Width / MAP.outputWidth; MAP.resolutionY = MAP.Height / MAP.outputHeight; MAP.CenterX = Math.round(MAP.strLeft + (MAP.Width/2)); MAP.CenterY = Math.round(MAP.strBottom + (MAP.Height/2)); MAP.CenterPixelX = Math.round(MAP.outputWidth/2); MAP.CenterPixelY = Math.round(MAP.outputHeight/2); //MAP.Scale = Math.round(MAP.Width*MAP.P); MAP.Scale = Math.round((MAP.Width*7.27)/2); //masstabsleiste setzten ScaleBar.Adjust(); } MAP.ZoomToXY = function (x, y, scale, result) { if (MAP.VE == null && MAP.GoogleMap == null) { if (x < projectLeft || x > projectRight || y < projectBottom || y > projectTop) { alert(lang_msg_KoordAusserhalb); return; } } if (WheelWorldXDiff != null && WheelWorldYDiff != null) { MAP.MoveToXY(x-WheelWorldXDiff, y-WheelWorldYDiff); WheelWorldXDiff = null; WheelWorldYDiff = null; } else MAP.MoveToXY(x, y); oldWidth = MAP.Width; oldHeight = MAP.Height; oldCenterX = MAP.CenterX; oldCenterY = MAP.CenterY; MAP.SetRangeForScale(x, y, scale); //mapimage anpassen tmpWidth = MAP.GetPixelFromMeterX(oldWidth); tmpHeight = MAP.GetPixelFromMeterY(oldHeight); faktorX =oldWidth/ MAP.Width; faktorY =oldHeight/MAP.Height; if ($(MAP.layer0_currImgId) != null) { GUI.SetObjWidth($(MAP.layer0_currImgId), tmpWidth); GUI.SetObjHeight($(MAP.layer0_currImgId), tmpHeight); $(MAP.layer0_currImgId).style.left = ((MAP.CenterPixelX-(tmpWidth/2)) + (parseInt($(MAP.layer0_currImgId).style.left+0)*faktorX) ) + "px"; $(MAP.layer0_currImgId).style.top = ((MAP.CenterPixelY-(tmpHeight/2)) + (parseInt($(MAP.layer0_currImgId).style.top+0)*faktorY) ) + "px"; } if ($(MAP.layer1_currImgId) != null) { GUI.SetObjWidth($(MAP.layer1_currImgId), tmpWidth); GUI.SetObjHeight($(MAP.layer1_currImgId), tmpHeight); $(MAP.layer1_currImgId).style.left = ((MAP.CenterPixelX-(tmpWidth/2)) + (parseInt($(MAP.layer1_currImgId).style.left+0)*faktorX) ) + "px"; $(MAP.layer1_currImgId).style.top = ((MAP.CenterPixelY-(tmpHeight/2)) + (parseInt($(MAP.layer1_currImgId).style.top+0)*faktorY) ) + "px"; } MapAction.isZoom = true; showResult1 = false; if (typeof(result) == "boolean") showResult1 = result; if (showResult1) { QUERIES.CurrentPinRW = x; QUERIES.CurrentPinHW = y; } else { } if ((QUERIES.Displaybehavior == "0" || QUERIES.Displaybehavior == "1") && $("showResult").style.display == "block") { /*QUERIES.CurrentPinRW = 0; QUERIES.CurrentPinHW = 0; */ QUERIES.ResetPin(); } MAP.LoadMaps(); } MAP.ShowResultPin = function() { //alert(QUERIES.CurrentPinRW +"\n"+ QUERIES.CurrentPinHW +"\n"+ QUERIES.Displaybehavior); if (QUERIES.CurrentPinRW != 0 && QUERIES.CurrentPinHW != 0 && QUERIES.Displaybehavior != "0") { imgPin = new Image(); imgPin.src = (QUERIES.CurrentPinImage == null || QUERIES.CurrentPinImage == "" ? "images/standardPin.gif" : QUERIES.CurrentPinImage); imgPinWidth = imgPin.width; imgPinHeight = imgPin.height; if(imgPinWidth > 0 && imgPinHeight > 0) { $("showResult").innerHTML = ''; $("imgResultPin").style.left = (MAP.GetPixelXFromWorldCoord(QUERIES.CurrentPinRW)-(imgPinWidth/2)) + "px"; $("imgResultPin").style.top = (MAP.GetPixelYFromWorldCoord(QUERIES.CurrentPinHW)-(imgPinHeight/2)) + "px"; } else { $("showResult").innerHTML = ''; $("imgResultPin").style.left = (MAP.GetPixelXFromWorldCoord(QUERIES.CurrentPinRW)-5) + "px"; $("imgResultPin").style.top = (MAP.GetPixelYFromWorldCoord(QUERIES.CurrentPinHW)-5) + "px"; } $("showResult").style.display = "block"; //if(QUERIES.Displaybehavior == "1") // QUERIES.ResetPin(); } else $("showResult").style.display = "none"; QUERIES.RePlaceSpeechbubble(); } MAP.MoveToXY = function (x, y) { MAP.MoveAllLayers(MAP.GetPixelFromMeterX(MAP.CenterX-x), MAP.GetPixelFromMeterY(y-MAP.CenterY)); } MAP.MoveAllLayers = function (x, y) { try { if(MAP.GetMapIsLoading()) return; MAP.HideMap(MAP.layer0_oldImgId); MAP.HideMap(MAP.layer1_oldImgId); allLayers = [MAP.layer0_currImgId, MAP.layer1_currImgId, MAP.layer2_currImgId, "imgResultPin", "detailInfo", MAP.layerWMS_currImgId]; //add symbols if ($("dSymbols").getElementsByTagName("img").length > 0) { for (t = 0; t < $("dSymbols").getElementsByTagName("img").length; t++) { allLayers.push($("dSymbols").getElementsByTagName("img")[t].id); } } //projektrange anpassen diffX = MAP.GetMeterForPixelX(x); diffY = MAP.GetMeterForPixelY(y); MAP.strRight = MAP.strRight-diffX; MAP.strLeft = MAP.strLeft-diffX; MAP.strTop = MAP.strTop+diffY; MAP.strBottom = MAP.strBottom+diffY; //if (MAP.CenterX < projectLeft || MAP.CenterX > projectRight || MAP.CenterY > projectTop || MAP.CenterY < projectBottom) MAP.MovedX += x; MAP.MovedY += y; for (i = 0; i < allLayers.length; i++) { if ($(allLayers[i]) != null) { //alert(allLayers[i] + "\n" + ((parseInt($(allLayers[i]).style.left+0)+x))); $(allLayers[i]).style.left = ((parseInt($(allLayers[i]).style.left+0)+x)) + "px"; $(allLayers[i]).style.top = ((parseInt($(allLayers[i]).style.top+0)+y)) + "px"; } } } catch(e) { //alert(x +"\n" + y); } //MAP.ShowResultPin(); MAP.CorrectRange(); } MAP.CorrectRange = function() { //auf projectgrenzen einschraenken if (MAP.strLeft < projectLeft) { MAP.strLeft = projectLeft; MAP.strRight = MAP.strLeft + MAP.Width; } if (MAP.strRight > projectRight) { MAP.strRight = projectRight; MAP.strLeft = MAP.strRight - MAP.Width; } if (MAP.strTop > projectTop) { MAP.strTop = projectTop; MAP.strBottom = MAP.strTop - MAP.Height; } if (MAP.strBottom < projectBottom) { MAP.strBottom = projectBottom; MAP.strTop = MAP.strBottom + MAP.Height; } MAP.InitializeMembers(); } MAP.CheckRange = function() { x = MAP.GetMeterFromPixelX(MAP.screenX); y = MAP.GetMeterFromPixelY(MAP.screenY); if (MAP.VE == null && MAP.GoogleMap == null) { if (x < projectLeft || x > projectRight || y < projectBottom || y > projectTop) { alert(lang_msg_KoordAusserhalb); return false; } } return true; } MAP.isPan = false; MAP.click = function(ev) { screenCoords = new MAP.GetScreencoords(ev); MAP.ClickedXOld = screenCoords.x; MAP.ClickedYOld = screenCoords.y; var DynFunction; for (idxMapClickArr = 0; idxMapClickArr < MapAction.ClickActions.length; idxMapClickArr++) { DynFunction = new Function("coordsObj", String(MapAction.ClickActions[idxMapClickArr] + "(coordsObj);")); DynFunction(new MAP.GetScreencoords(ev)); } //wenn messen, treffpunkt kartenklick deaktiviert if (MapAction.isMeasure || MapAction.isMeetingPlace || MapAction.isClick) return false; MAP.isPan = true; return false; } MAP.dblClick = function(ev) { if (!MAP.CheckRange()) return; WheelWorldXDiff = MAP.CenterX - MAP.GetMeterFromPixelX(MAP.screenX); WheelWorldYDiff = MAP.CenterY - MAP.GetMeterFromPixelY(MAP.screenY); MAP.CenterX = MAP.GetMeterFromPixelX(MAP.screenX); MAP.CenterY = MAP.GetMeterFromPixelY(MAP.screenY); TOOLBAR.ZoomIn(false); //MAP.ZoomToXY(MAP.CenterX, MAP.CenterY, MAP.Scale); return false; } MAP.clickUp = function(ev) { screenCoords = new MAP.GetScreencoords(ev); MAP.ClickedX = screenCoords.x; MAP.ClickedY = screenCoords.y; MAP.isPan = false; if (!MapAction.isMeasure && !MapAction.isMeetingPlace && !MapAction.isClick) //deaktivate pan if measure MAP.ExecutePan(); return false; } MAP.mouseMove = function(ev) { screenCoords = new MAP.GetScreencoords(ev); currX = screenCoords.x; currY = screenCoords.y; MAP.screenX = currX; MAP.screenY = currY; //window.status = MapAction.isMeetingPlace + " " + MAP.screenX + " : " + MAP.screenY + " " + MAP.GetMeterFromPixelX(currX) + " " + MAP.GetMeterFromPixelY(currY) + " --- " + MAP.strLeft + " | " + MAP.strTop + " | " + MAP.strRight + " | " + MAP.strBottom + " Karte: " + MAP.outputWidth + "px * " + MAP.outputHeight + "px"; if (MAP.isPan) { //MAP.ClearOverlays(); $("dMapAction").style.zIndex = 10000; if (MAP.mouseIsOverMap) { cDiffX = MAP.screenX - MAP.ClickedXOld; cDiffY = MAP.screenY - MAP.ClickedYOld; MAP.MoveAllLayers(cDiffX-MAP.MovedX, cDiffY-MAP.MovedY); //window.status = "panen"; } } else { $("dMapAction").style.zIndex = 5; MAP.MovedX = 0; MAP.MovedY = 0; } return false; } MAP.zoom = function(ev) { var DynFunction; for (idxMapZoomArr = 0; idxMapZoomArr < MapAction.ZoomActions.length; idxMapZoomArr++) { DynFunction = new Function("coordsObj", String(MapAction.ZoomActions[idxMapZoomArr] + "();")); DynFunction(); } return false; } MAP.mapChanged = function(ev) { var DynFunction; for (idxMapActionArr = 0; idxMapActionArr < MapAction.MapChangedActions.length; idxMapActionArr++) { DynFunction = new Function("", String(MapAction.MapChangedActions[idxMapActionArr] + "();")); DynFunction(); } return false; } MAP.mapChangedBefore = function(ev) { var DynFunction; for (idxMapActionArr = 0; idxMapActionArr < MapAction.MapChangedBeforeActions.length; idxMapActionArr++) { DynFunction = new Function("", String(MapAction.MapChangedBeforeActions[idxMapActionArr] + "();")); DynFunction(); } return false; } MAP.mapMoved = function(ev) { var DynFunction; for (idxMapMoveArr = 0; idxMapMoveArr < MapAction.MoveActions.length; idxMapMoveArr++) { DynFunction = new Function("", String(MapAction.MoveActions[idxMapMoveArr] + "();")); DynFunction(); } return false; } MAP.ExecutePan = function() { if (MAP.GetMapIsLoading()) { alert(lang_msg_RequestWirdVerarbeitet); return true; } if (MAP.ClickedX != MAP.ClickedXOld) { /* cDiffX = MAP.ClickedX - MAP.ClickedXOld; cDiffY = MAP.ClickedY - MAP.ClickedYOld; diffX = MAP.GetMeterForPixelX(cDiffX); diffY = MAP.GetMeterForPixelY(cDiffY); MAP.strRight = MAP.strRight-diffX; MAP.strLeft = MAP.strLeft-diffX; MAP.strTop = MAP.strTop+diffY; MAP.strBottom = MAP.strBottom+diffY; MAP.MoveAllLayers(cDiffX, cDiffY); */ MAP.MovedX = 0; MAP.MovedY = 0; MAP.LoadMaps(); } } MAP.AddEventListener = function (wich, functionToCall) { switch (wich) { case MapAction.click: if (!GENERAL.IsInArray(MapAction.ClickActions, String(functionToCall))) MapAction.ClickActions.push(String(functionToCall)); break; case MapAction.move: if (!GENERAL.IsInArray(MapAction.MoveActions, String(functionToCall))) MapAction.MoveActions.push(String(functionToCall)); break; case MapAction.zoom: if (!GENERAL.IsInArray(MapAction.ZoomActions, String(functionToCall))) MapAction.ZoomActions.push(String(functionToCall)); break; case MapAction.mapChanged: if (!GENERAL.IsInArray(MapAction.MapChangedActions, String(functionToCall))) MapAction.MapChangedActions.push(String(functionToCall)); break; case MapAction.mapChangedBefore: if (!GENERAL.IsInArray(MapAction.MapChangedBeforeActions, String(functionToCall))) MapAction.MapChangedBeforeActions.push(String(functionToCall)); break; } } MAP.RemoveEventListener = function (wich, functionToRemove) { switch (wich) { case MapAction.click: MapAction.ClickActions = GENERAL.DeleteFromArray(MapAction.ClickActions, String(functionToRemove)); break; case MapAction.move: MapAction.MoveActions = GENERAL.DeleteFromArray(MapAction.MoveActions, String(functionToRemove)); break; case MapAction.zoom: MapAction.ZoomActions = GENERAL.DeleteFromArray(MapAction.ZoomActions, String(functionToRemove)); break; case MapAction.mapChanged: MapAction.MapChangedActions = GENERAL.DeleteFromArray(MapAction.MapChangedActions, String(functionToRemove)); break; case MapAction.mapChangedBefore: MapAction.mapChangedBefore = GENERAL.DeleteFromArray(MapAction.MapChangedBeforeActions, String(functionToRemove)); break; } } MAP.GetScreencoords = function(ev) { var x; var y; var which; if (GENERAL.IsIE()) { //ie this.x = window.event.offsetX; this.y = window.event.offsetY; this.which = window.event.button; } else { //ns, mozilla this.x = ev.layerX; this.y = ev.layerY; this.which = ev.which; } } MAP.SetStandard = function () { document.images["mapAction"].onmousedown = MAP.click; document.images["mapAction"].onmouseup = MAP.clickUp; document.images["mapAction"].onmousemove = MAP.mouseMove; document.images["mapAction"].onmouseover = function () { MAP.mouseIsOverMap = true; return false; }; document.images["mapAction"].onmouseout = function () { MAP.mouseIsOverMap = false; return false; }; document.images["mapAction"].style.cursor = "pointer"; //MapAction.ClickActions = new Array(); //MapAction.ZoomActions = new Array(); $("pois").style.zIndex = "6"; } //MAP.setMouseInMap = //MAP.setMouseOutOfMap = function OnAborted(request, userContext) { var errorString = "The call to '" + userContext + "' failed, request is aborted!"; // alert(errorString); } function OnTimeout(request, userContext) { var timeoutString = "The call to '" + request + "\n" + userContext + "' failed due to time out!"; alert(timeoutString); } function OnError(error) { var stackTrace = error.get_stackTrace(); var message = error.get_message(); var statusCode = error.get_statusCode(); var exceptionType = error.get_exceptionType(); var timedout = error.get_timedOut(); var errorString = "Stack Trace: " + stackTrace + "\n" + "Service Error: " + message + "\n" + "Status Code: " + statusCode + "\n" + "Exception Type: " + exceptionType + "\n" + "Timedout: " + timedout; alert(errorString); } function OnError0(error) { MAP.Loading(false, 0); MAP._mapsToLoad--; OnError(error); } function OnError1(error) { MAP.Loading(false, 1); MAP._mapsToLoad--; OnError(error); } MAP.GetDefaultMap = function () { try { oXmlHttp = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetDefaultMap", ["sid", "site", "project"], [sid, site, project], "RPWeb_Services.asmx"); map = parseInt(oXmlHttp.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes[1].firstChild.data); } catch(e) { throw "Keine Defaultmap gefunden. (MAP.GetDefaultMap)"; } } MAP.SetMembers = function () { // alert("Bitte warten"); try { result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetProjectProperties", ["sid", "project", "site"], [sid, project, site], "RPWeb_Services.asmx"); properties = result.responseXML.documentElement.firstChild.firstChild.firstChild.childNodes; projectLeft = parseInt(properties[0].firstChild.data); projectTop = parseInt(properties[1].firstChild.data); projectRight = parseInt(properties[2].firstChild.data); projectBottom = parseInt(properties[3].firstChild.data); MAP.strLeft = projectLeft; MAP.strTop = projectTop; MAP.strRight = projectRight; MAP.strBottom = projectBottom; projectTitle = ""; try { projectTitle = properties[4].firstChild.data; document.title = projectTitle; } catch(e) {alert(Err.GetErrorMessage(e));} try { projectWelcometext = properties[5].firstChild.data; } catch(e) {alert(Err.GetErrorMessage(e));} try { projectCoordSystem = properties[6].firstChild.data; if (projectCoordSystem == "LAMBERT_47_5") { projectCoordSystem = "LAMBERT_47,5"; } } catch(e) {alert(Err.GetErrorMessage(e));} try { rpwebPath = properties[7].firstChild.data; } catch(e) {alert(Err.GetErrorMessage(e));} if ((projectLeft == "0" && projectRight == "0") || (projectLeft == "" && projectRight == "")) throw "Keine Projektkoordinaten vorhanden."; //falls features in der url übergeben wurden > in session tabelle schreiben if (vFeatures != null) MAP.SetSessionfilter("MAP.VISIBLE.FEATURES."+map, vFeatures); } catch(e) { msg = (typeof(e) == "string" ? e : e.message); throw "Fehler (MAP.SetMembers). \n" + msg; } } MAP.GetCoordsAndOpenUrl = function(url) { if(MAP.GoogleMap != null) { GEvent.addListener(MAP.GoogleMap, "click", function(marker, point) { if (marker) { try { map.removeOverlay(marker); } catch(e){} } else { GM.SetClickedCoords(point, true); var nUrl = url+"&sid=" + sid + "&lat="+ GM.LatitudeClicked + "&lon=" + GM.LongitudeClicked + "&x=" + MAP.ClickedX + "&y=" + MAP.ClickedY; MAP.OpenPage(nUrl); } }); } } MAP.OpenPage = function (url) { window.open(url, "bohrstelle", "width=800,height=700"); } MAP.loadUsagerequirement = function() { text = ""; try { //var xmlH = new XmlHelperObj(); //resultU = xmlH.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetUsagerequirement", ["sid", "site","project", "map"], [sid, site, project, map], "RPWeb_Services.asmx"); //text = resultU.responseXML.documentElement.firstChild.firstChild.childNodes[0].firstChild.data; //aalves 08/09/2010 - Para que esta funcionalidade esteja garantida não está a ser usado o webservice //Colocação do GeoEye nos mapas à escala 130000 e 100000 scale=MAP.arrZoomRanges[MAP.currentZoomRangeIndex]; if (scale=='130000' || scale=='100000') { $("usagerequirement").style.display = 'block'; $("usagerequirement").innerHTML = 'GeoEye'; } else { $("usagerequirement").style.display = 'none'; } } catch(e) {} // $("usagerequirement").innerHTML = text; } MAP.GetDetailInfoFromSession = function() { try { var SfXmlHelperObj = new XmlHelperObj(); result = SfXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetSessionfilter", ["sid", "site", "key"], [sid, site, "QUERY.DETAIL"], "RPWeb_Services.asmx"); return SfXmlHelperObj.GetElementValue(result, "GetSessionfilterResult"); } catch(e) { //alert(e.message); return ""; } } /* GoogleMaps class GM */ function GM() {} GM.Latitude = null; GM.Longitude = null; GM.LatitudeClicked = null; GM.LongitudeClicked = null; GM.MapTimeout = null; GM.orderOfCreation100 = function (marker,b) { return 100; } GM.orderOfCreation200 = function (marker,b) { return 200; } GM.orderOfCreation300 = function (marker,b) { return 300; } GM.ZoomToCoordinates = function (latlong, scale) { if(MAP.GoogleMap != null) MAP.GoogleMap.setCenter(latlong, scale); } GM.SetClickedCoords = function (point, setMarker) { cPoint = point.toString().replace("(","").replace(")","").replace(" ","").trim(); GM.LatitudeClicked = cPoint.split(",")[0].trim(); //y GM.LongitudeClicked = cPoint.split(",")[1].trim(); //x result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformFromGeografic", ["coordPairs", "coordSystem"], [cPoint, projectCoordSystem], "GeoCode.asmx"); coords = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes[0].firstChild.data; MAP.ClickedX = coords.split("|")[0]; MAP.ClickedY = coords.split("|")[1]; if (setMarker) MAP.GoogleMap.addOverlay(new GMarker(point)); } GM.MapChanged_Handler = function () { if (!MAP.GoogleMap.isLoaded()) return; if (GM.MapTimeout != null) window.clearInterval(GM.MapTimeout); GM.MapTimeout = window.setInterval("GM.MapChanged()", 800); } GM.MapChanged = function () { window.clearInterval(GM.MapTimeout); var bounds = MAP.GoogleMap.getBounds(); var southWest = bounds.getSouthWest(); var northEast = bounds.getNorthEast(); cPoints = southWest.lat() + "," + southWest.lng() + "|" + northEast.lat() + "," + northEast.lng(); result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformFromGeografic", ["coordPairs", "coordSystem"], [cPoints, projectCoordSystem], "GeoCode.asmx"); lastChild = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes; MAP.strLeft = Math.round(lastChild[0].firstChild.data.split("|")[0]); MAP.strTop = Math.round(lastChild[1].firstChild.data.split("|")[1]); MAP.strRight = Math.round(lastChild[1].firstChild.data.split("|")[0]); MAP.strBottom = Math.round(lastChild[0].firstChild.data.split("|")[1]); //window.status = MAP.strLeft + " | " + MAP.strTop + " | " + MAP.strRight + " | " + MAP.strBottom + " Karte: " + MAP.outputWidth + "px * " + MAP.outputHeight + "px " + cPoints; window.status = MAP.strLeft + " | " + MAP.strTop + " | " + MAP.strRight + " | " + MAP.strBottom; MAP.InitializeMembers(); MAP.mapMoved(); if (MAP.poisAvail) MAP.LoadMap(2); } // Creates a marker for Poi GM.CreateMarker = function (point, icon, id, tooltip, query_id, hasActions, primaryKeyColumn, title) { //marker[i] = new GMarker(point,{title:"Tooltip", zIndexProcess:sendBack, icon:cm_baseIcon}); var marker = new GMarker(point, {title:title, icon:icon, zIndexProcess:GM.orderOfCreation100}); //icon); // nUrl = "http://193.187.212.65/gis2Forms/formgeneratorWithTabs.aspx?name=TAEPBN_BOHRUNG&nodeid=1&workflow=BOHRUNG&savesession=true&id=" + id + "&sid=" + sid; //marker.title = title; GEvent.addListener(marker, "click", function() { //GM.GetMarkerDetailinfos(marker); GM.GetMarkerDetailinfos(id, query_id, hasActions, marker, primaryKeyColumn); }); return marker; } GM.InfoActionsRequest = null; GM.CurrentMarker = null; GM.GetMarkerDetailinfos = function (id, query_id, hasActions, nMarker, primaryKeyColumn, point) { infowindowPoint = null; if (nMarker != null) { nMarker.openInfoWindowHtml("
Infos werden geladen. Bitte warten...
"); GM.CurrentMarker = nMarker; infowindowPoint = nMarker.getPoint(); } else infowindowPoint = point; htmlInfoA = escape(String(QUERIES.GetDetailInfoHtml(id, query_id, primaryKeyColumn))).split("%A7%A7%A7%A7"); htmlInfo = unescape(htmlInfoA[0]) + "
" + unescape(htmlInfoA[1]); htmlActions = ""; if (hasActions != "0") { try { serviceUrl = hasActions.split(",")[0]; //kann auch eine aspxseite sein serviceMethod = hasActions.split(",")[1]; if (GM.InfoActionsRequest != null) GM.InfoActionsRequest.abort(); reqUrlParam = "method=" + serviceMethod + "&sid=" + sid + "&project=" + project + "&site=" + site + "&query_id=" + query_id + "&id=" + id + "&m=" + GENERAL.GetFullMilliseconds(); GM.InfoActionsRequest = zXmlHttp.createRequest(); GM.InfoActionsRequest.open("GET", serviceUrl+ (serviceUrl,indexOf("?") == -1 ? "?" : "") +reqUrlParam, false); GM.InfoActionsRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); GM.InfoActionsRequest.send(null); if(GM.InfoActionsRequest.status == 200) { htmlActions = GM.InfoActionsRequest.responseText; GM.InfoRequest = null; } else { //alert("Erro a carregar a Legenda (2)!\n" + GM.InfoRequest.statusText); } } catch (e) { GM.InfoActionsRequest = null; } } if(htmlActions.length > 0) //blase mit tabs { var infoTabs = [ new GInfoWindowTab("Info", "
" + htmlInfo.replace("§§§§", "
") + "
"), new GInfoWindowTab("Aktion", "
" + htmlActions + "
") ]; MAP.GoogleMap.openInfoWindowTabsHtml(infowindowPoint, infoTabs); } else MAP.GoogleMap.openInfoWindowHtml(infowindowPoint, "
" + htmlInfo.replace("§§§§", "
") + "
"); } GM.points=[]; GM.markers=[]; GM.lines=[]; GM.polygonPoints=[]; GM.polygon=null; GM.lineWidth=5; GM.lineColor='#ff0000'; GM.closerColor='#0000ff'; GM.fillColor='#009900'; //GM.redIcon = new GIcon(G_DEFAULT_ICON); GM.areaListener = null; var degreesPerRadian=180.0/Math.PI; var radiansPerDegree=Math.PI/180.0; var metersPerKm=1000.0; var meters2PerHectare=10000.0; var feetPerMeter=3.2808399; var feetPerMile=5280.0; var acresPerMile2=640; var earthRadiusMeters=6367460.0; var metersPerDegree=2.0*Math.PI*earthRadiusMeters/360.0; GM.MeasureArea = function() { GM.areaListener = GEvent.addListener(MAP.GoogleMap,'click', function (overlay,point) { if(overlay==null && point!=null) { GM.points.push(point); GM.Display(); } } ); } GM.Display = function() { for(var i=0;i0&&GM.points.length>=3) GM.AddPolylines(GM.lines,GM.GreatCirclePoints(GM.points[i-1],GM.points[i]),GM.lineColor,GM.lineWidth); } if(GM.points.length>=2) GM.AddPolylines(GM.lines,GM.GreatCirclePoints(GM.points[GM.points.length-1],GM.points[0]),GM.closerColor,GM.lineWidth); if(GM.points.length>=3) { GM.polygon=new GPolygon(GM.polygonPoints,GM.lineColor,0,0,GM.fillColor,0.5); MAP.GoogleMap.addOverlay(GM.polygon); } if(GM.points.length > 2) { var areaMeters2=GM.SphericalPolygonAreaMeters2(GM.points); if(areaMeters2<1000000.0) areaMeters2=GM.PlanarPolygonAreaMeters2(GM.points); $("measureResultText").innerHTML = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(areaMeters2, 0), ".") + "m²"; //alert(formatZahlTausendertrennzeichen(dezRound(areaMeters2, 0), ".")); } } function Angle(p1,p2,p3) { var bearing21=Bearing(p2,p1); var bearing23=Bearing(p2,p3); var angle=bearing21-bearing23; if(angle<0.0) angle+=360.0;return angle; } function Bearing(from,to) { var lat1=from.lat()*radiansPerDegree; var lon1=from.lng()*radiansPerDegree; var lat2=to.lat()*radiansPerDegree; var lon2=to.lng()*radiansPerDegree; var angle=-Math.atan2(Math.sin(lon1-lon2)*Math.cos(lat2),Math.cos(lat1)*Math.sin(lat2)-Math.sin(lat1)*Math.cos(lat2)*Math.cos(lon1-lon2)); if(angle<0.0) angle+=Math.PI*2.0;angle=angle*degreesPerRadian; return angle; } GM.AddPolylines = function(lines,ps,lineColor,lineWidth) { var line=new GPolyline(ps,lineColor,lineWidth); lines.push(line); MAP.GoogleMap.addOverlay(line); for(var i=0;i420.0) { totalAngle=points.length*360.0-totalAngle; sphericalExcess=totalAngle-planarTotalAngle; } else if(sphericalExcess>300.0&&sphericalExcess<420.0) { sphericalExcess=Math.abs(360.0-sphericalExcess); } return sphericalExcess*radiansPerDegree*earthRadiusMeters*earthRadiusMeters; } GM.PlanarPolygonAreaMeters2 = function(points) { var a=0.0; for(var i=0;i"; view = MAP.VE.GetMapView(); topleft = view.TopLeftLatLong; bottomright = view.BottomRightLatLong; pixel = new VEPixel(14, 14); var LL = MAP.VE.PixelToLatLong(pixel); //$("myControl").innerHTML += topleft.Latitude +", " + topleft.Longitude + "
"; var overlay = new VEShape(VEShapeType.Pushpin, new VELatLong(LL.Latitude, LL.Longitude)); overlay.SetCustomIcon(""); overlay.SetZIndex = 100; mVE.OverlayLayer.AddShape(overlay); } else { //alert(mVE.OverlayRequest.statusText); //alert("Erro a carregar a legenda (2)!\n" + ); } } } mVE.OverlayRequest.send(reqBody); } if (MAP.poisAvail) MAP.LoadMap(2); /* var infobox = "You can add html codes into the info box or change the style of the info box. You can design and show any info box you want!
"; var shape = new VEShape(VEShapeType.Pushpin, MAP.VE.GetCenter()); //Set the icon shape.SetCustomIcon(icon); //Set the info box //MAP.VE.ClearInfoBoxStyles(); shape.SetTitle("

Custom Pin

"); //shape.SetDescription(infobox); //Add the shape the the map MAP.VE.AddShape(shape); */ } MAP.PreloadedFeaturesForMap = null; MAP.CurrentVisibleFeaturesForMap = []; MAP.InitPreloadedFeatures = function() { result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetPreloadedFeaturesForMap", ["sid", "site", "map"], [sid, site, map], "RPWeb_Services.asmx"); evString = "(" + JSON.GetEvalString(result.responseXML.documentElement.firstChild.firstChild.childNodes[0].childNodes) + ")"; preFeatures = eval(evString); MAP.PreloadedFeaturesForMap = preFeatures.FeatureIds; MAP.CurrentVisibleFeaturesForMap = preFeatures.FeatureIds; MAP.AddEventListener(MapAction.mapChangedBefore, "MAP.ResetPreloadedFeatures"); } MAP.ResetPreloadedFeatures = function() { MAP.PreloadedFeaturesForMap = null; MAP.CurrentVisibleFeaturesForMap = []; } MAP.AddFeatures = function(features, loadMaps) { if (MAP.PreloadedFeaturesForMap == null) { MAP.InitPreloadedFeatures(); } fStr = MAP.PreloadedFeaturesForMap.join(",") + "," + features.join(","); if (MAP.CurrentVisibleFeaturesForMap.length == 0) MAP.CurrentVisibleFeaturesForMap = fStr.split(","); else { for (ifeaturesX = 0; ifeaturesX < features.length; ifeaturesX++) if(!GENERAL.IsInArray(MAP.CurrentVisibleFeaturesForMap, features[ifeaturesX])) MAP.CurrentVisibleFeaturesForMap.push(features[ifeaturesX]); } MAP.SetSessionfilter("MAP.VISIBLE.FEATURES." +map, MAP.CurrentVisibleFeaturesForMap.join(",")); if (loadMaps) { if (MAP.VE == null) MAP.LoadMaps(); else mVE.MapChanged(); } } MAP.RemoveFeatures = function(features, loadMaps) { if (MAP.PreloadedFeaturesForMap == null) { MAP.InitPreloadedFeatures(); } for (ifeaturesX = 0; ifeaturesX < features.length; ifeaturesX++) MAP.CurrentVisibleFeaturesForMap = GENERAL.DeleteFromArray(MAP.CurrentVisibleFeaturesForMap, features[ifeaturesX]); MAP.SetSessionfilter("MAP.VISIBLE.FEATURES."+map, MAP.CurrentVisibleFeaturesForMap.join(",")); if (loadMaps) { if (MAP.VE == null) MAP.LoadMaps(); else mVE.MapChanged(); } } function ScaleBar() {} ScaleBar.IsShow = true; ScaleBar.text = ""; ScaleBar.width = 0; //anpassen von wert und groesse der leiste ScaleBar.Adjust = function() { if($("scalebarText") == null) return; //$("scalebarText").innerHTML = Math.round(MAP.resolutionX * 200) + "m"; var initialScreenValue = Math.round(MAP.resolutionX * 200); //ausgangswert fuer die anzeige var newScreenValue = ScaleBar.CalculateScreenValue(initialScreenValue); var newPixelWidth = Math.round((200/initialScreenValue)*newScreenValue); GUI.SetObjWidth($("scalebarImage"), newPixelWidth); GUI.SetObjHeight($("scalebarImage"), 12); ScaleBar.width = newPixelWidth; $("scalebarText").innerHTML = (newScreenValue >= 1000 ? newScreenValue/1000 + " km" : newScreenValue + " m"); ScaleBar.text = $("scalebarText").innerHTML; } //rechnet den anzuzeigenden wert aus ScaleBar.CalculateScreenValue = function(currValue) { //return GENERAL.LeftPad("abcdefg", 16, "-") + "\n" + GENERAL.RightPad("abc", 10, "0"); currValue = String(currValue); var calcValue1 = parseInt(GENERAL.RightPad(currValue.charAt(0), currValue.length, "0"), 10); //erste zahl von currentvalue und den rest mit 0 auffuellen var calcValue2 = parseInt(GENERAL.RightPad(currValue.charAt(0) + "5", currValue.length, "0"), 10); //erste zahl+5 von currentvalue und den rest mit 0 auffuellen var calcValue3 = 0; if (parseInt(currValue) > calcValue2) { calcValue3 = calcValue1+(Math.pow(10, currValue.length-1)); calcValue1 = calcValue2; calcValue2 = calcValue3; } var newCalcValue = calcValue1; var diff1 = Math.abs(currValue - calcValue1); var diff2 = Math.abs(calcValue2 - currValue); if (diff2 < diff1) newCalcValue = calcValue2; return newCalcValue; } ScaleBar.Button_Clicked = function() { ScaleBar.OpenClose(); } ScaleBar.OpenClose = function () { if (ScaleBar.IsShow) { ScaleBar.IsShow = false; ScaleBar.Hide(); } else { ScaleBar.IsShow = true; ScaleBar.Show(); } } ScaleBar.Show = function() { if($("scaleBar") != null) $("scaleBar").style.display = "block"; } ScaleBar.Hide = function() { if($("scaleBar") != null) $("scaleBar").style.display = "none"; } // no special namespace function RPCoordPair(x, y) { this.X = x; this.Y = y; }function Overview() {} Overview.RealWidth = 0; Overview.RealHeight = 0; Overview.PixelWidth = 160; Overview.PixelHeight = 160; Overview.Left = 0; Overview.Top = 0; Overview.Right = 0; Overview.Bottom = 0; Overview.IsShow = false; Overview.IsStatic = false; Overview.ImgUrl = null; Overview.Zoomranges = null; Overview.MapType = null; Overview.Map = null; Overview.ResolutionX = 0; Overview.ResolutionY = 0; Overview.Load = function() { var ovRange = null; try { if (Overview.Map != null && Overview.IsShow) { $("overviewImageBox").innerHTML = ""; if (!Overview.IsStatic) { //dnamische overview overviewScaleIndex = parseInt(MAP.currentZoomRangeIndex)+parseInt(Overview.Zoomranges); if (overviewScaleIndex > MAP.arrZoomRanges.length-1) overviewScaleIndex = MAP.arrZoomRanges.length-1; ovRange = new MAP.SetRangeForScaleCustom(MAP.CenterX, MAP.CenterY, MAP.arrZoomRanges[overviewScaleIndex-1]); //Intergraph.Respublica.Web.RPWeb_Services.GetMap(sid, project, site, Overview.Map, Overview.PixelWidth, Overview.PixelHeight, MAP.strLeft-(MAP.Width), MAP.strTop+(MAP.Height), MAP.strRight+(MAP.Width), MAP.strBottom-(MAP.Height), 0, Overview.Complete); Intergraph.Respublica.Web.Service.RPWeb_Services.GetMapOverview(sid, project, site, Overview.Map, Overview.PixelWidth, Overview.PixelHeight, ovRange.cLeft, ovRange.cTop, ovRange.cRight, ovRange.cBottom, Overview.MapType, Overview.Complete); } else { //statische overview Overview.Complete(null); } } } catch(e) { msg = ""; if (ovRange != null) msg = MAP.CenterX + " : " + MAP.CenterY + " : " + MAP.arrZoomRanges[overviewScaleIndex] + " : " + Overview.PixelWidth + " : " + Overview.PixelHeight + " : " + ovRange.cLeft + " : " + ovRange.cTop + " : " + ovRange.cRight + " : " + ovRange.cBottom; alert("Fehler in: Overview.Load " + e.message + "\n" + msg); } //alert(MAP.OverviewMap); } Overview.Complete = function (result) { if($("overviewImageBox") != null) { var imgUrl = Overview.ImgUrl; if (result != null) { imgUrl = result.url; Overview.Left = parseInt(result.mapLeft); Overview.Top = parseInt(result.mapTop); Overview.Right = parseInt(result.mapRight); Overview.Bottom = parseInt(result.mapBottom); } $("overviewImageBox").innerHTML = '
'; $("overviewMapAction").onmousedown = Overview.RectMouseDown; $("overviewMapAction").onmousemove = Overview.RectMouseMove; $("overviewMapAction").onmouseup = Overview.RectMouseUp; Overview.DrawSection(); } } Overview.DrawSection = function() { Overview.RealWidth = Overview.Right-Overview.Left; Overview.RealHeight = Overview.Top-Overview.Bottom; Overview.ResolutionX = Overview.RealWidth/Overview.PixelWidth; Overview.ResolutionY = Overview.RealHeight/Overview.PixelHeight; sectionHeight = Math.round(MAP.Height/Overview.ResolutionY); sectionWidth = Math.round(MAP.Width/Overview.ResolutionX); if (sectionHeight == 0) sectionHeight = 1; if (sectionWidth == 0) sectionWidth = 1; rectTop = Math.round((Overview.Top - MAP.strTop)/Overview.ResolutionY); rectLeft = Math.round((MAP.strLeft - Overview.Left)/Overview.ResolutionX); /*
GUI.SetObjWidth($("overviewRect"), sectionWidth); GUI.SetObjHeight($("overviewRect"), sectionHeight); $("overviewRect").style.left = String(rectLeft)+"px"; $("overviewRect").style.top = String(rectTop)+"px"; $("overviewRect").style.clip = "rect(0," + (sectionWidth) + "px," + (sectionHeight) + "px,0)"; */ //fadenkreuz $("overviewRectContainer").innerHTML = ""; //1 linie horizontal Drawing.Line("overviewRectContainer", 1, "#000000", new Drawing.Coords(0, (rectTop+(sectionHeight/2))), new Drawing.Coords(rectLeft, (rectTop+(sectionHeight/2)))); //2 linie horizontal Drawing.Line("overviewRectContainer", 1, "#000000", new Drawing.Coords((rectLeft+sectionWidth), (rectTop+(sectionHeight/2))), new Drawing.Coords(Overview.PixelWidth, (rectTop+(sectionHeight/2)))); //1 linie vertikal Drawing.Line("overviewRectContainer", 1, "#000000", new Drawing.Coords((rectLeft+(sectionWidth/2)), 0), new Drawing.Coords((rectLeft+(sectionWidth/2)), rectTop)); //2 linie vertikal Drawing.Line("overviewRectContainer", 1, "#000000", new Drawing.Coords((rectLeft+(sectionWidth/2)), (rectTop+sectionHeight)), new Drawing.Coords((rectLeft+(sectionWidth/2)), Overview.PixelHeight)); //rechteck strCoords = new StringBuilder(); strCoords.append(rectLeft + "," + rectTop + " "); strCoords.append((rectLeft+sectionWidth) + "," + rectTop + " "); strCoords.append((rectLeft+sectionWidth) + "," + (rectTop + sectionHeight) + " "); strCoords.append(rectLeft + "," + (rectTop + sectionHeight) + " "); strCoords.append(rectLeft + "," + rectTop); Drawing.Polygon("overviewRectContainer", 1, "#000000", "#00ffff", "10", strCoords.toString()); $("overviewRectContainer").innerHTML += "
"; GUI.SetObjWidth($("overviewRect"), sectionWidth); GUI.SetObjHeight($("overviewRect"), sectionHeight); $("overviewRect").style.left = String(rectLeft)+"px"; $("overviewRect").style.top = String(rectTop)+"px"; $("overviewRect").style.overflow = "hidden"; //Drawing.Polygon("overviewRectContainer", 1, "#000000", null, null, "10,10 40,10 40,30 10,30 10,10"); } Overview.Mode = null; Overview.ClickedX = 0; Overview.ClickedY = 0; Overview.ClickedXOld = 0; Overview.ClickedYOld = 0; Overview.ClickedDiffX = 0; Overview.ClickedDiffY = 0; Overview.OldLeft = 0; Overview.OldTop = 0; Overview.NewLeft = 0; Overview.NewTop = 0; Overview.RectMouseDown = function (ev) { objCoords = new GENERAL.GetObjectcoords(ev); Overview.ClickedXOld = objCoords.x; Overview.ClickedYOld = objCoords.y; Overview.ClickedDiffX = Overview.ClickedXOld-parseInt($("overviewRect").style.left+0); Overview.ClickedDiffY = Overview.ClickedYOld-parseInt($("overviewRect").style.top+0); Overview.OldLeft = parseInt($("overviewRect").style.left+0); Overview.OldTop = parseInt($("overviewRect").style.top+0); if (Overview.ClickedXOld > Overview.OldLeft && Overview.ClickedXOld < (Overview.OldLeft+parseInt($("overviewRect").style.width+0)) && Overview.ClickedYOld > Overview.OldTop && Overview.ClickedYOld < (Overview.OldTop+parseInt($("overviewRect").style.height+0))) Overview.Mode = "move"; return false; } Overview.RectMouseMove = function (ev) { if (Overview.Mode == "move") { objCoords = new GENERAL.GetObjectcoords(ev); Overview.NewLeft = objCoords.x-Overview.ClickedDiffX; Overview.NewTop = objCoords.y-Overview.ClickedDiffY; $("overviewRect").style.left = Overview.NewLeft; $("overviewRect").style.top = Overview.NewTop; diffX = ((Overview.OldLeft-Overview.NewLeft)*Overview.ResolutionX); diffY = ((Overview.OldTop-Overview.NewTop)*Overview.ResolutionY); window.status = MAP.GetPixelFromMeterX(diffX) + " " + MAP.GetPixelFromMeterY(diffY); MAP.MoveAllLayers(MAP.GetPixelFromMeterX(diffX), MAP.GetPixelFromMeterY(diffY)); Overview.OldLeft = Overview.NewLeft; Overview.OldTop = Overview.NewTop; Overview.DrawSection(); //window.status = $("overviewRect").style.left; } return false; } Overview.RectMouseUp = function (ev) { if (Overview.Mode == "move") { objCoords = new GENERAL.GetObjectcoords(ev); Overview.ClickedX = objCoords.x; Overview.ClickedY = objCoords.y; //MAP.ZoomToXY(rw, hw, MAP.arrZoomRanges[MAP.currentZoomRangeIndex], false); MAP.LoadMaps(); } Overview.Mode = "moveend"; return false; } Overview.OpenClose = function () { if (Overview.IsShow) { //overview open > schliessen Overview.IsShow = false; Overview.Hide(); } else { //overview closed > öffnen Overview.IsShow = true; Overview.Show(); } } Overview.Show = function() { if($("overviewImageBox") != null) { $("overviewImageBox").style.display = "block"; $("imgOvAction").src = "App_Images/closeOV.gif"; $("usagerequirement").style.right = "170px"; Overview.Load(); } } Overview.Hide = function() { if($("overviewImageBox") != null) { $("overviewImageBox").style.display = "none"; if (GENERAL.IsIElt7()) $("usagerequirement").style.right = "14px"; else $("usagerequirement").style.right = "14px"; $("imgOvAction").src = "App_Images/openOV.gif"; } }/* class QUERIES */ function QUERIES() {} QUERIES.CurrentPinRW = 0; QUERIES.CurrentPinHW = 0; QUERIES.CurrentPinImage = ""; QUERIES.Displaybehavior = -1; QUERIES.Scale = null; QUERIES.SPContents = []; QUERIES.SPContentCurrent = 0; QUERIES.GoogleMapInfoWindow = null; QUERIES.CurrentSpeechbubbleWidth = 300; QUERIES.CurrentSpeechbubbleHeight = 271; QUERIES.ListBoxResult_SelectedIndexChanged = function (obj, showBin, showDetailInfo) { QUERIES.ResetPin(); QUERIES.SpeechBubbleClose(); if(MAP.GetLoaderMessage()) return; sPin = true; if (typeof(showBin) == "boolean") sPin = showBin; QUERIES.Displaybehavior = obj.rel.split("|")[7]; //alert(QUERIES.Displaybehavior); if(showBin == null) { if (obj.rel.split("|")[7] != "0") //displaybehavior sPin = true; else sPin = false; } sDetailInfo = true; if (typeof(showDetailInfo) == "boolean") sDetailInfo = showDetailInfo; //alert(obj.value.split("|")[7] + "\n" + sPin); QUERIES.CurrentPinRW = obj.rel.split("|")[0]; QUERIES.CurrentPinHW = obj.rel.split("|")[1]; QUERIES.Scale = obj.rel.split("|")[5]; //QUERIES.CurrentPinImage = (obj.value.split("|")[6] != "" ? rpwebPath + "POI_images/"+ obj.value.split("|")[6] : null); QUERIES.CurrentPinImage = (obj.rel.split("|")[6] != "" ? "Symbols/" + obj.rel.split("|")[6] : ""); //MAP.MoveToXY(QUERIES.CurrentPinRW, QUERIES.CurrentPinHW); //check scale queryScale = (QUERIES.Scale != null && QUERIES.Scale != "" ? QUERIES.Scale : QueryStandardscale); if(!GENERAL.IsInArray(MAP.arrZoomRanges, String(queryScale))) queryScale = MAP.arrZoomRanges[0] MAP.ZoomToXY(QUERIES.CurrentPinRW, QUERIES.CurrentPinHW, queryScale, sPin); if (sDetailInfo) { //QUERIES.CurrentPinRW = null; //QUERIES.CurrentPinHW = null; MAP.IsShowQuery = true; rw = obj.rel.split("|")[0]; hw = obj.rel.split("|")[1]; id = obj.rel.split("|")[2]; queryId = obj.rel.split("|")[3]; primaryKeyColumn = obj.rel.split("|")[4]; QUERIES.ShowDetailInfo(rw, hw, id, queryId, primaryKeyColumn); QUERIES.GoogleMapInfoWindow = obj; } } QUERIES.Poi_Clicked = function (id, rw, hw, queryId, primaryKeyColumn) { MAP.RemoveEventListener(MapAction.move, "Search.GetSpeechBubble"); MAP.RemoveEventListener(MapAction.zoom, "Search.GetSpeechBubble"); MAP.IsShowQuery = true; QUERIES.CurrentPinRW = rw; QUERIES.CurrentPinHW = hw; var SfXmlHelperObj = new XmlHelperObj(); result = SfXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetQueryPin", ["sid", "site", "queryid"], [sid, site, queryId], "RPWeb_Services.asmx"); rText = SfXmlHelperObj.GetElementValue(result, "GetQueryPinResult"); if (rText != "" && rText.indexOf("|") > -1) { QUERIES.CurrentPinImage = "Symbols/" + rText.split("|")[0]; QUERIES.Displaybehavior = rText.split("|")[1]; } if ((MAP.GetPixelXFromWorldCoord(rw) < (MAP.outputWidth-QUERIES.CurrentSpeechbubbleWidth)) && (MAP.GetPixelYFromWorldCoord(hw) > QUERIES.CurrentSpeechbubbleHeight)) { ; } else { _nRW = rw - (rw-MAP.CenterX); _nHW = hw - (hw-MAP.CenterY); if ((rw + MAP.GetMeterForPixelX(QUERIES.CurrentSpeechbubbleWidth)) > MAP.strRight) _nRW = MAP.CenterX + (MAP.GetMeterForPixelX(QUERIES.CurrentSpeechbubbleWidth)-(MAP.strRight-rw)); if ((hw + MAP.GetMeterForPixelY(QUERIES.CurrentSpeechbubbleHeight)) > MAP.strTop) _nHW = MAP.CenterY + (MAP.GetMeterForPixelY(QUERIES.CurrentSpeechbubbleHeight)-(MAP.strTop-hw)); MAP.ZoomToXY(_nRW, _nHW, MAP.arrZoomRanges[MAP.currentZoomRangeIndex], false); } QUERIES.ShowDetailInfo(rw, hw, id, queryId, primaryKeyColumn); } QUERIES.InfoQuery = function (rw, hw) { QUERIES.ResetPin(); /*QUERIES.CurrentPinRW = rw; QUERIES.CurrentPinHW = hw; QUERIES.Displaybehavior = "-1";*/ MAP.ZoomToXY(rw, hw, MAP.arrZoomRanges[MAP.currentZoomRangeIndex], false); result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetQueryDetailInfoTooltipQuery", ["sid", "site", "project", "feature_infoquery", "query_infoquery", "x", "y"], [sid, site, project, MAP.Infoquery_Feature, MAP.Infoquery_Query, rw, hw], "RPWeb_Services.asmx"); //htmlDetailInfo = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.data; if (result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.data == "§§§§Keine Info") htmlDetailInfo = "Sem Informa\347\343o"; else htmlDetailInfo = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.data; if (htmlDetailInfo.length == 4) return; $("detailInfo").innerHTML = QUERIES.GetSpeechBubble(htmlDetailInfo); $("detailInfo").style.left = ((GUI.GetObjWidth($("mapArea"))/2)-30) + "px"; $("detailInfo").style.top = ((GUI.GetObjHeight($("mapArea"))/2)-250) + "px"; $("detailInfo").style.display = "block"; } QUERIES.ShowDetailInfo = function (x, y, id, queryId, primaryKeyColumn) { htmlDetailInfo = QUERIES.GetDetailInfoHtml(id, queryId, primaryKeyColumn); if (htmlDetailInfo.length == 4) return; $("detailInfo").innerHTML = QUERIES.GetSpeechBubble(htmlDetailInfo); $("detailInfo").style.left = (MAP.GetPixelXFromWorldCoord(x)-30) + "px"; $("detailInfo").style.top = (MAP.GetPixelYFromWorldCoord(y)-250) + "px"; $("detailInfo").style.display = "block"; /* $("detailInfo").style.left = ((GUI.GetObjWidth($("mapArea"))/2)-30) + "px"; $("detailInfo").style.top = ((GUI.GetObjHeight($("mapArea"))/2)-250) + "px"; $("detailInfo").style.display = "block";*/ QUERIES.RePlaceSpeechbubble(); } QUERIES.ShowSpeechBubble = function (header, text) { htmlDetailInfo = header + "§§§§" + text; $("detailInfo").innerHTML = QUERIES.GetSpeechBubble(htmlDetailInfo); $("detailInfo").style.display = "block"; QUERIES.RePlaceSpeechbubble(); } QUERIES.RePlaceSpeechbubble = function() { /*$("detailInfo").style.left = ((GUI.GetObjWidth($("mapArea"))/2)-30) + "px"; $("detailInfo").style.top = ((GUI.GetObjHeight($("mapArea"))/2)-250) + "px";*/ if (QUERIES.CurrentPinRW == 0 || QUERIES.CurrentPinHW == 0) return; $("detailInfo").style.left = (MAP.GetPixelXFromWorldCoord(QUERIES.CurrentPinRW)-30) + "px"; $("detailInfo").style.top = (MAP.GetPixelYFromWorldCoord(QUERIES.CurrentPinHW)-250) + "px"; } QUERIES.ResetPin = function () { QUERIES.CurrentPinRW = 0; QUERIES.CurrentPinHW = 0; QUERIES.CurrentPinImage = ""; QUERIES.Displaybehavior = -1; } QUERIES.GetDetailInfoHtml = function (id, queryId, primaryKeyColumn) { result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetQueryDetailInfo", ["sid", "site", "project", "id", "queryId", "primaryColumn"], [sid, site, project, id, queryId, primaryKeyColumn], "RPWeb_Services.asmx"); return result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.data; } QUERIES.SpeechBubbleClose = function () { $("detailInfo").style.display = "none"; MAP.ClearSessionfilter("QUERY.DETAIL"); /* QUERIES.CurrentPinRW = 0; QUERIES.CurrentPinHW = 0; QUERIES.CurrentPinImage = ""; */ } /*Adicionado 14-10-2009 by Henrique Souto*/ QUERIES.SpeechBubbleClose2 = function () { $("detailInfo").style.display = "none"; MAP.ClearSessionfilter("QUERY.DETAIL"); MAP.RemoveEventListener(MapAction.move, "Search.GetSpeechBubble"); MAP.RemoveEventListener(MapAction.zoom, "Search.GetSpeechBubble"); } QUERIES.GetSpeechBubble = function(innerHtml) { QUERIES.SPContents = []; QUERIES.SPContentsCurrent = 0; var sb = new StringBuilder();; pages = innerHtml.split("[next]"); block1 = pages[0].split("§§§§")[0]; innerHtml = pages[0].split("§§§§")[1]; if (!GENERAL.IsIElt7()) { sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
" + block1 + "
"); sb.append("
"); sb.append(innerHtml); sb.append("
"); //blaettern if (pages.length > 1) sb.append("
\"Ver\"Ver
"); sb.append("
"); sb.append("
"); } else { // ie 6 und kleiner sb.append("
"); sb.append("
"); sb.append("
" + block1 + "
"); sb.append("
"); sb.append(innerHtml); sb.append("
"); if (pages.length > 1) sb.append("
\"Ver\"Ver
"); sb.append("
"); sb.append("
"); } for (i = 0; i < pages.length; i++) { block1 = pages[i].split("§§§§")[0]; innerHtml = pages[i].split("§§§§")[1]; QUERIES.SPContents.push(new QUERIES.SpeechBubbleContent(block1, innerHtml)); } return sb.toString(); } QUERIES.GetSpeechBubble2 = function(innerHtml) { QUERIES.SPContents = []; QUERIES.SPContentsCurrent = 0; var sb = new StringBuilder();; pages = innerHtml.split("[next]"); block1 = pages[0].split("§§§§")[0]; innerHtml = pages[0].split("§§§§")[1]; if (!GENERAL.IsIElt7()) { sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
"); sb.append("
" + block1 + "
"); sb.append("
"); sb.append(innerHtml); sb.append("
"); //blaettern if (pages.length > 1) sb.append("
\"Ver\"Ver
"); sb.append("
"); sb.append("
"); } else { // ie 6 und kleiner sb.append("
"); sb.append("
"); sb.append("
" + block1 + "
"); sb.append("
"); sb.append(innerHtml); sb.append("
"); if (pages.length > 1) sb.append("
\"Ver\"Ver
"); sb.append("
"); sb.append("
"); } for (i = 0; i < pages.length; i++) { block1 = pages[i].split("§§§§")[0]; innerHtml = pages[i].split("§§§§")[1]; QUERIES.SPContents.push(new QUERIES.SpeechBubbleContent(block1, innerHtml)); } return sb.toString(); } QUERIES.SpeechBubbleNav = function(w) { switch(w) { case "next": if (QUERIES.SPContentCurrent < (QUERIES.SPContents.length-1)) QUERIES.SPContentCurrent++; break; case "last": if (QUERIES.SPContentCurrent > 0) QUERIES.SPContentCurrent--; break; } $("speechBubbleTextHeader").innerHTML = QUERIES.SPContents[QUERIES.SPContentCurrent].Block1; $("speechBubbleText").innerHTML = QUERIES.SPContents[QUERIES.SPContentCurrent].Text; } QUERIES.SpeechBubbleContent = function(block1, text) { this.Block1 = block1; this.Text = text; } ///////////////////////////////////////////////////////////// //QUERIES.ShowDetailInfo2 = function (x, y, id) QUERIES.ShowDetailInfo2 = function (x, y, tipoPesquisa) { //htmlDetailInfo = QUERIES.GetDetailInfoHtml(id, queryId, primaryKeyColumn); // htmlDetailInfo = id; htmlDetailInfo = tipoPesquisa; if (htmlDetailInfo.length == 4) return; // $("detailInfo").innerHTML = QUERIES.GetSpeechBubble(id); $("detailInfo").innerHTML = QUERIES.GetSpeechBubble2(htmlDetailInfo); $("detailInfo").style.left = (MAP.GetPixelXFromWorldCoord(x)-30) + "px"; $("detailInfo").style.top = (MAP.GetPixelYFromWorldCoord(y)-250) + "px"; $("detailInfo").style.display = "block"; /* $("detailInfo").style.left = ((GUI.GetObjWidth($("mapArea"))/2)-30) + "px"; $("detailInfo").style.top = ((GUI.GetObjHeight($("mapArea"))/2)-250) + "px"; $("detailInfo").style.display = "block";*/ QUERIES.RePlaceSpeechbubble(); } QUERIES.ShowSpeechBubble2 = function (x,y,header, text) { htmlDetailInfo = header + "§§§§" + text; $("detailInfo").innerHTML = QUERIES.GetSpeechBubble2(htmlDetailInfo); $("detailInfo").style.display = "block"; $("detailInfo").style.left = (MAP.GetPixelXFromWorldCoord(x)-30) + "px"; $("detailInfo").style.top = (MAP.GetPixelYFromWorldCoord(y)-250) + "px"; QUERIES.RePlaceSpeechbubble(); } /* class TOOLBAR */ function TOOLBAR() {} TOOLBAR.ZoomIn = function(showMsg) { MAP.currentZoomRangeIndex--; if (MAP.currentZoomRangeIndex < 0) { MAP.currentZoomRangeIndex = 0; if (typeof(showMsg) != "boolean" || showMsg) { alert(lang_msg_KleinsteZoomStufe); return; } } //pois loeschen //MAP.RemovePOIs(); if (typeof(showMsg) != "boolean" || showMsg) { MapAction.isZoom = true; MAP.GotoScale(MAP.arrZoomRanges[MAP.currentZoomRangeIndex]); } else MAP.GotoScale(MAP.arrZoomRanges[MAP.currentZoomRangeIndex]); } TOOLBAR.ZoomOut = function() { MAP.currentZoomRangeIndex++; if (MAP.currentZoomRangeIndex > (MAP.arrZoomRanges.length-1)) { MAP.currentZoomRangeIndex = (MAP.arrZoomRanges.length-1); alert(lang_msg_GroessteZoomStufe); return; } //pois loeschen //MAP.RemovePOIs(); MapAction.isZoom = true; MAP.GotoScale(MAP.arrZoomRanges[MAP.currentZoomRangeIndex]); } TOOLBAR.kingsMove_click = function (wich) { MapAction.isZoom = true; MapAction.isMove = true; // kingsmove mapWidth = (parseInt(MAP.strRight)-parseInt(MAP.strLeft)); mapHeight = (parseInt(MAP.strTop)-parseInt(MAP.strBottom)); moveStepX = Math.round(mapWidth*0.33); moveStepY = Math.round(mapHeight*0.33); moveStepXpx = 0; //MAP.GetPixelFromMeterX(moveStepX); moveStepYpx = 0; //MAP.GetPixelFromMeterX(moveStepY); switch(wich) { //westen case "w": /*MAP.strRight = MAP.strRight - moveStepX; MAP.strLeft = MAP.strLeft - moveStepX;*/ moveStepXpx = MAP.GetPixelFromMeterX(moveStepX); break; //osten case "e": /*MAP.strRight = MAP.strRight + moveStepX; MAP.strLeft = MAP.strLeft + moveStepX;*/ moveStepXpx = MAP.GetPixelFromMeterX(moveStepX*-1); break; //sueden case "s": /*MAP.strTop = MAP.strTop - moveStepY; MAP.strBottom = MAP.strBottom - moveStepY;*/ moveStepYpx = MAP.GetPixelFromMeterY(moveStepY*-1); break; //norden case "n": /*MAP.strTop = MAP.strTop + moveStepY; MAP.strBottom = MAP.strBottom + moveStepY;*/ moveStepYpx = MAP.GetPixelFromMeterY(moveStepY); break; //nordwest case "nw": /*MAP.strRight = MAP.strRight - moveStepX; MAP.strLeft = MAP.strLeft - moveStepX; MAP.strTop = MAP.strTop + moveStepY; MAP.strBottom = MAP.strBottom + moveStepY;*/ moveStepXpx = MAP.GetPixelFromMeterX(moveStepX); moveStepYpx = MAP.GetPixelFromMeterY(moveStepY); break; //nordost case "ne": /*MAP.strRight = MAP.strRight + moveStepX; MAP.strLeft = MAP.strLeft + moveStepX; MAP.strTop = MAP.strTop + moveStepY; MAP.strBottom = MAP.strBottom + moveStepY;*/ moveStepXpx = MAP.GetPixelFromMeterX(moveStepX*-1); moveStepYpx = MAP.GetPixelFromMeterY(moveStepY); break; //suedost case "se": /*MAP.strRight = MAP.strRight + moveStepX; MAP.strLeft = MAP.strLeft + moveStepX; MAP.strTop = MAP.strTop - moveStepY; MAP.strBottom = MAP.strBottom - moveStepY;*/ moveStepXpx = MAP.GetPixelFromMeterX(moveStepX*-1); moveStepYpx = MAP.GetPixelFromMeterY(moveStepY*-1); break; //suewest case "sw": /*MAP.strRight = MAP.strRight - moveStepX; MAP.strLeft = MAP.strLeft - moveStepX; MAP.strTop = MAP.strTop - moveStepY; MAP.strBottom = MAP.strBottom - moveStepY;*/ moveStepXpx = MAP.GetPixelFromMeterX(moveStepX); moveStepYpx = MAP.GetPixelFromMeterY(moveStepY*-1); break; default: alert("err"); break; } MAP.MoveAllLayers(moveStepXpx,moveStepYpx); MAP.LoadMaps(); } TOOLBAR.FitAll = function() { MapAction.isZoom = true; //BRUNO SANTOS //HACK: Didn't did fit all when query string had x, y and scale. // Commented next two lines to do fit all even when that variables were defined. //if(startMap(true)) // return; /*MAP.strLeft = projectLeft; MAP.strTop = projectTop; MAP.strRight = projectRight; MAP.strBottom = projectBottom; MAP.InitializeMembers();*/ MAP.CenterX = (projectRight + projectLeft)/2; MAP.CenterY = (projectTop + projectBottom)/2; MAP.GotoScale(MAP.arrZoomRanges[MAP.arrZoomRanges.length-1]); //MAP.LoadMaps(); } TOOLBAR.Info = function () { MapAction.isMeasure = true; MAP.AddEventListener(MapAction.click, "TOOLBAR.InfoGet"); } TOOLBAR.InfoGet = function (obj) { MapAction.isMeasure = false; MAP.RemoveEventListener(MapAction.click, "TOOLBAR.InfoGet"); x = MAP.GetMeterFromPixelX(obj.x); y = MAP.GetMeterFromPixelY(obj.y); QUERIES.InfoQuery(x, y); } /* class MEASURE */ MEASURE.pointColor = MEASUREpointColor; MEASURE.lineColor = MEASURElineColor; MEASURE.pointWidth = MEASUREpointWidth; // in px MEASURE.lineWidth = MEASURElineWidth; // in px MEASURE.fillColor = MEASUREfillColor; MEASURE.opacity = MEASUREopacity; MEASURE.LineCoords = new Array(); // for clicked coord measure line MEASURE.AreaCoords = new Array(); // for clicked coord measure Area MEASURE.PointCoord = new Array(); // for clicked coord measure point MEASURE.Type = -1; // 0 = punkt, 1 = linie, 2 = Flaeche function MEASURE() { this.clickedPixelX = null; this.clickedPixelY = null; this.clickedWorldX = null; this.clickedWorldY = null; } MEASURE.SetXY = function (obj) { this.clickedPixelX = obj.x; this.clickedPixelY = obj.y; this.clickedWorldX = MAP.GetMeterFromPixelXMeas(this.clickedPixelX); this.clickedWorldY = MAP.GetMeterFromPixelYMeas(this.clickedPixelY); //Comentado em 13-01-2010 para permitir casas decimais nas coordenadas projectadas(Henrique Souto) // this.clickedWorldX = MAP.GetMeterFromPixelX(this.clickedPixelX); // this.clickedWorldY = MAP.GetMeterFromPixelY(this.clickedPixelY); } MEASURE.Cancel_Click = function(totalReset) { if (MAP.GoogleMap != null) { if(GM.areaListener != null) { GEvent.removeListener(GM.areaListener); GM.points=[]; GM.Display(); GM.areaListener = null; } if (GM.distanceListener != null) { MAP.GoogleMap.removeOverlay(GM.marker); MAP.GoogleMap.removeOverlay(GM.marker2); MAP.GoogleMap.removeOverlay(GM.polyline); GEvent.removeListener(GM.distanceListener); GM.lineDistanceStatus = 0; GM.distanceListener = null; GM.polylineCount = 0; GM.polylinePoints = []; } if(GM.pointListener != null) { MAP.GoogleMap.removeOverlay(GM.markerPoint); GEvent.removeListener(GM.pointListener); GM.pointListener = null; } } else { MAP.RemoveEventListener(MapAction.click, "MEASURE.Point"); MAP.RemoveEventListener(MapAction.click, "MEASURE.Line"); MAP.RemoveEventListener(MapAction.click, "MEASURE.Area"); } MAP.SetStandard(); MapAction.isMeasure = false; MEASURE.Reset(totalReset); MeetingPlace.Reset(); QUERIES.ResetPin(); MAP.ShowResultPin(); } MEASURE.Reset = function(totalReset) { $("dDraw").innerHTML = ""; $("measureResult").style.display = "none"; $("measureResultText").innerHTML = ""; $("IconLine").className = ""; $("IconArea").className = ""; $("IconPoint").className = ""; MEASURE.LineCoords = new Array(); MEASURE.AreaCoords = new Array(); MEASURE.PointCoord = new Array(); if (totalReset) if (MapInfoBox.OpenID == "MEASURE") MapInfoBox.Close(); } MEASURE.Redraw = function() { if (!MapAction.isMeasure) return; $("dDraw").innerHTML = ""; switch (MEASURE.Type) { case 0 : MEASURE.Point(null); break; case 1 : MEASURE.Line(null); break; case 2 : MEASURE.Area(null); break; } MEASURE.Area(null); } // point MEASURE.Point_Click = function () { MEASURE.Cancel_Click(); MapAction.isMeasure = true; MEASURE.Type = 0; $("IconPoint").className = "IconSelected"; if(MAP.GoogleMap != null) { GM.MeasurePoint(); return; } MAP.AddEventListener(MapAction.click, "MEASURE.Point"); $("pois").style.zIndex = "3"; } // MEASURE.Point = function (obj) // { // if (obj != null) // { // MEASURE.SetXY(obj); // MEASURE.PointCoord[0] = new RPCoordPair(this.clickedWorldX, this.clickedWorldY); // } // $("dDraw").innerHTML = ""; // Drawing.Point("dDraw", this.pointWidth, this.pointColor, MAP.GetPixelXFromWorldCoord(MEASURE.PointCoord[0].X), MAP.GetPixelYFromWorldCoord(MEASURE.PointCoord[0].Y)); // if (obj != null) // { // if (typeof(MEASUREShowPointResult_Format) != "undefined") // { // meter_result = ""; // geo_result = ""; // if (MEASUREShowPointResult_Format.indexOf("{METER}") > -1) // { // try // { // result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformToGeografic", ["coordPairs", "coordSystem"], [this.clickedWorldX+","+this.clickedWorldY, projectCoordSystem], "GeoCode.asmx"); // coords = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes[0].firstChild.data; // geo_result = GENERAL.GetTransformedCoordString(coords.split("|")[1]) + "   " + GENERAL.GetTransformedCoordString(coords.split("|")[0]); // } // catch(e) // { // geo_result = "Fehler!"; // } // } // if (MEASUREShowPointResult_Format.indexOf("{GEO}") > -1) // meter_result = "" + lang_messen_RW + ": " + this.clickedWorldX + "m | " + lang_messen_HW + ": " + this.clickedWorldY +"m"; // info_html_text = MEASUREShowPointResult_Format.replace("{METER}", meter_result).replace("{GEO}", geo_result); // MEASURE.ShowResult(info_html_text); // //$("measureResultText").innerHTML = MEASUREShowPointResult_Format.replace("{METER}", meter_result).replace("{GEO}", geo_result); // } // else // { // if (MEASUREShowPointResultGeografic) // { // try // { // result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformToGeografic", ["coordPairs", "coordSystem"], [this.clickedWorldX+","+this.clickedWorldY, projectCoordSystem], "GeoCode.asmx"); // coords = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes[0].firstChild.data; // $("measureResultText").innerHTML = GENERAL.GetTransformedCoordString(coords.split("|")[1]) + "   " + GENERAL.GetTransformedCoordString(coords.split("|")[0]); // } // catch(e) // { // $("measureResultText").innerHTML = "Fehler!"; // } // } // else // { // $("measureResultText").innerHTML = MEASUREPointCoordSystemText + "" + lang_messen_RW + ": " + this.clickedWorldX + "m | " + lang_messen_HW + ": " + this.clickedWorldY +"m"; // } // } // } // /*MAP.ClickedX = coords.split("|")[0]; // MAP.ClickedY = coords.split("|")[1];*/ // //$("measureResultText").innerHTML = "RW: " + this.clickedWorldX + "m | HW: " + this.clickedWorldY +"m"; // } MEASURE.Point = function (obj) { if (obj != null) { MEASURE.SetXY(obj); MEASURE.PointCoord[0] = new RPCoordPair(this.clickedWorldX, this.clickedWorldY); } $("dDraw").innerHTML = ""; Drawing.Point("dDraw", this.pointWidth, this.pointColor, MAP.GetPixelXFromWorldCoord(MEASURE.PointCoord[0].X), MAP.GetPixelYFromWorldCoord(MEASURE.PointCoord[0].Y)); if (obj != null) { if (typeof(MEASUREShowPointResult_Format) != "undefined") { meter_result = ""; geo_result = ""; if (MEASUREShowPointResult_Format.indexOf("{METER}") > -1) { try { result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformToGeografic", ["coordPairs", "coordSystem"], [this.clickedWorldX+","+this.clickedWorldY, projectCoordSystem], "GeoCode.asmx"); coords = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes[0].firstChild.data; geo_result = GENERAL.GetTransformedCoordString(coords.split("|")[1]) + "   " + GENERAL.GetTransformedCoordString(coords.split("|")[0]); } catch(e) { geo_result = "Fehler!"; } } if (MEASUREShowPointResult_Format.indexOf("{GEO}") > -1) meter_result = "" + lang_messen_RW + ": " + this.clickedWorldX + "m | " + lang_messen_HW + ": " + this.clickedWorldY +"m"; info_html_text = MEASUREShowPointResult_Format.replace("{METER}", meter_result).replace("{GEO}", geo_result); MEASURE.ShowResult(info_html_text); //$("measureResultText").innerHTML = MEASUREShowPointResult_Format.replace("{METER}", meter_result).replace("{GEO}", geo_result); } else { if (MEASUREShowPointResultGeografic) { try { result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformToGeografic", ["coordPairs", "coordSystem"], [this.clickedWorldX+","+this.clickedWorldY, projectCoordSystem], "GeoCode.asmx"); coords = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes[0].firstChild.data; $("measureResultText").innerHTML = GENERAL.GetTransformedCoordString(coords.split("|")[1]) + "   " + GENERAL.GetTransformedCoordString(coords.split("|")[0]); } catch(e) { $("measureResultText").innerHTML = "Fehler!"; } } else { $("measureResultText").innerHTML = MEASUREPointCoordSystemText + "" + lang_messen_RW + ": " + this.clickedWorldX + "m | " + lang_messen_HW + ": " + this.clickedWorldY +"m"; } } } /*MAP.ClickedX = coords.split("|")[0]; MAP.ClickedY = coords.split("|")[1];*/ //$("measureResultText").innerHTML = "RW: " + this.clickedWorldX + "m | HW: " + this.clickedWorldY +"m"; } // end point // line MEASURE.Line_Click = function () { MEASURE.Cancel_Click(); $("IconLine").className = "IconSelected"; MapAction.isMeasure = true; MEASURE.Type = 1; if(MAP.GoogleMap != null) { GM.LineDistance(); return; } MAP.AddEventListener(MapAction.click, "MEASURE.Line"); $("pois").style.zIndex = "3"; } MEASURE.Line = function (obj) { if (obj != null) { MEASURE.SetXY(obj); coords = []; coords[0] = new RPCoordPair(this.clickedWorldX, this.clickedWorldY); // world coords coords[1] = new RPCoordPair(this.clickedPixelX, this.clickedPixelY); // pixel coords MEASURE.LineCoords.push(coords); } LineCoordsLength = MEASURE.LineCoords.length; if (LineCoordsLength == 0) return; $("dDraw").innerHTML = ""; dist = 0; currDist = 0; dx = 0; dy = 0; for (i = 0; i < LineCoordsLength-1; i++) { dx = MEASURE.LineCoords[i][0].X - MEASURE.LineCoords[i+1][0].X; dy = MEASURE.LineCoords[i][0].Y - MEASURE.LineCoords[i+1][0].Y; currDist = Math.sqrt((dx*dx) + (dy*dy)); dist += currDist; } if((currDist >= 10000) && (dist >= 10000)) info_html_text = lang_messen_SegmentLaenge + ": " + formatZahlTausendertrennzeichen(dezRound(currDist/1000, 3), ".",3) + " km
" + lang_messen_Gesamtlaenge + ": " + formatZahlTausendertrennzeichen(dezRound(dist/1000, 3), ".",3) + " km"; else if((currDist < 10000) && (dist >= 10000)) info_html_text = lang_messen_SegmentLaenge + ": " + formatZahlTausendertrennzeichen(dezRound(currDist, 3), ".",3) + " m
" + lang_messen_Gesamtlaenge + ": " + formatZahlTausendertrennzeichen(dezRound(dist/1000, 3), ".",3) + " km"; else info_html_text = lang_messen_SegmentLaenge + ": " + formatZahlTausendertrennzeichen(dezRound(currDist, 3), ".",3) + " m
" + lang_messen_Gesamtlaenge + ": " + formatZahlTausendertrennzeichen(dezRound(dist, 3), ".",3) + " m"; MEASURE.ShowResult(info_html_text); //$("measureResultText").innerHTML = lang_messen_SegmentLaenge + ": " + formatZahlTausendertrennzeichen(dezRound(currDist, 0), ".") + "m | " + lang_messen_Gesamtlaenge + ": " + formatZahlTausendertrennzeichen(dezRound(dist, 0), ".") + "m"; /* Drawing.Point("dDraw", this.pointWidth, this.pointColor, MAP.GetPixelXFromWorldCoord(MEASURE.LineCoords[LineCoordsLength-1][0].X), MAP.GetPixelYFromWorldCoord(MEASURE.LineCoords[LineCoordsLength-1][0].Y)); if (LineCoordsLength > 1) Drawing.Line("dDraw", this.lineWidth, this.lineColor, MAP.GetPixelXFromWorldCoord(MEASURE.LineCoords[LineCoordsLength-2][0]), MAP.GetPixelYFromWorldCoord(MEASURE.LineCoords[LineCoordsLength-1][0])); */ for (i = 0; i < LineCoordsLength; i++) { Drawing.Point("dDraw", this.pointWidth, this.pointColor, MAP.GetPixelXFromWorldCoord(MEASURE.LineCoords[i][0].X), MAP.GetPixelYFromWorldCoord(MEASURE.LineCoords[i][0].Y)); if (i > 0) { ___newFrom = new RPCoordPair(MAP.GetPixelXFromWorldCoord(MEASURE.LineCoords[i-1][0].X), MAP.GetPixelYFromWorldCoord(MEASURE.LineCoords[i-1][0].Y)); ___newTo = new RPCoordPair(MAP.GetPixelXFromWorldCoord(MEASURE.LineCoords[i][0].X), MAP.GetPixelYFromWorldCoord(MEASURE.LineCoords[i][0].Y)); Drawing.Line("dDraw", this.lineWidth, this.lineColor, ___newFrom, ___newTo); } } } // area MEASURE.Area_Click = function () { MEASURE.Cancel_Click(); MapAction.isMeasure = true; MEASURE.Type = 2; $("IconArea").className = "IconSelected"; if(MAP.GoogleMap != null) { GM.MeasureArea(); return; } MAP.AddEventListener(MapAction.click, "MEASURE.Area"); $("pois").style.zIndex = "3"; } MEASURE.Area = function (obj) { if (obj != null) { MEASURE.SetXY(obj); coords = []; coords[0] = new RPCoordPair(this.clickedWorldX, this.clickedWorldY); // world coords coords[1] = new RPCoordPair(this.clickedPixelX, this.clickedPixelY); // pixel coords MEASURE.AreaCoords.push(coords); } AreaCoordsLength = MEASURE.AreaCoords.length; if (AreaCoordsLength == 0) return; $("dDraw").innerHTML = ""; area = 0; currArea = 0; for (i=2; i< AreaCoordsLength; i++) { x1 = MEASURE.AreaCoords[i-1][0].X - MEASURE.AreaCoords[0][0].X; x2 = MEASURE.AreaCoords[i][0].X - MEASURE.AreaCoords[0][0].X; y1 = MEASURE.AreaCoords[i-1][0].Y - MEASURE.AreaCoords[0][0].Y; y2 = MEASURE.AreaCoords[i][0].Y - MEASURE.AreaCoords[0][0].Y; currArea = (x1*y2 - x2*y1)/2; area += currArea; } currArea = Math.abs(currArea); area = Math.abs(area); //info_html_text = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(area, 3), ".", 3) + " m²"; if(typeof(MEASUREAreaUnit) != "undefined") { if(area >= 1000000) info_html_text = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(area/1000000, 3), ".", 2) + " km2"; else info_html_text = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(area, 3), ".", 2) + " m²"; } //Comentado em 23-11-2009 // if(typeof(MEASUREAreaUnit) != "undefined") // { // switch(MEASUREAreaUnit) // { // case 2 : // info_html_text = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(area/100, 0), ".") + "a"; // break; // case 3 : // info_html_text = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(area/10000, 0), ".") + "ha"; // break; // case 4 : // info_html_text = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(area/1000000, 0), ".") + "km²"; // break; // } // } MEASURE.ShowResult(info_html_text); //Comentado em 23-11-2009 //$("measureResultText").innerHTML = lang_messen_flaeche + ": " + formatZahlTausendertrennzeichen(dezRound(area, 0), ".") + "m²"; //------------------ /* polyCoords = ""; for (i = 0; i < AreaCoordsLength; i++) { Drawing.Point("dDraw", this.pointWidth, this.pointColor, MEASURE.AreaCoords[i][1].X, MEASURE.AreaCoords[i][1].Y); polyCoords += MEASURE.AreaCoords[i][1].X + "px," + MEASURE.AreaCoords[i][1].Y + "px "; } //close polygon polyCoords += MEASURE.AreaCoords[0][1].X + "px," + MEASURE.AreaCoords[0][1].Y + "px "; */ polyCoords = ""; for (i = 0; i < AreaCoordsLength; i++) { Drawing.Point("dDraw", this.pointWidth, this.pointColor, MAP.GetPixelXFromWorldCoord(MEASURE.AreaCoords[i][0].X), MAP.GetPixelYFromWorldCoord(MEASURE.AreaCoords[i][0].Y)); polyCoords += MAP.GetPixelXFromWorldCoord(MEASURE.AreaCoords[i][0].X) + "px," + MAP.GetPixelYFromWorldCoord(MEASURE.AreaCoords[i][0].Y) + "px "; } //close polygon polyCoords += MAP.GetPixelXFromWorldCoord(MEASURE.AreaCoords[0][0].X) + "px," + MAP.GetPixelYFromWorldCoord(MEASURE.AreaCoords[0][0].Y) + "px "; if (polyCoords != "") Drawing.Polygon("dDraw", this.lineWidth, this.lineColor, this.fillColor, this.opacity, polyCoords); } MEASURE.ShowResult = function(info_html_text) { MapInfoBox.Create("Resultado", info_html_text, 270, -1, true, "MEASURE"); } /* class Drawing */ function Drawing() {} Drawing.Point = function(layerId, pWidth, color, px, py) { if (GENERAL.IsVML()) { $(layerId).innerHTML += ' '; } else { jg = new jsGraphics(layerId); jg.setColor(color); jg.fillEllipse(px-(pWidth/2), py-(pWidth/2), pWidth, pWidth); jg.paint(); } } Drawing.Line = function(layerId, pWidth, color, coordsFrom, coordsTo) { if (GENERAL.IsVML()) { $(layerId).innerHTML += ''; } else { jg = new jsGraphics(layerId); jg.setColor(color); jg.setStroke(pWidth); jg.drawLine(Math.round(coordsFrom.X), Math.round(coordsFrom.Y), Math.round(coordsTo.X), Math.round(coordsTo.Y)); jg.paint(); } } Drawing.Polygon = function(layerId, pWidth, color, fillColor, opacity, polyCoords) { if (GENERAL.IsVML()) { strPoly = ''; strPoly += ' '; if (fillColor != null) strPoly += ' '; strPoly += ''; $(layerId).innerHTML += strPoly; } else { jg = new jsGraphics(layerId); jg.setColor(color); jg.setStroke(pWidth); var arrX = new Array(); var arrY = new Array(); strCrdsArr = polyCoords.split(" "); for(i = 0; i < strCrdsArr.length; i++) { strArrN = strCrdsArr[i].split(","); arrX.push(parseInt(strArrN[0])); arrY.push(parseInt(strArrN[1])); } jg.drawPolygon(arrX, arrY); jg.paint(); } } Drawing.Icon = function(layerId, symbolSrc, point, clearOtherElements) { symbol = new Image(); symbol.src = symbolSrc; symbolW = symbol.width; symbolH = symbol.height; if (clearOtherElements) $(layerId).innerHTML = ""; $(layerId).innerHTML += ""; } Drawing.IconRealWorld = function(layerId, symbolSrc, point, clearOtherElements) { symbol = new Image(); symbol.src = symbolSrc; symbolW = symbol.width; symbolH = symbol.height; if (clearOtherElements) $(layerId).innerHTML = ""; $(layerId).innerHTML += ""; } Drawing.Coords = function (x,y) { this.X = x; this.Y = y; } var printLeft; var printTop; var printRight; var printBottom; TOOLBAR.Print = function() { if(MAP.GoogleMap != null || MAP.VE != null) { alert("Esta funcionalidade não se encontra disponível sobre este mapa."); return; } if (allow_l_print && allow_p_print) { list = "
    "; list += "
  • Retrato
  • "; list += "
  • Paisagem
  • "; list += "
      "; MapInfoBox.Create("Opções impressão", list, 186, -1, true, "PRINT"); } else if (allow_p_print) TOOLBAR.OpenPrint('p'); else if (allow_l_print) TOOLBAR.OpenPrint('l'); } TOOLBAR.OpenPrint = function(format) { imgName = TOOLBAR.GetPrintImage(format); var gmVar = ""; if(MAP.GoogleMap != null) { gmVar = "&gm=" + MAP.GoogleMap.getCenter().lat() + ";" + MAP.GoogleMap.getCenter().lng() + ";" + MAP.GoogleMap.getZoom() + ";" + MAP.GoogleMap.getCurrentMapType().getUrlArg(); } if (format == "p") { if (imgName != "") { window.open(print_p_doc + "?i=" + imgName + "&sid=" + sid + "&site=" + site + "&map=" + map + "&projectTitle=" + projectTitle + "&left=" + printLeft+ "&top=" + printTop+ "&right=" + printRight+ "&bottom=" + printBottom + print_url_extension + gmVar + "&scale=" + MAP.arrZoomRanges[MAP.currentZoomRangeIndex]); } } else { if (imgName != "") { window.open(print_l_doc + "?i=" + imgName + "&sid=" + sid + "&site=" + site + "&map=" + map + "&projectTitle=" + projectTitle + "&left=" + printLeft+ "&top=" + printTop+ "&right=" + printRight+ "&bottom=" + printBottom + print_url_extension +gmVar + "&scale=" + MAP.arrZoomRanges[MAP.currentZoomRangeIndex]); } } if (allow_l_print && allow_p_print) MapInfoBox.Close(); } TOOLBAR.GetPrintImage = function (format) { //alert(QUERIES.CurrentPinImage); MAP.InitializeMembers(); imgName = ""; hasDetail = (MAP.GetDetailInfoFromSession().length == 0 ? false : true); var methodname = "GetOneImageForCurrentMap"; if(MAP.GoogleMap != null || MAP.VE != null) methodname = "GetOneImageForPois"; try { var MapXmlHelperObj = new XmlHelperObj(); if (format == "p") { print_p_width_n = print_p_width; print_p_height_n = print_p_height; if(hasDetail) { print_p_width_n = print_p_info_width; print_p_height_n = print_p_info_height; } printLeft = MAP.CenterX - MAP.GetMeterForPixelX(print_p_width_n/2); printTop = MAP.CenterY + MAP.GetMeterForPixelY(print_p_height_n/2); printRight = MAP.CenterX + MAP.GetMeterForPixelX(print_p_width_n/2); printBottom = MAP.CenterY - MAP.GetMeterForPixelY(print_p_height_n/2); // alert(QUERIES.CurrentPinRW + "\n" + QUERIES.CurrentPinHW + "\n" + QUERIES.CurrentPinImage); resultMap = MapXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", methodname, ["sid", "project", "site", "px", "py", "left", "top", "right", "bottom", "map", "returnServerPath", "showScaleBar", "scaleBarWidth", "scaleBarText", "highlightX", "highlightY", "highlightSymbol", "showUsagerequirement"], [sid, project, site, print_p_width_n, print_p_height_n, printLeft, printTop, printRight, printBottom, map, "false", ScaleBar.IsShow, ScaleBar.width, ScaleBar.text, QUERIES.CurrentPinRW, QUERIES.CurrentPinHW, QUERIES.CurrentPinImage, print_showUsagerequirement], "RPWeb_Services.asmx"); } else { print_l_width_n = print_l_width; print_l_height_n = print_l_height; if(hasDetail) { print_l_width_n = print_l_info_width; print_l_height_n = print_l_info_height; } printLeft = MAP.CenterX - MAP.GetMeterForPixelX(print_l_width_n/2); printTop = MAP.CenterY + MAP.GetMeterForPixelY(print_l_height_n/2); printRight = MAP.CenterX + MAP.GetMeterForPixelX(print_l_width_n/2); printBottom = MAP.CenterY - MAP.GetMeterForPixelY(print_l_height_n/2); resultMap = MapXmlHelperObj.GetResultFromSoapRequest("http://www.gisquadrat.com", methodname, ["sid", "project", "site", "px", "py", "left", "top", "right", "bottom", "map", "returnServerPath", "showScaleBar", "scaleBarWidth", "scaleBarText", "highlightX", "highlightY", "highlightSymbol", "showUsagerequirement"], [sid, project, site, print_l_width_n, print_l_height_n, printLeft, printTop, printRight, printBottom, map, "false", ScaleBar.IsShow, ScaleBar.width, ScaleBar.text, QUERIES.CurrentPinRW, QUERIES.CurrentPinHW, QUERIES.CurrentPinImage, print_showUsagerequirement], "RPWeb_Services.asmx"); } imgName = resultMap.responseXML.documentElement.getElementsByTagName(methodname+"Result")[0].firstChild.data; } catch(e) { alert(e.message); } return imgName; } TOOLBAR.Save = function() { if(MAP.GoogleMap != null || MAP.VE != null) { alert("Esta funcionalidade não se encontra disponível sobre este mapa."); return; } //prompt("", "./SaveMap.aspx?sid="+sid + "&project=" + project + "&site=" + site + "&px=" + MAP.outputWidth + "&py=" + MAP.outputHeight + "&left=" + MAP.strLeft + "&top=" + MAP.strTop + "&right=" + MAP.strRight + "&bottom=" + MAP.strBottom + "&map=" + map +"&scaleBarText=" + ScaleBar.text + "&scaleBarWidth=" + ScaleBar.width + "&showScaleBar=" + ScaleBar.IsShow + "&highlightX=" + QUERIES.CurrentPinRW +"&highlightY=" + QUERIES.CurrentPinHW + "&highlightSymbol=" + QUERIES.CurrentPinImage) location.href = "./SaveMap.aspx?sid="+sid + "&project=" + project + "&site=" + site + "&px=" + MAP.outputWidth + "&py=" + MAP.outputHeight + "&left=" + MAP.strLeft + "&top=" + MAP.strTop + "&right=" + MAP.strRight + "&bottom=" + MAP.strBottom + "&map=" + map +"&scaleBarText=" + ScaleBar.text + "&scaleBarWidth=" + ScaleBar.width + "&showScaleBar=" + ScaleBar.IsShow + "&highlightX=" + QUERIES.CurrentPinRW +"&highlightY=" + QUERIES.CurrentPinHW + "&highlightSymbol=" + QUERIES.CurrentPinImage + "&showUsagerequirement="+print_showUsagerequirement; } function MapInfoBox() { } MapInfoBox.OpenID = ""; var mpInfoBoxDrag = null; MapInfoBox.Create = function (headerText, content, x, y, dragable, id) { $("MapInfoBoxHeader").innerHTML = headerText; $("MapInfoBoxContent").innerHTML = content; if (MapInfoBox.OpenID != id) { $("MapInfo").style.left = x + 'px'; $("MapInfo").style.top = y + 'px'; Effect.BlindDown("MapInfo", {duration:0.3, afterFinish: function () { contentSize = $("MapInfoBoxContent").getDimensions(); } }); if (mpInfoBoxDrag != null) mpInfoBoxDrag.destroy(); if (dragable) mpInfoBoxDrag = new Draggable('MapInfo',{handle:'header'}); } MapInfoBox.OpenID = id; } MapInfoBox.Close = function () { //Effect.SwitchOff("MapInfo", {duration:0.2}); Effect.SlideUp("MapInfo", {duration:0.3}); MapInfoBox.OpenID = ""; }  //PageOnloadEvents.push("APPLICATION.AddStandardEvents"); function Page_Load() { try { if(APPLICATION.PreLoad()) //check important thinks before we can go on { APPLICATION.AddStandardEvents(); callPageOnloadEvents(); MAP.ChangeMap(null); /* InitializeContent(true, false); setTimeout("this.SetPageEvents()", 200); setTimeout("MAP.ChangeMap(null)", 0); setTimeout("InitializeContent(true, false)", 100); setTimeout("this.SetPageEvents()", 100); setTimeout("PANEL.Open(" + currPanel + ", 'panelContent" + currPanel + "')", 100); GENERAL.GetVersion(); */ } } catch (e) { alert("Fehler beim laden der Seite: " + Err.GetErrorMessage(e)); } } function FirstStart() { InitializeContent(true, false); this.SetPageEvents(); PANEL.Open(currPanel, 'panelContent' + currPanel); if (ovOpen != null && ovOpen == 1) Overview.OpenClose(); //setTimeout("PANEL.Open(" + currPanel + ", 'panelContent" + currPanel + "')", 100); setTimeout("GENERAL.GetVersion()", 10000); } function callPageOnloadEvents() { var DynFunction; for (idxPageLoadEvents = 0; idxPageLoadEvents < PageOnloadEvents.length; idxPageLoadEvents++) { DynFunction = new Function("", String(PageOnloadEvents[idxPageLoadEvents] + "();")); DynFunction(); } } function SetPageEvents() { window.onresize = function () { InitializeContent(false, false); } document.images["mapAction"].onmousedown = MAP.click; document.images["mapAction"].ondblclick = MAP.dblClick; document.images["mapAction"].onmouseup = MAP.clickUp; document.images["mapAction"].onmousemove = MAP.mouseMove; if ($("mapArea").addEventListener) $("mapArea").addEventListener('DOMMouseScroll', wheel, false); $("mapArea").onmousewheel = wheel; } var mapTimeout = null; function InitializeContent(isInit, onlyInit) { //alert(isInit + "\n" + onlyInit); try { window.clearInterval(mapTimeout); pageProperties = new GUI.PageProperties(); //alert(pageProperties._height); GUI.SetObjWidth($("header"), pageProperties._width-10); mapHeight = (pageProperties._height-headerHeight-mapFunctionsHeight); if (GENERAL.IsIElt7()) { //mapHeight = mapHeight-2; //mapHeight = mapHeight; if (!loadMapFunctions) mapHeight = (mapHeight + mapFunctionsHeight)-5; } else if (!loadMapFunctions) mapHeight = (mapHeight + mapFunctionsHeight)-5; mapWidth = pageProperties._width - (GUI.GetMapPixelLeft()+mapLeftPadding+mapRightPadding); GUI.SetObjWidth($("content"), "300"); GUI.SetObjWidth($("content"), pageProperties._width); GUI.SetObjHeight($("content"), (pageProperties._height-headerHeight)); GUI.SetObjHeight($("panel"), (pageProperties._height-headerHeight)); GUI.SetObjHeight($("panelCol1"), (pageProperties._height-(headerHeight+panelBorder+panelContentContainerPadding))); GUI.SetObjHeight($("panelAction"), (pageProperties._height-headerHeight)); GUI.SetObjHeight($("ifPlaceHolderPanel"), (pageProperties._height-headerHeight)); GUI.SetObjWidth($("mapArea"), mapWidth); GUI.SetObjHeight($("mapArea"), mapHeight); GUI.SetObjWidth($("othermaps"), mapWidth); GUI.SetObjHeight($("othermaps"), mapHeight); GUI.SetObjWidth($("mapAction"), mapWidth); GUI.SetObjHeight($("mapAction"), mapHeight); //GUI.SetObjWidth($("showResult"), mapWidth); //GUI.SetObjHeight($("showResult"), mapHeight); GUI.SetObjWidth($("mapAreaCollection"), pageProperties._width - (GUI.GetMapPixelLeft()+mapLeftPadding+mapRightPadding)); GUI.SetObjHeight($("mapAreaCollection"), (pageProperties._height - (headerHeight+mapBottomPadding))); document.images["mapAction"].width = mapWidth; document.images["mapAction"].height = mapHeight; GUI.SetObjWidth($("dMapAction"), mapWidth); GUI.SetObjHeight($("dMapAction"), mapHeight); GUI.SetObjWidth($("mapFunctionsContainer"), mapWidth); //aktiven panel anpassen if (PANEL.CurrentPanel != null) GUI.SetObjHeight($(PANEL.CurrentPanel), ((pageProperties._height-(headerHeight+panelBorder+panelContentContainerPadding))-1)-(PANEL.PanelCount*panelHeaderHeight)); if(PANEL.PanelIsHide == false) $("ifPlaceHolderPanel").style.display = "none"; //ggf ve anpassen if (MAP.VE != null) { MAP.VE.Resize(mapWidth, mapHeight); } if (!onlyInit) { if(typeof(isInit) == "boolean") { if (!isInit) MAP.LoadMaps(); else ReloadMap(); //mapTimeout = window.setInterval("ReloadMap()", 10); } else ReloadMap(); //mapTimeout = window.setInterval("ReloadMap()", 10); } } catch (e) { alert("Fehler beim initialisieren der Seite: " + e.Message + "\n" + e.description); } } function ReloadMap() { if (mapTimeout != null) window.clearInterval(mapTimeout); startMap(); } function startMap(isFit) { //alert(gotoScale); standardScale = gotoScale != null ? gotoScale : 5000; showPinAtStart = (showResultPin == "0" ? false : true); //beim einstieg symbolanzeigen if(showPinAtStart) QUERIES.Displaybehavior = 1; //treffpunkt if (meetingpoint != null && meetingpointX != null && meetingpointY != null) { MeetingPlace.SelectedSymbolId = meetingpoint; if (meetingpointLat != null && meetingpointLng != null) { MeetingPlace.Point = new GLatLng(meetingpointLat, meetingpointLng); return true; } MeetingPlace.Point = new RPCoordPair(meetingpointX, meetingpointY); //MAP.AddEventListener(MapAction.load, "MeetingPlace.DrawSymbol"); MAP.AddEventListener(MapAction.zoom, "MeetingPlace.DrawSymbol"); MAP.AddEventListener(MapAction.move, "MeetingPlace.DrawSymbol"); MAP.ZoomToXY(meetingpointX, meetingpointY, standardScale, showPinAtStart); /*meetingpoint = null; meetingpointX = null; meetingpointY = null;*/ return true; } if (gotoX != null && gotoY != null) //start with x,y { //alert(gotoX + "\n" + standardScale); MAP.ZoomToXY(gotoX, gotoY, standardScale, showPinAtStart); //gotoX = null; //gotoY = null; return true; } if (gotoLat != null && gotoLon != null) //start with latitude, longitude { cPoints = gotoLat + "," + gotoLon; //alert(cPoints); result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformFromGeografic", ["coordPairs", "coordSystem"], [cPoints, projectCoordSystem], "GeoCode.asmx"); lastChild = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes; x = Math.round(lastChild[0].firstChild.data.split("|")[0]); y = Math.round(lastChild[0].firstChild.data.split("|")[1]); //prompt("", x + " - " + y + " - " + standardScale); MAP.ZoomToXY(x, y, standardScale, showPinAtStart); //gotoLat = null; //gotoLon = null; return true; } if (isFit) return false; if (gotoScale != null) { MAP.GotoScale(gotoScale); return; } MAP.LoadMaps(); } /* mouse scrollwheel */ WheelWorldXDiff = null; WheelWorldYDiff = null; function handle(delta) { if (MAP.screenX != null) { MAP.InitializeMembers(); WheelWorldXDiff = MAP.CenterX - MAP.GetMeterFromPixelX(MAP.screenX); WheelWorldYDiff = MAP.CenterY - MAP.GetMeterFromPixelY(MAP.screenY); MAP.CenterX = MAP.GetMeterFromPixelX(MAP.screenX); MAP.CenterY = MAP.GetMeterFromPixelY(MAP.screenY); } if (delta < 0) { if (MAP.GoogleMap != null) MAP.GoogleMap.zoomOut(); else if (MAP.VE == null) TOOLBAR.ZoomOut(); } else { if (MAP.GoogleMap != null) MAP.GoogleMap.zoomIn(); else if (MAP.VE == null) TOOLBAR.ZoomIn(); } } function wheel(event) { if (!MAP.CheckRange()) return; var delta = 0; if (!event) event = window.event; if (event.wheelDelta) { delta = event.wheelDelta/120; if (window.opera) delta = -delta; } else if (event.detail) { delta = -event.detail/3; } if (delta) handle(delta); if (event.preventDefault) event.preventDefault(); event.returnValue = false; } /* class APPLICATION */ function APPLICATION() {} //check important thinks before we can go on APPLICATION.PreLoad = function () { if (loadDefaultMap) MAP.GetDefaultMap(); MAP.SetMembers(); //InitializeContent(true, true); MAP.InitializeMembers(); return true; } APPLICATION.AddStandardEvents = function() { //nutzungsbestimmungen bei jeden mapchange vom server holen MAP.AddEventListener(MapAction.mapChanged, "MAP.loadUsagerequirement"); } /* Mappoint suche class MP */ function MP() {} MP.Search = function () { if(MAP.GoogleMap == null) { //alert("Suche nur bei Googlekarte möglich."); //return; } try { // public AdressCoords GetAddressCoords(string street, string zip, string city, string country) req = Intergraph.Respublica.Web.MappointAddressSearch.MapPointAddress.GetAddressCoords($("MPStreet").value, $("MPZip").value, $("MPCity").value, $("MPCountry").value, MP.Handler_Search, MP.OnError); } catch(e) { alert("Es wurde keine Adresse gefunden.\n" + e.message); } } MP.SearchWithParameter = function (street, hnr, zip, city, country) { try { ///alert(street + "\n" + hnr + "\n" + zip + "\n" + city + "\n" + country); req = Intergraph.Respublica.Web.MappointAddressSearch.MapPointAddress.GetAddressCoords(street + " " + hnr, zip, city, country, MP.Handler_Search, MP.OnError); } catch(e) { alert("Es wurde keine Adresse gefunden.\n" + e.message); } } MP.Handler_Search = function (result) { latitude = parseFloat(result.Latitude); longitude = parseFloat(result.Longitude); score = parseFloat(result.Score); if (latitude == 0) { alert("Es wurde keine Adresse gefunden."); return; } if(MAP.GoogleMap == null && MAP.VE == null) { //var coords = null; //prompt("c", latitude +","+ longitude); req = Intergraph.Respublica.Web.GeocodeService.GeoCode.TransformFromGeografic(latitude +","+ longitude, projectCoordSystem, MP.Handler_SearchTransform, MP.OnError); } else if (MAP.GoogleMap != null) { scale = 16; //parseInt(prompt("Zoomstufe","")); GM.ZoomToCoordinates(new GLatLng(latitude, longitude), scale); } else if (MAP.VE != null) { scale = 16; //parseInt(prompt("Zoomstufe","")); mVE.ZoomToCoordinates(new VELatLong(latitude, longitude), scale); } } MP.Handler_SearchTransform = function (result) { //alert(parseFloat(result.coords[0].split("|")[0]) + "," + parseFloat(result.coords[0].split("|")[1])); MAP.ZoomToXY(parseFloat(result.coords[0].split("|")[0]), parseFloat(result.coords[0].split("|")[1]), 5000, true); } MP.OnAborted = function (request, userContext) { var errorString = "The call to '" + userContext + "' failed, request is aborted!"; // alert(errorString); } MP.OnTimeout = function (request, userContext) { var timeoutString = "The call to '" + userContext + "' failed due to time out!"; alert(timeoutString); } MP.OnError = function (result, response, userContext) { //MAP.Loading(false, userContext); var errorString = "Test '" + userContext + "' failed!"; if (result == null) { errorString += " Status code='" + response.get_statusCode() + "'"; } else { errorString += " Message='" + result.get_message() + "'\r\nstackTrace = " + result.get_stackTrace(); } alert(errorString); }  function MeetingPlace() { this.clickedPixelX = null; this.clickedPixelY = null; this.clickedWorldX = null; this.clickedWorldY = null; } MeetingPlace.Point = null; MeetingPlace.GMEvent = null; MeetingPlace.marker = null; MeetingPlace.Open = function () { GENERAL.WindowOpen("Treffpunkt.aspx?sid=" + sid + "&site=" + site + "&project=" + project, "", "400", "400"); } MeetingPlace.SelectedSymbolId = null; MeetingPlace.FirstStep = function () { try { oMp = document.form1.treffpunkt; //oMp = document.getElementById("formMeetingpoint").elements.treffpunkt; if (oMp != null) { if (GENERAL.CheckRadiobutton(oMp) != null) { MeetingPlace.SelectedSymbolId = GENERAL.CheckRadiobutton(oMp); if (MAP.GoogleMap != null) { MeetingPlace.GMEvent = GEvent.addListener(MAP.GoogleMap, "click", function(overlay, point) { if(overlay==null && point!=null) { MeetingPlace.SecondStep(point); } }); } else { MAP.AddEventListener(MapAction.click, "MeetingPlace.SecondStep"); } $("GetSecondStepText").innerHTML = ""; } else alert("Bitte Symbol auswählen."); } } catch(e) { alert("Es ist ein Fehler aufgetreten. (MeetingPlace.FirstStep)"); } } MeetingPlace.SecondStep = function (obj) { if (MAP.GoogleMap != null) { GEvent.removeListener(MeetingPlace.GMEvent); MeetingPlace.Point = obj; MeetingPlace.DrawSymbol(); cPoints = obj.lat() + "," + obj.lng(); result = XmlHelper.GetResultFromSoapRequest("http://www.gisquadrat.com/geocode", "TransformFromGeografic", ["coordPairs", "coordSystem"], [cPoints, projectCoordSystem], "GeoCode.asmx"); lastChild = result.responseXML.documentElement.firstChild.firstChild.firstChild.firstChild.childNodes; x = Math.round(lastChild[0].firstChild.data.split("|")[0]); y = Math.round(lastChild[0].firstChild.data.split("|")[1]); MeetingPlace.OpenSend(MeetingPlace.GetMapUrl(MeetingPlace.SelectedSymbolId, new RPCoordPair(x, y), obj)); return false; } try { MapAction.isMeetingPlace = true; MeetingPlace.SetXY(obj); //smbol in der karte einzeichnen MAP.AddEventListener(MapAction.move, "MeetingPlace.DrawSymbol"); MAP.RemoveEventListener(MapAction.click, "MeetingPlace.SecondStep"); MeetingPlace.Point = new RPCoordPair(this.clickedWorldX, this.clickedWorldY); MeetingPlace.DrawSymbol(); //fenster mit link oeffnen MeetingPlace.OpenSend(MeetingPlace.GetMapUrl(MeetingPlace.SelectedSymbolId, new RPCoordPair(this.clickedWorldX, this.clickedWorldY))); } catch(e) { alert("Es ist ein Fehler aufgetreten. (MeetingPlace.SecondStep)" + e.message); } MapAction.isMeetingPlace = false; return false; } MeetingPlace.DrawSymbol = function() { symbolSrc = MeetingPlace.GetSymbol(MeetingPlace.SelectedSymbolId); if (MAP.GoogleMap != null) { if(MeetingPlace.marker != null) MAP.GoogleMap.removeOverlay(MeetingPlace.marker); var imgChk = new Image(); imgChk.src = symbolSrc; poiW = imgChk.width; poiH = imgChk.height; var icon = new GIcon(); icon.image = symbolSrc; icon.iconSize = new GSize(poiW, poiH); icon.iconAnchor = new GPoint(poiW/2, poiH/2); MeetingPlace.marker = new GMarker(MeetingPlace.Point, icon); MAP.GoogleMap.addOverlay(MeetingPlace.marker); return; } Drawing.IconRealWorld("dSymbols", symbolSrc, MeetingPlace.Point, true); } MeetingPlace.GetSymbol = function (symbolId) { var reqSymbol = new XmlHelperObj(); resultSymbol = reqSymbol.GetResultFromSoapRequest("http://www.gisquadrat.com", "GetSymbol", ["sid", "site", "project", "symbolId"], [sid, site, project, symbolId], "RPWeb_Services.asmx"); return reqSymbol.GetElementValue(resultSymbol, "imgSrc"); } MeetingPlace.GetMapUrl = function (symbolId, point, latLng) { return GENERAL.BuildUrl() + "&meetingpoint=" + symbolId + "&meetingpointX=" + point.X + "&meetingpointY=" + point.Y + (latLng ? "&meetingpointLat=" +latLng.lat() + "&meetingpointLng=" + latLng.lng() : ""); } MeetingPlace.SetXY = function (obj) { this.clickedPixelX = obj.x; this.clickedPixelY = obj.y; this.clickedWorldX = MAP.GetMeterFromPixelX(this.clickedPixelX); this.clickedWorldY = MAP.GetMeterFromPixelY(this.clickedPixelY); } MeetingPlace.OpenSend = function(nUrl) { //alert(nUrl); //wUrl = "TreffpunktSend.aspx?sid=" + sid + "&site=" + site + "&project=" + project + "&tUrl=" + escape(nUrl); setTimeout('MeetingPlace.GetSecondStepText("'+nUrl+'")', 300); return false; } MeetingPlace.GetSecondStepText = function(nUrl) { sb = new StringBuilder(); //sb.append('Sie können diesen Link auch gleich als '); //sb.append('email'); //sb.append(' verschicken.'); sb.append(unescape($("MPPart3Text").innerHTML).replace("[url]", escape(nUrl))); sb.append('

      '); sb.append('' + nUrl + ''); $("GetSecondStepText").innerHTML = sb.toString();; } MeetingPlace.Reset = function() { if (MAP.GoogleMap != null) { if(MeetingPlace.marker != null) MAP.GoogleMap.removeOverlay(MeetingPlace.marker); } $("dSymbols").innerHTML = ""; MeetingPlace.SelectedSymbolId = null; MAP.RemoveEventListener(MapAction.move, "MeetingPlace.DrawSymbol"); }/* This notice must be untouched at all times. wz_jsgraphics.js v. 2.36 The latest version is available at http://www.walterzorn.com or http://www.devira.com or http://www.walterzorn.de Copyright (c) 2002-2004 Walter Zorn. All rights reserved. Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com ) Last modified: 21. 6. 2006 Performance optimizations for Internet Explorer by Thomas Frank and John Holdsworth. fillPolygon method implemented by Matthieu Haller. High Performance JavaScript Graphics Library. Provides methods - to draw lines, rectangles, ellipses, polygons with specifiable line thickness, - to fill rectangles and ellipses - to draw text. NOTE: Operations, functions and branching have rather been optimized to efficiency and speed than to shortness of source code. LICENSE: LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, or see http://www.gnu.org/copyleft/lesser.html */ var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz, jg_n4 = (document.layers && typeof document.classes != "undefined"); function chkDHTM(x, i) { x = document.body || null; jg_ie = x && typeof x.insertAdjacentHTML != "undefined"; jg_dom = (x && !jg_ie && typeof x.appendChild != "undefined" && typeof document.createRange != "undefined" && typeof (i = document.createRange()).setStartBefore != "undefined" && typeof i.createContextualFragment != "undefined"); jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined"; jg_fast = jg_ie && document.all && !window.opera; jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined"; } function pntDoc() { this.wnd.document.write(jg_fast? this.htmRpc() : this.htm); this.htm = ''; } function pntCnvDom() { var x = this.wnd.document.createRange(); x.setStartBefore(this.cnv); x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm); if(this.cnv) this.cnv.appendChild(x); this.htm = ''; } function pntCnvIe() { if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm); this.htm = ''; } function pntCnvIhtm() { if(this.cnv) this.cnv.innerHTML += this.htm; this.htm = ''; } function pntCnv() { this.htm = ''; } function mkDiv(x, y, w, h) { this.htm += '
      <\/div>'; } function mkDivIe(x, y, w, h) { this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';'; } function mkDivPrt(x, y, w, h) { this.htm += '
      <\/div>'; } function mkLyr(x, y, w, h) { this.htm += '<\/layer>\n'; } var regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g; function htmRpc() { return this.htm.replace( regex, '
      \n'); } function htmPrtRpc() { return this.htm.replace( regex, '
      \n'); } function mkLin(x1, y1, x2, y2) { if (x1 > x2) { var _x2 = x2; var _y2 = y2; x2 = x1; y2 = y1; x1 = _x2; y1 = _y2; } var dx = x2-x1, dy = Math.abs(y2-y1), x = x1, y = y1, yIncr = (y1 > y2)? -1 : 1; if (dx >= dy) { var pr = dy<<1, pru = pr - (dx<<1), p = pr-dx, ox = x; while ((dx--) > 0) { ++x; if (p > 0) { this.mkDiv(ox, y, x-ox, 1); y += yIncr; p += pru; ox = x; } else p += pr; } this.mkDiv(ox, y, x2-ox+1, 1); } else { var pr = dx<<1, pru = pr - (dy<<1), p = pr-dy, oy = y; if (y2 <= y1) { while ((dy--) > 0) { if (p > 0) { this.mkDiv(x++, y, 1, oy-y+1); y += yIncr; p += pru; oy = y; } else { y += yIncr; p += pr; } } this.mkDiv(x2, y2, 1, oy-y2+1); } else { while ((dy--) > 0) { y += yIncr; if (p > 0) { this.mkDiv(x++, oy, 1, y-oy); p += pru; oy = y; } else p += pr; } this.mkDiv(x2, oy, 1, y2-oy+1); } } } function mkLin2D(x1, y1, x2, y2) { if (x1 > x2) { var _x2 = x2; var _y2 = y2; x2 = x1; y2 = y1; x1 = _x2; y1 = _y2; } var dx = x2-x1, dy = Math.abs(y2-y1), x = x1, y = y1, yIncr = (y1 > y2)? -1 : 1; var s = this.stroke; if (dx >= dy) { if (dx > 0 && s-3 > 0) { var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx; _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; } else var _s = s; var ad = Math.ceil(s/2); var pr = dy<<1, pru = pr - (dx<<1), p = pr-dx, ox = x; while ((dx--) > 0) { ++x; if (p > 0) { this.mkDiv(ox, y, x-ox+ad, _s); y += yIncr; p += pru; ox = x; } else p += pr; } this.mkDiv(ox, y, x2-ox+ad+1, _s); } else { if (s-3 > 0) { var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy; _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; } else var _s = s; var ad = Math.round(s/2); var pr = dx<<1, pru = pr - (dy<<1), p = pr-dy, oy = y; if (y2 <= y1) { ++ad; while ((dy--) > 0) { if (p > 0) { this.mkDiv(x++, y, _s, oy-y+ad); y += yIncr; p += pru; oy = y; } else { y += yIncr; p += pr; } } this.mkDiv(x2, y2, _s, oy-y2+ad); } else { while ((dy--) > 0) { y += yIncr; if (p > 0) { this.mkDiv(x++, oy, _s, y-oy+ad); p += pru; oy = y; } else p += pr; } this.mkDiv(x2, oy, _s, y2-oy+ad+1); } } } function mkLinDott(x1, y1, x2, y2) { if (x1 > x2) { var _x2 = x2; var _y2 = y2; x2 = x1; y2 = y1; x1 = _x2; y1 = _y2; } var dx = x2-x1, dy = Math.abs(y2-y1), x = x1, y = y1, yIncr = (y1 > y2)? -1 : 1, drw = true; if (dx >= dy) { var pr = dy<<1, pru = pr - (dx<<1), p = pr-dx; while ((dx--) > 0) { if (drw) this.mkDiv(x, y, 1, 1); drw = !drw; if (p > 0) { y += yIncr; p += pru; } else p += pr; ++x; } if (drw) this.mkDiv(x, y, 1, 1); } else { var pr = dx<<1, pru = pr - (dy<<1), p = pr-dy; while ((dy--) > 0) { if (drw) this.mkDiv(x, y, 1, 1); drw = !drw; y += yIncr; if (p > 0) { ++x; p += pru; } else p += pr; } if (drw) this.mkDiv(x, y, 1, 1); } } function mkOv(left, top, width, height) { var a = width>>1, b = height>>1, wod = width&1, hod = (height&1)+1, cx = left+a, cy = top+b, x = 0, y = b, ox = 0, oy = b, aa = (a*a)<<1, bb = (b*b)<<1, st = (aa>>1)*(1-(b<<1)) + bb, tt = (bb>>1) - aa*((b<<1)-1), w, h; while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); } else if (tt < 0) { st += bb*((x<<1)+3) - (aa<<1)*(y-1); tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); w = x-ox; h = oy-y; if (w&2 && h&2) { this.mkOvQds(cx, cy, -x+2, ox+wod, -oy, oy-1+hod, 1, 1); this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1); } else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h); ox = x; oy = y; } else { tt -= aa*((y<<1)-3); st -= (aa<<1)*(--y); } } this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod); this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod); } function mkOv2D(left, top, width, height) { var s = this.stroke; width += s-1; height += s-1; var a = width>>1, b = height>>1, wod = width&1, hod = (height&1)+1, cx = left+a, cy = top+b, x = 0, y = b, aa = (a*a)<<1, bb = (b*b)<<1, st = (aa>>1)*(1-(b<<1)) + bb, tt = (bb>>1) - aa*((b<<1)-1); if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0)) { var ox = 0, oy = b, w, h, pxl, pxr, pxt, pxb, pxw; while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); } else if (tt < 0) { st += bb*((x<<1)+3) - (aa<<1)*(y-1); tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); w = x-ox; h = oy-y; if (w-1) { pxw = w+1+(s&1); h = s; } else if (h-1) { pxw = s; h += 1+(s&1); } else pxw = h = s; this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h); ox = x; oy = y; } else { tt -= aa*((y<<1)-3); st -= (aa<<1)*(--y); } } this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod); this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod); } else { var _a = (width-((s-1)<<1))>>1, _b = (height-((s-1)<<1))>>1, _x = 0, _y = _b, _aa = (_a*_a)<<1, _bb = (_b*_b)<<1, _st = (_aa>>1)*(1-(_b<<1)) + _bb, _tt = (_bb>>1) - _aa*((_b<<1)-1), pxl = new Array(), pxt = new Array(), _pxb = new Array(); pxl[0] = 0; pxt[0] = b; _pxb[0] = _b-1; while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); pxl[pxl.length] = x; pxt[pxt.length] = y; } else if (tt < 0) { st += bb*((x<<1)+3) - (aa<<1)*(y-1); tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); pxl[pxl.length] = x; pxt[pxt.length] = y; } else { tt -= aa*((y<<1)-3); st -= (aa<<1)*(--y); } if (_y > 0) { if (_st < 0) { _st += _bb*((_x<<1)+3); _tt += (_bb<<1)*(++_x); _pxb[_pxb.length] = _y-1; } else if (_tt < 0) { _st += _bb*((_x<<1)+3) - (_aa<<1)*(_y-1); _tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-3); _pxb[_pxb.length] = _y-1; } else { _tt -= _aa*((_y<<1)-3); _st -= (_aa<<1)*(--_y); _pxb[_pxb.length-1]--; } } } var ox = 0, oy = b, _oy = _pxb[0], l = pxl.length, w, h; for (var i = 0; i < l; i++) { if (typeof _pxb[i] != "undefined") { if (_pxb[i] < _oy || pxt[i] < oy) { x = pxl[i]; this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy); ox = x; oy = pxt[i]; _oy = _pxb[i]; } } else { x = pxl[i]; this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod); this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); ox = x; oy = pxt[i]; } } this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod); this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); } } function mkOvDott(left, top, width, height) { var a = width>>1, b = height>>1, wod = width&1, hod = height&1, cx = left+a, cy = top+b, x = 0, y = b, aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, st = (aa2>>1)*(1-(b<<1)) + bb, tt = (bb>>1) - aa2*((b<<1)-1), drw = true; while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); } else if (tt < 0) { st += bb*((x<<1)+3) - aa4*(y-1); tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3); } else { tt -= aa2*((y<<1)-3); st -= aa4*(--y); } if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1); drw = !drw; } } function mkRect(x, y, w, h) { var s = this.stroke; this.mkDiv(x, y, w, s); this.mkDiv(x+w, y, s, h); this.mkDiv(x, y+h, w+s, s); this.mkDiv(x, y+s, s, h-s); } function mkRectDott(x, y, w, h) { this.drawLine(x, y, x+w, y); this.drawLine(x+w, y, x+w, y+h); this.drawLine(x, y+h, x+w, y+h); this.drawLine(x, y, x, y+h); } function jsgFont() { this.PLAIN = 'font-weight:normal;'; this.BOLD = 'font-weight:bold;'; this.ITALIC = 'font-style:italic;'; this.ITALIC_BOLD = this.ITALIC + this.BOLD; this.BOLD_ITALIC = this.ITALIC_BOLD; } var Font = new jsgFont(); function jsgStroke() { this.DOTTED = -1; } var Stroke = new jsgStroke(); function jsGraphics(id, wnd) { this.setColor = new Function('arg', 'this.color = arg.toLowerCase();'); this.setStroke = function(x) { this.stroke = x; if (!(x+1)) { this.drawLine = mkLinDott; this.mkOv = mkOvDott; this.drawRect = mkRectDott; } else if (x-1 > 0) { this.drawLine = mkLin2D; this.mkOv = mkOv2D; this.drawRect = mkRect; } else { this.drawLine = mkLin; this.mkOv = mkOv; this.drawRect = mkRect; } }; this.setPrintable = function(arg) { this.printable = arg; if (jg_fast) { this.mkDiv = mkDivIe; this.htmRpc = arg? htmPrtRpc : htmRpc; } else this.mkDiv = jg_n4? mkLyr : arg? mkDivPrt : mkDiv; }; this.setFont = function(fam, sz, sty) { this.ftFam = fam; this.ftSz = sz; this.ftSty = sty || Font.PLAIN; }; this.drawPolyline = this.drawPolyLine = function(x, y, s) { for (var i=0 ; i>1, b = (h -= 1)>>1, wod = (w&1)+1, hod = (h&1)+1, cx = left+a, cy = top+b, x = 0, y = b, ox = 0, oy = b, aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, st = (aa2>>1)*(1-(b<<1)) + bb, tt = (bb>>1) - aa2*((b<<1)-1), pxl, dw, dh; if (w+1) while (y > 0) { if (st < 0) { st += bb*((x<<1)+3); tt += (bb<<1)*(++x); } else if (tt < 0) { st += bb*((x<<1)+3) - aa4*(y-1); pxl = cx-x; dw = (x<<1)+wod; tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3); dh = oy-y; this.mkDiv(pxl, cy-oy, dw, dh); this.mkDiv(pxl, cy+y+hod, dw, dh); ox = x; oy = y; } else { tt -= aa2*((y<<1)-3); st -= aa4*(--y); } } this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod); }; /* fillPolygon method, implemented by Matthieu Haller. This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib. C source of GD 1.8.4 found at http://www.boutell.com/gd/ THANKS to Kirsten Schulz for the polygon fixes! The intersection finding technique of this code could be improved by remembering the previous intertersection, and by using the slope. That could help to adjust intersections to produce a nice interior_extrema. */ this.fillPolygon = function(array_x, array_y) { var i; var y; var miny, maxy; var x1, y1; var x2, y2; var ind1, ind2; var ints; var n = array_x.length; if (!n) return; miny = array_y[0]; maxy = array_y[0]; for (i = 1; i < n; i++) { if (array_y[i] < miny) miny = array_y[i]; if (array_y[i] > maxy) maxy = array_y[i]; } for (y = miny; y <= maxy; y++) { var polyInts = new Array(); ints = 0; for (i = 0; i < n; i++) { if (!i) { ind1 = n-1; ind2 = 0; } else { ind1 = i-1; ind2 = i; } y1 = array_y[ind1]; y2 = array_y[ind2]; if (y1 < y2) { x1 = array_x[ind1]; x2 = array_x[ind2]; } else if (y1 > y2) { y2 = array_y[ind1]; y1 = array_y[ind2]; x2 = array_x[ind1]; x1 = array_x[ind2]; } else continue; // modified 11. 2. 2004 Walter Zorn if ((y >= y1) && (y < y2)) polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); else if ((y == maxy) && (y > y1) && (y <= y2)) polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); } polyInts.sort(integer_compare); for (i = 0; i < ints; i+=2) this.mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1); } }; this.drawString = function(txt, x, y) { this.htm += '
      '+ txt + '<\/div>'; }; /* drawStringRect() added by Rick Blommers. Allows to specify the size of the text rectangle and to align the text both horizontally (e.g. right) and vertically within that rectangle */ this.drawStringRect = function(txt, x, y, width, halign) { this.htm += '
      '+ txt + '<\/div>'; }; this.drawImage = function(imgSrc, x, y, w, h, a) { this.htm += '
      '+ ''+ '<\/div>'; }; this.clear = function() { this.htm = ""; if (this.cnv) this.cnv.innerHTML = this.defhtm; }; this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h) { this.mkDiv(xr+cx, yt+cy, w, h); this.mkDiv(xr+cx, yb+cy, w, h); this.mkDiv(xl+cx, yb+cy, w, h); this.mkDiv(xl+cx, yt+cy, w, h); }; this.setStroke(1); this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN); this.color = '#000000'; this.htm = ''; this.wnd = wnd || window; if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM(); if (typeof id != 'string' || !id) this.paint = pntDoc; else { this.cnv = document.all? (this.wnd.document.all[id] || null) : document.getElementById? (this.wnd.document.getElementById(id) || null) : null; this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : ''; this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv; } this.setPrintable(false); } function integer_compare(x,y) { return (x < y) ? -1 : ((x > y)*1); } /* Prototype JavaScript framework, version 1.5.0 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. * For details, see the Prototype web site: http://prototype.conio.net/ * /*--------------------------------------------------------------------------*/ var Prototype = { Version: '1.5.0', BrowserFeatures: { XPath: !!document.evaluate }, ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', emptyFunction: function() {}, K: function(x) { return x } } var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } var Abstract = new Object(); Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; } Object.extend(Object, { inspect: function(object) { try { if (object === undefined) return 'undefined'; if (object === null) return 'null'; return object.inspect ? object.inspect() : object.toString(); } catch (e) { if (e instanceof RangeError) return '...'; throw e; } }, keys: function(object) { var keys = []; for (var property in object) keys.push(property); return keys; }, values: function(object) { var values = []; for (var property in object) values.push(object[property]); return values; }, clone: function(object) { return Object.extend({}, object); } }); Function.prototype.bind = function() { var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))); } } Function.prototype.bindAsEventListener = function(object) { var __method = this, args = $A(arguments), object = args.shift(); return function(event) { return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments))); } } Object.extend(Number.prototype, { toColorPart: function() { var digits = this.toString(16); if (this < 16) return '0' + digits; return digits; }, succ: function() { return this + 1; }, times: function(iterator) { $R(0, this, true).each(iterator); return this; } }); var Try = { these: function() { var returnValue; for (var i = 0, length = arguments.length; i < length; i++) { var lambda = arguments[i]; try { returnValue = lambda(); break; } catch (e) {} } return returnValue; } } /*--------------------------------------------------------------------------*/ var PeriodicalExecuter = Class.create(); PeriodicalExecuter.prototype = { initialize: function(callback, frequency) { this.callback = callback; this.frequency = frequency; this.currentlyExecuting = false; this.registerCallback(); }, registerCallback: function() { this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, stop: function() { if (!this.timer) return; clearInterval(this.timer); this.timer = null; }, onTimerEvent: function() { if (!this.currentlyExecuting) { try { this.currentlyExecuting = true; this.callback(this); } finally { this.currentlyExecuting = false; } } } } String.interpret = function(value){ return value == null ? '' : String(value); } Object.extend(String.prototype, { gsub: function(pattern, replacement) { var result = '', source = this, match; replacement = arguments.callee.prepareReplacement(replacement); while (source.length > 0) { if (match = source.match(pattern)) { result += source.slice(0, match.index); result += String.interpret(replacement(match)); source = source.slice(match.index + match[0].length); } else { result += source, source = ''; } } return result; }, sub: function(pattern, replacement, count) { replacement = this.gsub.prepareReplacement(replacement); count = count === undefined ? 1 : count; return this.gsub(pattern, function(match) { if (--count < 0) return match[0]; return replacement(match); }); }, scan: function(pattern, iterator) { this.gsub(pattern, iterator); return this; }, truncate: function(length, truncation) { length = length || 30; truncation = truncation === undefined ? '...' : truncation; return this.length > length ? this.slice(0, length - truncation.length) + truncation : this; }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, stripTags: function() { return this.replace(/<\/?[^>]+>/gi, ''); }, stripScripts: function() { return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); }, extractScripts: function() { var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); return (this.match(matchAll) || []).map(function(scriptTag) { return (scriptTag.match(matchOne) || ['', ''])[1]; }); }, evalScripts: function() { return this.extractScripts().map(function(script) { return eval(script) }); }, escapeHTML: function() { var div = document.createElement('div'); var text = document.createTextNode(this); div.appendChild(text); return div.innerHTML; }, unescapeHTML: function() { var div = document.createElement('div'); div.innerHTML = this.stripTags(); return div.childNodes[0] ? (div.childNodes.length > 1 ? $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) : div.childNodes[0].nodeValue) : ''; }, toQueryParams: function(separator) { var match = this.strip().match(/([^?#]*)(#.*)?$/); if (!match) return {}; return match[1].split(separator || '&').inject({}, function(hash, pair) { if ((pair = pair.split('='))[0]) { var name = decodeURIComponent(pair[0]); var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; if (hash[name] !== undefined) { if (hash[name].constructor != Array) hash[name] = [hash[name]]; if (value) hash[name].push(value); } else hash[name] = value; } return hash; }); }, toArray: function() { return this.split(''); }, succ: function() { return this.slice(0, this.length - 1) + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); }, camelize: function() { var parts = this.split('-'), len = parts.length; if (len == 1) return parts[0]; var camelized = this.charAt(0) == '-' ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) : parts[0]; for (var i = 1; i < len; i++) camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); return camelized; }, capitalize: function(){ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); }, underscore: function() { return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); }, dasherize: function() { return this.gsub(/_/,'-'); }, inspect: function(useDoubleQuotes) { var escapedString = this.replace(/\\/g, '\\\\'); if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; else return "'" + escapedString.replace(/'/g, '\\\'') + "'"; } }); String.prototype.gsub.prepareReplacement = function(replacement) { if (typeof replacement == 'function') return replacement; var template = new Template(replacement); return function(match) { return template.evaluate(match) }; } String.prototype.parseQuery = String.prototype.toQueryParams; var Template = Class.create(); Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; Template.prototype = { initialize: function(template, pattern) { this.template = template.toString(); this.pattern = pattern || Template.Pattern; }, evaluate: function(object) { return this.template.gsub(this.pattern, function(match) { var before = match[1]; if (before == '\\') return match[2]; return before + String.interpret(object[match[3]]); }); } } var $break = new Object(); var $continue = new Object(); var Enumerable = { each: function(iterator) { var index = 0; try { this._each(function(value) { try { iterator(value, index++); } catch (e) { if (e != $continue) throw e; } }); } catch (e) { if (e != $break) throw e; } return this; }, eachSlice: function(number, iterator) { var index = -number, slices = [], array = this.toArray(); while ((index += number) < array.length) slices.push(array.slice(index, index+number)); return slices.map(iterator); }, all: function(iterator) { var result = true; this.each(function(value, index) { result = result && !!(iterator || Prototype.K)(value, index); if (!result) throw $break; }); return result; }, any: function(iterator) { var result = false; this.each(function(value, index) { if (result = !!(iterator || Prototype.K)(value, index)) throw $break; }); return result; }, collect: function(iterator) { var results = []; this.each(function(value, index) { results.push((iterator || Prototype.K)(value, index)); }); return results; }, detect: function(iterator) { var result; this.each(function(value, index) { if (iterator(value, index)) { result = value; throw $break; } }); return result; }, findAll: function(iterator) { var results = []; this.each(function(value, index) { if (iterator(value, index)) results.push(value); }); return results; }, grep: function(pattern, iterator) { var results = []; this.each(function(value, index) { var stringValue = value.toString(); if (stringValue.match(pattern)) results.push((iterator || Prototype.K)(value, index)); }) return results; }, include: function(object) { var found = false; this.each(function(value) { if (value == object) { found = true; throw $break; } }); return found; }, inGroupsOf: function(number, fillWith) { fillWith = fillWith === undefined ? null : fillWith; return this.eachSlice(number, function(slice) { while(slice.length < number) slice.push(fillWith); return slice; }); }, inject: function(memo, iterator) { this.each(function(value, index) { memo = iterator(memo, value, index); }); return memo; }, invoke: function(method) { var args = $A(arguments).slice(1); return this.map(function(value) { return value[method].apply(value, args); }); }, max: function(iterator) { var result; this.each(function(value, index) { value = (iterator || Prototype.K)(value, index); if (result == undefined || value >= result) result = value; }); return result; }, min: function(iterator) { var result; this.each(function(value, index) { value = (iterator || Prototype.K)(value, index); if (result == undefined || value < result) result = value; }); return result; }, partition: function(iterator) { var trues = [], falses = []; this.each(function(value, index) { ((iterator || Prototype.K)(value, index) ? trues : falses).push(value); }); return [trues, falses]; }, pluck: function(property) { var results = []; this.each(function(value, index) { results.push(value[property]); }); return results; }, reject: function(iterator) { var results = []; this.each(function(value, index) { if (!iterator(value, index)) results.push(value); }); return results; }, sortBy: function(iterator) { return this.map(function(value, index) { return {value: value, criteria: iterator(value, index)}; }).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; }).pluck('value'); }, toArray: function() { return this.map(); }, zip: function() { var iterator = Prototype.K, args = $A(arguments); if (typeof args.last() == 'function') iterator = args.pop(); var collections = [this].concat(args).map($A); return this.map(function(value, index) { return iterator(collections.pluck(index)); }); }, size: function() { return this.toArray().length; }, inspect: function() { return '#'; } } Object.extend(Enumerable, { map: Enumerable.collect, find: Enumerable.detect, select: Enumerable.findAll, member: Enumerable.include, entries: Enumerable.toArray }); var $A = Array.from = function(iterable) { if (!iterable) return []; if (iterable.toArray) { return iterable.toArray(); } else { var results = []; for (var i = 0, length = iterable.length; i < length; i++) results.push(iterable[i]); return results; } } Object.extend(Array.prototype, Enumerable); if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; Object.extend(Array.prototype, { _each: function(iterator) { for (var i = 0, length = this.length; i < length; i++) iterator(this[i]); }, clear: function() { this.length = 0; return this; }, first: function() { return this[0]; }, last: function() { return this[this.length - 1]; }, compact: function() { return this.select(function(value) { return value != null; }); }, flatten: function() { return this.inject([], function(array, value) { return array.concat(value && value.constructor == Array ? value.flatten() : [value]); }); }, without: function() { var values = $A(arguments); return this.select(function(value) { return !values.include(value); }); }, indexOf: function(object) { for (var i = 0, length = this.length; i < length; i++) if (this[i] == object) return i; return -1; }, reverse: function(inline) { return (inline !== false ? this : this.toArray())._reverse(); }, reduce: function() { return this.length > 1 ? this : this[0]; }, uniq: function() { return this.inject([], function(array, value) { return array.include(value) ? array : array.concat([value]); }); }, clone: function() { return [].concat(this); }, size: function() { return this.length; }, inspect: function() { return '[' + this.map(Object.inspect).join(', ') + ']'; } }); Array.prototype.toArray = Array.prototype.clone; function $w(string){ string = string.strip(); return string ? string.split(/\s+/) : []; } if(window.opera){ Array.prototype.concat = function(){ var array = []; for(var i = 0, length = this.length; i < length; i++) array.push(this[i]); for(var i = 0, length = arguments.length; i < length; i++) { if(arguments[i].constructor == Array) { for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) array.push(arguments[i][j]); } else { array.push(arguments[i]); } } return array; } } var Hash = function(obj) { Object.extend(this, obj || {}); }; Object.extend(Hash, { toQueryString: function(obj) { var parts = []; this.prototype._each.call(obj, function(pair) { if (!pair.key) return; if (pair.value && pair.value.constructor == Array) { var values = pair.value.compact(); if (values.length < 2) pair.value = values.reduce(); else { key = encodeURIComponent(pair.key); values.each(function(value) { value = value != undefined ? encodeURIComponent(value) : ''; parts.push(key + '=' + encodeURIComponent(value)); }); return; } } if (pair.value == undefined) pair[1] = ''; parts.push(pair.map(encodeURIComponent).join('=')); }); return parts.join('&'); } }); Object.extend(Hash.prototype, Enumerable); Object.extend(Hash.prototype, { _each: function(iterator) { for (var key in this) { var value = this[key]; if (value && value == Hash.prototype[key]) continue; var pair = [key, value]; pair.key = key; pair.value = value; iterator(pair); } }, keys: function() { return this.pluck('key'); }, values: function() { return this.pluck('value'); }, merge: function(hash) { return $H(hash).inject(this, function(mergedHash, pair) { mergedHash[pair.key] = pair.value; return mergedHash; }); }, remove: function() { var result; for(var i = 0, length = arguments.length; i < length; i++) { var value = this[arguments[i]]; if (value !== undefined){ if (result === undefined) result = value; else { if (result.constructor != Array) result = [result]; result.push(value) } } delete this[arguments[i]]; } return result; }, toQueryString: function() { return Hash.toQueryString(this); }, inspect: function() { return '#'; } }); function $H(object) { if (object && object.constructor == Hash) return object; return new Hash(object); }; ObjectRange = Class.create(); Object.extend(ObjectRange.prototype, Enumerable); Object.extend(ObjectRange.prototype, { initialize: function(start, end, exclusive) { this.start = start; this.end = end; this.exclusive = exclusive; }, _each: function(iterator) { var value = this.start; while (this.include(value)) { iterator(value); value = value.succ(); } }, include: function(value) { if (value < this.start) return false; if (this.exclusive) return value < this.end; return value <= this.end; } }); var $R = function(start, end, exclusive) { return new ObjectRange(start, end, exclusive); } var Ajax = { getTransport: function() { return Try.these( function() {return new XMLHttpRequest()}, function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false; }, activeRequestCount: 0 } Ajax.Responders = { responders: [], _each: function(iterator) { this.responders._each(iterator); }, register: function(responder) { if (!this.include(responder)) this.responders.push(responder); }, unregister: function(responder) { this.responders = this.responders.without(responder); }, dispatch: function(callback, request, transport, json) { this.each(function(responder) { if (typeof responder[callback] == 'function') { try { responder[callback].apply(responder, [request, transport, json]); } catch (e) {} } }); } }; Object.extend(Ajax.Responders, Enumerable); Ajax.Responders.register({ onCreate: function() { Ajax.activeRequestCount++; }, onComplete: function() { Ajax.activeRequestCount--; } }); Ajax.Base = function() {}; Ajax.Base.prototype = { setOptions: function(options) { this.options = { method: 'post', asynchronous: true, contentType: 'application/x-www-form-urlencoded', encoding: 'UTF-8', parameters: '' } Object.extend(this.options, options || {}); this.options.method = this.options.method.toLowerCase(); if (typeof this.options.parameters == 'string') this.options.parameters = this.options.parameters.toQueryParams(); } } Ajax.Request = Class.create(); Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; Ajax.Request.prototype = Object.extend(new Ajax.Base(), { _complete: false, initialize: function(url, options) { this.transport = Ajax.getTransport(); this.setOptions(options); this.request(url); }, request: function(url) { this.url = url; this.method = this.options.method; var params = this.options.parameters; if (!['get', 'post'].include(this.method)) { // simulate other verbs over post params['_method'] = this.method; this.method = 'post'; } params = Hash.toQueryString(params); if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=' // when GET, append parameters to URL if (this.method == 'get' && params) this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params; try { Ajax.Responders.dispatch('onCreate', this, this.transport); this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous); if (this.options.asynchronous) setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10); this.transport.onreadystatechange = this.onStateChange.bind(this); this.setRequestHeaders(); var body = this.method == 'post' ? (this.options.postBody || params) : null; this.transport.send(body); /* Force Firefox to handle ready state 4 for synchronous requests */ if (!this.options.asynchronous && this.transport.overrideMimeType) this.onStateChange(); } catch (e) { this.dispatchException(e); } }, onStateChange: function() { var readyState = this.transport.readyState; if (readyState > 1 && !((readyState == 4) && this._complete)) this.respondToReadyState(this.transport.readyState); }, setRequestHeaders: function() { var headers = { 'X-Requested-With': 'XMLHttpRequest', 'X-Prototype-Version': Prototype.Version, 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' }; if (this.method == 'post') { headers['Content-type'] = this.options.contentType + (this.options.encoding ? '; charset=' + this.options.encoding : ''); /* Force "Connection: close" for older Mozilla browsers to work * around a bug where XMLHttpRequest sends an incorrect * Content-length header. See Mozilla Bugzilla #246651. */ if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) headers['Connection'] = 'close'; } // user-defined headers if (typeof this.options.requestHeaders == 'object') { var extras = this.options.requestHeaders; if (typeof extras.push == 'function') for (var i = 0, length = extras.length; i < length; i += 2) headers[extras[i]] = extras[i+1]; else $H(extras).each(function(pair) { headers[pair.key] = pair.value }); } for (var name in headers) this.transport.setRequestHeader(name, headers[name]); }, success: function() { return !this.transport.status || (this.transport.status >= 200 && this.transport.status < 300); }, respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState]; var transport = this.transport, json = this.evalJSON(); if (state == 'Complete') { try { this._complete = true; (this.options['on' + this.transport.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(transport, json); } catch (e) { this.dispatchException(e); } if ((this.getHeader('Content-type') || 'text/javascript').strip(). match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction)(transport, json); Ajax.Responders.dispatch('on' + state, this, transport, json); } catch (e) { this.dispatchException(e); } if (state == 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction; } }, getHeader: function(name) { try { return this.transport.getResponseHeader(name); } catch (e) { return null } }, evalJSON: function() { try { var json = this.getHeader('X-JSON'); return json ? eval('(' + json + ')') : null; } catch (e) { return null } }, evalResponse: function() { try { return eval(this.transport.responseText); } catch (e) { this.dispatchException(e); } }, dispatchException: function(exception) { (this.options.onException || Prototype.emptyFunction)(this, exception); Ajax.Responders.dispatch('onException', this, exception); } }); Ajax.Updater = Class.create(); Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { initialize: function(container, url, options) { this.container = { success: (container.success || container), failure: (container.failure || (container.success ? null : container)) } this.transport = Ajax.getTransport(); this.setOptions(options); var onComplete = this.options.onComplete || Prototype.emptyFunction; this.options.onComplete = (function(transport, param) { this.updateContent(); onComplete(transport, param); }).bind(this); this.request(url); }, updateContent: function() { var receiver = this.container[this.success() ? 'success' : 'failure']; var response = this.transport.responseText; if (!this.options.evalScripts) response = response.stripScripts(); if (receiver = $(receiver)) { if (this.options.insertion) new this.options.insertion(receiver, response); else receiver.update(response); } if (this.success()) { if (this.onComplete) setTimeout(this.onComplete.bind(this), 10); } } }); Ajax.PeriodicalUpdater = Class.create(); Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { initialize: function(container, url, options) { this.setOptions(options); this.onComplete = this.options.onComplete; this.frequency = (this.options.frequency || 2); this.decay = (this.options.decay || 1); this.updater = {}; this.container = container; this.url = url; this.start(); }, start: function() { this.options.onComplete = this.updateComplete.bind(this); this.onTimerEvent(); }, stop: function() { this.updater.options.onComplete = undefined; clearTimeout(this.timer); (this.onComplete || Prototype.emptyFunction).apply(this, arguments); }, updateComplete: function(request) { if (this.options.decay) { this.decay = (request.responseText == this.lastText ? this.decay * this.options.decay : 1); this.lastText = request.responseText; } this.timer = setTimeout(this.onTimerEvent.bind(this), this.decay * this.frequency * 1000); }, onTimerEvent: function() { this.updater = new Ajax.Updater(this.container, this.url, this.options); } }); function $(element) { if (arguments.length > 1) { for (var i = 0, elements = [], length = arguments.length; i < length; i++) elements.push($(arguments[i])); return elements; } if (typeof element == 'string') element = document.getElementById(element); return Element.extend(element); } if (Prototype.BrowserFeatures.XPath) { document._getElementsByXPath = function(expression, parentElement) { var results = []; var query = document.evaluate(expression, $(parentElement) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) results.push(query.snapshotItem(i)); return results; }; } document.getElementsByClassName = function(className, parentElement) { if (Prototype.BrowserFeatures.XPath) { var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]"; return document._getElementsByXPath(q, parentElement); } else { var children = ($(parentElement) || document.body).getElementsByTagName('*'); var elements = [], child; for (var i = 0, length = children.length; i < length; i++) { child = children[i]; if (Element.hasClassName(child, className)) elements.push(Element.extend(child)); } return elements; } }; /*--------------------------------------------------------------------------*/ if (!window.Element) var Element = new Object(); Element.extend = function(element) { if (!element || _nativeExtensions || element.nodeType == 3) return element; if (!element._extended && element.tagName && element != window) { var methods = Object.clone(Element.Methods), cache = Element.extend.cache; if (element.tagName == 'FORM') Object.extend(methods, Form.Methods); if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName)) Object.extend(methods, Form.Element.Methods); Object.extend(methods, Element.Methods.Simulated); for (var property in methods) { var value = methods[property]; if (typeof value == 'function' && !(property in element)) element[property] = cache.findOrStore(value); } } element._extended = true; return element; }; Element.extend.cache = { findOrStore: function(value) { return this[value] = this[value] || function() { return value.apply(null, [this].concat($A(arguments))); } } }; Element.Methods = { visible: function(element) { return $(element).style.display != 'none'; }, toggle: function(element) { element = $(element); Element[Element.visible(element) ? 'hide' : 'show'](element); return element; }, hide: function(element) { $(element).style.display = 'none'; return element; }, show: function(element) { $(element).style.display = ''; return element; }, remove: function(element) { element = $(element); element.parentNode.removeChild(element); return element; }, update: function(element, html) { html = typeof html == 'undefined' ? '' : html.toString(); $(element).innerHTML = html.stripScripts(); setTimeout(function() {html.evalScripts()}, 10); return element; }, replace: function(element, html) { element = $(element); html = typeof html == 'undefined' ? '' : html.toString(); if (element.outerHTML) { element.outerHTML = html.stripScripts(); } else { var range = element.ownerDocument.createRange(); range.selectNodeContents(element); element.parentNode.replaceChild( range.createContextualFragment(html.stripScripts()), element); } setTimeout(function() {html.evalScripts()}, 10); return element; }, inspect: function(element) { element = $(element); var result = '<' + element.tagName.toLowerCase(); $H({'id': 'id', 'className': 'class'}).each(function(pair) { var property = pair.first(), attribute = pair.last(); var value = (element[property] || '').toString(); if (value) result += ' ' + attribute + '=' + value.inspect(true); }); return result + '>'; }, recursivelyCollect: function(element, property) { element = $(element); var elements = []; while (element = element[property]) if (element.nodeType == 1) elements.push(Element.extend(element)); return elements; }, ancestors: function(element) { return $(element).recursivelyCollect('parentNode'); }, descendants: function(element) { return $A($(element).getElementsByTagName('*')); }, immediateDescendants: function(element) { if (!(element = $(element).firstChild)) return []; while (element && element.nodeType != 1) element = element.nextSibling; if (element) return [element].concat($(element).nextSiblings()); return []; }, previousSiblings: function(element) { return $(element).recursivelyCollect('previousSibling'); }, nextSiblings: function(element) { return $(element).recursivelyCollect('nextSibling'); }, siblings: function(element) { element = $(element); return element.previousSiblings().reverse().concat(element.nextSiblings()); }, match: function(element, selector) { if (typeof selector == 'string') selector = new Selector(selector); return selector.match($(element)); }, up: function(element, expression, index) { return Selector.findElement($(element).ancestors(), expression, index); }, down: function(element, expression, index) { return Selector.findElement($(element).descendants(), expression, index); }, previous: function(element, expression, index) { return Selector.findElement($(element).previousSiblings(), expression, index); }, next: function(element, expression, index) { return Selector.findElement($(element).nextSiblings(), expression, index); }, getElementsBySelector: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element, args); }, getElementsByClassName: function(element, className) { return document.getElementsByClassName(className, element); }, readAttribute: function(element, name) { element = $(element); if (document.all && !window.opera) { var t = Element._attributeTranslations; if (t.values[name]) return t.values[name](element, name); if (t.names[name]) name = t.names[name]; var attribute = element.attributes[name]; if(attribute) return attribute.nodeValue; } return element.getAttribute(name); }, getHeight: function(element) { return $(element).getDimensions().height; }, getWidth: function(element) { return $(element).getDimensions().width; }, classNames: function(element) { return new Element.ClassNames(element); }, hasClassName: function(element, className) { if (!(element = $(element))) return; var elementClassName = element.className; if (elementClassName.length == 0) return false; if (elementClassName == className || elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) return true; return false; }, addClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element).add(className); return element; }, removeClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element).remove(className); return element; }, toggleClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className); return element; }, observe: function() { Event.observe.apply(Event, arguments); return $A(arguments).first(); }, stopObserving: function() { Event.stopObserving.apply(Event, arguments); return $A(arguments).first(); }, // removes whitespace-only text node children cleanWhitespace: function(element) { element = $(element); var node = element.firstChild; while (node) { var nextNode = node.nextSibling; if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) element.removeChild(node); node = nextNode; } return element; }, empty: function(element) { return $(element).innerHTML.match(/^\s*$/); }, descendantOf: function(element, ancestor) { element = $(element), ancestor = $(ancestor); while (element = element.parentNode) if (element == ancestor) return true; return false; }, scrollTo: function(element) { element = $(element); var pos = Position.cumulativeOffset(element); window.scrollTo(pos[0], pos[1]); return element; }, getStyle: function(element, style) { element = $(element); if (['float','cssFloat'].include(style)) style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat'); style = style.camelize(); var value = element.style[style]; if (!value) { if (document.defaultView && document.defaultView.getComputedStyle) { var css = document.defaultView.getComputedStyle(element, null); value = css ? css[style] : null; } else if (element.currentStyle) { value = element.currentStyle[style]; } } if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none')) value = element['offset'+style.capitalize()] + 'px'; if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) if (Element.getStyle(element, 'position') == 'static') value = 'auto'; if(style == 'opacity') { if(value) return parseFloat(value); if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) if(value[1]) return parseFloat(value[1]) / 100; return 1.0; } return value == 'auto' ? null : value; }, setStyle: function(element, style) { element = $(element); for (var name in style) { var value = style[name]; if(name == 'opacity') { if (value == 1) { value = (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0; if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); } else if(value === '') { if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); } else { if(value < 0.00001) value = 0; if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity='+value*100+')'; } } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat'; element.style[name.camelize()] = value; } return element; }, getDimensions: function(element) { element = $(element); var display = $(element).getStyle('display'); if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; // All *Width and *Height properties give 0 on elements with display none, // so enable the element temporarily var els = element.style; var originalVisibility = els.visibility; var originalPosition = els.position; var originalDisplay = els.display; els.visibility = 'hidden'; els.position = 'absolute'; els.display = 'block'; var originalWidth = element.clientWidth; var originalHeight = element.clientHeight; els.display = originalDisplay; els.position = originalPosition; els.visibility = originalVisibility; return {width: originalWidth, height: originalHeight}; }, makePositioned: function(element) { element = $(element); var pos = Element.getStyle(element, 'position'); if (pos == 'static' || !pos) { element._madePositioned = true; element.style.position = 'relative'; // Opera returns the offset relative to the positioning context, when an // element is position relative but top and left have not been defined if (window.opera) { element.style.top = 0; element.style.left = 0; } } return element; }, undoPositioned: function(element) { element = $(element); if (element._madePositioned) { element._madePositioned = undefined; element.style.position = element.style.top = element.style.left = element.style.bottom = element.style.right = ''; } return element; }, makeClipping: function(element) { element = $(element); if (element._overflow) return element; element._overflow = element.style.overflow || 'auto'; if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') element.style.overflow = 'hidden'; return element; }, undoClipping: function(element) { element = $(element); if (!element._overflow) return element; element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; element._overflow = null; return element; } }; Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf}); Element._attributeTranslations = {}; Element._attributeTranslations.names = { colspan: "colSpan", rowspan: "rowSpan", valign: "vAlign", datetime: "dateTime", accesskey: "accessKey", tabindex: "tabIndex", enctype: "encType", maxlength: "maxLength", readonly: "readOnly", longdesc: "longDesc" }; Element._attributeTranslations.values = { _getAttr: function(element, attribute) { return element.getAttribute(attribute, 2); }, _flag: function(element, attribute) { return $(element).hasAttribute(attribute) ? attribute : null; }, style: function(element) { return element.style.cssText.toLowerCase(); }, title: function(element) { var node = element.getAttributeNode('title'); return node.specified ? node.nodeValue : null; } }; Object.extend(Element._attributeTranslations.values, { href: Element._attributeTranslations.values._getAttr, src: Element._attributeTranslations.values._getAttr, disabled: Element._attributeTranslations.values._flag, checked: Element._attributeTranslations.values._flag, readonly: Element._attributeTranslations.values._flag, multiple: Element._attributeTranslations.values._flag }); Element.Methods.Simulated = { hasAttribute: function(element, attribute) { var t = Element._attributeTranslations; attribute = t.names[attribute] || attribute; return $(element).getAttributeNode(attribute).specified; } }; // IE is missing .innerHTML support for TABLE-related elements if (document.all && !window.opera){ Element.Methods.update = function(element, html) { element = $(element); html = typeof html == 'undefined' ? '' : html.toString(); var tagName = element.tagName.toUpperCase(); if (['THEAD','TBODY','TR','TD'].include(tagName)) { var div = document.createElement('div'); switch (tagName) { case 'THEAD': case 'TBODY': div.innerHTML = '' + html.stripScripts() + '
      '; depth = 2; break; case 'TR': div.innerHTML = '' + html.stripScripts() + '
      '; depth = 3; break; case 'TD': div.innerHTML = '
      ' + html.stripScripts() + '
      '; depth = 4; } $A(element.childNodes).each(function(node){ element.removeChild(node) }); depth.times(function(){ div = div.firstChild }); $A(div.childNodes).each( function(node){ element.appendChild(node) }); } else { element.innerHTML = html.stripScripts(); } setTimeout(function() {html.evalScripts()}, 10); return element; } }; Object.extend(Element, Element.Methods); var _nativeExtensions = false; if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) { var className = 'HTML' + tag + 'Element'; if(window[className]) return; var klass = window[className] = {}; klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__; }); Element.addMethods = function(methods) { Object.extend(Element.Methods, methods || {}); function copy(methods, destination, onlyIfAbsent) { onlyIfAbsent = onlyIfAbsent || false; var cache = Element.extend.cache; for (var property in methods) { var value = methods[property]; if (!onlyIfAbsent || !(property in destination)) destination[property] = cache.findOrStore(value); } } if (typeof HTMLElement != 'undefined') { copy(Element.Methods, HTMLElement.prototype); copy(Element.Methods.Simulated, HTMLElement.prototype, true); copy(Form.Methods, HTMLFormElement.prototype); [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) { copy(Form.Element.Methods, klass.prototype); }); _nativeExtensions = true; } } var Toggle = new Object(); Toggle.display = Element.toggle; /*--------------------------------------------------------------------------*/ Abstract.Insertion = function(adjacency) { this.adjacency = adjacency; } Abstract.Insertion.prototype = { initialize: function(element, content) { this.element = $(element); this.content = content.stripScripts(); if (this.adjacency && this.element.insertAdjacentHTML) { try { this.element.insertAdjacentHTML(this.adjacency, this.content); } catch (e) { var tagName = this.element.tagName.toUpperCase(); if (['TBODY', 'TR'].include(tagName)) { this.insertContent(this.contentFromAnonymousTable()); } else { throw e; } } } else { this.range = this.element.ownerDocument.createRange(); if (this.initializeRange) this.initializeRange(); this.insertContent([this.range.createContextualFragment(this.content)]); } setTimeout(function() {content.evalScripts()}, 10); }, contentFromAnonymousTable: function() { var div = document.createElement('div'); div.innerHTML = '' + this.content + '
      '; return $A(div.childNodes[0].childNodes[0].childNodes); } } var Insertion = new Object(); Insertion.Before = Class.create(); Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { initializeRange: function() { this.range.setStartBefore(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.parentNode.insertBefore(fragment, this.element); }).bind(this)); } }); Insertion.Top = Class.create(); Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { initializeRange: function() { this.range.selectNodeContents(this.element); this.range.collapse(true); }, insertContent: function(fragments) { fragments.reverse(false).each((function(fragment) { this.element.insertBefore(fragment, this.element.firstChild); }).bind(this)); } }); Insertion.Bottom = Class.create(); Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { initializeRange: function() { this.range.selectNodeContents(this.element); this.range.collapse(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.appendChild(fragment); }).bind(this)); } }); Insertion.After = Class.create(); Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { initializeRange: function() { this.range.setStartAfter(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.parentNode.insertBefore(fragment, this.element.nextSibling); }).bind(this)); } }); /*--------------------------------------------------------------------------*/ Element.ClassNames = Class.create(); Element.ClassNames.prototype = { initialize: function(element) { this.element = $(element); }, _each: function(iterator) { this.element.className.split(/\s+/).select(function(name) { return name.length > 0; })._each(iterator); }, set: function(className) { this.element.className = className; }, add: function(classNameToAdd) { if (this.include(classNameToAdd)) return; this.set($A(this).concat(classNameToAdd).join(' ')); }, remove: function(classNameToRemove) { if (!this.include(classNameToRemove)) return; this.set($A(this).without(classNameToRemove).join(' ')); }, toString: function() { return $A(this).join(' '); } }; Object.extend(Element.ClassNames.prototype, Enumerable); var Selector = Class.create(); Selector.prototype = { initialize: function(expression) { this.params = {classNames: []}; this.expression = expression.toString().strip(); this.parseExpression(); this.compileMatcher(); }, parseExpression: function() { function abort(message) { throw 'Parse error in selector: ' + message; } if (this.expression == '') abort('empty expression'); var params = this.params, expr = this.expression, match, modifier, clause, rest; while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { params.attributes = params.attributes || []; params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); expr = match[1]; } if (expr == '*') return this.params.wildcard = true; while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { modifier = match[1], clause = match[2], rest = match[3]; switch (modifier) { case '#': params.id = clause; break; case '.': params.classNames.push(clause); break; case '': case undefined: params.tagName = clause.toUpperCase(); break; default: abort(expr.inspect()); } expr = rest; } if (expr.length > 0) abort(expr.inspect()); }, buildMatchExpression: function() { var params = this.params, conditions = [], clause; if (params.wildcard) conditions.push('true'); if (clause = params.id) conditions.push('element.readAttribute("id") == ' + clause.inspect()); if (clause = params.tagName) conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); if ((clause = params.classNames).length > 0) for (var i = 0, length = clause.length; i < length; i++) conditions.push('element.hasClassName(' + clause[i].inspect() + ')'); if (clause = params.attributes) { clause.each(function(attribute) { var value = 'element.readAttribute(' + attribute.name.inspect() + ')'; var splitValueBy = function(delimiter) { return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; } switch (attribute.operator) { case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break; case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; case '|=': conditions.push( splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() ); break; case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break; case '': case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break; default: throw 'Unknown operator ' + attribute.operator + ' in selector'; } }); } return conditions.join(' && '); }, compileMatcher: function() { this.match = new Function('element', 'if (!element.tagName) return false; \ element = $(element); \ return ' + this.buildMatchExpression()); }, findElements: function(scope) { var element; if (element = $(this.params.id)) if (this.match(element)) if (!scope || Element.childOf(element, scope)) return [element]; scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); var results = []; for (var i = 0, length = scope.length; i < length; i++) if (this.match(element = scope[i])) results.push(Element.extend(element)); return results; }, toString: function() { return this.expression; } } Object.extend(Selector, { matchElements: function(elements, expression) { var selector = new Selector(expression); return elements.select(selector.match.bind(selector)).map(Element.extend); }, findElement: function(elements, expression, index) { if (typeof expression == 'number') index = expression, expression = false; return Selector.matchElements(elements, expression || '*')[index || 0]; }, findChildElements: function(element, expressions) { return expressions.map(function(expression) { return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) { var selector = new Selector(expr); return results.inject([], function(elements, result) { return elements.concat(selector.findElements(result || element)); }); }); }).flatten(); } }); function $$() { return Selector.findChildElements(document, $A(arguments)); } var Form = { reset: function(form) { $(form).reset(); return form; }, serializeElements: function(elements, getHash) { var data = elements.inject({}, function(result, element) { if (!element.disabled && element.name) { var key = element.name, value = $(element).getValue(); if (value != undefined) { if (result[key]) { if (result[key].constructor != Array) result[key] = [result[key]]; result[key].push(value); } else result[key] = value; } } return result; }); return getHash ? data : Hash.toQueryString(data); } }; Form.Methods = { serialize: function(form, getHash) { return Form.serializeElements(Form.getElements(form), getHash); }, getElements: function(form) { return $A($(form).getElementsByTagName('*')).inject([], function(elements, child) { if (Form.Element.Serializers[child.tagName.toLowerCase()]) elements.push(Element.extend(child)); return elements; } ); }, getInputs: function(form, typeName, name) { form = $(form); var inputs = form.getElementsByTagName('input'); if (!typeName && !name) return $A(inputs).map(Element.extend); for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { var input = inputs[i]; if ((typeName && input.type != typeName) || (name && input.name != name)) continue; matchingInputs.push(Element.extend(input)); } return matchingInputs; }, disable: function(form) { form = $(form); form.getElements().each(function(element) { element.blur(); element.disabled = 'true'; }); return form; }, enable: function(form) { form = $(form); form.getElements().each(function(element) { element.disabled = ''; }); return form; }, findFirstElement: function(form) { return $(form).getElements().find(function(element) { return element.type != 'hidden' && !element.disabled && ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); }); }, focusFirstElement: function(form) { form = $(form); form.findFirstElement().activate(); return form; } } Object.extend(Form, Form.Methods); /*--------------------------------------------------------------------------*/ Form.Element = { focus: function(element) { $(element).focus(); return element; }, select: function(element) { $(element).select(); return element; } } Form.Element.Methods = { serialize: function(element) { element = $(element); if (!element.disabled && element.name) { var value = element.getValue(); if (value != undefined) { var pair = {}; pair[element.name] = value; return Hash.toQueryString(pair); } } return ''; }, getValue: function(element) { element = $(element); var method = element.tagName.toLowerCase(); return Form.Element.Serializers[method](element); }, clear: function(element) { $(element).value = ''; return element; }, present: function(element) { return $(element).value != ''; }, activate: function(element) { element = $(element); element.focus(); if (element.select && ( element.tagName.toLowerCase() != 'input' || !['button', 'reset', 'submit'].include(element.type) ) ) element.select(); return element; }, disable: function(element) { element = $(element); element.disabled = true; return element; }, enable: function(element) { element = $(element); element.blur(); element.disabled = false; return element; } } Object.extend(Form.Element, Form.Element.Methods); var Field = Form.Element; var $F = Form.Element.getValue; /*--------------------------------------------------------------------------*/ Form.Element.Serializers = { input: function(element) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': return Form.Element.Serializers.inputSelector(element); default: return Form.Element.Serializers.textarea(element); } }, inputSelector: function(element) { return element.checked ? element.value : null; }, textarea: function(element) { return element.value; }, select: function(element) { return this[element.type == 'select-one' ? 'selectOne' : 'selectMany'](element); }, selectOne: function(element) { var index = element.selectedIndex; return index >= 0 ? this.optionValue(element.options[index]) : null; }, selectMany: function(element) { var values, length = element.length; if (!length) return null; for (var i = 0, values = []; i < length; i++) { var opt = element.options[i]; if (opt.selected) values.push(this.optionValue(opt)); } return values; }, optionValue: function(opt) { // extend element because hasAttribute may not be native return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; } } /*--------------------------------------------------------------------------*/ Abstract.TimedObserver = function() {} Abstract.TimedObserver.prototype = { initialize: function(element, frequency, callback) { this.frequency = frequency; this.element = $(element); this.callback = callback; this.lastValue = this.getValue(); this.registerCallback(); }, registerCallback: function() { setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, onTimerEvent: function() { var value = this.getValue(); var changed = ('string' == typeof this.lastValue && 'string' == typeof value ? this.lastValue != value : String(this.lastValue) != String(value)); if (changed) { this.callback(this.element, value); this.lastValue = value; } } } Form.Element.Observer = Class.create(); Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { getValue: function() { return Form.Element.getValue(this.element); } }); Form.Observer = Class.create(); Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { getValue: function() { return Form.serialize(this.element); } }); /*--------------------------------------------------------------------------*/ Abstract.EventObserver = function() {} Abstract.EventObserver.prototype = { initialize: function(element, callback) { this.element = $(element); this.callback = callback; this.lastValue = this.getValue(); if (this.element.tagName.toLowerCase() == 'form') this.registerFormCallbacks(); else this.registerCallback(this.element); }, onElementEvent: function() { var value = this.getValue(); if (this.lastValue != value) { this.callback(this.element, value); this.lastValue = value; } }, registerFormCallbacks: function() { Form.getElements(this.element).each(this.registerCallback.bind(this)); }, registerCallback: function(element) { if (element.type) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': Event.observe(element, 'click', this.onElementEvent.bind(this)); break; default: Event.observe(element, 'change', this.onElementEvent.bind(this)); break; } } } } Form.Element.EventObserver = Class.create(); Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { getValue: function() { return Form.Element.getValue(this.element); } }); Form.EventObserver = Class.create(); Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { getValue: function() { return Form.serialize(this.element); } }); if (!window.Event) { var Event = new Object(); } Object.extend(Event, { KEY_BACKSPACE: 8, KEY_TAB: 9, KEY_RETURN: 13, KEY_ESC: 27, KEY_LEFT: 37, KEY_UP: 38, KEY_RIGHT: 39, KEY_DOWN: 40, KEY_DELETE: 46, KEY_HOME: 36, KEY_END: 35, KEY_PAGEUP: 33, KEY_PAGEDOWN: 34, element: function(event) { return event.target || event.srcElement; }, isLeftClick: function(event) { return (((event.which) && (event.which == 1)) || ((event.button) && (event.button == 1))); }, pointerX: function(event) { return event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); }, pointerY: function(event) { return event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); }, stop: function(event) { if (event.preventDefault) { event.preventDefault(); event.stopPropagation(); } else { event.returnValue = false; event.cancelBubble = true; } }, // find the first node with the given tagName, starting from the // node the event was triggered on; traverses the DOM upwards findElement: function(event, tagName) { var element = Event.element(event); while (element.parentNode && (!element.tagName || (element.tagName.toUpperCase() != tagName.toUpperCase()))) element = element.parentNode; return element; }, observers: false, _observeAndCache: function(element, name, observer, useCapture) { if (!this.observers) this.observers = []; if (element.addEventListener) { this.observers.push([element, name, observer, useCapture]); element.addEventListener(name, observer, useCapture); } else if (element.attachEvent) { this.observers.push([element, name, observer, useCapture]); element.attachEvent('on' + name, observer); } }, unloadCache: function() { if (!Event.observers) return; for (var i = 0, length = Event.observers.length; i < length; i++) { Event.stopObserving.apply(this, Event.observers[i]); Event.observers[i][0] = null; } Event.observers = false; }, observe: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.attachEvent)) name = 'keydown'; Event._observeAndCache(element, name, observer, useCapture); }, stopObserving: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { try { element.detachEvent('on' + name, observer); } catch (e) {} } } }); /* prevent memory leaks in IE */ if (navigator.appVersion.match(/\bMSIE\b/)) Event.observe(window, 'unload', Event.unloadCache, false); var Position = { // set to true if needed, warning: firefox performance problems // NOT neeeded for page scrolling, only if draggable contained in // scrollable elements includeScrollOffsets: false, // must be called before calling withinIncludingScrolloffset, every time the // page is scrolled prepare: function() { this.deltaX = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; this.deltaY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; }, realOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.scrollTop || 0; valueL += element.scrollLeft || 0; element = element.parentNode; } while (element); return [valueL, valueT]; }, cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; } while (element); return [valueL, valueT]; }, positionedOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) { if(element.tagName=='BODY') break; var p = Element.getStyle(element, 'position'); if (p == 'relative' || p == 'absolute') break; } } while (element); return [valueL, valueT]; }, offsetParent: function(element) { if (element.offsetParent) return element.offsetParent; if (element == document.body) return element; while ((element = element.parentNode) && element != document.body) if (Element.getStyle(element, 'position') != 'static') return element; return document.body; }, // caches x/y coordinate pair to use with overlap within: function(element, x, y) { if (this.includeScrollOffsets) return this.withinIncludingScrolloffsets(element, x, y); this.xcomp = x; this.ycomp = y; this.offset = this.cumulativeOffset(element); return (y >= this.offset[1] && y < this.offset[1] + element.offsetHeight && x >= this.offset[0] && x < this.offset[0] + element.offsetWidth); }, withinIncludingScrolloffsets: function(element, x, y) { var offsetcache = this.realOffset(element); this.xcomp = x + offsetcache[0] - this.deltaX; this.ycomp = y + offsetcache[1] - this.deltaY; this.offset = this.cumulativeOffset(element); return (this.ycomp >= this.offset[1] && this.ycomp < this.offset[1] + element.offsetHeight && this.xcomp >= this.offset[0] && this.xcomp < this.offset[0] + element.offsetWidth); }, // within must be called directly before overlap: function(mode, element) { if (!mode) return 0; if (mode == 'vertical') return ((this.offset[1] + element.offsetHeight) - this.ycomp) / element.offsetHeight; if (mode == 'horizontal') return ((this.offset[0] + element.offsetWidth) - this.xcomp) / element.offsetWidth; }, page: function(forElement) { var valueT = 0, valueL = 0; var element = forElement; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; // Safari fix if (element.offsetParent==document.body) if (Element.getStyle(element,'position')=='absolute') break; } while (element = element.offsetParent); element = forElement; do { if (!window.opera || element.tagName=='BODY') { valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0; } } while (element = element.parentNode); return [valueL, valueT]; }, clone: function(source, target) { var options = Object.extend({ setLeft: true, setTop: true, setWidth: true, setHeight: true, offsetTop: 0, offsetLeft: 0 }, arguments[2] || {}) // find page position of source source = $(source); var p = Position.page(source); // find coordinate system to use target = $(target); var delta = [0, 0]; var parent = null; // delta [0,0] will do fine with position: fixed elements, // position:absolute needs offsetParent deltas if (Element.getStyle(target,'position') == 'absolute') { parent = Position.offsetParent(target); delta = Position.page(parent); } // correct by body offsets (fixes Safari) if (parent == document.body) { delta[0] -= document.body.offsetLeft; delta[1] -= document.body.offsetTop; } // set position if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; if(options.setWidth) target.style.width = source.offsetWidth + 'px'; if(options.setHeight) target.style.height = source.offsetHeight + 'px'; }, absolutize: function(element) { element = $(element); if (element.style.position == 'absolute') return; Position.prepare(); var offsets = Position.positionedOffset(element); var top = offsets[1]; var left = offsets[0]; var width = element.clientWidth; var height = element.clientHeight; element._originalLeft = left - parseFloat(element.style.left || 0); element._originalTop = top - parseFloat(element.style.top || 0); element._originalWidth = element.style.width; element._originalHeight = element.style.height; element.style.position = 'absolute'; element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.width = width + 'px'; element.style.height = height + 'px'; }, relativize: function(element) { element = $(element); if (element.style.position == 'relative') return; Position.prepare(); element.style.position = 'relative'; var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.height = element._originalHeight; element.style.width = element._originalWidth; } } // Safari returns margins on body which is incorrect if the child is absolutely // positioned. For performance reasons, redefine Position.cumulativeOffset for // KHTML/WebKit only. if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { Position.cumulativeOffset = function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; if (element.offsetParent == document.body) if (Element.getStyle(element, 'position') == 'absolute') break; element = element.offsetParent; } while (element); return [valueL, valueT]; } } Element.addMethods();function ResultList() {} ResultList.OldClickedItem = ""; ResultList.Click = function (prefix, countElements, currentElement) { if (ResultList.OldClickedItem != "") { if ($(ResultList.OldClickedItem) != null) $(ResultList.OldClickedItem).className = $(ResultList.OldClickedItem).className.replace(" highlight", ""); } ResultList.OldClickedItem = currentElement.id; //for (i = 0; i < countElements; i++) // $(prefix+i).className = $(prefix+i).className.replace(" highlight", ""); currentElement.className = currentElement.className + " highlight"; }