[OpenLayers-Commits] r3585 - in sandbox/euzuro/untiled3: apidoc_config doc_config examples lib/OpenLayers lib/OpenLayers/Control lib/OpenLayers/Layer lib/OpenLayers/Layer/MapServer tests tests/Layer
commits at openlayers.org
commits at openlayers.org
Thu Jul 5 13:11:30 EDT 2007
Author: euzuro
Date: 2007-07-05 13:11:23 -0400 (Thu, 05 Jul 2007)
New Revision: 3585
Modified:
sandbox/euzuro/untiled3/apidoc_config/Menu.txt
sandbox/euzuro/untiled3/doc_config/Menu.txt
sandbox/euzuro/untiled3/examples/example.html
sandbox/euzuro/untiled3/lib/OpenLayers/BaseTypes.js
sandbox/euzuro/untiled3/lib/OpenLayers/Control/Navigation.js
sandbox/euzuro/untiled3/lib/OpenLayers/Feature.js
sandbox/euzuro/untiled3/lib/OpenLayers/Layer.js
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/HTTPRequest.js
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Markers.js
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/WFS.js
sandbox/euzuro/untiled3/lib/OpenLayers/Map.js
sandbox/euzuro/untiled3/tests/Layer/test_HTTPRequest.html
sandbox/euzuro/untiled3/tests/test_Layer.html
Log:
bringing up changes from trunk
Modified: sandbox/euzuro/untiled3/apidoc_config/Menu.txt
===================================================================
--- sandbox/euzuro/untiled3/apidoc_config/Menu.txt 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/apidoc_config/Menu.txt 2007-07-05 17:11:23 UTC (rev 3585)
@@ -120,15 +120,24 @@
File: FixedZoomLevels (OpenLayers/Layer/FixedZoomLevels.js)
File: GeoRSS (no auto-title, OpenLayers/Layer/GeoRSS.js)
File: GML (no auto-title, OpenLayers/Layer/GML.js)
+ File: Gooogle (OpenLayers/Layer/Google.js)
File: Grid (OpenLayers/Layer/Grid.js)
+ File: HTTPRequest (OpenLayers/Layer/HTTPRequest.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
+ File: KaMap (OpenLayers/Layer/KaMap.js)
File: MapServer (OpenLayers/Layer/MapServer.js)
+ File: MapServer.Untiled (OpenLayers/Layer/MapServer/Untiled.js)
File: Markers (no auto-title, OpenLayers/Layer/Markers.js)
+ File: MultiMap (OpenLayers/Layer/MultiMap.js)
File: Text (OpenLayers/Layer/Text.js)
+ File: TMS (OpenLayers/Layer/TMS.js)
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
+ File: VirtualEarth (OpenLayers/Layer/VirtualEarth.js)
+ File: WFS (OpenLayers/Layer/WFS.js)
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
File: WMS.Untiled (no auto-title, OpenLayers/Layer/WMS/Untiled.js)
File: WorldWind (OpenLayers/Layer/WorldWind.js)
+ File: Yahoo (OpenLayers/Layer/Yahoo.js)
} # Group: Layer
File: Map (no auto-title, OpenLayers/Map.js)
Modified: sandbox/euzuro/untiled3/doc_config/Menu.txt
===================================================================
--- sandbox/euzuro/untiled3/doc_config/Menu.txt 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/doc_config/Menu.txt 2007-07-05 17:11:23 UTC (rev 3585)
@@ -120,15 +120,24 @@
File: FixedZoomLevels (OpenLayers/Layer/FixedZoomLevels.js)
File: GeoRSS (no auto-title, OpenLayers/Layer/GeoRSS.js)
File: GML (no auto-title, OpenLayers/Layer/GML.js)
+ File: Gooogle (OpenLayers/Layer/Google.js)
File: Grid (OpenLayers/Layer/Grid.js)
+ File: HTTPRequest (OpenLayers/Layer/HTTPRequest.js)
File: Image (no auto-title, OpenLayers/Layer/Image.js)
+ File: KaMap (OpenLayers/Layer/KaMap.js)
File: MapServer (OpenLayers/Layer/MapServer.js)
+ File: MapServer.Untiled (OpenLayers/Layer/MapServer/Untiled.js)
File: Markers (no auto-title, OpenLayers/Layer/Markers.js)
+ File: MultiMap (OpenLayers/Layer/MultiMap.js)
File: Text (OpenLayers/Layer/Text.js)
+ File: TMS (OpenLayers/Layer/TMS.js)
File: Vector (no auto-title, OpenLayers/Layer/Vector.js)
+ File: VirtualEarth (OpenLayers/Layer/VirtualEarth.js)
+ File: WFS (OpenLayers/Layer/WFS.js)
File: WMS (no auto-title, OpenLayers/Layer/WMS.js)
File: WMS.Untiled (no auto-title, OpenLayers/Layer/WMS/Untiled.js)
File: WorldWind (OpenLayers/Layer/WorldWind.js)
+ File: Yahoo (OpenLayers/Layer/Yahoo.js)
} # Group: Layer
File: Map (no auto-title, OpenLayers/Map.js)
Modified: sandbox/euzuro/untiled3/examples/example.html
===================================================================
--- sandbox/euzuro/untiled3/examples/example.html 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/examples/example.html 2007-07-05 17:11:23 UTC (rev 3585)
@@ -9,8 +9,10 @@
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
+ // making this a global variable so that it is accessible for
+ // debugging/inspecting in Firebug
+ var map = null;
-
<!--
function init(){
@@ -43,7 +45,7 @@
}
header.innerHTML += browserName + ")";
- var map = new OpenLayers.Map('map');
+ map = new OpenLayers.Map('map');
var options = {
resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101]
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/BaseTypes.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/BaseTypes.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/BaseTypes.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -91,8 +91,8 @@
x: 0.0,
/**
- * APIProperty: x
- * {Number} The x coordinate
+ * APIProperty: y
+ * {Number} The y coordinate
*/
y: 0.0,
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Control/Navigation.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Control/Navigation.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Control/Navigation.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -15,7 +15,7 @@
/**
* Property: dragPan
- * {<OpenLayers.Control.ZoomBox>}
+ * {<OpenLayers.Control.DragPan>}
*/
dragPan: null,
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Feature.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Feature.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Feature.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -139,8 +139,6 @@
*/
createMarker: function() {
- var marker = null;
-
if (this.lonlat != null) {
this.marker = new OpenLayers.Marker(this.lonlat, this.data.icon);
}
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -451,28 +451,6 @@
addTile:function(bounds, position) {
// Should be implemented by subclasses
},
-
- /**
- * APIMethod: mergeNewParams
- * Once params have been changed, we will need to re-init our tiles
- *
- * Parameters:
- * newParams - {Object} Hashtable of new params to use
- */
- mergeNewParams:function(newArguments) {
- OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
- [newArguments]);
- var bounds = this.map.getExtent();
- if (this.map != null) {
- if (this.singleTile) {
- this.initSingleTile(bounds);
- } else {
- this.initGriddedTiles(bounds);
- }
- }
-
- },
-
/**
* Method: moveGriddedTiles
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/HTTPRequest.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/HTTPRequest.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/HTTPRequest.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -115,6 +115,7 @@
*/
mergeNewParams:function(newParams) {
this.params = OpenLayers.Util.extend(this.params, newParams);
+ this.redraw();
},
/**
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -241,24 +241,10 @@
*/
setUrl: function(newUrl) {
OpenLayers.Layer.HTTPRequest.prototype.setUrl.apply(this, arguments);
- this.moveTo();
+ this.redraw();
},
-
+
/**
- * APIMethod: mergeNewParams
- * Once HTTPRequest has updated new params, reload the image div
- *
- * Parameters:
- * newParams - {Object}
- */
- mergeNewParams:function(newParams) {
- OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
- [newParams]);
- //redraw
- this.moveTo(null, true);
- },
-
- /**
* APIMethod: getFullRequestString
* combine the layer's url with its params and these newParams.
*
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Markers.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Markers.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Markers.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -7,6 +7,7 @@
* @requires Openlayers/Layer.js
*
* Class: OpenLayers.Layer.Markers
+ *
* Inherits from:
* - <OpenLayers.Layer>
*/
@@ -15,7 +16,7 @@
OpenLayers.Class.inherit( OpenLayers.Layer, {
/**
- * Property: isBaseLayer
+ * APIProperty: isBaseLayer
* {Boolean} Markers layer is never a base layer.
*/
isBaseLayer: false,
@@ -37,24 +38,24 @@
drawn: false,
/**
- * Constructor: OpenLayers.Layer.Markers
- * Create a Markers layer.
- *
- * Parameters:
- * name - {String}
- * options - {Object} Hashtable of extra options to tag onto the layer
- */
+ * Constructor: OpenLayers.Layer.Markers
+ * Create a Markers layer.
+ *
+ * Parameters:
+ * name - {String}
+ * options - {Object} Hashtable of extra options to tag onto the layer
+ */
initialize: function(name, options) {
OpenLayers.Layer.prototype.initialize.apply(this, arguments);
this.markers = new Array();
},
/**
- * Method: destroy
+ * APIMethod: destroy
*/
destroy: function() {
this.clearMarkers();
- markers = null;
+ this.markers = null;
OpenLayers.Layer.prototype.destroy.apply(this, arguments);
},
@@ -71,13 +72,15 @@
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
if (zoomChanged || !this.drawn) {
- this.redraw();
+ for(i=0; i < this.markers.length; i++) {
+ this.drawMarker(this.markers[i]);
+ }
this.drawn = true;
}
},
/**
- * Method: addMarker
+ * APIMethod: addMarker
*
* Parameters:
* marker - {<OpenLayers.Marker>}
@@ -91,7 +94,7 @@
},
/**
- * Method: removeMarker
+ * APIMethod: removeMarker
*
* Parameters:
* marker - {<OpenLayers.Marker>}
@@ -115,25 +118,14 @@
}
},
- /**
- * Method: redraw
- * clear all the marker div's from the layer and then redraw all of them.
- * Use the map to recalculate new placement of markers.
- */
- redraw: function() {
- for(i=0; i < this.markers.length; i++) {
- this.drawMarker(this.markers[i]);
- }
- },
-
/**
- * Method: drawMarker
- * *Private*. Calculate the pixel location for the marker, create it, and
- * add it to the layer's div
- *
- * Parameters:
- * marker - {<OpenLayers.Marker>}
- */
+ * Method: drawMarker
+ * Calculate the pixel location for the marker, create it, and
+ * add it to the layer's div
+ *
+ * Parameters:
+ * marker - {<OpenLayers.Marker>}
+ */
drawMarker: function(marker) {
var px = this.map.getLayerPxFromLonLat(marker.lonlat);
if (px == null) {
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/WFS.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/WFS.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/WFS.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -15,7 +15,8 @@
*/
OpenLayers.Layer.WFS = OpenLayers.Class.create();
OpenLayers.Layer.WFS.prototype =
- OpenLayers.Class.inherit( OpenLayers.Layer.Vector, OpenLayers.Layer.Markers, {
+ OpenLayers.Class.inherit( OpenLayers.Layer.Vector,
+ OpenLayers.Layer.Markers, {
/**
* APIProperty: isBaseLayer
@@ -65,7 +66,9 @@
initialize: function(name, url, params, options) {
if (options == undefined) { options = {}; }
- if (options.featureClass || !OpenLayers.Layer.Vector || !OpenLayers.Feature.Vector) {
+ if (options.featureClass ||
+ !OpenLayers.Layer.Vector ||
+ !OpenLayers.Feature.Vector) {
this.vectorMode = false;
}
@@ -80,7 +83,8 @@
if (!options.featureClass) {
options.featureClass = OpenLayers.Feature.WFS;
}
- OpenLayers.Layer.Markers.prototype.initialize.apply(this, newArguments);
+ OpenLayers.Layer.Markers.prototype.initialize.apply(this,
+ newArguments);
}
if (this.params && this.params.typename && !this.options.typename) {
@@ -155,7 +159,8 @@
}
// don't load data if current zoom level doesn't match
- if (this.options.minZoomLevel && this.map.getZoom() < this.options.minZoomLevel) {
+ if (this.options.minZoomLevel &&
+ (this.map.getZoom() < this.options.minZoomLevel) ) {
return null;
};
@@ -223,11 +228,27 @@
*/
onMapResize: function() {
if(this.vectorMode) {
- OpenLayers.Layer.Vector.prototype.onMapResize.apply(this, arguments);
+ OpenLayers.Layer.Vector.prototype.onMapResize.apply(this,
+ arguments);
} else {
- OpenLayers.Layer.Markers.prototype.onMapResize.apply(this, arguments);
+ OpenLayers.Layer.Markers.prototype.onMapResize.apply(this,
+ arguments);
}
},
+
+ /**
+ * APIMethod: mergeNewParams
+ * Modify parameters for the layer and redraw.
+ *
+ * Parameters:
+ * newParams - {Object}
+ */
+ mergeNewParams:function(newParams) {
+ var upperParams = OpenLayers.Util.upperCaseObject(newParams);
+ var newArguments = [upperParams];
+ OpenLayers.Layer.HTTPRequest.prototype.mergeNewParams.apply(this,
+ newArguments);
+ },
/**
* APIMethod: clone
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -100,12 +100,14 @@
/**
* Property: options
- * {Object}
+ * {Object} An optional object whose properties will be set on the layer.
+ * Any of the layer properties can be set as a property of the options
+ * object and sent to the constructor when the layer is created.
*/
options: null,
/**
- * Property: gutter
+ * APIProperty: gutter
* {Integer} Determines the width (in pixels) of the gutter around image
* tiles to ignore. By setting this property to a non-zero
* value, images will be requested that are wider and taller
@@ -118,7 +120,7 @@
gutter: 0,
/**
- * Property: projection
+ * APIProperty: projection
* {String} Set in the layer options to override the default projection
* string this layer - also set maxExtent, maxResolution, and
* units if appropriate.
@@ -126,38 +128,41 @@
projection: null,
/**
- * Property: units
+ * APIProperty: units
* {String} The layer map units. Defaults to 'degrees'. Possible values
* are 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'.
*/
units: null,
/**
- * Property: scales
+ * APIProperty: scales
* {Array}
*/
scales: null,
/**
- * Property: resolutions
- * {Array}
+ * APIProperty: resolutions
+ * {Array} A list of map resolutions (map units per pixel) in descending
+ * order. If this is not set in the layer constructor, it will be set
+ * based on other resolution related properties (maxExtent, maxResolution,
+ * maxScale, etc.).
*/
resolutions: null,
/**
- * Property: maxExtent
+ * APIProperty: maxExtent
* {<OpenLayers.Bounds>}
*/
maxExtent: null,
/**
- * Property: minExtent
+ * APIProperty: minExtent
* {<OpenLayers.Bounds>}
*/
minExtent: null,
/**
- * Property: maxResolution
+ * APIProperty: maxResolution
* {Float} Default max is 360 deg / 256 px, which corresponds to
* zoom level 0 on gmaps. Specify a different value in the layer
* options if you are not using a geographic projection and
@@ -166,38 +171,38 @@
maxResolution: null,
/**
- * Property: minResolution
+ * APIProperty: minResolution
* {Float}
*/
minResolution: null,
/**
- * Property: numZoomLevels
+ * APIProperty: numZoomLevels
* {Integer}
*/
numZoomLevels: null,
/**
- * Property: minScale
+ * APIProperty: minScale
* {Float}
*/
minScale: null,
/**
- * Property: maxScale
+ * APIProperty: maxScale
* {Float}
*/
maxScale: null,
/**
- * Property: displayOutsideMaxExtent
+ * APIProperty: displayOutsideMaxExtent
* {Boolean} Request map tiles that are completely outside of the max extent
* for this layer. Defaults to false
*/
displayOutsideMaxExtent: false,
/**
- * Property: wrapDateLine
+ * APIProperty: wrapDateLine
* {Boolean} #487 for more info.
*/
wrapDateLine: false,
@@ -330,6 +335,31 @@
},
/**
+ * APIMethod: redraw
+ * Redraws the layer. Returns true if the layer was redrawn, false if not.
+ *
+ * Return:
+ * {Boolean} The layer was redrawn.
+ */
+ redraw: function() {
+ var redrawn = false;
+ if (this.map) {
+
+ // min/max Range may have changed
+ this.inRange = this.calculateInRange();
+
+ // map's center might not yet be set
+ var extent = this.getExtent();
+
+ if (extent && this.inRange && this.visibility) {
+ this.moveTo(extent, true, false);
+ redrawn = true;
+ }
+ }
+ return redrawn;
+ },
+
+ /**
* Method: moveTo
*
* Parameters:
@@ -446,12 +476,7 @@
if (visibility != this.visibility) {
this.visibility = visibility;
this.display(visibility);
- if (visibility && this.map != null) {
- var extent = this.map.getExtent();
- if (extent != null) {
- this.moveTo(extent, true);
- }
- }
+ this.redraw();
if ((this.map != null) &&
((noEvent == null) || (noEvent == false))) {
this.map.events.triggerEvent("changelayer");
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Map.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Map.js 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Map.js 2007-07-05 17:11:23 UTC (rev 3585)
@@ -105,8 +105,8 @@
/**
* APIProperty: baseLayer
- * {<OpenLayers.Layer>} The currently selected base layer - this determines
- * min/max zoom level, projection, etc.
+ * {<OpenLayers.Layer>} The currently selected base layer. This determines
+ * min/max zoom level, projection, etc.
*/
baseLayer: null,
@@ -136,7 +136,7 @@
*/
viewRequestID: 0,
- // Options
+ // Options
/**
* APIProperty: tileSize
@@ -146,7 +146,7 @@
tileSize: null,
/**
- * Property: projection
+ * APIProperty: projection
* {String} Set in the map options to override the default projection
* string this map - also set maxExtent, maxResolution, and
* units if appropriate.
@@ -154,14 +154,23 @@
projection: "EPSG:4326",
/**
- * Property: units
+ * APIProperty: units
* {String} The map units. Defaults to 'degrees'. Possible values are
* 'degrees' (or 'dd'), 'm', 'ft', 'km', 'mi', 'inches'.
*/
units: 'degrees',
/**
- * Property: maxResolution
+ * APIProperty: resolutions
+ * {Array} A list of map resolutions (map units per pixel) in descending
+ * order. If this is not set in the layer constructor, it will be set
+ * based on other resolution related properties (maxExtent, maxResolution,
+ * maxScale, etc.).
+ */
+ resolutions: null,
+
+ /**
+ * APIProperty: maxResolution
* {Float} Default max is 360 deg / 256 px, which corresponds to
* zoom level 0 on gmaps. Specify a different value in the map
* options if you are not using a geographic projection and
@@ -170,25 +179,25 @@
maxResolution: 1.40625,
/**
- * Property: minResolution
+ * APIProperty: minResolution
* {Float}
*/
minResolution: null,
/**
- * Property: maxScale
+ * APIProperty: maxScale
* {Float}
*/
maxScale: null,
/**
- * Property: minScale
+ * APIProperty: minScale
* {Float}
*/
minScale: null,
/**
- * Property: maxExtent
+ * APIProperty: maxExtent
* {<OpenLayers.Bounds>} The maximum extent for the map. Defaults to the
* whole world in decimal degrees
* (-180, -90, 180, 90). Specify a different
@@ -199,13 +208,13 @@
maxExtent: null,
/**
- * Property: minExtent
+ * APIProperty: minExtent
* {<OpenLayers.Bounds>}
*/
minExtent: null,
/**
- * Property: numZoomLevels
+ * APIProperty: numZoomLevels
* {Integer} Number of zoom levels for the map. Defaults to 16. Set a
* different value in the map options if needed.
*/
@@ -483,6 +492,9 @@
addLayer: function (layer) {
for(var i=0; i < this.layers.length; i++) {
if (this.layers[i] == layer) {
+ var msg = "You tried to add the layer: " + layer.name +
+ " to the map, but it has already been added";
+ OpenLayers.Console.warn(msg);
return false;
}
}
@@ -506,9 +518,7 @@
layer.setVisibility(false);
}
} else {
- if (this.getCenter() != null) {
- layer.moveTo(this.getExtent(), true);
- }
+ layer.redraw();
}
this.events.triggerEvent("addlayer");
Modified: sandbox/euzuro/untiled3/tests/Layer/test_HTTPRequest.html
===================================================================
--- sandbox/euzuro/untiled3/tests/Layer/test_HTTPRequest.html 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/tests/Layer/test_HTTPRequest.html 2007-07-05 17:11:23 UTC (rev 3585)
@@ -65,7 +65,7 @@
}
function test_05_Layer_HTTPRequest_mergeNewParams (t) {
- t.plan( 3 );
+ t.plan( 4 );
layer = new OpenLayers.Layer.HTTPRequest(name, url, params, options);
@@ -80,6 +80,11 @@
newParams.chickpeas = 151;
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hash");
+
+ layer.redraw = function() {
+ t.ok(true, "layer.mergeNewParams calls layer.redraw");
+ }
+ layer.mergeNewParams();
}
Modified: sandbox/euzuro/untiled3/tests/test_Layer.html
===================================================================
--- sandbox/euzuro/untiled3/tests/test_Layer.html 2007-07-05 14:24:15 UTC (rev 3584)
+++ sandbox/euzuro/untiled3/tests/test_Layer.html 2007-07-05 17:11:23 UTC (rev 3585)
@@ -165,6 +165,50 @@
}
+ function test_07_Layer_redraw(t) {
+ t.plan(8)
+
+ var name = 'Test Layer';
+ var url = "http://octo.metacarta.com/cgi-bin/mapserv";
+ var params = { map: '/mapdata/vmap_wms.map',
+ layers: 'basic',
+ format: 'image/jpeg'};
+
+ var layer = new OpenLayers.Layer.WMS(name, url, params);
+
+ t.ok(!layer.redraw(),
+ "redraw on an orphan layer returns false");
+
+ var map = new OpenLayers.Map('map');
+ map.addLayer(layer);
+
+ t.ok(!layer.redraw(),
+ "redraw returns false if map does not yet have a center");
+ map.zoomToMaxExtent();
+
+ t.ok(layer.redraw(),
+ "redraw returns true after map has a center");
+
+ layer.setVisibility(false);
+ t.ok(!layer.redraw(),
+ "redraw returns false if a layer is not visible");
+
+ layer.setVisibility(true);
+ t.ok(layer.redraw(),
+ "redraw returns true even if extent has not changed");
+
+ layer.moveTo = function(bounds, zoomChanged, dragging) {
+ var extent = layer.map.getExtent();
+ t.ok(bounds.equals(extent),
+ "redraw calls moveTo with the map extent");
+ t.ok(zoomChanged,
+ "redraw calls moveTo with zoomChanged true");
+ t.ok(!dragging,
+ "redraw calls moveTo with dragging false");
+ }
+ layer.redraw();
+
+ }
/******
*
More information about the Commits
mailing list