Changeset 605
- Timestamp:
- 06/15/06 15:02:21 (3 years ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Tile/Image.js (modified) (3 diffs)
- trunk/openlayers/tests/test_Layer_WMS.html (modified) (1 diff)
- trunk/openlayers/tests/test_Tile_Image.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Tile/Image.js
r522 r605 8 8 9 9 /** @type DOMElement img */ 10 img :null,10 imgDiv:null, 11 11 12 12 /** … … 24 24 25 25 destroy: function() { 26 if ((this.img != null) && (this.img.parentNode == this.layer.div)) {27 this.layer.div.removeChild(this.img );26 if ((this.imgDiv != null) && (this.imgDiv.parentNode == this.layer.div)) { 27 this.layer.div.removeChild(this.imgDiv); 28 28 } 29 this.img = null;29 this.imgDiv = null; 30 30 OpenLayers.Tile.prototype.destroy.apply(this, arguments); 31 31 }, … … 34 34 */ 35 35 draw:function() { 36 this.img = OpenLayers.Util.createImage(null,37 this.position,38 this.size,39 this.url,40 "absolute");41 this.layer.div.appendChild(this.img );36 this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null, 37 this.position, 38 this.size, 39 this.url, 40 "absolute"); 41 this.layer.div.appendChild(this.imgDiv); 42 42 }, 43 43 trunk/openlayers/tests/test_Layer_WMS.html
r601 r605 26 26 var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel); 27 27 tile.draw(); 28 t.eq( tile.img.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "image src is created correctly via addtile" ); 29 t.eq( tile.img.style.top, "6px", "image top is set correctly via addtile" ); 30 t.eq( tile.img.style.left, "5px", "image top is set correctly via addtile" ); 28 29 var img = tile.imgDiv.childNodes[0]; 30 31 t.eq( img.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "image src is created correctly via addtile" ); 32 t.eq( tile.imgDiv.style.top, "6px", "image top is set correctly via addtile" ); 33 t.eq( tile.imgDiv.style.left, "5px", "image top is set correctly via addtile" ); 34 35 var firstChild = layer.div.firstChild; 31 36 if (!isMozilla) 32 37 t.ok( true, "skipping element test outside of Mozilla"); 33 38 else 34 t.ok( layer.div.firstChild instanceof HTMLImageElement, "div first child is an image object" );35 t.eq( layer.div.firstChild.src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "div first child is correct image object" );39 t.ok( firstChild instanceof HTMLElement, "div first child is an image object" ); 40 t.eq( firstChild.childNodes[0].src, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=/mapdata/vmap_wms.map&LAYERS=basic&FORMAT=image/jpeg&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&SRS=EPSG:4326&BBOX=1,2,3,4&WIDTH=256&HEIGHT=256", "div first child is correct image object" ); 36 41 var pos = tile.getPosition(); 37 42 t.eq( pos.toString(), "x=5,y=6", "Position of tile is set correctly." ); trunk/openlayers/tests/test_Tile_Image.html
r512 r605 24 24 } 25 25 function test_02_Tile_Image_draw (t) { 26 t.plan( 4);26 t.plan( 5 ); 27 27 28 28 var layer = new Object(); //bogus layer … … 35 35 36 36 tile.draw(); 37 38 var img = tile.imgDiv.childNodes[0]; 39 37 40 if (!isMozilla) 38 41 t.ok( true, "skipping element test outside of Mozilla"); 39 42 else 40 t.ok( tile.img instanceof HTMLImageElement, "tile.draw creates an image"); 41 t.eq( tile.img.src, "http://www.openlayers.org/dev/tests/tileimage", "tile.draw creates an image"); 42 t.eq( tile.img.style.width, "5px", "Image width is correct" ); 43 t.eq( tile.img.style.height, "6px", "Image height is correct" ); 43 t.ok( tile.imgDiv instanceof HTMLElement, "tile.draw creates an image"); 44 if (!isMozilla) 45 t.ok( true, "skipping element test outside of Mozilla"); 46 else 47 t.ok( img instanceof HTMLImageElement, "tile.draw creates an image"); 48 t.eq( img.src, "http://www.openlayers.org/dev/tests/tileimage", "tile.draw creates an image"); 49 t.eq( tile.imgDiv.style.width, "5px", "Image width is correct" ); 50 t.eq( tile.imgDiv.style.height, "6px", "Image height is correct" ); 44 51 } 45 52
