var clear="images/clear.gif" //path to clear.gif function PNGFix() { //TEST 1: /* var arVersion = navigator.appVersion.split("MSIE") var version = parseFloat(arVersion[1]) if ((version >= 5.5) && (document.body.filters)) { for(var i=0; i" //img.outerHTML = strNewHTML i = i-1 } } } */ /* //TEST 2: var els = document.getElementsByTagName('*'); var ip=/\.png/i; var i=els.length; while(i-- >0){ //Fetch element var el=els[i]; //Fetch element style tags var es=el.style; //If element is a PNG file if(el.src&&el.src.match(ip)&&!es.filter) { //es.height=el.height; //es.width=el.width; //es.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')"; //el.src=clear; } else { var elb=el.currentStyle.backgroundImage; if(elb.match(ip)){ var path=elb.split('"'); var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale'; es.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')"; es.height=el.clientHeight+'px'; es.backgroundImage='none'; var elkids=el.getElementsByTagName('*'); if (elkids){ var j=elkids.length; if(el.currentStyle.position!="absolute")es.position='static'; while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative"; } } } } */ } /* pngfix=function(){var els=document.getElementsByTagName('*');var ip=/\.png/i;var i=els.length;while(i-- >0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear;}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=='no-repeat')?'crop':'scale';es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+'px';es.backgroundImage='none';var elkids=el.getElementsByTagName('*');if (elkids){var j=elkids.length;if(el.currentStyle.position!="absolute")es.position='static';while (j-- >0)if(!elkids[j].style.position)elkids[j].style.position="relative";}}}}} window.attachEvent('onload',pngfix); */ //Fetch dom element function $(EName) { if (!document.getElementById(EName)) { return null; } else { return document.getElementById(EName); } } //Fetch form value function $$(EName) { if (!document.getElementById(EName)) { return ""; } else { return CleanString(document.getElementById(EName).value); } } //Disable text selection function DisableTextSelect(El) { El.onselectstart = function() {return false;} // ie //El.onmousedown = function() {return false;} // mozilla return El; } //Get cookie value function GetCookie( check_name ) { // first we'll split this cookie up into name/value pairs // note: document.cookie only returns name=value, not the other components var a_all_cookies = document.cookie.split( ';' ); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; // set boolean t/f default f for ( i = 0; i < a_all_cookies.length; i++ ) { // now we'll split apart each name=value pair a_temp_cookie = a_all_cookies[i].split( '=' ); // and trim left/right whitespace while we're at it cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); // if the extracted name matches passed check_name if ( cookie_name == check_name ) { b_cookie_found = true; // we need to handle case where cookie has no value but exists (no = sign, that is): if ( a_temp_cookie.length > 1 ) { cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); } // note that in cases where cookie is initialized but no value, null is returned return cookie_value; break; } a_temp_cookie = null; cookie_name = ''; } if ( !b_cookie_found ) { return null; } } //Open popup function Popup(URL, PopName, W, H, Left, Top) { var WN; if (Left && Top) { WN = window.open(URL, PopName, "status=yes,resizable=yes,scrollbars=yes,location=yes,left=" + Left + ",top=" + Top + ",height=" + H + ",width=" + W); } else { WN = window.open(URL, PopName, "status=yes,resizable=yes,scrollbars=yes,location=yes,height=" + H + ",width=" + W); } if (window.focus) { WN.focus(); } } //Generate parcel aerial image + 1 highlight function ParcelAerial(ID, APN) { var Params = new StringBuilder("t=" + Math.random()); Params.append("&execute=parcelaerial"); if (APN) { Params.append("&apn=" + APN); } else { Params.append("&apn=" + GetURLParam("apn")); } if (ID) { Params.append("&id=" + ID); } else { Params.append("&id=" + GetURLParam("id")); } //Defaults, these will be set internally via address db query Params.append("&fpt=0"); Params.append("&fpp=0"); Params.append("&width=0"); Params.append("&height=0"); Params.append("¢erx=0"); Params.append("¢ery=0"); //No params were pased in if (GetURLParam("apn") == "" && GetURLParam("id") == "" && !APN && !ID) { alert("No APN or Master Address ID was passed in."); } else { var PResponse = function(XMLObj) { var URL = XMLObj.responseText; Popup(URL + "?t=" + Math.random(), "aerial", 900, 600); setTimeout("ClearLoadingStatus()",300); } var A = new AjaxConn(); SetLoadingStatus(" Generating Aerial Image...","cameraicon.png"); A.connect("ajaxrequest.aspx","POST",Params.toString(),PResponse); } } //Get URL parameter function GetURLParam(strParamName) { var strReturn = ""; var strHref = window.location.href; if (strHref.indexOf("?") > -1){ var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for (var iParam = 0; iParam < aQueryString.length; iParam++ ) { if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return unescape(strReturn); } //Select all on a dropdown function SelectAll(DropDownName) { if ($(DropDownName)) { var D = $(DropDownName); for (var i = D.options.length-1; i>=0; i--){ D.options[i].selected = true; } } } //Select a specific dropdown value function SelectValue(DropDownName, Val) { if ($(DropDownName)) { var D = $(DropDownName); for (var i = D.options.length-1; i>=0; i--){ if (D.options[i].value == Val) { D.options[i].selected = true; break; } } } } //Simple propercase function ProperCase(s) { return s.toLowerCase().replace(/^(.)|\s(.)/g, function($1) { return $1.toUpperCase(); }); } //Fetch formatted address string from master address ID function GetAddress(ID, ContainerName) { var Params = "t=" + Math.random(); Params += "&execute=address_string"; Params += "&id=" + ID; var AddrResponse = function(XMLObj) { $(ContainerName).innerHTML = XMLObj.responseText; setTimeout("ClearLoadingStatus()",300); } SetLoadingStatus("Fetching Address...") var A = new AjaxConn(); A.connect(Obj.AppRoot + "ajaxrequest.aspx","POST",Params,AddrResponse); } //Fetch formatted street name string from street ID function GetStreet(ID, ContainerName) { var Params = "t=" + Math.random(); Params += "&execute=street_string"; Params += "&id=" + ID; var StrResponse = function(XMLObj) { $(ContainerName).innerHTML = XMLObj.responseText; setTimeout("ClearLoadingStatus()",300); } SetLoadingStatus("Fetching Street Name...") var A = new AjaxConn(); A.connect(Obj.AppRoot + "ajaxrequest.aspx","POST",Params,StrResponse); } //Find absolute position of any dom object function FindPixelPosition(obj) { //var curleft = FindPositionX(obj); //var curtop = FindPositionY(obj); var curleft = 0; var curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } return new PixelPosition(curleft, curtop); } //Find X (left) pixel position of JS object function FindPositionX(obj) { var curleft = 0; if (obj.offsetParent) { while (1) { curleft+=obj.offsetLeft; if (!obj.offsetParent) { break; } obj=obj.offsetParent; } } else if (obj.x) { curleft+=obj.x; } return curleft; } //Find Y (top) pixel position of JS object function FindPositionY(obj) { var curtop = 0; if (obj.offsetParent) { while (1) { curtop+=obj.offsetTop; if (!obj.offsetParent) { break; } obj=obj.offsetParent; } } else if (obj.y) { curtop+=obj.y; } return curtop; } //Represents pixel position of a dom object function PixelPosition(Left, Top) { this.Left = 0; this.Top = 0; if (Left) { this.Left = parseInt(Left); } if (Top) { this.Top = parseInt(Top); } } //Represents feet point (XY) function Point(PointStr) { this.X = 0; this.Y = 0; var PointArr = new Array(); if (PointStr) { PointArr = PointStr.split(" "); this.X = parseFloat(PointArr[0]); this.Y = parseFloat(PointArr[1]); } } //Trim string function CleanString(Str) { Str = Str.replace(/^\s+|\s+$/g,""); Str = Str.replace("<",""); Str = Str.replace(">",""); return Str; } //Flush all layer child nodes, such as images, etc. function FlushLayer(LayerObj) { var Count = 0; if (LayerObj) { while(LayerObj.hasChildNodes()){ Purge(LayerObj.lastChild); LayerObj.removeChild(LayerObj.lastChild); Count++; } } } //Garbage collection function Purge(IElement) { var Attributes = IElement.attributes; var i; var ACount; var AName; if (Attributes) { ACount = Attributes.length; for (i = 0; i < ACount; i += 1) { AName = Attributes[i].name; if (typeof IElement[AName] === 'function') { IElement[AName] = null; } } } Attributes = IElement.childNodes; if (Attributes) { ACount = Attributes.length; for (i = 0; i < ACount; i += 1) { this.purge(IElement.childNodes[i]); } } } //Toggle element visibility function ToggleVisibility(EName) { if ($(EName).style.display=="") { $(EName).style.display="none"; } else { $(EName).style.display=""; } } //Parse for XML tag value function ParseTag(TName, XML) { var P1 = 0; var P2 = 0; var Str = ""; if (XML.indexOf("<"+TName+">",0) > -1){ P1 = XML.indexOf("<"+TName+">",0)+TName.length+2; P2 = XML.indexOf("",P1); Str = XML.substring(P1,P2); } return Str; } //////////////////////////////////////////////////// //Hex to RGB conversion functions //////////////////////////////////////////////////// //Find decimal from hex val function GiveDec(Hex) { var Value = ""; if (Hex == "A") { Value = 10; } else if (Hex == "B") { Value = 11; } else if(Hex == "C") { Value = 12; } else if(Hex == "D") { Value = 13; } else if(Hex == "E") { Value = 14; } else if(Hex == "F") { Value = 15; } else { Value = eval(Hex); } return Value; } //Find hex value of decimal function GiveHex(Dec) { var Value = ""; if (Dec == 10) { Value = "A"; } else if (Dec == 11) { Value = "B"; } else if (Dec == 12) { Value = "C"; } else if (Dec == 13) { Value = "D"; } else if (Dec == 14) { Value = "E"; } else if (Dec == 15) { Value = "F"; } else { Value = "" + Dec; } return Value; } //Convert a #abcdef color hex string to RGB color function HexToDec(Input) { Input = Input.toUpperCase(); Input = Input.replace("#",""); var a = GiveDec(Input.substring(0, 1)); var b = GiveDec(Input.substring(1, 2)); var c = GiveDec(Input.substring(2, 3)); var d = GiveDec(Input.substring(3, 4)); var e = GiveDec(Input.substring(4, 5)); var f = GiveDec(Input.substring(5, 6)); var x = (a * 16) + b; var y = (c * 16) + d; var z = (e * 16) + f; var C = new RGBColor(x, y, z); return C; } function DecToHex(Red, Green, Blue) { var a = GiveHex(Math.floor(Red / 16)); var b = GiveHex(Red % 16); var c = GiveHex(Math.floor(Green / 16)); var d = GiveHex(Green % 16); var e = GiveHex(Math.floor(Blue / 16)); var f = GiveHex(Blue % 16); var z = a + b + c + d + e + f; return "#" + z; } function RGBColor(Red, Green, Blue) { this.R = Red; this.Red = Red; this.G = Green; this.Green = Green; this.B = Blue; this.Blue = Blue; this.HexColor = function() { var C = DecToHex(this.R, this.G, this.B); return C; } } //Check for numeric value function IsNumeric(strString) { var strValidChars = "0123456789.-"; var strChar; var blnResult = true; if (strString.length == 0) return false; //test strString consists of valid characters listed above for (i = 0; i < strString.length && blnResult == true; i++) { strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) == -1) { blnResult = false; } } return blnResult; } //Perform textbook UTM -> CA NAD83 conversion function ConvertToNAD83(Lat, Long) { //Force longitude as negative val if (Long>0) { Long = Long * -1; } var layer; if (IsNumeric(Lat)==false || IsNumeric(Long)==false) { alert("Invalid or no coordinates entered."); return null; } else { //Find X and Y var B = Lat; var L = Long; //Page 11-39 coordinate system PDF constants //Document Title: The California Coordinate System //Documents: PointConversion.PDF (Caltrans) var L0 = -122.000; var Nb = 1640416.667; var E0 = 6561666.667; var B0 = 39.0846839219; var SinB0 = 0.630468335285; var Rb = 26311590.850; var R0 = 25795162.985; var N0 = 2156844.531; var L1 = 364197.5131; var L2 = 31.3198; var L3 = 18.4998; var L4 = 0.065577; //Find radial distance var DB = B-B0; //Delta B var u = (DB*(L1+DB*(L2+DB*(L3+L4*DB)))); //Find mapping radius var R = R0-u; //Find plane convergence var y = (L0-L)*SinB0; var SinY = Math.sin(y); SinY = (SinY/180)*Math.PI; //False Northing var n = N0+u; //False Easting var e = E0 - (R * SinY); return new LatLong(e, n); } } //Cross browser initialization function function Browser() { var ua, s, i; this.isIE = false; //IE flag this.isNS = false; //NS/FX flag //Custom IE6 detection this.isIE6 = false; this.version = null; //Browser versioning ua = navigator.userAgent; //Flag IE browser type s = "MSIE"; if ((i = ua.indexOf(s)) >= 0) { this.isIE = true; this.version = parseFloat(ua.substr(i + s.length)); //IE6 detection if (this.version == 6) { this.isIE6 = true; } return; } //Flag NS/FX browser type s = "Netscape6/"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = parseFloat(ua.substr(i + s.length)); return; } // Treat any other "Gecko" browser as NS 6.1. s = "Gecko"; if ((i = ua.indexOf(s)) >= 0) { this.isNS = true; this.version = 6.1; return; } } //Cross browser check initialization var browser = new Browser(); //Asynchronous ajax request function AjaxConn() { var xmlhttp, bComplete = false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; }}} if (!xmlhttp) return null; this.connect = function(sURL, sMethod, sVars, fnDone) { if (!xmlhttp) return false; bComplete = false; sMethod = sMethod.toUpperCase(); try { if (sMethod == "GET") { xmlhttp.open(sMethod, sURL+"?"+sVars, true); sVars = ""; } else { xmlhttp.open(sMethod, sURL, true); xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1"); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } xmlhttp.onreadystatechange = function(){ if (xmlhttp.readyState == 4 && !bComplete) { bComplete = true; fnDone(xmlhttp); }}; xmlhttp.send(sVars); } catch(z) { return false; } return true; }; return this; } //Synchronous get request function GET(url) { var AJAX; if (window.XMLHttpRequest) { AJAX=new XMLHttpRequest(); } else { AJAX=new ActiveXObject("Microsoft.XMLHTTP"); } if (AJAX) { AJAX.open("GET", url, false); AJAX.send(null); return AJAX.responseText; } else { return false; } } //Synchronous post request function POST(url, passData) { var AJAX; if (window.XMLHttpRequest) { AJAX=new XMLHttpRequest(); } else { AJAX=new ActiveXObject("Microsoft.XMLHTTP"); } if (AJAX) { AJAX.open("POST", url, false); AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); AJAX.send(passData); return AJAX.responseText; } else { return false; } } //Stringbuilder class for javascript //Author: K. Collins 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(""); } //Custom error handler test /* function CatchError(Message, URL, LineNum) { alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= '+linenumber); return true; } window.onerror = CatchError; */ //Compile flags: /* 0: full API accessability for custom apps? 1: canned style, intranet version 2: canned style, extranet version 3: canned style, public version 4: canned style, localhost install (e.g. tablet PC) */ var Obj; function Map(DivName, CompileFlag, ThemeID, DoFullScreen) { Obj = this; this.M = $(DivName); this.M.style.overflow = "hidden"; //Make debug labels this.DebugLabels(false); //Right-click Mouse Menu Event this.M.oncontextmenu=function() { return false; } //disable right click IE menu document.body.oncontextmenu=function() { return false; } //Set mouse pointer this.M.style.cursor = "hand"; if (!browser.isIE) { this.M.style.cursor = "pointer"; } this.M.style.position = "relative"; this.CompileFlag = CompileFlag; //IE6 detection if (browser.isIE6 == true) { if (this.CompileFlag <= 1) { if($("iemessage2")) { $("iemessage2").style.display = ""; } } else { if($("iemessage")) { $("iemessage").style.display = ""; } } } //Fullscreen flag this.LoadFullScreen = true; if (DoFullScreen != null) { this.LoadFullScreen = DoFullScreen; } //Fullscreen mode for canned styles if (this.CompileFlag >= 1 && this.CompileFlag <= 4) { if (this.LoadFullScreen == true) { this.FullScreen(); } } //Dynamic mouse over flag (disable shortcut keys / mousing when mouse is not over map div) this.IsMouseOver = false; //ID of clicked text field ID this.ClickedTextField = ""; this.TextFieldMouseOver = false; //Populate array of available themes this.AppRoot = ""; //A custom AppRoot is required this.Themes = this.BuildThemeCollection(); this.ThemeID = 0; //Default: basic theme //Check if the user wants to start off with a different theme if (ThemeID) { this.ThemeID = ThemeID; } //Build zoom level collection this.ZoomLevels; this.MakeZoomLevels(); //Default full extent zoom parameters this.CurrentCenter = this.Themes[this.ThemeID].CenterLatLong; this.CurrentZoom = 3; this.MinZoom = 0; this.MaxZoom = 13; //Select by extent parameters this.ExtentMBR = new MBR(0,0,0,0); this.EnableExtentMBR = false; this.ExtentCallBack; //Measure Tool parameters this.EnableMeasure = false; this.MeasureTimeout; //Point Search Tool parameters this.PointSearchZoom = 11; this.EnableGPSDrag = false; //Mouse wheel and window resize timers this.ZoomTimer; this.ResizeTimer; //Tile count this.TileCount = 0; //# of tile width and height this.TileWidth = 0; this.TileHeight = 0; //Z-index tracker for floating menus this.MenuLayers = new Array(); //Array for temporarily showing / hiding all windows this.MenuHideList = new Array(); //ID of selected menu this.MenuSelectedID = ""; //Z-index reserved for selected floating menu this.SelectedMenuIndex = 0; //Collection of previous extents this.LatLongHistory = new Array(); this.ZoomHistory = new Array(); //Collection of Identify parcel objects this.IdentifyCollection; this.ResetParcelCollection("identify"); //Collection of Search parcel objects this.SearchCollection; this.ResetParcelCollection("search"); //Parcel / Streetline / GPS Buffer vars this.BufferParcelID = ""; //Single parcel buffer this.BufferStreetName = ""; //Teleatlas street buffer this.BufferSiteRoad = ""; //Teleatlas street buffer this.BufferCity = ""; //Teleatlas street buffer this.BufferType = ""; //Buffer type flag (street, streetname, or gps) this.BufferX = 0; //Point buffer this.BufferY = 0; //Point buffer this.BufferCollection; this.BufferStreetCollection; this.ResetParcelCollection("buffer"); //Grid search vars (such as Thomas Grid) this.MapGridMBR = new MBR(0,0,0,0); this.MapGridFontColor = "#00ffff"; this.MapGridName = ""; //label //Streetview vars this.StreetViewRoot = "http://gis.solanocounty.com/streetview/"; this.StreetViewURL = ""; this.StreetSessionID = ""; //this.StreetIconRoot = this.AppRoot + "/streetviewarrows/"; //this.StreetViewMouseOver = false; //Initialize events this.InitializeEvents(); //Make scale bar this.MakeScaleBar(); //Run content / floating menus preloader and URL API loader this.RunPreloader(); } //Reset map, clear out all windows and drawings, default to plain map, and clear previous extents Map.prototype.ResetAll = function() { this.ClearAll(); //Close most of the windows and clear all vector graphics this.ThemeID = 0; //Plain Map default //Clear extent history this.LatLongHistory = new Array(); this.ZoomHistory = new Array(); //Zoom to full extent this.FullExtent(); } //Right click clear selection: clear all collections Map.prototype.ClearAll = function() { SetLoadingStatus("Clearing Map..."); setTimeout("Obj.ExecuteClearAll()",100); } Map.prototype.ExecuteClearAll = function() { //Clear parcel identify, buffer, and search this.ClearIdentify(); this.ResetBuffer(); this.ClearSearch(true,true); $("search").style.display = "none"; $("buffer").style.display = "none"; //Clear street view this.ClearStreetView(); //Close map save menus $("savemap").style.display = "none"; $("savemaplist").style.display = "none"; //Close print menu $("print").style.display = "none"; //Close themes $("themes").style.display = "none"; //Close mouse menu $("mousemenu").style.display = "none"; //Clear map grid this.RemoveMapGrid(); //Clear point search $("gps").style.display = "none"; this.RemoveGPSPin(); ClearLoadingStatus(); } //Reset a parcel collection Map.prototype.ResetParcelCollection = function(FloatWindowName) { /* Parameters of ParcelCollection: 1) LayerDivName 2) FillColor 3) FillTransparency 4) MouseOverColor 5) PageSize 6) GridName 7) TotalLabel 8) AcresLabel 9) MinMaxButton 10) MinMaxContainerID */ //Identify if (FloatWindowName == "identify") { this.IdentifyCollection = new ParcelCollection("identifycontainer", "#99ffff", "30%", "#99ff00", 5, "identifygrid", "identifycount1", "identifycount2", "identify_minmax", "identifygrid"); //Search / Advanced Search } else if (FloatWindowName == "search") { //"#3399ff" this.SearchCollection = new ParcelCollection("searchcontainer", "#ffffff", "40%", "#ffffff", 11, "searchgrid", "searchcount1", "", "search_minmax", "searchgrid"); //Buffer / Advanced Buffer } else if (FloatWindowName == "buffer") { //Parcels this.BufferCollection = new ParcelCollection("buffercontainer", "#00ff00", "30%", "#00ff00", 5, "buffergrid2", "buffercount", "", "buffer_minmax", "buffergrid2"); //Street line(s) this.BufferStreetCollection = new StreetLineCollection(); } } //Perform refresh from resize command Map.prototype.RefreshMap = function() { //For compile flags 1-4, go to fullscreen resize if (this.CompileFlag >= 1 && this.CompileFlag <= 4) { if (this.LoadFullScreen == true) { this.FullScreen(); } } this.setCenter(this.CurrentCenter, this.CurrentZoom); } //Fullscreen resize Map.prototype.FullScreen = function() { var Width = 0; var Height = 0; var HeaderHeight = 52; //IE if (browser.isIE == true) { Width = parseInt(document.body.offsetWidth); Height = parseInt(document.body.offsetHeight); this.M.style.width = (Width-21) + "px"; this.M.style.height = (Height-4-HeaderHeight) + "px"; //FF, Chrome, Safari, etc } else { Width = parseInt(window.innerWidth); Height = parseInt(window.innerHeight); this.M.style.width = (Width-3) + "px"; this.M.style.height = (Height-HeaderHeight) + "px"; } } //Handle resize timer Map.prototype.ResizeMap = function() { if (Obj) { clearTimeout(this.ResizeTimer); this.ResizeTimer = setTimeout("Obj.RefreshMap()",500); } } //DEPRECATED, replaced by MinMaxWindow in windows.JS: //Minimize / Maximize a floating form element //ContainerName = example is datagrid div name Map.prototype.ToggleMinimize = function(ContainerName, MinMaxButtonName) { var C = $(ContainerName); if (C.style.display == "") { C.style.display = "none"; $(MinMaxButtonName).src = this.AppRoot + "images/maximize.png"; } else { C.style.display = ""; $(MinMaxButtonName).src = this.AppRoot + "images/minimize.png"; } } //Initialize window/mouse events Map.prototype.InitializeEvents = function() { //Bind window resize eventk window.onresize = this.ResizeMap; //Mouse over div this.M.onmouseover = function() { Obj.IsMouseOver = true; } this.M.onmouseout = function() { Obj.IsMouseOver = false; } //TESTING: this.MouseX, this.MouseY //if (!browser.isIE) { document.captureEvents(Event.MOUSEMOVE); } //document.onmousemove = this.MousePosition; //Scroll wheel listener if (!browser.isIE) { window.addEventListener("DOMMouseScroll", MouseWheel, false); } else { window.onmousewheel = document.onmousewheel = MouseWheel; } } function LatLong(X, Y) { this.X = 0; this.Y = 0; if (X) { this.X = X; } if (Y) { this.Y = Y; } } function FloatingMenu(ID, ZIndex) { this.ID = ID; this.ZIndex = ZIndex; } //Change map theme Map.prototype.ChangeTheme = function(ThemeID) { var Title = ""; //Close themes window $("themes").style.display = "none"; if (this.ThemeID != ThemeID) { this.ThemeID = ThemeID; //Change theme label Title = this.Themes[this.ThemeID].Title; $("themelabel").innerHTML = Title; SetLoadingStatus("Loading " + Title + "...","map_icon"); //Check for zoom region checkbox if ($("regionzoomcheck") != null && $("regionzoomcheck").checked == true) { this.CurrentCenter = new LatLong(this.Themes[ThemeID].CenterX, this.Themes[ThemeID].CenterY); this.CurrentZoom = this.Themes[ThemeID].DefaultZoom; this.setCenter(this.CurrentCenter, this.CurrentZoom); } else { this.setCenter(this.CurrentCenter, this.CurrentZoom); } setTimeout("ClearLoadingStatus()",350); //Theme ID matches current theme } else { Title = this.Themes[this.ThemeID].Title; SetLoadingStatus("Loading " + Title + "...","map_icon"); setTimeout("ClearLoadingStatus()",300); } } //Open theme switcher Map.prototype.ThemeMenu = function() { //alert($("themes")); this.OpenWindow("themes"); this.MinMaxWindow("themes","open"); //List default themes this.ListThemes(); } Map.prototype.ListThemes = function(ThemeType) { var Offsets = new Array(); var T; var i = 0; var Count = 0; var H = new StringBuilder(); H.append(""); //Load county themes list if (ThemeType == "county" || ThemeType == null) { Offsets.push(0); Offsets.push(1); Offsets.push(2); Offsets.push(3); Offsets.push(4); Offsets.push(5); //Do not show ag and nhd if (this.CompileFlag != 3) { Offsets.push(8); Offsets.push(9); } //Build buttons for (i=0; i"); } H.append(""); } H.append("
"); H.append(""); H.append("
"); //Load regional themes list } else if (ThemeType == "regional") { Offsets.push(6); Offsets.push(7); //Checkbox H.append(""); H.append(""); H.append(" Zoom to Region (when clicking on a button below)"); //Build buttons for (i=0; i"); } H.append(""); H.append(""); H.append(""); } H.append(""); } //alert(H.toString()); $("themecontainer").innerHTML = H.toString(); } //Generate a collection of tile cache themes Map.prototype.BuildThemeCollection = function() { var Themes = new Array(); var ServerRootArray = new Array(); var AppRootArray = new Array(); var i = 0; //Tile cache locations var Server1 = "http://solarcweb04/tilethemes/"; var Server2 = "http://solarcweb03/tilethemes/"; var Server3 = "http://gis.solanocounty.com/tilethemes/"; var Server4 = "http://localhost/tilethemes/"; //App locations //var AppServer1 = "http://solarcweb01/solanomapsdev/"; //var AppServer2 = "http://gis.solanocounty.com/enginedev/"; //var AppServer3 = "http://localhost/solanomaps/"; //Basic map Themes[0] = new TileTheme("","PlainMap","basictheme.jpg","Basic Map"); //Aerials Themes[1] = new TileTheme("","AerialMap","aerialtheme.jpg","Aerial Photography (2004)"); //Basic map + zoning Themes[2] = new TileTheme("","BasicZoning","basiczoning.jpg","Basic Map and Zoning"); //Aerials + zoning Themes[3] = new TileTheme("","AerialZoning","aerialzoning.jpg","Aerials and Zoning"); //Basic map + general plan Themes[4] = new TileTheme("","BasicGeneralPlan","basicgeneralplan.jpg","Basic Map and 1980 General Plan"); //Aerials + general plan Themes[5] = new TileTheme("","AerialGeneralPlan","aerialgeneralplan.jpg","Aerials and 1980 General Plan"); //Basic map + benicia zoning (APN labels) Themes[6] = new TileTheme("","BeniciaZoning","beniciazoning1.jpg","Basic Map and Benicia Zonning",6517625,1786925,7); Themes[7] = new TileTheme("","BeniciaZoning2","beniciazoning2.jpg","Basic Map and Benicia Zonning",6517625,1786925,7); //Basic map + NHD Themes[8] = new TileTheme("","BasicNHD","nhdtheme.jpg","Basic Map + Natural Hazards"); //Aerials + Agriculture Themes[9] = new TileTheme("","AerialAgriculture","agtheme.jpg","Aerials + Agriculture"); //Basic Map + Assessor Map Book Numbers?? //Intranet compile theme or Bare API for internal use if (this.CompileFlag == 1 || this.CompileFlag == 0) { for (i=0; i=1600) { this.CurrentZoom = 4; } else if (W>=800) { this.CurrentZoom = 3; } else if (W>=550) { this.CurrentZoom = 2; } else { this.CurrentZoom = 3; } this.setCenter(this.CurrentCenter, this.CurrentZoom); } //Zoom by extent (see selectextent.js) Map.prototype.StartZoomExtent = function() { this.EnableExtentSelect("#ff3333", "Obj.ZoomExtent()"); } //Perform MBR zoom operation Map.prototype.ZoomExtent = function() { this.ZoomToMBR(this.ExtentMBR.MinX, this.ExtentMBR.MaxX, this.ExtentMBR.MinY, this.ExtentMBR.MaxY); //this.M.removeChild($("extentsquare")); setTimeout("ClearLoadingStatus()",150); } //Refresh current extent Map.prototype.RefeshExtent = function() { this.setCenter(this.CurrentCenter, this.CurrentZoom); } //Go to previous extent, if it exists Map.prototype.PreviousExtent = function() { this.LatLongHistory.pop(); this.ZoomHistory.pop(); //If there is a previous extent to pop if (this.LatLongHistory.length > 0) { this.CurrentCenter = this.LatLongHistory.pop(); this.CurrentZoom = this.ZoomHistory.pop(); this.setCenter(this.CurrentCenter, this.CurrentZoom); } } //Store current extent Map.prototype.StoreExtent = function() { var CInfo = this.GetContainerInfo(); this.LatLongHistory.push(new LatLong(CInfo.CenterX, CInfo.CenterY)); this.ZoomHistory.push(this.CurrentZoom); //this.DebugExtentHistory(); } //Print debugging output for extent storage Map.prototype.DebugExtentHistory = function() { var S = new StringBuilder(); for (var i=0; i"); } $("debug2").innerHTML = S.toString(); } //Double click zoom in Map.prototype.ClickZoomIn = function(e) { var Process = true; //Ignore operation if any of the blockers are open //Ignore operation if shift of ctrl key is down if (this.ShiftCtrlPressed(e) == true) { Process = false; } if (Process == true) { //Track mouse position this.MousePosition(e); //Get map div container bounds var C = this.GetContainerInfo(); var Zoom = this.ZoomLevels[this.CurrentZoom]; //Calculate distance between mouse and map div center (feet) var OffsetX = (this.MouseX - C.CenterLeft) * Zoom.FPP; var OffsetY = (C.CenterTop - this.MouseY) * Zoom.FPP; //Change current centerpoint this.CurrentCenter = new LatLong(this.CurrentCenter.X + OffsetX, this.CurrentCenter.Y + OffsetY); //Perform zoom if (this.CurrentZoom < (this.MaxZoom + 1)){ this.CurrentZoom = this.CurrentZoom + 2; this.setCenter(this.CurrentCenter, this.CurrentZoom); } else if (this.CurrentZoom < this.MaxZoom){ this.CurrentZoom++; this.setCenter(this.CurrentCenter, this.CurrentZoom); } setTimeout("ClearLoadingStatus()",120); } } //Search for appropriate zoom level to zoom, based on MBR //This is for buffer results zoom and zoom in by extent Map.prototype.ApproximateZoomOffset = function(Bounds) { var MinX = Bounds.MinX; var MaxX = Bounds.MaxX; var MinY = Bounds.MinY; var MaxY = Bounds.MaxY; var CheckLength = 0; var i = 0; if ((MaxX-MinX) > (MaxY-MinY)) { CheckLength = (MaxX-MinX); } else { CheckLength = (MaxY-MinY); } //Find appropiate zoom level for (i=(this.ZoomLevels.length-1); i>=0; i--) { var Zoom = this.ZoomLevels[i]; if (CheckLength <= Zoom.FPT) { break; } } //Go 1 level further down if (i this.MinZoom){ this.CurrentZoom--; this.setCenter(this.CurrentCenter, this.CurrentZoom); } } //Simplified version of setCenter, only taking in XY point Map.prototype.setCenterSimple = function(X, Y, ZoomOffset) { if (IsNumeric(X) == true && IsNumeric(Y) == true) { X = parseFloat(X); Y = parseFloat(Y); if (ZoomOffset) { this.CurrentZoom = ZoomOffset; } this.setCenter(new LatLong(X, Y), this.CurrentZoom); } else { alert("X or Y value is not a numeric value."); } } //Center the map Map.prototype.setCenter = function(LL, ZoomLevel) { this.CurrentCenter = LL; this.TileCount = 0; if (ZoomLevel < this.MinZoom) { this.CurrentZoom = this.MinZoom; } else if (ZoomLevel > this.MaxZoom) { this.CurrentZoom = this.MaxZoom; } else { this.CurrentZoom = ZoomLevel; } //Add entry to extent history this.StoreExtent(); //Flush tile grid FlushLayer($("tilegrid")); $("dragcontainer").style.left = "0px"; $("dragcontainer").style.top = "0px"; //Get absolute map div position var P = FindPixelPosition(this.M); var Zoom = this.ZoomLevels[this.CurrentZoom]; var FPT = Zoom.FPT; //Testing //$("debug").innerHTML = "Zoom: " + Zoom.FPT; //Fetch container width and height var ContainerWidth = parseInt(this.M.style.width); var ContainerHeight = parseInt(this.M.style.height); //Calculate absolute pixel space centerpoint var CenterX = LL.X; var CenterY = LL.Y; //Calculate feet space extents of div container var DivMinX = Math.round(CenterX - ((ContainerWidth/2)*Zoom.FPP)); //left var DivMaxX = Math.round(CenterX + ((ContainerWidth/2)*Zoom.FPP)); //right var DivMaxY = Math.round(CenterY + ((ContainerHeight/2)*Zoom.FPP)); //top var DivMinY = Math.round(CenterY - ((ContainerHeight/2)*Zoom.FPP)); //bottom //Set initial search bounds as map div bounds var TileMinX = DivMinX; var TileMaxX = DivMaxX; var TileMinY = DivMinY; var TileMaxY = DivMaxY; var MinX = 99999999; var MaxX = 0; var MinY = 99999999; var MaxY = 0; var PxLeft = 0; var PxTop = 0; var ImageSrc = ""; var ImageName = ""; var RoundedLeft = 0; var RoundedTop = 0; var Node; //Search for tile minmax bounds while ((TileMinX - Zoom.MinX) % Zoom.FPT != 0) { TileMinX--; } while ((TileMaxX - Zoom.MinX) % Zoom.FPT != 0) { TileMaxX++; } while ((TileMinY - Zoom.MinY) % Zoom.FPT != 0) { TileMinY--; } while ((TileMaxY - Zoom.MinY) % Zoom.FPT != 0) { TileMaxY++; } //Add image elements to tile layer for (var left = (TileMinX - Zoom.FPT); left < TileMaxX; left += Zoom.FPT) { for (var top = (TileMinY - Zoom.FPT); top < TileMaxY; top += Zoom.FPT) { //Increment tile count this.TileCount++; //Calculate pixel space image position PxLeft = parseInt((left - DivMinX) / Zoom.FPP); PxTop = parseInt((DivMaxY-(top+Zoom.FPT)) / Zoom.FPP); if (this.TileCount == 1) { RoundedLeft = PxLeft; RoundedTop = PxTop; } else { //Check for horizontal rounding error if ((PxLeft-RoundedLeft)!=0 && (PxLeft-RoundedLeft)%512 != 0) { if (((PxLeft+1)-RoundedLeft)%512 == 0) { PxLeft++; } else if (((PxLeft-1)-RoundedLeft)%512 == 0) { PxLeft--; } } //Check for vertical rounding error if ((PxTop-RoundedTop)!=0 && (PxTop-RoundedTop)%512 != 0) { if (((PxTop+1)-RoundedTop)%512 == 0) { PxTop++; } else if (((PxTop-1)-RoundedTop)%512 == 0) { PxTop--; } } } //Create image Node = null; Node = document.createElement("img"); Node.setAttribute("id", this.TileCount); //Set xy bounds and zoom level Node.setAttribute("minx", left); Node.setAttribute("maxx", (left+Zoom.FPT)); Node.setAttribute("miny", top); Node.setAttribute("maxy", (top+Zoom.FPT)); //Pixel positioning & img src Node.style.position = "absolute"; Node.style.left = PxLeft + "px"; Node.style.top = PxTop + "px"; //Set image src this.SetTileImage(Node); //Bind standard events Node = this.TileEvents(Node); //In case if tile is 404 Node.onerror = function() { DefaultTile(this.getAttribute("id")); } //Add the tile to tile grid $("tilegrid").appendChild(Node); } } //Determine the tile grid width and height for (var i=1; i<=this.TileCount; i++) { Node = $(i); TileMinX = parseInt(Node.getAttribute("minx")); TileMaxX = parseInt(Node.getAttribute("maxx")); TileMinY = parseInt(Node.getAttribute("miny")); TileMaxY = parseInt(Node.getAttribute("maxy")); if (TileMinX < MinX) { MinX = TileMinX; } if (TileMaxX > MaxX) { MaxX = TileMaxX; } if (TileMinY < MinY) { MinY = TileMinY; } if (TileMaxY > MaxY) { MaxY = TileMaxY; } } this.TileWidth = parseInt((MaxX - MinX)/FPT); this.TileHeight = parseInt((MaxY - MinY)/FPT); //Redraw identify parcels this.IdentifyCollection.DrawAll(); //Redraw search parcels this.SearchCollection.DrawAll(); //Redraw buffer parcels this.BufferCollection.DrawAll(); //Redraw buffer street lines this.BufferStreetCollection.DrawAll(); //Redraw street view pin this.RefreshStreetPin(); //Redraw grid search square & label this.RefreshMapGrid(); //Draw scalebar labels this.UpdateScaleBar(); //Redraw GPS / NAD83 point search pin this.RefreshGPSPin(); } //Bind tile mouse events Map.prototype.TileEvents = function(Node) { //Identify mouse single click event //Firefox if (!browser.isIE) { Node.onmousedown = function(event) { Obj.SingleTileClick(event); return false; } //IE } else { Node.onmousedown = function() { Obj.SingleTileClick(event); } } //No text highlighting Node.onselectstart = function() { return false; } //Drag finished if (!browser.isIE) { Node.onmouseup = function(event) { Obj.UpdateCenterPoint(event); } } else { Node.onmouseup = function() { Obj.UpdateCenterPoint(event); } } //Double click zoom if (!browser.isIE) { Node.ondblclick = function(event) { Obj.ClickZoomIn(event); } } else { Node.ondblclick = function() { Obj.ClickZoomIn(event); } } //Click once to hide mouse menu, reset clicked text field if (!browser.isIE) { Node.onclick = function(event) { Obj.ResetClickedTextField(); Obj.HideMouseMenu(event); } } else { Node.onclick = function() { Obj.ResetClickedTextField(); Obj.HideMouseMenu(event); } } //Disable text selection Node.onselectstart = function () { return false; }; return Node; } //Create 14 tile zoom levels Map.prototype.MakeZoomLevels = function() { this.ZoomLevels = new Array(); this.ZoomLevels[0] = new TileZoom(300000, 6410000, 6710000, 1716000, 2016000); //full extent this.ZoomLevels[1] = new TileZoom(250000, 6435000, 6685000, 1741000, 1991000); //full extent this.ZoomLevels[2] = new TileZoom(200000, 6360000, 6760000, 1766000, 1966000); //full extent this.ZoomLevels[3] = new TileZoom(150000, 6410000, 6710000, 1716000, 2016000); //full extent this.ZoomLevels[4] = new TileZoom(128000, 6432000, 6688000, 1738000, 1994000); //full extent this.ZoomLevels[5] = new TileZoom(64000, 6432000, 6688000, 1770000, 1962000); this.ZoomLevels[6] = new TileZoom(32000, 6432000, 6688000, 1770000, 1962000); this.ZoomLevels[7] = new TileZoom(16000, 6440000, 6680000, 1770000, 1962000); this.ZoomLevels[8] = new TileZoom(8000, 6440000, 6680000, 1770000, 1962000); this.ZoomLevels[9] = new TileZoom(4000, 6440000, 6680000, 1772000, 1960000); this.ZoomLevels[10] = new TileZoom(2000, 6440000, 6680000, 1772000, 1960000); this.ZoomLevels[11] = new TileZoom(1000, 6440000, 6680000, 1772000, 1960000); this.ZoomLevels[12] = new TileZoom(500, 6440000, 6680000, 1772000, 1960000); this.ZoomLevels[13] = new TileZoom(250, 6440000, 6680000, 1772000, 1960000); } //Debug function 1 Map.prototype.DebugTiles = function() { var H = new StringBuilder(); var Node; for (var i=1; i<=this.TileCount; i++) { Node = $(i); H.append(i + ") " + Node.src + ""); H.append(" " + Node.style.left + "," + Node.style.top); H.append("
"); } $("debug1").innerHTML = H.toString(); } //Generate map div position / bounds information Map.prototype.GetContainerInfo = function() { //Get absolute map div position var P = FindPixelPosition(this.M); var Zoom = this.ZoomLevels[this.CurrentZoom]; var FPT = Zoom.FPT; var C = new ContainerInfo(); //Fetch container width and height C.ContainerWidth = parseInt(this.M.style.width); C.ContainerHeight = parseInt(this.M.style.height); //Calculate absolute pixel space centerpoint C.CenterTop = Math.round(P.Top + (C.ContainerHeight/2)); C.CenterLeft = Math.round(P.Left + (C.ContainerWidth/2)); C.CenterX = this.CurrentCenter.X; C.CenterY = this.CurrentCenter.Y; //Calculate feet space extents of div container C.DivMinX = Math.round(C.CenterX - ((C.ContainerWidth/2)*Zoom.FPP)); //left C.DivMaxX = Math.round(C.CenterX + ((C.ContainerWidth/2)*Zoom.FPP)); //right C.DivMaxY = Math.round(C.CenterY + ((C.ContainerHeight/2)*Zoom.FPP)); //top C.DivMinY = Math.round(C.CenterY - ((C.ContainerHeight/2)*Zoom.FPP)); //bottom return C; } function ContainerInfo() { this.ContainerWidth = 0; this.ContainerHeight = 0; this.CenterTop = 0; this.CenterLeft = 0; this.CenterX = 0; this.CenterY = 0; this.DivMinX = 0; this.DivMaxX = 0; this.DivMaxY = 0; this.DivMinY = 0; } //Tile zoom parameter object function TileZoom(ZoomLevel, MinX, MaxX, MinY, MaxY) { this.ZoomLevel = ZoomLevel; this.MinX = MinX; this.MaxX = MaxX; this.MinY = MinY; this.MaxY = MaxY; this.FPT = ZoomLevel; this.FPP = (ZoomLevel/512); } //Global vars for tracking div dragging var DragObject = new Object(); var DragID = ""; var OpacityDrag = false; //Initialize element dragging Map.prototype.StartDrag = function(Event, ID, Opacity) { var X; var Y; var ML; var MousePosition; //$("debug2").innerHTML = "test dragging: " + ID; //If the object is a menu, bring it to the front for (var i=0; i= MapWidth){ Node.style.left = parseInt(TileLeft - (this.TileWidth * 512)) + "px"; Node.setAttribute("minx", (TileMinX - (this.TileWidth * FPT))); Node.setAttribute("maxx", (TileMaxX - (this.TileWidth * FPT))); this.SetTileImage(Node); //Tile is too far to the left, move it to the new right-most column } else if ((DragLeft + TileLeft) <= -512) { Node.style.left = parseInt(TileLeft + (this.TileWidth * 512)) + "px"; Node.setAttribute("minx", (TileMinX + (this.TileWidth * FPT))); Node.setAttribute("maxx", (TileMaxX + (this.TileWidth * FPT))); this.SetTileImage(Node); } //Fetch current feet coordinates TileMinX = parseInt(Node.getAttribute("minx")); TileMaxX = parseInt(Node.getAttribute("maxx")); TileMinY = parseInt(Node.getAttribute("miny")); TileMaxY = parseInt(Node.getAttribute("maxy")); //Tile is too far to the bottom, move it to the new top row if ((DragTop + TileTop) >= MapHeight){ Node.style.top = parseInt(TileTop - (this.TileHeight * 512)) + "px"; Node.setAttribute("miny", (TileMinY + (this.TileHeight * FPT))); Node.setAttribute("maxy", (TileMaxY + (this.TileHeight * FPT))); this.SetTileImage(Node); //Tile is too far to the top, move it to the new bottom row } else if ((DragTop + TileTop) <= -512) { Node.style.top = parseInt(TileTop + (this.TileHeight * 512)) + "px"; Node.setAttribute("miny", (TileMinY - (this.TileHeight * FPT))); Node.setAttribute("maxy", (TileMaxY - (this.TileHeight * FPT))); this.SetTileImage(Node); } } //Obj.DebugTiles(); //$("debug3").innerHTML = ""; //$("debug2").innerHTML = "Tile Width: " + this.TileWidth + "  Tile Height: " + this.TileHeight; } //Set tile image Map.prototype.SetTileImage = function(Node) { var Zoom = this.ZoomLevels[this.CurrentZoom]; var URL = new StringBuilder(); URL.append(this.Themes[this.ThemeID].TileRoot); URL.append(this.Themes[this.ThemeID].TileDirectory + "/" + Zoom.FPT + "/"); URL.append(Node.getAttribute("minx") + "-" + Node.getAttribute("maxx") + "-"); URL.append(Node.getAttribute("miny") + "-" + Node.getAttribute("maxy") + ".jpg"); Node.setAttribute("fpt", Zoom.FPT); //Node.setAttribute("alt", "Right click here to access shortcuts menu."); Node.src = URL.toString(); } //Keyboard event handler document.onkeydown = Keyboard; function Keyboard(e) { var ProcessKeyboard = false; var KCode; var ShiftKey = false; //Ignore keyboard handler if mouse is not hovering over a map tile if (Obj.IsMouseOver == true) { ProcessKeyboard = true; } if (window.event) { KCode = window.event.keyCode; ShiftKey = window.event.shiftKey; } else if (e) { KCode = e.which; ShiftKey = e.shiftKey; } //Ignore operation if temporary vector draw blocker is turned on if ($("localblocker").style.display == "") { ProcessKeyboard = false; //ESC key to turn off extent selector, and then refresh map if (KCode == 27) { Obj.ClearExtentSelection(); } } if (ProcessKeyboard == true) { //Arrow Keys Panning if (KCode == 38) { //Up Obj.StartTween("up"); } else if (KCode == 40) { //Down Obj.StartTween("down"); } else if (KCode == 37) { //Left Obj.StartTween("left"); } else if (KCode == 39) { //Right Obj.StartTween("right"); } //Plus & Minus Key Zooming if (KCode==107 || KCode==187) { clearTimeout(Obj.ZoomTimer); Obj.ZoomTimer = setTimeout("Obj.ZoomIn()", 90); } else if (KCode==109 || KCode==189) { clearTimeout(Obj.ZoomTimer); Obj.ZoomTimer = setTimeout("Obj.ZoomOut()", 90); } //Theme switcher if shift key is held down //alert(ShiftKey); if (ShiftKey == true) { //1 = Plain Map if (KCode == 49) { Obj.ChangeTheme(0); //2 = Aerial Map } else if (KCode == 50) { Obj.ChangeTheme(1); //3 = Basic Map + Zoning } else if (KCode == 51) { Obj.ChangeTheme(2); //4 = Aerials + Zoning } else if (KCode == 52) { Obj.ChangeTheme(3); //5 = Basic Map + General Plan } else if (KCode == 53) { Obj.ChangeTheme(4); //6 = Aerials + General Plan } else if (KCode == 54) { Obj.ChangeTheme(5); //7 = Basic Map + NHD } else if (KCode == 55) { Obj.ChangeTheme(8); //8 = Aerials + Agriculture } else if (KCode == 56) { Obj.ChangeTheme(9); //R = Reset map } else if (KCode == 82) { Obj.ResetAll(); } //alert(KCode); } } } //Check if control key is pressed Map.prototype.CtrlPressed = function(Event) { if (Event) { if (Event.ctrlKey == true) { return true; } else { return false; } } else { return false; } } //Check if shift or control key is pressed Map.prototype.ShiftCtrlPressed = function(Event) { if (Event) { if (Event.shiftKey == true || Event.ctrlKey == true) { return true; } else { return false; } } else { return false; } } //Keyboard panning var TweenDelay; var TweenCount = 0; //Recursive counter var TweenMax = 7; //max number of steps var TStepSize = 40; //movement pixels per frame var TweenDirection = ""; Map.prototype.StartTween = function(Direction) { TweenDirection = Direction; TweenCount = 0; //reset frame counter this.Tween(); //start recursion } //Recursive map tile tween function, for keyboard panning Map.prototype.Tween = function() { var M = $("dragcontainer"); if (TweenDirection=="left") { M.style.left = (parseInt(M.style.left)+TStepSize) + "px"; } else if (TweenDirection=="right") { M.style.left = (parseInt(M.style.left)-TStepSize) + "px"; } else if (TweenDirection=="up") { M.style.top = (parseInt(M.style.top)+TStepSize) + "px"; } else if (TweenDirection=="down") { M.style.top = (parseInt(M.style.top)-TStepSize) + "px"; } TweenCount++; //More tweening needed if (TweenCount<=TweenMax){ clearTimeout(TweenDelay); TweenDelay = setTimeout("Obj.Tween()",5); //Tween done } else { clearTimeout(TweenDelay); setTimeout("Obj.UpdateCenterPoint()",20); } } //Content preloader /* Sequence: 1) DIV layers 2) menu images 3) floating menus 4) URL API calls (called from 3) */ //Opacity when menu is not selected or moused over var MenuOpacity = 85; //Start preload sequence Map.prototype.RunPreloader = function() { var LastIndex = this.MakeLayers(); //Preload menu images this.LoadImages(); //Preload floating windows this.LoadMenus(LastIndex); //Preload dock navigation this.MakeDockMenu(); } //Create layered divs Map.prototype.MakeLayers = function() { //Parent container for all draggable elements this.MakeLayer("dragcontainer", this.M, 0); //Tile grid this.MakeLayer("tilegrid", $("dragcontainer"), 0); //Image overlay layer (example:large buffers) this.MakeLayer("imagecontainer", $("dragcontainer"), 100); //Parcel highlight and street line layer (BUFFER) this.MakeLayer("buffercontainer", $("dragcontainer"), 150); this.MakeLayer("streetcontainer", $("dragcontainer"), 200); //Parcel higlight layer (SEARCH) this.MakeLayer("searchcontainer", $("dragcontainer"), 250); //Parcel highlight layer (IDENTIFY) this.MakeLayer("identifycontainer", $("dragcontainer"), 300); //Grid search layer this.MakeLayer("gridcontainer", $("dragcontainer"), 350); //MapMaker vector draw storage layer this.MakeLayer("drawcontainer", $("dragcontainer"), 400); //20 MAX point / point bubble layers var L = 3000; for (var i=1; i<=20; i++) { this.MakeLayer("pointlayer" + i, $("dragcontainer"), L); //pins this.MakeLayer("bubblelayer" + i, $("dragcontainer"), L+100); //infobubbles L += (i*200); } //Google street view icon L += 100; this.MakeLayer("streetviewlayer", $("dragcontainer"), L); //Point search icon L += 100; this.MakeLayer("gpslayer", $("dragcontainer"), L) //General purpose blocker for last 2 layers below L += 100; this.MakeBlocker("blocker", this.M, L); //Localized blocker for temporary vector graphics L += 100; this.MakeLocalBlocker("localblocker", this.M, L); //Layer for temporary mouse vectors (dynamic drawing and selection) L += 100; this.MakeLayer("mousevectors", this.M, L); //Make top center label holder for primary help content L += 100; this.MakeTopCenterLabel(999999, "help", 100, "#5173aa", "730", true); //Make top center label holder for secondary help content L += 100; this.MakeTopCenterLabel(999999, "guide", 93, "#56af58", "", false); //Initialize Status indicators StatusIndicators(); //Initialize splash screen(s) and layer, see splash.js L += 100; this.MakeLayer("splash", document.body, L); this.SplashScreen(); return L; } //Preload images TBA Map.prototype.LoadImages = function() { } //Load top menu and floating menus from XML Map.prototype.LoadMenus = function(LastIndex) { var XML = ""; var Offset = 0; ////////////////////////////////////////////////////////////// //Initialize compile flag-dependant menus ////////////////////////////////////////////////////////////// //Right click identify this.MenuLayers[Offset] = new FloatingMenu("identify", LastIndex); LastIndex += 200; Offset++; //Autocomplete / advanced search this.MenuLayers[Offset] = new FloatingMenu("search", LastIndex); LastIndex += 200; Offset++; //GPS Search this.MenuLayers[Offset] = new FloatingMenu("gps", LastIndex); LastIndex += 200; Offset++; //Save My Map this.MenuLayers[Offset] = new FloatingMenu("savemap", LastIndex); LastIndex += 200; Offset++; //List Saved Maps this.MenuLayers[Offset] = new FloatingMenu("savemaplist", LastIndex); LastIndex += 200; Offset++; //Street View this.MenuLayers[Offset] = new FloatingMenu("streetview", LastIndex); LastIndex += 200; Offset++; //Theme Selector this.MenuLayers[Offset] = new FloatingMenu("themes", LastIndex); LastIndex += 200; Offset++; //Buffer this.MenuLayers[Offset] = new FloatingMenu("buffer", LastIndex); LastIndex += 200; Offset++; //Print this.MenuLayers[Offset] = new FloatingMenu("print", LastIndex); LastIndex += 200; Offset++; var MResponse = function(XMLObj) { XML = XMLObj.responseText; //Testing var StartLeft = 5; var StartTop = 60 + 45; var ML; //Add floating menus for (var i=0; i"); } H.append(""); H.append(""); H.append("
"); //Message H.append(""); H.append(""); H.append(""); H.append("
"); //Subtext H.append(""); H.append(""); H.append(""); H.append("
"); if (AlignCenter == true) { H.append(""); } L.innerHTML = H.toString(); document.body.appendChild(L); } } //Make local map div interface blocker Map.prototype.MakeLocalBlocker = function(ElementName, ParentDiv, ZIndex) { if (!$(ElementName)) { var LayerObj = document.createElement("div"); LayerObj.style.zIndex = ZIndex; LayerObj.style.position = "absolute"; LayerObj.setAttribute("id",ElementName); //Blocker specific styles LayerObj.style.filter = "alpha(opacity=0)"; //IE opacity LayerObj.style.opacity = "0"; //Firefox opacity LayerObj.style.width = "100px"; LayerObj.style.height = "100px"; LayerObj.style.left = "0px"; LayerObj.style.top = "0px"; LayerObj.style.backgroundColor = "#336699"; LayerObj.style.display = "none"; ParentDiv.appendChild(LayerObj); } } //Update local map div interface blocker size Map.prototype.UpdateLocalBlockerSize = function(ElementName) { var B = $(ElementName); B.style.width = this.M.style.width; B.style.height = this.M.style.height; } //Make whole browser interface blocker to lock out during processing / vector draws Map.prototype.MakeBlocker = function(ElementName, ParentDiv, ZIndex) { if (!$(ElementName)) { var LayerObj = document.createElement("div"); LayerObj.style.zIndex = ZIndex; LayerObj.style.position = "absolute"; LayerObj.setAttribute("id",ElementName); //Blocker specific styles LayerObj.style.filter = "alpha(opacity=0)"; //IE opacity LayerObj.style.opacity = "0"; //Firefox opacity LayerObj.style.width = "100%"; LayerObj.style.height = "100%"; LayerObj.style.left = "0px"; LayerObj.style.top = "0px"; LayerObj.style.backgroundColor = "#336699"; LayerObj.style.display = "none"; //Disable mouse selection LayerObj.onselectstart = function() { return false; }; LayerObj.onmousedown = function() { return false; }; ParentDiv.appendChild(LayerObj); } } //Loading indicators function SetLoadingStatus(Message, IconSrc) { //There is a message to show if (Message) { var Root = ""; if (Obj.AppRoot) { Root = Obj.AppRoot; } var H = new StringBuilder(); H.append("
"); H.append("
"); H.append(""); H.append(""); //There is an icon if (IconSrc && IconSrc != "") { H.append(""); H.append(""); } H.append("
"); if (IconSrc.indexOf(".") > -1) { H.append(""); } else { H.append(""); } H.append(" "); H.append(Message + "
"); H.append("
"); $("loadlabel").innerHTML = H.toString(); $("loadlabel").style.display = ""; } $("loadlabelback").style.display = ""; } //Clear loading label w/fade function ClearLoadingStatus() { $("loadlabel").style.display = "none"; $("loadlabelback").style.display = "none"; } //Status indicators function StatusIndicators() { var D; //Loading blocker if (!$("loadlabelback")) { D = document.createElement("div"); D.setAttribute("id", "loadlabelback"); D.style.filter = "alpha(opacity=0)"; D.style.opacity = "0"; D.style.width = "100%"; D.style.height = "100%"; D.style.zIndex = "900000"; D.style.position = "absolute"; D.style.left = "0px"; D.style.top = "0px"; D.style.backgroundColor = "#ffffff"; D.style.display = "none"; document.body.appendChild(D); } //Loading label if (!$("loadlabel")) { D = document.createElement("div"); D.setAttribute("id", "loadlabel"); D.style.filter = "alpha(opacity=95)"; D.style.opacity = "0.95"; D.style.left = "50%"; D.style.top = "5px"; D.style.marginLeft = "-200px"; D.style.zIndex = "900000"; D.style.position = "absolute"; D.style.backgroundColor = "#ffffff"; D.style.display = "none"; document.body.appendChild(D); } } //Check for URL api inputs Map.prototype.URLAPI = function() { var X = 0; var Y = 0; var Lat = 0; var Long = 0; //Zoom to NAD83 XY coordinate if (GetURLParam("x") != "" && GetURLParam("y") != "") { //Check if values are numeric //http://solarcweb01/enginedev/?x=6574063.00000&y=1883063 if (IsNumeric(GetURLParam("x")) == true && IsNumeric(GetURLParam("y")) == true) { //Zoom to point this.CloseSplash(); X = parseFloat(GetURLParam("x")); Y = parseFloat(GetURLParam("y")); this.DrawGPSPoint(new LatLong(X, Y), 13); } else { alert("X or Y URL input is not a numeric value."); } //Zoom to UTM DD LatLong //http://solarcweb01/enginedev/?lat=38.24818&long=-122.04123 } else if (GetURLParam("lat") != "" && GetURLParam("long") != "") { //Check if values are numeric if (IsNumeric(GetURLParam("lat")) == true && IsNumeric(GetURLParam("long")) == true) { this.CloseSplash(); this.DefaultPointSearch(GetURLParam("lat") + "," + GetURLParam("long"), true); } else { alert("Latitude or Longitude URL input is not a numeric value."); } //Select and zoom to parcel APN (Version 1.X compatibility) } else if (GetURLParam("apn") != "") { //No parcel address was passed in, search APN only if (GetURLParam("parceladdress") == "") { SetLoadingStatus("Finding Parcel...","map_icon"); //Parcel address was passed in } else { SetLoadingStatus("Finding " + ProperCase(GetURLParam("parceladdress")) + "...","map_icon"); } //See SelectGeometry.js to finish up this.CloseSplash(); this.QueryParcelAPN(GetURLParam("apn"), GetURLParam("parceladdress"), this.IdentifyCollection); } } //Add 2 debug labels to document Map.prototype.DebugLabels = function(DoShow) { var D = document.createElement("div"); D.setAttribute("id","debug"); D.style.position = "absolute"; D.style.left = "5px"; D.style.top = "300px"; D.style.backgroundColor = "#ffffff"; D.style.padding = "3px"; if (DoShow == false) { D.style.display = "none"; } document.body.appendChild(D); D = document.createElement("div"); D.setAttribute("id","debug2"); D.style.position = "absolute"; D.style.left = "5px"; D.style.top = "325px"; D.style.backgroundColor = "#ffffff"; D.style.padding = "3px"; if (DoShow == false) { D.style.display = "none"; } document.body.appendChild(D); } //Functions for floating windows //The rest of the functions are in PRELOADER.JS //Some windows have multiple DOM items to hide, so make special cases Map.prototype.MinMaxWindow = function(ID, ForceOpenClose) { var W = $(ID); var Content1 = $(ID + "_1"); var DoOpen = false; var i = 1; //Force the window minimization on or off, skip automatic toggling if (ForceOpenClose) { //Force it open (maximize) if (ForceOpenClose == "open") { DoOpen = true; //Force it close (minimize) } else if (ForceOpenClose == "close") { DoOpen = false; } } else { //Hide content if (Content1.style.display == "") { DoOpen = false; //Show content } else { DoOpen = true; } } //Maximize if (DoOpen == true && $(ID + "_minmaxbutton")) { $(ID + "_minmaxbutton").src = this.AppRoot + "images/minimize.png"; while ($(ID + "_" + i)) { $(ID + "_" + i).style.display = ""; i++; } //Minimize } else if (DoOpen == false && $(ID + "_minmaxbutton")) { $(ID + "_minmaxbutton").src = this.AppRoot + "images/maximize.png"; while ($(ID + "_" + i)) { $(ID + "_" + i).style.display = "none"; i++; } } } //Open floating window Map.prototype.OpenWindow = function(ID) { var W = $(ID); this.SortMenus(ID); W.style.display = ""; } //Close floating window Map.prototype.CloseWindow = function(ID) { var W = $(ID); W.style.zIndex = parseInt(W.getAttribute("menuindex")); W.style.display = "none"; //Special case to remove streetview pin if (ID == "streetview" && $("streetpin")) { this.ClearStreetView(); //Special case to remove point search pin } else if (ID == "gps" && $("gpspin")) { $("gpslayer").removeChild($("gpspin")); } } //Temporarily hide / show all menus and dock (for dynamic vector graphic functions) Map.prototype.TempHideWindows = function() { var ID = ""; var Count = 0; var i = 0; this.MenuHideList = new Array(); //Fetch array of menus which are visible for (i=0; i"); for (var i=1; i"); for (var i=1; i -1) { $("identify").innerHTML = XML; $("identify").style.display = ""; //No parcels found } else if (XML == "") { if (Obj.IdentifyCollection.ParcelCount == 0) { $("identify").style.display = "none"; } alert("No address was found."); //1 APN found, 1 or more situs addresses found } else { //Loop through all parcels found Parcels = XML.split(""); for (var i=1; i"); for (var i=1; i -1) { $(this.LayerDivName).removeChild($(this.LayerPrefix + parseInt(APN))); this.ParcelArray.splice(Offset,1); this.ParcelCount--; return true; //No removal needed } else { return false; } } //One APN can have multiple address IDs this.RemoveID = function(ID) { var ParcelObj; var Offset = this.SearchByID(ID); //Removal needed if (Offset > -1) { //If the parcel object has only 1 address id, remove it entirely if (this.ParcelArray[Offset].IDCount == 1) { this.RemoveAPN(this.ParcelArray[Offset].APN); //Leave the parcel object in place, and remove 1 address ID } else { this.ParcelArray[Offset].RemoveID(ID); } return true; } else { return false; } } //Search by parcel APN this.SearchByAPN = function(APN) { var ANum = parseInt(APN); var Offset = -1; for (var i=0; i=0; i--) { //1 APN can have multiple IDs ParcelIDs = this.ParcelArray[i].IDCollection; for (var f=0; f0) { IDList.append(":"); } RowCount++; IDList.append(ParcelIDs[f]); } } return IDList.toString(); } //Redraw parcels (after zoom / resize operations) this.DrawAll = function() { var ParcelObj; for (var i=0; i=0; i--) { var Zoom = ZoomLevels[i]; if (Width <= Zoom.FPT) { break; } } //Zoom to parcel Obj.CurrentCenter = new LatLong(CX, CY); Obj.CurrentZoom = i; Obj.setCenter(Obj.CurrentCenter, Obj.CurrentZoom); //Higlight parcel if (!$(this.LayerPrefix + parseInt(ParcelObj.APN))) { Obj.DrawPolygon(this.LayerDivName, this.LayerPrefix + parseInt(ParcelObj.APN), ParcelObj.PolygonParts, ParcelObj.XYBounds, this.FillColor, this.FillTransparency, this.MouseOverColor); } setTimeout("ClearLoadingStatus()",100); } //Export datagrid to mailing labels, excel, or word this.ExportGrid = function(Format, Prefix) { var RowCount = 0; var IDList = new StringBuilder(); var DoExport = true; //Build deliminated list of ids to post for (var i=this.ParcelArray.length-1; i>=0; i--) { ParcelIDs = this.ParcelArray[i].IDCollection; for (var f=0; f0) { IDList.append(":"); } RowCount++; IDList.append(ParcelIDs[f]); } } var Params = "t=" + Math.random() + "&execute=parcelgridexport"; Params += "&format=" + Format; Params += "&idlist=" + IDList.toString(); Params += "&apncheck=" + $(Prefix + "_apncheck").checked; //APN checkbox Params += "&prefix=" + Prefix; Params += "&compileflag=" + Obj.CompileFlag; //alert(Params); //If the current theme requires special columns for word and excel exports var ThemeName = Obj.Themes[Obj.ThemeID].TileDirectory; Params += "&themename=" + ThemeName.toUpperCase() //Open popup var GridResponse2 = function(XMLObj) { var XML = XMLObj.responseText; //alert(XML); if (XML.indexOf("ERROR") > -1) { $("debug2").innerHTML = XML; $("debug2").style.display = ""; } var URL = Obj.AppRoot + "savefile.html?t=" + Math.random() + "&filename="; if (Format == "occupant") { URL += "OccupantLabels"; URL += "&extension=doc"; } else if (Format == "owner") { URL += "OwnerLabels"; URL += "&extension=doc"; } else if (Format == "word") { URL += "ParcelExport"; URL += "&extension=doc"; } else if (Format == "excel") { URL += "ParcelExport"; URL += "&extension=xls"; } //Add compile flag //URL += "&compileflag=" + Obj.CompileFlag; //Open save as popup Popup(URL, "export", 200, 200); setTimeout("ClearLoadingStatus()",350); } //5000 limit for datagrid exports if (Prefix == "search" || Prefix == "buffer") { if (parseInt($(Prefix + "count2").innerHTML) > 5000) { alert("There is a limit of 5000 search results for parcel exports."); DoExport = false; } } if (DoExport == true) { var SC = "
(this can take a few seconds)" if (Format == "word") { SetLoadingStatus(" Exporting to Word" + SC + "...","word"); } else if (Format == "excel") { SetLoadingStatus(" Exporting to Excel" + SC + "...","excel"); } else if (Format == "occupant") { SetLoadingStatus(" Exporting to Avery 5160 Labels" + SC + "...","contact"); } else if (Format == "owner") { SetLoadingStatus(" Exporting to Avery 5160 Labels" + SC + "...","contact"); } var A = new AjaxConn(); A.connect(Obj.AppRoot + "ajaxrequest.aspx","POST",Params,GridResponse2); } } //Bind inline parcel datagrid this.Grid = function(Prefix, PageOffset) { var D = $(this.GridName); var H = new StringBuilder(); var RowHTM = new StringBuilder(); var TR = new StringBuilder(); var ParcelIDs = new Array(); var ParcelObj; var BG = "#ffffff"; var RowCount = 0; var AcresTotal = 0.0; var IDList = new StringBuilder(); //Nothing to process if (this.ParcelCount == 0) { $(Prefix).style.display = "none"; //1 or more parcels to show on grid: } else { //Get row count RowCount = 0; for (var i=0; i=0; i--) { ParcelIDs = this.ParcelArray[i].IDCollection; for (var f=0; f0) { IDList.append(":"); } RowCount++; IDList.append(ParcelIDs[f]); } } //$("debug").innerHTML = "RowCount: " + RowCount; //Datagrid response var GridResponse1 = function(XMLObj) { //No remove row button if (Prefix.toUpperCase().indexOf("identify") > -1) { H.append(Obj.ParcelHeader(6)); // } else { H.append(Obj.ParcelHeader(7)); } H.append(XMLObj.responseText); $(Prefix).style.display = ""; D.innerHTML = H.toString(); D.style.display = ""; ClearLoadingStatus(); } var Params = "t=" + Math.random() + "&execute=parcelgrid"; Params += "&pagesize=" + this.PageSize; Params += "&idlist=" + IDList.toString(); Params += "&fillcolor=" + this.FillColor; Params += "&fillcolorover=" + this.MouseOverColor; //Paging request exists if (PageOffset) { Params += "&pageoffset=" + PageOffset; } else { Params += "&pageoffset=0"; } //alert(Params); if (PageOffset) { Params += "&pagenum=" + PageOffset; } else { Params += "&pagenum=0"; } var A = new AjaxConn(); SetLoadingStatus("Loading..."); A.connect(Obj.AppRoot + "ajaxrequest.aspx","POST",Params,GridResponse1); } } } //Parcel object, using deliminated strings for ID storage function Parcel(APN, ID, PolygonParts, Acres, Bounds) { this.APN = parseInt(APN); this.IDCollection = new Array(); this.IDCollection[0] = ID; this.IDCount = 1; this.Acres = Acres; this.PolygonParts = PolygonParts; this.XYBounds = Bounds; //Search for parcel address ID this.SearchID = function(ID) { var Found = false; for (var i=0; i"); H.append(""); for (var i=0; i"); H.append("" + C.ColName + ""); } if (ButtonTDCount) { H.append(""); //No TD buttons width lock needed } else { H.append("> "); } } H.append(""); return H.toString(); } function HeaderColumn(ColName, Width) { this.ColName = ""; this.Width = 0; if (ColName) { this.ColName = ColName; } if (Width) { this.Width = Width; } } //Count rows, exclusion count function CountRows(HTM, HeaderRowCounts) { HTM = HTM.toUpperCase(); var H = HTM.split("1) { H.append(Total + " results" + AStr + " found"); } else if (Total==1) { H.append(Total + " result" + AStr + " found"); } else if (Total==0) { H.append("No results found"); } //Time label if (Seconds && Total != 0) { if (Seconds>1) { H.append(" in " + Seconds + " seconds"); } else { H.append(" in " + Seconds + " second"); } } return H.toString(); } //Draw simple straight line (no feet conversions needed) //Works faster for dynamic vector draws Map.prototype.DrawSimpleLine = function(LayerName, ID, X1, Y1, X2, Y2, LineWidth, LineColor) { var C; var CanvasObj; var Str = new StringBuilder(); var L = $(LayerName); var Width = Math.abs(X1 - X2); var Height = Math.abs(Y1 - Y2); //Use VML (IE) if (browser.isIE == true) { Str.append(""); L.innerHTML = Str.toString(); } else { //CanvasPos = RP.ConvertToPixels(XYBounds.MinX, XYBounds.MaxY, FPP); CanvasObj = document.createElement("CANVAS"); CanvasObj.setAttribute("id",ID + "line"); CanvasObj.setAttribute("width",Width+1); CanvasObj.setAttribute("height",Height+1); CanvasObj.style.position = "absolute"; CanvasObj.style.left = "0px"; CanvasObj.style.top = "0px"; C = CanvasObj.getContext("2d"); C.beginPath(); C.moveTo(X1, Y1); C.lineTo(X2, Y2); C.lineWidth = LineWidth; C.strokeStyle = LineColor; C.stroke(); //Check if line exists on layer if ($(ID + "line")) { L.removeChild($(ID + "line")); } L.appendChild(CanvasObj); } } //Draw complex line (from street data) Map.prototype.DrawLine = function(LayerName, ID, LineParts, XYBounds, LineWidth, LineColor, LineTransparency, MouseOverColor) { var Pts; //Array of points var PixelPt; var VML; var VMLPos; var CanvasPos; var CanvasObj; var Group; var Fill; var Str = new StringBuilder(); var L = $(LayerName); var RP = this.GetReferencePoint(); //Reference conversion point from sample tile var FPP = this.ZoomLevels[this.CurrentZoom].FPP; //feet per pixel var Width = parseInt(((XYBounds.MaxX - XYBounds.MinX) / FPP)); var Height = parseInt(((XYBounds.MaxY - XYBounds.MinY) / FPP)); //Use VML (IE) if (browser.isIE == true) { Group = document.createElement("vml:group"); Group.setAttribute("id", ID); Group.style.position = "absolute"; Group.style.left = "0px"; Group.style.top = "0px"; Group.style.zIndex = 0; Group.style.width = Width + "px"; Group.style.height = Height + "px"; Group.coordorigin = "0,0"; Group.coordsize = Width + "," + Height; VMLPos = RP.ConvertToPixels(XYBounds.MinX, XYBounds.MaxY, FPP); //Loop through each line part for (var i=0; i0) { Str.append("," + PixelPt.Left + "," + PixelPt.Top); } else { Str.append(PixelPt.Left + "," + PixelPt.Top); } } //Create VML VML = document.createElement("vml:polyline"); VML.setAttribute("id", ID + "" + i); //ID + geometry parts count VML.setAttribute("groupid", ID); //ID only //Set colors attributes VML.setAttribute("linecolor1", LineColor); VML.setAttribute("linetransparency", LineTransparency); VML.setAttribute("mouseovercolor", MouseOverColor); VML.style.position = "absolute"; VML.style.width = Width + "px"; VML.style.height = Height + "px"; VML.style.left = VMLPos.Left + "px"; VML.style.top = VMLPos.Top + "px"; VML.points = Str.toString(); VML.strokecolor = LineColor; VML.strokeweight = LineWidth + "px"; VML.filled = "false"; //Stroke transparency Stroke = document.createElement("vml:stroke"); Stroke.setAttribute("id",ID + "" + i + "stroke"); Stroke.opacity = LineTransparency; VML.appendChild(Stroke); //Same mouse events as tile image: VML = this.TileEvents(VML); Group.appendChild(VML); } //Check if line exists on layer if ($(ID)) { L.removeChild($(ID)); } L.appendChild(Group); //Use Canvas } else { //alert("test"); CanvasPos = RP.ConvertToPixels(XYBounds.MinX, XYBounds.MaxY, FPP); CanvasObj = document.createElement("CANVAS"); CanvasObj.setAttribute("id",ID); CanvasObj.setAttribute("width",Width+1); CanvasObj.setAttribute("height",Height+1); CanvasObj.style.position = "absolute"; CanvasObj.style.left = CanvasPos.Left + "px"; CanvasObj.style.top = CanvasPos.Top + "px"; //Same mouse events as tile image: CanvasObj = this.TileEvents(CanvasObj); var C; //Loop through each polygon part for (var i=0; i0) { Str.append("," + PixelPt.Left + "," + PixelPt.Top); } else { Str.append(PixelPt.Left + "," + PixelPt.Top); } } //Create VML VML = document.createElement("vml:polyline"); VML.setAttribute("id", ID + "" + i); VML.setAttribute("groupid", ID); //Set colors attributes VML.setAttribute("fillcolor1", FillColor); VML.setAttribute("filltransparency", FillTransparency); VML.setAttribute("mouseovercolor", MouseOverColor); VML.style.position = "absolute"; VML.style.width = Width + "px"; VML.style.height = Height + "px"; VML.style.left = VMLPos.Left + "px"; VML.style.top = VMLPos.Top + "px"; VML.points = Str.toString(); VML.strokecolor = FillColor; //Thin line for higher zoom levels if (this.CurrentZoom <= 8) { VML.strokeweight = "1px"; } else { VML.strokeweight = "2px"; } //Highlight VML.onmouseover = function() { var GroupID = this.getAttribute("groupid"); var d = 0; var part; while ($(GroupID + "" + d)) { //alert(this.getAttribute("mouseovercolor")); part = $(GroupID + "" + d); part.strokecolor = this.getAttribute("mouseovercolor"); $(GroupID + "" + d + "fill").color = this.getAttribute("mouseovercolor"); $(GroupID).style.zIndex = 1000; d++; } } //Reset highlight VML.onmouseout = function() { var GroupID = this.getAttribute("groupid"); var d = 0; var part; while ($(GroupID + "" + d)) { //alert(this.getAttribute("fillcolor1")); part = $(GroupID + "" + d); part.strokecolor = this.getAttribute("fillcolor1"); $(GroupID + "" + d + "fill").color = this.getAttribute("fillcolor1"); $(GroupID).style.zIndex = 0; d++; } } //Same mouse events as tile image: VML = this.TileEvents(VML); //Fill color //if (FillTransparency != "0%") { Fill = document.createElement("vml:fill"); Fill.setAttribute("id",ID + "" + i + "fill"); Fill.color = FillColor; Fill.opacity = FillTransparency; VML.appendChild(Fill); //} //Done Group.appendChild(VML); } //Check if polygon exists on layer if ($(ID)) { L.removeChild($(ID)); } L.appendChild(Group); //Use Canvas (Firefox) } else { //alert(FillColor + ":" + FillTransparency); CanvasPos = RP.ConvertToPixels(XYBounds.MinX, XYBounds.MaxY, FPP); CanvasObj = document.createElement("CANVAS"); CanvasObj.setAttribute("id",ID); CanvasObj.setAttribute("width",Width+1); CanvasObj.setAttribute("height",Height+1); CanvasObj.style.position = "absolute"; CanvasObj.style.left = CanvasPos.Left + "px"; CanvasObj.style.top = CanvasPos.Top + "px"; //Same mouse events as tile image: CanvasObj = this.TileEvents(CanvasObj); var C; var FillHexColor = HexToDec(FillColor); var FillTransFloat = parseFloat(FillTransparency) / 100; var StyleStr = "rgba(" + FillHexColor.R + ","; StyleStr += FillHexColor.G + ","; StyleStr += FillHexColor.B + "," + FillTransFloat + ")"; //Loop through each polygon part for (var i=0; i"); var PointCollections = new Array(); var Points = new Array(); var PointStrings = new Array(); var PolyStr = ""; var i = 0; var f = 0; //Loop through each polygon part for (i=1; i",""); //Fill array of points PointStrings = PolyStr.split(","); for (f=0; f"); var PointCollections = new Array(); var Points = new Array(); var PointStrings = new Array(); var LineStr = ""; var i = 0; var f = 0; //Loop through each polygon part for (i=1; i",""); //Fill array of points PointStrings = LineStr.split(","); for (f=0; fpixel space conversions) function ReferencePoint(Left, Top, X, Y) { this.Left = Left; this.Top = Top; this.X = X; this.Y = Y; //Convert a feet coordinate into drag container pixel position this.ConvertToPixels = function(X, Y, FPP) { var L = this.Left - parseInt(((this.X - X) / FPP)); var T = this.Top + parseInt(((this.Y - Y) / FPP)); return new PixelPosition(L,T); } } //Min bounding rectangle function MBR(MinX, MaxX, MinY, MaxY) { this.MinX = MinX; this.MaxX = MaxX; this.MinY = MinY; this.MaxY = MaxY; } var SearchTimer; var SearchDefault = "Click here and enter at least 3 characters."; var NoResults = "No results found" Map.prototype.ClearSearchField = function(FieldObj) { var Str = FieldObj.value; if (Str == SearchDefault || Str == "optional") { FieldObj.value = ""; } } Map.prototype.ClearSearch = function(ResetDropDown, AdvancedForm) { var Prefix = "search"; $(Prefix + "grid").innerHTML = ""; $(Prefix + "grid").style.display = "none"; $(Prefix + "field").value = SearchDefault; $(Prefix + "count").innerHTML = CountLabel(0, 0); $(Prefix + "count2").innerHTML = "0"; //Maximize floating window Obj.MinMaxWindow(Prefix, "open"); //Reset advanced form required if (AdvancedForm) { this.ResetAdvanced("search"); } //Reset dropdown to street search (clear search button on header bar) if (ResetDropDown) { $(Prefix + "type").value = "street"; } //Flush the polygon layer this.ResetParcelCollection("search"); } //Search dropdown onchange handler Map.prototype.SearchOnChange = function() { this.ClearSearch(); var SType = $("searchtype").value; //Set the unit input field if (SType == "street") { $("unitform").style.display = ""; } else { $("unitform").style.display = "none"; } //Assessee button if (SType == "assessee") { $("searchfield").value = ""; $("assesseebutton").style.display = ""; //alert($("assesseebutton").style.display); } else { $("assesseebutton").style.display = "none"; } } //Start autocomplete timer Map.prototype.AutoCompleteSearch = function() { if ($("searchtype").value != "assessee") { clearTimeout(SearchTimer); setTimeout("Obj.ExecuteSearch()", 80); } } //Execute address / street / apn / assesee etc search Map.prototype.ExecuteSearch = function() { var StartTime = new Date().getTime(); var Seconds = 0.0; var SearchType = $("searchtype").value; var Str = ""; var Params = "t=" + Math.random() + "&searchtype=" + SearchType; var A; var HTM = ""; var Count = 0; //Handle parcel data output (address, apn, and assessee) var ParcelResponse = function(XMLObj) { Seconds = Obj.GetBenchMark(StartTime); HTM = Obj.ParcelHeader(6) + XMLObj.responseText + ""; Obj.BindSearchGrid(HTM, Seconds); } //Handle street name search output var StreetResponse = function(XMLObj) { //$("searchgrid").innerHTML = XMLObj.responseText; //$("searchgrid").style.display = ""; //ClearLoadingStatus(); Seconds = Obj.GetBenchMark(StartTime); HTM = Obj.StreetHeader() + XMLObj.responseText + ""; Obj.BindSearchGrid(HTM, Seconds); } //Handle place name search output var PlaceResponse = function(XMLObj) { Seconds = Obj.GetBenchMark(StartTime); HTM = Obj.PlaceHeader() + XMLObj.responseText + ""; Obj.BindSearchGrid(HTM, Seconds); } //Handle Thomas map book grid var ThomasGridResponse = function(XMLObj) { Seconds = Obj.GetBenchMark(StartTime); HTM = Obj.GridSearchHeader() + XMLObj.responseText + ""; Obj.BindSearchGrid(HTM, Seconds); } Str = CleanString($("searchfield").value); if (Str.length >= 3) { Params += "&execute=" + SearchType + "&search=" + Str; //Assessee search takes longer if (SearchType == "assessee") { SetLoadingStatus("Searching Parcels..."); } else { //SetLoadingStatus(); } //Execute search A = new AjaxConn(); if (SearchType == "streetname") { A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,StreetResponse); } else if (SearchType == "place") { A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,PlaceResponse); } else if (SearchType == "thomasgrid") { A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,ThomasGridResponse); } else { A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,ParcelResponse); } } else { $("searchgrid").style.display = "none"; $("searchcount").innerHTML = CountLabel(0, 0); } } Map.prototype.BindSearchGrid = function(HTM, Seconds, Prefix, GridName) { var Count = CountRows(HTM,1); //Search prefix if (Prefix && GridName) { //Maximize floating window this.MinMaxWindow(Prefix, "open"); //Count label if ($(Prefix + "count")) { $(Prefix + "count").innerHTML = CountLabel(Count, Seconds); $(Prefix + "count2").innerHTML = Count; } //Fill datagrid if ($(GridName)) { $(GridName).innerHTML = HTM; $(GridName).style.display = ""; } //Default to autocomplete search / advanced search grid } else { //Maximize floating window this.MinMaxWindow("search", "open"); $("searchcount").innerHTML = CountLabel(Count, Seconds); $("searchcount2").innerHTML = Count; $("searchgrid").innerHTML = HTM; $("searchgrid").style.display = ""; } } Map.prototype.GetBenchMark = function(StartTime) { ClearLoadingStatus(); var EndTime = new Date().getTime(); var Seconds = ((EndTime-StartTime)/1000.0); return Seconds; } //Zoom into a search parcel (reset required) Map.prototype.ZoomSearch = function(ID) { SetLoadingStatus("Zooming to Parcel...","map_icon"); this.ResetParcelCollection("search"); this.QueryParcelID(ID, this.SearchCollection,true); } Map.prototype.ToggleAdvancedSearch = function() { var A = $("advancedsearch"); var S = $("regularsearch"); var OS = $("opensearch"); var CS = $("closesearch"); //Hide advanced search form if (A.style.display == "") { A.style.display = "none"; S.style.display = ""; OS.style.display = ""; CS.style.display = "none"; //Show advanced search form } else { A.style.display = ""; S.style.display = "none"; OS.style.display = "none"; CS.style.display = ""; //Clear subdivisions selector $("search_subdivisionsdiv").innerHTML = ""; //Load city / subdivision selector this.LoadCities("search_cityselect","search_citylistdiv"); } } //Params: //City dropdown id //City dropdown div container id Map.prototype.LoadCities = function(DropDownID, DropDownDivID) { var Params = "t=" + Math.random(); Params += "&execute=subdivisions"; Params += "&dropdown=cities"; Params += "&dropdownid=" + DropDownID; SetLoadingStatus(); var CResponse = function(XMLObj) { ClearLoadingStatus(); $(DropDownDivID).innerHTML = XMLObj.responseText; } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,CResponse); } //Load subdivisions dropdown Map.prototype.LoadSubdivisions = function(Prefix) { var ContainerID = ""; var DropDownID = ""; var City = ""; //Advanced Search form if (Prefix == "search") { City = $("search_cityselect").value; DropDownID = "search_subdivselect"; ContainerID = "search_subdivisionsdiv"; //Buffer form } else { City = $("buffer_cityselect").value; DropDownID = "buffer_subdivselect"; ContainerID = "buffer_subdivisionsdiv"; } if (City != "") { var Params = "t=" + Math.random(); Params += "&execute=subdivisions"; Params += "&dropdown=subdivisions"; Params += "&dropdownid=" + DropDownID; Params += "&city=" + City; SetLoadingStatus("Loading Subdivisions..."); var SResponse = function(XMLObj) { $(ContainerID).innerHTML = XMLObj.responseText; setTimeout("ClearLoadingStatus()",400); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,SResponse); } else { $(ContainerID).innerHTML = ""; } } //Load layer values dropdown Map.prototype.LoadLayerValues = function(Prefix) { var ContainerID = ""; var DropDownID = ""; var LayerName = ""; //Advanced Search form if (Prefix == "search") { LayerName = $("search_shapefiles").value; DropDownID = "search_layervalues"; ContainerID = "search_layervaluesdiv"; } alert(DropDownID); if (LayerName != "") { var Params = "t=" + Math.random(); Params += "&execute=layers"; Params += "&dropdownid=" + DropDownID; Params += "&layer=" + LayerName; SetLoadingStatus(); var LYRResponse = function(XMLObj) { $(ContainerID).innerHTML = XMLObj.responseText; setTimeout("ClearLoadingStatus()",400); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,LYRResponse); } else { $(ContainerID).innerHTML = ""; } } //Validate advanced search form Map.prototype.AdvancedSearch = function(Prefix, PageOffset, CustomGridName) { var StartTime = new Date().getTime(); var LayerName = ""; var LayerVal = ""; var ErrStr = new StringBuilder(); var i = 0; var Total = 0; var Seconds = 0; var XML = ""; var HTM = ""; var FieldPost = ""; var ASResponse = function(XMLObj) { XML = XMLObj.responseText; HTM = ParseTag("grid", XML); Total = parseInt(ParseTag("total", XML)); //Results found if (Total > 0) { if (CustomGridName) { $(CustomGridName).innerHTML = Obj.ParcelHeader(6) + HTM + ""; $(CustomGridName).style.display = ""; } else { $(Prefix + "grid").innerHTML = Obj.ParcelHeader(6) + HTM + ""; $(Prefix + "grid").style.display = ""; } Seconds = Obj.GetBenchMark(StartTime); $(Prefix + "count").innerHTML = CountLabel(Total, Seconds); $(Prefix + "count2").innerHTML = Total; //No results } else { $(Prefix + "count").innerHTML = NoResults; $(Prefix + "count2").innerHTML = "0"; if (CustomGridName) { $(CustomGridName).style.display = "none"; } else { $(Prefix + "grid").style.display = "none"; } } ClearLoadingStatus(); } var Params = new StringBuilder("t=" + Math.random()); Params.append("&execute=advanced" + Prefix); FieldPost = this.CheckAdvancedForm(Prefix); //Page Offset if (PageOffset) { Params.append("&pageoffset=" + PageOffset); } else { Params.append("&pageoffset=0"); } //1 or more form errors found if (FieldPost.indexOf("")>-1) { ClearLoadingStatus(); //No errors } else { Params.append(FieldPost); //alert(Params.toString()); if (PageOffset) { SetLoadingStatus("Opening Page " + (PageOffset+1) + "...","folder1"); } else { SetLoadingStatus("Finding Parcels..."); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params.toString(),ASResponse); } } //Returns XML if there is an error, otherwise returns post string part Map.prototype.CheckAdvancedForm = function(Prefix) { var Params = new StringBuilder(); var ErrStr = new StringBuilder(); var LayerName = ""; var LayerVal = ""; //List of fields needing numeric range checking var NumericRangeFields = new Array(); NumericRangeFields[0] = new RangeField("lotmin","Minimum Lot Size",0,900000000); NumericRangeFields[1] = new RangeField("lotmax","Maximum Lot Size",0,900000000); NumericRangeFields[2] = new RangeField("buildingmin","Minimum Residential Area",0,900000000); NumericRangeFields[3] = new RangeField("buildingmax","Maximum Residential Area",0,900000000); NumericRangeFields[4] = new RangeField("bedsmin","Minimum # of Bedrooms",0,50); NumericRangeFields[5] = new RangeField("bedsmax","Maximum # of Bedrooms",0,50); NumericRangeFields[6] = new RangeField("bathsmin","Minimum # of Bathrooms",0,50); NumericRangeFields[7] = new RangeField("bathsmax","Maximum # of Bathrooms",0,50); NumericRangeFields[8] = new RangeField("builtmin","Minimum Year Built",0,2050); NumericRangeFields[9] = new RangeField("builtmax","Maximum Year Built",0,2050); //Use codes multi selection var Use = $(Prefix + "_usecodes"); var Count = 0; var UseCodeTotal = 26; var UseStr = ""; for (var i=0; i 0) { alert(ErrStr.toString()); return "" + ErrStr.toString() + ""; //Advanced search form is turned off } else if ($("advanced" + Prefix.toLowerCase()).style.display == "none") { return ""; //Process advanced search / buffer filter } else { return Params.toString(); } } //Validate single numeric field Map.prototype.ValidateNumericField = function(ElementName, FieldAlias) { var ErrStr = ""; var EL = $(ElementName); var Val = EL.value; //Non numeric value found if (IsNumeric(Val)==false || isNaN(Val)) { ErrStr += "Non-numeric value found in " + FieldAlias + "\n"; } //Blank values are ok if (Val == "") { ErrStr = ""; } return ErrStr; } //Validate minmax search fields Map.prototype.ValidateNumericRange = function(ElementName, FieldAlias, Min, Max) { var ErrStr = ""; var EL = $(ElementName); var Val = EL.value; //Non numeric value found if (IsNumeric(Val)==false || isNaN(Val)) { ErrStr += "Non-numeric value found in " + FieldAlias + "\n"; //Below min value found } else if (ValMax) { ErrStr += "Value of more than " + Max + " found in " + FieldAlias + "\n"; } //Blank values are ok if (Val == "") { ErrStr = ""; } return ErrStr; } //Rest advanced search FORM ONLY Map.prototype.ResetAdvanced = function(Prefix, CustomGridName, DoFlushGrid) { //Check if compiler generated form if ($(Prefix + "_usecodes")) { //Usecodes dropdown SelectAll(Prefix + "_usecodes"); //Form fields $(Prefix + "_zip1").value = ""; $(Prefix + "_zip2").value = ""; $(Prefix + "_zip3").value = ""; $(Prefix + "_street1").value = ""; $(Prefix + "_street2").value = ""; $(Prefix + "_assessee1").value = ""; $(Prefix + "_assessee2").value = ""; $(Prefix + "_lotmin").value = "0"; $(Prefix + "_lotmax").value = "900000000"; $(Prefix + "_buildingmin").value = "0"; $(Prefix + "_buildingmax").value = "900000000"; $(Prefix + "_bedsmin").value = "0"; $(Prefix + "_bedsmax").value = "50"; $(Prefix + "_bathsmin").value = "0"; $(Prefix + "_bathsmax").value = "50"; $(Prefix + "_builtmin").value = "0"; $(Prefix + "_builtmax").value = "2050"; //Grid and results count $(Prefix + "count").innerHTML = NoResults; $(Prefix + "count2").innerHTML = "0"; //Non standard datagrid name passed in if (CustomGridName) { if (DoFlushGrid && DoFlushGrid == true) { $(CustomGridName).innerHTML = ""; $(CustomGridName).style.display = "none"; } else if (DoFlushGrid == null) { $(CustomGridName).innerHTML = ""; $(CustomGridName).style.display = "none"; } //Standard results datagrid } else { $(Prefix + "grid").innerHTML = ""; $(Prefix + "grid").style.display = "none"; } //Layer filter dropdowns (buffer search does not have it) if ($(Prefix + "_shapefiles")) { $(Prefix + "_shapefiles").value = ""; $(Prefix + "_layervaluesdiv").innerHTML = ""; } //City / subdivision dropdowns $(Prefix + "_subdivisionsdiv").innerHTML = ""; this.LoadCities(Prefix + "_cityselect",Prefix + "_citylistdiv"); } } //Numeric range field object function RangeField(Name, Alias, Min, Max) { this.Name = Name; this.Alias = Alias; this.Min = Min; this.Max = Max; } //Global var to indicate buffer paging (eliminate unecessary redraws) var RedrawBuffer = false; //Run parcel buffer operation Map.prototype.RunBuffer = function(PageOffset, PagingQuery) { var StartTime = new Date().getTime(); var Seconds = 0.0; var Total = 0; var Acres = 0; var MinX = 0; var MaxX = 0; var MinY = 0; var MaxY = 0; var Params = "t=" + Math.random(); var A; var XML = ""; var FieldPost = ""; if (PagingQuery) { if (PagingQuery == true) { RedrawBuffer = false; } else { RedrawBuffer = true; } } else { RedrawBuffer = true; } var BufferResponse = function(XMLObj) { XML = XMLObj.responseText; //ClearLoadingStatus(); //alert(XML); //$("debug2").innerHTML = XML; if (XML.indexOf("Server Error") > -1) { $("buffergrid2").innerHTML = XML; $("buffergrid2").style.display = ""; } else { //debug //$("buffergrid2").innerHTML = ParseTag("query",XML); //$("buffergrid2").style.display = ""; //ClearLoadingStatus(); //Fetch grid, total, and MBR bounds Seconds = Obj.GetBenchMark(StartTime); Total = parseInt(ParseTag("total",XML)); Acres = parseFloat(ParseTag("acrestotal",XML)).toFixed(3); MinX = parseFloat(ParseTag("minxtotal",XML)); MaxX = parseFloat(ParseTag("maxxtotal",XML)); MinY = parseFloat(ParseTag("minytotal",XML)); MaxY = parseFloat(ParseTag("maxytotal",XML)); $("buffercount").innerHTML = CountLabel(Total, Seconds, Acres); $("buffercount2").innerHTML = Total; if (Total > 0) { $("buffergrid2").innerHTML = Obj.ParcelHeader(6) + ParseTag("grid",XML); //Debug //$("buffergrid2").innerHTML = ParseTag("query",XML) + $("buffergrid2").innerHTML; $("buffergrid2").style.display = ""; $("bufferexportrow").style.display = ""; //Ignore draw if this is a grid paging query if (RedrawBuffer == true) { SetLoadingStatus("Drawing Parcels..."); Obj.ResetParcelCollection("buffer"); Obj.HighlightParcelList(ParseTag("parcels",XML), Obj.BufferCollection); //Zoom to buffer if ($("buffertype").innerHTML != "Point") { Obj.ZoomToMBR(MinX, MaxX, MinY, MaxY); } Obj.ResetParcelCollection("search"); setTimeout("Obj.QueryParcelID(Obj.BufferParcelID, Obj.SearchCollection)",150); } //Perform street line highlight for street buffer if (Obj.BufferType == "teleatlas_streetname" && (PagingQuery == false || PagingQuery == null)) { Obj.QueryStreet(Obj.BufferStreetName, Obj.BufferCity); } } else { alert("No results found."); $("buffergrid2").innerHTML = ""; $("buffergrid2").style.display = "none"; $("bufferexportrow").style.display = "none"; Obj.ResetParcelCollection("buffer"); ClearLoadingStatus(); } } } //Single parcel buffer if (this.BufferType == "street") { //Check buffer feet input if (IsNumeric($$("bufferfeet")) == false) { alert("Non-numeric value entered for buffer radius."); } else if ($$("bufferfeet") > 2640) { alert("Buffer radius limit is 1/2 mile (2640 feet)."); } else if ($$("bufferfeet") < 0) { alert("Buffer radius limit cannot be a negative number."); //Buffer feet input passed } else { Params += "&execute=parcelbuffer"; Params += "&feet=" + $$("bufferfeet"); Params += "&parcelid=" + this.BufferParcelID; Params += "&pageoffset=" + PageOffset; Params += "&drawlimit=" + $$("bufferlimit"); //Add advanced buffer filter parameters FieldPost = this.CheckAdvancedForm("buffer"); //1 or more form errors found if (FieldPost.indexOf("")>-1) { ClearLoadingStatus(); } else { Params += FieldPost; if (PageOffset) { SetLoadingStatus("Opening Page " + (PageOffset+1) + "...","folder1"); } else { SetLoadingStatus("Generating " + $$("bufferfeet") + "ft Parcel Buffer..."); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,BufferResponse); } } //Street line buffer } else if (this.BufferType == "teleatlas_streetname" || this.BufferType == "scips_streetname") { if (this.BufferType == "teleatlas_streetname") { Params += "&execute=teleatlas_streetbuffer"; } else { Params += "&execute=scips_streetbuffer"; if (PagingQuery == false) { alert("No TeleAtlas street line was found. An approximate street buffer will be derived from SCIPS data."); } } Params += "&streetname=" + this.BufferStreetName; Params += "&siteroad=" + this.BufferSiteRoad; Params += "&cityname=" + this.BufferCity; Params += "&pageoffset=" + PageOffset; Params += "&drawlimit=" + $$("bufferlimit"); //Add advanced buffer filter parameters FieldPost = this.CheckAdvancedForm("buffer"); //1 or more form errors found if (FieldPost.indexOf("")>-1) { ClearLoadingStatus(); } else { Params += FieldPost; if (PageOffset) { SetLoadingStatus("Opening Page " + (PageOffset+1) + "...","folder1"); } else { SetLoadingStatus("Generating Parcel Buffer..."); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,BufferResponse); } //Point buffer } else if (this.BufferType == "point") { //Check buffer feet input if (IsNumeric($$("bufferfeet")) == false) { alert("Non-numeric value entered for buffer radius."); } else if ($$("bufferfeet") > 2640) { alert("Buffer radius limit is 1/2 mile (2640 feet)."); } else if ($$("bufferfeet") < 0) { alert("Buffer radius limit cannot be a negative number."); //Buffer feet validation passed } else { Params += "&execute=pointbuffer"; Params += "&x=" + this.BufferX; Params += "&y=" + this.BufferY; Params += "&pageoffset=" + PageOffset; Params += "&feet=" + $$("bufferfeet"); Params += "&drawlimit=" + $$("bufferlimit"); //Add advanced buffer filter parameters FieldPost = this.CheckAdvancedForm("buffer"); //1 or more form errors found if (FieldPost.indexOf("")>-1) { ClearLoadingStatus(); } else { Params += FieldPost; if (PageOffset) { SetLoadingStatus("Opening Page " + (PageOffset+1) + "...","folder1"); } else { SetLoadingStatus("Generating Parcel Buffer..."); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,BufferResponse); } } } } //Reset buffer form only Map.prototype.ResetBufferForm = function() { this.ResetAdvanced("buffer","buffergrid2", false); $("bufferfeet").value = "300"; SelectValue("bufferlimit","100"); //Force the datagrid to visible //$("buffergrid2").style.display = ""; } //Reset buffer operation Map.prototype.ResetBuffer = function() { //Reset form fields this.ResetBufferForm(); //Show default buffer selector $("blankbuffer").style.display = ""; //Hide regular and advanced forms $("bufferform").style.display = "none"; $("advancedbuffer").style.display = "none"; //Reset advanced form button toggle $("openadvancedbuffer").style.display = ""; $("closeadvancedbuffer").style.display = "none"; //Reset polygon draws this.ResetParcelCollection("buffer"); this.ResetParcelCollection("search"); //Reset grid $("buffergrid2").innerHTML = ""; $("buffergrid2").style.display = "none"; $("buffercount").innerHTML = NoResults; $("buffercount2").innerHTML = "0"; if ($("bufferexportrow")) { $("bufferexportrow").style.display = "none"; } //Maximize the buffer containers this.MinMaxWindow("buffer", "open"); } //Reset buffer options form Map.prototype.BufferOption = function(BufferTypeStr) { var BTop = parseInt($("buffer").style.top) - 57; var BLeft = parseInt($("buffer").style.left) + 1; //Maximize the buffer containers this.MinMaxWindow("buffer", "open"); if (BufferTypeStr == "street" || BufferTypeStr == "streetname") { //Buffer type flag, for RunBuffer() this.BufferType = BufferTypeStr; //Position search window in front of buffer window if ($("search").style.display == "none") { this.ToggleMenu("search"); } else { this.SortMenus("search"); } $("search").style.top = BTop + "px"; $("search").style.left = BLeft + "px"; //Reset the search window, position it close to the buffer window $("searchfield").value = SearchDefault; $("searchunit").value = ""; $("searchcount").innerHTML = NoResults; $("searchgrid").innerHTML = ""; $("searchgrid").style.display = "none"; $("regularsearch").style.display = ""; $("advancedsearch").style.display = "none"; //Clear search parcel collection this.ResetParcelCollection("search"); //Change search type dropdown selection if (BufferTypeStr == "street") { $("searchtype").value = "street"; } else { $("searchtype").value = "streetname"; } //Toggle optional search field(s), such as unit # this.SearchOnChange(); } } //Instantiate buffer form Map.prototype.NewBuffer = function(BufferType, BufferVal_1, BufferVal_2, BufferVal_3) { var URL = ""; var PT; //Maximize the buffer containers this.MinMaxWindow("buffer", "open"); //Buffer type flag, for RunBuffer() this.BufferType = BufferType; if ($("buffer").style.display == "none") { this.ToggleMenu("buffer"); } else { this.SortMenus("buffer"); } //Close loading blocker ClearLoadingStatus(); //Clear polygons this.ResetParcelCollection("buffer"); $("blankbuffer").style.display = "none"; $("bufferform").style.display = ""; $("buffergrid2").innerHTML = ""; $("buffergrid2").style.display = "none"; $("bufferexportrow").style.display = "none"; $("buffercount").innerHTML = NoResults; //Address buffer //Bufferval_1 = ParcelID if (BufferType == "street") { $("buffertype").innerHTML = "Address"; $("bufferdistancefields").style.display = ""; //Set location label this.BufferParcelID = BufferVal_1; this.BufferStreetName = ""; this.BufferSiteRoad = ""; this.BufferCity = ""; GetAddress(BufferVal_1,"bufferlocation"); //TeleAtlas Street line buffer //Bufferval_1 = TeleAtlas Street Name //Bufferval_2 = SCIPS Siteroad //Bufferval_3 = TeleAtlas City Name } else if (BufferType == "teleatlas_streetname" || BufferType == "scips_streetname") { this.BufferParcelID = ""; this.BufferCity = BufferVal_3; if (BufferVal_1.indexOf(">NONE<") == -1) { this.BufferStreetName = BufferVal_1; } else { BufferVal_1 = ""; this.BufferStreetName = ""; } if (BufferVal_2.indexOf(">NONE<") == -1) { this.BufferSiteRoad = BufferVal_2; } else { BufferVal_2 = ""; this.BufferSiteRoad = ""; } //alert(BufferVal_1 + ":" + BufferVal_2); //If there is no streetname? $("buffertype").innerHTML = "Street"; $("bufferdistancefields").style.display = "none"; //Build zoom URL URL = ""; URL += ""; if (BufferVal_1 == "" && BufferVal_2 != "") { URL += ProperCase(BufferVal_2); } else { URL += ProperCase(BufferVal_1); } URL += ", " + ProperCase(BufferVal_3); URL += ", CA"; $("bufferlocation").innerHTML = URL; //Run the buffer this.RunBuffer(0,false); //GPS point buffer (see pointsearch.js) } else if (BufferType == "point") { if ($("gpspin")) { PT = $("gpspin"); this.BufferX = parseFloat(PT.getAttribute("x")); this.BufferY = parseFloat(PT.getAttribute("y")); $("buffertype").innerHTML = "Point"; this.PointBufferLabel(this.BufferX, this.BufferY); } } } //Build buffer form point search label / link Map.prototype.PointBufferLabel = function(X, Y) { var URL = ""; URL += ""; URL += "X:" + parseInt(X) + " ft, "; URL += "Y:" + parseInt(Y) + " ft"; URL += ""; $("bufferlocation").innerHTML = URL; } //Show/hide advanced buffer form Map.prototype.ToggleAdvancedBuffer = function() { var A = $("advancedbuffer"); var OS = $("openadvancedbuffer"); var CS = $("closeadvancedbuffer"); //Hide advanced search form if (A.style.display == "") { A.style.display = "none"; OS.style.display = ""; CS.style.display = "none"; //Show advanced search form } else { A.style.display = ""; OS.style.display = "none"; CS.style.display = ""; //Clear subdivisions selector $("buffer_subdivisionsdiv").innerHTML = ""; //Load city / subdivision selector this.LoadCities("buffer_cityselect","buffer_citylistdiv"); } } var StreetViewTimer; //ClearStreet view icon and windowing Map.prototype.ClearStreetView = function() { clearTimeout(StreetViewTimer); $("streetview").style.display = "none"; if ($("streetpin")) { $("streetpin").style.display = "none"; } } //Open street view DIV container Map.prototype.OpenStreetContainer = function(URL) { var F = $("streetviewcontainer"); F.style.height = "494px"; F.style.width = "592px"; F.style.left = "20px"; F.style.top = "120px"; F.style.padding = "0px"; this.StreetViewURL = URL; $("streetviewcontainer").src = URL; $("streetview").style.display = "none"; this.ToggleMenu("streetview"); //Maximize window this.MinMaxWindow("streetview", "open"); //Set timed street view result retrieval this.MoveStreetPin(); } //Open street view window (on street line) Map.prototype.StreetLineView = function(StreetCity) { var Params = "t=" + Math.random() + "&execute=ip"; var IPResponse = function(XMLObj) { var XML = XMLObj.responseText; var IP = ParseTag("ip",XML); IP = IP.replace(/\./g,""); //Set global IP variable Obj.StreetSessionID = IP; var URL = Obj.StreetViewRoot; URL += "?streetcity=" + StreetCity; URL += "&ip=" + IP; URL += "&t=" + Math.random(); Obj.OpenStreetContainer(URL); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,IPResponse); } //Open street view window (in front of parcel) Map.prototype.OpenParcelStreetView = function(Lat, Long, ParcelLat, ParcelLong, StreetX, StreetY, Address, IP) { var URL = this.StreetViewRoot; URL += "?lat=" + Lat; URL += "&long=" + Long; URL += "&parcellat=" + ParcelLat; URL += "&parcellong=" + ParcelLong; URL += "&streetx=" + StreetX; URL += "&streety=" + StreetY; URL += "&address=" + Address; URL += "&ip=" + IP.replace(/\./g,""); URL += "&t=" + Math.random(); this.OpenStreetContainer(URL); } //Redraw street view pin Map.prototype.RefreshStreetPin = function() { //If the pin exists and the form is open if ($("streetpin") && $("streetview").style.display == "") { var S = $("streetpin"); var X = parseFloat(S.getAttribute("x")); var Y = parseFloat(S.getAttribute("y")); var ImgSrc = S.getAttribute("src"); this.DrawPoint("streetviewlayer",ImgSrc,"streetpin",X,Y,true); } } //Fetch pano location and yaw, then convert back to NAD83, and then plot Map.prototype.MoveStreetPin = function(DoTimeout) { clearTimeout(StreetViewTimer); StreetViewTimer = setTimeout("Obj.RetrieveStreetSession()",3000); } Map.prototype.RetrieveStreetSession = function() { var XML = ""; var Params = "t=" + Math.random(); Params += "&execute=streetviewsession"; Params += "&ip=" + this.StreetSessionID; var LL; var Lat; var Long; var Yaw; var Address; var X; var Y; var PinName = "0"; var ImgURL; //Retrieve street view session from public server var STResponse = function(XMLObj) { XML = XMLObj.responseText; //Nothing was found, or error found if (XML == "" || XML.indexOf("error") > -1) { //alert(XML); $("streetview").style.display = "none"; if ($("streetpin")) { $("streetpin").style.display = "none"; } } else { X = parseFloat(ParseTag("x",XML)); Y = parseFloat(ParseTag("y",XML)); Lat = parseFloat(ParseTag("lat",XML)); Long = parseFloat(ParseTag("long",XML)); Address = ParseTag("address",XML); Yaw = parseFloat(ParseTag("yaw",XML)); //Change this conversion to the new version TBA: LL = ConvertToNAD83(Lat, Long); //Determine rotation pin image src if (Yaw > 345 && Yaw <= 15) { PinName = "0"; } else if (Yaw > 15 && Yaw <= 45) { PinName = "30"; } else if (Yaw > 45 && Yaw <= 75) { PinName = "60"; } else if (Yaw > 75 && Yaw <= 105) { PinName = "90"; } else if (Yaw > 105 && Yaw <= 135) { PinName = "120"; } else if (Yaw > 135 && Yaw <= 165) { PinName = "150"; } else if (Yaw > 165 && Yaw <= 195) { PinName = "180"; } else if (Yaw > 195 && Yaw <= 225) { PinName = "210"; } else if (Yaw > 225 && Yaw <= 255) { PinName = "240"; } else if (Yaw > 255 && Yaw <= 285) { PinName = "270"; } else if (Yaw > 285 && Yaw <= 315) { PinName = "300"; } else if (Yaw > 315 && Yaw <= 345) { PinName = "330"; } ImgURL = Obj.AppRoot + "streetviewarrows/" + PinName + ".gif"; //Map extremities off on textbook UTM->NAD83 conversion, use triangulation for now Obj.DrawPoint("streetviewlayer",ImgURL,"streetpin",X,Y,true); //Implement this later /* //Bind dragging event $("streetpin").onmousedown = function(event) { clearTimeout(StreetViewTimer); Obj.StartDrag(event,"streetpin",80); } $("streetpin").onmouseup = function(event) { alert("stopped dragging"); } */ //alert(Obj.StreetViewMouseOver); if ($("streetview").style.display == "") { clearTimeout(StreetViewTimer); StreetViewTimer = setTimeout("Obj.RetrieveStreetSession()",1500); } } } var A = new AjaxConn(); if (A) { A.connect(this.AppRoot + "ajaxrequest.aspx", "POST", Params, STResponse); } } //Calculate UTM position of parcel center //DoZoom TBA Map.prototype.ParcelStreetView = function(ParcelID, DoZoom) { var ErrStr = ""; var XML = ""; var Params = "t=" + Math.random(); Params += "&execute=parcelutm"; Params += "&parcelid=" + ParcelID; var PResponse = function(XMLObj) { XML = XMLObj.responseText; //alert(XML); //$("debug").innerHTML = XML; if (XML.indexOf("") > -1) { ErrStr = ParseTag("error",XML); alert(ErrStr); } else if (XML.indexOf("Server Error") > -1) { $("debug").innerHTML = XML; } else { //Retrieve NAD83 coordinate of street line point var FX = parseFloat(ParseTag("feetx",XML)); var FY = parseFloat(ParseTag("feety",XML)); //Test accuracy of streetline finder (NIntersect) //var ImgURL = Obj.StreetIconRoot + "0.gif"; //Obj.DrawPoint("streetviewlayer",ImgURL,"streetpin",FX,FY,true); //Retrieve UTM coordinate of estimated street line point var StreetLat = parseFloat(ParseTag("lat",XML)); var StreetLong = parseFloat(ParseTag("long",XML)); //Retrieve XY coordinate of estimated street line point var StreetX = parseFloat(ParseTag("feetx",XML)); var StreetY = parseFloat(ParseTag("feety",XML)); //Retrieve UTM coordinate of parcel centroid (for pitch calculation @ gis.solanocounty.com) var ParcelLat = parseFloat(ParseTag("parcellat",XML)); var ParcelLong = parseFloat(ParseTag("parcellong",XML)); //Retrieve workstation IP address var IP = ParseTag("ip",XML); var Address = ParseTag("address",XML); //Set global var for street view result XML retrieval Obj.StreetSessionID = IP.replace(/\./g,""); //alert("test"); //Open street view Obj.OpenParcelStreetView(StreetLat, StreetLong, ParcelLat, ParcelLong, StreetX, StreetY, Address, IP); } ClearLoadingStatus(); } SetLoadingStatus(" Loading...","cameraicon.png"); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,PResponse); } //Test NAD83 -> UTM converter Map.prototype.TestUTM = function(X, Y) { var URL = ""; var XML = ""; var Params = "t=" + Math.random(); Params += "&execute=nad83_to_utm"; Params += "&x=" + X; Params += "&y=" + Y; var UResponse = function(XMLObj) { XML = XMLObj.responseText; URL = "http://maps.google.com/maps?q="; URL += ParseTag("y",XML) + "+" + ParseTag("x",XML); alert(XML); $("debug2").innerHTML = "" + URL + ""; } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,UResponse); } //There is an issue with the NAD83 conversion. Test function for 53 Marshall Way, Vallejo Map.prototype.TestError = function() { //38.1540983274242, Long -122.233243115072 var ImgURL = ""; var Params = "t=" + Math.random(); Params += "&execute=nad83test"; //End of Zinfandel Ln, Vallejo, CA Params += "&x=-122.202471"; Params += "&y=38.129086"; //38.129086 Longitude: -122.202471 //Parcel centroid //Params += "&x=-122.233243115072"; //Params += "&y=38.1540983274242"; var TestResponse = function(XMLObj) { XML = XMLObj.responseText; //alert(XML); FX = parseFloat(ParseTag("x",XML)); FY = parseFloat(ParseTag("y",XML)); //ImgURL = Obj.StreetIconRoot + "0.gif"; ImgURL = Obj.AppRoot + "streetviewarrows/0.gif"; Obj.DrawPoint("streetviewlayer",ImgURL,"streetpin",FX,FY,true); Obj.CurrentZoom = 10; Obj.CurrentCenter = new LatLong(FX, FY); Obj.setCenter(Obj.CurrentCenter, Obj.CurrentZoom); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,TestResponse); } //Test UTM -> NAD83 //38.2469037465411 -122.033342738721 Map.prototype.TestNAD83 = function(X, Y) { var URL = ""; var XML = ""; var FX = 0; var FY = 0; var Params = "t=" + Math.random(); Params += "&execute=nad83test"; Params += "&x=" + X; Params += "&y=" + Y; var UResponse = function(XMLObj) { XML = XMLObj.responseText; alert(XML); $("debug2").innerHTML = ParseTag("x",XML) + ":" + ParseTag("y",XML); FX = parseFloat(ParseTag("x",XML)); FY = parseFloat(ParseTag("y",XML)); Obj.CurrentZoom = 10; Obj.CurrentCenter = new LatLong(FX, FY); Obj.setCenter(Obj.CurrentCenter, Obj.CurrentZoom); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,UResponse); } //Generate Map Images //Right click save Map.prototype.QuickImage = function() { $("mousemenu").style.display = "none"; var Params = this.PrintPost("quickimage", parseInt(this.M.style.width), parseInt(this.M.style.height), this.ThemeID); var TResponse = function(XMLObj) { var XML = XMLObj.responseText; //alert(XML); //$("debug2").innerHTML = XML; Popup(XML + "?t=" + Math.random(),"quickimage",900,650); setTimeout("ClearLoadingStatus()",300); } SetLoadingStatus("Generating Image File...","image_icon"); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,TResponse); } //Print map: generate image file Map.prototype.PrintImage = function(PDFPrint) { var Width = 0; var Height = 0; var WH = new Array(); var PSize = ""; //PDF file reqeusted if (PDFPrint) { PSize = $("pagesize").value; } else { PSize = $("printsize").value; } //Current browser map window size if (PSize == "browser") { Width = parseInt(this.M.style.width); Height = parseInt(this.M.style.height); //Resolution of user's monitor } else if (PSize == "screen") { Width = parseInt(screen.width); Height = parseInt(screen.height); //Custom WxH selection } else { WH = PSize.split("x"); Width = parseInt(WH[0]); Height = parseInt(WH[1]); } //For print menu, title is required var Params = this.PrintPost("quickimage", Width, Height, this.ThemeID); Params += "&title=" + $("printtitle").value; //PDF file requested if (PDFPrint) { Params += "&pdf=true"; } var ImageResponse = function(XMLObj) { var XML = XMLObj.responseText; //$("debug2").innerHTML = XML; Popup(XML + "?t=" + Math.random(),"printimage",900,650); setTimeout("ClearLoadingStatus()",300); } //PDF file requested if (PDFPrint) { SetLoadingStatus(" Generating PDF File...","pdf2"); } else { SetLoadingStatus("Generating Image File...","image_icon"); } var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,ImageResponse); } //Generate POST string of the current map view, which includes //XY Bounds //Current theme, theme directory //Delim list of buffer parcels //Delim list of identify parcels //Delim list of search parcels //Street line highlight (buffer only for now) //Point search point //This is also used in savemap.js Map.prototype.PrintPost = function(Execute, PxWidth, PxHeight, ThemeID) { var CInfo = this.GetContainerInfo(); //Fetch dimensional data if map div var Zoom; //Adjust zoom level if user requested a size that is >= 2X current zoom //4X Zoom compensation if ((PxWidth >= parseInt(CInfo.ContainerWidth * 4) && PxHeight >= parseInt(CInfo.ContainerHeight * 4)) && this.CurrentZoom < (this.MaxZoom-1)) { Zoom = this.ZoomLevels[this.CurrentZoom + 2]; //2X Zoom compensation } else if ((PxWidth >= parseInt(CInfo.ContainerWidth * 2) && PxHeight >= parseInt(CInfo.ContainerHeight * 2)) && this.CurrentZoom < this.MaxZoom) { Zoom = this.ZoomLevels[this.CurrentZoom + 1]; //User browser size is >=2X larger than requested print size //Turned off for full extents (0-6 zoom levels) } else if ((PxWidth <= parseInt(CInfo.ContainerWidth / 1.5) && PxHeight <= parseInt(CInfo.ContainerHeight / 1.5)) && this.CurrentZoom >= 6) { Zoom = this.ZoomLevels[this.CurrentZoom - 1]; //Generate print file based on current tile zoom } else { Zoom = this.ZoomLevels[this.CurrentZoom]; } var FPT = Zoom.FPT; var Params = new StringBuilder(); Params.append("t=" + Math.random()); //Params.append("&execute=print"); Params.append("&execute=" + Execute); //Tile cache locations Params.append("&tileroot=" + this.Themes[ThemeID].TileRoot); Params.append("&themename=" + this.Themes[ThemeID].TileDirectory); Params.append("&themeid=" + ThemeID); //XY Bounds, this is calculated from center point and posted width and height now. //Params.append("&minx=" + CInfo.DivMinX); //Params.append("&maxx=" + CInfo.DivMaxX); //Params.append("&miny=" + CInfo.DivMinY); //Params.append("&maxy=" + CInfo.DivMaxY); //Center Point Params.append("¢erx=" + CInfo.CenterX); Params.append("¢ery=" + CInfo.CenterY); //More spatial params Params.append("&zoomoffset=" + this.CurrentZoom); Params.append("&fpt=" + Zoom.FPT); Params.append("&fpp=" + Zoom.FPP); Params.append("&width=" + PxWidth); Params.append("&height=" + PxHeight); //Identify parcel highlights Params.append("&identifyparcels=" + this.IdentifyCollection.DelimParcelList()); Params.append("&identifyfillcolor=" + this.IdentifyCollection.FillColor); Params.append("&identifytransparency=" + this.IdentifyCollection.FillTransparency); //Buffer parcel highlights Params.append("&bufferparcels=" + this.BufferCollection.DelimParcelList()); Params.append("&bufferfillcolor=" + this.BufferCollection.FillColor); Params.append("&buffertransparency=" + this.BufferCollection.FillTransparency); //Search parcel highlights Params.append("&searchparcels=" + this.SearchCollection.DelimParcelList()); Params.append("&searchfillcolor=" + this.SearchCollection.FillColor); Params.append("&searchtransparency=" + this.SearchCollection.FillTransparency); //Streetline selection (single street buffer only for now) Params.append("&streetlines=" + this.BufferStreetCollection.DelimStreets()); Params.append("&streetcolor=" + this.BufferStreetCollection.LineColor); Params.append("&streetwidth=" + this.BufferStreetCollection.LineWidth); Params.append("&streetopacity=" + this.BufferStreetCollection.LineOpacity); //GPS point if ($("gpspin")) { Params.append("&pointsearchx=" + $("gpspin").getAttribute("x")); Params.append("&pointsearchy=" + $("gpspin").getAttribute("y")); } //Grid search MBR if ($("mapgridtable")) { Params.append("&mapgridminx=" + $("mapgridtable").getAttribute("minx")); Params.append("&mapgridmaxx=" + $("mapgridtable").getAttribute("maxx")); Params.append("&mapgridminy=" + $("mapgridtable").getAttribute("miny")); Params.append("&mapgridmaxy=" + $("mapgridtable").getAttribute("maxy")); Params.append("&mapgridname=" + $("mapgridtable").getAttribute("gridname")); Params.append("&mapgridfontcolor=" + this.MapGridFontColor); } //Map Markups TBA return Params.toString(); } //Global array of dockicons var DockIcons; //Header navigation buttons & menus Map.prototype.MakeDockMenu = function() { //Build icons collection based on compile flag var D; var H = new StringBuilder(); var i = 0; var Names = new Array(); Names[i] = "fullextent"; i++; Names[i] = "measure"; i++; Names[i] = "zoomextent"; i++; Names[i] = "zoomin"; i++; Names[i] = "zoomout"; i++; Names[i] = "previous"; i++; Names[i] = "reset"; i++; Names[i] = "print"; i++; Names[i] = "save"; i++; Names[i] = "open"; i++; Names[i] = "search"; i++; Names[i] = "pointsearch"; i++; if (this.CompileFlag != 3) { Names[i] = "buffer"; i++; } i = 0; var Calls = new Array() Calls[i] = "Obj.FullExtent()"; i++; Calls[i] = "Obj.OpenMeasure()"; i++; Calls[i] = "Obj.StartZoomExtent()"; i++; Calls[i] = "Obj.ZoomIn()"; i++; Calls[i] = "Obj.ZoomOut()"; i++; Calls[i] = "Obj.PreviousExtent()"; i++; Calls[i] = "Obj.ResetAll()"; i++; Calls[i] = "Obj.ToggleMenu('print')"; i++; Calls[i] = "Obj.ToggleMenu('savemap')"; i++; Calls[i] = "Obj.ListSaveMaps()"; i++; Calls[i] = "Obj.ToggleMenu('search')"; i++; Calls[i] = "Obj.ToggleMenu('gps')"; i++; if (this.CompileFlag != 3) { Calls[i] = "Obj.ToggleMenu('buffer')"; i++; } i = 0; DockIcons = new Array(); var AddIcon = true; //Translucent blocker H = new StringBuilder(); H.append("
"); H.append("
"); D = document.createElement("div"); D.setAttribute("id","dockbackground"); D.style.position = "absolute"; D.style.left= "0px"; D.style.top = "1px"; D.style.zindex = "190000"; D.style.width = "100%"; D.innerHTML = H.toString(); this.M.appendChild(D); for (i=0; i"); H.append(""); //2 TDs per icon, multiples of 2!! H.append(this.DockTD("Navigation", 14, "#618ed5")); H.append(this.DockTD("Print & Save", 6, "#83a7de")); if (this.CompileFlag == 3) { H.append(this.DockTD("Search", 4, "#7eba6d")); } else { H.append(this.DockTD("Search", 6, "#7eba6d")); } H.append(this.DockTD("", 4, "#7eba6d")); /* H.append(this.DockTD("Navigation", 16, "#618ed5")); H.append(this.DockTD("Print & Save", 6, "#83a7de")); H.append(this.DockTD("Search", 8, "#7eba6d")); H.append(this.DockTD("", 4, "#7eba6d")); */ //#7eba6d H.append(""); H.append(""); H.append(""); H.append(""); //Resizable icons for (i=0; i"); H.append(""); //Shortcuts sub table H.append(""); H.append(""); H.append("
"); H.append("
"); //Menu D = document.createElement("div"); D.setAttribute("id","dock"); D.style.position = "absolute"; D.style.left= "0px"; D.style.top = "2px"; D.style.zindex = "200000"; D.style.width = "100%"; D.innerHTML = H.toString(); //Disable mouse selection D.onselectstart = function () { return false; }; D.onmousedown = function () { return false; }; this.M.appendChild(D); //Set default sizing and mousover icon for (i=0; i" + Title + ""); H.append(""); return H.toString(); } //Dock icon class function DockIcon(ID, AppRoot, CallBack, ArrayOffset) { this.ID = ID + "icon"; //DOM ID of icon image this.ArrayOffset = ArrayOffset; //Offset refering to global DockIcons var this.IconTimout; this.MinSrc = AppRoot + "dockicons/" + ID + "_out.jpg"; this.MaxSrc = AppRoot + "dockicons/" + ID + "_over.jpg"; //TESTING //this.MinSrc = AppRoot + "buttons/blue_out.jpg"; //this.MaxSrc = AppRoot + "buttons/blue_over.jpg"; this.MinSize = 28; //Min icon width / height this.MaxSize = 56; //Max icon width / height //Enlarge this.UpInterval = 12; //Milliseconds between each resize operation this.UpIncrement = 7; //Pixels per resize step //Reduce this.DownInterval = 25; //Milliseconds between each resize operation this.DownIncrement = 7; //Pixels per resize step //Set onclick callback if (CallBack == "") { this.CallBack = "alert('test')"; } else { this.CallBack = CallBack; } //this.Alt = "testing 123"; //HTML alt tag //Return TD container of dock icon this.ToString = function() { var H = new StringBuilder(); if (this.ArrayOffset != 0) { H.append(""); } H.append(""); H.append(""); H.append(""); return H.toString(); } this.SetDefaultSize = function() { var I = $(this.ID); I.style.width = this.MinSize + "px"; I.style.height = this.MinSize + "px"; if (browser.isIE == true) { I.style.cursor= "hand"; } else { I.style.cursor= "pointer"; } } this.Enlarge = function() { var I = $(this.ID); var Width = parseInt(I.style.width); //Maximum icon size reached if (Width == this.MaxSize) { clearTimeout(this.IconTimout); I.src = this.MaxSrc; //Show help Obj.ShowHelp(this.ID); //Resize required } else if (Width < this.MaxSize) { clearTimeout(this.IconTimout); this.Resize(Width + this.UpIncrement, "enlarge"); } } this.Reduce = function() { var I = $(this.ID); var Width = parseInt(I.style.width); //Minimum icon size reached if (Width == this.MinSize) { clearTimeout(this.IconTimout); I.src = this.MinSrc; //Resize required } else if (Width > this.MinSize) { clearTimeout(this.IconTimout); this.Resize(Width - this.DownIncrement, "reduce"); } } this.Resize = function(WH, Flag) { var F = ""; var I = $(this.ID); I.style.width = WH + "px"; I.style.height = WH + "px"; //Recursive call if (Flag == "reduce") { F = "DockIcons[" + this.ArrayOffset + "].Reduce()"; clearTimeout(this.IconTimeout); this.IconTimeout = setTimeout(F, this.DownInterval); } else if (Flag == "enlarge") { F = "DockIcons[" + this.ArrayOffset + "].Enlarge()"; clearTimeout(this.IconTimeout); this.IconTimeout = setTimeout(F, this.UpInterval); } } } //Universal "select by extent" functions Map.prototype.EnableExtentSelect = function(BorderColor, CallBack) { var TBL = new StringBuilder(); var B = $("localblocker"); B.style.display = ""; //Disable mouse selection of elements B.onselectstart = function() {return false;} // ie this.EnableExtentMBR = false; //Inner tranlucent table for extent square TBL.append(""); TBL.append("
"); //Add resizable square element to blocker var S = document.createElement("div"); S.setAttribute("id","extentsquare"); S.style.borderStyle = "solid"; S.style.borderColor = BorderColor; S.style.borderWidth = "1px"; S.style.filter = "alpha(opacity=80)"; S.style.opacity = "0.8"; S.style.position = "absolute"; S.style.left = "0px"; S.style.top = "0px"; S.style.width = "1px"; S.style.height = "1px"; S.style.display = "none"; S.innerHTML = TBL.toString(); if ($("extentsquare")) { this.M.removeChild($("extentsquare")); } this.M.appendChild(S); //Update local blocker to map div size and position this.UpdateLocalBlockerSize("localblocker"); ExtentCallBack = CallBack; //Mouse events //Firefox if (!browser.isIE) { B.onmousedown = function(event) { Obj.InitializeSelectMBR(event); return false; } B.onmouseup = function(event) { Obj.StopExtent(event); } B.onmousemove = function(event) { Obj.UpdateExtent(event); } //IE } else { B.onmousedown = function() { Obj.InitializeSelectMBR(event); } B.onmouseup = function() { Obj.StopExtent(event); } B.onmousemove = function() { Obj.UpdateExtent(event); } } //Override help container $("helpmessage").innerHTML = ""; $("helpsubtext").innerHTML = "Click on the map and drag to perform a selection. Press the ESC key when you are finished."; $("help").style.display = ""; //Hide windows temporarily this.TempHideWindows(); //Hide dock temporarily this.HideDock(); //Default top center MBR label this.MBRLabel(0,0,0,0,0,0,0); } //Initialize the select square, store starting XY position Map.prototype.InitializeSelectMBR = function(Event) { //Check for correct mouse button press if (Event.button <= 1) { var X = 0; var Y = 0; var S = $("extentsquare"); this.EnableExtentMBR = true; //Get mouse position if (browser.isIE == true) { X = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; Y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } else { X = Event.clientX + window.scrollX; Y = Event.clientY + window.scrollY; } //Correct XY for map div location var MPos = FindPixelPosition(this.M); X -= MPos.Left; Y -= MPos.Top; S.setAttribute("startx", X); S.setAttribute("starty", Y); S.style.left = X + "px"; S.style.top = Y + "px"; S.style.display = "none"; } } Map.prototype.UpdateExtent = function(Event) { if (this.EnableExtentMBR == true && Event.button <= 1) { var X = 0; var Y = 0; var S = $("extentsquare"); var StartX = parseInt(S.getAttribute("startx")); var StartY = parseInt(S.getAttribute("starty")); var NewX = 0; var NewY = 0; var Width = 0; var Height = 0; //Get mouse position if (browser.isIE == true) { X = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; Y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } else { X = Event.clientX + window.scrollX; Y = Event.clientY + window.scrollY; } //Correct XY for map div location var MPos = FindPixelPosition(this.M); X -= MPos.Left; Y -= MPos.Top; //Top left if (X < StartX && Y < StartY) { NewX = X; NewY = Y; //Top right } else if (X > StartX && Y < StartY) { NewX = StartX; NewY = Y; //Bottom right } else if (X > StartX && Y > StartY) { NewX = StartX; NewY = StartY; //Bottom left } else if (X < StartX && Y > StartY) { NewX = X; NewY = StartY; } //Set extent MBR location and size Width = Math.abs(StartX - X); Height = Math.abs(StartY - Y); var S = $("extentsquare"); S.style.width = Width + "px"; S.style.height = Height + "px"; S.style.left = NewX + "px"; S.style.top = NewY + "px"; S.style.display = ""; //Update status label and NAD83 translation of extent MBR this.UpdateExtentNAD83(); } } //Update NAD83 bounds of extent square Map.prototype.UpdateExtentNAD83 = function() { var S = $("extentsquare"); var Width = parseInt(S.style.width); var Height = parseInt(S.style.height); var Top = parseInt(S.style.top); var Left = parseInt(S.style.left); //Extent square is relative and restricted inside map div location //Compensate for this var MPos = FindPixelPosition(this.M); Left += MPos.Left; Top += MPos.Top; var TopLeft = this.ConvertToFeet(Left, Top); var BottomRight = this.ConvertToFeet(Left + Width, Top + Height); var WMiles = (BottomRight.X - TopLeft.X) / 5280; var HMiles = (TopLeft.Y - BottomRight.Y) / 5280; var SqMi = WMiles * HMiles; //Update top center MBR label this.MBRLabel(SqMi, WMiles, HMiles, TopLeft.X, BottomRight.X, BottomRight.Y, TopLeft.Y); this.ExtentMBR.MinX = TopLeft.X; this.ExtentMBR.MaxX = BottomRight.X; this.ExtentMBR.MinY = BottomRight.Y; this.ExtentMBR.MaxY = TopLeft.Y; } //Build MBR help label Map.prototype.MBRLabel = function(SqMi, WMiles, HMiles, MinX, MaxX, MinY, MaxY) { //Generate dynamic extent label var T = new StringBuilder(); T.append("Area: " + SqMi.toFixed(4) + " square miles  "); T.append("Width: " + WMiles.toFixed(3) + " miles  "); T.append("Height: " + HMiles.toFixed(3) + " miles
"); T.append("MinX: " + MinX + " feet  "); T.append("MaxX: " + MaxX + " feet
"); T.append("MinY: " + MinY + " feet  "); T.append("MaxY: " + MaxY + " feet"); //Override help container and make it visible $("helpmessage").innerHTML = T.toString(); } //Detach select from extent events from blocker object Map.prototype.StopExtent = function(Event) { if (Event.button <= 1) { $("extentsquare").style.display = "none"; this.EnableExtentMBR = false; //Perform callback operation if ($("localblocker").style.display == "") { SetLoadingStatus("Loading...","map_icon"); setTimeout(ExtentCallBack,100); } } } //Stop selection mode (called via keyboard.js) Map.prototype.ClearExtentSelection = function() { //Hide extent selection blocker and help container $("localblocker").style.display = "none"; $("help").style.display = "none"; //If there is a selection extent square to clear if ($("extentsquare")) { //$("extentsquare").style.display = "none"; this.M.removeChild($("extentsquare")); } //If there is a measure line container to clear if ($("measurecontainer")) { this.M.removeChild($("measurecontainer")); } //Detach events var B = $("localblocker"); B.onmousedown = null; B.onmouseup = null; B.onmousemove = null; //this.EnableExtentMBR = false; //Show dock and windows this.TempShowWindows(); //Show dock this.ShowDock(); } //Help content loader Map.prototype.ShowHelp = function(AliasName) { var Alias = AliasName.replace("icon",""); var H = ""; var Subtext = false; //Dock icons if (Alias == "fullextent") { H = "Zoom out to full county view"; } else if (Alias == "measure") { H = "Open the line measure tool"; } else if (Alias == "zoomextent") { H = "Open zoom in by extent selection"; } else if (Alias == "zoomin") { H = "Zoom in"; } else if (Alias == "zoomout") { H = "Zoom out"; } else if (Alias == "previous") { H = "Go to previous map extent"; } else if (Alias == "reset") { H = "Clear all map menus and markups, and then zoom to full extent"; } else if (Alias == "print") { H = "Generate a map image or PDF file"; } else if (Alias == "save") { H = "Save current map view"; } else if (Alias == "open") { H = "Open saved map view"; } else if (Alias == "search") { H = "Find an address or location"; } else if (Alias == "pointsearch") { H = "Search by point coordinate"; } else if (Alias == "buffer") { H = "Open the parcel buffer tool"; } else if (Alias == "pictometry") { H = "Open pictometry popup window"; } else if (Alias == "draw") { H = "Draw shapes, lines, labels, and more..."; } else if (Alias == "mls") { H = "Search for homes on sale (updated every 12 hrs)"; } //Mouse menu if (Alias == "identify") { H = "Identify this parcel. You can also hold down the CTRL key and click on the map."; } else if (Alias == "mouseimage") { H = "Save current map view as image file."; } else if (Alias == "mousepoint") { H = "Open point search tool and display point coordinates."; } //Current map theme if (Alias == "theme") { H = "Current Map Theme: " + this.Themes[this.ThemeID].Title; } //List mouse and keyboard shortcuts if (Alias == "shortcuts") { var SBR = "


