Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-leaflet-directive

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-leaflet-directive - npm Package Compare versions

Comparing version 0.7.3 to 0.7.6

doc/markers-attribute.md

35

bower.json
{
"name": "angular-leaflet-directive",
"description": "AngularJS directive to embed an interact with maps managed by Leaflet library",
"keywords": [
"angularjs",
"javascript",
"directive",
"leaflet"
],
"main": [
"dist/angular-leaflet-directive.js"
],
"dependencies": {
"angular": "1.2.x",
"jquery": "2.0.x",
"bootstrap": "3.0.x",
"leaflet-dist": "0.7.x"
},
"devDependencies": {
"jquery": "2.1.x",
"bootstrap": "3.1.x",
"angular-route": "1.2.x",
"angular-animate": "1.2.x",
"angular-mocks": "1.2.x",
"leaflet-dist": "0.7.x",
"leaflet.markerclusterer": "0.4",
"leaflet.draw": "0.2.2",
"Leaflet.label": "0.2.1",
"leaflet-tilelayer-geojson": "*",
"Leaflet.awesome-markers": "*",
"leaflet-plugins": "1.0.0"
}
"leaflet-plugins": "1.0.1",
"esri-leaflet": "0.0.1-beta.4"
},
"ignore": [
"**/.*",
"src",
"doc",
"examples",
"test",
"*.md",
"Gruntfile.js",
"package.json",
"bower.json"
]
}

@@ -0,1 +1,39 @@

