Tag 2.4-RC2.

git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.4-rc2@3089 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-04-20 01:29:54 +00:00
parent b6fb16153c
commit 9011c8ca0a
118 changed files with 1591 additions and 730 deletions

View File

@@ -1,5 +1,5 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
/* Copyright (c) 2006 MetaCarta, Inc., published under a BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
@@ -148,24 +148,23 @@ OpenLayers.Layer.prototype = {
* @param {Object} options Hashtable of extra options to tag onto the layer
*/
initialize: function(name, options) {
//store a copy of the custom options for later cloning
this.options = OpenLayers.Util.extend(new Object(), options);
//add options to layer
OpenLayers.Util.extend(this, this.options);
this.addOptions(options);
this.name = name;
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
if (this.div == null) {
if (this.id == null) {
this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME + "_");
this.div = OpenLayers.Util.createDiv();
this.div.style.width = "100%";
this.div.style.height = "100%";
this.div.id = this.id;
}
this.events = new OpenLayers.Events(this, this.div, this.EVENT_TYPES);
this.events = new OpenLayers.Events(this, this.div,
this.EVENT_TYPES);
}
},
/**
@@ -187,8 +186,10 @@ OpenLayers.Layer.prototype = {
this.name = null;
this.div = null;
this.options = null;
this.events.destroy();
if (this.events) {
this.events.destroy();
}
this.events = null;
},
@@ -216,9 +217,12 @@ OpenLayers.Layer.prototype = {
* @param {String} newName
*/
setName: function(newName) {
this.name = newName;
if (this.map != null)
this.map.events.triggerEvent("changelayer");
if (newName != this.name) {
this.name = newName;
if (this.map != null) {
this.map.events.triggerEvent("changelayer");
}
}
},
/**
@@ -226,6 +230,10 @@ OpenLayers.Layer.prototype = {
*/
addOptions: function (newOptions) {
if (this.options == null) {
this.options = new Object();
}
// update our copy for clone
OpenLayers.Util.extend(this.options, newOptions);
@@ -264,22 +272,25 @@ OpenLayers.Layer.prototype = {
* @param {OpenLayers.Map} map
*/
setMap: function(map) {
this.map = map;
if (this.map == null) {
// grab some essential layer data from the map if it hasn't already
// been set
this.maxExtent = this.maxExtent || this.map.maxExtent;
this.projection = this.projection || this.map.projection;
this.units = this.units || this.map.units;
this.initResolutions();
if (!this.isBaseLayer) {
this.inRange = this.calculateInRange();
this.map = map;
// grab some essential layer data from the map if it hasn't already
// been set
this.maxExtent = this.maxExtent || this.map.maxExtent;
this.projection = this.projection || this.map.projection;
this.units = this.units || this.map.units;
this.initResolutions();
if (!this.isBaseLayer) {
this.inRange = this.calculateInRange();
}
// deal with gutters
this.setTileSize();
}
// deal with gutters
this.setTileSize();
},
/**
@@ -336,7 +347,7 @@ OpenLayers.Layer.prototype = {
if (visibility != this.visibility) {
this.visibility = visibility;
this.display(visibility);
if (this.map != null) {
if (visibility && this.map != null) {
var extent = this.map.getExtent();
if (extent != null) {
this.moveTo(extent, true);
@@ -378,9 +389,11 @@ OpenLayers.Layer.prototype = {
* @param {Boolean} isBaseLayer
*/
setIsBaseLayer: function(isBaseLayer) {
this.isBaseLayer = isBaseLayer;
if (this.map != null) {
this.map.events.triggerEvent("changelayer");
if (isBaseLayer != this.isBaseLayer) {
this.isBaseLayer = isBaseLayer;
if (this.map != null) {
this.map.events.triggerEvent("changelayer");
}
}
},
@@ -646,11 +659,13 @@ OpenLayers.Layer.prototype = {
* @param {Float} opacity
*/
setOpacity: function(opacity) {
this.opacity = opacity;
for(var i=0; i<this.div.childNodes.length; ++i) {
var element = this.div.childNodes[i].firstChild;
OpenLayers.Util.modifyDOMElement(element, null, null, null,
null, null, null, opacity);
if (opacity != this.opacity) {
this.opacity = opacity;
for(var i=0; i<this.div.childNodes.length; ++i) {
var element = this.div.childNodes[i].firstChild;
OpenLayers.Util.modifyDOMElement(element, null, null, null,
null, null, null, opacity);
}
}
},