"; var F = ""; var F2 = ""; H = "
"; H += "Mouse and Keyboard Shortcuts
"; H += "(Shortcuts are disabled when hovering over a floating menu)

"; H += SBR; H += F + "Right click on map: Open quick menu
"; H += F + "Mouse scroll wheel: Zoom in & out
"; H += F + "Plus and minus keys: Zoom in & out
"; H += F + "Double click on map: Zoom in
"; H += F + "Arrow keys: Pan map
" + SBR; //Theme shortcuts H += "
"; H += F2 + "Shift - 1: Switch to Basic Map
"; H += F2 + "Shift - 2: Switch to Aerial Photography
"; H += F2 + "Shift - 3: Switch to Basic Map + Zoning
"; H += F2 + "Shift - 4: Switch to Aerials + Zoning
"; H += F2 + "Shift - 5: Switch to Basic Map + General Plan
"; H += F2 + "Shift - 6: Switch to Aerials + General Plan
"; if (this.CompileFlag != 3) { H += F2 + "Shift - 7: Switch to Basic Map + NHD
"; H += F2 + "Shift - 8: Switch to Aerials + Agriculture
"; } H += F2 + "Shift - R: Reset map and zoom to full extent
"; H += "
"; } //Set help message $("guidemessage").innerHTML = " " + H + " "; //Set sub text if (Subtext == true && H != "") { $("guiderow2").style.display = ""; $("guidesubtext").innerHTML = "Press the 'H' key while hovering over an icon to open help information."; } else { $("guiderow2").style.display = "none"; $("guidesubtext").innerHTML = ""; } //Show help $("guide").style.display = ""; } //Hide dock help content Map.prototype.HideHelp = function() { $("guide").style.display = "none"; } //Open Measure tool Map.prototype.OpenMeasure = function() { //Hide mouse menut $("mousemenu").style.display = "none"; //Turn on interface blocker var B = $("localblocker"); B.style.display = ""; //Disable mouse selection of elements B.onselectstart = function() {return false;} // ie B.onmousedown = function() {return false;} // mozilla this.EnableMeasure = false; //Update local blocker to map div size and position this.UpdateLocalBlockerSize("localblocker"); //Add measure line container to map div var ML = document.createElement("div"); ML.setAttribute("id","measurecontainer"); ML.style.display = "none"; ML.style.position = "absolute"; ML.style.left = "0px"; ML.style.top = "0px"; ML.style.width = "0px"; ML.style.height = "0px"; if (!$("measurecontainer")) { this.M.appendChild(ML); } else { $("measurecontainer").innerHTML = ""; } //Mouse events //Firefox if (!browser.isIE) { B.onmousedown = function(event) { Obj.StartMeasure(event); return false; } B.onmouseup = function(event) { Obj.StopMeasure(event); } B.onmousemove = function(event) { Obj.UpdateMeasure(event); } //IE } else { B.onmousedown = function() { Obj.StartMeasure(event); } B.onmouseup = function() { Obj.StopMeasure(event); } B.onmousemove = function() { Obj.UpdateMeasure(event); } } //Override help container $("helpmessage").innerHTML = ""; $("helpsubtext").innerHTML = "Click on the map and drag to measure. Press the ESC key when you are finished."; $("help").style.display = ""; //Default measure label this.MeasureLabel(0,0,0,0); //Hide windows temporarily this.TempHideWindows(); //Hide dock temporarily this.HideDock(); } //Open measure tool via right click menu Map.prototype.ShortCutMeasure = function() { this.OpenMeasure(); } Map.prototype.StartMeasure = function(Event) { var X = 0; var Y = 0; var ML = $("measurecontainer"); var MPos = FindPixelPosition(this.M); ML.innerHTML = ""; //Check for correct mouse button press if (Event && Event.button <= 1) { this.EnableMeasure = true; //Get mouse position if (browser.isIE == true) { X = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; Y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; //Perform mouse pointer correction X -= 3; Y -= 3; } else { X = Event.clientX + window.scrollX; Y = Event.clientY + window.scrollY; } var MP = this.ConvertToFeet(X, Y); ML.setAttribute("startleft",(X-MPos.Left)); ML.setAttribute("starttop",(Y-MPos.Top)); ML.setAttribute("startx",MP.X); ML.setAttribute("starty",MP.Y); ML.style.left = (X-MPos.Left) + "px"; ML.style.top = (Y-MPos.Top) + "px"; ML.style.display = ""; } } //Update measure label and vector line Map.prototype.UpdateMeasure = function(Event) { var X1 = 0; var Y1 = 0; var X2 = 0; var Y2 = 0; var X = 0; var Y = 0; var NewX = 0; var NewY = 0; var Width = 0; var Height = 0; var ML = $("measurecontainer"); var MPos = FindPixelPosition(this.M); var Left = parseInt(ML.style.left) + MPos.Left; var Top = parseInt(ML.style.top) + MPos.Top; var StartLeft = ML.getAttribute("startleft"); var StartTop = ML.getAttribute("starttop"); var MousePT; if (Event.button <= 1 && this.EnableMeasure == true) { //Get mouse position if (browser.isIE == true) { X = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; Y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; //Perform mouse pointer correction X -= 3; Y -= 3; } else { X = Event.clientX + window.scrollX; Y = Event.clientY + window.scrollY; } MousePT = this.ConvertToFeet(X, Y); X -= MPos.Left; Y -= MPos.Top; Width = Math.abs(StartLeft-X); Height = Math.abs(StartTop-Y); //Top left if (X < StartLeft && Y < StartTop) { NewX = X; NewY = Y; X1 = 0; Y1 = 0; X2 = Width; Y2 = Height; //Top right } else if (X > StartLeft && Y < StartTop) { NewX = StartLeft; NewY = Y; X1 = 0; Y1 = Height; X2 = Width; Y2 = 0; //Bottom right } else if (X > StartLeft && Y > StartTop) { NewX = StartLeft; NewY = StartTop; X1 = 0; Y1 = 0; X2 = Width; Y2 = Height; //Bottom left } else if (X < StartLeft && Y > StartTop) { NewX = X; NewY = StartTop; X1 = 0; Y1 = Height; X2 = Width; Y2 = 0; } //Vertical line if (X == StartLeft) { if (Y < StartTop) { NewY = Y; } else { NewY = StartTop; } NewX = X; Width = 2; X1 = 0; Y1 = 0; X2 = 0; Y2 = Height; } //Horizontal line if (Y == StartTop) { if (X < StartLeft) { NewX = X; } else { NewX = StartLeft; } NewY = Y; Height = 2; X1 = 0; Y1 = 0; X2 = Width; Y2 = 0; } //Update VML line container ML.style.left = NewX; ML.style.top = NewY; //Draw VML line if (X != StartLeft && Y != StartTop) { this.DrawSimpleLine("measurecontainer","measureline",X1,Y1,X2,Y2,2,"red"); } //Update measure label this.MeasureLabel(ML.getAttribute("startx"), ML.getAttribute("starty"), MousePT.X, MousePT.Y); } } Map.prototype.StopMeasure = function(Event) { this.EnableMeasure = false; } Map.prototype.MeasureLabel = function(X1, Y1, X2, Y2) { var FPP = parseFloat(this.ZoomLevels[this.CurrentZoom].FPT / 512); var Distance = Math.sqrt(Math.pow((X1-X2),2) + Math.pow((Y1-Y2),2)); var Miles = 0; if (Distance > 0) { Miles = Distance / 5280; } //Generate dynamic extent label var T = new StringBuilder(); T.append("Distance: "); T.append("" + Distance.toFixed(3) + " feet / "); T.append(Miles.toFixed(4) + " miles  "); T.append("Accuracy (current zoom level): " + FPP.toFixed(4) + " feet per dot / pixel
"); T.append("X1: " + X1 + " feet  "); T.append("Y1: " + Y1 + " feet (starting point)
"); T.append("X2: " + X2 + " feet  "); T.append("Y2: " + Y2 + " feet (mouse pointer)"); //Override help container and make it visible $("helpmessage").innerHTML = T.toString(); } //Load default point using UTM coordinates (675 Texas St) //LLStr is for the "Examples" dropdown on point search form Map.prototype.DefaultPointSearch = function(LLStr, ZoomClose) { var Latitude = 38.24818; var Longitude = -122.04123; var LArr = new Array(); //Parse example point (decimal degrees) if (LLStr) { LArr = LLStr.split(","); Latitude = parseFloat(LArr[0]); Longitude = parseFloat(LArr[1]); } var LL = ConvertToNAD83(Latitude, Longitude); var LatDMS = this.ConvertToDMS(Latitude); var LongDMS = this.ConvertToDMS(Longitude); //Set form textfields this.UpdatePointForm(Latitude, Longitude, LatDMS, LongDMS, LL); //Load example point if (LLStr) { //Zoom in close if (ZoomClose) { this.DrawGPSPoint(LL, 11); } else { this.DrawGPSPoint(LL, 7); } } } //Update point search fields Map.prototype.UpdatePointForm = function(Latitude, Longitude, LatDMS, LongDMS, LL) { $("latd").value = LatDMS[0]; $("latm").value = LatDMS[1]; $("lats").value = LatDMS[2]; $("longd").value = LongDMS[0]; $("longm").value = LongDMS[1]; $("longs").value = LongDMS[2]; $("latdd").value = Latitude; $("longdd").value = Longitude; $("easting_x").value = LL.X.toFixed(5); $("northing_y").value = LL.Y.toFixed(5); //If the current parcel buffer mode is point search, update it if ($("buffertype").innerHTML == "Point") { this.BufferX = LL.X.toFixed(5); this.BufferY = LL.Y.toFixed(5); this.PointBufferLabel(this.BufferX, this.BufferY); } } //Draw GPS point based on mouse menu position Map.prototype.MouseGPSPoint = function() { var MM = $("mousemenu"); var Left = parseInt(MM.style.left); var Top = parseInt(MM.style.top); var MPos = FindPixelPosition(this.M); //Hide mouse menu MM.style.display = "none"; //Convert from pixel to NAD83 space var LL = Obj.ConvertToFeet(Left, Top); //alert(Left + ":" + Top); //Draw GPS point this.DrawGPSPoint(LL); //Show point search form if ($("gps").style.display == "") { this.SortMenus("gps"); this.MinMaxWindow("gps","open"); } else { this.ToggleMenu("gps"); this.MinMaxWindow("gps","open"); } //Update point search form, refresh pin again this.UpdateGPSDragPin(Left, Top); } //Draw GPS point, bind custom events, center, and zoom Map.prototype.DrawGPSPoint = function(LL, ZoomLevel) { //Draw pin //pins/00ffff_large.gif this.DrawPoint("gpslayer",this.AppRoot + "pins/greenpin.gif","gpspin",LL.X,LL.Y,false); //Bind dragging events this.GPSPointEvents($("gpspin")); //Zoom to map (if ZoomLevels array offset was passed in) if (ZoomLevel) { this.CurrentCenter = LL; this.CurrentZoom = ZoomLevel; this.setCenter(LL, this.CurrentZoom); } } Map.prototype.LoadPointExample = function() { this.DefaultPointSearch($("gps_examples").value); } //Convert decimal degrees to DMS format Map.prototype.ConvertToDMS = function(DecDegrees) { var DMS = new Array(); var DegreesTemp = Math.abs(parseFloat(DecDegrees)); var Degrees = Math.floor(DegreesTemp); var MinutesTemp = DegreesTemp - Degrees; var MinutesTemp = 60.0 * MinutesTemp; Minutes = Math.floor(MinutesTemp); var SecondsTemp = MinutesTemp - Minutes; SecondsTemp = 60.0 * SecondsTemp; var Seconds = SecondsTemp.toFixed(2); DMS[0] = Degrees; DMS[1] = Minutes; DMS[2] = Seconds; return DMS; } //Validate degrees decimals UTM point Map.prototype.ValidateDD = function(Latitude, Longitude, DoAlert) { var ErrStr = new StringBuilder(); //Validate latitude if (Latitude == "") { ErrStr.append("No latitude was entered.\n"); } else if (IsNumeric(Latitude) == false) { ErrStr.append("Latitude entered is not a numeric value.\n"); } else if (IsNumeric(Latitude) == true && parseFloat(Latitude)<0) { ErrStr.append("Negative number entered for latitude.\n"); } //Validate longitude if (Longitude == "") { ErrStr.append("No longitude was entered.\n"); } else if (IsNumeric(Longitude) == false) { ErrStr.append("Longitude entered is not a numeric value.\n"); } else if (IsNumeric(Longitude) == true && parseFloat(Longitude)>0) { ErrStr.append("Positive number entered for longitude.\n"); } //1 or more input errors found if (ErrStr.toString() != "" && DoAlert == true) { alert(ErrStr.toString()); } return ErrStr.toString(); } //Validate MMDDSS UTM point Map.prototype.ValidateDMS = function(DDD, MM, SS, FormName, DoAlert) { var ErrStr = new StringBuilder(); //Validate degrees if (DDD == "") { ErrStr.append("No degrees entered for " + FormName + ".\n"); } else if (IsNumeric(DDD) == false) { ErrStr.append("Degrees entered for " + FormName + " is not a numeric value.\n"); } //Validate minutes if (MM == "") { ErrStr.append("No minutes entered for " + FormName + ".\n"); } else if (IsNumeric(MM) == false) { ErrStr.append("Minutes entered for " + FormName + " is not a numeric value.\n"); } //Validate seconds if (SS == "") { ErrStr.append("No seconds entered for " + FormName + ".\n"); } else if (IsNumeric(SS) == false) { ErrStr.append("Seconds entered for " + FormName + " is not a numeric value.\n"); } //1 or more input errors found if (ErrStr.toString() != "" && DoAlert == true) { alert(ErrStr.toString()); } return ErrStr.toString(); } //Validate CA NAD83 input Map.prototype.ValidateNAD83 = function(X, Y, DoAlert) { var ErrStr = new StringBuilder(); //Validate easting x if (X == "") { ErrStr.append("No easting (x) entered.\n"); } else if (IsNumeric(X) == false) { ErrStr.append("Easting (x) entered is not a numeric value.\n"); } //Validate northing y if (Y == "") { ErrStr.append("No northing (y) entered.\n"); } else if (IsNumeric(Y) == false) { ErrStr.append("Northing (y) entered is not a numeric value.\n"); } //1 or more input errors found if (ErrStr.toString() != "" && DoAlert == true) { alert(ErrStr.toString()); } return ErrStr.toString(); } //Zoom to point from UTM DD point input Map.prototype.ZoomDD = function(OpenBuffer) { var Latitude = $("latdd").value; var Longitude = $("longdd").value; var ErrStr = this.ValidateDD(Latitude, Longitude, true); //Form validation passed if (ErrStr == "") { this.DrawDDPoint(Latitude, Longitude); //Open buffer form if (OpenBuffer) { this.PointBuffer(); } } } //Zoom to point from UTM DMS point input Map.prototype.ZoomDMS = function(OpenBuffer) { var LatD = $("latd").value; var LatM = $("latm").value; var LatS = $("lats").value; var LongD = $("longd").value; var LongM = $("longm").value; var LongS = $("longs").value; var LL; var Latitude; var Longitude; var ErrStr = ""; var Div = parseFloat(1/60); ErrStr += this.ValidateDMS(LatD, LatM, LatS, "latitude", false); ErrStr += this.ValidateDMS(LongD, LongM, LongS, "longitude", false); //Form validation passed if (ErrStr == "") { //Convert to degrees decimals format Latitude = parseFloat(LatD); Latitude += (parseFloat(LatM)/60); Latitude += (parseFloat(LatS)/60/60); Longitude = parseFloat(Math.abs(LongD)); Longitude += (parseFloat(LongM)/60); Longitude += (parseFloat(LongS)/60/60); Longitude = -Longitude; this.DrawDDPoint(Latitude, Longitude); //Open buffer form if (OpenBuffer) { this.PointBuffer(); } //1 or more validation errors found } else { alert(ErrStr); } } Map.prototype.ZoomNAD83 = function(OpenBuffer) { var X = $("easting_x").value; var Y = $("northing_y").value; var ErrStr = this.ValidateNAD83(X, Y, true); var LL; if (ErrStr == "") { X = parseFloat(X); Y = parseFloat(Y); LL = new LatLong(X, Y); this.DrawGPSPoint(LL, this.PointSearchZoom); //Open buffer form if (OpenBuffer) { this.PointBuffer(); } } } //Initialize new point to parcels buffer Map.prototype.PointBuffer = function() { SetLoadingStatus("Preparing Parcel Buffer...","map_icon"); setTimeout("Obj.NewBuffer('point')",600); } //Update pin location after a map zoom operation Map.prototype.RefreshGPSPin = function() { if ($("gpspin")) { var S = $("gpspin"); var X = parseFloat(S.getAttribute("x")); var Y = parseFloat(S.getAttribute("y")); //var LL = new LatLong(X, Y); var ImgSrc = S.getAttribute("src"); this.DrawPoint("gpslayer",ImgSrc,"gpspin",X,Y,false); //Set dragging events this.GPSPointEvents($("gpspin")); } } //Clear GPS point Map.prototype.RemoveGPSPin = function() { if ($("gpspin")) { $("gpslayer").removeChild($("gpspin")); } } //Attach drag events to pin image Map.prototype.GPSPointEvents = function(PT) { //Start dragging PT.onmousedown = function(Event) { Obj.StartDrag(Event,"gpspin",75); } //Stop dragging, update UTM and NAD83 form values PT.onmouseup = function(Event) { var X = 0; var Y = 0; var PN = $("gpspin"); var MPos = FindPixelPosition(Obj.M); //Get pin position X = parseInt(PN.style.left) + parseInt($("dragcontainer").style.left); Y = parseInt(PN.style.top) + parseInt($("dragcontainer").style.top); //Compensate for map div position X += MPos.Left; Y += MPos.Top; //Compensate for pin pixel positioning X += parseInt(PN.width/2); Y += parseInt(PN.height); //Force open the point search form if ($("gps").style.display == "none") { Obj.ToggleMenu("gps"); } Obj.MinMaxWindow("gps","open"); //Update gps pin Obj.UpdateGPSDragPin(X, Y); } } //Convert DD coordinate and draw GPS pin Map.prototype.DrawDDPoint = function(Latitude, Longitude) { //NAD83 conversion response var DDResponse = function(XMLObj) { var XML = XMLObj.responseText; var X = parseFloat(ParseTag("x",XML)); var Y = parseFloat(ParseTag("y",XML)); Obj.DrawGPSPoint(new LatLong(X, Y), Obj.PointSearchZoom); setTimeout("ClearLoadingStatus()",400); } //Convert from NAD83 to UTM space var Params = new StringBuilder("t=" + Math.random()); Params.append("&execute=utm_to_nad83"); Params.append("&x=" + Longitude); Params.append("&y=" + Latitude); SetLoadingStatus(" Converting Point...","bufferpin"); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params.toString(),DDResponse); } //Update GPS point element data, and point search form Map.prototype.UpdateGPSDragPin = function(X, Y) { var XML = ""; var Latitude; var Longitude; var LatDMS; var LongDMS; var CPos = FindPixelPosition(Obj.M); var LL; var PN = $("gpspin"); //Convert from pixel to NAD83 space LL = Obj.ConvertToFeet(X, Y); //Set NAD83 coordinates PN.setAttribute("x",LL.X); PN.setAttribute("y",LL.Y); //Convert from NAD83 to UTM space var Params = "t=" + Math.random(); Params += "&execute=nad83_to_utm"; Params += "&x=" + LL.X; Params += "&y=" + LL.Y; //Process UTM response var PResponse = function(XMLObj) { XML = XMLObj.responseText; //Error found if (XML.indexOf("Error") > -1) { alert("Point input is out of bounds."); } else { $("debug").innerHTML = ""; Latitude = parseFloat(ParseTag("lat",XML)); Longitude = parseFloat(ParseTag("long",XML)); LatDMS = Obj.ConvertToDMS(Latitude); LongDMS = Obj.ConvertToDMS(Longitude); Obj.UpdatePointForm(Latitude, Longitude, LatDMS, LongDMS, LL); } setTimeout("ClearLoadingStatus()",100); } SetLoadingStatus(" Updating Coordinates...","gpsicon.png"); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,PResponse); } //List current maps Map.prototype.ListSaveMaps = function() { var Params = "t=" + Math.random(); Params += "&execute=listsavemaps"; //Process list response var LResponse = function(XMLObj) { var XML = XMLObj.responseText; var H = new StringBuilder(); //No maps found if (XML == "") { $("savemaptotal").innerHTML = "0 maps found."; $("savemapgrid").innerHTML = ""; } else { //Set columns var Count = parseInt(ParseTag("total",XML)); var Cols = new Array(); Cols[0] = new HeaderColumn("#"); Cols[1] = new HeaderColumn("Title"); Cols[2] = new HeaderColumn("Description"); Cols[3] = new HeaderColumn("Date Saved"); //Bind grid H.append(Obj.BindHeader(Cols, 2, 123)); H.append(ParseTag("grid",XML) + ""); $("savemapgrid").innerHTML = H.toString(); if (Count == 1) { $("savemaptotal").innerHTML = Count + " map found."; } else { $("savemaptotal").innerHTML = Count + " maps found."; } } //Force open the save maps list form if ($("savemaplist").style.display == "none") { Obj.ToggleMenu("savemaplist"); } Obj.MinMaxWindow("savemaplist","open"); setTimeout("ClearLoadingStatus()",250); } SetLoadingStatus("Loading Saved Maps..."); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,LResponse); } //Delete a map Map.prototype.DeleteSaveMap = function(ID) { var Params = "t=" + Math.random(); Params += "&execute=deletesavemap"; Params += "&id=" + ID; //Confirm or cancel var answer = confirm("Press OK to confirm deletion.") if (answer){ //Reload list of saved maps var DResponse = function(XMLObj) { setTimeout("Obj.ListSaveMaps()",200); } //Delete SetLoadingStatus("Deleting Map..."); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,DResponse); } } //Save current map view Map.prototype.SaveMapView = function() { var Params = ""; var ErrStr = ""; var Title = $$("savetitle"); var Description = $$("savedescription"); if (Title == "") { ErrStr += "No title was entered\n"; } if (Title.length > 200) { ErrStr += "Title must be 200 characters or less.\n"; } if (Description.length > 400) { ErrStr += "Description must be 400 characters or less.\n"; } Title = Title.replace("&",""); Title = Title.replace("=",""); Description = Description.replace("&",""); Description = Description.replace("=",""); if (ErrStr != "") { alert(ErrStr); } else { //Use print POST generator from print.js Params += this.PrintPost("savemap", parseInt(this.M.style.width), parseInt(this.M.style.height), this.ThemeID); Params += "&title=" + Title; Params += "&description=" + Description; //alert(Params); var SResponse = function(XMLObj) { var XML = XMLObj.responseText; //Error if (XML.indexOf("Error")>-1) { alert(XML); } else if (XML != "") { alert("Your map view has been saved."); //Open and align the save list form var Left = parseInt($("savemap").style.left); var Top = parseInt($("savemap").style.top); if ($("savemaplist").style.display == "none") { Obj.ToggleMenu("savemaplist"); } //Close save new map $("savemap").style.display = "none"; //Open save map list Obj.MinMaxWindow("savemaplist","open"); $("savemaplist").style.left = "75px"; $("savemaplist").style.top = "75px"; //Relist the saved maps Obj.ListSaveMaps(); } ClearLoadingStatus(); } SetLoadingStatus("Saving Map..."); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,SResponse); } } //Open a selected save map Map.prototype.OpenSaveMap = function(ID) { var Str = "Obj.ExecuteOpenSaveMap(" + ID + ")"; SetLoadingStatus("Opening Saved Map View..."); setTimeout(Str,20); } Map.prototype.ExecuteOpenSaveMap = function(ID) { var Params = "t=" + Math.random(); Params += "&execute=loadsavemap"; Params += "&id=" + ID; var PNames = new Array(); PNames[0] = "identify"; PNames[1] = "search"; PNames[2] = "buffer"; var XML = ""; var Str = ""; var PXML = ""; var ParcelXML = ""; var HTM = ""; var PolygonParts; var APN = ""; var ID = ""; var Acres = 0; var Parcels; var Bounds; var ZoomOffset = 0; var CenterX = 0; var CenterY = 0; var X = 0; var Y = 0; var StreetName = ""; var City = ""; //Fetch map XML var MResponse = function(XMLObj) { XML = XMLObj.responseText; //Fetch map extent settings CenterX = parseFloat(ParseTag("centerx",XML)); CenterY = parseFloat(ParseTag("centery",XML)); ZoomOffset = parseInt(ParseTag("zoomoffset",XML)); //Change map to stored tile cache theme Obj.ChangeTheme(parseInt(ParseTag("themeid",XML))); //Zoom to proper extent Obj.setCenterSimple(CenterX, CenterY, ZoomOffset); //Clear existing parcel layers Obj.ResetParcelCollection("identify"); Obj.ResetParcelCollection("search"); Obj.ResetParcelCollection("buffer"); //Load the parcel layers for (var f=0; f"); //Loop through all parcels found for (var i=1; i -1) { this.MapGridFontColor = "#00ffff"; } else { this.MapGridFontColor = "#000000"; } //Position the map grid G.style.left = GridPos.Left + "px"; G.style.top = GridPos.Top + "px"; G.style.width = Width + "px"; G.style.height = Height + "px"; //Draw table and optional label H.append(""); H.append("
"); //There is room to draw a label if (this.CurrentZoom > 6) { this.MapGridName = Name; H.append("" + Name + ""); //Show no label } else { this.MapGridName = ""; } H.append("
"); G.innerHTML = H.toString(); G = this.TileEvents(G); //Create grid search element if ($("mapgridtable")) { L.removeChild($("mapgridtable")); } L.appendChild(G); } Map.prototype.RemoveMapGrid = function() { if ($("mapgridtable")) { var L = $("gridcontainer"); L.removeChild($("mapgridtable")); } } //Refresh map grid Map.prototype.RefreshMapGrid = function() { if ($("mapgridtable")) { var MG = $("mapgridtable"); var MinX = parseInt(MG.getAttribute("minx")); var MaxX = parseInt(MG.getAttribute("maxx")); var MinY = parseInt(MG.getAttribute("miny")); var MaxY = parseInt(MG.getAttribute("maxy")); var Name = MG.getAttribute("gridname"); this.DrawMapGrid(Name, MinX, MaxX, MinY, MaxY, false); } } //Convert parcel point to UTM and open popup Map.prototype.LoadPictometry = function(X, Y, Street, City, Zip) { var XML = ""; var Latitude = 0; var Longitude = 0; var URL = ""; var Width = 0; var Height = 0; if (browser.isIE == true) { Width = parseInt(document.body.offsetWidth); Height = parseInt(document.body.offsetHeight); } else { Width = parseInt(window.innerWidth); Height = parseInt(window.innerHeight); } //Open pictometry popup var PResponse = function(XMLObj) { //Fetch latlong XML = XMLObj.responseText; Latitude = parseFloat(ParseTag("lat",XML)); Longitude = parseFloat(ParseTag("long",XML)); //Open popup URL = "http://gis.solanocounty.com/msnpictometry/pictometry.html?t=" + Math.random(); URL += "&lat=" + Latitude; URL += "&long=" + Longitude; URL += "&street=" + Street; URL += "&city=" + City; URL += "&zip=" + Zip; Popup(URL,"pictometry",Width-45,Height-35, 10, 10); setTimeout("ClearLoadingStatus()",300); } //Convert from NAD83 to UTM space var Params = "t=" + Math.random(); Params += "&execute=nad83_to_utm"; Params += "&x=" + X + "&y=" + Y; //Perform Parcel Center -> UTM translation SetLoadingStatus(" Loading...","airplane.png"); var A = new AjaxConn(); A.connect(this.AppRoot + "ajaxrequest.aspx","POST",Params,PResponse); } //Load pictometry from mouse XY Map.prototype.MousePictometry = function() { //Fetch menu and find parcel var MM = $("mousemenu"); MM.style.display = "none"; var PT = this.ConvertToFeet(parseInt(MM.style.left), parseInt(MM.style.top)); this.LoadPictometry(PT.X, PT.Y, "", "", ""); } //Splash screen generator Map.prototype.SplashScreen = function() { var SBR = "


