[OpenLayers-Commits] r3596 - sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer
commits at openlayers.org
commits at openlayers.org
Thu Jul 5 14:57:51 EDT 2007
Author: euzuro
Date: 2007-07-05 14:57:49 -0400 (Thu, 05 Jul 2007)
New Revision: 3596
Modified:
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js
Log:
revert changes made to MapServer untiled class. I can't deal with the code in these mapserver layers. If someone has the motivation to go through and clean these layers up, there is no reason that they cannot share the singleTile functionality. I'm willing to fix these myself, but I cannot spare the time right now.
Modified: sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js
===================================================================
--- sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js 2007-07-05 18:54:38 UTC (rev 3595)
+++ sandbox/euzuro/untiled3/lib/OpenLayers/Layer/MapServer/Untiled.js 2007-07-05 18:57:49 UTC (rev 3596)
@@ -3,37 +3,138 @@
* for the full text of the license. */
/**
+ * @requires OpenLayers/Layer/HTTPRequest.js
* @requires OpenLayers/Layer/MapServer.js
*
* Class: OpenLayers.Layer.MapServer.Untiled
*
* Inherits from:
- * - <OpenLayers.Layer.MapServer>
+ * - <OpenLayers.Layer.HTTPRequest>
*/
OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class.create();
OpenLayers.Layer.MapServer.Untiled.prototype =
- OpenLayers.Class.inherit( OpenLayers.Layer.Mapserver, {
+ OpenLayers.Class.inherit( OpenLayers.Layer.HTTPRequest, {
/**
- * APIProperty: singleTile
- * {Boolean} Always true for untiled layer.
+ * Constant: default_params
+ * Hashtable of default parameter key/value pairs
*/
- singleTile: true,
+ default_params: {
+ mode: "map",
+ map_imagetype: "png"
+ },
+
+ /**
+ * APIProperty: reproject
+ * {Boolean} 'stretch' tiles according to base layer.
+ */
+ reproject: true,
/**
- * Constructor: OpenLayers.Layer.MapServer.Untiled
- *
- * Parameters:
- * name - {String}
- * url - {String}
- * params - {Object}
+ * APIProperty: ratio
+ * {Float} the ratio of image/tile size to map size (this is the untiled
+ * buffer)
*/
+ ratio: 1,
+
+ /**
+ * Property: tile
+ * {<OpenLayers.Tile.Image>}
+ */
+ tile: null,
+
+ /**
+ * Propety: doneLoading
+ * {Boolean} did the image finish loading before a new draw was initiated?
+ */
+ doneLoading: false,
+
+ /**
+ * Constructor: OpenLayers.Layer.MapServer.Untiled
+ *
+ * Parameters:
+ * name - {String}
+ * url - {String}
+ * params - {Object}
+ */
initialize: function(name, url, params, options) {
- OpenLayers.Layer.MapServer.prototype.initialize.apply(this, arguments);
+ var newArguments = [];
+ newArguments.push(name, url, params, options);
+ OpenLayers.Layer.HTTPRequest.prototype.initialize.apply(this,
+ newArguments);
+ OpenLayers.Util.applyDefaults(
+ this.params,
+ this.default_params
+ );
+
+ // unless explicitly set in options, if the layer is transparent,
+ // it will be an overlay
+ if ((options == null) || (options.isBaseLayer == null)) {
+ this.isBaseLayer = ((this.params.transparent != "true") &&
+ (this.params.transparent != true));
+ }
},
+ /**
+ * APIMethod: destroy
+ */
+ destroy: function() {
+ if (this.tile) {
+ this.tile.destroy();
+ this.tile = null;
+ }
+ OpenLayers.Layer.HTTPRequest.prototype.destroy.apply(this, arguments);
+ },
+
+ /**
+ * APIMethod: clone
+ * obj - {Object}
+ *
+ * Returns:
+ * {<OpenLayers.Layer.MapServer.Untiled>} An exact clone of this
+ * OpenLayers.Layer.MapServer.Untiled
+ */
+ clone: function (obj) {
+
+ if (obj == null) {
+ obj = new OpenLayers.Layer.MapServer.Untiled(this.name,
+ this.url,
+ this.params,
+ this.options);
+ }
+ //get all additions from superclasses
+ obj = OpenLayers.Layer.HTTPRequest.prototype.clone.apply(this, [obj]);
+
+ // copy/set any non-init, non-simple values here
+
+ return obj;
+ },
+
+
/**
+ * Method: setMap
+ * Once HTTPRequest has set the map, we can load the image div
+ *
+ * Parameters:
+ * map - {<OpenLayers.Map>}
+ */
+ setMap: function(map) {
+ OpenLayers.Layer.HTTPRequest.prototype.setMap.apply(this, arguments);
+ },
+
+ /**
+ * Method: setTileSize
+ * Set the tile size based on the map size.
+ */
+ setTileSize: function() {
+ var tileSize = this.map.getSize();
+ tileSize.w = tileSize.w * this.ratio;
+ tileSize.h = tileSize.h * this.ratio;
+ this.tileSize = tileSize;
+ },
+
+ /**
* Method: moveTo
* When it is not a dragging move (ie when done dragging)
* reload and recenter the div.
More information about the Commits
mailing list