-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkmlmmanager.min.js
31 lines (31 loc) · 2.75 KB
/
kmlmmanager.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* @name KMLMManager
* @version 0.2
* @copyright (c) 2009 Dario Bigongiari
* @author Dario Bigongiari
*
* ------------------------------------------------------------------------------
* The MIT License
*
* Copyright (c) 2009 Dario Bigongiari ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* ------------------------------------------------------------------------------
*/
function KMLMManager(d,p,l,j,m){this.show=function(r){if(r){for(var q=0;q<r.length;++q){h(r[q])}}e=GEvent.addListener(d,"zoomend",g);GEvent.trigger(d,"zoomend",d.getZoom());i.show()};this.hide=function(){if(e){GEvent.removeListener(e)}i.hide()};this.removeAll=function(q){for(label in l){if(l.hasOwnProperty(label)){this.removeZoomLevel(label,false)}}if(q){i.refresh()}};this.removeZoomLevel=function(r,t){if(!l[r]){return}var q=l[r];var s=0;while(s<q){this.removeOverlay(l[r][s],false);++s}if(t){i.refresh()}};this.removeOverlay=function(r,t){if(!b[r]||!o[r]){return}var q=o[r];var s=0;while(s<q){i.removeMarker(markers[s]);++s}b[r]=false;if(t){i.refresh()}};j=2||j;var o={};var b={};var e=null;var a={nbr:0};m=m||{};var i=new MarkerManager(d,m);function g(t,q){q=q||t;if(t>q){return}q+=j;var u,r;for(var s in l){if(l.hasOwnProperty(s)){u=l[s];if(q>=u){h(s)}}}}function h(r,u){u=u||l[r];var t=p[r],q=t.length,s=0;while(s<q){c(t[s],u);++s}}function c(r,s){if(b[r]){return}if(o[r]){i.addMarkers(o[r],s);if(k(r)<1){i.refresh()}b[r]=true;return}if(!f(r)){return}var q=new GGeoXml(r);GEvent.addListener(q,"load",function(){this.extractMarkers=n;o[r]=this.extractMarkers();c(r,s)})}function n(){if(this.hc){return this.hc}else{return this.Yb}}function f(q){if(a[q]){return false}a[q]=true;a.nbr+=1;return true}function k(q){a[q]=true;var r=a.nbr-1;if(r<0){r=0}a.nbr=r;return r}};