| 6 | | OpenLayers.Popup = Class.create(); |
|---|
| 7 | | |
|---|
| 8 | | OpenLayers.Popup.count = 0; |
|---|
| 9 | | OpenLayers.Popup.SIZE = new OpenLayers.Size(200, 200); |
|---|
| 10 | | OpenLayers.Popup.COLOR = "white"; |
|---|
| 11 | | OpenLayers.Popup.OPACITY = 1; |
|---|
| 12 | | OpenLayers.Popup.BORDER = "0px"; |
|---|
| 13 | | |
|---|
| 14 | | OpenLayers.Popup.prototype = { |
|---|
| 15 | | |
|---|
| 16 | | /** @type String */ |
|---|
| 17 | | id: "", |
|---|
| 18 | | |
|---|
| 19 | | /** reference to the parent DIV to which this popup is @type DOMElement */ |
|---|
| 20 | | parent: null, |
|---|
| 21 | | |
|---|
| 22 | | /** @type OpenLayers.LonLat */ |
|---|
| 23 | | lonlat: null, |
|---|
| 24 | | |
|---|
| 25 | | /** @type DOMElement */ |
|---|
| 26 | | div: null, |
|---|
| 27 | | |
|---|
| 28 | | /** @type OpenLayers.Size*/ |
|---|
| 29 | | size: null, |
|---|
| 30 | | |
|---|
| 31 | | /** @type String */ |
|---|
| 32 | | contentHTML: "", |
|---|
| 33 | | |
|---|
| 34 | | /** @type String */ |
|---|
| 35 | | backgroundColor: "", |
|---|
| 36 | | |
|---|
| 37 | | /** @type float */ |
|---|
| 38 | | opacity: "", |
|---|
| 39 | | |
|---|
| 40 | | /** @type String */ |
|---|
| 41 | | border: "", |
|---|
| 42 | | |
|---|
| | 6 | OpenLayers.Popup.Anchored = Class.create(); |
|---|
| | 7 | OpenLayers.Popup.Anchored.prototype = |
|---|
| | 8 | Object.extend( new OpenLayers.Popup(), { |
|---|
| 53 | | OpenLayers.Popup.count += 1; |
|---|
| 54 | | this.id = (id != null) ? id : "Popup" + OpenLayers.Popup.count; |
|---|
| 55 | | this.lonlat = lonlat; |
|---|
| 56 | | this.size = (size != null) ? size : OpenLayers.Popup.SIZE; |
|---|
| 57 | | if (contentHTML != null) { |
|---|
| 58 | | this.contentHTML = contentHTML; |
|---|
| 59 | | } |
|---|
| 60 | | this.backgroundColor = OpenLayers.Popup.COLOR; |
|---|
| 61 | | this.opacity = OpenLayers.Popup.OPACITY; |
|---|
| 62 | | this.border = OpenLayers.Popup.BORDER; |
|---|
| | 19 | OpenLayers.Popup.prototype.initialize.apply(this, arguments); |
|---|
| 104 | | /** |
|---|
| 105 | | * @param {OpenLayers.Size} size |
|---|
| 106 | | */ |
|---|
| 107 | | setSize:function(size) { |
|---|
| 108 | | if (size != undefined) { |
|---|
| 109 | | this.size = size; |
|---|
| 110 | | } |
|---|
| 111 | | |
|---|
| 112 | | if (this.div != null) { |
|---|
| 113 | | this.div.style.width = this.size.w; |
|---|
| 114 | | this.div.style.height = this.size.h; |
|---|
| 115 | | } |
|---|
| 116 | | }, |
|---|
| 117 | | |
|---|
| 118 | | /** |
|---|
| 119 | | * @param {String} color |
|---|
| 120 | | */ |
|---|
| 121 | | setBackgroundColor:function(color) { |
|---|
| 122 | | if (color != undefined) { |
|---|
| 123 | | this.backgroundColor = color; |
|---|
| 124 | | } |
|---|
| 125 | | |
|---|
| 126 | | if (this.div != null) { |
|---|
| 127 | | this.div.style.backgroundColor = this.backgroundColor; |
|---|
| 128 | | } |
|---|
| 129 | | }, |
|---|
| 130 | | |
|---|
| 131 | | /** |
|---|
| 132 | | * @param {float} opacity |
|---|
| 133 | | */ |
|---|
| 134 | | setOpacity:function(opacity) { |
|---|
| 135 | | if (opacity != undefined) { |
|---|
| 136 | | this.opacity = opacity; |
|---|
| 137 | | } |
|---|
| 138 | | |
|---|
| 139 | | if (this.div != null) { |
|---|
| 140 | | // for Mozilla and Safari |
|---|
| 141 | | this.div.style.opacity = this.opacity; |
|---|
| 142 | | |
|---|
| 143 | | // for IE |
|---|
| 144 | | this.div.style.filter = 'alpha(opacity=' + this.opacity*100 + ')'; |
|---|
| 145 | | } |
|---|
| 146 | | }, |
|---|
| 147 | | |
|---|
| 148 | | /** |
|---|
| 149 | | * @param {int} border |
|---|
| 150 | | */ |
|---|
| 151 | | setBorder:function(border) { |
|---|
| 152 | | if (border != undefined) { |
|---|
| 153 | | this.border = border; |
|---|
| 154 | | } |
|---|
| 155 | | |
|---|
| 156 | | if (this.div != null) { |
|---|
| 157 | | this.div.style.border = this.border; |
|---|
| 158 | | } |
|---|
| 159 | | }, |
|---|
| 160 | | |
|---|
| 161 | | /** |
|---|
| 162 | | * @param {String} contentHTML |
|---|
| 163 | | */ |
|---|
| 164 | | setContentHTML:function(contentHTML) { |
|---|
| 165 | | if (contentHTML != null) { |
|---|
| 166 | | this.contentHTML = contentHTML; |
|---|
| 167 | | } |
|---|
| 168 | | |
|---|
| 169 | | if (this.div != null) { |
|---|
| 170 | | this.div.innerHTML = this.contentHTML; |
|---|
| 171 | | } |
|---|
| 172 | | }, |
|---|
| 173 | | |
|---|
| 174 | | CLASS_NAME: "OpenLayers.Popup" |
|---|
| 175 | | }; |
|---|
| | 45 | CLASS_NAME: "OpenLayers.Popup.Anchored" |
|---|
| | 46 | }); |
|---|