"; var H = new StringBuilder(); var S = $("splash"); H.append("
"); //Show disclaimer if (this.CompileFlag == 3) { H.append(this.PublicDisclaimer()); } H.append(""); H.append("
"); H.append(""); H.append("Welcome to Solano County Maps 2.0"); H.append("
"); H.append(SBR); //Launch buttons H.append("
"); H.append(""); H.append(""); H.append(""); H.append(""); H.append(""); H.append("
"); H.append("

"); H.append(""); H.append("Do you have questions or comments about this application? "); H.append("Send an email to "); H.append(""); H.append("gisstaff@solanocounty.com."); //Message for outside users who are if (this.CompileFlag == 3) { H.append("
"); H.append("For county employees, the full version is available at "); H.append("http://webstart > GIS Portal > Applications Tab"); } H.append("
"); H.append(SBR + "
"); $("blocker").style.display = ""; S.innerHTML = H.toString(); S.style.width = "100%"; S.style.height = "400px"; S.style.left = "0px"; S.style.top = "54px"; } //Open search Map.prototype.SplashSearch = function() { this.CloseSplash(); this.ToggleMenu("search"); } //Close splash screen Map.prototype.CloseSplash = function() { $("splash").style.display = "none"; $("blocker").style.display = "none"; } //Close Disclaimer Map.prototype.CloseDisclaimer = function() { $("disclaimer").style.display = "none"; $("splashtable").style.display = ""; } //Disclaimer for restricted version Map.prototype.PublicDisclaimer = function() { var H = new StringBuilder(); H.append("
"); H.append("
"); H.append("Please read the following information and select the \"accept\" button "); H.append("at the bottom of the page.

"); H.append("Data Disclaimer
"); H.append("Solano County makes no representations about the suitability of the "); H.append("information contained on this site for any purpose. All information "); H.append("and related graphics are provided \"as is\" with out warranty of any kind. "); H.append("Solano County hereby disclaims all warranties and conditions with "); H.append("regard to this information, including implied warranties and conditions "); H.append("of merchantability, fitness for a particular purpose, title and "); H.append("non-infringement. In no event shall Solano County be liable for any "); H.append("special, indirect or consequential damages or any damages whatsoever "); H.append("resulting from loss of use, data or profits, whether in an action of "); H.append("contract, negligence or other tortuous action, arising out of or in "); H.append("connection with the use or performance of software, documents, provision "); H.append("of or failure to provide services, or information available from "); H.append("this site.

"); H.append("The information and related graphics published on this site could "); H.append("include technical inaccuracies or typographical errors. Changes are "); H.append("periodically added to the information herein. Furthermore, Solano County "); H.append("and/or its respective suppliers may make improvements and/or changes in the "); H.append("product(s) and/or the service(s) described herein at any time.

"); H.append("
"); H.append(" "); H.append("

"); H.append("Solano County GIS Email: "); H.append(""); H.append("gisstaff@solanocounty.com"); H.append("

"); return H.toString(); } //Scalebar generator Map.prototype.MakeScaleBar = function() { var Width = parseInt(this.M.style.width); var Height = parseInt(this.M.style.height); var H = new StringBuilder(); //Outer table H.append(""); //Map legend link H.append("
"); H.append(""); H.append(""); //Inner table H.append(""); //Left Label 1 H.append(""); H.append("
 0"); //Left Label 2 H.append(""); H.append(""); //Middle Label H.append(""); H.append(""); //Right Label H.append(""); H.append(""); //H.append(""); //Image H.append("
"); H.append(""); //Close inner table H.append("
"); //Close outer table H.append("
"); var S = document.createElement("div"); S.setAttribute("id","scalebar"); S.style.position = "absolute"; S.innerHTML = H.toString(); S.style.zIndex = "999999"; //alert(Width + ":" + Height); this.M.appendChild(S); //http://solarcweb01/solanomapsdev/downloads/scalebar256.png //http://solarcweb01/solanomapsdev/downloads/scalebar512.png } //Update scalebar labels Map.prototype.UpdateScaleBar = function() { var T = this.ThemeID; var Zoom = this.ZoomLevels[this.CurrentZoom]; var FPT = Zoom.FPT; var Width = parseInt(this.M.style.width); var Height = parseInt(this.M.style.height); var ShowLegend = false; var URL = ""; $("scale1").innerHTML = parseInt(FPT * 0.25); $("scale2").innerHTML = parseInt(FPT * 0.5); $("scale3").innerHTML = FPT + " ft "; //Check for themes requiring map legend link if (T == 4 || T == 5 || T == 6 || T == 7 || T == 8 || T == 9 || T == 2 || T == 3) { URL = "  "; URL += "Map Legend "; $("legendlink").innerHTML = URL; $("legendlink").style.display = ""; ShowLegend = true; } else { $("legendlink").style.display = "none"; } var S = $("scalebar"); if (ShowLegend == true) { S.style.left = (Width - 600) + "px"; } else { S.style.left = (Width - 518) + "px"; } S.style.top = (Height - 28) + "px"; }