]> git.openstreetmap.org Git - rails.git/blob - public/lib/OpenLayers/Tile/Image.js
Potlatch 0.11b
[rails.git] / public / lib / OpenLayers / Tile / Image.js
1 /* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
2  * See http://svn.openlayers.org/trunk/openlayers/license.txt for the full
3  * text of the license. */
4 // @require: OpenLayers/Tile.js
5 /**
6 * @class
7 */
8 OpenLayers.Tile.Image = Class.create();
9 OpenLayers.Tile.Image.prototype = 
10   Object.extend( new OpenLayers.Tile(), {
11     
12     /** @type DOMElement img */
13     imgDiv:null,
14
15     /** 
16     * @constructor
17     *
18     * @param {OpenLayers.Grid} layer
19     * @param {OpenLayers.Pixel} position
20     * @param {OpenLayers.Bounds} bounds
21     * @param {String} url
22     * @param {OpenLayers.Size} size
23     */
24     initialize: function(layer, position, bounds, url, size) {
25         OpenLayers.Tile.prototype.initialize.apply(this, arguments);
26     },
27
28     destroy: function() {
29         if ((this.imgDiv != null) && (this.imgDiv.parentNode == this.layer.div)) {
30             this.layer.div.removeChild(this.imgDiv);
31         }
32         this.imgDiv = null;
33         OpenLayers.Tile.prototype.destroy.apply(this, arguments);
34     },
35
36     /**
37     */
38     draw:function(transparent) {
39         if (false) { // don't actually use the alpha PNG hack right now
40                      // it has a fiercely bad effect on IE6's performance
41             // if (transparent) {
42             this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null,
43                                                            this.position,
44                                                            this.size,
45                                                            this.url,
46                                                            "absolute");
47         } else {
48             this.imgDiv = OpenLayers.Util.createImage(null,
49                                                       this.position,
50                                                       this.size,
51                                                       this.url,
52                                                       "absolute");
53         }
54         this.layer.div.appendChild(this.imgDiv);
55     },
56
57     /** @final @type String */
58     CLASS_NAME: "OpenLayers.Tile.Image"
59   }
60 );