Convert all classes to use new-style class definitions. All tests pass.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1651 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -179,7 +179,7 @@ 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(), {
|
||||
OpenLayers.Ajax.Request.prototype = OpenLayers.Class.inherit( OpenLayers.Ajax.Base, {
|
||||
initialize: function(url, options) {
|
||||
this.transport = OpenLayers.Ajax.getTransport();
|
||||
this.setOptions(options);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Control.ArgParser = OpenLayers.Class.create();
|
||||
OpenLayers.Control.ArgParser.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
|
||||
/** @type OpenLayers.LonLat */
|
||||
center: null,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Control.KeyboardDefaults = OpenLayers.Class.create();
|
||||
OpenLayers.Control.KeyboardDefaults.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
|
||||
/** @type int */
|
||||
slideFactor: 50,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Control.LayerSwitcher = OpenLayers.Class.create();
|
||||
OpenLayers.Control.LayerSwitcher.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
|
||||
/** @type String */
|
||||
activeColor: "darkblue",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Control.MouseDefaults = OpenLayers.Class.create();
|
||||
OpenLayers.Control.MouseDefaults.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
|
||||
/** @type Boolean */
|
||||
performedDrag: false,
|
||||
|
||||
@@ -12,8 +12,8 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class.create();
|
||||
OpenLayers.Control.MouseToolbar.X = 6;
|
||||
OpenLayers.Control.MouseToolbar.Y = 300;
|
||||
OpenLayers.Control.MouseToolbar.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(),
|
||||
OpenLayers.Util.extend( new OpenLayers.Control.MouseDefaults(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control,
|
||||
OpenLayers.Control.MouseDefaults, {
|
||||
|
||||
mode: null,
|
||||
|
||||
@@ -306,5 +306,5 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ OpenLayers.Control.PanZoom = OpenLayers.Class.create();
|
||||
OpenLayers.Control.PanZoom.X = 4;
|
||||
OpenLayers.Control.PanZoom.Y = 4;
|
||||
OpenLayers.Control.PanZoom.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
|
||||
/** @type int */
|
||||
slideFactor: 50,
|
||||
|
||||
@@ -11,7 +11,7 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class.create();
|
||||
OpenLayers.Control.PanZoomBar.X = 4;
|
||||
OpenLayers.Control.PanZoomBar.Y = 4;
|
||||
OpenLayers.Control.PanZoomBar.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control.PanZoom(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control.PanZoom, {
|
||||
|
||||
/** @type Array(...) */
|
||||
buttons: null,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Control.Permalink = OpenLayers.Class.create();
|
||||
OpenLayers.Control.Permalink.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
|
||||
/** @type DOMElement */
|
||||
element: null,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Control.Scale = OpenLayers.Class.create();
|
||||
OpenLayers.Control.Scale.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Control(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Control, {
|
||||
/** @type DOMElement */
|
||||
element: null,
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Feature.WFS = OpenLayers.Class.create();
|
||||
OpenLayers.Feature.WFS.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Feature(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Feature, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -19,16 +19,11 @@ OpenLayers.Feature.WFS.prototype =
|
||||
*/
|
||||
initialize: function(layer, xmlNode) {
|
||||
var newArguments = arguments;
|
||||
if (arguments.length > 0) {
|
||||
var data = this.processXMLNode(xmlNode);
|
||||
newArguments = new Array(layer, data.lonlat, data)
|
||||
}
|
||||
OpenLayers.Feature.prototype.initialize.apply(this, newArguments);
|
||||
|
||||
if (arguments.length > 0) {
|
||||
this.createMarker();
|
||||
this.layer.addMarker(this.marker);
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
|
||||
@@ -104,8 +104,6 @@ OpenLayers.Layer.prototype = {
|
||||
* @param {Object} options Hashtable of extra options to tag onto the layer
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
if (arguments.length > 0) {
|
||||
|
||||
//store a copy of the custom options for later cloning
|
||||
this.options = OpenLayers.Util.extend(new Object(), options);
|
||||
|
||||
@@ -122,7 +120,6 @@ OpenLayers.Layer.prototype = {
|
||||
this.div.style.height = "100%";
|
||||
this.div.id = this.id;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
OpenLayers.Layer.EventPane = OpenLayers.Class.create();
|
||||
OpenLayers.Layer.EventPane.prototype =
|
||||
OpenLayers.Util.extend(new OpenLayers.Layer, {
|
||||
OpenLayers.Class.inherit( OpenLayers.Layer, {
|
||||
|
||||
/** EventPaned layers are always base layers, by necessity.
|
||||
*
|
||||
@@ -33,12 +33,9 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
*/
|
||||
initialize: function(name, options) {
|
||||
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
|
||||
|
||||
if (arguments.length > 0) {
|
||||
if (this.pane == null) {
|
||||
this.pane = OpenLayers.Util.createDiv();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** Set the map property for the layer. This is done through an accessor
|
||||
|
||||
@@ -28,9 +28,7 @@ OpenLayers.Layer.HTTPRequest.prototype =
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = arguments;
|
||||
if (arguments.length > 0) {
|
||||
newArguments = [name, options];
|
||||
}
|
||||
OpenLayers.Layer.prototype.initialize.apply(this, newArguments);
|
||||
this.url = url;
|
||||
this.params = OpenLayers.Util.extend( new Object(), params);
|
||||
|
||||
@@ -31,7 +31,7 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
newArguments.push(name, url, params, options);
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||
this.params = (params ? params : {});
|
||||
if (arguments.length > 0 && params) {
|
||||
if (params) {
|
||||
OpenLayers.Util.applyDefaults(
|
||||
this.params,
|
||||
this.DEFAULT_PARAMS
|
||||
|
||||
@@ -24,11 +24,9 @@ OpenLayers.Layer.MapServer.prototype =
|
||||
*/
|
||||
initialize: function(name, url, params) {
|
||||
var newArguments = new Array();
|
||||
if (arguments.length > 0) {
|
||||
//uppercase params
|
||||
params = OpenLayers.Util.upperCaseObject(params);
|
||||
newArguments.push(name, url, params);
|
||||
}
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||
|
||||
if (arguments.length > 0) {
|
||||
|
||||
@@ -52,26 +52,20 @@ OpenLayers.Layer.WFS.prototype =
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
if (arguments.length > 0) {
|
||||
//uppercase params
|
||||
params = OpenLayers.Util.upperCaseObject(params);
|
||||
newArguments.push(name, url, params, options);
|
||||
}
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||
|
||||
var newArguments = new Array();
|
||||
if (arguments.length > 0) {
|
||||
//uppercase params
|
||||
newArguments.push(name, options);
|
||||
}
|
||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, newArguments);
|
||||
|
||||
if (arguments.length > 0) {
|
||||
OpenLayers.Util.applyDefaults(
|
||||
this.params,
|
||||
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -31,19 +31,14 @@ OpenLayers.Layer.WMS.prototype =
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
if (arguments.length > 0) {
|
||||
//uppercase params
|
||||
params = OpenLayers.Util.upperCaseObject(params);
|
||||
newArguments.push(name, url, params, options);
|
||||
}
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||
|
||||
if (arguments.length > 0) {
|
||||
OpenLayers.Util.applyDefaults(
|
||||
this.params,
|
||||
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
|
||||
);
|
||||
}
|
||||
|
||||
// unless explicitly set in options, if the layer is transparent,
|
||||
// it will be an overlay
|
||||
|
||||
@@ -35,20 +35,15 @@ OpenLayers.Layer.WMS.Untiled.prototype =
|
||||
*/
|
||||
initialize: function(name, url, params, options) {
|
||||
var newArguments = new Array();
|
||||
if (arguments.length > 0) {
|
||||
//uppercase params
|
||||
params = OpenLayers.Util.upperCaseObject(params);
|
||||
newArguments.push(name, url, params, options);
|
||||
}
|
||||
OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
|
||||
newArguments);
|
||||
|
||||
if (arguments.length > 0) {
|
||||
OpenLayers.Util.applyDefaults(
|
||||
this.params,
|
||||
OpenLayers.Util.upperCaseObject(this.DEFAULT_PARAMS)
|
||||
);
|
||||
}
|
||||
|
||||
// unless explicitly set in options, if the layer is transparent,
|
||||
// it will be an overlay
|
||||
|
||||
@@ -32,7 +32,7 @@ OpenLayers.Layer.WorldWind.prototype =
|
||||
newArguments.push(name, url, params, options);
|
||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
||||
this.params = (params ? params : {});
|
||||
if (arguments.length > 0 && params) {
|
||||
if (params) {
|
||||
OpenLayers.Util.applyDefaults(
|
||||
this.params,
|
||||
this.DEFAULT_PARAMS
|
||||
|
||||
@@ -28,7 +28,6 @@ OpenLayers.Marker.prototype = {
|
||||
* @param {OpenLayers.LonLat lonlat
|
||||
*/
|
||||
initialize: function(lonlat, icon) {
|
||||
if (arguments.length > 0) {
|
||||
this.lonlat = lonlat;
|
||||
|
||||
var newIcon = (icon) ? icon : OpenLayers.Marker.defaultIcon();
|
||||
@@ -41,7 +40,6 @@ OpenLayers.Marker.prototype = {
|
||||
this.icon.calculateOffset = newIcon.calculateOffset;
|
||||
}
|
||||
this.events = new OpenLayers.Events(this, this.icon.imageDiv, null);
|
||||
}
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* @requires OpenLayers/Marker.js
|
||||
*/
|
||||
OpenLayers.Marker.Box = OpenLayers.Class.create();
|
||||
OpenLayers.Marker.Box.prototype = OpenLayers.Util.extend( new OpenLayers.Marker(), {
|
||||
OpenLayers.Marker.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Marker, {
|
||||
/** @type OpenLayers.LonLat */
|
||||
bounds: null,
|
||||
|
||||
@@ -21,13 +21,11 @@ OpenLayers.Marker.Box.prototype = OpenLayers.Util.extend( new OpenLayers.Marker(
|
||||
* @param {OpenLayers.LonLat lonlat
|
||||
*/
|
||||
initialize: function(bounds, borderColor, borderWidth) {
|
||||
if (arguments.length > 0) {
|
||||
this.bounds = bounds;
|
||||
this.div = OpenLayers.Util.createDiv();
|
||||
this.div.style.overflow = 'hidden';
|
||||
this.events = new OpenLayers.Events(this, this.div, null);
|
||||
this.setBorder(borderColor, borderWidth);
|
||||
}
|
||||
},
|
||||
|
||||
setBorder: function (color, width) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Popup.Anchored = OpenLayers.Class.create();
|
||||
OpenLayers.Popup.Anchored.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Popup(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Popup, {
|
||||
|
||||
/** "lr", "ll", "tr", "tl" - relative position of the popup.
|
||||
* @type String */
|
||||
|
||||
@@ -13,7 +13,7 @@ OpenLayers.Popup.AnchoredBubble = OpenLayers.Class.create();
|
||||
OpenLayers.Popup.AnchoredBubble.CORNER_SIZE = 5;
|
||||
|
||||
OpenLayers.Popup.AnchoredBubble.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Popup.Anchored(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Popup.Anchored, {
|
||||
|
||||
/** @type DOMElement */
|
||||
contentDiv:null,
|
||||
|
||||
@@ -46,7 +46,6 @@ OpenLayers.Tile.prototype = {
|
||||
* @param {OpenLayers.Size} size
|
||||
*/
|
||||
initialize: function(layer, position, bounds, url, size) {
|
||||
if (arguments.length > 0) {
|
||||
this.layer = layer;
|
||||
this.position = position;
|
||||
this.bounds = bounds;
|
||||
@@ -55,7 +54,6 @@ OpenLayers.Tile.prototype = {
|
||||
|
||||
//give the tile a unique id based on its BBOX.
|
||||
this.id = OpenLayers.Util.createUniqueID("Tile_");
|
||||
}
|
||||
},
|
||||
|
||||
/** nullify references to prevent circular references and memory leaks
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Tile.Image = OpenLayers.Class.create();
|
||||
OpenLayers.Tile.Image.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Tile(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Tile, {
|
||||
|
||||
/** @type DOMElement img */
|
||||
imgDiv: null,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
OpenLayers.Tile.WFS = OpenLayers.Class.create();
|
||||
OpenLayers.Tile.WFS.prototype =
|
||||
OpenLayers.Util.extend( new OpenLayers.Tile(), {
|
||||
OpenLayers.Class.inherit( OpenLayers.Tile, {
|
||||
|
||||
/** @type Array(OpenLayers.Feature)*/
|
||||
features: null,
|
||||
@@ -28,11 +28,8 @@ OpenLayers.Tile.WFS.prototype =
|
||||
*/
|
||||
initialize: function(layer, position, bounds, urls, size) {
|
||||
var newArguments = arguments;
|
||||
if (arguments.length > 0) {
|
||||
newArguments = [layer, position, bounds, null, size];
|
||||
}
|
||||
OpenLayers.Tile.prototype.initialize.apply(this, newArguments);
|
||||
|
||||
this.urls = urls;
|
||||
this.features = new Array();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user