Changeset 3555
- Timestamp:
- 07/02/07 18:51:50 (1 year ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Layer.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/Image.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/MapServer.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/MapServer/Untiled.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Layer/WMS.js (modified) (1 diff)
- trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js (modified) (2 diffs)
- trunk/openlayers/lib/OpenLayers/Tile/Image.js (modified) (3 diffs)
- trunk/openlayers/tests/Layer/test_Image.html (modified) (2 diffs)
- trunk/openlayers/tests/Tile/test_Image.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Layer.js
r3545 r3555 382 382 } 383 383 }, 384 385 /** 386 * @returns The size that the image should be, taking into account gutters 387 * @tile OpenLayers.Size 388 */ 389 getImageSize: function() { 390 return (this.imageSize || this.tileSize); 391 }, 384 392 385 393 /** … … 406 414 this.imageSize = new OpenLayers.Size(tileSize.w + (2 * this.gutter), 407 415 tileSize.h + (2 * this.gutter)); 408 } else {409 // layers without gutters may have null tile size - as long410 // as they don't rely on Tile.Image411 this.imageSize = tileSize;412 this.imageOffset = new OpenLayers.Pixel(0, 0);413 416 } 414 417 }, trunk/openlayers/lib/OpenLayers/Layer/Image.js
r3545 r3555 173 173 174 174 /** 175 * Set the tile size based on the map size. This also sets layer.imageSize 176 * and layer.imageOffset for use by Tile.Image. 175 * Set the tile size based on the map size. 177 176 */ 178 177 setTileSize: function() { … … 180 179 var tileHeight = this.extent.getHeight() / this.map.getResolution(); 181 180 this.tileSize = new OpenLayers.Size(tileWidth, tileHeight); 182 this.imageSize = this.tileSize;183 this.imageOffset = new OpenLayers.Pixel(0, 0);184 181 }, 185 182 trunk/openlayers/lib/OpenLayers/Layer/MapServer.js
r3545 r3555 120 120 // Make a list, so that getFullRequestString uses literal "," 121 121 var extent = [bounds.left, bounds. bottom, bounds.right, bounds.top]; 122 123 var imageSize = this.getImageSize(); 122 124 123 125 // make lists, so that literal ','s are used … … 125 127 {mapext: extent, 126 128 imgext: extent, 127 map_size: [ this.imageSize.w, this.imageSize.h],128 imgx: this.imageSize.w / 2,129 imgy: this.imageSize.h / 2,130 imgxy: [ this.imageSize.w, this.imageSize.h]129 map_size: [imageSize.w, imageSize.h], 130 imgx: imageSize.w / 2, 131 imgy: imageSize.h / 2, 132 imgxy: [imageSize.w, imageSize.h] 131 133 }); 132 134 trunk/openlayers/lib/OpenLayers/Layer/MapServer/Untiled.js
r3545 r3555 126 126 /** 127 127 * Method: setTileSize 128 * Set the tile size based on the map size. This also sets layer.imageSize 129 * and layer.imageOffset for use by Tile.Image. 128 * Set the tile size based on the map size. 130 129 */ 131 130 setTileSize: function() { … … 134 133 tileSize.h = tileSize.h * this.ratio; 135 134 this.tileSize = tileSize; 136 this.imageSize = tileSize;137 this.imageOffset = new OpenLayers.Pixel(0, 0);138 135 }, 139 136 trunk/openlayers/lib/OpenLayers/Layer/WMS.js
r3554 r3555 143 143 getURL: function (bounds) { 144 144 bounds = this.adjustBounds(bounds); 145 146 var imageSize = this.getImageSize(); 145 147 return this.getFullRequestString( 146 148 {BBOX:bounds.toBBOX(), 147 WIDTH: this.imageSize.w,148 HEIGHT: this.imageSize.h});149 WIDTH:imageSize.w, 150 HEIGHT:imageSize.h}); 149 151 }, 150 152 trunk/openlayers/lib/OpenLayers/Layer/WMS/Untiled.js
r3554 r3555 148 148 /** 149 149 * Method: setTileSize 150 * Set the tile size based on the map size. This also sets layer.imageSize 151 * and layer.imageOffset for use by Tile.Image. 150 * Set the tile size based on the map size. 152 151 */ 153 152 setTileSize: function() { … … 156 155 tileSize.h = tileSize.h * this.ratio; 157 156 this.tileSize = tileSize; 158 this.imageSize = tileSize;159 this.imageOffset = new OpenLayers.Pixel(0, 0);160 157 }, 161 158 trunk/openlayers/lib/OpenLayers/Tile/Image.js
r3545 r3555 108 108 null, this.position, this.size); 109 109 110 var imageSize = this.layer.getImageSize(); 110 111 if (this.layer.alpha) { 111 112 OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv, 112 null, null, this.layer.imageSize, this.url);113 null, null, imageSize, this.url); 113 114 } else { 114 115 this.imgDiv.src = this.url; 115 116 OpenLayers.Util.modifyDOMElement(this.imgDiv, 116 null, null, this.layer.imageSize) ;117 null, null, imageSize) ; 117 118 } 118 119 this.drawn = true; … … 154 155 */ 155 156 initImgDiv: function() { 157 158 var offset = this.layer.imageOffset; 159 var size = this.layer.getImageSize(); 160 156 161 if (this.layer.alpha) { 157 162 this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null, 158 this.layer.imageOffset,159 this.layer.imageSize,163 offset, 164 size, 160 165 null, 161 166 "relative", … … 166 171 } else { 167 172 this.imgDiv = OpenLayers.Util.createImage(null, 168 this.layer.imageOffset,169 this.layer.imageSize,173 offset, 174 size, 170 175 null, 171 176 "relative", trunk/openlayers/tests/Layer/test_Image.html
r3299 r3555 40 40 41 41 function test_50_Layer_Image_tileTests (t) { 42 t.plan( 9);42 t.plan(6); 43 43 var map = new OpenLayers.Map('map'); 44 44 … … 50 50 map.addLayer(layer); 51 51 map.zoomToMaxExtent(); 52 t.ok(layer.imageSize, "layer.imageSize is set");53 t.ok(layer.tileSize, "layer.tileSize is set");54 t.ok(layer.tileSize.equals(layer.imageSize), "tileSize equals imageSize");55 52 56 53 // no resolution info was sent, so maxResolution should be calculated trunk/openlayers/tests/Tile/test_Image.html
r3172 r3555 189 189 190 190 var tile = layer.grid[0][0]; 191 t.ok(tile.layer.imageSize .equals(tile.size),192 "zero size gutter doesn't changeimage size");193 194 t.ok(tile.layer.imageOffset .equals(new OpenLayers.Pixel(0, 0)),195 "zero size gutter doesn't affect image offset");191 t.ok(tile.layer.imageSize == null, 192 "zero size gutter doesn't set image size"); 193 194 t.ok(tile.layer.imageOffset == null, 195 "zero size gutter doesn't set image offset"); 196 196 197 197 var zero_gutter_bounds = tile.bounds;