<a name="0.7.6"></a>
### 0.7.6 (2014-03-20)
#### Bug Fixes
* **center:** solved a bug with the autoDiscover property. ([823934db](https://github.com/tombatossals/angular-leaflet-directive/commit/823934db787c7b372142cf8bcf3204d11139cf2c))
* **markers:** Bug solved which prevents to create a markers group without overlay ([2017f1a0](https://github.com/tombatossals/angular-leaflet-directive/commit/2017f1a06778502e4145a6dbc6756a133b1827c8))
* **tiles:** Fixed a bug related with multiple maps on screen and tiles. Thanks to @gabrielha ([3a774523](https://github.com/tombatossals/angular-leaflet-directive/commit/3a7745233ffe7e95269073be6640fc7ef3777cdc))
* **url-center:** round the latlng to 4 digits as suggested by @fbuchinger here: ([4a6d755e](https://github.com/tombatossals/angular-leaflet-directive/commit/4a6d755eda22d29feb0b1149b6458a3600170b61))
#### Features
* **build:**
* Added a special property "url-hash-center" which allows to sync the center with ([e361dad6](https://github.com/tombatossals/angular-leaflet-directive/commit/e361dad66596be4875864d522ea5599deb83ca72))
* Dinamically add and remove the layers control. ([ac0ce4be](https://github.com/tombatossals/angular-leaflet-directive/commit/ac0ce4bebffda65e6a834a72019a9bd82e37cae2))
* Added a new GeoJSON layer. Thanks to @cktong: ([e9c391d2](https://github.com/tombatossals/angular-leaflet-directive/commit/e9c391d2813a08deb57dd9dfc07459e25eb00ccf))
* **documentation:** Added more "markers" attribute documentation. ([4dacd3d0](https://github.com/tombatossals/angular-leaflet-directive/commit/4dacd3d022a090ab83189e0bccdf71754df6543e))
* **example:** Added a new example of marker clustering without overlays ([8a65587d](https://github.com/tombatossals/angular-leaflet-directive/commit/8a65587d3f6d6c0ec17be1ab7fc3beacf3e23449))
* **test:** Added unitary tests and protractor tests for the new url-hash-center property ([d43ff384](https://github.com/tombatossals/angular-leaflet-directive/commit/d43ff38459df9495774af8fea899f8aa06349f66))
* **url-center-hash:** Listen for URL changes to update the center. ([ebad6267](https://github.com/tombatossals/angular-leaflet-directive/commit/ebad62678ac23ed2ae9e6a1353cac09e25a2a010))
<a name="v0.7.4"></a>
### v0.7.4 (2014-02-09)
#### Features
* **build:**
* Solved some bugs with the markers management, and reworked example markers-updat ([754db7f6](https://github.com/tombatossals/angular-leaflet-directive/commit/754db7f6fa3bf0221f61fe45da5600d3cb11c539))
* Embed default marker icon as a base64 string. Thanks to @couclock for reporting ([b0e40cb5](https://github.com/tombatossals/angular-leaflet-directive/commit/b0e40cb585fba476e30ce5aa1477c9fcd3afc4f6))
* travis integration with coveralls.io. ([82709893](https://github.com/tombatossals/angular-leaflet-directive/commit/82709893f494c34606c729ee7b39c002128d1cc1))
* **documentation:** Initial "markers" attribute documentation. ([ec7dc696](https://github.com/tombatossals/angular-leaflet-directive/commit/ec7dc6960566cbcf90008b0c216100c918100cab))
* **layers:** Added the GeoJSON layer functionality by @cktong. ([fba0d0d1](https://github.com/tombatossals/angular-leaflet-directive/commit/fba0d0d11af16beb2785d70b822f21dde3f235bf))
* **markers:** When a marker popup is changed on map the marker object is updated in the scope ([ae66898a](https://github.com/tombatossals/angular-leaflet-directive/commit/ae66898adb17cc20b8a91fe783bc26b0c07552b3))
<a name="v0.7.3"></a>

@@ -2,0 +40,0 @@ ### v0.7.3 (2014-01-11)

@@ -29,3 +29,3 @@ Contributing

```
# Inside the project dir, install the dependencies
# Inside the project dir, install the nodeJS dependencies
$ npm install

@@ -51,2 +51,17 @@ npm http GET https://registry.npmjs.org/protractor/0.14.0

And we must install the client libraries dependencies with _bower_ too:
```
[dave@haddock angular-leaflet-directive]$ bower install
bower angular#1.2.x cached git://github.com/angular/bower-angular.git#1.2.6-build.1989+sha.b0474cb
bower angular#1.2.x validate 1.2.6-build.1989+sha.b0474cb against git://github.com/angular/bower-angular.git#1.2.x
...
angular-route#1.2.10-build.2164+sha.8b395ff bower_components/angular-route
└── angular#1.2.10-build.2164+sha.8b395ff
angular-animate#1.2.10-build.2164+sha.8b395ff bower_components/angular-animate
└── angular#1.2.10-build.2164+sha.8b395ff
angular#1.2.10-build.2164+sha.8b395ff bower_components/angular
```
Once you have the development dependencies installed, we can use our predefined grunt tasks. For example:

@@ -53,0 +68,0 @@

8

dist/angular-leaflet-directive.min.js

@@ -24,3 +24,3 @@ /**!

*
* angular-google-maps
* angular-leaflet-directive
* https://github.com/tombatossals/angular-leaflet-directive

@@ -31,4 +31,4 @@ *

/*! angular-leaflet-directive 11-01-2014 */
!function(){"use strict";angular.module("leaflet-directive",[]).directive("leaflet",["$q","leafletData","leafletMapDefaults","leafletHelpers","leafletEvents",function(a,b,c,d,e){var f;return{restrict:"EA",replace:!0,scope:{center:"=center",defaults:"=defaults",maxbounds:"=maxbounds",bounds:"=bounds",markers:"=markers",legend:"=legend",geojson:"=geojson",paths:"=paths",tiles:"=tiles",layers:"=layers",controls:"=controls",eventBroadcast:"=eventBroadcast"},template:'<div class="angular-leaflet-map"></div>',controller:["$scope",function(b){f=a.defer(),this.getMap=function(){return f.promise},this.getLeafletScope=function(){return b}}],link:function(a,g,h){var i=d.isDefined,j=c.setDefaults(a.defaults,h.id),k=e.genDispatchMapEvent,l=e.getAvailableMapEvents();i(h.width)&&(isNaN(h.width)?g.css("width",h.width):g.css("width",h.width+"px")),i(h.height)&&(isNaN(h.height)?g.css("height",h.height):g.css("height",h.height+"px"));var m=new L.Map(g[0],c.getMapCreationDefaults(h.id));if(f.resolve(m),i(h.center)||m.setView([j.center.lat,j.center.lng],j.center.zoom),!i(h.tiles)&&!i(h.layers)){var n=L.tileLayer(j.tileLayer,j.tileLayerOptions);n.addTo(m),b.setTiles(n)}if(i(m.zoomControl)&&i(j.zoomControlPosition)&&m.zoomControl.setPosition(j.zoomControlPosition),i(m.zoomControl)&&j.zoomControl===!1&&m.zoomControl.removeFrom(m),i(m.zoomsliderControl)&&i(j.zoomsliderControl)&&j.zoomsliderControl===!1&&m.zoomsliderControl.removeFrom(m),!i(h.eventBroadcast))for(var o="broadcast",p=0;p<l.length;p++){var q=l[p];m.on(q,k(a,q,o),{eventName:q})}m.whenReady(function(){b.setMap(m,h.id)})}}}]),angular.module("leaflet-directive").directive("center",["$log","$parse","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i=d.isDefined,j=d.isNumber,k=d.safeApply,l=d.isValidCenter,m=h.getLeafletScope(),n=m.center;h.getMap().then(function(d){var e=c.getDefaults(g.id);if(!i(n))return d.setView([e.center.lat,e.center.lng],e.center.zoom),void 0;var f={lat:b("center.lat"),lng:b("center.lng"),zoom:b("center.zoom"),autoDiscover:b("center.autoDiscover")},h=!1;m.$watch("center",function(b){return h=!0,l(b)||b.autoDiscover===!0?b.autoDiscover===!0?(j(b.zoom)||d.setView([e.center.lat,e.center.lng],e.center.zoom),j(b.zoom)&&b.zoom>e.center.zoom?d.locate({setView:!0,maxZoom:b.zoom}):i(e.maxZoom)?d.locate({setView:!0,maxZoom:e.maxZoom}):d.locate({setView:!0}),void 0):(d.setView([b.lat,b.lng],b.zoom),h=!1,void 0):(a.warn("[AngularJS - Leaflet] invalid 'center'"),d.setView([e.center.lat,e.center.lng],e.center.zoom),void 0)},!0),d.on("moveend",function(){h||k(m,function(a){f&&(f.lat.assign(a,d.getCenter().lat),f.lng.assign(a,d.getCenter().lng),f.zoom.assign(a,d.getZoom()),f.autoDiscover.assign(a,!1))})}),n.autoDiscover===!0&&d.on("locationerror",function(){a.warn("[AngularJS - Leaflet] The Geolocation API is unauthorized on this page."),l(n)?d.setView([n.lat,n.lng],n.zoom):d.setView([e.center.lat,e.center.lng],e.center.zoom)})})}}}]),angular.module("leaflet-directive").directive("tiles",["$log","leafletData","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i=d.isDefined,j=h.getLeafletScope(),k=j.tiles;return i(k)||i(k.url)?(h.getMap().then(function(a){var d,e=c.getDefaults(g.id);j.$watch("tiles",function(c){var f=e.tileLayerOptions,h=e.tileLayer;return!i(c.url)&&i(d)?(a.removeLayer(d),void 0):i(d)?i(c.url)&&i(c.options)&&!angular.equals(c.options,f)?(a.removeLayer(d),f=e.tileLayerOptions,angular.copy(c.options,f),h=c.url,d=L.tileLayer(h,f),d.addTo(a),b.setTiles(d,g.id),void 0):(i(c.url)&&d.setUrl(c.url),void 0):(i(c.options)&&angular.copy(c.options,f),i(c.url)&&(h=c.url),d=L.tileLayer(h,f),d.addTo(a),b.setTiles(d,g.id),void 0)},!0)}),void 0):(a.warn("[AngularJS - Leaflet] The 'tiles' definition doesn't have the 'url' property."),void 0)}}}]),angular.module("leaflet-directive").directive("legend",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(c,d,e,f){var g=b.isArray,h=f.getLeafletScope(),i=h.legend;f.getMap().then(function(b){if(g(i.colors)&&g(i.labels)&&i.colors.length===i.labels.length){var c=i.legendClass?i.legendClass:"legend",d=i.position||"bottomright",e=L.control({position:d});e.onAdd=function(){for(var a=L.DomUtil.create("div",c),b=0;b<i.colors.length;b++)a.innerHTML+='<div><i style="background:'+i.colors[b]+'"></i>'+i.labels[b]+"</div>";return a},e.addTo(b)}else a.warn("[AngularJS - Leaflet] legend.colors and legend.labels must be set.")})}}}]),angular.module("leaflet-directive").directive("geojson",["$log","$rootScope","leafletData","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,e,f,g){var h=d.safeApply,i=d.isDefined,j=g.getLeafletScope(),k={};g.getMap().then(function(a){j.$watch("geojson",function(e){if(i(k)&&a.hasLayer(k)&&a.removeLayer(k),i(e)&&i(e.data)){var f=e.resetStyleOnMouseout,g=e.onEachFeature;g||(g=function(a,c){d.LabelPlugin.isLoaded()&&i(e.label)&&c.bindLabel(a.properties.description),c.on({mouseover:function(c){h(j,function(){e.selected=a,b.$broadcast("leafletDirectiveMap.geojsonMouseover",c)})},mouseout:function(a){f&&k.resetStyle(a.target),h(j,function(){e.selected=void 0,b.$broadcast("leafletDirectiveMap.geojsonMouseout",a)})},click:function(a){h(j,function(){b.$broadcast("leafletDirectiveMap.geojsonClick",e.selected,a)})}})}),e.options={style:e.style,onEachFeature:g},k=L.geoJson(e.data,e.options),c.setGeoJSON(k),k.addTo(a)}})})}}}]),angular.module("leaflet-directive").directive("layers",["$log","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletLayerHelpers",function(a,b,c,d,e,f){var g;return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){g=b.defer(),this.getLayers=function(){return g.promise}},link:function(b,h,i,j){var k=d.isDefined,l=d.isObject,m={},n=j.getLeafletScope(),o=n.layers,p=f.createLayer;j.getMap().then(function(b){var d=e.getDefaults(i.id);if(!k(o)||!k(o.baselayers)||0===Object.keys(o.baselayers).length)return a.error("[AngularJS - Leaflet] At least one baselayer has to be defined"),void 0;g.resolve(m),c.setLayers(m,i.id),m.baselayers={},m.controls={},m.controls.layers=new L.control.layers,m.controls.layers.setPosition(d.controlLayersPosition);var f=!1;for(var h in o.baselayers){var j=p(o.baselayers[h]);k(j)?(m.baselayers[h]=j,o.baselayers[h].top===!0&&(b.addLayer(m.baselayers[h]),f=!0),m.controls.layers.addBaseLayer(m.baselayers[h],o.baselayers[h].name)):delete o.baselayers[h]}var q=Object.keys(o.baselayers).length;l(o.overlays)&&(q+=Object.keys(o.overlays).length),q>1&&m.controls.layers.addTo(b),!f&&Object.keys(m.baselayers).length>0&&b.addLayer(m.baselayers[Object.keys(o.baselayers)[0]]),m.overlays={};for(h in o.overlays){var r=p(o.overlays[h]);k(r)?(m.overlays[h]=r,o.overlays[h].visible===!0&&b.addLayer(m.overlays[h]),m.controls.layers.addOverlay(m.overlays[h],o.overlays[h].name)):delete o.overlays[h]}n.$watch("layers.baselayers",function(c){for(var d in m.baselayers)k(c[d])||(m.controls.layers.removeLayer(m.baselayers[d]),b.hasLayer(m.baselayers[d])&&b.removeLayer(m.baselayers[d]),delete m.baselayers[d]);for(var e in c)if(!k(m.baselayers[e])){var f=p(c[e]);k(f)&&(m.baselayers[e]=f,c[e].top===!0&&b.addLayer(m.baselayers[e]),m.controls.layers.addBaseLayer(m.baselayers[e],c[e].name))}if(0===Object.keys(m.baselayers).length)return a.error("[AngularJS - Leaflet] At least one baselayer has to be defined"),void 0;var g=!1;for(var h in m.baselayers)if(b.hasLayer(m.baselayers[h])){g=!0;break}g||b.addLayer(m.baselayers[Object.keys(o.baselayers)[0]])},!0),n.$watch("layers.overlays",function(a){for(var c in m.overlays)k(a[c])||(m.controls.layers.removeLayer(m.overlays[c]),b.hasLayer(m.overlays[c])&&b.removeLayer(m.overlays[c]),delete m.overlays[c]);for(var d in a){if(!k(m.overlays[d])){var e=p(a[d]);k(e)&&(m.overlays[d]=e,m.controls.layers.addOverlay(m.overlays[d],a[d].name),a[d].visible===!0&&b.addLayer(m.overlays[d]))}a[d].visible&&!b.hasLayer(m.overlays[d])?b.addLayer(m.overlays[d]):a[d].visible===!1&&b.hasLayer(m.overlays[d])&&b.removeLayer(m.overlays[d])}},!0)})}}}]),angular.module("leaflet-directive").directive("bounds",["$log","leafletHelpers","leafletBoundsHelpers",function(a,b,c){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(d,e,f,g){var h=b.isDefined,i=c.createLeafletBounds,j=c.updateBoundsInScope,k=g.getLeafletScope();g.getMap().then(function(b){var c=!0;b.whenReady(function(){k.$watch("bounds",function(d){if(!h(d))return a.error("[AngularJS - Leaflet] Invalid bounds"),void 0;c=!1;var e=i(d);e&&!b.getBounds().equals(e)&&b.fitBounds(e)},!0),b.on("dragend zoomend",function(){c||j(k,b)})})})}}}]),angular.module("leaflet-directive").directive("markers",["$log","$rootScope","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletMarkersHelpers","leafletEvents",function(a,b,c,d,e,f,g,h){return{restrict:"A",scope:!1,replace:!1,require:["leaflet","?layers"],link:function(b,f,i,j){var k=j[0],l=e,m=e.isDefined,n=e.isString,o=k.getLeafletScope(),p=o.markers,q=g.deleteMarker,r=g.addMarkerWatcher,s=g.addMarkerToGroup,t=h.bindMarkerEvents,u=g.createMarker;k.getMap().then(function(b){var e,f={};e=m(j[1])?j[1].getLayers:function(){var a=c.defer();return a.resolve(),a.promise},m(p)&&e().then(function(c){d.setMarkers(f,i.id),o.$watch("markers",function(d){for(var e in f)m(d)&&m(d[e])||(q(f[e],b,c),delete f[e]);for(var g in d)if(!m(f[g])){var h=d[g],j=u(h);if(!m(j)){a.error("[AngularJS - Leaflet] Received invalid data on the marker "+g+".");continue}if(f[g]=j,m(h.message)&&j.bindPopup(h.message),m(h.group)&&s(j,h.group,b),l.LabelPlugin.isLoaded()&&m(h.label)&&m(h.label.message)&&j.bindLabel(h.label.message,h.label.options),m(h)&&m(h.layer)){if(!n(h.layer)){a.error("[AngularJS - Leaflet] A layername must be a string");continue}if(!m(c)){a.error("[AngularJS - Leaflet] You must add layers to the directive if the markers are going to use this functionality.");continue}if(!m(c.overlays)||!m(c.overlays[h.layer])){a.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"');continue}var k=c.overlays[h.layer];if(!(k instanceof L.LayerGroup)){a.error('[AngularJS - Leaflet] Adding a marker to an overlay needs a overlay of the type "group"');continue}k.addLayer(j),b.hasLayer(j)&&h.focus===!0&&j.openPopup()}else b.addLayer(j),h.focus===!0&&j.openPopup(),l.LabelPlugin.isLoaded()&&m(h.label)&&m(h.label.options)&&h.label.options.noHide===!0&&j.showLabel();var p=!m(i.watchMarkers)||"true"===i.watchMarkers;p&&r(j,g,o,c,b),t(j,g,h,o)}},!0)})})}}}]),angular.module("leaflet-directive").directive("paths",["$log","leafletData","leafletMapDefaults","leafletHelpers","leafletPathsHelpers",function(a,b,c,d,e){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,f,g,h){var i=d.isDefined,j=h.getLeafletScope(),k=j.paths,l=e.createPath,m=e.setPathOptions;h.getMap().then(function(a){var d=c.getDefaults(g.id);if(i(k)){var e={};b.setPaths(e,g.id);var f=function(b,c){var d=j.$watch("paths."+c,function(c){return i(c)?(m(b,c.type,c),void 0):(a.removeLayer(b),d(),void 0)},!0)};j.$watch("paths",function(b){for(var c in b)if(!i(e[c])){var g=l(c,b[c],d);i(g)&&(e[c]=g,a.addLayer(g),f(g,c))}for(var h in e)i(b[h])||delete e[h]},!0)}})}}}]),angular.module("leaflet-directive").directive("controls",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"?^leaflet",link:function(a,c,d,e){if(e){var f=b.isDefined,g=e.getLeafletScope(),h=g.controls;e.getMap().then(function(a){if(f(L.Control.Draw)&&f(h.draw)){var b=new L.Control.Draw(h.draw.options);a.addControl(b)}if(f(h.custom))for(var c=0;c<h.custom.length;c++)a.addControl(h.custom[c])})}}}}]),angular.module("leaflet-directive").directive("eventBroadcast",["$log","$rootScope","leafletHelpers","leafletEvents",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(b,e,f,g){var h=c.isObject,i=g.getLeafletScope(),j=i.eventBroadcast,k=d.getAvailableMapEvents(),l=d.genDispatchMapEvent;g.getMap().then(function(b){var c,d,e=[],f="broadcast";if(h(j)){if(void 0===j.map||null===j.map)e=k;else if("object"!=typeof j.map)a.warn("[AngularJS - Leaflet] event-broadcast.map must be an object check your model.");else{void 0!==j.map.logic&&null!==j.map.logic&&("emit"!==j.map.logic&&"broadcast"!==j.map.logic?a.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===j.map.logic&&(f="emit"));var g=!1,m=!1;if(void 0!==j.map.enable&&null!==j.map.enable&&"object"==typeof j.map.enable&&(g=!0),void 0!==j.map.disable&&null!==j.map.disable&&"object"==typeof j.map.disable&&(m=!0),g&&m)a.warn("[AngularJS - Leaflet] can not enable and disable events at the time");else if(g||m)if(g)for(c=0;c<j.map.enable.length;c++)d=j.map.enable[c],-1!==e.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" is already enabled"):-1===k.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist"):e.push(d);else for(e=k,c=0;c<j.map.disable.length;c++){d=j.map.disable[c];var n=e.indexOf(d);-1===n?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist or has been already disabled"):e.splice(n,1)}else a.warn("[AngularJS - Leaflet] must enable or disable events")}for(c=0;c<e.length;c++)d=e[c],b.on(d,l(i,d,f),{eventName:d})}else a.warn("[AngularJS - Leaflet] event-broadcast must be an object, check your model.")})}}}]),angular.module("leaflet-directive").directive("maxbounds",["$log","leafletMapDefaults","leafletBoundsHelpers",function(a,b,c){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,b,d,e){var f=e.getLeafletScope(),g=c.isValidBounds;e.getMap().then(function(a){f.$watch("maxbounds",function(b){if(!g(b))return a.setMaxBounds(),void 0;var c=[[b.southWest.lat,b.southWest.lng],[b.northEast.lat,b.northEast.lng]];a.setMaxBounds(c),a.fitBounds(c)})})}}}]),angular.module("leaflet-directive").service("leafletData",["$log","$q","leafletHelpers",function(a,b,c){var d=c.getDefer,e=c.getUnresolvedDefer,f=c.setResolvedDefer,g={},h={},i={},j={},k={},l={};this.setMap=function(a,b){var c=e(g,b);c.resolve(a),f(g,b)},this.getMap=function(a){var b=d(g,a);return b.promise},this.getPaths=function(a){var b=d(j,a);return b.promise},this.setPaths=function(a,b){var c=e(j,b);c.resolve(a),f(j,b)},this.getMarkers=function(a){var b=d(k,a);return b.promise},this.setMarkers=function(a,b){var c=e(k,b);c.resolve(a),f(k,b)},this.getLayers=function(a){var b=d(i,a);return b.promise},this.setLayers=function(a,b){var c=e(i,b);c.resolve(a),f(i,b)},this.setTiles=function(a,b){var c=e(h,b);c.resolve(a),f(h,b)},this.getTiles=function(a){var b=d(h,a);return b.promise},this.setGeoJSON=function(a,b){var c=e(l,b);c.resolve(a),f(l,b)},this.getGeoJSON=function(a){var b=d(l,a);return b.promise}}]),angular.module("leaflet-directive").factory("leafletMapDefaults",["leafletHelpers",function(a){function b(){return{keyboard:!0,dragging:!0,worldCopyJump:!1,doubleClickZoom:!0,scrollWheelZoom:!0,zoomControl:!0,zoomsliderControl:!1,zoomControlPosition:"topleft",attributionControl:!0,layercontrol:{position:"topright",control:L.control.layers,collapsed:!0},controlLayersPosition:"topright",crs:L.CRS.EPSG3857,tileLayer:"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",tileLayerOptions:{attribution:'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'},path:{weight:10,opacity:1,color:"#0000ff"},center:{lat:0,lng:0,zoom:1}}}var c=a.isDefined,d=a.obtainEffectiveMapId,e={};return{getDefaults:function(a){var b=d(e,a);return e[b]},getMapCreationDefaults:function(a){var b=d(e,a),f=e[b],g={maxZoom:f.maxZoom,keyboard:f.keyboard,dragging:f.dragging,zoomControl:f.zoomControl,doubleClickZoom:f.doubleClickZoom,scrollWheelZoom:f.scrollWheelZoom,attributionControl:f.attributionControl,worldCopyJump:f.worldCopyJump,crs:f.crs};return c(f.minZoom)&&(g.minZoom=f.minZoom),c(f.zoomAnimation)&&(g.zoomAnimation=f.zoomAnimation),c(f.fadeAnimation)&&(g.fadeAnimation=f.fadeAnimation),c(f.markerZoomAnimation)&&(g.markerZoomAnimation=f.markerZoomAnimation),g},setDefaults:function(a,f){var g=b();c(a)&&(g.doubleClickZoom=c(a.doubleClickZoom)?a.doubleClickZoom:g.doubleClickZoom,g.scrollWheelZoom=c(a.scrollWheelZoom)?a.scrollWheelZoom:g.doubleClickZoom,g.zoomControl=c(a.zoomControl)?a.zoomControl:g.zoomControl,g.zoomsliderControl=c(a.zoomsliderControl)?a.zoomsliderControl:g.zoomsliderControl,g.attributionControl=c(a.attributionControl)?a.attributionControl:g.attributionControl,g.tileLayer=c(a.tileLayer)?a.tileLayer:g.tileLayer,g.zoomControlPosition=c(a.zoomControlPosition)?a.zoomControlPosition:g.zoomControlPosition,g.keyboard=c(a.keyboard)?a.keyboard:g.keyboard,g.dragging=c(a.dragging)?a.dragging:g.dragging,g.controlLayersPosition=c(a.controlLayersPosition)?a.controlLayersPosition:g.controlLayersPosition,c(a.crs)&&c(L.CRS[a.crs])&&(g.crs=L.CRS[a.crs]),c(a.tileLayerOptions)&&angular.copy(a.tileLayerOptions,g.tileLayerOptions),c(a.maxZoom)&&(g.maxZoom=a.maxZoom),c(a.minZoom)&&(g.minZoom=a.minZoom),c(a.zoomAnimation)&&(g.zoomAnimation=a.zoomAnimation),c(a.fadeAnimation)&&(g.fadeAnimation=a.fadeAnimation),c(a.markerZoomAnimation)&&(g.markerZoomAnimation=a.markerZoomAnimation),c(a.worldCopyJump)&&(g.worldCopyJump=a.worldCopyJump));var h=d(e,f);return e[h]=g,g}}}]),angular.module("leaflet-directive").factory("leafletEvents",["$rootScope","$q","$log","leafletHelpers",function(a,b,c,d){var e=d.safeApply,f=d.isDefined,g=d.isObject,h=d,i=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu"]},j=function(a,b,c,d){for(var e=i(),f="markers."+d,g=0;g<e.length;g++){var h=e[g];c.label.on(h,l(a,h,b,c.label,f))}},k=function(b,c,d,f,g,h){return function(i){var j="leafletDirectiveMarker."+b;"click"===b?e(d,function(){a.$broadcast("leafletDirectiveMarkersClick",g)}):"dragend"===b&&(e(d,function(){h.lat=f.getLatLng().lat,h.lng=f.getLatLng().lng}),h.message&&h.focus===!0&&f.openPopup()),e(d,function(b){"emit"===c?b.$emit(j,{markerName:g,leafletEvent:i}):a.$broadcast(j,{markerName:g,leafletEvent:i})})}},l=function(b,c,d,f,g){return function(h){var i="leafletDirectiveLabel."+c,j=g.replace("markers.","");e(b,function(b){"emit"===d?b.$emit(i,{leafletEvent:h,label:f,markerName:j}):"broadcast"===d&&a.$broadcast(i,{leafletEvent:h,label:f,markerName:j})})}},m=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu","dragstart","drag","dragend","move","remove","popupopen","popupclose"]};return{getAvailableMapEvents:function(){return["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focus","blur","preclick","load","unload","viewreset","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoomend","zoomlevelschange","resize","autopanstart","layeradd","layerremove","baselayerchange","overlayadd","overlayremove","locationfound","locationerror","popupopen","popupclose"]},genDispatchMapEvent:function(b,c,d){return function(f){var g="leafletDirectiveMap."+c;e(b,function(b){"emit"===d?b.$emit(g,{leafletEvent:f}):"broadcast"===d&&a.$broadcast(g,{leafletEvent:f})})}},getAvailableMarkerEvents:m,bindMarkerEvents:function(a,b,d,e){var i,l,n=[],o="broadcast";if(f(e.eventBroadcast))if(g(e.eventBroadcast))if(f(e.eventBroadcast.marker))if(g(e.eventBroadcast.marker))c.warn("[AngularJS - Leaflet] event-broadcast.marker must be an object check your model.");else{void 0!==e.eventBroadcast.marker.logic&&null!==e.eventBroadcast.marker.logic&&("emit"!==e.eventBroadcast.marker.logic&&"broadcast"!==e.eventBroadcast.marker.logic?c.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===e.eventBroadcast.marker.logic&&(o="emit"));var p=!1,q=!1;if(void 0!==e.eventBroadcast.marker.enable&&null!==e.eventBroadcast.marker.enable&&"object"==typeof e.eventBroadcast.marker.enable&&(p=!0),void 0!==e.eventBroadcast.marker.disable&&null!==e.eventBroadcast.marker.disable&&"object"==typeof e.eventBroadcast.marker.disable&&(q=!0),p&&q)c.warn("[AngularJS - Leaflet] can not enable and disable events at the same time");else if(p||q)if(p)for(i=0;i<e.eventBroadcast.marker.enable.length;i++)l=e.eventBroadcast.marker.enable[i],-1!==n.indexOf(l)?c.warn("[AngularJS - Leaflet] This event "+l+" is already enabled"):-1===m().indexOf(l)?c.warn("[AngularJS - Leaflet] This event "+l+" does not exist"):n.push(l);else for(n=m(),i=0;i<e.eventBroadcast.marker.disable.length;i++){l=e.eventBroadcast.marker.disable[i];var r=n.indexOf(l);-1===r?c.warn("[AngularJS - Leaflet] This event "+l+" does not exist or has been already disabled"):n.splice(r,1)}else c.warn("[AngularJS - Leaflet] must enable or disable events")}else n=m();else c.error("[AngularJS - Leaflet] event-broadcast must be an object check your model.");else n=m();for(i=0;i<n.length;i++)l=n[i],a.on(l,k(l,o,e,a,b,d));h.LabelPlugin.isLoaded()&&f(a.label)&&j(e,o,a,b)}}}]),angular.module("leaflet-directive").factory("leafletLayerHelpers",["$rootScope","$log","leafletHelpers",function($rootScope,$log,leafletHelpers){function isValidLayerType(a){return isString(a.type)?-1===Object.keys(layerTypes).indexOf(a.type)?($log.error("[AngularJS - Leaflet] A layer must have a valid type: "+Object.keys(layerTypes)),!1):layerTypes[a.type].mustHaveUrl&&!isString(a.url)?($log.error("[AngularJS - Leaflet] A base layer must have an url"),!1):layerTypes[a.type].mustHaveLayer&&!isDefined(a.layer)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have an layer defined"),!1):layerTypes[a.type].mustHaveBounds&&!isDefined(a.bounds)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have bounds defined"),!1):!0:!1}var Helpers=leafletHelpers,isString=leafletHelpers.isString,isObject=leafletHelpers.isObject,isDefined=leafletHelpers.isDefined,layerTypes={xyz:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer(a.url,a.options)}},wms:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer.wms(a.url,a.options)}},wfs:{mustHaveUrl:!0,mustHaveLayer:!0,createLayer:function(params){if(Helpers.WFSLayerPlugin.isLoaded()){var options=angular.copy(params.options);return options.crs&&"string"==typeof options.crs&&(options.crs=eval(options.crs)),new L.GeoJSON.WFS(params.url,params.layer,options)}}},group:{mustHaveUrl:!1,createLayer:function(){return L.layerGroup()}},google:{mustHaveUrl:!1,createLayer:function(a){var b=a.type||"SATELLITE";if(Helpers.GoogleLayerPlugin.isLoaded())return new L.Google(b,a.options)}},ags:{mustHaveUrl:!0,createLayer:function(a){if(Helpers.AGSLayerPlugin.isLoaded()){var b=angular.copy(a.options);angular.extend(b,{url:a.url});var c=new lvector.AGS(b);return c.onAdd=function(a){this.setMap(a)},c.onRemove=function(){this.setMap(null)},c}}},dynamic:{mustHaveUrl:!0,createLayer:function(a){return Helpers.DynamicMapLayerPlugin.isLoaded()?L.esri.dynamicMapLayer(a.url,a.options):void 0}},markercluster:{mustHaveUrl:!1,createLayer:function(a){return Helpers.MarkerClusterPlugin.isLoaded()?new L.MarkerClusterGroup(a.options):($log.error("[AngularJS - Leaflet] The markercluster plugin is not loaded."),void 0)}},bing:{mustHaveUrl:!0,createLayer:function(a){return Helpers.BingLayerPlugin.isLoaded()?new L.BingLayer(a.key,a.options):void 0}},imageOverlay:{mustHaveUrl:!0,mustHaveBounds:!0,createLayer:function(a){return L.imageOverlay(a.url,a.bounds,a.options)}}};return{createLayer:function(a){if(isValidLayerType(a)){if(!isString(a.name))return $log.error("[AngularJS - Leaflet] A base layer must have a name"),void 0;isObject(a.layerParams)||(a.layerParams={}),isObject(a.layerOptions)||(a.layerOptions={});for(var b in a.layerParams)a.layerOptions[b]=a.layerParams[b];var c={url:a.url,options:a.layerOptions,layer:a.layer,type:a.layerType,bounds:a.bounds,key:a.key};return layerTypes[a.type].createLayer(c)}}}}]),angular.module("leaflet-directive").factory("leafletPathsHelpers",["$rootScope","$log","leafletHelpers",function(a,b,c){function d(a){return a.filter(function(a){return!!a.lat&&!!a.lng}).map(function(a){return new L.LatLng(a.lat,a.lng)})}function e(a){return new L.LatLng(a.lat,a.lng)}function f(a){return a.map(function(a){return d(a)})}function g(a,b){var c={weight:b.path.weight,color:b.path.color,opacity:b.path.opacity};return h(a.stroke)&&(c.stroke=a.stroke),h(a.fill)&&(c.fill=a.fill),h(a.fillColor)&&(c.fillColor=a.fillColor),h(a.fillOpacity)&&(c.fillOpacity=a.fillOpacity),h(a.smoothFactor)&&(c.smoothFactor=a.smoothFactor),h(a.noClip)&&(c.noClip=a.noClip),c}var h=c.isDefined,i=c.isArray,j=c.isNumber,k=c.isValidPoint,l=function(a,b){h(b.weight)&&a.setStyle({weight:b.weight}),h(b.color)&&a.setStyle({color:b.color}),h(b.opacity)&&a.setStyle({opacity:b.opacity})},m=function(a){if(!i(a))return!1;for(var b in a){var c=a[b];if(!k(c))return!1}return!0},n={polyline:{isValid:function(a){var b=a.latlngs;return m(b)},createPath:function(a){return new L.Polyline([],a)},setPath:function(a,b){a.setLatLngs(d(b.latlngs)),l(a,b)}},multiPolyline:{isValid:function(a){var b=a.latlngs;if(!i(b)||2!==b.length)return!1;for(var c in b){var d=b[c];if(!m(d))return!1}return!0},createPath:function(a){return new L.multiPolyline([[[0,0],[1,1]]],a)},setPath:function(a,b){a.setLatLngs(f(b.latlngs)),l(a,b)}},polygon:{isValid:function(a){var b=a.latlngs;return m(b)},createPath:function(a){return new L.Polygon([],a)},setPath:function(a,b){a.setLatLngs(d(b.latlngs)),l(a,b)}},multiPolygon:{isValid:function(a){var b=a.latlngs;if(!i(b)||2!==b.length)return!1;for(var c in b){var d=b[c];if(!m(d))return!1}return!0},createPath:function(a){return new L.MultiPolygon([[[0,0],[1,1],[0,1]]],a)},setPath:function(a,b){a.setLatLngs(f(b.latlngs)),l(a,b)}},rectangle:{isValid:function(a){var b=a.latlngs;if(!i(b)||2!==b.length)return!1;for(var c in b){var d=b[c];if(!k(d))return!1}return!0},createPath:function(a){return new L.Rectangle([[0,0],[1,1]],a)},setPath:function(a,b){a.setBounds(new L.LatLngBounds(d(b.latlngs))),l(a,b)}},circle:{isValid:function(a){var b=a.latlngs;return k(b)&&j(a.radius)},createPath:function(a){return new L.Circle([0,0],1,a)},setPath:function(a,b){a.setLatLng(e(b.latlngs)),h(b.radius)&&a.setRadius(b.radius),l(a,b)}},circleMarker:{isValid:function(a){var b=a.latlngs;return k(b)&&j(a.radius)},createPath:function(a){return new L.CircleMarker([0,0],a)},setPath:function(a,b){a.setLatLng(e(b.latlngs)),h(b.radius)&&a.setRadius(b.radius),l(a,b)}}},o=function(a){var b={};return a.latlngs&&(b.latlngs=a.latlngs),a.radius&&(b.radius=a.radius),b};return{setPathOptions:function(a,b,c){h(b)||(b="polyline"),n[b].setPath(a,c)},createPath:function(a,c,d){h(c.type)||(c.type="polyline");var e=g(c,d),f=o(c);return n[c.type].isValid(f)?n[c.type].createPath(e):(b.error("[AngularJS - Leaflet] Invalid data passed to the "+c.type+" path"),void 0)}}}]),angular.module("leaflet-directive").factory("leafletBoundsHelpers",["$log","leafletHelpers",function(a,b){function c(a){return angular.isDefined(a)&&angular.isDefined(a.southWest)&&angular.isDefined(a.northEast)&&angular.isNumber(a.southWest.lat)&&angular.isNumber(a.southWest.lng)&&angular.isNumber(a.northEast.lat)&&angular.isNumber(a.northEast.lng)}var d=b.isArray,e=b.isNumber;return{createLeafletBounds:function(a){return c(a)?L.latLngBounds([a.southWest.lat,a.southWest.lng],[a.northEast.lat,a.northEast.lng]):!1},isValidBounds:c,createBoundsFromArray:function(b){return d(b)&&2===b.length&&d(b[0])&&d(b[1])&&2===b[0].length&&2===b[1].length&&e(b[0][0])&&e(b[0][1])&&e(b[1][0])&&e(b[1][1])?{northEast:{lat:b[0][0],lng:b[0][1]},southWest:{lat:b[1][0],lng:b[1][1]}}:(a.error("[AngularJS - Leaflet] The bounds array is not valid."),void 0)},updateBoundsInScope:function(a,b){var c=b.getBounds(),d={northEast:{lat:c.getNorthEast().lat,lng:c.getNorthEast().lng},southWest:{lat:c.getSouthWest().lat,lng:c.getSouthWest().lng}};angular.equals(a.bounds,d)||(a.bounds=d)}}}]),angular.module("leaflet-directive").factory("leafletMarkersHelpers",["$rootScope","leafletHelpers","$log",function(a,b,c){var d=b.isDefined,e=b.MarkerClusterPlugin,f=b,g=b.isString,h=b.isNumber,i=b.isObject,j={},k=function(a){return d(a)&&d(a.type)&&"div"===a.type?new L.divIcon(a):d(a)?new L.Icon.Default(a):new L.Icon.Default},l=function(a,b,c){if(a.closePopup(),d(c)&&d(c.overlays))for(var e in c.overlays)if(c.overlays[e]instanceof L.LayerGroup&&c.overlays[e].hasLayer(a))return c.overlays[e].removeLayer(a),void 0;if(d(j))for(var f in j)j[f].hasLayer(a)&&j[f].removeLayer(a);b.hasLayer(a)&&b.removeLayer(a)};return{deleteMarker:l,createMarker:function(a){if(!d(a))return c.error("[AngularJS - Leaflet] The marker definition is not valid."),void 0;var b={icon:k(a.icon),title:d(a.title)?a.title:"",draggable:d(a.draggable)?a.draggable:!1,clickable:d(a.clickable)?a.clickable:!0,riseOnHover:d(a.riseOnHover)?a.riseOnHover:!1};return new L.marker(a,b)},addMarkerToGroup:function(a,b,f){return g(b)?e.isLoaded()?(d(j[b])||(j[b]=new L.MarkerClusterGroup,f.addLayer(j[b])),j[b].addLayer(a),void 0):(c.error("[AngularJS - Leaflet] The MarkerCluster plugin is not loaded."),void 0):(c.error("[AngularJS - Leaflet] The marker group you have specified is invalid."),void 0)},addMarkerWatcher:function(a,b,e,j,m){var n=e.$watch("markers."+b,function(b,e){if(!d(b))return l(a,m,j),n(),void 0;if(d(e)){if(!h(b.lat)||!h(b.lng))return c.warn("There are problems with lat-lng data, please verify your marker model"),l(a,m,j),void 0;if(g(b.layer)||g(e.layer)&&(d(j.overlays[e.layer])&&j.overlays[e.layer].hasLayer(a)&&(j.overlays[e.layer].removeLayer(a),a.closePopup()),m.hasLayer(a)||m.addLayer(a)),g(b.layer)&&(d(e.layer)||e.layer!==b.layer)){if(g(e.layer)&&d(j.overlays[e.layer])&&j.overlays[e.layer].hasLayer(a)&&j.overlays[e.layer].removeLayer(a),a.closePopup(),m.hasLayer(a)&&m.removeLayer(a),!d(j.overlays[b.layer]))return c.error("[AngularJS - Leaflet] You must use a name of an existing layer"),void 0;var o=j.overlays[b.layer];if(!(o instanceof L.LayerGroup))return c.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"'),void 0;o.addLayer(a),m.hasLayer(a)&&b.focus===!0&&a.openPopup()}if(b.draggable!==!0&&e.draggable===!0&&a.dragging===!0&&a.dragging.disable(),b.draggable===!0&&e.draggable!==!0&&(a.dragging?a.dragging.enable():L.Handler.MarkerDrag&&(a.dragging=new L.Handler.MarkerDrag(a),a.options.draggable=!0,a.dragging.enable())),i(b.icon)||i(e.icon)&&(a.setIcon(k()),a.closePopup(),a.unbindPopup(),g(b.message)&&a.bindPopup(b.message)),i(b.icon)&&i(e.icon)&&!angular.equals(b.icon,e.icon)){var p=!1;a.dragging&&(p=a.dragging.enabled()),a.setIcon(k(b.icon)),p&&a.dragging.enable(),a.closePopup(),a.unbindPopup(),g(b.message)&&a.bindPopup(b.message)}!g(b.message)&&g(e.message)&&(a.closePopup(),a.unbindPopup()),g(b)&&!g(e)&&(a.bindPopup(b.message),b.focus===!0&&a.openPopup()),g(b)&&g(e)&&b.message!==e.message&&a.setPopupContent(b.message),b.focus!==!0&&e.focus===!0&&a.closePopup(),b.focus===!0&&e.focus!==!0&&a.openPopup(),e.focus===!0&&b.focus===!0&&a.openPopup();var q=a.getLatLng();if(q.lat!==b.lat||q.lng!==b.lng){var r=!1;g(b.layer)&&f.MarkerClusterPlugin.is(j.overlays[b.layer])&&(j.overlays[b.layer].removeLayer(a),r=!0),a.setLatLng([b.lat,b.lng]),r&&j.overlays[b.layer].addLayer(a)}}},!0)}}}]),angular.module("leaflet-directive").factory("leafletHelpers",["$q","$log",function(a,b){function c(a,c){var d,e;if(angular.isDefined(c))d=c;else if(1===Object.keys(a).length)for(e in a)a.hasOwnProperty(e)&&(d=e);else 0===Object.keys(a).length?d="main":b.error("[AngularJS - Leaflet] - You have more than 1 map on the DOM, you must provide the map ID to the leafletData.getXXX call");return d}function d(b,d){var e,f=c(b,d);return angular.isDefined(b[f])&&b[f].resolvedDefer!==!0?e=b[f].defer:(e=a.defer(),b[f]={defer:e,resolvedDefer:!1}),e}return{isDefined:function(a){return angular.isDefined(a)&&null!==a},isNumber:function(a){return angular.isNumber(a)},isString:function(a){return angular.isString(a)
},isArray:function(a){return angular.isArray(a)},isObject:function(a){return angular.isObject(a)},equals:function(a,b){return angular.equals(a,b)},isValidCenter:function(a){return angular.isDefined(a)&&angular.isNumber(a.lat)&&angular.isNumber(a.lng)&&angular.isNumber(a.zoom)},isValidPoint:function(a){return angular.isDefined(a)&&angular.isNumber(a.lat)&&angular.isNumber(a.lng)},safeApply:function(a,b){var c=a.$root.$$phase;"$apply"===c||"$digest"===c?a.$eval(b):a.$apply(b)},obtainEffectiveMapId:c,getDefer:function(a,b){var e,f=c(a,b);return e=angular.isDefined(a[f])&&a[f].resolvedDefer!==!1?a[f].defer:d(a,b)},getUnresolvedDefer:d,setResolvedDefer:function(a,b){var d=c(a,b);a[d].resolvedDefer=!0},AwesomeMarkersPlugin:{isLoaded:function(){return void 0!==L.AwesomeMarkers?void 0!==L.AwesomeMarkers.Icon:!1},is:function(a){return this.isLoaded()?a instanceof L.AwesomeMarkers.Icon:!1},equal:function(a,b){return this.isLoaded()?this.is(a)?angular.equals(a,b):!1:!1}},LabelPlugin:{isLoaded:function(){return angular.isDefined(L.Label)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},MarkerClusterPlugin:{isLoaded:function(){return angular.isDefined(L.MarkerClusterGroup)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},GoogleLayerPlugin:{isLoaded:function(){return angular.isDefined(L.Google)},is:function(a){return this.isLoaded()?a instanceof L.Google:!1}},BingLayerPlugin:{isLoaded:function(){return angular.isDefined(L.BingLayer)},is:function(a){return this.isLoaded()?a instanceof L.BingLayer:!1}},WFSLayerPlugin:{isLoaded:function(){return void 0!==L.GeoJSON.WFS},is:function(a){return this.isLoaded()?a instanceof L.GeoJSON.WFS:!1}},AGSLayerPlugin:{isLoaded:function(){return void 0!==lvector&&void 0!==lvector.AGS},is:function(a){return this.isLoaded()?a instanceof lvector.AGS:!1}},DynamicMapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.dynamicMapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.dynamicMapLayer:!1}},Leaflet:{DivIcon:{is:function(a){return a instanceof L.DivIcon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}},Icon:{is:function(a){return a instanceof L.Icon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}}}}}])}();
/*! angular-leaflet-directive 19-03-2014 */
!function(){"use strict";angular.module("leaflet-directive",[]).directive("leaflet",["$q","leafletData","leafletMapDefaults","leafletHelpers","leafletEvents",function(a,b,c,d,e){var f;return{restrict:"EA",replace:!0,scope:{center:"=center",defaults:"=defaults",maxbounds:"=maxbounds",bounds:"=bounds",markers:"=markers",legend:"=legend",geojson:"=geojson",paths:"=paths",tiles:"=tiles",layers:"=layers",controls:"=controls",eventBroadcast:"=eventBroadcast"},template:'<div class="angular-leaflet-map"></div>',controller:["$scope",function(b){f=a.defer(),this.getMap=function(){return f.promise},this.getLeafletScope=function(){return b}}],link:function(a,g,h){var i=d.isDefined,j=c.setDefaults(a.defaults,h.id),k=e.genDispatchMapEvent,l=e.getAvailableMapEvents();i(h.width)&&(isNaN(h.width)?g.css("width",h.width):g.css("width",h.width+"px")),i(h.height)&&(isNaN(h.height)?g.css("height",h.height):g.css("height",h.height+"px"));var m=new L.Map(g[0],c.getMapCreationDefaults(h.id));if(f.resolve(m),i(h.center)||m.setView([j.center.lat,j.center.lng],j.center.zoom),!i(h.tiles)&&!i(h.layers)){var n=L.tileLayer(j.tileLayer,j.tileLayerOptions);n.addTo(m),b.setTiles(n,h.id)}if(i(m.zoomControl)&&i(j.zoomControlPosition)&&m.zoomControl.setPosition(j.zoomControlPosition),i(m.zoomControl)&&j.zoomControl===!1&&m.zoomControl.removeFrom(m),i(m.zoomsliderControl)&&i(j.zoomsliderControl)&&j.zoomsliderControl===!1&&m.zoomsliderControl.removeFrom(m),!i(h.eventBroadcast))for(var o="broadcast",p=0;p<l.length;p++){var q=l[p];m.on(q,k(a,q,o),{eventName:q})}m.whenReady(function(){b.setMap(m,h.id)}),a.$on("$destroy",function(){b.unresolveMap(h.id)})}}}]),angular.module("leaflet-directive").directive("center",["$log","$q","$location","leafletMapDefaults","leafletHelpers",function(a,b,c,d,e){var f,g=e.isDefined,h=e.isNumber,i=e.isSameCenterOnMap,j=e.safeApply,k=e.isValidCenter,l=function(a){a.$broadcast("boundsChanged")},m=function(a,b,d){if(g(d.urlHashCenter)){var e=b.getCenter(),f=e.lat.toFixed(4)+":"+e.lng.toFixed(4)+":"+b.getZoom(),h=c.search();g(h.c)&&h.c===f||a.$emit("centerUrlHash",f)}};return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){f=b.defer(),this.getCenter=function(){return f.promise}},link:function(b,e,n,o){var p=o.getLeafletScope(),q=p.center;o.getMap().then(function(b){var e=d.getDefaults(n.id);if(-1!==n.center.search("-"))return a.error('The "center" variable can\'t use a "-" on his key name: "'+n.center+'".'),void b.setView([e.center.lat,e.center.lng],e.center.zoom);if(!g(q))return a.error('The "center" property is not defined in the main scope'),void b.setView([e.center.lat,e.center.lng],e.center.zoom);g(q.lat)&&g(q.lng)||g(q.autoDiscover)||angular.copy(e.center,q);var o,r;if("yes"===n.urlHashCenter){var s=function(){var a,b=c.search();if(g(b.c)){var d=b.c.split(":");3===d.length&&(a={lat:parseFloat(d[0]),lng:parseFloat(d[1]),zoom:parseInt(d[2],10)})}return a};o=s(),p.$on("$locationChangeSuccess",function(a){var c=a.currentScope,d=s();g(d)&&!i(d,b)&&(c.center={lat:d.lat,lng:d.lng,zoom:d.zoom})})}p.$watch("center",function(c){return g(o)&&(angular.copy(o,c),o=void 0),k(c)||c.autoDiscover===!0?c.autoDiscover===!0?(h(c.zoom)||b.setView([e.center.lat,e.center.lng],e.center.zoom),void b.locate(h(c.zoom)&&c.zoom>e.center.zoom?{setView:!0,maxZoom:c.zoom}:g(e.maxZoom)?{setView:!0,maxZoom:e.maxZoom}:{setView:!0})):void(r&&i(c,b)||(b.setView([c.lat,c.lng],c.zoom),l(p,b))):void a.warn("[AngularJS - Leaflet] invalid 'center'")},!0),b.whenReady(function(){r=!0}),b.on("moveend",function(){f.resolve(),m(p,b,n),i(q,b)||j(p,function(a){a.center={lat:b.getCenter().lat,lng:b.getCenter().lng,zoom:b.getZoom(),autoDiscover:!1},l(p,b)})}),q.autoDiscover===!0&&b.on("locationerror",function(){a.warn("[AngularJS - Leaflet] The Geolocation API is unauthorized on this page."),k(q)?(b.setView([q.lat,q.lng],q.zoom),l(p,b)):(b.setView([e.center.lat,e.center.lng],e.center.zoom),l(p,b))})})}}}]),angular.module("leaflet-directive").directive("tiles",["$log","leafletData","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i=d.isDefined,j=h.getLeafletScope(),k=j.tiles;return i(k)||i(k.url)?void h.getMap().then(function(a){var d,e=c.getDefaults(g.id);j.$watch("tiles",function(c){var f=e.tileLayerOptions,h=e.tileLayer;return!i(c.url)&&i(d)?void a.removeLayer(d):i(d)?i(c.url)&&i(c.options)&&!angular.equals(c.options,f)?(a.removeLayer(d),f=e.tileLayerOptions,angular.copy(c.options,f),h=c.url,d=L.tileLayer(h,f),d.addTo(a),void b.setTiles(d,g.id)):void(i(c.url)&&d.setUrl(c.url)):(i(c.options)&&angular.copy(c.options,f),i(c.url)&&(h=c.url),d=L.tileLayer(h,f),d.addTo(a),void b.setTiles(d,g.id))},!0)}):void a.warn("[AngularJS - Leaflet] The 'tiles' definition doesn't have the 'url' property.")}}}]),angular.module("leaflet-directive").directive("legend",["$log","$http","leafletHelpers","leafletLegendHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i,j=c.isArray,k=c.isDefined,l=c.isFunction,m=h.getLeafletScope(),n=m.legend,o=n.legendClass?n.legendClass:"legend",p=n.position||"bottomright";h.getMap().then(function(c){k(n.url)||j(n.colors)&&j(n.labels)&&n.colors.length===n.labels.length?k(n.url)?a.info("[AngularJS - Leaflet] loading arcgis legend service."):(i=L.control({position:p}),i.onAdd=d.getOnAddArrayLegend(n,o),i.addTo(c)):a.warn("[AngularJS - Leaflet] legend.colors and legend.labels must be set."),m.$watch("legend.url",function(e){k(e)&&b.get(e).success(function(a){k(i)?d.updateArcGISLegend(i.getContainer(),a):(i=L.control({position:p}),i.onAdd=d.getOnAddArcGISLegend(a,o),i.addTo(c)),k(n.loadedData)&&l(n.loadedData)&&n.loadedData()}).error(function(){a.warn("[AngularJS - Leaflet] legend.url not loaded.")})})})}}}]),angular.module("leaflet-directive").directive("geojson",["$log","$rootScope","leafletData","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,e,f,g){var h=d.safeApply,i=d.isDefined,j=g.getLeafletScope(),k={};g.getMap().then(function(a){j.$watch("geojson",function(e){if(i(k)&&a.hasLayer(k)&&a.removeLayer(k),i(e)&&i(e.data)){var f=e.resetStyleOnMouseout,g=e.onEachFeature;g||(g=function(a,c){d.LabelPlugin.isLoaded()&&i(e.label)&&c.bindLabel(a.properties.description),c.on({mouseover:function(c){h(j,function(){e.selected=a,b.$broadcast("leafletDirectiveMap.geojsonMouseover",c)})},mouseout:function(a){f&&k.resetStyle(a.target),h(j,function(){e.selected=void 0,b.$broadcast("leafletDirectiveMap.geojsonMouseout",a)})},click:function(c){h(j,function(){e.selected=a,b.$broadcast("leafletDirectiveMap.geojsonClick",e.selected,c)})}})}),e.options={style:e.style,onEachFeature:g},k=L.geoJson(e.data,e.options),c.setGeoJSON(k),k.addTo(a)}})})}}}]),angular.module("leaflet-directive").directive("layers",["$log","$q","leafletData","leafletHelpers","leafletLayerHelpers","leafletControlHelpers",function(a,b,c,d,e,f){var g;return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){g=b.defer(),this.getLayers=function(){return g.promise}},link:function(b,h,i,j){var k=d.isDefined,l={},m=j.getLeafletScope(),n=m.layers,o=e.createLayer,p=f.updateLayersControl,q=!1;j.getMap().then(function(b){if(!k(n)||!k(n.baselayers)||0===Object.keys(n.baselayers).length)return void a.error("[AngularJS - Leaflet] At least one baselayer has to be defined");g.resolve(l),c.setLayers(l,i.id),l.baselayers={},l.overlays={};var d=i.id,e=!1;for(var f in n.baselayers){var h=o(n.baselayers[f]);k(h)?(l.baselayers[f]=h,n.baselayers[f].top===!0&&(b.addLayer(l.baselayers[f]),e=!0)):delete n.baselayers[f]}!e&&Object.keys(l.baselayers).length>0&&b.addLayer(l.baselayers[Object.keys(n.baselayers)[0]]);for(f in n.overlays){var j=o(n.overlays[f]);k(j)?(l.overlays[f]=j,n.overlays[f].visible===!0&&b.addLayer(l.overlays[f])):delete n.overlays[f]}m.$watch("layers.baselayers",function(c){for(var e in l.baselayers)k(c[e])||(b.hasLayer(l.baselayers[e])&&b.removeLayer(l.baselayers[e]),delete l.baselayers[e]);for(var f in c)if(!k(l.baselayers[f])){var g=o(c[f]);k(g)&&(l.baselayers[f]=g,c[f].top===!0&&b.addLayer(l.baselayers[f]))}if(0===Object.keys(l.baselayers).length)return void a.error("[AngularJS - Leaflet] At least one baselayer has to be defined");var h=!1;for(var i in l.baselayers)if(b.hasLayer(l.baselayers[i])){h=!0;break}h||b.addLayer(l.baselayers[Object.keys(n.baselayers)[0]]),q=p(b,d,q,c,n.overlays,l)},!0),m.$watch("layers.overlays",function(a){for(var c in l.overlays)k(a[c])||(b.hasLayer(l.overlays[c])&&b.removeLayer(l.overlays[c]),delete l.overlays[c]);for(var e in a){if(!k(l.overlays[e])){var f=o(a[e]);k(f)&&(l.overlays[e]=f,a[e].visible===!0&&b.addLayer(l.overlays[e]))}a[e].visible&&!b.hasLayer(l.overlays[e])?b.addLayer(l.overlays[e]):a[e].visible===!1&&b.hasLayer(l.overlays[e])&&b.removeLayer(l.overlays[e])}q=p(b,d,q,n.baselayers,a,l)},!0)})}}}]),angular.module("leaflet-directive").directive("bounds",["$log","$timeout","leafletHelpers","leafletBoundsHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:["leaflet","center"],link:function(b,e,f,g){var h=c.isDefined,i=d.createLeafletBounds,j=g[0].getLeafletScope(),k=g[0],l=g[1],m=function(a){return 0===a._southWest.lat&&0===a._southWest.lng&&0===a._northEast.lat&&0===a._northEast.lng?!0:!1};k.getMap().then(function(b){b.whenReady(function(){l.getCenter().then(function(){j.$on("boundsChanged",function(c){var d=c.currentScope,e=b.getBounds();if(a.debug("updated map bounds...",e),!m(e)){var f={northEast:{lat:e._northEast.lat,lng:e._northEast.lng},southWest:{lat:e._southWest.lat,lng:e._southWest.lng}};angular.equals(d.bounds,f)||(a.debug("Need to update scope bounds."),d.bounds=f)}}),j.$watch("bounds",function(c){if(a.debug("updated bounds...",c),!h(c))return void a.error("[AngularJS - Leaflet] Invalid bounds");var d=i(c);d&&!b.getBounds().equals(d)&&(a.debug("Need to update map bounds."),b.fitBounds(d))},!0)})})})}}}]),angular.module("leaflet-directive").directive("markers",["$log","$rootScope","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletMarkersHelpers","leafletEvents",function(a,b,c,d,e,f,g,h){return{restrict:"A",scope:!1,replace:!1,require:["leaflet","?layers"],link:function(b,f,i,j){var k=j[0],l=e,m=e.isDefined,n=e.isString,o=k.getLeafletScope(),p=o.markers,q=g.deleteMarker,r=g.addMarkerWatcher,s=g.listenMarkerEvents,t=g.addMarkerToGroup,u=h.bindMarkerEvents,v=g.createMarker;k.getMap().then(function(b){var e,f={};e=m(j[1])?j[1].getLayers:function(){var a=c.defer();return a.resolve(),a.promise},m(p)&&e().then(function(c){d.setMarkers(f,i.id),o.$watch("markers",function(d){for(var e in f)m(d)&&m(d[e])||(q(f[e],b,c),delete f[e]);for(var g in d)if(-1===g.search("-")){if(!m(f[g])){var h=d[g],j=v(h);if(!m(j)){a.error("[AngularJS - Leaflet] Received invalid data on the marker "+g+".");continue}if(f[g]=j,m(h.message)&&j.bindPopup(h.message,h.popupOptions),m(h.group)&&t(j,h.group,b),l.LabelPlugin.isLoaded()&&m(h.label)&&m(h.label.message)&&j.bindLabel(h.label.message,h.label.options),m(h)&&m(h.layer)){if(!n(h.layer)){a.error("[AngularJS - Leaflet] A layername must be a string");continue}if(!m(c)){a.error("[AngularJS - Leaflet] You must add layers to the directive if the markers are going to use this functionality.");continue}if(!m(c.overlays)||!m(c.overlays[h.layer])){a.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"');continue}var k=c.overlays[h.layer];if(!(k instanceof L.LayerGroup)){a.error('[AngularJS - Leaflet] Adding a marker to an overlay needs a overlay of the type "group"');continue}k.addLayer(j),b.hasLayer(j)&&h.focus===!0&&j.openPopup()}else m(h.group)||(b.addLayer(j),h.focus===!0&&j.openPopup(),l.LabelPlugin.isLoaded()&&m(h.label)&&m(h.label.options)&&h.label.options.noHide===!0&&j.showLabel());var p=!m(i.watchMarkers)||"true"===i.watchMarkers;p&&(r(j,g,o,c,b),s(j,h,o)),u(j,g,h,o)}}else a.error('The marker can\'t use a "-" on his key name: "'+g+'".')},!0)})})}}}]),angular.module("leaflet-directive").directive("paths",["$log","leafletData","leafletMapDefaults","leafletHelpers","leafletPathsHelpers","leafletEvents",function(a,b,c,d,e,f){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(g,h,i,j){var k=d.isDefined,l=j.getLeafletScope(),m=l.paths,n=e.createPath,o=f.bindPathEvents,p=e.setPathOptions;j.getMap().then(function(e){var f=c.getDefaults(i.id);if(k(m)){var g={};b.setPaths(g,i.id);var h=function(a,b){var c=l.$watch("paths."+b,function(b){return k(b)?void p(a,b.type,b):(e.removeLayer(a),void c())},!0)};l.$watch("paths",function(b){for(var c in b)if(-1===c.search("-")){if(!k(g[c])){var i=b[c],j=n(c,b[c],f);k(j)&&k(i.message)&&j.bindPopup(i.message),d.LabelPlugin.isLoaded()&&k(i.label)&&k(i.label.message)&&j.bindLabel(i.label.message,i.label.options),k(j)&&(g[c]=j,e.addLayer(j),h(j,c)),o(j,c,i,l)}}else a.error('[AngularJS - Leaflet] The path name "'+c+'" is not valid. It must not include "-" and a number.');for(var m in g)k(b[m])||delete g[m]},!0)}})}}}]),angular.module("leaflet-directive").directive("controls",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"?^leaflet",link:function(a,c,d,e){if(e){var f=b.isDefined,g=e.getLeafletScope(),h=g.controls;e.getMap().then(function(a){if(f(L.Control.Draw)&&f(h.draw)){var b=new L.FeatureGroup;a.addLayer(b);var c={edit:{featureGroup:b}};angular.extend(c,h.draw.options);var d=new L.Control.Draw(c);a.addControl(d)}if(f(h.custom))for(var e in h.custom)a.addControl(h.custom[e])})}}}}]),angular.module("leaflet-directive").directive("eventBroadcast",["$log","$rootScope","leafletHelpers","leafletEvents",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(b,e,f,g){var h=c.isObject,i=g.getLeafletScope(),j=i.eventBroadcast,k=d.getAvailableMapEvents(),l=d.genDispatchMapEvent;g.getMap().then(function(b){var c,d,e=[],f="broadcast";if(h(j)){if(void 0===j.map||null===j.map)e=k;else if("object"!=typeof j.map)a.warn("[AngularJS - Leaflet] event-broadcast.map must be an object check your model.");else{void 0!==j.map.logic&&null!==j.map.logic&&("emit"!==j.map.logic&&"broadcast"!==j.map.logic?a.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===j.map.logic&&(f="emit"));var g=!1,m=!1;if(void 0!==j.map.enable&&null!==j.map.enable&&"object"==typeof j.map.enable&&(g=!0),void 0!==j.map.disable&&null!==j.map.disable&&"object"==typeof j.map.disable&&(m=!0),g&&m)a.warn("[AngularJS - Leaflet] can not enable and disable events at the time");else if(g||m)if(g)for(c=0;c<j.map.enable.length;c++)d=j.map.enable[c],-1!==e.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" is already enabled"):-1===k.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist"):e.push(d);else for(e=k,c=0;c<j.map.disable.length;c++){d=j.map.disable[c];var n=e.indexOf(d);-1===n?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist or has been already disabled"):e.splice(n,1)}else a.warn("[AngularJS - Leaflet] must enable or disable events")}for(c=0;c<e.length;c++)d=e[c],b.on(d,l(i,d,f),{eventName:d})}else a.warn("[AngularJS - Leaflet] event-broadcast must be an object, check your model.")})}}}]),angular.module("leaflet-directive").directive("maxbounds",["$log","leafletMapDefaults","leafletBoundsHelpers",function(a,b,c){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,b,d,e){var f=e.getLeafletScope(),g=c.isValidBounds;e.getMap().then(function(a){f.$watch("maxbounds",function(b){if(!g(b))return void a.setMaxBounds();var c=[[b.southWest.lat,b.southWest.lng],[b.northEast.lat,b.northEast.lng]];a.setMaxBounds(c),a.fitBounds(c)})})}}}]),angular.module("leaflet-directive").service("leafletData",["$log","$q","leafletHelpers",function(a,b,c){var d=c.getDefer,e=c.getUnresolvedDefer,f=c.setResolvedDefer,g={},h={},i={},j={},k={},l={};this.setMap=function(a,b){var c=e(g,b);c.resolve(a),f(g,b)},this.getMap=function(a){var b=d(g,a);return b.promise},this.unresolveMap=function(a){var b=c.obtainEffectiveMapId(g,a);g[b]=void 0},this.getPaths=function(a){var b=d(j,a);return b.promise},this.setPaths=function(a,b){var c=e(j,b);c.resolve(a),f(j,b)},this.getMarkers=function(a){var b=d(k,a);return b.promise},this.setMarkers=function(a,b){var c=e(k,b);c.resolve(a),f(k,b)},this.getLayers=function(a){var b=d(i,a);return b.promise},this.setLayers=function(a,b){var c=e(i,b);c.resolve(a),f(i,b)},this.setTiles=function(a,b){var c=e(h,b);c.resolve(a),f(h,b)},this.getTiles=function(a){var b=d(h,a);return b.promise},this.setGeoJSON=function(a,b){var c=e(l,b);c.resolve(a),f(l,b)},this.getGeoJSON=function(a){var b=d(l,a);return b.promise}}]),angular.module("leaflet-directive").factory("leafletMapDefaults",["$q","leafletHelpers",function(a,b){function c(){return{keyboard:!0,dragging:!0,worldCopyJump:!1,doubleClickZoom:!0,scrollWheelZoom:!0,zoomControl:!0,zoomsliderControl:!1,zoomControlPosition:"topleft",attributionControl:!0,controls:{layers:{visible:!0,position:"topright",collapsed:!0}},crs:L.CRS.EPSG3857,tileLayer:"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",tileLayerOptions:{attribution:'&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'},path:{weight:10,opacity:1,color:"#0000ff"},center:{lat:0,lng:0,zoom:1}}}var d=b.isDefined,e=b.obtainEffectiveMapId,f={};return{getDefaults:function(a){var b=e(f,a);return f[b]},getMapCreationDefaults:function(a){var b=e(f,a),c=f[b],g={maxZoom:c.maxZoom,keyboard:c.keyboard,dragging:c.dragging,zoomControl:c.zoomControl,doubleClickZoom:c.doubleClickZoom,scrollWheelZoom:c.scrollWheelZoom,attributionControl:c.attributionControl,worldCopyJump:c.worldCopyJump,crs:c.crs};return d(c.minZoom)&&(g.minZoom=c.minZoom),d(c.zoomAnimation)&&(g.zoomAnimation=c.zoomAnimation),d(c.fadeAnimation)&&(g.fadeAnimation=c.fadeAnimation),d(c.markerZoomAnimation)&&(g.markerZoomAnimation=c.markerZoomAnimation),g},setDefaults:function(a,b){var g=c();d(a)&&(g.doubleClickZoom=d(a.doubleClickZoom)?a.doubleClickZoom:g.doubleClickZoom,g.scrollWheelZoom=d(a.scrollWheelZoom)?a.scrollWheelZoom:g.doubleClickZoom,g.zoomControl=d(a.zoomControl)?a.zoomControl:g.zoomControl,g.zoomsliderControl=d(a.zoomsliderControl)?a.zoomsliderControl:g.zoomsliderControl,g.attributionControl=d(a.attributionControl)?a.attributionControl:g.attributionControl,g.tileLayer=d(a.tileLayer)?a.tileLayer:g.tileLayer,g.zoomControlPosition=d(a.zoomControlPosition)?a.zoomControlPosition:g.zoomControlPosition,g.keyboard=d(a.keyboard)?a.keyboard:g.keyboard,g.dragging=d(a.dragging)?a.dragging:g.dragging,d(a.controls)&&angular.extend(g.controls,a.controls),d(a.crs)&&d(L.CRS[a.crs])&&(g.crs=L.CRS[a.crs]),d(a.tileLayerOptions)&&angular.copy(a.tileLayerOptions,g.tileLayerOptions),d(a.maxZoom)&&(g.maxZoom=a.maxZoom),d(a.minZoom)&&(g.minZoom=a.minZoom),d(a.zoomAnimation)&&(g.zoomAnimation=a.zoomAnimation),d(a.fadeAnimation)&&(g.fadeAnimation=a.fadeAnimation),d(a.markerZoomAnimation)&&(g.markerZoomAnimation=a.markerZoomAnimation),d(a.worldCopyJump)&&(g.worldCopyJump=a.worldCopyJump));var h=e(f,b);return f[h]=g,g}}}]),angular.module("leaflet-directive").factory("leafletEvents",["$rootScope","$q","$log","leafletHelpers",function(a,b,c,d){var e=d.safeApply,f=d.isDefined,g=d.isObject,h=d,i=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu"]},j=function(a,b,c,d){for(var e=i(),f="markers."+d,g=0;g<e.length;g++){var h=e[g];c.label.on(h,m(a,h,b,c.label,f))}},k=function(b,c,d,f,g,h){return function(i){var j="leafletDirectiveMarker."+b;"click"===b?e(d,function(){a.$broadcast("leafletDirectiveMarkersClick",g)}):"dragend"===b&&(e(d,function(){h.lat=f.getLatLng().lat,h.lng=f.getLatLng().lng}),h.message&&h.focus===!0&&f.openPopup()),e(d,function(b){"emit"===c?b.$emit(j,{markerName:g,leafletEvent:i}):a.$broadcast(j,{markerName:g,leafletEvent:i})})}},l=function(b,c,d,f,g){return function(f){var h="leafletDirectivePath."+b;e(d,function(b){"emit"===c?b.$emit(h,{pathName:g,leafletEvent:f}):a.$broadcast(h,{pathName:g,leafletEvent:f})})}},m=function(b,c,d,f,g){return function(h){var i="leafletDirectiveLabel."+c,j=g.replace("markers.","");e(b,function(b){"emit"===d?b.$emit(i,{leafletEvent:h,label:f,markerName:j}):"broadcast"===d&&a.$broadcast(i,{leafletEvent:h,label:f,markerName:j})})}},n=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu","dragstart","drag","dragend","move","remove","popupopen","popupclose"]},o=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu","add","remove","popupopen","popupclose"]};return{getAvailableMapEvents:function(){return["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focus","blur","preclick","load","unload","viewreset","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoomend","zoomlevelschange","resize","autopanstart","layeradd","layerremove","baselayerchange","overlayadd","overlayremove","locationfound","locationerror","popupopen","popupclose","draw:created","draw:edited","draw:deleted","draw:drawstart","draw:drawstop","draw:editstart","draw:editstop","draw:deletestart","draw:deletestop"]},genDispatchMapEvent:function(b,c,d){return function(f){var g="leafletDirectiveMap."+c;e(b,function(b){"emit"===d?b.$emit(g,{leafletEvent:f}):"broadcast"===d&&a.$broadcast(g,{leafletEvent:f})})}},getAvailableMarkerEvents:n,getAvailablePathEvents:o,bindMarkerEvents:function(a,b,d,e){var i,l,m=[],o="broadcast";if(f(e.eventBroadcast))if(g(e.eventBroadcast))if(f(e.eventBroadcast.marker))if(g(e.eventBroadcast.marker)){void 0!==e.eventBroadcast.marker.logic&&null!==e.eventBroadcast.marker.logic&&("emit"!==e.eventBroadcast.marker.logic&&"broadcast"!==e.eventBroadcast.marker.logic?c.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===e.eventBroadcast.marker.logic&&(o="emit"));var p=!1,q=!1;if(void 0!==e.eventBroadcast.marker.enable&&null!==e.eventBroadcast.marker.enable&&"object"==typeof e.eventBroadcast.marker.enable&&(p=!0),void 0!==e.eventBroadcast.marker.disable&&null!==e.eventBroadcast.marker.disable&&"object"==typeof e.eventBroadcast.marker.disable&&(q=!0),p&&q)c.warn("[AngularJS - Leaflet] can not enable and disable events at the same time");else if(p||q)if(p)for(i=0;i<e.eventBroadcast.marker.enable.length;i++)l=e.eventBroadcast.marker.enable[i],-1!==m.indexOf(l)?c.warn("[AngularJS - Leaflet] This event "+l+" is already enabled"):-1===n().indexOf(l)?c.warn("[AngularJS - Leaflet] This event "+l+" does not exist"):m.push(l);else for(m=n(),i=0;i<e.eventBroadcast.marker.disable.length;i++){l=e.eventBroadcast.marker.disable[i];var r=m.indexOf(l);-1===r?c.warn("[AngularJS - Leaflet] This event "+l+" does not exist or has been already disabled"):m.splice(r,1)}else c.warn("[AngularJS - Leaflet] must enable or disable events")}else c.warn("[AngularJS - Leaflet] event-broadcast.marker must be an object check your model.");else m=n();else c.error("[AngularJS - Leaflet] event-broadcast must be an object check your model.");else m=n();for(i=0;i<m.length;i++)l=m[i],a.on(l,k(l,o,e,a,b,d));h.LabelPlugin.isLoaded()&&f(a.label)&&j(e,o,a,b)},bindPathEvents:function(a,b,d,e){var i,k,m=[],n="broadcast";if(window.lls=e,f(e.eventBroadcast))if(g(e.eventBroadcast))if(f(e.eventBroadcast.path))if(g(e.eventBroadcast.paths))c.warn("[AngularJS - Leaflet] event-broadcast.path must be an object check your model.");else{void 0!==e.eventBroadcast.path.logic&&null!==e.eventBroadcast.path.logic&&("emit"!==e.eventBroadcast.path.logic&&"broadcast"!==e.eventBroadcast.path.logic?c.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===e.eventBroadcast.path.logic&&(n="emit"));var p=!1,q=!1;if(void 0!==e.eventBroadcast.pats.enable&&null!==e.eventBroadcast.path.enable&&"object"==typeof e.eventBroadcast.path.enable&&(p=!0),void 0!==e.eventBroadcast.path.disable&&null!==e.eventBroadcast.path.disable&&"object"==typeof e.eventBroadcast.path.disable&&(q=!0),p&&q)c.warn("[AngularJS - Leaflet] can not enable and disable events at the same time");else if(p||q)if(p)for(i=0;i<e.eventBroadcast.path.enable.length;i++)k=e.eventBroadcast.path.enable[i],-1!==m.indexOf(k)?c.warn("[AngularJS - Leaflet] This event "+k+" is already enabled"):-1===o().indexOf(k)?c.warn("[AngularJS - Leaflet] This event "+k+" does not exist"):m.push(k);else for(m=o(),i=0;i<e.eventBroadcast.path.disable.length;i++){k=e.eventBroadcast.path.disable[i];var r=m.indexOf(k);-1===r?c.warn("[AngularJS - Leaflet] This event "+k+" does not exist or has been already disabled"):m.splice(r,1)}else c.warn("[AngularJS - Leaflet] must enable or disable events")}else m=o();else c.error("[AngularJS - Leaflet] event-broadcast must be an object check your model.");else m=o();for(i=0;i<m.length;i++)k=m[i],a.on(k,l(k,n,e,m,b));h.LabelPlugin.isLoaded()&&f(a.label)&&j(e,n,a,b)}}}]),angular.module("leaflet-directive").factory("leafletLayerHelpers",["$rootScope","$log","leafletHelpers",function($rootScope,$log,leafletHelpers){function isValidLayerType(a){return isString(a.type)?-1===Object.keys(layerTypes).indexOf(a.type)?($log.error("[AngularJS - Leaflet] A layer must have a valid type: "+Object.keys(layerTypes)),!1):layerTypes[a.type].mustHaveUrl&&!isString(a.url)?($log.error("[AngularJS - Leaflet] A base layer must have an url"),!1):layerTypes[a.type].mustHaveLayer&&!isDefined(a.layer)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have an layer defined"),!1):layerTypes[a.type].mustHaveBounds&&!isDefined(a.bounds)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have bounds defined"),!1):!0:!1}var Helpers=leafletHelpers,isString=leafletHelpers.isString,isObject=leafletHelpers.isObject,isDefined=leafletHelpers.isDefined,layerTypes={xyz:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer(a.url,a.options)}},geoJSON:{mustHaveUrl:!0,createLayer:function(a){return Helpers.GeoJSONPlugin.isLoaded()?new L.TileLayer.GeoJSON(a.url,a.pluginOptions,a.options):void 0}},wms:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer.wms(a.url,a.options)}},wmts:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer.wmts(a.url,a.options)}},wfs:{mustHaveUrl:!0,mustHaveLayer:!0,createLayer:function(params){if(Helpers.WFSLayerPlugin.isLoaded()){var options=angular.copy(params.options);return options.crs&&"string"==typeof options.crs&&(options.crs=eval(options.crs)),new L.GeoJSON.WFS(params.url,params.layer,options)}}},group:{mustHaveUrl:!1,createLayer:function(){return L.layerGroup()}},google:{mustHaveUrl:!1,createLayer:function(a){var b=a.type||"SATELLITE";if(Helpers.GoogleLayerPlugin.isLoaded())return new L.Google(b,a.options)}},china:{mustHaveUrl:!1,createLayer:function(a){var b=a.type||"";if(Helpers.ChinaLayerPlugin.isLoaded())return L.tileLayer.chinaProvider(b,a.options)}},ags:{mustHaveUrl:!0,createLayer:function(a){if(Helpers.AGSLayerPlugin.isLoaded()){var b=angular.copy(a.options);angular.extend(b,{url:a.url});var c=new lvector.AGS(b);return c.onAdd=function(a){this.setMap(a)},c.onRemove=function(){this.setMap(null)},c}}},dynamic:{mustHaveUrl:!0,createLayer:function(a){return Helpers.DynamicMapLayerPlugin.isLoaded()?L.esri.dynamicMapLayer(a.url,a.options):void 0}},markercluster:{mustHaveUrl:!1,createLayer:function(a){return Helpers.MarkerClusterPlugin.isLoaded()?new L.MarkerClusterGroup(a.options):void $log.error("[AngularJS - Leaflet] The markercluster plugin is not loaded.")}},bing:{mustHaveUrl:!1,createLayer:function(a){return Helpers.BingLayerPlugin.isLoaded()?new L.BingLayer(a.key,a.options):void 0}},yandex:{mustHaveUrl:!1,createLayer:function(a){var b=a.type||"map";if(Helpers.YandexLayerPlugin.isLoaded())return new L.Yandex(b,a.options)}},imageOverlay:{mustHaveUrl:!0,mustHaveBounds:!0,createLayer:function(a){return L.imageOverlay(a.url,a.bounds,a.options)}}};return{createLayer:function(a){if(isValidLayerType(a)){if(!isString(a.name))return void $log.error("[AngularJS - Leaflet] A base layer must have a name");isObject(a.layerParams)||(a.layerParams={}),isObject(a.layerOptions)||(a.layerOptions={});for(var b in a.layerParams)a.layerOptions[b]=a.layerParams[b];var c={url:a.url,options:a.layerOptions,layer:a.layer,type:a.layerType,bounds:a.bounds,key:a.key,pluginOptions:a.pluginOptions};return layerTypes[a.type].createLayer(c)}}}}]),angular.module("leaflet-directive").factory("leafletControlHelpers",["$rootScope","$log","leafletHelpers","leafletMapDefaults",function(a,b,c,d){var e,f=c.isObject,g=c.isDefined,h=function(a,b){var c=0;return f(a)&&(c+=Object.keys(a).length),f(b)&&(c+=Object.keys(b).length),c>1},i=function(a){var b,c=d.getDefaults(a),e={collapsed:c.controls.layers.collapsed,position:c.controls.layers.position};return b=c.controls.layers&&g(c.controls.layers.control)?c.controls.layers.control.apply(this,[[],[],e]):new L.control.layers([],[],e)};return{layersControlMustBeVisible:h,updateLayersControl:function(a,b,c,d,f,j){var k,l=h(d,f);if(g(e)&&c){for(k in j.baselayers)e.removeLayer(j.baselayers[k]);for(k in j.overlays)e.removeLayer(j.overlays[k]);e.removeFrom(a)}if(l){e=i(b);for(k in d)g(j.baselayers[k])&&e.addBaseLayer(j.baselayers[k],d[k].name);for(k in f)g(j.overlays[k])&&e.addOverlay(j.overlays[k],f[k].name);e.addTo(a)}return l}}}]),angular.module("leaflet-directive").factory("leafletLegendHelpers",function(){var a=function(a,b){if(a.innerHTML="",b.error)a.innerHTML+='<div class="info-title alert alert-danger">'+b.error.message+"</div>";else for(var c=0;c<b.layers.length;c++){var d=b.layers[c];a.innerHTML+='<div class="info-title">'+d.layerName+"</div>";for(var e=0;e<d.legend.length;e++){var f=d.legend[e];a.innerHTML+='<div class="inline"><img src="data:'+f.contentType+";base64,"+f.imageData+'" /></div><div class="info-label">'+f.label+"</div>"}}},b=function(b,c){return function(){var d=L.DomUtil.create("div",c);return L.Browser.touch?L.DomEvent.on(d,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(d),L.DomEvent.on(d,"mousewheel",L.DomEvent.stopPropagation)),a(d,b),d}},c=function(a,b){return function(){for(var c=L.DomUtil.create("div",b),d=0;d<a.colors.length;d++)c.innerHTML+='<div class="outline"><i style="background:'+a.colors[d]+'"></i></div><div class="info-label">'+a.labels[d]+"</div>";return L.Browser.touch?L.DomEvent.on(c,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(c),L.DomEvent.on(c,"mousewheel",L.DomEvent.stopPropagation)),c}};return{getOnAddArcGISLegend:b,getOnAddArrayLegend:c,updateArcGISLegend:a}}),angular.module("leaflet-directive").factory("leafletPathsHelpers",["$rootScope","$log","leafletHelpers",function(a,b,c){function d(a){return a.filter(function(a){return k(a)}).map(function(a){return new L.LatLng(a.lat,a.lng)})}function e(a){return new L.LatLng(a.lat,a.lng)}function f(a){return a.map(function(a){return d(a)})}function g(a,b){for(var c=["stroke","weight","color","opacity","fill","fillColor","fillOpacity","dashArray","lineCap","lineJoin","clickable","pointerEvents","className","smoothFactor","noClip"],d={},e=0;e<c.length;e++){var f=c[e];h(a[f])?d[f]=a[f]:h(b.path[f])&&(d[f]=b.path[f])}return d}var h=c.isDefined,i=c.isArray,j=c.isNumber,k=c.isValidPoint,l=function(a,b){h(b.weight)&&a.setStyle({weight:b.weight}),h(b.color)&&a.setStyle({color:b.color}),h(b.opacity)&&a.setStyle({opacity:b.opacity})},m=function(a){if(!i(a))return!1;for(var b in a){var c=a[b];if(!k(c))return!1}return!0},n={polyline:{isValid:function(a){var b=a.latlngs;return m(b)},createPath:function(a){return new L.Polyline([],a)},setPath:function(a,b){a.setLatLngs(d(b.latlngs)),l(a,b)}},multiPolyline:{isValid:function(a){var b=a.latlngs;if(!i(b)||2!==b.length)return!1;for(var c in b){var d=b[c];if(!m(d))return!1}return!0},createPath:function(a){return new L.multiPolyline([[[0,0],[1,1]]],a)},setPath:function(a,b){a.setLatLngs(f(b.latlngs)),l(a,b)
}},polygon:{isValid:function(a){var b=a.latlngs;return m(b)},createPath:function(a){return new L.Polygon([],a)},setPath:function(a,b){a.setLatLngs(d(b.latlngs)),l(a,b)}},multiPolygon:{isValid:function(a){var b=a.latlngs;if(!i(b)||2!==b.length)return!1;for(var c in b){var d=b[c];if(!m(d))return!1}return!0},createPath:function(a){return new L.MultiPolygon([[[0,0],[1,1],[0,1]]],a)},setPath:function(a,b){a.setLatLngs(f(b.latlngs)),l(a,b)}},rectangle:{isValid:function(a){var b=a.latlngs;if(!i(b)||2!==b.length)return!1;for(var c in b){var d=b[c];if(!k(d))return!1}return!0},createPath:function(a){return new L.Rectangle([[0,0],[1,1]],a)},setPath:function(a,b){a.setBounds(new L.LatLngBounds(d(b.latlngs))),l(a,b)}},circle:{isValid:function(a){var b=a.latlngs;return k(b)&&j(a.radius)},createPath:function(a){return new L.Circle([0,0],1,a)},setPath:function(a,b){a.setLatLng(e(b.latlngs)),h(b.radius)&&a.setRadius(b.radius),l(a,b)}},circleMarker:{isValid:function(a){var b=a.latlngs;return k(b)&&j(a.radius)},createPath:function(a){return new L.CircleMarker([0,0],a)},setPath:function(a,b){a.setLatLng(e(b.latlngs)),h(b.radius)&&a.setRadius(b.radius),l(a,b)}}},o=function(a){var b={};return a.latlngs&&(b.latlngs=a.latlngs),a.radius&&(b.radius=a.radius),b};return{setPathOptions:function(a,b,c){h(b)||(b="polyline"),n[b].setPath(a,c)},createPath:function(a,c,d){h(c.type)||(c.type="polyline");var e=g(c,d),f=o(c);return n[c.type].isValid(f)?n[c.type].createPath(e):void b.error("[AngularJS - Leaflet] Invalid data passed to the "+c.type+" path")}}}]),angular.module("leaflet-directive").factory("leafletBoundsHelpers",["$log","leafletHelpers",function(a,b){function c(a){return angular.isDefined(a)&&angular.isDefined(a.southWest)&&angular.isDefined(a.northEast)&&angular.isNumber(a.southWest.lat)&&angular.isNumber(a.southWest.lng)&&angular.isNumber(a.northEast.lat)&&angular.isNumber(a.northEast.lng)}var d=b.isArray,e=b.isNumber;return{createLeafletBounds:function(a){return c(a)?L.latLngBounds([a.southWest.lat,a.southWest.lng],[a.northEast.lat,a.northEast.lng]):void 0},isValidBounds:c,createBoundsFromArray:function(b){return d(b)&&2===b.length&&d(b[0])&&d(b[1])&&2===b[0].length&&2===b[1].length&&e(b[0][0])&&e(b[0][1])&&e(b[1][0])&&e(b[1][1])?{northEast:{lat:b[0][0],lng:b[0][1]},southWest:{lat:b[1][0],lng:b[1][1]}}:void a.error("[AngularJS - Leaflet] The bounds array is not valid.")}}}]),angular.module("leaflet-directive").factory("leafletMarkersHelpers",["$rootScope","leafletHelpers","$log",function(a,b,c){var d=b.isDefined,e=b.MarkerClusterPlugin,f=b.AwesomeMarkersPlugin,g=b.safeApply,h=b,i=b.isString,j=b.isNumber,k=b.isObject,l=b.isDefinedAndNotNull,m={},n=function(a){if(d(a)&&d(a.type)&&"awesomeMarker"===a.type)return f.isLoaded()||c.error("[AngularJS - Leaflet] The AwesomeMarkers Plugin is not loaded."),new L.AwesomeMarkers.icon(a);if(d(a)&&d(a.type)&&"div"===a.type)return new L.divIcon(a);var b="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAGmklEQVRYw7VXeUyTZxjvNnfELFuyIzOabermMZEeQC/OclkO49CpOHXOLJl/CAURuYbQi3KLgEhbrhZ1aDwmaoGqKII6odATmH/scDFbdC7LvFqOCc+e95s2VG50X/LLm/f4/Z7neY/ne18aANCmAr5E/xZf1uDOkTcGcWR6hl9247tT5U7Y6SNvWsKT63P58qbfeLJG8M5qcgTknrvvrdDbsT7Ml+tv82X6vVxJE33aRmgSyYtcWVMqX97Yv2JvW39UhRE2HuyBL+t+gK1116ly06EeWFNlAmHxlQE0OMiV6mQCScusKRlhS3QLeVJdl1+23h5dY4FNB3thrbYboqptEFlphTC1hSpJnbRvxP4NWgsE5Jyz86QNNi/5qSUTGuFk1gu54tN9wuK2wc3o+Wc13RCmsoBwEqzGcZsxsvCSy/9wJKf7UWf1mEY8JWfewc67UUoDbDjQC+FqK4QqLVMGGR9d2wurKzqBk3nqIT/9zLxRRjgZ9bqQgub+DdoeCC03Q8j+0QhFhBHR/eP3U/zCln7Uu+hihJ1+bBNffLIvmkyP0gpBZWYXhKussK6mBz5HT6M1Nqpcp+mBCPXosYQfrekGvrjewd59/GvKCE7TbK/04/ZV5QZYVWmDwH1mF3xa2Q3ra3DBC5vBT1oP7PTj4C0+CcL8c7C2CtejqhuCnuIQHaKHzvcRfZpnylFfXsYJx3pNLwhKzRAwAhEqG0SpusBHfAKkxw3w4627MPhoCH798z7s0ZnBJ/MEJbZSbXPhER2ih7p2ok/zSj2cEJDd4CAe+5WYnBCgR2uruyEw6zRoW6/DWJ/OeAP8pd/BGtzOZKpG8oke0SX6GMmRk6GFlyAc59K32OTEinILRJRchah8HQwND8N435Z9Z0FY1EqtxUg+0SO6RJ/mmXz4VuS+DpxXC3gXmZwIL7dBSH4zKE50wESf8qwVgrP1EIlTO5JP9Igu0aexdh28F1lmAEGJGfh7jE6ElyM5Rw/FDcYJjWhbeiBYoYNIpc2FT/SILivp0F1ipDWk4BIEo2VuodEJUifhbiltnNBIXPUFCMpthtAyqws/BPlEF/VbaIxErdxPphsU7rcCp8DohC+GvBIPJS/tW2jtvTmmAeuNO8BNOYQeG8G/2OzCJ3q+soYB5i6NhMaKr17FSal7GIHheuV3uSCY8qYVuEm1cOzqdWr7ku/R0BDoTT+DT+ohCM6/CCvKLKO4RI+dXPeAuaMqksaKrZ7L3FE5FIFbkIceeOZ2OcHO6wIhTkNo0ffgjRGxEqogXHYUPHfWAC/lADpwGcLRY3aeK4/oRGCKYcZXPVoeX/kelVYY8dUGf8V5EBRbgJXT5QIPhP9ePJi428JKOiEYhYXFBqou2Guh+p/mEB1/RfMw6rY7cxcjTrneI1FrDyuzUSRm9miwEJx8E/gUmqlyvHGkneiwErR21F3tNOK5Tf0yXaT+O7DgCvALTUBXdM4YhC/IawPU+2PduqMvuaR6eoxSwUk75ggqsYJ7VicsnwGIkZBSXKOUww73WGXyqP+J2/b9c+gi1YAg/xpwck3gJuucNrh5JvDPvQr0WFXf0piyt8f8/WI0hV4pRxxkQZdJDfDJNOAmM0Ag8jyT6hz0WGXWuP94Yh2jcfjmXAGvHCMslRimDHYuHuDsy2QtHuIavznhbYURq5R57KpzBBRZKPJi8eQg48h4j8SDdowifdIrEVdU+gbO6QNvRRt4ZBthUaZhUnjlYObNagV3keoeru3rU7rcuceqU1mJBxy+BWZYlNEBH+0eH4vRiB+OYybU2hnblYlTvkHinM4m54YnxSyaZYSF6R3jwgP7udKLGIX6r/lbNa9N6y5MFynjWDtrHd75ZvTYAPO/6RgF0k76mQla3FGq7dO+cH8sKn0Vo7nDllwAhqwLPkxrHwWmHJOo+AKJ4rab5OgrM7rVu8eWb2Pu0Dh4eDgXoOfvp7Y7QeqknRmvcTBEyq9m/HQQSCSz6LHq3z0yzsNySRfMS253wl2KyRDbcZPcfJKjZmSEOjcxyi+Y8dUOtsIEH6R2wNykdqrkYJ0RV92H0W58pkfQk7cKevsLK10Py8SdMGfXNXATY+pPbyJR/ET6n9nIfztNtZYRV9XniQu9IA2vOVgy4ir7GCLVmmd+zjkH0eAF9Po6K61pmCXHxU5rHMYd1ftc3owjwRSVRzLjKvqZEty6cRUD7jGqiOdu5HG6MdHjNcNYGqfDm5YRzLBBCCDl/2bk8a8gdbqcfwECu62Fg/HrggAAAABJRU5ErkJggg==",e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAYAAACoYAD2AAAC5ElEQVRYw+2YW4/TMBCF45S0S1luXZCABy5CgLQgwf//S4BYBLTdJLax0fFqmB07nnQfEGqkIydpVH85M+NLjPe++dcPc4Q8Qh4hj5D/AaQJx6H/4TMwB0PeBNwU7EGQAmAtsNfAzoZkgIa0ZgLMa4Aj6CxIAsjhjOCoL5z7Glg1JAOkaicgvQBXuncwJAWjksLtBTWZe04CnYRktUGdilALppZBOgHGZcBzL6OClABvMSVIzyBjazOgrvACf1ydC5mguqAVg6RhdkSWQFj2uxfaq/BrIZOLEWgZdALIDvcMcZLD8ZbLC9de4yR1sYMi4G20S4Q/PWeJYxTOZn5zJXANZHIxAd4JWhPIloTJZhzMQduM89WQ3MUVAE/RnhAXpTycqys3NZALOBbB7kFrgLesQl2h45Fcj8L1tTSohUwuxhy8H/Qg6K7gIs+3kkaigQCOcyEXCHN07wyQazhrmIulvKMQAwMcmLNqyCVyMAI+BuxSMeTk3OPikLY2J1uE+VHQk6ANrhds+tNARqBeaGc72cK550FP4WhXmFmcMGhTwAR1ifOe3EvPqIegFmF+C8gVy0OfAaWQPMR7gF1OQKqGoBjq90HPMP01BUjPOqGFksC4emE48tWQAH0YmvOgF3DST6xieJgHAWxPAHMuNhrImIdvoNOKNWIOcE+UXE0pYAnkX6uhWsgVXDxHdTfCmrEEmMB2zMFimLVOtiiajxiGWrbU52EeCdyOwPEQD8LqyPH9Ti2kgYMf4OhSKB7qYILbBv3CuVTJ11Y80oaseiMWOONc/Y7kJYe0xL2f0BaiFTxknHO5HaMGMublKwxFGzYdWsBF174H/QDknhTHmHHN39iWFnkZx8lPyM8WHfYELmlLKtgWNmFNzQcC1b47gJ4hL19i7o65dhH0Negbca8vONZoP7doIeOC9zXm8RjuL0Gf4d4OYaU5ljo3GYiqzrWQHfJxA6ALhDpVKv9qYeZA8eM3EhfPSCmpuD0AAAAASUVORK5CYII=";return d(a)?(d(a.iconUrl)||(a.iconUrl=b,a.shadowUrl=e),new L.Icon.Default(a)):new L.Icon.Default({iconUrl:b,shadowUrl:e})},o=function(a,b,c){if(a.closePopup(),d(c)&&d(c.overlays))for(var e in c.overlays)if(c.overlays[e]instanceof L.LayerGroup&&c.overlays[e].hasLayer(a))return void c.overlays[e].removeLayer(a);if(d(m))for(var f in m)m[f].hasLayer(a)&&m[f].removeLayer(a);b.hasLayer(a)&&b.removeLayer(a)};return{deleteMarker:o,createMarker:function(a){if(!d(a))return void c.error("[AngularJS - Leaflet] The marker definition is not valid.");var b={icon:n(a.icon),title:d(a.title)?a.title:"",draggable:d(a.draggable)?a.draggable:!1,clickable:d(a.clickable)?a.clickable:!0,riseOnHover:d(a.riseOnHover)?a.riseOnHover:!1,zIndexOffset:d(a.zIndexOffset)?a.zIndexOffset:0,iconAngle:d(a.iconAngle)?a.iconAngle:0};return new L.marker(a,b)},addMarkerToGroup:function(a,b,f){return i(b)?e.isLoaded()?(d(m[b])||(m[b]=new L.MarkerClusterGroup,f.addLayer(m[b])),void m[b].addLayer(a)):void c.error("[AngularJS - Leaflet] The MarkerCluster plugin is not loaded."):void c.error("[AngularJS - Leaflet] The marker group you have specified is invalid.")},listenMarkerEvents:function(a,b,c){a.on("popupopen",function(){g(c,function(){b.focus=!0})}),a.on("popupclose",function(){g(c,function(){b.focus=!1})})},addMarkerWatcher:function(a,b,e,f,g){var m=e.$watch("markers."+b,function(b,e){if(!d(b))return o(a,g,f),void m();if(d(e)){if(!j(b.lat)||!j(b.lng))return c.warn("There are problems with lat-lng data, please verify your marker model"),void o(a,g,f);if(i(b.layer)||i(e.layer)&&(d(f.overlays[e.layer])&&f.overlays[e.layer].hasLayer(a)&&(f.overlays[e.layer].removeLayer(a),a.closePopup()),g.hasLayer(a)||g.addLayer(a)),i(b.layer)&&e.layer!==b.layer){if(i(e.layer)&&d(f.overlays[e.layer])&&f.overlays[e.layer].hasLayer(a)&&f.overlays[e.layer].removeLayer(a),a.closePopup(),g.hasLayer(a)&&g.removeLayer(a),!d(f.overlays[b.layer]))return void c.error("[AngularJS - Leaflet] You must use a name of an existing layer");var p=f.overlays[b.layer];if(!(p instanceof L.LayerGroup))return void c.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"');p.addLayer(a),g.hasLayer(a)&&b.focus===!0&&a.openPopup()}if(b.draggable!==!0&&e.draggable===!0&&l(a.dragging)&&a.dragging.disable(),b.draggable===!0&&e.draggable!==!0&&(a.dragging?a.dragging.enable():L.Handler.MarkerDrag&&(a.dragging=new L.Handler.MarkerDrag(a),a.options.draggable=!0,a.dragging.enable())),k(b.icon)||k(e.icon)&&(a.setIcon(n()),a.closePopup(),a.unbindPopup(),i(b.message)&&a.bindPopup(b.message)),k(b.icon)&&k(e.icon)&&!angular.equals(b.icon,e.icon)){var q=!1;a.dragging&&(q=a.dragging.enabled()),a.setIcon(n(b.icon)),q&&a.dragging.enable(),a.closePopup(),a.unbindPopup(),i(b.message)&&a.bindPopup(b.message)}!i(b.message)&&i(e.message)&&(a.closePopup(),a.unbindPopup()),h.LabelPlugin.isLoaded()&&d(b.label)&&d(b.label.message)&&!angular.equals(b.label.message,e.label.message)&&a.updateLabelContent(b.label.message),i(b.message)&&!i(e.message)&&(a.bindPopup(b.message),b.focus===!0&&a.openPopup()),i(b.message)&&i(e.message)&&b.message!==e.message&&a.setPopupContent(b.message);var r=!1;b.focus!==!0&&e.focus===!0&&(a.closePopup(),r=!0),b.focus===!0&&e.focus!==!0&&(a.openPopup(),r=!0),e.focus===!0&&b.focus===!0&&(a.openPopup(),r=!0);var s=a.getLatLng(),t=i(b.layer)&&h.MarkerClusterPlugin.is(f.overlays[b.layer]);t?r?(b.lat!==e.lat||b.lng!==e.lng)&&(f.overlays[b.layer].removeLayer(a),a.setLatLng([b.lat,b.lng]),f.overlays[b.layer].addLayer(a)):s.lat!==b.lat||s.lng!==b.lng?(f.overlays[b.layer].removeLayer(a),a.setLatLng([b.lat,b.lng]),f.overlays[b.layer].addLayer(a)):(b.lat!==e.lat||b.lng!==e.lng)&&(f.overlays[b.layer].removeLayer(a),a.setLatLng([b.lat,b.lng]),f.overlays[b.layer].addLayer(a)):(s.lat!==b.lat||s.lng!==b.lng)&&a.setLatLng([b.lat,b.lng])}},!0)}}}]),angular.module("leaflet-directive").factory("leafletHelpers",["$q","$log",function(a,b){function c(a,c){var d,e;if(angular.isDefined(c))d=c;else if(1===Object.keys(a).length)for(e in a)a.hasOwnProperty(e)&&(d=e);else 0===Object.keys(a).length?d="main":b.error("[AngularJS - Leaflet] - You have more than 1 map on the DOM, you must provide the map ID to the leafletData.getXXX call");return d}function d(b,d){var e,f=c(b,d);return angular.isDefined(b[f])&&b[f].resolvedDefer!==!0?e=b[f].defer:(e=a.defer(),b[f]={defer:e,resolvedDefer:!1}),e}return{isDefined:function(a){return angular.isDefined(a)&&null!==a},isNumber:function(a){return angular.isNumber(a)},isString:function(a){return angular.isString(a)},isArray:function(a){return angular.isArray(a)},isObject:function(a){return angular.isObject(a)},isFunction:function(a){return angular.isFunction(a)},equals:function(a,b){return angular.equals(a,b)},isValidCenter:function(a){return angular.isDefined(a)&&angular.isNumber(a.lat)&&angular.isNumber(a.lng)&&angular.isNumber(a.zoom)},isValidPoint:function(a){return angular.isDefined(a)&&angular.isNumber(a.lat)&&angular.isNumber(a.lng)},isSameCenterOnMap:function(a,b){var c=b.getCenter(),d=b.getZoom();return c.lat===a.lat&&c.lng===a.lng&&d===a.zoom?!0:!1},safeApply:function(a,b){var c=a.$root.$$phase;"$apply"===c||"$digest"===c?a.$eval(b):a.$apply(b)},obtainEffectiveMapId:c,getDefer:function(a,b){var e,f=c(a,b);return e=angular.isDefined(a[f])&&a[f].resolvedDefer!==!1?a[f].defer:d(a,b)},getUnresolvedDefer:d,setResolvedDefer:function(a,b){var d=c(a,b);a[d].resolvedDefer=!0},AwesomeMarkersPlugin:{isLoaded:function(){return angular.isDefined(L.AwesomeMarkers)&&angular.isDefined(L.AwesomeMarkers.Icon)?!0:!1},is:function(a){return this.isLoaded()?a instanceof L.AwesomeMarkers.Icon:!1},equal:function(a,b){return this.isLoaded()&&this.is(a)?angular.equals(a,b):!1}},LabelPlugin:{isLoaded:function(){return angular.isDefined(L.Label)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},MarkerClusterPlugin:{isLoaded:function(){return angular.isDefined(L.MarkerClusterGroup)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},GoogleLayerPlugin:{isLoaded:function(){return angular.isDefined(L.Google)},is:function(a){return this.isLoaded()?a instanceof L.Google:!1}},ChinaLayerPlugin:{isLoaded:function(){return angular.isDefined(L.tileLayer.chinaProvider)}},BingLayerPlugin:{isLoaded:function(){return angular.isDefined(L.BingLayer)},is:function(a){return this.isLoaded()?a instanceof L.BingLayer:!1}},WFSLayerPlugin:{isLoaded:function(){return void 0!==L.GeoJSON.WFS},is:function(a){return this.isLoaded()?a instanceof L.GeoJSON.WFS:!1}},AGSLayerPlugin:{isLoaded:function(){return void 0!==lvector&&void 0!==lvector.AGS},is:function(a){return this.isLoaded()?a instanceof lvector.AGS:!1}},YandexLayerPlugin:{isLoaded:function(){return angular.isDefined(L.Yandex)},is:function(a){return this.isLoaded()?a instanceof L.Yandex:!1}},DynamicMapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.dynamicMapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.dynamicMapLayer:!1}},GeoJSONPlugin:{isLoaded:function(){return angular.isDefined(L.TileLayer.GeoJSON)},is:function(a){return this.isLoaded()?a instanceof L.TileLayer.GeoJSON:!1}},Leaflet:{DivIcon:{is:function(a){return a instanceof L.DivIcon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}},Icon:{is:function(a){return a instanceof L.Icon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}}}}}])}();

@@ -62,2 +62,13 @@ 'center' Attribute Documentation

Center position coded on a hash URL param
------------------------------------------
We can use a special feature of the center attribute which allow us to synchronize the center position of the map with the URL, adding to it a special GET parameter where the center is coded. Then we can persist the map position on the browser URL.
```
<leaflet center="center" url-hash-center="yes" />
```
Adding that attribute will synchronize the center with a GET parameter on the URL of this form `?c=lat:lng:zoom`. Furthermore, whenever the map center is changed a new event `urlCenterHash` will be emitted to the parent scope so you can update your `$location.search` with the new info (if you want).
You can take a look of this feature on this [demo](http://tombatossals.github.io/angular-leaflet-directive/examples/url-hash-center-example.html).
Development information

@@ -64,0 +75,0 @@ -----------------------

@@ -52,1 +52,2 @@ 'layers' Attribute Documentation

* MarkerCluster Layer.
* GeoJSON Layer.

@@ -35,2 +35,6 @@ 'paths' Attribute Documentation

Properties of paths
-------------------
We can change some of the properties of the paths (color, weight, opacity, stroke, etc.) the same way that we can change them on a Leaflet Path Object, take a look at [its documentation](http://leafletjs.com/reference.html#path) for reference.
Examples

@@ -37,0 +41,0 @@ --------

@@ -78,2 +78,5 @@ module.exports = function(grunt) {

configFile: 'test/protractor.conf.js',
args: {
specs: [ 'test/e2e/*.js' ],
}
},

@@ -98,3 +101,3 @@ run: {},

files: {
'dist/<%= pkg.name %>.min.no-header.js': ['dist/angular-leaflet-directive.ngmin.js']
'dist/<%= pkg.name %>.min.no-header.js': ['dist/angular-leaflet-directive.js']
}

@@ -108,5 +111,5 @@ }

cwd: 'dist',
src: ['angular-leaflet-directive.js'],
src: ['angular-leaflet-directive.pre.js'],
dest: 'dist',
ext: '.ngmin.js',
ext: '.js',
flatten: 'src/'

@@ -188,3 +191,3 @@ }

coverageReporter: {
type : 'html',
type : 'lcov',
dir : 'coverage/'

@@ -195,2 +198,9 @@ }

coveralls: {
options: {
debug: true,
coverage_dir: 'coverage'
}
},
watch: {

@@ -254,2 +264,4 @@ options : {

'src/services/leafletLayerHelpers.js',
'src/services/leafletControlHelpers.js',
'src/services/leafletLegendHelpers.js',
'src/services/leafletPathsHelpers.js',

@@ -260,3 +272,3 @@ 'src/services/leafletBoundsHelpers.js',

],
dest: 'dist/angular-leaflet-directive.js',
dest: 'dist/angular-leaflet-directive.pre.js',
},

@@ -296,3 +308,4 @@ license: {

//travis
grunt.registerTask('travis', ['bower:install', 'test:unit', 'shell:protractor_update', 'protractor:saucelabs']);
grunt.registerTask('travis', ['bower:install', 'test:unit']);
//grunt.registerTask('travis', ['bower:install', 'test:unit', 'karma:unit_coverage', 'coveralls', 'shell:protractor_update', 'protractor:saucelabs']);
};

@@ -5,3 +5,3 @@ {

"description": "angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps",
"version": "0.7.3",
"version": "0.7.6",
"homepage": "http://tombatossals.github.io/angular-leaflet-directive/",

@@ -41,3 +41,3 @@ "repository": {

"karma-coverage": "*",
"karma": "~0.10.x",
"karma": "*",
"protractor": "*",

@@ -47,3 +47,4 @@ "grunt-protractor-runner": "*",

"grunt-conventional-changelog": "*",
"grunt-bump": "*"
"grunt-bump": "*",
"grunt-karma-coveralls": "*"
},

@@ -50,0 +51,0 @@ "scripts": {

@@ -1,4 +0,7 @@

# angular-leaflet-directive [![Build Status](https://travis-ci.org/tombatossals/angular-leaflet-directive.png)](https://travis-ci.org/tombatossals/angular-leaflet-directive) [![Dependency Status](https://gemnasium.com/tombatossals/angular-leaflet-directive.png)](https://gemnasium.com/tombatossals/angular-leaflet-directive)
# angular-leaflet-directive
[![Build Status](https://travis-ci.org/tombatossals/angular-leaflet-directive.png)](https://travis-ci.org/tombatossals/angular-leaflet-directive) [![Dependency Status](https://gemnasium.com/tombatossals/angular-leaflet-directive.png)](https://gemnasium.com/tombatossals/angular-leaflet-directive) [![Coverage
Status](https://coveralls.io/repos/tombatossals/angular-leaflet-directive/badge.png?branch=master)](http://tombatossals.github.io/angular-leaflet-directive/coverage/PhantomJS%201.9.7%20%28Linux%29/lcov-report/dist/angular-leaflet-directive.js.html)
[AngularJS](http://angularjs.org/) directive for the Leaflet Javascript

@@ -13,2 +16,3 @@ Library. This software aims to easily embed maps managed by leaflet on your

* [Center autodiscover example](http://tombatossals.github.io/angular-leaflet-directive/examples/center-autodiscover-example.html)
* [Center with url hash example](http://tombatossals.github.io/angular-leaflet-directive/examples/url-hash-center-example.html)
* [Custom parameters example](http://tombatossals.github.io/angular-leaflet-directive/examples/custom-parameters-example.html)

@@ -19,6 +23,10 @@ * [Bounds example](http://tombatossals.github.io/angular-leaflet-directive/examples/bounds-example.html)

* [Tile zoom changer example](http://tombatossals.github.io/angular-leaflet-directive/examples/tiles-zoom-changer-example.html)
* [Layers simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/tiles-simple-example.html)
* [Layers simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/layers-simple-example.html)
* [Overlays simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/overlays-simple-example.html)
* [ImageOverlay simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/layers-imageoverlay-example.html)
* [Dynamic add/remove layers/overlays example](http://tombatossals.github.io/angular-leaflet-directive/examples/layers-add-remove.html)
* [Google Maps example](http://tombatossals.github.io/angular-leaflet-directive/examples/googlemaps-example.html)
* [ESRI Dynamic Layer example](http://tombatossals.github.io/angular-leaflet-directive/examples/esri-dynamiclayer-example.html)
* [ESRI Legend example](http://tombatossals.github.io/angular-leaflet-directive/examples/esri-legend-example.html)
* [Yandex Maps example](http://tombatossals.github.io/angular-leaflet-directive/examples/yandexmaps-example.html)
* [Paths Simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/paths-simple-example.html)

@@ -30,3 +38,5 @@ * [Paths Types example](http://tombatossals.github.io/angular-leaflet-directive/examples/paths-types-example.html)

* [Marker with group clustering example](http://tombatossals.github.io/angular-leaflet-directive/examples/markers-clustering-example.html)
* [Marker with group clustering example without overlays](http://tombatossals.github.io/angular-leaflet-directive/examples/markers-clustering-without-overlays-example.html)
* [Marker groups example](http://tombatossals.github.io/angular-leaflet-directive/examples/markers-groups-example.html)
* [Marker update properties example](http://tombatossals.github.io/angular-leaflet-directive/examples/markers-update-example.html)
* [Markers dynamic add/remove example](http://tombatossals.github.io/angular-leaflet-directive/examples/markers-dynamic-addremove-example.html)

@@ -33,0 +43,0 @@ * [Marker addition example](http://tombatossals.github.io/angular-leaflet-directive/examples/markers-add-example.html)

@@ -1,2 +0,2 @@

angular.module("leaflet-directive").directive('bounds', function ($log, leafletHelpers, leafletBoundsHelpers) {
angular.module("leaflet-directive").directive('bounds', function ($log, $timeout, leafletHelpers, leafletBoundsHelpers) {
return {

@@ -6,3 +6,3 @@ restrict: "A",

replace: false,
require: 'leaflet',
require: [ 'leaflet', 'center' ],

@@ -12,29 +12,54 @@ link: function(scope, element, attrs, controller) {

createLeafletBounds = leafletBoundsHelpers.createLeafletBounds,
updateBoundsInScope = leafletBoundsHelpers.updateBoundsInScope,
leafletScope = controller.getLeafletScope();
leafletScope = controller[0].getLeafletScope(),
mapController = controller[0],
centerController = controller[1];
controller.getMap().then(function(map) {
var initializing = true;
var emptyBounds = function(bounds) {
if (bounds._southWest.lat === 0 && bounds._southWest.lng === 0 && bounds._northEast.lat === 0 && bounds._northEast.lng === 0) {
return true;
}
return false;
};
mapController.getMap().then(function(map) {
map.whenReady(function() {
leafletScope.$watch('bounds', function(newBounds) {
if (!isDefined(newBounds)) {
$log.error('[AngularJS - Leaflet] Invalid bounds');
return;
}
centerController.getCenter().then(function() {
leafletScope.$on("boundsChanged", function(event) {
var scope = event.currentScope;
var bounds = map.getBounds();
$log.debug("updated map bounds...", bounds);
if (emptyBounds(bounds)) {
return;
}
var newScopeBounds = {
northEast: {
lat: bounds._northEast.lat,
lng: bounds._northEast.lng
},
southWest: {
lat: bounds._southWest.lat,
lng: bounds._southWest.lng
}
};
if (!angular.equals(scope.bounds, newScopeBounds)) {
$log.debug("Need to update scope bounds.");
scope.bounds = newScopeBounds;
}
});
initializing = false;
var leafletBounds = createLeafletBounds(newBounds);
if (leafletBounds && !map.getBounds().equals(leafletBounds)) {
map.fitBounds(leafletBounds);
}
}, true);
leafletScope.$watch('bounds', function(bounds) {
$log.debug("updated bounds...", bounds);
if (!isDefined(bounds)) {
$log.error('[AngularJS - Leaflet] Invalid bounds');
return;
}
map.on('dragend zoomend', function() {
if (!initializing) {
updateBoundsInScope(leafletScope, map);
}
var leafletBounds = createLeafletBounds(bounds);
if (leafletBounds && !map.getBounds().equals(leafletBounds)) {
$log.debug("Need to update map bounds.");
map.fitBounds(leafletBounds);
}
}, true);
});
});
});

@@ -41,0 +66,0 @@ }

@@ -1,2 +0,28 @@

angular.module("leaflet-directive").directive('center', function ($log, $parse, leafletMapDefaults, leafletHelpers) {
angular.module("leaflet-directive").directive('center',
function ($log, $q, $location, leafletMapDefaults, leafletHelpers) {
var isDefined = leafletHelpers.isDefined,
isNumber = leafletHelpers.isNumber,
isSameCenterOnMap = leafletHelpers.isSameCenterOnMap,
safeApply = leafletHelpers.safeApply,
isValidCenter = leafletHelpers.isValidCenter;
var notifyCenterChangedToBounds = function(scope) {
scope.$broadcast("boundsChanged");
};
var notifyCenterUrlHashChanged = function(scope, map, attrs) {
if (!isDefined(attrs.urlHashCenter)) {
return;
}
var center = map.getCenter();
var centerUrlHash = (center.lat).toFixed(4) + ":" + (center.lng).toFixed(4) + ":" + map.getZoom();
var search = $location.search();
if (!isDefined(search.c) || search.c !== centerUrlHash) {
//$log.debug("notified new center...");
scope.$emit("centerUrlHash", centerUrlHash);
}
};
var _leafletCenter;
return {

@@ -7,10 +33,11 @@ restrict: "A",

require: 'leaflet',
controller: function () {
_leafletCenter = $q.defer();
this.getCenter = function() {
return _leafletCenter.promise;
};
},
link: function(scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined,
isNumber = leafletHelpers.isNumber,
safeApply = leafletHelpers.safeApply,
isValidCenter = leafletHelpers.isValidCenter,
leafletScope = controller.getLeafletScope(),
center = leafletScope.center;
var leafletScope = controller.getLeafletScope(),
centerModel = leafletScope.center;

@@ -20,23 +47,58 @@ controller.getMap().then(function(map) {

if (!isDefined(center)) {
if (attrs.center.search("-") !== -1) {
$log.error('The "center" variable can\'t use a "-" on his key name: "' + attrs.center + '".');
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom);
return;
} else if (!isDefined(centerModel)) {
$log.error('The "center" property is not defined in the main scope');
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom);
return;
} else if (!(isDefined(centerModel.lat) && isDefined(centerModel.lng)) && !isDefined(centerModel.autoDiscover)) {
angular.copy(defaults.center, centerModel);
}
var centerModel = {
lat: $parse("center.lat"),
lng: $parse("center.lng"),
zoom: $parse("center.zoom"),
autoDiscover: $parse("center.autoDiscover")
};
var urlCenterHash, mapReady;
if (attrs.urlHashCenter === "yes") {
var extractCenterFromUrl = function() {
var search = $location.search();
var centerParam;
if (isDefined(search.c)) {
var cParam = search.c.split(":");
if (cParam.length === 3) {
centerParam = { lat: parseFloat(cParam[0]), lng: parseFloat(cParam[1]), zoom: parseInt(cParam[2], 10) };
}
}
return centerParam;
};
urlCenterHash = extractCenterFromUrl();
var changingModel = false;
leafletScope.$on('$locationChangeSuccess', function(event) {
var scope = event.currentScope;
//$log.debug("updated location...");
var urlCenter = extractCenterFromUrl();
if (isDefined(urlCenter) && !isSameCenterOnMap(urlCenter, map)) {
//$log.debug("updating center model...", urlCenter);
scope.center = {
lat: urlCenter.lat,
lng: urlCenter.lng,
zoom: urlCenter.zoom
};
}
});
}
leafletScope.$watch("center", function(center) {
changingModel = true;
//$log.debug("updated center model...");
// The center from the URL has priority
if (isDefined(urlCenterHash)) {
angular.copy(urlCenterHash, center);
urlCenterHash = undefined;
}
if (!isValidCenter(center) && center.autoDiscover !== true) {
$log.warn("[AngularJS - Leaflet] invalid 'center'");
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom);
//map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom);
return;
}
if (center.autoDiscover === true) {

@@ -56,28 +118,46 @@ if (!isNumber(center.zoom)) {

if (mapReady && isSameCenterOnMap(center, map)) {
//$log.debug("no need to update map again.");
return;
}
//$log.debug("updating map center...", center);
map.setView([center.lat, center.lng], center.zoom);
changingModel = false;
notifyCenterChangedToBounds(leafletScope, map);
}, true);
map.whenReady(function() {
mapReady = true;
});
map.on("moveend", function(/* event */) {
if (changingModel) {
// Resolve the center after the first map position
_leafletCenter.resolve();
notifyCenterUrlHashChanged(leafletScope, map, attrs);
//$log.debug("updated center on map...");
if (isSameCenterOnMap(centerModel, map)) {
//$log.debug("same center in model, no need to update again.");
return;
}
safeApply(leafletScope, function(scope) {
if (centerModel) {
centerModel.lat.assign(scope, map.getCenter().lat);
centerModel.lng.assign(scope, map.getCenter().lng);
centerModel.zoom.assign(scope, map.getZoom());
centerModel.autoDiscover.assign(scope, false);
}
//$log.debug("updating center model...", map.getCenter(), map.getZoom());
scope.center = {
lat: map.getCenter().lat,
lng: map.getCenter().lng,
zoom: map.getZoom(),
autoDiscover: false
};
notifyCenterChangedToBounds(leafletScope, map);
});
});
if (center.autoDiscover === true) {
if (centerModel.autoDiscover === true) {
map.on("locationerror", function() {
$log.warn("[AngularJS - Leaflet] The Geolocation API is unauthorized on this page.");
if (isValidCenter(center)) {
map.setView([center.lat, center.lng], center.zoom);
if (isValidCenter(centerModel)) {
map.setView([centerModel.lat, centerModel.lng], centerModel.zoom);
notifyCenterChangedToBounds(leafletScope, map);
} else {
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom);
notifyCenterChangedToBounds(leafletScope, map);
}

@@ -84,0 +164,0 @@ });

@@ -19,3 +19,12 @@ angular.module("leaflet-directive").directive('controls', function ($log, leafletHelpers) {

if (isDefined(L.Control.Draw) && isDefined(controls.draw)) {
var drawControl = new L.Control.Draw(controls.draw.options);
var drawnItems = new L.FeatureGroup();
map.addLayer(drawnItems);
var options = {
edit: {
featureGroup: drawnItems
}
};
angular.extend(options, controls.draw.options);
var drawControl = new L.Control.Draw(options);
map.addControl(drawControl);

@@ -25,3 +34,3 @@ }

if(isDefined(controls.custom)) {
for(var i = 0; i < controls.custom.length; i++) {
for(var i in controls.custom) {
map.addControl(controls.custom[i]);

@@ -28,0 +37,0 @@ }

@@ -51,2 +51,3 @@ angular.module("leaflet-directive").directive('geojson', function ($log, $rootScope, leafletData, leafletHelpers) {

safeApply(leafletScope, function() {
geojson.selected = feature;
$rootScope.$broadcast('leafletDirectiveMap.geojsonClick', geojson.selected, e);

@@ -53,0 +54,0 @@ });

@@ -1,2 +0,2 @@

angular.module("leaflet-directive").directive('layers', function ($log, $q, leafletData, leafletHelpers, leafletMapDefaults, leafletLayerHelpers) {
angular.module("leaflet-directive").directive('layers', function ($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
var _leafletLayers;

@@ -17,11 +17,10 @@

var isDefined = leafletHelpers.isDefined,
isObject = leafletHelpers.isObject,
leafletLayers = {},
leafletScope = controller.getLeafletScope(),
layers = leafletScope.layers,
createLayer = leafletLayerHelpers.createLayer;
createLayer = leafletLayerHelpers.createLayer,
updateLayersControl = leafletControlHelpers.updateLayersControl,
isLayersControlVisible = false;
controller.getMap().then(function(map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
// Do we have a baselayers property?

@@ -39,6 +38,5 @@ if (!isDefined(layers) || !isDefined(layers.baselayers) || Object.keys(layers.baselayers).length === 0) {

leafletLayers.baselayers = {};
leafletLayers.controls = {};
leafletLayers.controls.layers = new L.control.layers();
leafletLayers.controls.layers.setPosition(defaults.controlLayersPosition);
leafletLayers.overlays = {};
var mapId = attrs.id;

@@ -60,15 +58,4 @@ // Setup all baselayers definitions

}
leafletLayers.controls.layers.addBaseLayer(leafletLayers.baselayers[layerName], layers.baselayers[layerName].name);
}
// Only add the layers switch selector control if we have more than one baselayer + overlay
var numberOfLayers = Object.keys(layers.baselayers).length;
if (isObject(layers.overlays)) {
numberOfLayers += Object.keys(layers.overlays).length;
}
if (numberOfLayers > 1) {
leafletLayers.controls.layers.addTo(map);
}
// If there is no visible layer add first to the map

@@ -80,3 +67,2 @@ if (!oneVisibleLayer && Object.keys(leafletLayers.baselayers).length > 0) {

// Setup the Overlays
leafletLayers.overlays = {};
for (layerName in layers.overlays) {

@@ -89,8 +75,6 @@ var newOverlayLayer = createLayer(layers.overlays[layerName]);

leafletLayers.overlays[layerName] = newOverlayLayer;
// Only add the visible overlays to the map, layer control manages the addition to the map
// of layers in its control
// Only add the visible overlays to the map
if (layers.overlays[layerName].visible === true) {
map.addLayer(leafletLayers.overlays[layerName]);
}
leafletLayers.controls.layers.addOverlay(leafletLayers.overlays[layerName], layers.overlays[layerName].name);
}

@@ -103,4 +87,2 @@

if (!isDefined(newBaseLayers[name])) {
// Remove the layer from the control
leafletLayers.controls.layers.removeLayer(leafletLayers.baselayers[name]);
// Remove from the map if it's on it

@@ -119,8 +101,6 @@ if (map.hasLayer(leafletLayers.baselayers[name])) {

leafletLayers.baselayers[newName] = testBaseLayer;
// Only add the visible layer to the map, layer control manages the addition to the map
// of layers in its control
// Only add the visible layer to the map
if (newBaseLayers[newName].top === true) {
map.addLayer(leafletLayers.baselayers[newName]);
}
leafletLayers.controls.layers.addBaseLayer(leafletLayers.baselayers[newName], newBaseLayers[newName].name);
}

@@ -147,2 +127,5 @@ }

}
// Only show the layers switch selector control if we have more than one baselayer + overlay
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, newBaseLayers, layers.overlays, leafletLayers);
}, true);

@@ -155,4 +138,2 @@

if (!isDefined(newOverlayLayers[name])) {
// Remove the layer from the control
leafletLayers.controls.layers.removeLayer(leafletLayers.overlays[name]);
// Remove from the map if it's on it

@@ -173,3 +154,2 @@ if (map.hasLayer(leafletLayers.overlays[name])) {

leafletLayers.overlays[newName] = testOverlayLayer;
leafletLayers.controls.layers.addOverlay(leafletLayers.overlays[newName], newOverlayLayers[newName].name);
if (newOverlayLayers[newName].visible === true) {

@@ -188,2 +168,5 @@ map.addLayer(leafletLayers.overlays[newName]);

}
// Only add the layers switch selector control if we have more than one baselayer + overlay
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, layers.baselayers, newOverlayLayers, leafletLayers);
}, true);

@@ -190,0 +173,0 @@ });

@@ -66,3 +66,3 @@ angular.module("leaflet-directive", []).directive('leaflet', function ($q, leafletData, leafletMapDefaults, leafletHelpers, leafletEvents) {

tileLayerObj.addTo(map);
leafletData.setTiles(tileLayerObj);
leafletData.setTiles(tileLayerObj, attrs.id);
}

@@ -99,4 +99,8 @@

});
scope.$on('$destroy', function () {
leafletData.unresolveMap(attrs.id);
});
}
};
});

@@ -1,2 +0,2 @@

angular.module("leaflet-directive").directive('legend', function ($log, leafletHelpers) {
angular.module("leaflet-directive").directive('legend', function ($log, $http, leafletHelpers, leafletLegendHelpers) {
return {

@@ -10,22 +10,44 @@ restrict: "A",

var isArray = leafletHelpers.isArray,
isDefined = leafletHelpers.isDefined,
isFunction = leafletHelpers.isFunction,
leafletScope = controller.getLeafletScope(),
legend = leafletScope.legend;
var legendClass = legend.legendClass ? legend.legendClass : "legend";
var position = legend.position || 'bottomright';
var leafletLegend;
controller.getMap().then(function(map) {
if (!isArray(legend.colors) || !isArray(legend.labels) || legend.colors.length !== legend.labels.length) {
if (!isDefined(legend.url) && (!isArray(legend.colors) || !isArray(legend.labels) || legend.colors.length !== legend.labels.length)) {
$log.warn("[AngularJS - Leaflet] legend.colors and legend.labels must be set.");
} else if(isDefined(legend.url)){
$log.info("[AngularJS - Leaflet] loading arcgis legend service.");
} else {
var legendClass = legend.legendClass ? legend.legendClass : "legend";
var position = legend.position || 'bottomright';
var leafletLegend = L.control({ position: position });
leafletLegend.onAdd = function (/*map*/) {
var div = L.DomUtil.create('div', legendClass);
for (var i = 0; i < legend.colors.length; i++) {
div.innerHTML +=
'<div><i style="background:' + legend.colors[i] + '"></i>' + legend.labels[i] + '</div>';
}
return div;
};
// TODO: Watch array legend.
leafletLegend = L.control({ position: position });
leafletLegend.onAdd = leafletLegendHelpers.getOnAddArrayLegend(legend, legendClass);
leafletLegend.addTo(map);
}
leafletScope.$watch('legend.url', function(newURL) {
if(!isDefined(newURL)) {
return;
}
$http.get(newURL)
.success(function(legendData) {
if(isDefined(leafletLegend)) {
leafletLegendHelpers.updateArcGISLegend(leafletLegend.getContainer(),legendData);
} else {
leafletLegend = L.control({ position: position });
leafletLegend.onAdd = leafletLegendHelpers.getOnAddArcGISLegend(legendData, legendClass);
leafletLegend.addTo(map);
}
if(isDefined(legend.loadedData) && isFunction(legend.loadedData)) {
legend.loadedData();
}
})
.error(function() {
$log.warn('[AngularJS - Leaflet] legend.url not loaded.');
});
});
});

@@ -32,0 +54,0 @@ }

@@ -17,2 +17,3 @@ angular.module("leaflet-directive").directive('markers', function ($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults, leafletMarkersHelpers, leafletEvents) {

addMarkerWatcher = leafletMarkersHelpers.addMarkerWatcher,
listenMarkerEvents = leafletMarkersHelpers.listenMarkerEvents,
addMarkerToGroup = leafletMarkersHelpers.addMarkerToGroup,

@@ -54,2 +55,7 @@ bindMarkerEvents = leafletEvents.bindMarkerEvents,

for (var newName in newMarkers) {
if (newName.search("-") !== -1) {
$log.error('The marker can\'t use a "-" on his key name: "' + newName + '".');
continue;
}
if (!isDefined(leafletMarkers[newName])) {

@@ -66,3 +72,3 @@ var markerData = newMarkers[newName];

if (isDefined(markerData.message)) {
marker.bindPopup(markerData.message);
marker.bindPopup(markerData.message, markerData.popupOptions);
}

@@ -110,3 +116,4 @@

} else {
// Add the marker to the map if it hasn't been added to a layer or to a group
} else if (!isDefined(markerData.group)) {
// We do not have a layer attr, so the marker goes to the map layer

@@ -127,2 +134,3 @@ map.addLayer(marker);

addMarkerWatcher(marker, newName, leafletScope, layers, map);
listenMarkerEvents(marker, markerData, leafletScope);
}

@@ -129,0 +137,0 @@ bindMarkerEvents(marker, newName, markerData, leafletScope);

@@ -1,2 +0,2 @@

angular.module("leaflet-directive").directive('paths', function ($log, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers) {
angular.module("leaflet-directive").directive('paths', function ($log, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletEvents) {
return {

@@ -13,2 +13,3 @@ restrict: "A",

createPath = leafletPathsHelpers.createPath,
bindPathEvents = leafletEvents.bindPathEvents,
setPathOptions = leafletPathsHelpers.setPathOptions;

@@ -41,5 +42,21 @@

for (var newName in newPaths) {
if (newName.search("-") !== -1) {
$log.error('[AngularJS - Leaflet] The path name "' + newName + '" is not valid. It must not include "-" and a number.');
continue;
}
if (!isDefined(leafletPaths[newName])) {
var pathData = newPaths[newName];
var newPath = createPath(newName, newPaths[newName], defaults);
// bind popup if defined
if (isDefined(newPath) && isDefined(pathData.message)) {
newPath.bindPopup(pathData.message);
}
// Show label if defined
if (leafletHelpers.LabelPlugin.isLoaded() && isDefined(pathData.label) && isDefined(pathData.label.message)) {
newPath.bindLabel(pathData.label.message, pathData.label.options);
}
// Listen for changes on the new path

@@ -51,2 +68,4 @@ if (isDefined(newPath)) {

}
bindPathEvents(newPath, newName, pathData, leafletScope);
}

@@ -53,0 +72,0 @@ }

@@ -24,3 +24,3 @@ /**!

*
* angular-google-maps
* angular-leaflet-directive
* https://github.com/tombatossals/angular-leaflet-directive

@@ -27,0 +27,0 @@ *

@@ -18,4 +18,2 @@ angular.module("leaflet-directive").factory('leafletBoundsHelpers', function ($log, leafletHelpers) {

[bounds.northEast.lat, bounds.northEast.lng ]);
} else {
return false;
}

@@ -47,22 +45,4 @@ },

},
updateBoundsInScope: function(leafletScope, map) {
var mapBounds = map.getBounds();
var newScopeBounds = {
northEast: {
lat: mapBounds.getNorthEast().lat,
lng: mapBounds.getNorthEast().lng
},
southWest: {
lat: mapBounds.getSouthWest().lat,
lng: mapBounds.getSouthWest().lng
}
};
if(!angular.equals(leafletScope.bounds, newScopeBounds)) {
leafletScope.bounds = newScopeBounds;
}
}
};
});

@@ -24,2 +24,7 @@ angular.module("leaflet-directive").service('leafletData', function ($log, $q, leafletHelpers) {

this.unresolveMap = function (scopeId) {
var id = leafletHelpers.obtainEffectiveMapId(maps, scopeId);
maps[id] = undefined;
};
this.getPaths = function(scopeId) {

@@ -26,0 +31,0 @@ var defer = getDefer(paths, scopeId);

@@ -62,2 +62,22 @@ angular.module("leaflet-directive").factory('leafletEvents', function ($rootScope, $q, $log, leafletHelpers) {

var genDispatchPathEvent = function(eventName, logic, leafletScope, marker, name) {
return function(e) {
var broadcastName = 'leafletDirectivePath.' + eventName;
safeApply(leafletScope, function(scope){
if (logic === "emit") {
scope.$emit(broadcastName, {
pathName: name,
leafletEvent: e
});
} else {
$rootScope.$broadcast(broadcastName, {
pathName: name,
leafletEvent: e
});
}
});
};
};
var genDispatchLabelEvent = function(scope, eventName, logic, label, scope_watch_name) {

@@ -106,2 +126,17 @@ return function(e) {

var _getAvailablePathEvents = function() {
return [
'click',
'dblclick',
'mousedown',
'mouseover',
'mouseout',
'contextmenu',
'add',
'remove',
'popupopen',
'popupclose'
];
};
return {

@@ -143,3 +178,12 @@ getAvailableMapEvents: function() {

'popupopen',
'popupclose'
'popupclose',
'draw:created',
'draw:edited',
'draw:deleted',
'draw:drawstart',
'draw:drawstop',
'draw:editstart',
'draw:editstop',
'draw:deletestart',
'draw:deletestop'
];

@@ -169,2 +213,4 @@ },

getAvailablePathEvents: _getAvailablePathEvents,
bindMarkerEvents: function(marker, name, markerData, leafletScope) {

@@ -187,3 +233,3 @@ var markerEvents = [];

markerEvents = _getAvailableMarkerEvents();
} else if (isObject(leafletScope.eventBroadcast.marker)) {
} else if (!isObject(leafletScope.eventBroadcast.marker)) {
// Not a valid object

@@ -269,5 +315,108 @@ $log.warn("[AngularJS - Leaflet] event-broadcast.marker must be an object check your model.");

}
},
bindPathEvents: function(path, name, pathData, leafletScope) {
var pathEvents = [];
var i;
var eventName;
var logic = "broadcast";
window.lls = leafletScope;
if (!isDefined(leafletScope.eventBroadcast)) {
// Backward compatibility, if no event-broadcast attribute, all events are broadcasted
pathEvents = _getAvailablePathEvents();
} else if (!isObject(leafletScope.eventBroadcast)) {
// Not a valid object
$log.error("[AngularJS - Leaflet] event-broadcast must be an object check your model.");
} else {
// We have a possible valid object
if (!isDefined(leafletScope.eventBroadcast.path)) {
// We do not have events enable/disable do we do nothing (all enabled by default)
pathEvents = _getAvailablePathEvents();
} else if (isObject(leafletScope.eventBroadcast.paths)) {
// Not a valid object
$log.warn("[AngularJS - Leaflet] event-broadcast.path must be an object check your model.");
} else {
// We have a possible valid map object
// Event propadation logic
if (leafletScope.eventBroadcast.path.logic !== undefined && leafletScope.eventBroadcast.path.logic !== null) {
// We take care of possible propagation logic
if (leafletScope.eventBroadcast.path.logic !== "emit" && leafletScope.eventBroadcast.path.logic !== "broadcast") {
// This is an error
$log.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'.");
} else if (leafletScope.eventBroadcast.path.logic === "emit") {
logic = "emit";
}
}
// Enable / Disable
var pathEventsEnable = false, pathEventsDisable = false;
if (leafletScope.eventBroadcast.pats.enable !== undefined && leafletScope.eventBroadcast.path.enable !== null) {
if (typeof leafletScope.eventBroadcast.path.enable === 'object') {
pathEventsEnable = true;
}
}
if (leafletScope.eventBroadcast.path.disable !== undefined && leafletScope.eventBroadcast.path.disable !== null) {
if (typeof leafletScope.eventBroadcast.path.disable === 'object') {
pathEventsDisable = true;
}
}
if (pathEventsEnable && pathEventsDisable) {
// Both are active, this is an error
$log.warn("[AngularJS - Leaflet] can not enable and disable events at the same time");
} else if (!pathEventsEnable && !pathEventsDisable) {
// Both are inactive, this is an error
$log.warn("[AngularJS - Leaflet] must enable or disable events");
} else {
// At this point the path object is OK, lets enable or disable events
if (pathEventsEnable) {
// Enable events
for (i = 0; i < leafletScope.eventBroadcast.path.enable.length; i++) {
eventName = leafletScope.eventBroadcast.path.enable[i];
// Do we have already the event enabled?
if (pathEvents.indexOf(eventName) !== -1) {
// Repeated event, this is an error
$log.warn("[AngularJS - Leaflet] This event " + eventName + " is already enabled");
} else {
// Does the event exists?
if (_getAvailablePathEvents().indexOf(eventName) === -1) {
// The event does not exists, this is an error
$log.warn("[AngularJS - Leaflet] This event " + eventName + " does not exist");
} else {
// All ok enable the event
pathEvents.push(eventName);
}
}
}
} else {
// Disable events
pathEvents = _getAvailablePathEvents();
for (i = 0; i < leafletScope.eventBroadcast.path.disable.length; i++) {
eventName = leafletScope.eventBroadcast.path.disable[i];
var index = pathEvents.indexOf(eventName);
if (index === -1) {
// The event does not exist
$log.warn("[AngularJS - Leaflet] This event " + eventName + " does not exist or has been already disabled");
} else {
pathEvents.splice(index, 1);
}
}
}
}
}
}
for (i = 0; i < pathEvents.length; i++) {
eventName = pathEvents[i];
path.on(eventName, genDispatchPathEvent(eventName, logic, leafletScope, pathEvents, name));
}
if (Helpers.LabelPlugin.isLoaded() && isDefined(path.label)) {
genLabelEvents(leafletScope, logic, path, name);
}
}
};
});

@@ -67,2 +67,7 @@ angular.module("leaflet-directive").factory('leafletHelpers', function ($q, $log) {

// Determine if a reference is a function.
isFunction: function(value) {
return angular.isFunction(value);
},
// Determine if two objects have the same properties

@@ -83,2 +88,11 @@ equals: function(o1, o2) {

isSameCenterOnMap: function(centerModel, map) {
var mapCenter = map.getCenter();
var zoom = map.getZoom();
if (mapCenter.lat === centerModel.lat && mapCenter.lng === centerModel.lng && zoom === centerModel.zoom) {
return true;
}
return false;
},
safeApply: function($scope, fn) {

@@ -115,4 +129,4 @@ var phase = $scope.$root.$$phase;

isLoaded: function() {
if (L.AwesomeMarkers !== undefined) {
return (L.AwesomeMarkers.Icon !== undefined);
if (angular.isDefined(L.AwesomeMarkers) && angular.isDefined(L.AwesomeMarkers.Icon)) {
return true;
} else {

@@ -176,2 +190,7 @@ return false;

},
ChinaLayerPlugin: {
isLoaded: function() {
return angular.isDefined(L.tileLayer.chinaProvider);
}
},
BingLayerPlugin: {

@@ -199,3 +218,3 @@ isLoaded: function() {

}
},
}
},

@@ -212,3 +231,15 @@ AGSLayerPlugin: {

}
}
},
YandexLayerPlugin: {
isLoaded: function() {
return angular.isDefined(L.Yandex);
},
is: function(layer) {
if (this.isLoaded()) {
return layer instanceof L.Yandex;
} else {
return false;
}
}
},

@@ -225,4 +256,16 @@ DynamicMapLayerPlugin: {

}
},
}
},
GeoJSONPlugin: {
isLoaded: function(){
return angular.isDefined(L.TileLayer.GeoJSON);
},
is: function(layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.GeoJSON;
} else {
return false;
}
}
},
Leaflet: {

@@ -229,0 +272,0 @@ DivIcon: {

@@ -14,2 +14,11 @@ angular.module("leaflet-directive").factory('leafletLayerHelpers', function ($rootScope, $log, leafletHelpers) {

},
geoJSON:{
mustHaveUrl: true,
createLayer: function(params) {
if (!Helpers.GeoJSONPlugin.isLoaded()) {
return;
}
return new L.TileLayer.GeoJSON(params.url, params.pluginOptions, params.options);
}
},
wms: {

@@ -21,2 +30,8 @@ mustHaveUrl: true,

},
wmts: {
mustHaveUrl: true,
createLayer: function(params) {
return L.tileLayer.wmts(params.url, params.options);
}
},
wfs: {

@@ -53,2 +68,12 @@ mustHaveUrl: true,

},
china:{
mustHaveUrl:false,
createLayer:function(params){
var type = params.type || '';
if(!Helpers.ChinaLayerPlugin.isLoaded()){
return;
}
return L.tileLayer.chinaProvider(type, params.options);
}
},
ags: {

@@ -95,3 +120,3 @@ mustHaveUrl: true,

bing: {
mustHaveUrl: true,
mustHaveUrl: false,
createLayer: function(params) {

@@ -104,2 +129,12 @@ if (!Helpers.BingLayerPlugin.isLoaded()) {

},
yandex: {
mustHaveUrl: false,
createLayer: function(params) {
var type = params.type || 'map';
if (!Helpers.YandexLayerPlugin.isLoaded()) {
return;
}
return new L.Yandex(type, params.options);
}
},
imageOverlay: {

@@ -172,3 +207,4 @@ mustHaveUrl: true,

bounds: layerDefinition.bounds,
key: layerDefinition.key
key: layerDefinition.key,
pluginOptions: layerDefinition.pluginOptions
};

@@ -175,0 +211,0 @@

@@ -1,2 +0,2 @@

angular.module("leaflet-directive").factory('leafletMapDefaults', function (leafletHelpers) {
angular.module("leaflet-directive").factory('leafletMapDefaults', function ($q, leafletHelpers) {
function _getDefaults() {

@@ -13,8 +13,9 @@ return {

attributionControl: true,
layercontrol: {
position:'topright',
control: L.control.layers,
collapsed: true
},
controlLayersPosition: 'topright',
controls: {
layers: {
visible: true,
position:'topright',
collapsed: true
}
},
crs: L.CRS.EPSG3857,

@@ -91,3 +92,3 @@ tileLayer: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',

newDefaults.zoomControl = isDefined(userDefaults.zoomControl) ? userDefaults.zoomControl : newDefaults.zoomControl;
newDefaults.zoomsliderControl = isDefined(userDefaults.zoomsliderControl) ? userDefaults.zoomsliderControl : newDefaults.zoomsliderControl;
newDefaults.zoomsliderControl = isDefined(userDefaults.zoomsliderControl) ? userDefaults.zoomsliderControl : newDefaults.zoomsliderControl;
newDefaults.attributionControl = isDefined(userDefaults.attributionControl) ? userDefaults.attributionControl : newDefaults.attributionControl;

@@ -99,3 +100,5 @@ newDefaults.tileLayer = isDefined(userDefaults.tileLayer) ? userDefaults.tileLayer : newDefaults.tileLayer;

newDefaults.controlLayersPosition = isDefined(userDefaults.controlLayersPosition) ? userDefaults.controlLayersPosition : newDefaults.controlLayersPosition;
if(isDefined(userDefaults.controls)) {
angular.extend(newDefaults.controls, userDefaults.controls);
}

@@ -102,0 +105,0 @@ if (isDefined(userDefaults.crs) && isDefined(L.CRS[userDefaults.crs])) {

@@ -5,2 +5,4 @@ angular.module("leaflet-directive").factory('leafletMarkersHelpers', function ($rootScope, leafletHelpers, $log) {

MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin,
AwesomeMarkersPlugin = leafletHelpers.AwesomeMarkersPlugin,
safeApply = leafletHelpers.safeApply,
Helpers = leafletHelpers,

@@ -10,5 +12,14 @@ isString = leafletHelpers.isString,

isObject = leafletHelpers.isObject,
isDefinedAndNotNull = leafletHelpers.isDefinedAndNotNull,
groups = {};
var createLeafletIcon = function(iconData) {
if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'awesomeMarker') {
if (!AwesomeMarkersPlugin.isLoaded()) {
$log.error('[AngularJS - Leaflet] The AwesomeMarkers Plugin is not loaded.');
}
return new L.AwesomeMarkers.icon(iconData);
}
if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'div') {

@@ -18,5 +29,18 @@ return new L.divIcon(iconData);

var base64icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAGmklEQVRYw7VXeUyTZxjvNnfELFuyIzOabermMZEeQC/OclkO49CpOHXOLJl/CAURuYbQi3KLgEhbrhZ1aDwmaoGqKII6odATmH/scDFbdC7LvFqOCc+e95s2VG50X/LLm/f4/Z7neY/ne18aANCmAr5E/xZf1uDOkTcGcWR6hl9247tT5U7Y6SNvWsKT63P58qbfeLJG8M5qcgTknrvvrdDbsT7Ml+tv82X6vVxJE33aRmgSyYtcWVMqX97Yv2JvW39UhRE2HuyBL+t+gK1116ly06EeWFNlAmHxlQE0OMiV6mQCScusKRlhS3QLeVJdl1+23h5dY4FNB3thrbYboqptEFlphTC1hSpJnbRvxP4NWgsE5Jyz86QNNi/5qSUTGuFk1gu54tN9wuK2wc3o+Wc13RCmsoBwEqzGcZsxsvCSy/9wJKf7UWf1mEY8JWfewc67UUoDbDjQC+FqK4QqLVMGGR9d2wurKzqBk3nqIT/9zLxRRjgZ9bqQgub+DdoeCC03Q8j+0QhFhBHR/eP3U/zCln7Uu+hihJ1+bBNffLIvmkyP0gpBZWYXhKussK6mBz5HT6M1Nqpcp+mBCPXosYQfrekGvrjewd59/GvKCE7TbK/04/ZV5QZYVWmDwH1mF3xa2Q3ra3DBC5vBT1oP7PTj4C0+CcL8c7C2CtejqhuCnuIQHaKHzvcRfZpnylFfXsYJx3pNLwhKzRAwAhEqG0SpusBHfAKkxw3w4627MPhoCH798z7s0ZnBJ/MEJbZSbXPhER2ih7p2ok/zSj2cEJDd4CAe+5WYnBCgR2uruyEw6zRoW6/DWJ/OeAP8pd/BGtzOZKpG8oke0SX6GMmRk6GFlyAc59K32OTEinILRJRchah8HQwND8N435Z9Z0FY1EqtxUg+0SO6RJ/mmXz4VuS+DpxXC3gXmZwIL7dBSH4zKE50wESf8qwVgrP1EIlTO5JP9Igu0aexdh28F1lmAEGJGfh7jE6ElyM5Rw/FDcYJjWhbeiBYoYNIpc2FT/SILivp0F1ipDWk4BIEo2VuodEJUifhbiltnNBIXPUFCMpthtAyqws/BPlEF/VbaIxErdxPphsU7rcCp8DohC+GvBIPJS/tW2jtvTmmAeuNO8BNOYQeG8G/2OzCJ3q+soYB5i6NhMaKr17FSal7GIHheuV3uSCY8qYVuEm1cOzqdWr7ku/R0BDoTT+DT+ohCM6/CCvKLKO4RI+dXPeAuaMqksaKrZ7L3FE5FIFbkIceeOZ2OcHO6wIhTkNo0ffgjRGxEqogXHYUPHfWAC/lADpwGcLRY3aeK4/oRGCKYcZXPVoeX/kelVYY8dUGf8V5EBRbgJXT5QIPhP9ePJi428JKOiEYhYXFBqou2Guh+p/mEB1/RfMw6rY7cxcjTrneI1FrDyuzUSRm9miwEJx8E/gUmqlyvHGkneiwErR21F3tNOK5Tf0yXaT+O7DgCvALTUBXdM4YhC/IawPU+2PduqMvuaR6eoxSwUk75ggqsYJ7VicsnwGIkZBSXKOUww73WGXyqP+J2/b9c+gi1YAg/xpwck3gJuucNrh5JvDPvQr0WFXf0piyt8f8/WI0hV4pRxxkQZdJDfDJNOAmM0Ag8jyT6hz0WGXWuP94Yh2jcfjmXAGvHCMslRimDHYuHuDsy2QtHuIavznhbYURq5R57KpzBBRZKPJi8eQg48h4j8SDdowifdIrEVdU+gbO6QNvRRt4ZBthUaZhUnjlYObNagV3keoeru3rU7rcuceqU1mJBxy+BWZYlNEBH+0eH4vRiB+OYybU2hnblYlTvkHinM4m54YnxSyaZYSF6R3jwgP7udKLGIX6r/lbNa9N6y5MFynjWDtrHd75ZvTYAPO/6RgF0k76mQla3FGq7dO+cH8sKn0Vo7nDllwAhqwLPkxrHwWmHJOo+AKJ4rab5OgrM7rVu8eWb2Pu0Dh4eDgXoOfvp7Y7QeqknRmvcTBEyq9m/HQQSCSz6LHq3z0yzsNySRfMS253wl2KyRDbcZPcfJKjZmSEOjcxyi+Y8dUOtsIEH6R2wNykdqrkYJ0RV92H0W58pkfQk7cKevsLK10Py8SdMGfXNXATY+pPbyJR/ET6n9nIfztNtZYRV9XniQu9IA2vOVgy4ir7GCLVmmd+zjkH0eAF9Po6K61pmCXHxU5rHMYd1ftc3owjwRSVRzLjKvqZEty6cRUD7jGqiOdu5HG6MdHjNcNYGqfDm5YRzLBBCCDl/2bk8a8gdbqcfwECu62Fg/HrggAAAABJRU5ErkJggg==";
var base64shadow = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAYAAACoYAD2AAAC5ElEQVRYw+2YW4/TMBCF45S0S1luXZCABy5CgLQgwf//S4BYBLTdJLax0fFqmB07nnQfEGqkIydpVH85M+NLjPe++dcPc4Q8Qh4hj5D/AaQJx6H/4TMwB0PeBNwU7EGQAmAtsNfAzoZkgIa0ZgLMa4Aj6CxIAsjhjOCoL5z7Glg1JAOkaicgvQBXuncwJAWjksLtBTWZe04CnYRktUGdilALppZBOgHGZcBzL6OClABvMSVIzyBjazOgrvACf1ydC5mguqAVg6RhdkSWQFj2uxfaq/BrIZOLEWgZdALIDvcMcZLD8ZbLC9de4yR1sYMi4G20S4Q/PWeJYxTOZn5zJXANZHIxAd4JWhPIloTJZhzMQduM89WQ3MUVAE/RnhAXpTycqys3NZALOBbB7kFrgLesQl2h45Fcj8L1tTSohUwuxhy8H/Qg6K7gIs+3kkaigQCOcyEXCHN07wyQazhrmIulvKMQAwMcmLNqyCVyMAI+BuxSMeTk3OPikLY2J1uE+VHQk6ANrhds+tNARqBeaGc72cK550FP4WhXmFmcMGhTwAR1ifOe3EvPqIegFmF+C8gVy0OfAaWQPMR7gF1OQKqGoBjq90HPMP01BUjPOqGFksC4emE48tWQAH0YmvOgF3DST6xieJgHAWxPAHMuNhrImIdvoNOKNWIOcE+UXE0pYAnkX6uhWsgVXDxHdTfCmrEEmMB2zMFimLVOtiiajxiGWrbU52EeCdyOwPEQD8LqyPH9Ti2kgYMf4OhSKB7qYILbBv3CuVTJ11Y80oaseiMWOONc/Y7kJYe0xL2f0BaiFTxknHO5HaMGMublKwxFGzYdWsBF174H/QDknhTHmHHN39iWFnkZx8lPyM8WHfYELmlLKtgWNmFNzQcC1b47gJ4hL19i7o65dhH0Negbca8vONZoP7doIeOC9zXm8RjuL0Gf4d4OYaU5ljo3GYiqzrWQHfJxA6ALhDpVKv9qYeZA8eM3EhfPSCmpuD0AAAAASUVORK5CYII=";
if (!isDefined(iconData)) {
return new L.Icon.Default();
return new L.Icon.Default({
iconUrl: base64icon,
shadowUrl: base64shadow
});
}
if (!isDefined(iconData.iconUrl)) {
iconData.iconUrl = base64icon;
iconData.shadowUrl = base64shadow;
}
return new L.Icon.Default(iconData);

@@ -67,3 +91,5 @@ };

clickable: isDefined(markerData.clickable) ? markerData.clickable : true,
riseOnHover: isDefined(markerData.riseOnHover) ? markerData.riseOnHover : false
riseOnHover: isDefined(markerData.riseOnHover) ? markerData.riseOnHover : false,
zIndexOffset: isDefined(markerData.zIndexOffset) ? markerData.zIndexOffset : 0,
iconAngle: isDefined(markerData.iconAngle) ? markerData.iconAngle : 0
};

@@ -91,2 +117,15 @@

listenMarkerEvents: function(marker, markerData, leafletScope) {
marker.on("popupopen", function(/* event */) {
safeApply(leafletScope, function() {
markerData.focus = true;
});
});
marker.on("popupclose", function(/* event */) {
safeApply(leafletScope, function() {
markerData.focus = false;
});
});
},
addMarkerWatcher: function(marker, name, leafletScope, layers, map) {

@@ -111,3 +150,3 @@ var clearWatch = leafletScope.$watch("markers."+name, function(markerData, oldMarkerData) {

// It is possible the the layer has been removed or the layer marker does not exist
// It is possible that the layer has been removed or the layer marker does not exist
// Update the layer group if present or move it to the map if not

@@ -129,3 +168,3 @@ if (!isString(markerData.layer)) {

if (isString(markerData.layer) && (isDefined(oldMarkerData.layer) || oldMarkerData.layer !== markerData.layer)) {
if (isString(markerData.layer) && oldMarkerData.layer !== markerData.layer) {
// If it was on a layer group we have to remove it

@@ -163,5 +202,6 @@ if (isString(oldMarkerData.layer) && isDefined(layers.overlays[oldMarkerData.layer]) && layers.overlays[oldMarkerData.layer].hasLayer(marker)) {

// Update the draggable property
if (markerData.draggable !== true && oldMarkerData.draggable === true && marker.dragging === true) {
if (markerData.draggable !== true && oldMarkerData.draggable === true && (isDefinedAndNotNull(marker.dragging))) {
marker.dragging.disable();
}
if (markerData.draggable === true && oldMarkerData.draggable !== true) {

@@ -216,4 +256,9 @@ // The markerData.draggable property must be true so we update if there wasn't a previous value or it wasn't true

// Update the label content
if (Helpers.LabelPlugin.isLoaded() && isDefined(markerData.label) && isDefined(markerData.label.message) && !angular.equals(markerData.label.message, oldMarkerData.label.message)) {
marker.updateLabelContent(markerData.label.message);
}
// There is some text in the popup, so we must show the text or update existing
if (isString(markerData) && !isString(oldMarkerData)) {
if (isString(markerData.message) && !isString(oldMarkerData.message)) {
// There was no message before so we create it

@@ -227,3 +272,3 @@ marker.bindPopup(markerData.message);

if (isString(markerData) && isString(oldMarkerData) && markerData.message !== oldMarkerData.message) {
if (isString(markerData.message) && isString(oldMarkerData.message) && markerData.message !== oldMarkerData.message) {
// There was a different previous message so we update it

@@ -234,5 +279,7 @@ marker.setPopupContent(markerData.message);

// Update the focus property
var updatedFocus = false;
if (markerData.focus !== true && oldMarkerData.focus === true) {
// If there was a focus property and was true we turn it off
marker.closePopup();
updatedFocus = true;
}

@@ -243,2 +290,3 @@

marker.openPopup();
updatedFocus = true;
}

@@ -249,16 +297,36 @@

marker.openPopup();
updatedFocus = true;
}
var markerLatLng = marker.getLatLng();
if (markerLatLng.lat !== markerData.lat || markerLatLng.lng !== markerData.lng) {
// if the marker is in a clustermarker layer it has to be removed and added again to the layer
var isCluster = false;
if (isString(markerData.layer) && Helpers.MarkerClusterPlugin.is(layers.overlays[markerData.layer])) {
layers.overlays[markerData.layer].removeLayer(marker);
isCluster = true;
var isCluster = (isString(markerData.layer) && Helpers.MarkerClusterPlugin.is(layers.overlays[markerData.layer]));
// If the marker is in a cluster it has to be removed and added to the layer when the location is changed
if (isCluster) {
// The focus has changed even by a user click or programatically
if (updatedFocus) {
// We only have to update the location if it was changed programatically, because it was
// changed by a user drag the marker data has already been updated by the internal event
// listened by the directive
if ((markerData.lat !== oldMarkerData.lat) || (markerData.lng !== oldMarkerData.lng)) {
layers.overlays[markerData.layer].removeLayer(marker);
marker.setLatLng([markerData.lat, markerData.lng]);
layers.overlays[markerData.layer].addLayer(marker);
}
} else {
// The marker has possibly moved. It can be moved by a user drag (marker location and data are equal but old
// data is diferent) or programatically (marker location and data are diferent)
if ((markerLatLng.lat !== markerData.lat) || (markerLatLng.lng !== markerData.lng)) {
// The marker was moved by a user drag
layers.overlays[markerData.layer].removeLayer(marker);
marker.setLatLng([markerData.lat, markerData.lng]);
layers.overlays[markerData.layer].addLayer(marker);
} else if ((markerData.lat !== oldMarkerData.lat) || (markerData.lng !== oldMarkerData.lng)) {
// The marker was moved programatically
layers.overlays[markerData.layer].removeLayer(marker);
marker.setLatLng([markerData.lat, markerData.lng]);
layers.overlays[markerData.layer].addLayer(marker);
}
}
} else if (markerLatLng.lat !== markerData.lat || markerLatLng.lng !== markerData.lng) {
marker.setLatLng([markerData.lat, markerData.lng]);
if (isCluster) {
layers.overlays[markerData.layer].addLayer(marker);
}
}

@@ -265,0 +333,0 @@ }, true);

@@ -9,3 +9,3 @@ angular.module("leaflet-directive").factory('leafletPathsHelpers', function ($rootScope, $log, leafletHelpers) {

return latlngs.filter(function(latlng) {
return !!latlng.lat && !!latlng.lng;
return isValidPoint(latlng);
}).map(function (latlng) {

@@ -27,26 +27,23 @@ return new L.LatLng(latlng.lat, latlng.lng);

function _getOptions(path, defaults) {
var options = {
weight: defaults.path.weight,
color: defaults.path.color,
opacity: defaults.path.opacity
};
var availableOptions = [
// Path options
'stroke', 'weight', 'color', 'opacity',
'fill', 'fillColor', 'fillOpacity',
'dashArray', 'lineCap', 'lineJoin', 'clickable',
'pointerEvents', 'className',
if(isDefined(path.stroke)) {
options.stroke = path.stroke;
// Polyline options
'smoothFactor', 'noClip'
];
var options = {};
for (var i = 0; i < availableOptions.length; i++) {
var optionName = availableOptions[i];
if (isDefined(path[optionName])) {
options[optionName] = path[optionName];
} else if (isDefined(defaults.path[optionName])) {
options[optionName] = defaults.path[optionName];
}
}
if(isDefined(path.fill)) {
options.fill = path.fill;
}
if(isDefined(path.fillColor)) {
options.fillColor = path.fillColor;
}
if(isDefined(path.fillOpacity)) {
options.fillOpacity = path.fillOpacity;
}
if(isDefined(path.smoothFactor)) {
options.smoothFactor = path.smoothFactor;
}
if(isDefined(path.noClip)) {
options.noClip = path.noClip;
}

@@ -53,0 +50,0 @@ return options;

@@ -8,3 +8,3 @@ module.exports = function(karma) {

files: [
'bower_components/leaflet-dist/leaflet.js',
'bower_components/leaflet-dist/leaflet-src.js',
'bower_components/angular/angular.js',

@@ -11,0 +11,0 @@ 'bower_components/leaflet.markerclusterer/dist/leaflet.markercluster.js',

@@ -18,3 +18,3 @@ // A reference configuration file.

// The location of the selenium standalone server .jar file.
seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.39.0.jar',
seleniumServerJar: '../node_modules/protractor/selenium/selenium-server-standalone-2.40.0.jar',
// The port to start the selenium server on, or null if the server should

@@ -21,0 +21,0 @@ // find its own unused port.

@@ -18,2 +18,3 @@ 'use strict';

beforeEach(function(){
scope = $rootScope.$new();
bounds = {

@@ -29,10 +30,16 @@ southWest: {

};
scope = $rootScope.$new();
});
afterEach(inject(function($rootScope) {
$rootScope.$apply();
}));
it('updates the map bounds if bounds are provided', function() {
scope.bounds = bounds;
var element = angular.element('<leaflet bounds="bounds"></leaflet>');
angular.extend(scope, {
bounds: bounds,
center: {}
});
var element = angular.element('<leaflet bounds="bounds" center="center"></leaflet>');
element = $compile(element)(scope);
var map;

@@ -42,4 +49,4 @@ leafletData.getMap().then(function(leafletMap) {

});
scope.$digest();
var mapBounds = map.getBounds();

@@ -53,5 +60,9 @@ expect(mapBounds.getSouthWest().lat).toBeCloseTo(51.508742458803326);

it('allows empty bounds initialization', function(){
scope.bounds = {};
var element = angular.element('<leaflet bounds="bounds"></leaflet>');
angular.extend(scope, {
bounds: {},
center: {}
});
var element = angular.element('<leaflet bounds="bounds" center="center"></leaflet>');
element = $compile(element)(scope);
var map;

@@ -61,31 +72,36 @@ leafletData.getMap().then(function(leafletMap) {

});
scope.$digest();
var mapBounds = map.getBounds();
expect(mapBounds.getSouthWest().lat).toBeCloseTo(0);
expect(mapBounds.getSouthWest().lng).toBeCloseTo(0);
expect(mapBounds.getNorthEast().lat).toBeCloseTo(0);
expect(mapBounds.getNorthEast().lng).toBeCloseTo(0);
});
it('should update map bounds when map initializes', function() {
scope.bounds = {};
var element = angular.element('<leaflet bounds="bounds"></leaflet>');
xit('should update map bounds when map initializes', function() {
angular.extend(scope, {
bounds: {},
center: { lat: 5 , lng: -3, zoom: 4 }
});
var element = angular.element('<leaflet bounds="bounds" center="center"></leaflet>');
element = $compile(element)(scope);
scope.$apply();
leafletData.getMap().then(function(map) {
var bounds = scope.bounds;
var mapBounds = map.getBounds();
console.log(mapBounds);
var map;
leafletData.getMap().then(function(leafletMap) {
map = leafletMap;
});
scope.$digest();
expect(bounds.northEast).toBeNull();
expect(bounds.southWest).toBeDefined();
var bounds = scope.bounds;
var mapBounds = map.getBounds();
expect(bounds.northEast.lat).toBe(mapBounds.getNorthEast().lat);
expect(bounds.northEast.lng).toBe(mapBounds.getNorthEast().lng);
expect(bounds.southWest.lat).toBe(mapBounds.getSouthWest().lat);
expect(bounds.southWest.lng).toBe();
});
console.log(bounds);
expect(bounds.northEast).toBeDefined();
expect(bounds.southWest).toBeDefined();
expect(bounds.northEast.lat).toBe(mapBounds._northEast.lat);
expect(bounds.northEast.lng).toBe(mapBounds._northEast.lng);
expect(bounds.southWest.lat).toBe(mapBounds._southWest.lat);
expect(bounds.southWest.lng).toBe(mapBounds._southWest.lng);
});
});

@@ -8,17 +8,12 @@ 'use strict';

describe('Directive: leaflet center', function() {
var $compile, $rootScope, $timeout, leafletData, center, scope;
var $compile, $rootScope, $timeout, $location, leafletData, center, scope;
beforeEach(module('leaflet-directive'));
beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_, _leafletData_){
beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_, _$location_, _leafletData_){
$compile = _$compile_;
$rootScope = _$rootScope_;
$timeout = _$timeout_;
$location = _$location_;
leafletData = _leafletData_;
}));
afterEach(inject(function($rootScope) {
$rootScope.$apply();
}));
beforeEach(function(){
center = {

@@ -32,4 +27,8 @@ lat: 0.966,

scope.center = center;
});
}));
afterEach(inject(function($rootScope) {
$rootScope.$apply();
}));
it('should have default {[0, 0], 1} parameters on the map if not correctly defined', function() {

@@ -76,3 +75,3 @@ scope.center = {};

center.zoom = 8;
$rootScope.$digest();
scope.$digest();

@@ -84,2 +83,35 @@ expect(map.getCenter().lat).toBeCloseTo(2.02);

describe('Using url-hash functionality', function() {
it('should update the center of the map if changes the url', function() {
var element = angular.element('<leaflet center="center" url-hash-center="yes"></leaflet>');
element = $compile(element)(scope);
var map;
leafletData.getMap().then(function(leafletMap) {
map = leafletMap;
});
var centerParams = {
c: "30.1" + ":" + "-9.2" + ":" + "4"
};
$location.search(centerParams);
scope.$digest();
expect(map.getCenter().lat).toBeCloseTo(30.1);
expect(map.getCenter().lng).toBeCloseTo(-9.2);
expect(map.getZoom()).toEqual(4);
});
it('should update the url hash if changes the center', function() {
var element = angular.element('<leaflet center="center" url-hash-center="yes"></leaflet>');
element = $compile(element)(scope);
scope.center = { lat: 9.5, lng: -1.8, zoom: 8 };
var centerUrlHash;
scope.$on("centerUrlHash", function(event, u) {
centerUrlHash = u;
});
scope.$digest();
expect(centerUrlHash).toBe('9.5000:-1.8000:8');
});
});
});

@@ -506,2 +506,214 @@ 'use strict';

//
// ***************************************************************************
//
it('should broadcast path events (backward compatibility) from the rootscope if the event-broadcast does not have a path attribute',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
map: {
enable: ['click'],
logic: 'broadcast'
}
};
expect(true).toBe(true);
});
it('should NOT broadcast path events from the rootscope if the event-broadcast path attribute is not an object',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: 3
};
expect(true).toBe(true);
});
it('should broadcast path events from the rootscope if the event-broadcast path attribute does not have logic defined',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click']
}
};
expect(true).toBe(true);
});
it('should NOT broadcast path events from the rootscope if the event-broadcast path attribute has logic defined but is not "emit" or "broadcast"',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click'],
logic: "boolean"
}
};
expect(true).toBe(true);
});
it('should emit path events from the rootscope if the event-broadcast path attribute has logic defined "emit"',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click'],
logic: "emit"
}
};
expect(true).toBe(true);
});
it('should broadcast path events from the rootscope if the event-broadcast path attribute has logic defined as "broadcast"',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click'],
logic: "broadcast"
}
};
expect(true).toBe(true);
});
it('should NOT broadcast path events from the rootscope if the event-broadcast path attribute has enabled and disabled defined',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click'],
disable: ['zoomend'],
logic: "broadcast"
}
};
expect(true).toBe(true);
});
it('should NOT broadcast path events from the rootscope if the event-broadcast path attribute does not have enabled and disabled defined',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
logic: "broadcast"
}
};
expect(true).toBe(true);
});
it('should NOT broadcast some path events from the rootscope if the event-broadcast path attribute disables them',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
disable: ['click'],
logic: "broadcast"
}
};
expect(true).toBe(true);
});
it('should NOT emit some path events from the rootscope if the event-broadcast path attribute disables them',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
disable: ['click'],
logic: "emit"
}
};
expect(true).toBe(true);
});
it('should broadcast some path events from the rootscope if the event-broadcast path attribute enables them',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click'],
logic: "broadcast"
}
};
expect(true).toBe(true);
});
it('should emit some path events from the rootscope if the event-broadcast path attribute enables them',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click'],
logic: "emit"
}
};
expect(true).toBe(true);
});
it('should NOT broadcast some path events from the rootscope if the event-broadcast path attribute disables them although there is an invalid event name',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
disable: ['click', 'foo'],
logic: "broadcast"
}
};
expect(true).toBe(true);
});
it('should NOT emit some path events from the rootscope if the event-broadcast path attribute disables them although there is an invalid event name',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
disable: ['click', 'foo'],
logic: "emit"
}
};
expect(true).toBe(true);
});
it('should broadcast some path events from the rootscope if the event-broadcast path attribute enables them although there is an invalid event name',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
path: {
enable: ['click', 'foo'],
logic: "broadcast"
}
};
expect(true).toBe(true);
});
it('should emit some path events from the rootscope if the event-broadcast path attribute enables them although there is an invalid event name',function() {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
$scope.events = {
marker: {
enable: ['click', 'foo'],
logic: "emit"
}
};
expect(true).toBe(true);
});
//
// ***************************************************************************
//
it('should broadcast label events',function() {

@@ -508,0 +720,0 @@ spyOn($rootScope, '$broadcast');

@@ -8,3 +8,3 @@ 'use strict';

describe('Directive: leaflet', function() {
var $compile = null, $rootScope = null, leafletData = null;
var $compile, $rootScope, leafletData, scope;

@@ -16,2 +16,3 @@ beforeEach(module('leaflet-directive'));

leafletData = _leafletData_;
scope = $rootScope.$new();
}));

@@ -30,4 +31,4 @@

var element = angular.element('<leaflet></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getLayers().then(function() {

@@ -39,3 +40,3 @@ expect(layers).toBe(undefined);

it('should not create layers if they are miss-configured', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -49,4 +50,4 @@ baselayers: {},

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getLayers().then(function() {

@@ -58,3 +59,3 @@ expect(layers).toBe(undefined);

it('should create layers if baselayers is defined with data', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -68,4 +69,4 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getLayers().then(function(layers) {

@@ -78,3 +79,3 @@ expect(layers).not.toBe(undefined);

it('should create one layer if correctly configured', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -98,3 +99,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -104,3 +105,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();
leafletData.getLayers().then(function(layers) {

@@ -112,3 +113,3 @@ expect(map.hasLayer(layers.baselayers.osm)).toBe(true);

it('should create image overlay layer if correctly configured', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -128,3 +129,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -134,3 +135,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();
leafletData.getLayers().then(function(layers) {

@@ -142,3 +143,3 @@ expect(map.hasLayer(layers.baselayers.imageOverlay)).toBe(true);

it('should create two layers if correctly configured', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -172,3 +173,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -178,3 +179,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();
leafletData.getLayers().then(function(layers) {

@@ -188,3 +189,3 @@ expect(Object.keys(layers.baselayers).length).toEqual(2);

it('should create two different type layers if correctly configured', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -216,3 +217,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getLayers().then(function(layers) {

@@ -224,3 +225,3 @@ expect(Object.keys(layers.baselayers).length).toEqual(2);

it('should refuse to create malformed layers', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -315,3 +316,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getLayers().then(function(layers) {

@@ -324,3 +325,3 @@ expect(Object.keys(layers.baselayers).length).toEqual(0);

// If we not provide layers the system will use the default
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -353,3 +354,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var layers;

@@ -359,11 +360,11 @@ leafletData.getLayers().then(function(leafletLayers) {

});
$rootScope.$digest();
scope.$digest();
expect(Object.keys(layers.baselayers).length).toEqual(2);
delete $rootScope.layers.baselayers.cycle;
$rootScope.$digest();
delete scope.layers.baselayers.cycle;
scope.$digest();
expect(Object.keys(layers.baselayers).length).toEqual(1);
expect(typeof layers.baselayers.osm).toBe('object');
expect(layers.baselayers.cycle).toBe(undefined);
$rootScope.layers.baselayers.cloudmade1 = {
scope.layers.baselayers.cloudmade1 = {
name: 'Cloudmade Night Commander',

@@ -381,9 +382,9 @@ type: 'xyz',

};
$rootScope.$digest();
scope.$digest();
expect(Object.keys(layers.baselayers).length).toEqual(2);
expect(typeof layers.baselayers.osm).toBe('object');
expect(typeof layers.baselayers.cloudmade1).toBe('object');
delete $rootScope.layers.baselayers.osm;
delete $rootScope.layers.baselayers.cloudmade1;
$rootScope.$digest();
delete scope.layers.baselayers.osm;
delete scope.layers.baselayers.cloudmade1;
scope.$digest();
expect(Object.keys(layers.baselayers).length).toEqual(0);

@@ -395,3 +396,3 @@ });

// As overlays are optional, if we create a valid baselayer must create an empty overlay object
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -413,3 +414,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getLayers().then(function(layers) {

@@ -424,3 +425,3 @@ expect(layers.overlays).not.toBe(null);

it('should create and empty overlay', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -443,3 +444,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getLayers().then(function(layers) {

@@ -453,3 +454,3 @@ expect(layers.overlays).not.toBe(null);

it('should create one correct and one incorrect overlay', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -498,5 +499,5 @@ baselayers: {

});
$rootScope.$digest();
scope.$digest();
var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getLayers().then(function(layers ) {

@@ -512,3 +513,3 @@ expect(layers.overlays).not.toBe(null);

it('should create correct overlays', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -557,6 +558,6 @@ baselayers: {

});
$rootScope.$digest();
scope.$digest();
var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getLayers().then(function(layers) {

@@ -573,3 +574,3 @@ expect(layers.overlays).not.toBe(null);

// Check for layer group
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -598,3 +599,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -604,3 +605,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();

@@ -618,3 +619,3 @@ leafletData.getLayers().then(function(layers) {

it('should check for a marker in the layer group that is not visible', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -650,3 +651,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -661,3 +662,3 @@ leafletData.getMap().then(function(leafletMap) {

$rootScope.$digest();
scope.$digest();

@@ -673,3 +674,3 @@ leafletData.getLayers().then(function(layers) {

it('should check for a marker in the layer group that is visible', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -705,3 +706,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -715,3 +716,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();

@@ -727,3 +728,3 @@ leafletData.getLayers().then(function(layers) {

it('should check for a marker in a wrong layer group', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -759,3 +760,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getMarkers().then(function(markers) {

@@ -767,3 +768,3 @@ expect(Object.keys(markers).length).toEqual(0);

it('should check for a marker the old way', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -798,3 +799,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -804,3 +805,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();
leafletData.getMarkers().then(function(markers) {

@@ -814,3 +815,3 @@ expect(Object.keys(markers).length).toEqual(1);

// Create correct overlays
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -856,4 +857,4 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
var layers;

@@ -864,7 +865,7 @@ leafletData.getLayers().then(function(leafletLayers) {

$rootScope.$digest();
scope.$digest();
expect(Object.keys(layers.overlays).length).toEqual(2);
delete $rootScope.layers.overlays.fire;
delete scope.layers.overlays.fire;
$rootScope.$digest();
scope.$digest();
expect(Object.keys(layers.overlays).length).toEqual(1);

@@ -875,3 +876,3 @@ expect(typeof layers.overlays.hillshade).toBe('object');

// Added a bad layer
$rootScope.layers.overlays.fire = {
scope.layers.overlays.fire = {
name: 'OpenFireMap',

@@ -885,3 +886,3 @@ badtype: 'xyz',

};
$rootScope.$digest();
scope.$digest();
expect(Object.keys(layers.overlays).length).toEqual(1);

@@ -892,3 +893,3 @@ expect(typeof layers.overlays.hillshade).toBe('object');

// Added a good layer
$rootScope.layers.overlays.fire = {
scope.layers.overlays.fire = {
name: 'OpenFireMap',

@@ -902,3 +903,3 @@ type: 'xyz',

};
$rootScope.$digest();
scope.$digest();
expect(Object.keys(layers.overlays).length).toEqual(2);

@@ -911,3 +912,3 @@ expect(typeof layers.overlays.hillshade).toBe('object');

// Check for a marker remove in a layer group
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -948,3 +949,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -962,3 +963,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(true);

@@ -968,9 +969,8 @@ expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(true);

// remove marker information
$rootScope.markers.m1 = {};
$rootScope.$digest();
scope.markers.m1 = {};
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(false);
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(false);
// null the marker information
$rootScope.markers.m1 = {
scope.markers.m1 = {
lat: 1.2,

@@ -980,16 +980,18 @@ lng: 0.3,

};
$rootScope.$digest();
expect(map.hasLayer(markers.m1)).toBe(true);
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(true); //Fail
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(true);
$rootScope.markers.m1 = null;
$rootScope.$digest();
// null the marker information
scope.markers.m1 = null;
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(false);
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(false);
// delete the marker
delete $rootScope.markers.m1;
$rootScope.$digest();
delete scope.markers.m1;
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(false);
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(false);
// delete the marker layer
$rootScope.markers.m1 = {
scope.markers.m1 = {
lat: 1.2,

@@ -999,13 +1001,13 @@ lng: 0.3,

};
$rootScope.$digest();
$rootScope.markers.m1 = {
scope.$digest();
scope.markers.m1 = {
lat: 1.2,
lng: 0.3
};
$rootScope.$digest();
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(true);
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(false);
expect(layers.overlays.trucks.hasLayer(markers.m1)).toBe(false);
// Then add to a not visivle layer
$rootScope.markers.m1 = {
// Then add to a not visible layer
scope.markers.m1 = {
lat: 1.2,

@@ -1015,8 +1017,11 @@ lng: 0.3,

};
$rootScope.$digest();
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(false);
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(false);
expect(layers.overlays.trucks.hasLayer(markers.m1)).toBe(true);
});
it('should add and remove markers in overlays in watch', function() {
// Check for a marker remove in a layer group
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -1056,5 +1061,17 @@ baselayers: {

});
element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
var element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)(scope);
var map;
leafletData.getMap().then(function(leafletMap) {
map = leafletMap;
});
var markers;
leafletData.getMarkers().then(function(leafletMarkers) {
markers = leafletMarkers;
});
var layers;
leafletData.getLayers().then(function(leafletLayers) {
layers = leafletLayers;
});
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(true);

@@ -1064,3 +1081,3 @@ expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(true);

// Change layer
$rootScope.markers.m1 = {
scope.markers.m1 = {
lat: 3.2,

@@ -1070,3 +1087,3 @@ lng: 0.3,

};
$rootScope.$digest();
scope.$digest();
expect(map.hasLayer(markers.m1)).toBe(false);

@@ -1080,3 +1097,3 @@ expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(false);

// Provide a markercluster layer
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -1103,3 +1120,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -1117,3 +1134,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();

@@ -1129,3 +1146,3 @@ // The layer is correctly created

// Provide a visible markercluster layer
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -1153,3 +1170,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -1167,3 +1184,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();

@@ -1177,3 +1194,3 @@ // The layer is correctly created

it('should create a visible markercluster layer with options empty', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -1202,3 +1219,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -1216,3 +1233,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();
// The layer is correctly created

@@ -1230,3 +1247,3 @@ expect(layers.overlays.cars instanceof L.MarkerClusterGroup).toBe(true);

it('should create a visible markercluster layer with options', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -1258,3 +1275,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -1272,4 +1289,4 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
$rootScope.$digest();
scope.$digest();
scope.$digest();
// The layer is correctly created

@@ -1288,3 +1305,3 @@ expect(layers.overlays.cars instanceof L.MarkerClusterGroup).toBe(true);

it('should create a visible markercluster layer with options and layers', function() {
angular.extend($rootScope, {
angular.extend(scope, {
layers: {

@@ -1328,3 +1345,3 @@ baselayers: {

var element = angular.element('<leaflet layers="layers" markers="markers"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var map;

@@ -1342,3 +1359,3 @@ leafletData.getMap().then(function(leafletMap) {

});
$rootScope.$digest();
scope.$digest();
// The layer is correctly created

@@ -1345,0 +1362,0 @@ expect(layers.overlays.cars instanceof L.MarkerClusterGroup).toBe(true);

@@ -8,3 +8,3 @@ 'use strict';

describe('Directive: leaflet', function() {
var $compile = null, $rootScope = null, $timeout, leafletData = null, leafletMapDefaults = null;
var $compile, $rootScope, $timeout, leafletData, leafletMapDefaults, scope;

@@ -18,2 +18,3 @@ beforeEach(module('leaflet-directive'));

leafletMapDefaults = _leafletMapDefaults_;
scope = $rootScope.$new();
}));

@@ -27,4 +28,4 @@

var element = angular.element('<leaflet></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
expect(element.text()).toEqual('+-Leaflet | © OpenStreetMap contributors');

@@ -35,3 +36,3 @@ });

var element = angular.element('<leaflet></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletMap;

@@ -41,3 +42,3 @@ leafletData.getMap().then(function(map) {

});
$rootScope.$digest();
scope.$digest();
expect(leafletMap.getZoom()).toEqual(1);

@@ -50,3 +51,3 @@ expect(leafletMap.getCenter().lat).toEqual(0);

var element = angular.element('<leaflet></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletTiles;

@@ -56,3 +57,3 @@ leafletData.getTiles().then(function(tiles) {

});
$rootScope.$digest();
scope.$digest();
var defaults = leafletMapDefaults.getDefaults();

@@ -63,5 +64,5 @@ expect(leafletTiles._url).toEqual(defaults.tileLayer);

it('should set the max zoom if specified', function() {
angular.extend($rootScope, { defaults: { maxZoom: 15 } });
angular.extend(scope, { defaults: { maxZoom: 15 } });
var element = angular.element('<leaflet defaults="defaults"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletMap;

@@ -71,3 +72,3 @@ leafletData.getMap().then(function(map) {

});
$rootScope.$digest();
scope.$digest();
expect(leafletMap.getMaxZoom()).toEqual(15);

@@ -77,5 +78,5 @@ });

it('should set the min zoom if specified', function() {
angular.extend($rootScope, { defaults: { minZoom: 4 } });
angular.extend(scope, { defaults: { minZoom: 4 } });
var element = angular.element('<leaflet defaults="defaults"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletMap;

@@ -85,3 +86,3 @@ leafletData.getMap().then(function(map) {

});
$rootScope.$digest();
scope.$digest();
expect(leafletMap.getMinZoom()).toEqual(4);

@@ -92,3 +93,3 @@ });

var element = angular.element('<leaflet defaults="defaults" width="640px" height="480px"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);

@@ -101,3 +102,3 @@ expect(element.css("width")).toBe("640px");

var element = angular.element('<leaflet defaults="defaults" width=640 height=480></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);

@@ -109,3 +110,3 @@ expect(element.css("width")).toBe("640px");

it('should set tileLayer and tileLayer options if specified', function() {
angular.extend($rootScope, {
angular.extend(scope, {
defaults: {

@@ -120,3 +121,3 @@ tileLayer: "http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png",

var element = angular.element('<leaflet defaults="defaults"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletTiles;

@@ -126,3 +127,3 @@ leafletData.getTiles().then(function(tiles) {

});
$rootScope.$digest();
scope.$digest();
var defaults = leafletMapDefaults.getDefaults();

@@ -136,3 +137,3 @@ expect(leafletTiles.options.detectRetina).toEqual(true);

it('should set zoom control button properly if zoomControlPosition option is set', function() {
angular.extend($rootScope, {
angular.extend(scope, {
defaults: {

@@ -143,3 +144,3 @@ zoomControlPosition: 'topright'

var element = angular.element('<leaflet defaults="defaults"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletMap;

@@ -149,3 +150,3 @@ leafletData.getMap().then(function(map) {

});
$rootScope.$digest();
scope.$digest();
expect(leafletMap.zoomControl.getPosition()).toEqual('topright');

@@ -155,3 +156,3 @@ });

it('should remove zoom control button if unset on defaults', function() {
angular.extend($rootScope, {
angular.extend(scope, {
defaults: {

@@ -162,3 +163,3 @@ zoomControl: false

var element = angular.element('<leaflet defaults="defaults"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletMap;

@@ -168,5 +169,22 @@ leafletData.getMap().then(function(map) {

});
$rootScope.$digest();
scope.$digest();
expect(leafletMap.zoomControl).toBe(undefined);
});
it('should unset from leafletData after scope destroy', function () {
var element = angular.element('<leaflet></leaflet>');
var $scope = scope.$new();
element = $compile(element)($scope);
$scope.$destroy();
scope.$digest();
var shouldNotBeMap;
leafletData.getMap().then(function (map) {
shouldNotBeMap = map;
});
scope.$digest();
expect(shouldNotBeMap).toBe(undefined);
});
});

@@ -103,2 +103,56 @@ 'use strict';

it('should bind label to main marker if message is given', function() {
spyOn(leafletHelpers.LabelPlugin, 'isLoaded').andReturn(true);
L.Label = L.Class.extend({
includes: L.Mixin.Events,
});
L.BaseMarkerMethods = {
bindLabel: function(content, options) {
this.label = new L.Label(options, this);
this.label._content = content;
return this;
},
updateLabelContent: function(content) {
this.label._content = content;
}
};
L.Marker.include(L.BaseMarkerMethods);
var marker = {
lat: 0.966,
lng: 2.02,
message: 'this is paris',
label: {
message: 'original',
options: {
clickable: true
}
}
};
angular.extend($rootScope, {
markers: {
marker: marker
}
});
var element = angular.element('<leaflet markers="markers"></leaflet>');
$compile(element)($rootScope);
$rootScope.$digest();
leafletData.getMarkers().then(function(leafletMarkers){
var leafletMainMarker = leafletMarkers.marker;
expect(leafletMainMarker.label._content).toEqual('original');
});
marker.label.message = 'new';
$rootScope.$digest();
leafletData.getMarkers().then(function(leafletMarkers){
var leafletMainMarker = leafletMarkers.marker;
expect(leafletMainMarker.label._content).toEqual('new');
});
});
// Markers

@@ -105,0 +159,0 @@ it('should create markers on the map', function() {

@@ -8,3 +8,3 @@ 'use strict';

describe('Directive: leaflet', function() {
var $compile = null, $rootScope = null, leafletData = null;
var $compile, $rootScope, leafletData, scope;

@@ -16,2 +16,3 @@ beforeEach(module('leaflet-directive'));

leafletData = _leafletData_;
scope = $rootScope.$new();
}));

@@ -23,2 +24,26 @@

// Error management
it('should not allow a bad name object', function() {
var latlngs1 = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 }
];
angular.extend(scope, {
paths : {
"p1-p2": {
latlngs : latlngs1
}
}
});
var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)(scope);
scope.$digest();
leafletData.getPaths().then(function(paths) {
expect(paths).toEqual({});
});
});
// Polyline

@@ -34,6 +59,11 @@ it('should create polyline on the map', function() {

];
angular.extend($rootScope, { paths : { p1: { latlngs : latlngs1 }, p2: { latlngs : latlngs2 }}});
angular.extend(scope, {
paths : {
p1: { latlngs : latlngs1 },
p2: { latlngs : latlngs2 }
}
});
var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getPaths().then(function(paths) {

@@ -58,3 +88,3 @@ var polyline1 = paths.p1;

it('should create multiPolyline on the map', function() {
angular.extend($rootScope, {
angular.extend(scope, {
paths : {

@@ -77,4 +107,4 @@ p1: {

var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getPaths().then(function(paths) {

@@ -102,7 +132,7 @@ var polylines = paths.p1;

];
angular.extend($rootScope, { paths : { p1: { latlngs : latlngs, type: 'polygon' }}});
angular.extend(scope, { paths : { p1: { latlngs : latlngs, type: 'polygon' }}});
var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
$rootScope.$digest();
scope.$digest();
leafletData.getPaths().then(function(paths) {

@@ -136,6 +166,6 @@ var polygon = paths.p1;

];
angular.extend($rootScope, { paths : { p1: { latlngs : [ latlngs1, latlngs2 ], type: 'multiPolygon' }}});
angular.extend(scope, { paths : { p1: { latlngs : [ latlngs1, latlngs2 ], type: 'multiPolygon' }}});
var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getPaths().then(function(paths) {

@@ -174,6 +204,6 @@ var multiPolygon = paths.p1;

];
angular.extend($rootScope, { paths : { p1: { latlngs : latlngs1, type: 'rectangle' }, p2: { latlngs : latlngs2, type: 'rectangle' }}});
angular.extend(scope, { paths : { p1: { latlngs : latlngs1, type: 'rectangle' }, p2: { latlngs : latlngs2, type: 'rectangle' }}});
var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getPaths().then(function(paths) {

@@ -212,6 +242,6 @@ var rectangle1 = paths.p1;

};
angular.extend($rootScope, { paths : { p1: c1, p2: c2 }});
angular.extend(scope, { paths : { p1: c1, p2: c2 }});
var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();

@@ -247,6 +277,6 @@ leafletData.getPaths().then(function(paths) {

};
angular.extend($rootScope, { paths : { p1: c1, p2: c2 }});
angular.extend(scope, { paths : { p1: c1, p2: c2 }});
var element = angular.element('<leaflet paths="paths"></leaflet>');
element = $compile(element)($rootScope);
$rootScope.$digest();
element = $compile(element)(scope);
scope.$digest();
leafletData.getPaths().then(function(paths) {

@@ -253,0 +283,0 @@ var circle1 = paths.p1;

@@ -8,3 +8,3 @@ 'use strict';

describe('Directive: leaflet', function() {
var $compile = null, $rootScope = null, leafletData = null, leafletMapDefaults = null;
var $compile, $rootScope, leafletData, leafletMapDefaults, scope;

@@ -17,2 +17,3 @@ beforeEach(module('leaflet-directive'));

leafletMapDefaults = _leafletMapDefaults_;
scope = $rootScope.$new();
}));

@@ -25,5 +26,5 @@

it('should set default tiles if bad tiles structure is provided', function() {
angular.extend($rootScope, { tiles: {} });
angular.extend(scope, { tiles: {} });
var element = angular.element('<leaflet tiles="tiles"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
leafletData.getTiles().then(function(leafletTiles) {

@@ -39,5 +40,5 @@ var defaults = leafletMapDefaults.getDefaults();

};
angular.extend($rootScope, { tiles: tiles });
angular.extend(scope, { tiles: tiles });
var element = angular.element('<leaflet tiles="tiles"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);
var leafletTiles;

@@ -47,6 +48,6 @@ leafletData.getTiles().then(function(tiles) {

});
$rootScope.$digest();
scope.$digest();
expect(leafletTiles._url).toEqual("http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png");
$rootScope.tiles.url = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
$rootScope.$digest();
scope.tiles.url = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
scope.$digest();
expect(leafletTiles._url).toEqual("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png");

@@ -59,5 +60,5 @@ });

};
angular.extend($rootScope, { tiles: tiles });
angular.extend(scope, { tiles: tiles });
var element = angular.element('<leaflet tiles="tiles"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);

@@ -73,12 +74,12 @@ var leafletMap;

});
$rootScope.$digest();
scope.$digest();
expect(leafletTiles._url).toEqual("http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png");
expect(leafletMap.hasLayer(leafletTiles)).toBe(true);
$rootScope.tiles = {};
$rootScope.$digest();
scope.tiles = {};
scope.$digest();
leafletData.getTiles().then(function(tiles) {
leafletTiles = tiles;
});
$rootScope.$digest();
scope.$digest();
expect(leafletMap.hasLayer(leafletTiles)).toBe(false);

@@ -91,5 +92,5 @@ });

};
angular.extend($rootScope, { tiles: tiles });
angular.extend(scope, { tiles: tiles });
var element = angular.element('<leaflet tiles="tiles"></leaflet>');
element = $compile(element)($rootScope);
element = $compile(element)(scope);

@@ -105,8 +106,8 @@ var leafletMap;

});
$rootScope.$digest();
scope.$digest();
expect(leafletTiles._url).toEqual("http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png");
expect(leafletMap.hasLayer(leafletTiles)).toBe(true);
$rootScope.tiles.options = { maxZoom: 19 };
$rootScope.$digest();
scope.tiles.options = { maxZoom: 19 };
scope.$digest();
expect(leafletMap.hasLayer(leafletTiles)).toBe(false);

@@ -116,5 +117,5 @@ leafletData.getTiles().then(function(tiles) {

});
$rootScope.$digest();
scope.$digest();
expect(leafletTiles.options.maxZoom).toEqual(19);
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc