160 | | changeTiles: function(opacity_val) { |
161 | | // IE6 does not support opacity, so we remove the layer if opacity is 0 |
162 | | if (this.tileLayerOverlay != null) { |
163 | | this.gmap.removeOverlay(this.tileLayerOverlay); |
164 | | } |
165 | | if (opacity_val < 0.01) { |
166 | | this.tileLayerOverlay = null; |
167 | | } else { |
168 | | this.tileLayerOverlay = new GTileLayerOverlay( |
169 | | new GTileLayer(null, null, null, { |
170 | | tileUrlTemplate: URL.tile_url, |
171 | | isPng:true, |
172 | | opacity:opacity_val |
173 | | }) |
174 | | ); |
175 | | this.gmap.addOverlay(this.tileLayerOverlay); |
176 | | } |
177 | | }, |
178 | | addOverlay: function(overlay) { |
179 | | this.gmap.addOverlay(overlay); |
180 | | }, |
181 | | removeOverlay: function(overlay) { |
182 | | this.gmap.removeOverlay(overlay); |
183 | | }, |
184 | | openInfoWindow: function(type, id, latlng) { |
185 | | if (type == "EVENT") { |
186 | | var event = EVENT.getItem(id); |
187 | | var info_div = Utils.constructInfoWindowHtml([event]); |
188 | | this.gmap.openInfoWindowHtml(latlng, info_div); |
189 | | //this.highLightOverlay(event.element_ids); |
190 | | } |
191 | | if (type == "ELEMENT") { |
192 | | var element = ELEMENT.getItem(id); |
193 | | var events = new Array(); |
194 | | $.each(element.events, function(index, event_id) { |
195 | | if (CURRENT_EVENT_HASH.hasItem(event_id)) { |
196 | | var event = EVENT.getItem(event_id); |
197 | | events.push(event); |
198 | | } |
199 | | }); |
200 | | if (events.length > 1) { |
201 | | var info_tabs = Utils.constructInfoWindowTabsHtml(events); |
202 | | this.gmap.openInfoWindowTabsHtml(latlng, info_tabs); |
203 | | } else { |
204 | | var info_div = Utils.constructInfoWindowHtml(events); |
205 | | this.gmap.openInfoWindowHtml(latlng, info_div); |
206 | | } |
207 | | //this.highLightOverlay(id); |
208 | | } |
209 | | }, |
210 | | highLightOverlay: function(element_ids) { |
211 | | $.each(element_ids, function(index, element_id) { |
212 | | if (CURRENT_ELEMENT_HASH.hasItem(element_id)) { |
213 | | var element = ELEMENT.getItem(element_id); |
214 | | element.highLight(); |
215 | | HIGH_LIGHT_ELEMENT.push(element_id); |
216 | | } |
217 | | }); |
218 | | }, |
219 | | |
220 | | deHighLightOverlay: function() { |
221 | | while (HIGH_LIGHT_ELEMENT.length > 0) { |
222 | | var element_id = HIGH_LIGHT_ELEMENT.pop(); |
223 | | var element = ELEMENT.getItem(element_id); |
224 | | //element.deHighLight(); |
225 | | } |
226 | | }, |
227 | | |
228 | | setCenter: function(center, level) { |
229 | | this.gmap.panTo(center); |
230 | | }, |
231 | | |
232 | | clearOverlays: function() { |
233 | | this.gmap.closeInfoWindow(); |
234 | | while (CURRENT_ELEMENT.length > 0) { |
235 | | var element_id = CURRENT_ELEMENT.pop(); |
236 | | var elem = ELEMENT.getItem(element_id); |
237 | | CURRENT_ELEMENT_HASH.removeItem(element_id); |
238 | | elem.removeFromMap(); |
239 | | } |
240 | | |
241 | | while (CURRENT_EVENT.length > 0) { |
242 | | var event_id = CURRENT_EVENT.pop(); |
243 | | CURRENT_EVENT_HASH.removeItem(element_id); |
244 | | } |
245 | | CURRENT_OVERLAY_ID = ""; |
246 | | }, |
247 | | |
248 | | updateOverlay: function(type, id) { |
249 | | if (type + '_' + id == CURRENT_OVERLAY_ID) |
250 | | return; |
251 | | CURRENT_OVERLAY_ID = type + '_' + id; |
252 | | this.clearOverlays(); |
253 | | |
254 | | var element_ids; |
255 | | var event_ids; |
256 | | if (type == 'E') { |
257 | | var big_event = BIG_EVENT.getItem(id); |
258 | | element_ids = big_event.element_ids; |
259 | | event_ids = big_event.event_ids; |
260 | | } else { |
261 | | var people = PEOPLE.getItem(id); |
262 | | element_ids = people.element_ids; |
263 | | event_ids = people.event_ids; |
264 | | } |
265 | | |
266 | | $.each(element_ids, function(index, element_id) { |
267 | | var elem = ELEMENT.getItem(element_id); |
268 | | elem.drawOnMap(); |
269 | | CURRENT_ELEMENT.push(element_id); |
270 | | CURRENT_ELEMENT_HASH.setItem(element_id, ""); |
271 | | }); |
272 | | |
273 | | $.each(event_ids, function(index, event_id) { |
274 | | CURRENT_EVENT.push(event_id); |
275 | | CURRENT_EVENT_HASH.setItem(event_id, ""); |
276 | | }); |
277 | | } |
| 166 | changeTiles: function(opacity_val), |
| 167 | addOverlay: function(overlay), |
| 168 | removeOverlay: function(overlay), |
| 169 | openInfoWindow: function(type, id, latlng), |
| 170 | highLightOverlay: function(element_ids), |
| 171 | deHighLightOverlay: function(), |
| 172 | setCenter: function(center, level), |
| 173 | clearOverlays: function(), |
| 174 | updateOverlay: function(type, id) |