if (typeof (Dmp) == 'undefined') Dmp = new Object(); var _TOOLKIT_LOCATION='http://parcelstream.com/api/lib\\4.0\\Legacy/';Dmp.HostName='http://parcelstream.com/'; // Create namespace if (typeof (Dmp) == 'undefined') Dmp = new Object(); if (typeof (Dmp.Core) == 'undefined') Dmp.Core = new Object(); if (typeof (Dmp.Core.QueryModel) == 'undefined') Dmp.Core.QueryModel = new Object(); if (typeof (Dmp.Core.WktTools) == 'undefined') Dmp.Core.WktTools = new Object(); if (typeof (Dmp.Core.Collections) == "undefined") Dmp.Core.Collections = new Object(); if (typeof (Dmp.Core.Layers) == 'undefined') Dmp.Core.Layers = new Object(); if (typeof (Dmp.Core.Layers.MapLayers) == 'undefined') Dmp.Core.Layers.MapLayers = new Object(); if (typeof (Dmp.Layers) == 'undefined') Dmp.Layers = new Object(); if (typeof (Dmp.Layer) == 'undefined') Dmp.Layer = new Object(); if (typeof (Dmp.Drawing) == 'undefined') Dmp.Drawing = new Object(); if (typeof (Dmp.Env) == 'undefined') Dmp.Env = new Object(); if (typeof (Dmp.Conn) == "undefined") Dmp.Conn = new Object(); if (typeof (Dmp.Util) == 'undefined') Dmp.Util = new Object(); if (typeof (Dmp.Abstraction) == 'undefined') Dmp.Abstraction = new Object(); if (typeof (Dmp.Legacy) == 'undefined') Dmp.Legacy = new Object(); if (typeof (Dmp.Identify) == 'undefined') Dmp.Identify = new Object(); if (typeof (Dmp.Map) == 'undefined') Dmp.Map = new Object(); if (typeof (Dmp.Cookbook) == 'undefined') Dmp.Cookbook = new Object(); /** * Generates a unique string that are generally used for creating IDs for temporary objects. * @returns the unique string * @syntax: public static String Dmp.Util.getGuid() * @returns a unique string * @type {String} */ Dmp.Util.getGuid = function() { if (!Dmp.Util._guidCount) Dmp.Util._guidCount = 1; var tday = new Date(); var rand = Math.floor(Math.random() * 2000000000) return tday.getTime() + "" + rand + "" + Dmp.Util._guidCount++; }; //getGuid /** * Takes a key-value pair Json object and uses the key to set the respective property on the targetObject. * functions and properties starting with "_" cannot be overwritten in this way. * @params {Object} targetObject. Object to get its properties populated. Required. * @params {Object} json. Used to populate the targetObject. The key must match the desired property to set. Required. * @private */ Dmp.Util._populateFromJson = function(targetObject, json) { for(var n in json) { if(n && n.length > 0 && n.charAt(0) == "_") continue; if(typeof(targetObject[n]) == "function") continue; targetObject[n] = json[n]; } } /** * @params {Bing Maps object} map. Required. * @returns the current zoom level of the given Bing Map. * @type {Number} */ Dmp.Util.getZoomLevel = function(map) { if(!map || !map.getZoom) return 1; return map.getZoom(); } /** * @params {Bing Maps object} map. Required. * @returns an Object with xMin, yMax, yMin, yMax properties representing the current map's view * @type {object{ */ Dmp.Util.getMapView = function(map) { var view = map.getBounds(); var mapView = { xMin : view.getWest(), xMax : view.getEast(), yMin : view.getSouth(), yMax : view.getNorth() }; return mapView; } /** * @author Jon Davis * @version 1.3.1 */ var using = window.using = function( scriptName, callback, context ) { function durl(sc) { var su = sc; if (sc && sc.substring(0, 4) == "url(") { su = sc.substring(4, sc.length - 1); } var r = using.registered[su]; return (!r && (!using.__durls || !using.__durls[su]) && sc && sc.length > 4 && sc.substring(0, 4) == "url("); } var a=-1; var scriptNames = new Array(); if (typeof(scriptName) != "string" && scriptName.length) { var _scriptNames = scriptName; for (var s=0;s<_scriptNames.length; s++) { if (using.registered[_scriptNames[s]] || durl(_scriptNames[s])) { scriptNames.push(_scriptNames[s]); } } scriptName = scriptNames[0]; a=1; } else { while (typeof(arguments[++a]) == "string") { if (using.registered[scriptName] || durl(scriptName)) { scriptNames.push(arguments[a]); } } } callback = arguments[a]; context = arguments[++a]; if (scriptNames.length > 1) { var cb = callback; callback = function() { using(scriptNames, cb, context); } } var reg = using.registered[scriptName]; if (!using.__durls) using.__durls = {}; if (durl(scriptName) && scriptName.substring(0, 4) == "url(") { scriptName = scriptName.substring(4, scriptName.length - 1); if (!using.__durls[scriptName]) { scriptNames[0] = scriptName; using.register(scriptName, true, scriptName); reg = using.registered[scriptName]; var callbackQueue = using.prototype.getCallbackQueue(scriptName); var cbitem = new using.prototype.CallbackItem(function() { using.__durls[scriptName] = true; }); callbackQueue.push(cbitem); callbackQueue.push(new using.prototype.CallbackItem(callback, context)); callback = undefined; context = undefined; } } if (reg) { // load dependencies first for (var r=reg.requirements.length-1; r>=0; r--) { if (using.registered[reg.requirements[r].name]) { using(reg.requirements[r].name, function() { using(scriptName, callback, context); }, context); return; } } // load each script URL for (var u=0; u 2) return; } if (remote) { using.srcScript(scriptUrl, asyncWait, callbackQueue); } else { var xhr; if (window.XMLHttpRequest) xhr = new XMLHttpRequest(); else if (window.ActiveXObject) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } xhr.onreadystatechange = function(){ if (xhr.readyState == 4 && xhr.status == 200) { using.injectScript(xhr.responseText, scriptName); if (callbackQueue) { for (var q=0; q 0 || callbackQueue.length > 1) { xhr.open("GET", scriptUrl, true); } else { xhr.open("GET", scriptUrl, false); } xhr.send(null); } }, genScriptNode : function() { var scriptNode = document.createElement("script"); scriptNode.setAttribute("type", "text/javascript"); scriptNode.setAttribute("language", "JavaScript"); return scriptNode; }, srcScript : function(scriptUrl, asyncWait, callbackQueue) { var scriptNode = using.prototype.genScriptNode(); scriptNode.setAttribute("src", scriptUrl); if (callbackQueue) { var execQueue = function() { using.__callbackQueue[scriptUrl] = undefined; for (var q=0; q 0) { setTimeout(execQueue, asyncWait); } else { execQueue(); } } }; } var headNode = document.getElementsByTagName("head")[0]; headNode.appendChild(scriptNode); }, injectScript : function(scriptText, scriptName) { var scriptNode = using.prototype.genScriptNode(); try { scriptNode.setAttribute("name", scriptName); } catch (err) { } scriptNode.text = scriptText; var headNode = document.getElementsByTagName("head")[0]; headNode.appendChild(scriptNode); } }; using.register = using.prototype.register; using.load = using.prototype.load; using.wait = using.prototype.wait; using.defaultAsyncWait = using.prototype.defaultAsyncWait; using.srcScript = using.prototype.srcScript; using.injectScript = using.prototype.injectScript; //Make sure registered always exists. -MW 5/1/08 using.registered = { }; /** * @class * Interface for Styles classes. * Current supported types: SldPath, SldBody */ Dmp.Drawing.IStyle= function() { var _styleValue = ""; var _attributeLink = ""; /** * Sets the style, whether the value should be a Path or a Body depends on the inherited class */ this.setStyleValue = function( val ) { _styleValue = val; } this.getStyleValue = function() { return _styleValue; } this.setAttributeLink = function( val ) { _attributeLink = val; } this.getAttributeLink = function() { return _attributeLink; } } /** * @class * SldStyle contains a path (as a string) to the location of the SLD definition. * @requires {IStyle} * @see Dmp.Drawing.IStyle * @params {String} sldBody. Path to the SLD definition. Can be set after initialization. Optional. * @params {String} attLink. Attribute link for this SLD. Can be set after initialization. Optional. */ Dmp.Drawing.SldStyle = function(sldPath, attLink) { var _self = this; var _sldPath = sldPath; this.base = Dmp.Drawing.IStyle; this.base(); this.setStyleValue(sldPath); this.setAttributeLink(attLink); this.getType = function(){ return "path"; } /** * Accessor to this Style object's style * @returns the value of the style. In this case, a path to the SLD definition. * @type {String} * @deprecated. use getStyleValue() */ this.styleValue = function() { return _sldPath; } /** * @deprecated */ this.getSldPath = function() { return _sldPath; } /** * Serializes this style object into an xml string, mainly used for creaing map composition files. * @returns string of the form: * @type {String} */ this.toXml = function() { var xml = " * @type {String} */ this.toXml = function() { var xml = "