Merged r1559:r1587 from source:/sandbox/crschmidt/noprototype. OpenLayers is now Prototype-free(tm).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1588 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -13,7 +13,9 @@
|
||||
|
||||
*/
|
||||
|
||||
/* Prototype JavaScript framework, version 1.4.0
|
||||
/* Contains portions of Prototype.js:
|
||||
*
|
||||
* Prototype JavaScript framework, version 1.4.0
|
||||
* (c) 2005 Sam Stephenson <sam@conio.net>
|
||||
*
|
||||
* Prototype is freely distributable under the terms of an MIT-style license.
|
||||
|
||||
@@ -48,11 +48,11 @@ if (typeof(_OPENLAYERS_SFL_) == "undefined") {
|
||||
*/
|
||||
(function() {
|
||||
var jsfiles=new Array(
|
||||
"Prototype.js",
|
||||
"Rico/Corner.js",
|
||||
"Rico/Color.js",
|
||||
"OpenLayers/BaseTypes.js",
|
||||
"OpenLayers/Util.js",
|
||||
"OpenLayers/Prototype.js",
|
||||
"Rico/Corner.js",
|
||||
"Rico/Color.js",
|
||||
"OpenLayers/Ajax.js",
|
||||
"OpenLayers/Events.js",
|
||||
"OpenLayers/Map.js",
|
||||
|
||||
@@ -60,7 +60,7 @@ OpenLayers.loadURL = function(uri, params, caller,
|
||||
: OpenLayers.nullHandler;
|
||||
|
||||
// from prototype.js
|
||||
new Ajax.Request(uri,
|
||||
new OpenLayers.Ajax.Request(uri,
|
||||
{ method: 'get',
|
||||
parameters: params,
|
||||
onComplete: success,
|
||||
@@ -83,7 +83,7 @@ OpenLayers.parseXMLString = function(text) {
|
||||
text = text.substring(index);
|
||||
}
|
||||
|
||||
var ajaxResponse = Try.these(
|
||||
var ajaxResponse = OpenLayers.Util.Try(
|
||||
function() {
|
||||
var xmldom = new ActiveXObject('Microsoft.XMLDOM');
|
||||
xmldom.loadXML(text);
|
||||
@@ -106,3 +106,197 @@ OpenLayers.parseXMLString = function(text) {
|
||||
|
||||
return ajaxResponse;
|
||||
};
|
||||
|
||||
OpenLayers.Ajax = {
|
||||
emptyFunction: function () {},
|
||||
|
||||
getTransport: function() {
|
||||
return OpenLayers.Util.Try(
|
||||
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
|
||||
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
|
||||
function() {return new XMLHttpRequest()}
|
||||
) || false;
|
||||
},
|
||||
|
||||
activeRequestCount: 0
|
||||
};
|
||||
|
||||
OpenLayers.Ajax.Responders = {
|
||||
responders: [],
|
||||
|
||||
register: function(responderToAdd) {
|
||||
for (var i = 0; i < this.responders.length; i++)
|
||||
if (responderToAdd == this.responders[i])
|
||||
return;
|
||||
this.responders.push(responderToAdd);
|
||||
},
|
||||
|
||||
dispatch: function(callback, request, transport, json) {
|
||||
for (var i = 0; i < this.responders.length; i++) {
|
||||
responder = this.responders[i];
|
||||
if (responder[callback] && typeof responder[callback] == 'function') {
|
||||
try {
|
||||
responder[callback].apply(responder, [request, transport, json]);
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
OpenLayers.Ajax.Responders.register({
|
||||
onCreate: function() {
|
||||
OpenLayers.Ajax.activeRequestCount++;
|
||||
},
|
||||
|
||||
onComplete: function() {
|
||||
OpenLayers.Ajax.activeRequestCount--;
|
||||
}
|
||||
});
|
||||
|
||||
OpenLayers.Ajax.Base = function() {};
|
||||
OpenLayers.Ajax.Base.prototype = {
|
||||
setOptions: function(options) {
|
||||
this.options = {
|
||||
method: 'post',
|
||||
asynchronous: true,
|
||||
parameters: ''
|
||||
}
|
||||
OpenLayers.Util.extend(this.options, options || {});
|
||||
},
|
||||
|
||||
responseIsSuccess: function() {
|
||||
return this.transport.status == undefined
|
||||
|| this.transport.status == 0
|
||||
|| (this.transport.status >= 200 && this.transport.status < 300);
|
||||
},
|
||||
|
||||
responseIsFailure: function() {
|
||||
return !this.responseIsSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
OpenLayers.Ajax.Request = OpenLayers.Class.create();
|
||||
OpenLayers.Ajax.Request.Events =
|
||||
['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
|
||||
|
||||
OpenLayers.Ajax.Request.prototype = OpenLayers.Util.extend(new OpenLayers.Ajax.Base(), {
|
||||
initialize: function(url, options) {
|
||||
this.transport = OpenLayers.Ajax.getTransport();
|
||||
this.setOptions(options);
|
||||
this.request(url);
|
||||
},
|
||||
|
||||
request: function(url) {
|
||||
var parameters = this.options.parameters || '';
|
||||
if (parameters.length > 0) parameters += '&_=';
|
||||
|
||||
try {
|
||||
this.url = url;
|
||||
if (this.options.method == 'get' && parameters.length > 0)
|
||||
this.url += (this.url.match(/\?/) ? '&' : '?') + parameters;
|
||||
|
||||
OpenLayers.Ajax.Responders.dispatch('onCreate', this, this.transport);
|
||||
|
||||
this.transport.open(this.options.method, this.url,
|
||||
this.options.asynchronous);
|
||||
|
||||
if (this.options.asynchronous) {
|
||||
this.transport.onreadystatechange = this.onStateChange.bind(this);
|
||||
setTimeout((function() {this.respondToReadyState(1)}).bind(this), 10);
|
||||
}
|
||||
|
||||
this.setRequestHeaders();
|
||||
|
||||
var body = this.options.postBody ? this.options.postBody : parameters;
|
||||
this.transport.send(this.options.method == 'post' ? body : null);
|
||||
|
||||
} catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
},
|
||||
|
||||
setRequestHeaders: function() {
|
||||
var requestHeaders =
|
||||
['X-Requested-With', 'XMLHttpRequest',
|
||||
'X-Prototype-Version', 'OpenLayers'];
|
||||
|
||||
if (this.options.method == 'post') {
|
||||
requestHeaders.push('Content-type',
|
||||
'application/x-www-form-urlencoded');
|
||||
|
||||
/* Force "Connection: close" for Mozilla browsers to work around
|
||||
* a bug where XMLHttpReqeuest sends an incorrect Content-length
|
||||
* header. See Mozilla Bugzilla #246651.
|
||||
*/
|
||||
if (this.transport.overrideMimeType)
|
||||
requestHeaders.push('Connection', 'close');
|
||||
}
|
||||
|
||||
if (this.options.requestHeaders)
|
||||
requestHeaders.push.apply(requestHeaders, this.options.requestHeaders);
|
||||
|
||||
for (var i = 0; i < requestHeaders.length; i += 2)
|
||||
this.transport.setRequestHeader(requestHeaders[i], requestHeaders[i+1]);
|
||||
},
|
||||
|
||||
onStateChange: function() {
|
||||
var readyState = this.transport.readyState;
|
||||
if (readyState != 1)
|
||||
this.respondToReadyState(this.transport.readyState);
|
||||
},
|
||||
|
||||
header: function(name) {
|
||||
try {
|
||||
return this.transport.getResponseHeader(name);
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
evalJSON: function() {
|
||||
try {
|
||||
return eval(this.header('X-JSON'));
|
||||
} catch (e) {}
|
||||
},
|
||||
|
||||
evalResponse: function() {
|
||||
try {
|
||||
return eval(this.transport.responseText);
|
||||
} catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
},
|
||||
|
||||
respondToReadyState: function(readyState) {
|
||||
var event = OpenLayers.Ajax.Request.Events[readyState];
|
||||
var transport = this.transport, json = this.evalJSON();
|
||||
|
||||
if (event == 'Complete') {
|
||||
try {
|
||||
(this.options['on' + this.transport.status]
|
||||
|| this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
|
||||
|| OpenLayers.Ajax.emptyFunction)(transport, json);
|
||||
} catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
|
||||
if ((this.header('Content-type') || '').match(/^text\/javascript/i))
|
||||
this.evalResponse();
|
||||
}
|
||||
|
||||
try {
|
||||
(this.options['on' + event] || OpenLayers.Ajax.emptyFunction)(transport, json);
|
||||
OpenLayers.Ajax.Responders.dispatch('on' + event, this, transport, json);
|
||||
} catch (e) {
|
||||
this.dispatchException(e);
|
||||
}
|
||||
|
||||
/* Avoid memory leak in MSIE: clean up the oncomplete event handler */
|
||||
if (event == 'Complete')
|
||||
this.transport.onreadystatechange = OpenLayers.Ajax.emptyFunction;
|
||||
},
|
||||
|
||||
dispatchException: function(exception) {
|
||||
(this.options.onException || OpenLayers.Ajax.emptyFunction)(this, exception);
|
||||
OpenLayers.Ajax.Responders.dispatch('onException', this, exception);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
|
||||
* text of the license. */
|
||||
|
||||
/* OpenLayers.Class metaclass */
|
||||
OpenLayers.Class = {
|
||||
create: function() {
|
||||
return function() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*********************
|
||||
* *
|
||||
@@ -9,13 +17,12 @@
|
||||
* *
|
||||
*********************/
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* This class represents a screen coordinate, in x and y coordinates
|
||||
*/
|
||||
OpenLayers.Pixel = Class.create();
|
||||
OpenLayers.Pixel = OpenLayers.Class.create();
|
||||
OpenLayers.Pixel.prototype = {
|
||||
|
||||
/** @type float */
|
||||
@@ -106,7 +113,7 @@ OpenLayers.Pixel.prototype = {
|
||||
*
|
||||
* This class represents a width and height pair
|
||||
*/
|
||||
OpenLayers.Size = Class.create();
|
||||
OpenLayers.Size = OpenLayers.Class.create();
|
||||
OpenLayers.Size.prototype = {
|
||||
|
||||
/** @type float */
|
||||
@@ -177,7 +184,7 @@ OpenLayers.Size.prototype = {
|
||||
*
|
||||
* This class represents a longitude and latitude pair
|
||||
*/
|
||||
OpenLayers.LonLat = Class.create();
|
||||
OpenLayers.LonLat = OpenLayers.Class.create();
|
||||
OpenLayers.LonLat.prototype = {
|
||||
|
||||
/** @type float */
|
||||
@@ -290,7 +297,7 @@ OpenLayers.LonLat.fromString = function(str) {
|
||||
* This class represents a bounding box.
|
||||
* Data stored as left, bottom, right, top floats
|
||||
*/
|
||||
OpenLayers.Bounds = Class.create();
|
||||
OpenLayers.Bounds = OpenLayers.Class.create();
|
||||
OpenLayers.Bounds.prototype = {
|
||||
|
||||
/** @type float */
|
||||
@@ -652,7 +659,88 @@ OpenLayers.Bounds.oppositeQuadrant = function(quadrant) {
|
||||
};
|
||||
|
||||
|
||||
/*********************
|
||||
* *
|
||||
* ELEMENT *
|
||||
* *
|
||||
*********************/
|
||||
|
||||
OpenLayers.Element = {
|
||||
visible: function(element) {
|
||||
return $(element).style.display != 'none';
|
||||
},
|
||||
|
||||
toggle: function() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = $(arguments[i]);
|
||||
OpenLayers.Element[OpenLayers.Element.visible(element) ? 'hide' : 'show'](element);
|
||||
}
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = $(arguments[i]);
|
||||
element.style.display = 'none';
|
||||
}
|
||||
},
|
||||
|
||||
show: function() {
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = $(arguments[i]);
|
||||
element.style.display = '';
|
||||
}
|
||||
},
|
||||
|
||||
remove: function(element) {
|
||||
element = $(element);
|
||||
element.parentNode.removeChild(element);
|
||||
},
|
||||
|
||||
getHeight: function(element) {
|
||||
element = $(element);
|
||||
return element.offsetHeight;
|
||||
},
|
||||
|
||||
getDimensions: function(element) {
|
||||
element = $(element);
|
||||
if (OpenLayers.Element.getStyle(element, 'display') != 'none')
|
||||
return {width: element.offsetWidth, height: element.offsetHeight};
|
||||
|
||||
// All *Width and *Height properties give 0 on elements with display none,
|
||||
// so enable the element temporarily
|
||||
var els = element.style;
|
||||
var originalVisibility = els.visibility;
|
||||
var originalPosition = els.position;
|
||||
els.visibility = 'hidden';
|
||||
els.position = 'absolute';
|
||||
els.display = '';
|
||||
var originalWidth = element.clientWidth;
|
||||
var originalHeight = element.clientHeight;
|
||||
els.display = 'none';
|
||||
els.position = originalPosition;
|
||||
els.visibility = originalVisibility;
|
||||
return {width: originalWidth, height: originalHeight};
|
||||
},
|
||||
|
||||
getStyle: function(element, style) {
|
||||
element = $(element);
|
||||
var value = element.style[style.camelize()];
|
||||
if (!value) {
|
||||
if (document.defaultView && document.defaultView.getComputedStyle) {
|
||||
var css = document.defaultView.getComputedStyle(element, null);
|
||||
value = css ? css.getPropertyValue(style) : null;
|
||||
} else if (element.currentStyle) {
|
||||
value = element.currentStyle[style.camelize()];
|
||||
}
|
||||
}
|
||||
|
||||
if (window.opera && ['left', 'top', 'right', 'bottom'].include(style))
|
||||
if (OpenLayers.Element.getStyle(element, 'position') == 'static') value = 'auto';
|
||||
|
||||
return value == 'auto' ? null : value;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*********************
|
||||
* *
|
||||
@@ -660,8 +748,6 @@ OpenLayers.Bounds.oppositeQuadrant = function(quadrant) {
|
||||
* *
|
||||
*********************/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param {String} sStart
|
||||
*
|
||||
@@ -703,6 +789,28 @@ String.prototype.trim = function() {
|
||||
};
|
||||
|
||||
|
||||
String.indexOf = function(object) {
|
||||
for (var i = 0; i < this.length; i++)
|
||||
if (this[i] == object) return i;
|
||||
return -1;
|
||||
};
|
||||
|
||||
String.prototype.camelize = function() {
|
||||
var oStringList = this.split('-');
|
||||
if (oStringList.length == 1) return oStringList[0];
|
||||
|
||||
var camelizedString = this.indexOf('-') == 0
|
||||
? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1)
|
||||
: oStringList[0];
|
||||
|
||||
for (var i = 1, len = oStringList.length; i < len; i++) {
|
||||
var s = oStringList[i];
|
||||
camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
|
||||
}
|
||||
|
||||
return camelizedString;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*********************
|
||||
@@ -756,8 +864,6 @@ Array.prototype.clear = function() {
|
||||
* *
|
||||
*********************/
|
||||
|
||||
|
||||
|
||||
/** NOTE: Works only with integer values does *not* work with floats!
|
||||
*
|
||||
* @param {int} sig
|
||||
@@ -774,3 +880,28 @@ Number.prototype.limitSigDigs = function(sig) {
|
||||
}
|
||||
return parseInt(number);
|
||||
}
|
||||
|
||||
|
||||
/*********************
|
||||
* *
|
||||
* FUNCTION *
|
||||
* *
|
||||
*********************/
|
||||
|
||||
Function.prototype.bind = function() {
|
||||
var __method = this, args = [], object = arguments[0];
|
||||
for (var i = 1; i < arguments.length; i++)
|
||||
args.push(arguments[i]);
|
||||
return function(moreargs) {
|
||||
for (var i = 0; i < arguments.length; i++)
|
||||
args.push(arguments[i]);
|
||||
return __method.apply(object, args);
|
||||
}
|
||||
};
|
||||
|
||||
Function.prototype.bindAsEventListener = function(object) {
|
||||
var __method = this;
|
||||
return function(event) {
|
||||
return __method.call(object, event || window.event);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Control = Class.create();
|
||||
OpenLayers.Control = OpenLayers.Class.create();
|
||||
OpenLayers.Control.prototype = {
|
||||
|
||||
/** @type String */
|
||||
@@ -30,7 +30,7 @@ OpenLayers.Control.prototype = {
|
||||
* @param {Object} options
|
||||
*/
|
||||
initialize: function (options) {
|
||||
Object.extend(this, options);
|
||||
OpenLayers.Util.extend(this, options);
|
||||
|
||||
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
|
||||
},
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.KeyboardDefaults = Class.create();
|
||||
OpenLayers.Control.KeyboardDefaults = OpenLayers.Class.create();
|
||||
OpenLayers.Control.KeyboardDefaults.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type int */
|
||||
slideFactor: 50,
|
||||
@@ -25,7 +25,7 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
||||
*
|
||||
*/
|
||||
draw: function() {
|
||||
Event.observe(document,
|
||||
OpenLayers.Event.observe(document,
|
||||
'keypress',
|
||||
this.defaultKeyDown.bind(this));
|
||||
},
|
||||
@@ -35,16 +35,16 @@ OpenLayers.Control.KeyboardDefaults.prototype =
|
||||
*/
|
||||
defaultKeyDown: function (evt) {
|
||||
switch(evt.keyCode) {
|
||||
case Event.KEY_LEFT:
|
||||
case OpenLayers.Event.KEY_LEFT:
|
||||
this.map.pan(-50, 0);
|
||||
break;
|
||||
case Event.KEY_RIGHT:
|
||||
case OpenLayers.Event.KEY_RIGHT:
|
||||
this.map.pan(50, 0);
|
||||
break;
|
||||
case Event.KEY_UP:
|
||||
case OpenLayers.Event.KEY_UP:
|
||||
this.map.pan(0, -50);
|
||||
break;
|
||||
case Event.KEY_DOWN:
|
||||
case OpenLayers.Event.KEY_DOWN:
|
||||
this.map.pan(0, 50);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.LayerSwitcher = Class.create();
|
||||
OpenLayers.Control.LayerSwitcher = OpenLayers.Class.create();
|
||||
OpenLayers.Control.LayerSwitcher.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type String */
|
||||
activeColor: "darkblue",
|
||||
@@ -129,10 +129,11 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
inputElem.defaultChecked = checked;
|
||||
inputElem.layer = layer;
|
||||
inputElem.control = this;
|
||||
|
||||
if (!baseLayer && !layer.inRange()) {
|
||||
inputElem.disabled = true;
|
||||
}
|
||||
Event.observe(inputElem, "mouseup",
|
||||
OpenLayers.Event.observe(inputElem, "mouseup",
|
||||
this.onInputClick.bindAsEventListener(inputElem));
|
||||
|
||||
// create span
|
||||
@@ -142,7 +143,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
}
|
||||
labelSpan.innerHTML = layer.name;
|
||||
labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "baseline";
|
||||
Event.observe(labelSpan, "click",
|
||||
OpenLayers.Event.observe(labelSpan, "click",
|
||||
this.onInputClick.bindAsEventListener(inputElem));
|
||||
// create line break
|
||||
var br = document.createElement("br");
|
||||
@@ -185,7 +186,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.control.updateMap();
|
||||
}
|
||||
}
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
},
|
||||
|
||||
/** Need to update the map accordingly whenever user clicks in either of
|
||||
@@ -237,7 +238,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.showControls(false);
|
||||
|
||||
if (e != null) {
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -254,7 +255,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.showControls(true);
|
||||
|
||||
if (e != null) {
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -292,13 +293,13 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.div.style.color = "white";
|
||||
this.div.style.backgroundColor = "transparent";
|
||||
|
||||
Event.observe(this.div, "mouseup",
|
||||
OpenLayers.Event.observe(this.div, "mouseup",
|
||||
this.mouseUp.bindAsEventListener(this));
|
||||
Event.observe(this.div, "click",
|
||||
OpenLayers.Event.observe(this.div, "click",
|
||||
this.ignoreEvent);
|
||||
Event.observe(this.div, "mousedown",
|
||||
OpenLayers.Event.observe(this.div, "mousedown",
|
||||
this.mouseDown.bindAsEventListener(this));
|
||||
Event.observe(this.div, "dblclick", this.ignoreEvent);
|
||||
OpenLayers.Event.observe(this.div, "dblclick", this.ignoreEvent);
|
||||
|
||||
|
||||
// layers list div
|
||||
@@ -325,7 +326,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
|
||||
this.baseLayersDiv = document.createElement("div");
|
||||
this.baseLayersDiv.style.paddingLeft = "10px";
|
||||
/*Event.observe(this.baseLayersDiv, "click",
|
||||
/*OpenLayers.Event.observe(this.baseLayersDiv, "click",
|
||||
this.onLayerClick.bindAsEventListener(this));
|
||||
*/
|
||||
|
||||
@@ -375,7 +376,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.maximizeDiv.style.right = "0px";
|
||||
this.maximizeDiv.style.left = "";
|
||||
this.maximizeDiv.style.display = "none";
|
||||
Event.observe(this.maximizeDiv,
|
||||
OpenLayers.Event.observe(this.maximizeDiv,
|
||||
"click",
|
||||
this.maximizeControl.bindAsEventListener(this));
|
||||
|
||||
@@ -394,7 +395,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.minimizeDiv.style.right = "0px";
|
||||
this.minimizeDiv.style.left = "";
|
||||
this.minimizeDiv.style.display = "none";
|
||||
Event.observe(this.minimizeDiv,
|
||||
OpenLayers.Event.observe(this.minimizeDiv,
|
||||
"click",
|
||||
this.minimizeControl.bindAsEventListener(this));
|
||||
|
||||
@@ -407,7 +408,7 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
ignoreEvent: function(evt) {
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/** Register a local 'mouseDown' flag so that we'll know whether or not
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.MouseDefaults = Class.create();
|
||||
OpenLayers.Control.MouseDefaults = OpenLayers.Class.create();
|
||||
OpenLayers.Control.MouseDefaults.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type Boolean */
|
||||
performedDrag: false,
|
||||
@@ -21,11 +21,11 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||
|
||||
//register mousewheel events specifically on the window and document
|
||||
Event.observe(window, "DOMMouseScroll",
|
||||
OpenLayers.Event.observe(window, "DOMMouseScroll",
|
||||
this.onWheelEvent.bindAsEventListener(this));
|
||||
Event.observe(window, "mousewheel",
|
||||
OpenLayers.Event.observe(window, "mousewheel",
|
||||
this.onWheelEvent.bindAsEventListener(this));
|
||||
Event.observe(document, "mousewheel",
|
||||
OpenLayers.Event.observe(document, "mousewheel",
|
||||
this.onWheelEvent.bindAsEventListener(this));
|
||||
},
|
||||
|
||||
@@ -47,7 +47,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
* @type Boolean
|
||||
*/
|
||||
defaultClick: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
var notAfterDrag = !this.performedDrag;
|
||||
this.performedDrag = false;
|
||||
return notAfterDrag;
|
||||
@@ -59,7 +59,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
defaultDblClick: function (evt) {
|
||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -67,7 +67,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseDown: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.performedDrag = false;
|
||||
if (evt.shiftKey) {
|
||||
@@ -86,7 +86,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
this.map.viewPortDiv.appendChild(this.zoomBox);
|
||||
}
|
||||
document.onselectstart=function() { return false; }
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -124,7 +124,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseUp: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
if (this.zoomBox) {
|
||||
this.zoomBoxEnd(evt);
|
||||
} else {
|
||||
@@ -217,7 +217,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
|
||||
// first determine whether or not the wheeling was inside the map
|
||||
var inMap = false;
|
||||
var elem = Event.element(e);
|
||||
var elem = OpenLayers.Event.element(e);
|
||||
while(elem != null) {
|
||||
if (this.map && elem == this.map.div) {
|
||||
inMap = true;
|
||||
@@ -249,7 +249,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
}
|
||||
|
||||
//only wheel the map, not the window
|
||||
Event.stop(e);
|
||||
OpenLayers.Event.stop(e);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
* @requires OpenLayers/Control.js
|
||||
* @requires OpenLayers/Control/MouseDefaults.js
|
||||
*/
|
||||
OpenLayers.Control.MouseToolbar = Class.create();
|
||||
OpenLayers.Control.MouseToolbar = OpenLayers.Class.create();
|
||||
OpenLayers.Control.MouseToolbar.X = 6;
|
||||
OpenLayers.Control.MouseToolbar.Y = 300;
|
||||
OpenLayers.Control.MouseToolbar.prototype =
|
||||
Object.extend( new OpenLayers.Control(),
|
||||
Object.extend( new OpenLayers.Control.MouseDefaults(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(),
|
||||
OpenLayers.Util.extend( new OpenLayers.Control.MouseDefaults(), {
|
||||
|
||||
mode: null,
|
||||
|
||||
@@ -68,7 +68,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
btn.events = new OpenLayers.Events(this, btn, null, true);
|
||||
btn.events.register("mousedown", this, this.buttonDown);
|
||||
btn.events.register("mouseup", this, this.buttonUp);
|
||||
btn.events.register("dblclick", this, Event.stop);
|
||||
btn.events.register("dblclick", this, OpenLayers.Event.stop);
|
||||
btn.action = id;
|
||||
btn.title = title;
|
||||
btn.alt = title;
|
||||
@@ -83,21 +83,21 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonDown: function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.buttonClicked = evt.element.action;
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonUp: function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
if (this.buttonClicked != null) {
|
||||
if (this.buttonClicked == evt.element.action) {
|
||||
this.switchModeTo(evt.element.action);
|
||||
}
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
this.buttonClicked = null;
|
||||
}
|
||||
},
|
||||
@@ -110,7 +110,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
this.performedDrag = false;
|
||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -118,7 +118,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseDown: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.performedDrag = false;
|
||||
this.startViaKeyboard = false;
|
||||
@@ -194,7 +194,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
break;
|
||||
}
|
||||
document.onselectstart = function() { return false; }
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
switchModeTo: function(mode) {
|
||||
@@ -269,7 +269,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseUp: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
switch (this.mode) {
|
||||
case "zoombox":
|
||||
this.zoomBoxEnd(evt);
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.PanZoom = Class.create();
|
||||
OpenLayers.Control.PanZoom = OpenLayers.Class.create();
|
||||
OpenLayers.Control.PanZoom.X = 4;
|
||||
OpenLayers.Control.PanZoom.Y = 4;
|
||||
OpenLayers.Control.PanZoom.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type int */
|
||||
slideFactor: 50,
|
||||
@@ -101,7 +101,7 @@ OpenLayers.Control.PanZoom.prototype =
|
||||
* @type Boolean
|
||||
*/
|
||||
doubleClick: function (evt) {
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
@@ -109,7 +109,7 @@ OpenLayers.Control.PanZoom.prototype =
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonDown: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
|
||||
switch (this.action) {
|
||||
case "panup":
|
||||
@@ -135,7 +135,7 @@ OpenLayers.Control.PanZoom.prototype =
|
||||
break;
|
||||
}
|
||||
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
*
|
||||
* @requires OpenLayers/Control/PanZoom.js
|
||||
*/
|
||||
OpenLayers.Control.PanZoomBar = Class.create();
|
||||
OpenLayers.Control.PanZoomBar = OpenLayers.Class.create();
|
||||
OpenLayers.Control.PanZoomBar.X = 4;
|
||||
OpenLayers.Control.PanZoomBar.Y = 4;
|
||||
OpenLayers.Control.PanZoomBar.prototype =
|
||||
Object.extend( new OpenLayers.Control.PanZoom(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control.PanZoom(), {
|
||||
|
||||
/** @type Array(...) */
|
||||
buttons: null,
|
||||
@@ -147,12 +147,12 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
* and sets the zoom level appropriately.
|
||||
*/
|
||||
divClick: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
var y = evt.xy.y;
|
||||
var top = Position.page(evt.object)[1];
|
||||
var top = OpenLayers.Util.pagePosition(evt.object)[1];
|
||||
var levels = Math.floor((y - top)/this.zoomStopHeight);
|
||||
this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels);
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
@@ -160,13 +160,13 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
* event listener for clicks on the slider
|
||||
*/
|
||||
zoomBarDown:function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
this.map.events.register("mousemove", this, this.passEventToSlider);
|
||||
this.map.events.register("mouseup", this, this.passEventToSlider);
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.zoomStart = evt.xy.clone();
|
||||
this.div.style.cursor = "move";
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/*
|
||||
@@ -178,14 +178,14 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
zoomBarDrag:function(evt) {
|
||||
if (this.mouseDragStart != null) {
|
||||
var deltaY = this.mouseDragStart.y - evt.xy.y
|
||||
var offsets = Position.page(this.zoombarDiv);
|
||||
var offsets = OpenLayers.Util.pagePosition(this.zoombarDiv);
|
||||
if ((evt.clientY - offsets[1]) > 0 &&
|
||||
(evt.clientY - offsets[1]) < parseInt(this.zoombarDiv.style.height) - 2) {
|
||||
var newTop = parseInt(this.slider.style.top) - deltaY;
|
||||
this.slider.style.top = newTop+"px";
|
||||
}
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -195,7 +195,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
* and switch to it.
|
||||
*/
|
||||
zoomBarUp:function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (!OpenLayers.Event.isLeftClick(evt)) return;
|
||||
if (this.zoomStart) {
|
||||
this.div.style.cursor="default";
|
||||
this.map.events.unregister("mouseup", this, this.passEventToSlider);
|
||||
@@ -204,7 +204,7 @@ OpenLayers.Control.PanZoomBar.prototype =
|
||||
this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight));
|
||||
this.moveZoomBar();
|
||||
this.mouseDragStart = null;
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.Permalink = Class.create();
|
||||
OpenLayers.Control.Permalink = OpenLayers.Class.create();
|
||||
OpenLayers.Control.Permalink.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
|
||||
/** @type DOMElement */
|
||||
element: null,
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Control.js
|
||||
*/
|
||||
OpenLayers.Control.Scale = Class.create();
|
||||
OpenLayers.Control.Scale = OpenLayers.Class.create();
|
||||
OpenLayers.Control.Scale.prototype =
|
||||
Object.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
/** @type DOMElement */
|
||||
element: null,
|
||||
|
||||
|
||||
@@ -2,10 +2,121 @@
|
||||
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
|
||||
* text of the license. */
|
||||
|
||||
OpenLayers.Event = {
|
||||
KEY_BACKSPACE: 8,
|
||||
KEY_TAB: 9,
|
||||
KEY_RETURN: 13,
|
||||
KEY_ESC: 27,
|
||||
KEY_LEFT: 37,
|
||||
KEY_UP: 38,
|
||||
KEY_RIGHT: 39,
|
||||
KEY_DOWN: 40,
|
||||
KEY_DELETE: 46,
|
||||
|
||||
element: function(event) {
|
||||
return event.target || event.srcElement;
|
||||
},
|
||||
|
||||
isLeftClick: function(event) {
|
||||
return (((event.which) && (event.which == 1)) ||
|
||||
((event.button) && (event.button == 1)));
|
||||
},
|
||||
|
||||
pointerX: function(event) {
|
||||
return event.pageX || (event.clientX +
|
||||
(document.documentElement.scrollLeft || document.body.scrollLeft));
|
||||
},
|
||||
|
||||
pointerY: function(event) {
|
||||
return event.pageY || (event.clientY +
|
||||
(document.documentElement.scrollTop || document.body.scrollTop));
|
||||
},
|
||||
|
||||
stop: function(event) {
|
||||
if (event.preventDefault) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
} else {
|
||||
event.returnValue = false;
|
||||
event.cancelBubble = true;
|
||||
}
|
||||
},
|
||||
|
||||
// find the first node with the given tagName, starting from the
|
||||
// node the event was triggered on; traverses the DOM upwards
|
||||
findElement: function(event, tagName) {
|
||||
var element = OpenLayers.Event.element(event);
|
||||
while (element.parentNode && (!element.tagName ||
|
||||
(element.tagName.toUpperCase() != tagName.toUpperCase())))
|
||||
element = element.parentNode;
|
||||
return element;
|
||||
},
|
||||
|
||||
observers: false,
|
||||
|
||||
_observeAndCache: function(element, name, observer, useCapture) {
|
||||
if (!this.observers) this.observers = [];
|
||||
if (element.addEventListener) {
|
||||
this.observers.push([element, name, observer, useCapture]);
|
||||
element.addEventListener(name, observer, useCapture);
|
||||
} else if (element.attachEvent) {
|
||||
this.observers.push([element, name, observer, useCapture]);
|
||||
element.attachEvent('on' + name, observer);
|
||||
}
|
||||
},
|
||||
|
||||
unloadCache: function() {
|
||||
if (!OpenLayers.Event.observers) return;
|
||||
for (var i = 0; i < OpenLayers.Event.observers.length; i++) {
|
||||
OpenLayers.Event.stopObserving.apply(this, OpenLayers.Event.observers[i]);
|
||||
OpenLayers.Event.observers[i][0] = null;
|
||||
}
|
||||
OpenLayers.Event.observers = false;
|
||||
},
|
||||
|
||||
observe: function(elementParam, name, observer, useCapture) {
|
||||
var element = $(elementParam);
|
||||
useCapture = useCapture || false;
|
||||
|
||||
if (name == 'keypress' &&
|
||||
(navigator.appVersion.match(/Konqueror|Safari|KHTML/)
|
||||
|| element.attachEvent))
|
||||
name = 'keydown';
|
||||
|
||||
this._observeAndCache(element, name, observer, useCapture);
|
||||
},
|
||||
|
||||
stopObserving: function(elementParam, name, observer, useCapture) {
|
||||
var element = $(elementParam);
|
||||
useCapture = useCapture || false;
|
||||
|
||||
if (name == 'keypress' &&
|
||||
(navigator.appVersion.match(/Konqueror|Safari|KHTML/)
|
||||
|| element.detachEvent))
|
||||
name = 'keydown';
|
||||
|
||||
if (element.removeEventListener) {
|
||||
element.removeEventListener(name, observer, useCapture);
|
||||
} else if (element.detachEvent) {
|
||||
element.detachEvent('on' + name, observer);
|
||||
}
|
||||
}
|
||||
};
|
||||
/* prevent memory leaks in IE */
|
||||
OpenLayers.Event.observe(window, 'unload', OpenLayers.Event.unloadCache, false);
|
||||
|
||||
if (window.Event) {
|
||||
OpenLayers.Util.extend(window.Event, OpenLayers.Event);
|
||||
} else {
|
||||
var Event = OpenLayers.Event;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Events = Class.create();
|
||||
OpenLayers.Events = OpenLayers.Class.create();
|
||||
OpenLayers.Events.prototype = {
|
||||
|
||||
/** @final @type Array: supported events */
|
||||
@@ -29,7 +140,6 @@ OpenLayers.Events.prototype = {
|
||||
/** @type Array: list of support application events */
|
||||
eventTypes: null,
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
@@ -72,11 +182,11 @@ OpenLayers.Events.prototype = {
|
||||
this.listeners[eventType] = new Array();
|
||||
|
||||
// use Prototype to register the event cross-browser
|
||||
Event.observe(element, eventType,
|
||||
OpenLayers.Event.observe(element, eventType,
|
||||
this.handleBrowserEvent.bindAsEventListener(this));
|
||||
}
|
||||
// disable dragstart in IE so that mousedown/move/up works normally
|
||||
Event.observe(element, "dragstart", Event.stop);
|
||||
OpenLayers.Event.observe(element, "dragstart", OpenLayers.Event.stop);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -180,7 +290,7 @@ OpenLayers.Events.prototype = {
|
||||
}
|
||||
// don't fall through to other DOM elements
|
||||
if (!this.fallThrough) {
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -208,11 +318,13 @@ OpenLayers.Events.prototype = {
|
||||
*/
|
||||
getMousePosition: function (evt) {
|
||||
if (!this.element.offsets) {
|
||||
this.element.offsets = Position.page(this.element);
|
||||
this.element.offsets = OpenLayers.Util.pagePosition(this.element);
|
||||
}
|
||||
return new OpenLayers.Pixel(
|
||||
(evt.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) - this.element.offsets[0],
|
||||
(evt.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) - this.element.offsets[1]
|
||||
(evt.clientX + (document.documentElement.scrollLeft
|
||||
|| document.body.scrollLeft)) - this.element.offsets[0],
|
||||
(evt.clientY + (document.documentElement.scrollTop
|
||||
|| document.body.scrollTop)) - this.element.offsets[1]
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* @requires OpenLayers/Util.js
|
||||
*/
|
||||
OpenLayers.Feature = Class.create();
|
||||
OpenLayers.Feature = OpenLayers.Class.create();
|
||||
OpenLayers.Feature.prototype= {
|
||||
|
||||
/** @type OpenLayers.Events */
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Feature.js
|
||||
*/
|
||||
OpenLayers.Feature.WFS = Class.create();
|
||||
OpenLayers.Feature.WFS = OpenLayers.Class.create();
|
||||
OpenLayers.Feature.WFS.prototype =
|
||||
Object.extend( new OpenLayers.Feature(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Feature(), {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Icon = Class.create();
|
||||
OpenLayers.Icon = OpenLayers.Class.create();
|
||||
OpenLayers.Icon.prototype = {
|
||||
|
||||
/** image url
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Layer = Class.create();
|
||||
OpenLayers.Layer = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.prototype = {
|
||||
|
||||
/** @type String */
|
||||
@@ -99,10 +99,10 @@ OpenLayers.Layer.prototype = {
|
||||
if (arguments.length > 0) {
|
||||
|
||||
//store a copy of the custom options for later cloning
|
||||
this.options = Object.extend(new Object(), options);
|
||||
this.options = OpenLayers.Util.extend(new Object(), options);
|
||||
|
||||
//add options to layer
|
||||
Object.extend(this, this.options);
|
||||
OpenLayers.Util.extend(this, this.options);
|
||||
|
||||
this.name = name;
|
||||
|
||||
@@ -166,10 +166,10 @@ OpenLayers.Layer.prototype = {
|
||||
addOptions: function (newOptions) {
|
||||
|
||||
// update our copy for clone
|
||||
Object.extend(this.options, newOptions);
|
||||
OpenLayers.Util.extend(this.options, newOptions);
|
||||
|
||||
// add new options to this
|
||||
Object.extend(this, this.options);
|
||||
OpenLayers.Util.extend(this, this.options);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
*/
|
||||
OpenLayers.Layer.Boxes = Class.create();
|
||||
OpenLayers.Layer.Boxes = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Boxes.prototype =
|
||||
Object.extend( new OpenLayers.Layer.Markers(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.Markers(), {
|
||||
|
||||
initialize: function () {
|
||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
*/
|
||||
OpenLayers.Layer.Canvas = Class.create();
|
||||
OpenLayers.Layer.Canvas = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Canvas.prototype =
|
||||
Object.extend( new OpenLayers.Layer(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer(), {
|
||||
|
||||
/** Canvas layer is never a base layer.
|
||||
*
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @requires OpenLayers/Layer.js
|
||||
* @requires OpenLayers/Util.js
|
||||
*/
|
||||
OpenLayers.Layer.EventPane = Class.create();
|
||||
OpenLayers.Layer.EventPane = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.EventPane.prototype =
|
||||
Object.extend(new OpenLayers.Layer, {
|
||||
OpenLayers.Util.extend(new OpenLayers.Layer, {
|
||||
|
||||
/** EventPaned layers are always base layers, by necessity.
|
||||
*
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
*
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Layer.FixedZoomLevels = Class.create();
|
||||
OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.FixedZoomLevels.prototype = {
|
||||
|
||||
/********************************************************/
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
*/
|
||||
OpenLayers.Layer.GeoRSS = Class.create();
|
||||
OpenLayers.Layer.GeoRSS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.GeoRSS.prototype =
|
||||
Object.extend( new OpenLayers.Layer.Markers(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.Markers(), {
|
||||
|
||||
/** store url of text file
|
||||
* @type str */
|
||||
@@ -130,7 +130,7 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
}
|
||||
if (!sameMarkerClicked) {
|
||||
var popup = this.createPopup();
|
||||
Event.observe(popup.div, "click",
|
||||
OpenLayers.Event.observe(popup.div, "click",
|
||||
function() {
|
||||
for(var i=0; i < this.layer.map.popups.length; i++) {
|
||||
this.layer.map.removePopup(this.layer.map.popups[i]);
|
||||
@@ -138,7 +138,7 @@ OpenLayers.Layer.GeoRSS.prototype =
|
||||
}.bindAsEventListener(this));
|
||||
this.layer.map.addPopup(popup);
|
||||
}
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
*/
|
||||
OpenLayers.Layer.Google = Class.create();
|
||||
OpenLayers.Layer.Google = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Google.prototype =
|
||||
Object.extend( new OpenLayers.Layer.EventPane(),
|
||||
Object.extend( new OpenLayers.Layer.FixedZoomLevels(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.EventPane(),
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.FixedZoomLevels(), {
|
||||
|
||||
/** @type Boolean */
|
||||
isFixed: true,
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/HTTPRequest.js
|
||||
*/
|
||||
OpenLayers.Layer.Grid = Class.create();
|
||||
OpenLayers.Layer.Grid = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Grid.prototype =
|
||||
Object.extend( new OpenLayers.Layer.HTTPRequest(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.HTTPRequest(), {
|
||||
|
||||
/** @type OpenLayers.Size */
|
||||
tileSize: null,
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
*/
|
||||
OpenLayers.Layer.HTTPRequest = Class.create();
|
||||
OpenLayers.Layer.HTTPRequest = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.HTTPRequest.prototype =
|
||||
Object.extend( new OpenLayers.Layer(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer(), {
|
||||
|
||||
/** @type String */
|
||||
url: null,
|
||||
@@ -33,7 +33,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
}
|
||||
OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
|
||||
this.url = url;
|
||||
this.params = Object.extend( new Object(), params);
|
||||
this.params = OpenLayers.Util.extend( new Object(), params);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -79,7 +79,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
* @param {Object} newParams
|
||||
*/
|
||||
mergeNewParams:function(newParams) {
|
||||
this.params = Object.extend(this.params, newParams);
|
||||
this.params = OpenLayers.Util.extend(this.params, newParams);
|
||||
},
|
||||
|
||||
|
||||
@@ -106,8 +106,8 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
|
||||
// create a new params hashtable with all the layer params and the
|
||||
// new params together. then convert to string
|
||||
var allParams = Object.extend(new Object(), this.params);
|
||||
var allParams = Object.extend(allParams, newParams);
|
||||
var allParams = OpenLayers.Util.extend(new Object(), this.params);
|
||||
var allParams = OpenLayers.Util.extend(allParams, newParams);
|
||||
var paramsString = OpenLayers.Util.getParameterString(allParams);
|
||||
|
||||
if (paramsString != "") {
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
*/
|
||||
OpenLayers.Layer.KaMap = Class.create();
|
||||
OpenLayers.Layer.KaMap = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.KaMap.prototype =
|
||||
Object.extend( new OpenLayers.Layer.Grid(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.Grid(), {
|
||||
|
||||
/** KaMap Layer is always a base layer
|
||||
*
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Layer.MapServer = Class.create();
|
||||
OpenLayers.Layer.MapServer = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.MapServer.prototype =
|
||||
Object.extend( new OpenLayers.Layer.Grid(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.Grid(), {
|
||||
|
||||
/** @final @type hash */
|
||||
DEFAULT_PARAMS: {
|
||||
@@ -57,8 +57,8 @@ OpenLayers.Layer.MapServer.prototype =
|
||||
*/
|
||||
clone: function (name, params) {
|
||||
var mergedParams = {};
|
||||
Object.extend(mergedParams, this.params);
|
||||
Object.extend(mergedParams, params);
|
||||
OpenLayers.Util.extend(mergedParams, this.params);
|
||||
OpenLayers.Util.extend(mergedParams, params);
|
||||
var obj = new OpenLayers.Layer.MapServer(name, this.url, mergedParams);
|
||||
obj.setTileSize(this.tileSize);
|
||||
return obj;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer.js
|
||||
*/
|
||||
OpenLayers.Layer.Markers = Class.create();
|
||||
OpenLayers.Layer.Markers = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Markers.prototype =
|
||||
Object.extend( new OpenLayers.Layer(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer(), {
|
||||
|
||||
/** Markers layer is never a base layer.
|
||||
*
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
*/
|
||||
OpenLayers.Layer.MultiMap = Class.create();
|
||||
OpenLayers.Layer.MultiMap = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.MultiMap.prototype =
|
||||
Object.extend( new OpenLayers.Layer.EventPane(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.EventPane(), {
|
||||
|
||||
/** @type MMMap */
|
||||
multimap: null,
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
*/
|
||||
OpenLayers.Layer.Text = Class.create();
|
||||
OpenLayers.Layer.Text = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Text.prototype =
|
||||
Object.extend( new OpenLayers.Layer.Markers(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.Markers(), {
|
||||
|
||||
/** store url of text file - this should be specified in the
|
||||
* "options" hashtable
|
||||
@@ -145,7 +145,7 @@ OpenLayers.Layer.Text.prototype =
|
||||
if (!sameMarkerClicked) {
|
||||
this.layer.map.addPopup(this.createPopup());
|
||||
}
|
||||
Event.stop(evt);
|
||||
OpenLayers.Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
*/
|
||||
OpenLayers.Layer.VirtualEarth = Class.create();
|
||||
OpenLayers.Layer.VirtualEarth = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.VirtualEarth.prototype =
|
||||
Object.extend( new OpenLayers.Layer.EventPane(),
|
||||
Object.extend( new OpenLayers.Layer.FixedZoomLevels(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.EventPane(),
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.FixedZoomLevels(), {
|
||||
|
||||
/** @type VEMap */
|
||||
vemap: null,
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
* @requires OpenLayers/Layer/Markers.js
|
||||
*/
|
||||
OpenLayers.Layer.WFS = Class.create();
|
||||
OpenLayers.Layer.WFS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WFS.prototype =
|
||||
Object.extend(new OpenLayers.Layer.Grid(),
|
||||
Object.extend(new OpenLayers.Layer.Markers(), {
|
||||
OpenLayers.Util.extend(new OpenLayers.Layer.Grid(),
|
||||
OpenLayers.Util.extend(new OpenLayers.Layer.Markers(), {
|
||||
|
||||
/** WFS layer is never a base layer.
|
||||
*
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
*/
|
||||
OpenLayers.Layer.WMS = Class.create();
|
||||
OpenLayers.Layer.WMS = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WMS.prototype =
|
||||
Object.extend( new OpenLayers.Layer.Grid(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.Grid(), {
|
||||
|
||||
/** Hashtable of default parameter key/value pairs
|
||||
* @final @type Object */
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
* @requires OpenLayers/Layer/HTTPRequest.js
|
||||
* @requires OpenLayers/Layer/WMS.js
|
||||
*/
|
||||
OpenLayers.Layer.WMS.Untiled = Class.create();
|
||||
OpenLayers.Layer.WMS.Untiled = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
Object.extend( new OpenLayers.Layer.HTTPRequest(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.HTTPRequest(), {
|
||||
|
||||
/** Hashtable of default parameter key/value pairs
|
||||
* @final @type Object */
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/Grid.js
|
||||
*/
|
||||
OpenLayers.Layer.WorldWind = Class.create();
|
||||
OpenLayers.Layer.WorldWind = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.WorldWind.prototype =
|
||||
Object.extend( new OpenLayers.Layer.Grid(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.Grid(), {
|
||||
|
||||
DEFAULT_PARAMS: {
|
||||
},
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Layer/EventPane.js
|
||||
*/
|
||||
OpenLayers.Layer.Yahoo = Class.create();
|
||||
OpenLayers.Layer.Yahoo = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.Yahoo.prototype =
|
||||
Object.extend( new OpenLayers.Layer.EventPane(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Layer.EventPane(), {
|
||||
|
||||
/** @type YMap */
|
||||
yahoomap: null,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @requires OpenLayers/Util.js
|
||||
* @requires OpenLayers/Events.js
|
||||
*/
|
||||
OpenLayers.Map = Class.create();
|
||||
OpenLayers.Map = OpenLayers.Class.create();
|
||||
OpenLayers.Map.TILE_WIDTH = 256;
|
||||
OpenLayers.Map.TILE_HEIGHT = 256;
|
||||
OpenLayers.Map.prototype = {
|
||||
@@ -152,7 +152,7 @@ OpenLayers.Map.prototype = {
|
||||
// Else updateSize on catching the window's resize
|
||||
// Note that this is ok, as updateSize() does nothing if the
|
||||
// map's size has not actually changed.
|
||||
Event.observe(window, 'resize',
|
||||
OpenLayers.Event.observe(window, 'resize',
|
||||
this.updateSize.bindAsEventListener(this));
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ OpenLayers.Map.prototype = {
|
||||
this.popups = new Array();
|
||||
|
||||
// always call map.destroy()
|
||||
Event.observe(window,
|
||||
OpenLayers.Event.observe(window,
|
||||
'unload',
|
||||
this.destroy.bindAsEventListener(this));
|
||||
|
||||
@@ -213,7 +213,7 @@ OpenLayers.Map.prototype = {
|
||||
|
||||
// now add the options declared by the user
|
||||
// (these will override defaults)
|
||||
Object.extend(this, options);
|
||||
OpenLayers.Util.extend(this, options);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -513,7 +513,7 @@ OpenLayers.Map.prototype = {
|
||||
|
||||
// Workaround for the fact that hidden elements return 0 for size.
|
||||
if (size.w == 0 && size.h == 0) {
|
||||
var dim = Element.getDimensions(this.div);
|
||||
var dim = OpenLayers.Element.getDimensions(this.div);
|
||||
size.w = dim.width;
|
||||
size.h = dim.height;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Marker = Class.create();
|
||||
OpenLayers.Marker = OpenLayers.Class.create();
|
||||
OpenLayers.Marker.prototype = {
|
||||
|
||||
/** @type OpenLayers.Icon */
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
*
|
||||
* @requires OpenLayers/Marker.js
|
||||
*/
|
||||
OpenLayers.Marker.Box = Class.create();
|
||||
OpenLayers.Marker.Box.prototype = Object.extend( new OpenLayers.Marker(), {
|
||||
OpenLayers.Marker.Box = OpenLayers.Class.create();
|
||||
OpenLayers.Marker.Box.prototype = OpenLayers.Util.extend( new OpenLayers.Marker(), {
|
||||
/** @type OpenLayers.LonLat */
|
||||
bounds: null,
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* @class
|
||||
*/
|
||||
OpenLayers.Popup = Class.create();
|
||||
OpenLayers.Popup = OpenLayers.Class.create();
|
||||
|
||||
OpenLayers.Popup.WIDTH = 200;
|
||||
OpenLayers.Popup.HEIGHT = 200;
|
||||
@@ -137,28 +137,28 @@ OpenLayers.Popup.prototype = {
|
||||
* @type Boolean
|
||||
*/
|
||||
visible: function() {
|
||||
return Element.visible(this.div);
|
||||
return OpenLayers.Element.visible(this.div);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
toggle: function() {
|
||||
Element.toggle(this.div);
|
||||
OpenLayers.Element.toggle(this.div);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
show: function() {
|
||||
Element.show(this.div);
|
||||
OpenLayers.Element.show(this.div);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
hide: function() {
|
||||
Element.hide(this.div);
|
||||
OpenLayers.Element.hide(this.div);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Popup.js
|
||||
*/
|
||||
OpenLayers.Popup.Anchored = Class.create();
|
||||
OpenLayers.Popup.Anchored = OpenLayers.Class.create();
|
||||
OpenLayers.Popup.Anchored.prototype =
|
||||
Object.extend( new OpenLayers.Popup(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Popup(), {
|
||||
|
||||
/** "lr", "ll", "tr", "tl" - relative position of the popup.
|
||||
* @type String */
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
*
|
||||
* @requires OpenLayers/Popup/Anchored.js
|
||||
*/
|
||||
OpenLayers.Popup.AnchoredBubble = Class.create();
|
||||
OpenLayers.Popup.AnchoredBubble = OpenLayers.Class.create();
|
||||
|
||||
//Border space for the rico corners
|
||||
OpenLayers.Popup.AnchoredBubble.CORNER_SIZE = 5;
|
||||
|
||||
OpenLayers.Popup.AnchoredBubble.prototype =
|
||||
Object.extend( new OpenLayers.Popup.Anchored(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Popup.Anchored(), {
|
||||
|
||||
/** @type DOMElement */
|
||||
contentDiv:null,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* size - but do not add themselves to the layer div automatically, for
|
||||
* example.
|
||||
*/
|
||||
OpenLayers.Tile = Class.create();
|
||||
OpenLayers.Tile = OpenLayers.Class.create();
|
||||
OpenLayers.Tile.prototype = {
|
||||
|
||||
/** @type String */
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Tile.js
|
||||
*/
|
||||
OpenLayers.Tile.Image = Class.create();
|
||||
OpenLayers.Tile.Image = OpenLayers.Class.create();
|
||||
OpenLayers.Tile.Image.prototype =
|
||||
Object.extend( new OpenLayers.Tile(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Tile(), {
|
||||
|
||||
/** @type DOMElement img */
|
||||
imgDiv: null,
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*
|
||||
* @requires OpenLayers/Tile.js
|
||||
*/
|
||||
OpenLayers.Tile.WFS = Class.create();
|
||||
OpenLayers.Tile.WFS = OpenLayers.Class.create();
|
||||
OpenLayers.Tile.WFS.prototype =
|
||||
Object.extend( new OpenLayers.Tile(), {
|
||||
OpenLayers.Util.extend( new OpenLayers.Tile(), {
|
||||
|
||||
/** @type Array(OpenLayers.Feature)*/
|
||||
features: null,
|
||||
|
||||
@@ -7,6 +7,34 @@
|
||||
*/
|
||||
OpenLayers.Util = new Object();
|
||||
|
||||
/* from Prototype.js */
|
||||
if ($ == null) {
|
||||
var $ = function () {
|
||||
var elements = new Array();
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var element = arguments[i];
|
||||
if (typeof element == 'string')
|
||||
element = document.getElementById(element);
|
||||
|
||||
if (arguments.length == 1)
|
||||
return element;
|
||||
|
||||
elements.push(element);
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
}
|
||||
|
||||
/* from Prototype.js */
|
||||
OpenLayers.Util.extend = function(destination, source) {
|
||||
for (property in source) {
|
||||
destination[property] = source[property];
|
||||
}
|
||||
return destination;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} id
|
||||
* @param {OpenLayers.Pixel} px
|
||||
@@ -105,9 +133,9 @@ OpenLayers.Util.createImage = function(id, px, sz, imgURL, position, border,
|
||||
|
||||
if(delayDisplay) {
|
||||
image.style.display = "none";
|
||||
Event.observe(image, "load",
|
||||
OpenLayers.Event.observe(image, "load",
|
||||
OpenLayers.Util.onImageLoad.bindAsEventListener(image));
|
||||
Event.observe(image, "error",
|
||||
OpenLayers.Event.observe(image, "error",
|
||||
OpenLayers.Util.onImageLoadError.bindAsEventListener(image));
|
||||
|
||||
}
|
||||
@@ -244,9 +272,9 @@ OpenLayers.Util.createAlphaImageDiv = function(id, px, sz, imgURL,
|
||||
|
||||
if (delayDisplay) {
|
||||
img.style.display = "none";
|
||||
Event.observe(img, "load",
|
||||
OpenLayers.Event.observe(img, "load",
|
||||
OpenLayers.Util.onImageLoad.bindAsEventListener(div));
|
||||
Event.observe(img, "error",
|
||||
OpenLayers.Event.observe(img, "error",
|
||||
OpenLayers.Util.onImageLoadError.bindAsEventListener(div));
|
||||
}
|
||||
|
||||
@@ -275,7 +303,7 @@ OpenLayers.Util.upperCaseObject = function (object) {
|
||||
};
|
||||
|
||||
/** Takes a hashtable and copies any keys that don't exist from
|
||||
* another hashtable, by analogy with Object.extend() from
|
||||
* another hashtable, by analogy with OpenLayers.Util.extend() from
|
||||
* Prototype.js.
|
||||
*
|
||||
* @param {Object} to
|
||||
@@ -318,6 +346,21 @@ OpenLayers.Util.getImagesLocation = function() {
|
||||
return OpenLayers._getScriptLocation() + "img/";
|
||||
};
|
||||
|
||||
/* Originally from Prototype */
|
||||
|
||||
OpenLayers.Util.Try = function() {
|
||||
var returnValue;
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var lambda = arguments[i];
|
||||
try {
|
||||
returnValue = lambda();
|
||||
break;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
/** These could/should be made namespace aware?
|
||||
@@ -328,7 +371,7 @@ OpenLayers.Util.getImagesLocation = function() {
|
||||
* @return {Array}
|
||||
*/
|
||||
OpenLayers.Util.getNodes=function(p, tagName) {
|
||||
var nodes = Try.these(
|
||||
var nodes = OpenLayers.Util.Try(
|
||||
function () {
|
||||
return OpenLayers.Util._getNodes(p.documentElement.childNodes,
|
||||
tagName);
|
||||
@@ -392,7 +435,7 @@ OpenLayers.Util.getTagText = function (parent, item, index) {
|
||||
*/
|
||||
OpenLayers.Util.getXmlNodeValue = function(node) {
|
||||
var val = null;
|
||||
Try.these(
|
||||
OpenLayers.Util.Try(
|
||||
function() {
|
||||
val = node.text;
|
||||
if (!val)
|
||||
@@ -573,3 +616,26 @@ OpenLayers.Util.safeStopPropagation = function(evt) {
|
||||
}
|
||||
evt.cancelBubble = true;
|
||||
};
|
||||
|
||||
OpenLayers.Util.pagePosition = function(forElement) {
|
||||
var valueT = 0, valueL = 0;
|
||||
|
||||
var element = forElement;
|
||||
do {
|
||||
valueT += element.offsetTop || 0;
|
||||
valueL += element.offsetLeft || 0;
|
||||
|
||||
// Safari fix
|
||||
if (element.offsetParent==document.body)
|
||||
if (OpenLayers.Element.getStyle(element,'position')=='absolute') break;
|
||||
|
||||
} while (element = element.offsetParent);
|
||||
|
||||
element = forElement;
|
||||
do {
|
||||
valueT -= element.scrollTop || 0;
|
||||
valueL -= element.scrollLeft || 0;
|
||||
} while (element = element.parentNode);
|
||||
|
||||
return [valueL, valueT];
|
||||
};
|
||||
|
||||
1781
lib/Prototype.js
1781
lib/Prototype.js
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
Rico.Color = Class.create();
|
||||
Rico.Color = OpenLayers.Class.create();
|
||||
|
||||
Rico.Color.prototype = {
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ Rico.Corner = {
|
||||
border : false,
|
||||
compact : false
|
||||
}
|
||||
Object.extend(this.options, options || {});
|
||||
OpenLayers.Util.extend(this.options, options || {});
|
||||
|
||||
this.options.numSlices = this.options.compact ? 2 : 4;
|
||||
if ( this._isTransparent() )
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
|
||||
t.ok( layer.isBaseLayer, "baselayer is true by default");
|
||||
|
||||
var newParams = Object.extend(new Object(), params);
|
||||
var newParams = OpenLayers.Util.extend(new Object(), params);
|
||||
newParams.transparent = "true";
|
||||
layer = new OpenLayers.Layer.WMS(name, url, newParams);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user