1 | /* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for |
---|
2 | * full list of contributors). Published under the Clear BSD license. |
---|
3 | * See http://svn.openlayers.org/trunk/openlayers/license.txt for the |
---|
4 | * full text of the license. */ |
---|
5 | |
---|
6 | /** |
---|
7 | * @requires OpenLayers/Popup/Framed.js |
---|
8 | * @requires OpenLayers/Util.js |
---|
9 | */ |
---|
10 | |
---|
11 | /** |
---|
12 | * Class: OpenLayers.Popup.FramedCloud |
---|
13 | * |
---|
14 | * Inherits from: |
---|
15 | * - <OpenLayers.Popup.Framed> |
---|
16 | */ |
---|
17 | OpenLayers.Popup.FramedCloud = |
---|
18 | OpenLayers.Class(OpenLayers.Popup.Framed, { |
---|
19 | |
---|
20 | /** |
---|
21 | * Property: contentDisplayClass |
---|
22 | * {String} The CSS class of the popup content div. |
---|
23 | */ |
---|
24 | contentDisplayClass: "olFramedCloudPopupContent", |
---|
25 | |
---|
26 | /** |
---|
27 | * APIProperty: autoSize |
---|
28 | * {Boolean} Framed Cloud is autosizing by default. |
---|
29 | */ |
---|
30 | autoSize: true, |
---|
31 | |
---|
32 | /** |
---|
33 | * APIProperty: panMapIfOutOfView |
---|
34 | * {Boolean} Framed Cloud does pan into view by default. |
---|
35 | */ |
---|
36 | panMapIfOutOfView: true, |
---|
37 | |
---|
38 | /** |
---|
39 | * APIProperty: imageSize |
---|
40 | * {<OpenLayers.Size>} |
---|
41 | */ |
---|
42 | imageSize: new OpenLayers.Size(1276, 736), |
---|
43 | |
---|
44 | /** |
---|
45 | * APIProperty: isAlphaImage |
---|
46 | * {Boolean} The FramedCloud does not use an alpha image (in honor of the |
---|
47 | * good ie6 folk out there) |
---|
48 | */ |
---|
49 | isAlphaImage: false, |
---|
50 | |
---|
51 | /** |
---|
52 | * APIProperty: fixedRelativePosition |
---|
53 | * {Boolean} The Framed Cloud popup works in just one fixed position. |
---|
54 | */ |
---|
55 | fixedRelativePosition: false, |
---|
56 | |
---|
57 | /** |
---|
58 | * Property: positionBlocks |
---|
59 | * {Object} Hash of differen position blocks, keyed by relativePosition |
---|
60 | * two-character code string (ie "tl", "tr", "bl", "br") |
---|
61 | */ |
---|
62 | positionBlocks: { |
---|
63 | "tl": { |
---|
64 | 'offset': new OpenLayers.Pixel(44, 0), |
---|
65 | 'padding': new OpenLayers.Bounds(8, 40, 8, 9), |
---|
66 | 'blocks': [ |
---|
67 | { // top-left |
---|
68 | size: new OpenLayers.Size('auto', 'auto'), |
---|
69 | anchor: new OpenLayers.Bounds(0, 51, 22, 0), |
---|
70 | position: new OpenLayers.Pixel(0, 0) |
---|
71 | }, |
---|
72 | { //top-right |
---|
73 | size: new OpenLayers.Size(22, 'auto'), |
---|
74 | anchor: new OpenLayers.Bounds(null, 50, 0, 0), |
---|
75 | position: new OpenLayers.Pixel(-1238, 0) |
---|
76 | }, |
---|
77 | { //bottom-left |
---|
78 | size: new OpenLayers.Size('auto', 19), |
---|
79 | anchor: new OpenLayers.Bounds(0, 32, 22, null), |
---|
80 | position: new OpenLayers.Pixel(0, -631) |
---|
81 | }, |
---|
82 | { //bottom-right |
---|
83 | size: new OpenLayers.Size(22, 18), |
---|
84 | anchor: new OpenLayers.Bounds(null, 32, 0, null), |
---|
85 | position: new OpenLayers.Pixel(-1238, -632) |
---|
86 | }, |
---|
87 | { // stem |
---|
88 | size: new OpenLayers.Size(81, 35), |
---|
89 | anchor: new OpenLayers.Bounds(null, 0, 0, null), |
---|
90 | position: new OpenLayers.Pixel(0, -688) |
---|
91 | } |
---|
92 | ] |
---|
93 | }, |
---|
94 | "tr": { |
---|
95 | 'offset': new OpenLayers.Pixel(-45, 0), |
---|
96 | 'padding': new OpenLayers.Bounds(8, 40, 8, 9), |
---|
97 | 'blocks': [ |
---|
98 | { // top-left |
---|
99 | size: new OpenLayers.Size('auto', 'auto'), |
---|
100 | anchor: new OpenLayers.Bounds(0, 51, 22, 0), |
---|
101 | position: new OpenLayers.Pixel(0, 0) |
---|
102 | }, |
---|
103 | { //top-right |
---|
104 | size: new OpenLayers.Size(22, 'auto'), |
---|
105 | anchor: new OpenLayers.Bounds(null, 50, 0, 0), |
---|
106 | position: new OpenLayers.Pixel(-1238, 0) |
---|
107 | }, |
---|
108 | { //bottom-left |
---|
109 | size: new OpenLayers.Size('auto', 19), |
---|
110 | anchor: new OpenLayers.Bounds(0, 32, 22, null), |
---|
111 | position: new OpenLayers.Pixel(0, -631) |
---|
112 | }, |
---|
113 | { //bottom-right |
---|
114 | size: new OpenLayers.Size(22, 19), |
---|
115 | anchor: new OpenLayers.Bounds(null, 32, 0, null), |
---|
116 | position: new OpenLayers.Pixel(-1238, -631) |
---|
117 | }, |
---|
118 | { // stem |
---|
119 | size: new OpenLayers.Size(81, 35), |
---|
120 | anchor: new OpenLayers.Bounds(0, 0, null, null), |
---|
121 | position: new OpenLayers.Pixel(-215, -687) |
---|
122 | } |
---|
123 | ] |
---|
124 | }, |
---|
125 | "bl": { |
---|
126 | 'offset': new OpenLayers.Pixel(45, 0), |
---|
127 | 'padding': new OpenLayers.Bounds(8, 9, 8, 40), |
---|
128 | 'blocks': [ |
---|
129 | { // top-left |
---|
130 | size: new OpenLayers.Size('auto', 'auto'), |
---|
131 | anchor: new OpenLayers.Bounds(0, 21, 22, 32), |
---|
132 | position: new OpenLayers.Pixel(0, 0) |
---|
133 | }, |
---|
134 | { //top-right |
---|
135 | size: new OpenLayers.Size(22, 'auto'), |
---|
136 | anchor: new OpenLayers.Bounds(null, 21, 0, 32), |
---|
137 | position: new OpenLayers.Pixel(-1238, 0) |
---|
138 | }, |
---|
139 | { //bottom-left |
---|
140 | size: new OpenLayers.Size('auto', 21), |
---|
141 | anchor: new OpenLayers.Bounds(0, 0, 22, null), |
---|
142 | position: new OpenLayers.Pixel(0, -629) |
---|
143 | }, |
---|
144 | { //bottom-right |
---|
145 | size: new OpenLayers.Size(22, 21), |
---|
146 | anchor: new OpenLayers.Bounds(null, 0, 0, null), |
---|
147 | position: new OpenLayers.Pixel(-1238, -629) |
---|
148 | }, |
---|
149 | { // stem |
---|
150 | size: new OpenLayers.Size(81, 33), |
---|
151 | anchor: new OpenLayers.Bounds(null, null, 0, 0), |
---|
152 | position: new OpenLayers.Pixel(-101, -674) |
---|
153 | } |
---|
154 | ] |
---|
155 | }, |
---|
156 | "br": { |
---|
157 | 'offset': new OpenLayers.Pixel(-44, 0), |
---|
158 | 'padding': new OpenLayers.Bounds(8, 9, 8, 40), |
---|
159 | 'blocks': [ |
---|
160 | { // top-left |
---|
161 | size: new OpenLayers.Size('auto', 'auto'), |
---|
162 | anchor: new OpenLayers.Bounds(0, 21, 22, 32), |
---|
163 | position: new OpenLayers.Pixel(0, 0) |
---|
164 | }, |
---|
165 | { //top-right |
---|
166 | size: new OpenLayers.Size(22, 'auto'), |
---|
167 | anchor: new OpenLayers.Bounds(null, 21, 0, 32), |
---|
168 | position: new OpenLayers.Pixel(-1238, 0) |
---|
169 | }, |
---|
170 | { //bottom-left |
---|
171 | size: new OpenLayers.Size('auto', 21), |
---|
172 | anchor: new OpenLayers.Bounds(0, 0, 22, null), |
---|
173 | position: new OpenLayers.Pixel(0, -629) |
---|
174 | }, |
---|
175 | { //bottom-right |
---|
176 | size: new OpenLayers.Size(22, 21), |
---|
177 | anchor: new OpenLayers.Bounds(null, 0, 0, null), |
---|
178 | position: new OpenLayers.Pixel(-1238, -629) |
---|
179 | }, |
---|
180 | { // stem |
---|
181 | size: new OpenLayers.Size(81, 33), |
---|
182 | anchor: new OpenLayers.Bounds(0, null, null, 0), |
---|
183 | position: new OpenLayers.Pixel(-311, -674) |
---|
184 | } |
---|
185 | ] |
---|
186 | } |
---|
187 | }, |
---|
188 | |
---|
189 | /** |
---|
190 | * APIProperty: minSize |
---|
191 | * {<OpenLayers.Size>} |
---|
192 | */ |
---|
193 | minSize: new OpenLayers.Size(105, 10), |
---|
194 | |
---|
195 | /** |
---|
196 | * APIProperty: maxSize |
---|
197 | * {<OpenLayers.Size>} |
---|
198 | */ |
---|
199 | maxSize: new OpenLayers.Size(1200, 660), |
---|
200 | |
---|
201 | /** |
---|
202 | * Constructor: OpenLayers.Popup.FramedCloud |
---|
203 | * |
---|
204 | * Parameters: |
---|
205 | * id - {String} |
---|
206 | * lonlat - {<OpenLayers.LonLat>} |
---|
207 | * contentSize - {<OpenLayers.Size>} |
---|
208 | * contentHTML - {String} |
---|
209 | * anchor - {Object} Object to which we'll anchor the popup. Must expose |
---|
210 | * a 'size' (<OpenLayers.Size>) and 'offset' (<OpenLayers.Pixel>) |
---|
211 | * (Note that this is generally an <OpenLayers.Icon>). |
---|
212 | * closeBox - {Boolean} |
---|
213 | * closeBoxCallback - {Function} Function to be called on closeBox click. |
---|
214 | */ |
---|
215 | initialize:function(id, lonlat, contentSize, contentHTML, anchor, closeBox, |
---|
216 | closeBoxCallback) { |
---|
217 | |
---|
218 | this.imageSrc = OpenLayers.Util.getImagesLocation() + 'cloud-popup-relative.png'; |
---|
219 | OpenLayers.Popup.Framed.prototype.initialize.apply(this, arguments); |
---|
220 | this.contentDiv.className = this.contentDisplayClass; |
---|
221 | }, |
---|
222 | |
---|
223 | /** |
---|
224 | * APIMethod: destroy |
---|
225 | */ |
---|
226 | destroy: function() { |
---|
227 | OpenLayers.Popup.Framed.prototype.destroy.apply(this, arguments); |
---|
228 | }, |
---|
229 | |
---|
230 | CLASS_NAME: "OpenLayers.Popup.FramedCloud" |
---|
231 | }); |
---|