diff --git a/.gitignore b/.gitignore
index 4e5cc436..46b2c0bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,19 +1,32 @@
-temp
+# OS
+# ===========
+.DS_Store
+Thumbs.db
+
+# Project
+# ===========
+dist/angular-leaflet-directive.pre.js
+dist/angular-leaflet-directive.min.no-header.js
+js/angular-leaflet-directive-webpage.ngmin.js
+
+# Related ecosystem
+# ===========
node_modules
-libpeerconnection.log
+bower_components
+coverage
+saucelabs.json
+
+# General
+# ===========
+temp
+*.log
*.swp
.*.swp
*~
*.iml
.idea
.project
-node_modules
-dist/angular-leaflet-directive.pre.js
-dist/angular-leaflet-directive.min.no-header.js
-js/angular-leaflet-directive-webpage.ngmin.js
-coverage
-bower_components
-saucelabs.json
+core
lib
tags
.tags
diff --git a/.jscsrc b/.jscsrc
new file mode 100644
index 00000000..2f4841ec
--- /dev/null
+++ b/.jscsrc
@@ -0,0 +1,3 @@
+{
+ "preset": "airbnb"
+}
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 00000000..054b6ae3
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,42 @@
+{
+ "node": true,
+ "browser": true,
+ "esnext": true,
+ "bitwise": true,
+ "curly": false,
+ "eqeqeq": true,
+ "immed": true,
+ "indent": 4,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "regexp": true,
+ "undef": true,
+ "unused": true,
+ "trailing": true,
+ "smarttabs": true,
+ "globals": {
+ "angular": false,
+ "L": false,
+ "lvector": false,
+ "cartodb": false,
+ "jasmine": false,
+ "isCommonJS": false,
+ "exports": false,
+ "spyOn": false,
+ "it": false,
+ "xit": false,
+ "expect": false,
+ "runs": false,
+ "waits": false,
+ "waitsFor": false,
+ "beforeEach": false,
+ "afterEach": false,
+ "describe": false,
+ "xdescribe": false,
+ "protractor": false,
+ "browser": false,
+ "by": false,
+ "element": false
+ }
+}
diff --git a/.travis.yml b/.travis.yml
index 693eaa37..21389c23 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,15 +1,27 @@
+sudo: false
language: node_js
-
+cache:
+ directories:
+ - node_modules
+notifications:
+ email: false
node_js:
- - "0.10"
+ - '4'
+before_install:
+ - npm i -g npm@^2.0.0
+before_script:
+ - npm prune
+ - npm install -g grunt-cli
+ - npm install -g bower
+ - bower install --config.interactive=false
+after_success:
+ - npm run semantic-release
+branches:
+ except:
+ - "/^v\\d+\\.\\d+\\.\\d+$/"
env:
global:
- secure: "Ugov4QqHxEN4976jaQvtQigwwB7wiG0vxiE4pIDiZKJ67py0d0kLZXI4CzNs8zV5EOrkR+ug2cs9vTmA8CdSmhQcx4SVwFoim/ReoQb9AK76+tgEso+F3nZpE1jeIorKN2/LAXtwkHOZa9WaDwhMlCULJxJ8DZoMsXkc5Xq3c6A="
- secure: "QW7a9wCfc4u+MGnPyLzE+HHRhAhTf0a1mqixoUB2MVNL/hZ7+nXAOL/oz3LxodPpwH3NEl4RyqteGS15XpJvZKuKXiyHWbrfSLHz7DD1LYuIzc7UOgyBTXF0C97DP5ae7zui+qvDOe67ud+qBerroP9jdcx+mSVQgMIAfF1uWY4="
- secure: "gflE27IYzgjICndyY7800KdoNKem0oMWKtIjXQuSTJFuWJvBVWkUajT8maNbv1+c46r6iFptd27m5Arzl9hqAh2deHqLxwRGqietcY737q7oRJzKRfA4MGycF8fKHEh8U5KupXTC7UXuESLWGA+bpWA6KNJ5CImAw2MWJXmsX9c="
-
-before_script:
- - npm install -g grunt-cli
- - npm install -g bower
- - bower install --config.interactive=false
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 713641bf..6f3f1de8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,62 @@
+
+### 0.9.0 (2015-10-12)
+
+#### Breaking changes
+
+* **events:** refactor(rootScope map events): If the id attribute is set for the leaflet directive then the id will be used in the rootScope leaflet events. Example: ``, Will fire `leafletDirectiveMap.firstMap.click` ([d22b3f0](https://github.com/tombatossals/angular-leaflet-directive/commit/d22b3f0))
+
+#### Bug Fixes
+
+* **build:** Added "core" to .gitignore to avoid more "core" files inside distributed version ([2ff48c3e](https://github.com/tombatossals/angular-leaflet-directive/commit/2ff48c3e))
+
+#### Features
+
+* **Leaflet.vector-markers:** Add support for Leaflet plugin 'Leaflet.vector-markers' ([eb386a1](https://github.com/tombatossals/angular-leaflet-directive/commit/eb386a1))
+* **Nokia Maps:** Added Nokia here maps. ([83b71ef](https://github.com/tombatossals/angular-leaflet-directive/commit/83b71ef))
+
+
+### 0.8.8 (2015-09-04)
+
+
+#### Bug Fixes
+
+* **center:**
+ * Fix bug with scope.center via @ageblade ([7e718c5f](https://github.com/tombatossals/angular-leaflet-directive/commit/7e718c5f))
+ * Fix bug with scope.center ([277ebc58](https://github.com/tombatossals/angular-leaflet-directive/commit/277ebc58))
+
+
+#### Features
+
+* **layers:** Add support for Leaflet.TileLayer.IIP ([ec0fe740](https://github.com/tombatossals/angular-leaflet-directive/commit/ec0fe740))
+* **lf-center:** lfCenter or 'lf-center' added which is a dupe of center. center to be deprecated ([06b5a3fa](https://github.com/tombatossals/angular-leaflet-directive/commit/06b5a3fa))
+
+
+#### Breaking changes
+
+* **logger:** Add new independent logger requirement to replace Angular $log. Remember to include angular-simple-logger before Angular-Leaflet from your bower assets. ([4f35bf6](https://github.com/tombatossals/angular-leaflet-directive/commit/4f35bf6))
+
+
+
+### 0.8.7 (2015-08-26)
+
+
+#### Bug Fixes
+
+* **code:** Deleted uneeded file ([5be6c453](https://github.com/tombatossals/angular-leaflet-directive/commit/5be6c453))
+* **controls:** Solved a problem with loading custom controls, as reported by @adgoncal here: ([a1843f20](https://github.com/tombatossals/angular-leaflet-directive/commit/a1843f20))
+* **dependencies:**
+ * remove dependency font-awesome ([f735e856](https://github.com/tombatossals/angular-leaflet-directive/commit/f735e856))
+ * utfgrid now specifies main file ([79c6a252](https://github.com/tombatossals/angular-leaflet-directive/commit/79c6a252))
+* **paths:** Better log description with a path inside overlay error ([a02c3046](https://github.com/tombatossals/angular-leaflet-directive/commit/a02c3046))
+
+
+#### Features
+
+* **examples:**
+ * Added new example of loading custom controls ([979a7333](https://github.com/tombatossals/angular-leaflet-directive/commit/979a7333))
+ * Compiled the examples with the new GeoGJSON Shape Layer added by @stev-0 here: h ([1f5e86a2](https://github.com/tombatossals/angular-leaflet-directive/commit/1f5e86a2))
+
+
### 0.8.6 (2015-07-28)
diff --git a/Gruntfile.js b/Gruntfile.js
index 3bf01262..4fe611df 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,5 +1,6 @@
-global._ = require('lodash');
-
module.exports = function (grunt) {
+
require('load-grunt-config')(grunt);
+ grunt.config('pkg', grunt.file.readJSON('package.json'));
+
};
diff --git a/LICENSE b/LICENSE
index b8e9e728..d295fad2 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License
-Copyright (c) 2012-2013 https://github.com/tombatossals/angular-leaflet-directive
+Copyright (c) https://github.com/tombatossals/angular-leaflet-directive
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index 834bf04d..cd81f16a 100644
--- a/README.md
+++ b/README.md
@@ -1,114 +1,47 @@
-# angular-leaflet-directive
-## [tombatossals](http://github.com/tombatossals/angular-leaflet-directive) - main upstream
-[](https://gitter.im/tombatossals/angular-leaflet-directive?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+# Angular Leaflet Directive
-[](https://travis-ci.org/tombatossals/angular-leaflet-directive)
+[AngularJS](http://angularjs.org/) directive for the [Leaflet](http://www.leafletjs.com/) Javascript
+Library. This software aims to easily embed maps managed by Leaflet on your project.
-[](https://david-dm.org/tombatossals/angular-leaflet-directive)
-[](https://david-dm.org/tombatossals/angular-leaflet-directive)
+### [tombatossals/angular-leaflet-directive](http://github.com/tombatossals/angular-leaflet-directive)
+This is a personal project, which has been coded by me helped by many people for some years. I'm evolving it frequently, actually I'm making the code transition to Leaflet 1.0 and Angular 2. If you need enterprise for older versions, sorry, I can't give you more support that my spare time allows me. If you want to help with the actual code it would be really appreciated, but first of all, please, read the * [CONTRIBUTING documentation](https://github.com/tombatossals/angular-leaflet-directive/blob/master/CONTRIBUTING.md)
-[](https://travis-ci.org/tombatossals/angular-leaflet-directive) [](https://david-dm.org/tombatossals/angular-leaflet-directive)
+[](https://david-dm.org/tombatossals/angular-leaflet-directive) [](http://tombatossals.github.io/angular-leaflet-directive/coverage/PhantomJS%201.9.7%20%28Linux%29/lcov-report/dist/angular-leaflet-directive.js.html)
+[](https://github.com/semantic-release/semantic-release)
+
+### [angular-ui](http://github.com/angular-ui/ui-leaflet)
+If you need better response time with your doubts and needs with the code of version 0.9.0, take a look at the [angular-ui](http://github.com/angular-ui/ui-leaflet) fork of this project, it's lead by really awesome developers which have helped me evolving the project for some time.
+
+[](https://travis-ci.org/angular-ui/ui-leaflet) [](https://david-dm.org/angular-ui/ui-leaflet)
+[](https://david-dm.org/angular-ui/ui-leaflet) [](http://realtymaps.github.io/ui-leaflet/coverage/PhantomJS%201.9.7%20%28Linux%29/lcov-report/dist/ui-leaflet.js.html)
+
+## Examples
+
+[Browse all the examples](http://tombatossals.github.io/angular-leaflet-directive/examples/0000-viewer.html) added by the community to learn about the directive and its possibilities.
+
+## Documentation
-## [realtymaps](http://github.com/realtymaps/angular-leaflet-directive)
-[](https://travis-ci.org/realtymaps/angular-leaflet-directive)
-
-[](https://david-dm.org/realtymaps/angular-leaflet-directive)
-[](https://david-dm.org/realtymaps/angular-leaflet-directive)
-
-[](http://realtymaps.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
-Library. This software aims to easily embed maps managed by leaflet on your
-[Leaflet](http://leaflet.cloudmade.com) project.
-
-You can browse all the examples added by the community to learn about the directive and its possibilities here:
-
-http://tombatossals.github.io/angular-leaflet-directive/examples/0000-viewer.html
-
-Or you can see some examples directly:
-
-* [Basic example](http://tombatossals.github.io/angular-leaflet-directive/examples/0100-basic-first-example.html)
-* [Center example](http://tombatossals.github.io/angular-leaflet-directive/examples/0101-basic-center-example.html)
-* [Center autodiscover example](http://tombatossals.github.io/angular-leaflet-directive/examples/0102-basic-center-autodiscover-example.html )
-* [Center with url hash example](http://tombatossals.github.io/angular-leaflet-directive/examples/0103-basic-center-url-hash-example.html)
-* [Custom parameters example](http://tombatossals.github.io/angular-leaflet-directive/examples/0104-basic-custom-parameters-example.html)
-* [Draw controls example](http://tombatossals.github.io/angular-leaflet-directive/examples/0401-controls-draw-example.html)
-* [Bounds example](http://tombatossals.github.io/angular-leaflet-directive/examples/0105-basic-bounds-example.html)
-* [MaxBounds example](http://tombatossals.github.io/angular-leaflet-directive/examples/0106-basic-maxbounds-example.html)
-* [Tiles example](http://tombatossals.github.io/angular-leaflet-directive/examples/0107-basic-tiles-example.html)
-* [Tile zoom changer example](http://tombatossals.github.io/angular-leaflet-directive/examples/0108-basic-tiles-zoom-changer-example.html)
-* [Layers simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/0201-layers-simple-example.html)
-* [Overlays simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/0202-layers-overlays-simple-example.html)
-* [ImageOverlay simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/0202-layers-overlays-simple-example.html)
-* [Dynamic add/remove layers/overlays example](http://tombatossals.github.io/angular-leaflet-directive/examples/0204-layers-dynamic-addition-example.html)
-* [Google Maps example](http://tombatossals.github.io/angular-leaflet-directive/examples/0205-layers-googlemaps-example.html)
-* [Hide a layer in the layer selector example](http://tombatossals.github.io/angular-leaflet-directive/examples/0207-layers-hide-baselayer-on-selector-example.html)
-* [ESRI Dynamic Layer example](http://tombatossals.github.io/angular-leaflet-directive/examples/0208-layers-esri-dynamic-layer-example.html)
-* [ESRI Legend example](http://tombatossals.github.io/angular-leaflet-directive/examples/0209-layers-esri-legend-service-example.html)
-* [Paths Simple example](http://tombatossals.github.io/angular-leaflet-directive/examples/0300-paths-simple-example.html)
-* [Paths Types example](http://tombatossals.github.io/angular-leaflet-directive/examples/0301-paths-types-example.html)
-* [Paths example](http://tombatossals.github.io/angular-leaflet-directive/examples/0304-paths-advanced-example.html)
-* [Single marker example](http://tombatossals.github.io/angular-leaflet-directive/examples/0500-markers-simple-example.html)
-* [Marker with label example](http://tombatossals.github.io/angular-leaflet-directive/examples/0505-markers-label-example.html)
-* [Marker change opacity example](http://tombatossals.github.io/angular-leaflet-directive/examples/0507-markers-change-opacity-example.html)
-* [Marker with Angular templates example](http://tombatossals.github.io/angular-leaflet-directive/examples/0514-markers-angular-template-example.html)
-* [Marker with group clustering example](http://tombatossals.github.io/angular-leaflet-directive/examples/0508-markers-clustering-example.html)
-* [Marker with group clustering example (10000 markers)](http://tombatossals.github.io/angular-leaflet-directive/examples/0511-markers-clustering-10000-markers-example.html)
-* [Marker with group clustering example without overlays](http://tombatossals.github.io/angular-leaflet-directive/examples/0509-markers-clustering-without-overlays-example.html)
-* [Marker groups example](http://tombatossals.github.io/angular-leaflet-directive/examples/0506-markers-groups-example.html)
-* [Marker icons properties example](http://tombatossals.github.io/angular-leaflet-directive/examples/0503-markers-icons-example.html)
-* [Markers dynamic add/remove example](http://tombatossals.github.io/angular-leaflet-directive/examples/0502-markers-add-remove-example.html)
-* [Marker addition example](http://tombatossals.github.io/angular-leaflet-directive/examples/0501-markers-events-add-example.html)
-* [Legend example](http://tombatossals.github.io/angular-leaflet-directive/examples/0600-mixed-image-legend-example.html)
-* [GeoJson example](http://tombatossals.github.io/angular-leaflet-directive/examples/0113-basic-geojson-simple-example.html)
-* [HeatMap example](http://tombatossals.github.io/angular-leaflet-directive/examples/0221-layers-heatmap-example.html)
-* [Decoration example](http://tombatossals.github.io/angular-leaflet-directive/examples/0306-paths-decorations-simple-example.html)
-* [UTFGrid example](http://tombatossals.github.io/angular-leaflet-directive/examples/0214-layers-utfgrid-example.html)
-* [Events example](http://tombatossals.github.io/angular-leaflet-directive/examples/0115-basic-events-example.html)
-* [Accessing the leaflet map object](http://tombatossals.github.io/angular-leaflet-directive/examples/0116-basic-access-leaflet-object-example.html)
-* [Accessing the leaflet map object of two maps](http://tombatossals.github.io/angular-leaflet-directive/examples/0119-basic-double-map-access-map-object-example.html)
-* [Two maps events](http://tombatossals.github.io/angular-leaflet-directive/examples/0118-basic-double-map-events-example.html)
-* [Two maps with markers and events](http://tombatossals.github.io/angular-leaflet-directive/examples/0515-markers-two-maps-events-example.html)
-* [Two maps sharing attributes](http://tombatossals.github.io/angular-leaflet-directive/examples/0120-basic-double-map-sharing-attributes-example.html)
-* [Center map with GeoIP](http://tombatossals.github.io/angular-leaflet-directive/examples/0109-basic-center-geoip-example.html)
-
-To see it in action, go to the main page where you can find more examples and
-some documentation:
-
- * http://tombatossals.github.com/angular-leaflet-directive
-
-
-## How to use it
-
-You must include the leaflet-directive dependency on your angular module:
+Still working on it. In the meantime, take a look at this URL for some minimal descriptions: https://tombatossals.github.com/angular-leaflet-directive
+
+## Getting started/How to use it
+
+Include the `leaflet-directive` dependency on your Angular module:
```
-var app = angular.module("demoapp", ["leaflet-directive"]);
+var app = angular.module('demoapp', ['leaflet-directive']);
```
-After that, you can change the default values of the directive (if you want) on
-your angular controller. For example, you can change the tiles source, the
-maxzoom on the leaflet map or the polyline path properties.
+After that, you are ready to rock. Just define some objects with the basic configuration you want reflected in your map and the rendered map will obey you. Also, you can modify that configuration dinamically if you need to. Let's see an example.
-```javascript
-angular.extend($scope, {
- defaults: {
- tileLayer: "http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png",
- maxZoom: 14,
- path: {
- weight: 10,
- color: '#800000',
- opacity: 1
- }
- }
-});
-```
+### center
-If you want to set the start of the map to a precise position, you can define
-the "center" property of the scope (lat, lng, zoom). It will be updated
+If you want to set the map view to a precise position, you can define
+the "center" property of the scope (lat, lng, zoom). It will also be updated
interacting on the scope and on the leaflet map in two-way binding. Example:
+
```javascript
angular.extend($scope, {
center: {
@@ -119,37 +52,13 @@ angular.extend($scope, {
});
```
-If you need to run any method on the map object, use ```leafletData``` as following (notice the map object is returned in a form of a promise):
-
-```javascript
-angular.module('myModule').controller('MapController', ['$scope', 'leafletData',
- function($scope, leafletData) {
- leafletData.getMap().then(function(map) {
- L.GeoIP.centerMapOnPosition(map, 15);
- });
- }
-]);
-```
-
-Finally, you must include the markup directive on your HTML page, like this:
+Finally, you must include the markup directive on your HTML page. One important thing is that you must define the map width&height, as attributes of the directive or with CSS code, as you wish.
```html
-
+
```
-If you want to have more than one map on the page and access their respective map objects, add an *id* attribute to your leaflet directive in HTML, like this:
+If you want to have more than one map on the page and access their respective map objects, add an *id* attribute to your leaflet directive in HTML:
```html
-
-```
-
-And then you can use this id in ```getMap()``` like this:
-
-```javascript
-angular.module('myModule').controller('MapController', ['$scope', 'leafletData',
- function($scope, leafletData) {
- leafletData.getMap('mymap').then(function(map) {
- L.GeoIP.centerMapOnPosition(map, 15);
- });
- }
-]);
+
```
diff --git a/bower.json b/bower.json
index d97732cd..b4f65832 100644
--- a/bower.json
+++ b/bower.json
@@ -2,7 +2,7 @@
"name": "angular-leaflet-directive",
"author": "https://github.com/tombatossals/angular-leaflet-directive/graphs/contributors",
"description": "angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps",
- "version": "0.8.6",
+ "version": "0.10.0",
"homepage": "http://tombatossals.github.io/angular-leaflet-directive/",
"keywords": [
"angularjs",
@@ -31,27 +31,24 @@
"leaflet-tilelayer-geojson": "*",
"Leaflet.utfgrid": "danzel/Leaflet.utfgrid",
"Leaflet.awesome-markers": "*",
+ "leaflet-providers": "*",
+ "leaflet.vector-markers": "*",
"webgl-heatmap-leaflet": "*",
"leaflet-plugins": "*",
"esri-leaflet": "*",
"proj4": "*",
- "font-awesome": "~4.3.x",
+ "font-awesome": "*",
"proj4leaflet": "*",
"Leaflet.MakiMarkers": "*",
"Leaflet.heat": "https://github.com/Leaflet/Leaflet.heat/archive/gh-pages.tar.gz",
"Leaflet.ExtraMarkers": "https://github.com/coryasilva/Leaflet.ExtraMarkers/archive/v1.0.1.tar.gz",
"Leaflet.fullscreen": "http://github.com/Leaflet/Leaflet.fullscreen/archive/v0.0.4.tar.gz",
"Leaflet.PolylineDecorator": "bbecquet/Leaflet.PolylineDecorator",
- "ionrangeslider": "~1.9.3",
- "leaflet-minimap": "~2.2.0",
+ "ionrangeslider": "*",
+ "leaflet-minimap": "*",
"esri-leaflet-clustered-feature-layer": "~1.0.x",
"esri-leaflet-heatmap-feature-layer": "~1.0.x",
- "leaflet-search": "~1.5.8"
- },
- "overrides": {
- "Leaflet.utfgrid": {
- "main": "dist/leaflet.utfgrid.js"
- }
+ "leaflet-search": "*"
},
"ignore": [
"**/.*",
diff --git a/core b/core
deleted file mode 100644
index 687fd3fc..00000000
Binary files a/core and /dev/null differ
diff --git a/dist/angular-leaflet-directive.js b/dist/angular-leaflet-directive.js
index 291f86f7..b4e92c96 100644
--- a/dist/angular-leaflet-directive.js
+++ b/dist/angular-leaflet-directive.js
@@ -1,1211 +1,1385 @@
+/**!
+ * The MIT License
+ *
+ * Copyright (c) 2013 the angular-leaflet-directive Team, http://tombatossals.github.io/angular-leaflet-directive
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * angular-leaflet-directive
+ * https://github.com/tombatossals/angular-leaflet-directive
+ *
+ * @authors https://github.com/tombatossals/angular-leaflet-directive/graphs/contributors
+ */
+
/*!
-* angular-leaflet-directive 0.8.6 2015-07-28
+* angular-leaflet-directive 2015-11-06
* angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps
* git: https://github.com/tombatossals/angular-leaflet-directive
*/
(function(angular){
'use strict';
-angular.module("leaflet-directive", []).directive('leaflet',
- ["$q", "leafletData", "leafletMapDefaults", "leafletHelpers", "leafletEvents", function ($q, leafletData, leafletMapDefaults, leafletHelpers, leafletEvents) {
- return {
- restrict: "EA",
- replace: true,
- scope: {
- center : '=',
- defaults : '=',
- maxbounds : '=',
- bounds : '=',
- markers : '=',
- legend : '=',
- geojson : '=',
- paths : '=',
- tiles : '=',
- layers : '=',
- controls : '=',
- decorations : '=',
- eventBroadcast : '=',
- markersWatchOptions : '=',
- geojsonWatchOptions : '='
- },
- transclude: true,
- template: '
',link:function(a,b,e,f){var g=d.isDefined,h=f.getLeafletScope(),i=h.layers;a.$watch("icons",function(){var b={uncheck:"fa fa-square-o",check:"fa fa-check-square-o",radio:"fa fa-dot-circle-o",unradio:"fa fa-circle-o",up:"fa fa-angle-up",down:"fa fa-angle-down",open:"fa fa-angle-double-down",close:"fa fa-angle-double-up",toggleLegend:"fa fa-pencil-square-o"};g(a.icons)?(angular.extend(b,a.icons),angular.extend(a.icons,b)):a.icons=b}),e.order=!g(e.order)||"normal"!==e.order&&"reverse"!==e.order?"normal":e.order,a.order="normal"===e.order,a.orderNumber="normal"===e.order?-1:1,a.layers=i,f.getMap().then(function(b){h.$watch("layers.baselayers",function(d){var e={};c.getLayers().then(function(c){var f;for(f in d){var g=d[f];g.icon=a.icons[b.hasLayer(c.baselayers[f])?"radio":"unradio"],e[f]=g}a.baselayersArray=e})}),h.$watch("layers.overlays",function(b){var d=[],e={};c.getLayers().then(function(c){var f;for(f in b){var h=b[f];h.icon=a.icons[h.visible?"check":"uncheck"],d.push(h),g(a.layerProperties[h.name])||(a.layerProperties[h.name]={opacity:g(h.layerOptions.opacity)?100*h.layerOptions.opacity:100,opacityControl:!1,showLegend:!0}),g(h.group)&&(g(a.groupProperties[h.group])||(a.groupProperties[h.group]={visible:!1}),e[h.group]=g(e[h.group])?e[h.group]:{count:0,visibles:0},e[h.group].count++,h.visible&&e[h.group].visibles++),g(h.index)&&c.overlays[f].setZIndex&&c.overlays[f].setZIndex(b[f].index)}for(f in e)a.groupProperties[f].visible=e[f].visibles===e[f].count;a.overlaysArray=d})},!0)})}}}]),angular.module("leaflet-directive").directive("layers",["$log","$q","leafletData","leafletHelpers","leafletLayerHelpers","leafletControlHelpers",function(a,b,c,d,e,f){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:["$scope",function(a){a._leafletLayers=b.defer(),this.getLayers=function(){return a._leafletLayers.promise}}],link:function(a,b,g,h){var i=d.isDefined,j={},k=h.getLeafletScope(),l=k.layers,m=e.createLayer,n=f.updateLayersControl,o=!1;h.getMap().then(function(b){a._leafletLayers.resolve(j),c.setLayers(j,g.id),j.baselayers={},j.overlays={};var d=g.id,e=!1;for(var f in l.baselayers){var h=m(l.baselayers[f]);i(h)?(j.baselayers[f]=h,l.baselayers[f].top===!0&&(b.addLayer(j.baselayers[f]),e=!0)):delete l.baselayers[f]}!e&&Object.keys(j.baselayers).length>0&&b.addLayer(j.baselayers[Object.keys(l.baselayers)[0]]);for(f in l.overlays){"cartodb"===l.overlays[f].type;var p=m(l.overlays[f]);i(p)?(j.overlays[f]=p,l.overlays[f].visible===!0&&b.addLayer(j.overlays[f])):delete l.overlays[f]}k.$watch("layers.baselayers",function(a,c){if(angular.equals(a,c))return o=n(b,d,o,a,l.overlays,j),!0;for(var e in j.baselayers)(!i(a[e])||a[e].doRefresh)&&(b.hasLayer(j.baselayers[e])&&b.removeLayer(j.baselayers[e]),delete j.baselayers[e],a[e]&&a[e].doRefresh&&(a[e].doRefresh=!1));for(var f in a)if(i(j.baselayers[f]))a[f].top!==!0||b.hasLayer(j.baselayers[f])?a[f].top===!1&&b.hasLayer(j.baselayers[f])&&b.removeLayer(j.baselayers[f]):b.addLayer(j.baselayers[f]);else{var g=m(a[f]);i(g)&&(j.baselayers[f]=g,a[f].top===!0&&b.addLayer(j.baselayers[f]))}var h=!1;for(var k in j.baselayers)if(b.hasLayer(j.baselayers[k])){h=!0;break}!h&&Object.keys(j.baselayers).length>0&&b.addLayer(j.baselayers[Object.keys(j.baselayers)[0]]),o=n(b,d,o,a,l.overlays,j)},!0),k.$watch("layers.overlays",function(a,c){if(angular.equals(a,c))return o=n(b,d,o,l.baselayers,a,j),!0;for(var e in j.overlays)(!i(a[e])||a[e].doRefresh)&&(b.hasLayer(j.overlays[e])&&b.removeLayer(j.overlays[e]),delete j.overlays[e],a[e]&&a[e].doRefresh&&(a[e].doRefresh=!1));for(var f in a){if(!i(j.overlays[f])){var g=m(a[f]);if(!i(g))continue;j.overlays[f]=g,a[f].visible===!0&&b.addLayer(j.overlays[f])}a[f].visible&&!b.hasLayer(j.overlays[f])?b.addLayer(j.overlays[f]):a[f].visible===!1&&b.hasLayer(j.overlays[f])&&b.removeLayer(j.overlays[f]),a[f].visible&&b._loaded&&a[f].data&&"heatmap"===a[f].type&&(j.overlays[f].setData(a[f].data),j.overlays[f].update())}o=n(b,d,o,l.baselayers,a,j)},!0)})}}}]),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,k,l,m=c.isArray,n=c.isDefined,o=c.isFunction,p=h.getLeafletScope(),q=p.legend;p.$watch("legend",function(a){n(a)&&(i=a.legendClass?a.legendClass:"legend",j=a.position||"bottomright",l=a.type||"arcgis")},!0),h.getMap().then(function(c){p.$watch("legend",function(b){return n(b)?n(b.url)||"arcgis"!==l||m(b.colors)&&m(b.labels)&&b.colors.length===b.labels.length?n(b.url)?void a.info("[AngularJS - Leaflet] loading legend service."):(n(k)&&(k.removeFrom(c),k=null),k=L.control({position:j}),"arcgis"===l&&(k.onAdd=d.getOnAddArrayLegend(b,i)),void k.addTo(c)):void a.warn("[AngularJS - Leaflet] legend.colors and legend.labels must be set."):void(n(k)&&(k.removeFrom(c),k=null))}),p.$watch("legend.url",function(e){n(e)&&b.get(e).success(function(a){n(k)?d.updateLegend(k.getContainer(),a,l,e):(k=L.control({position:j}),k.onAdd=d.getOnAddLegend(a,i,l,e),k.addTo(c)),n(q.loadedData)&&o(q.loadedData)&&q.loadedData()}).error(function(){a.warn("[AngularJS - Leaflet] legend.url not loaded.")})})})}}}]),angular.module("leaflet-directive").directive("markers",["$log","$rootScope","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletMarkersHelpers","leafletMarkerEvents","leafletIterators","leafletWatchHelpers","leafletDirectiveControlsHelpers",function(a,b,c,d,e,f,g,h,i,j,k){var l=e.isDefined,m=e.errorHeader,n=e,o=e.isString,p=g.addMarkerWatcher,q=g.updateMarker,r=g.listenMarkerEvents,s=g.addMarkerToGroup,t=g.createMarker,u=g.deleteMarker,v=i,w=e.watchOptions,x=j.maybeWatch,y=k.extend,z=function(a,b,c){if(Object.keys(a).length){if(c&&o(c)){if(!a[c]||!Object.keys(a[c]).length)return;return a[c][b]}return a[b]}},A=function(a,b,c,d){return d&&o(d)?(l(b[d])||(b[d]={}),b[d][c]=a):b[c]=a,a},B=function(b,c,d,e,f,g){if(!o(b))return a.error(m+" A layername must be a string"),!1;if(!l(c))return a.error(m+" You must add layers to the directive if the markers are going to use this functionality."),!1;if(!l(c.overlays)||!l(c.overlays[b]))return a.error(m+' A marker can only be added to a layer of type "group"'),!1;var h=c.overlays[b];return h instanceof L.LayerGroup||h instanceof L.FeatureGroup?(h.addLayer(e),!f&&g.hasLayer(e)&&d.focus===!0&&e.openPopup(),!0):(a.error(m+' Adding a marker to an overlay needs a overlay of the type "group" or "featureGroup"'),!1)},C=function(b,c,d,e,f,g,i,j,k){for(var o in b)if(!k[o])if(-1===o.search("-")){var u=n.copy(b[o]),v=n.getObjectDotPath(j?[j,o]:[o]),w=z(f,o,j);if(l(w)){var x=l(x)?c[o]:void 0;q(u,x,w,v,g,e,d)}else{var y=t(u),C=(u?u.layer:void 0)||j;if(!l(y)){a.error(m+" Received invalid data on the marker "+o+".");continue}if(A(y,f,o,j),l(u.message)&&y.bindPopup(u.message,u.popupOptions),l(u.group)){var D=l(u.groupOption)?u.groupOption:null;s(y,u.group,D,d)}if(n.LabelPlugin.isLoaded()&&l(u.label)&&l(u.label.message)&&y.bindLabel(u.label.message,u.label.options),l(u)&&(l(u.layer)||l(j))){var E=B(C,e,u,y,i.individual.doWatch,d);if(!E)continue}else l(u.group)||(d.addLayer(y),i.individual.doWatch||u.focus!==!0||y.openPopup());i.individual.doWatch&&p(y,v,g,e,d,i.individual.isDeep),r(y,u,g,i.individual.doWatch,d),h.bindEvents(y,v,u,g,C)}}else a.error('The marker can\'t use a "-" on his key name: "'+o+'".')},D=function(b,c,d,e,f){var g,h,i=!1,j=!1,k=l(c);for(var o in d)i||(a.debug(m+"[markers] destroy: "),i=!0),k&&(h=b[o],g=c[o],j=angular.equals(h,g)&&e),l(b)&&Object.keys(b).length&&l(b[o])&&Object.keys(b[o]).length&&!j||f&&n.isFunction(f)&&f(h,g,o)},E=function(b,c,d,e,f){D(b,c,d,!1,function(b,c,g){a.debug(m+"[marker] is deleting marker: "+g),u(d[g],e,f),delete d[g]})},F=function(b,c,d){var e={};return D(b,c,d,!0,function(b,c,d){a.debug(m+"[marker] is already rendered, marker: "+d),e[d]=b}),e};return{restrict:"A",scope:!1,replace:!1,require:["leaflet","?layers"],link:function(a,b,e,f){var g=f[0],h=g.getLeafletScope();g.getMap().then(function(a){var b,g={};b=l(f[1])?f[1].getLayers:function(){var a=c.defer();return a.resolve(),a.promise};var i=h.markersWatchOptions||w;l(e.watchMarkers)&&(i.doWatch=i.individual.doWatch=!l(e.watchMarkers)||n.isTruthy(e.watchMarkers));var j=l(e.markersNested)&&n.isTruthy(e.markersNested);b().then(function(b){var c=function(c,d){return j?void v.each(c,function(c,e){var f=l(f)?d[e]:void 0;E(c,f,g[e],a,b)}):void E(c,d,g,a,b)},f=function(d,e){c(d,e);var f=null;return j?void v.each(d,function(c,j){var k=l(k)?e[j]:void 0;f=F(d[j],k,g[j]),C(c,e,a,b,g,h,i,j,f)}):(f=F(d,e,g),void C(d,e,a,b,g,h,i,void 0,f))};y(e.id,"markers",f,c),d.setMarkers(g,e.id),x(h,"markers",i,function(a,b){f(a,b)})})})}}}]),angular.module("leaflet-directive").directive("maxbounds",["$log","leafletMapDefaults","leafletBoundsHelpers","leafletHelpers",function(a,b,c,d){
-return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,b,e,f){var g=f.getLeafletScope(),h=c.isValidBounds,i=d.isNumber;f.getMap().then(function(a){g.$watch("maxbounds",function(b){if(!h(b))return void a.setMaxBounds();var d=c.createLeafletBounds(b);i(b.pad)&&(d=d.pad(b.pad)),a.setMaxBounds(d),e.center||a.fitBounds(d)})})}}}]),angular.module("leaflet-directive").directive("paths",["$log","$q","leafletData","leafletMapDefaults","leafletHelpers","leafletPathsHelpers","leafletEvents",function(a,b,c,d,e,f,g){return{restrict:"A",scope:!1,replace:!1,require:["leaflet","?layers"],link:function(h,i,j,k){var l=k[0],m=e.isDefined,n=e.isString,o=l.getLeafletScope(),p=o.paths,q=f.createPath,r=g.bindPathEvents,s=f.setPathOptions;l.getMap().then(function(f){var g,h=d.getDefaults(j.id);g=m(k[1])?k[1].getLayers:function(){var a=b.defer();return a.resolve(),a.promise},m(p)&&g().then(function(b){var d={};c.setPaths(d,j.id);var g=!m(j.watchPaths)||"true"===j.watchPaths,i=function(a,c){var d=o.$watch('paths["'+c+'"]',function(c,e){if(!m(c)){if(m(e.layer))for(var g in b.overlays){var h=b.overlays[g];h.removeLayer(a)}return f.removeLayer(a),void d()}s(a,c.type,c)},!0)};o.$watchCollection("paths",function(c){for(var j in d)m(c[j])||(f.removeLayer(d[j]),delete d[j]);for(var k in c)if(0!==k.search("\\$"))if(-1===k.search("-")){if(!m(d[k])){var l=c[k],p=q(k,c[k],h);if(m(p)&&m(l.message)&&p.bindPopup(l.message,l.popupOptions),e.LabelPlugin.isLoaded()&&m(l.label)&&m(l.label.message)&&p.bindLabel(l.label.message,l.label.options),m(l)&&m(l.layer)){if(!n(l.layer)){a.error("[AngularJS - Leaflet] A layername must be a string");continue}if(!m(b)){a.error("[AngularJS - Leaflet] You must add layers to the directive if the markers are going to use this functionality.");continue}if(!m(b.overlays)||!m(b.overlays[l.layer])){a.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"');continue}var t=b.overlays[l.layer];if(!(t instanceof L.LayerGroup||t instanceof L.FeatureGroup)){a.error('[AngularJS - Leaflet] Adding a marker to an overlay needs a overlay of the type "group" or "featureGroup"');continue}d[k]=p,t.addLayer(p),g?i(p,k):s(p,l.type,l)}else m(p)&&(d[k]=p,f.addLayer(p),g?i(p,k):s(p,l.type,l));r(p,k,l,o)}}else a.error('[AngularJS - Leaflet] The path name "'+k+'" is not valid. It must not include "-" and a number.')})})})}}}]),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.")}}}]),["markers","geojson"].forEach(function(a){angular.module("leaflet-directive").directive(a+"WatchOptions",["$log","$rootScope","$q","leafletData","leafletHelpers",function(b,c,d,e,f){var g=f.isDefined,h=f.errorHeader,i=f.isObject,j=f.watchOptions;return{restrict:"A",scope:!1,replace:!1,require:["leaflet"],link:function(c,d,e,f){var k=f[0],l=k.getLeafletScope();k.getMap().then(function(){g(c[a+"WatchOptions"])&&(i(c[a+"WatchOptions"])?angular.extend(j,c[a+"WatchOptions"]):b.error(h+"["+a+"WatchOptions] is not an object"),l[a+"WatchOptions"]=j)})}}}])}),angular.module("leaflet-directive").factory("leafletEventsHelpersFactory",["$rootScope","$q","$log","leafletHelpers",function(a,b,c,d){var e=d.safeApply,f=d.isDefined,g=d.isObject,h=d.isArray,i=d.errorHeader,j=function(a,b){this.rootBroadcastName=a,this.lObjectType=b};return j.prototype.getAvailableEvents=function(){return[]},j.prototype.genDispatchEvent=function(a,b,c,d,e,f,g,h){var i=this;return function(j){var k=i.rootBroadcastName+"."+a;i.fire(c,k,b,j,j.target||d,f,e,g,h)}},j.prototype.fire=function(b,c,d,g,h,i,j,k,l){e(b,function(){var e={leafletEvent:g,leafletObject:h,modelName:j,model:i};f(k)&&angular.extend(e,{layerName:k}),"emit"===d?b.$emit(c,e):a.$broadcast(c,e)})},j.prototype.bindEvents=function(a,b,d,e,j,k){var l=[],m="emit",n=this;if(f(e.eventBroadcast))if(g(e.eventBroadcast))if(f(e.eventBroadcast[n.lObjectType]))if(g(e.eventBroadcast[n.lObjectType])){f(e.eventBroadcast[this.lObjectType].logic)&&"emit"!==e.eventBroadcast[n.lObjectType].logic&&"broadcast"!==e.eventBroadcast[n.lObjectType].logic&&c.warn(i+"Available event propagation logic are: 'emit' or 'broadcast'.");var o=!1,p=!1;f(e.eventBroadcast[n.lObjectType].enable)&&h(e.eventBroadcast[n.lObjectType].enable)&&(o=!0),f(e.eventBroadcast[n.lObjectType].disable)&&h(e.eventBroadcast[n.lObjectType].disable)&&(p=!0),o&&p?c.warn(i+"can not enable and disable events at the same time"):o||p?o?e.eventBroadcast[this.lObjectType].enable.forEach(function(a){-1!==l.indexOf(a)?c.warn(i+"This event "+a+" is already enabled"):-1===n.getAvailableEvents().indexOf(a)?c.warn(i+"This event "+a+" does not exist"):l.push(a)}):(l=this.getAvailableEvents(),e.eventBroadcast[n.lObjectType].disable.forEach(function(a){var b=l.indexOf(a);-1===b?c.warn(i+"This event "+a+" does not exist or has been already disabled"):l.splice(b,1)})):c.warn(i+"must enable or disable events")}else c.warn(i+"event-broadcast."+[n.lObjectType]+" must be an object check your model.");else l=this.getAvailableEvents();else c.error(i+"event-broadcast must be an object check your model.");else l=this.getAvailableEvents();return l.forEach(function(c){a.on(c,n.genDispatchEvent(c,m,e,a,b,d,j,k))}),m},j}]).service("leafletEventsHelpers",["leafletEventsHelpersFactory",function(a){return new a}]),angular.module("leaflet-directive").factory("leafletGeoJsonEvents",["$rootScope","$q","$log","leafletHelpers","leafletEventsHelpersFactory","leafletLabelEvents","leafletData",function(a,b,c,d,e,f,g){var h=d.safeApply,i=(d.isDefined,e),j=function(){i.call(this,"leafletDirectiveGeoJson","geojson")};return j.prototype=new i,j.prototype.genDispatchEvent=function(b,c,d,e,f,j,k,l){var m=i.prototype.genDispatchEvent.call(this,b,c,d,e,f,j,k),n=this;return function(c){"mouseout"===b&&(l.resetStyleOnMouseout&&g.getGeoJSON(l.mapId).then(function(a){var b=k?a[k]:a;b.resetStyle(c.target)}),h(d,function(){a.$broadcast(n.rootBroadcastName+".mouseout",c)})),m(c)}},j.prototype.getAvailableEvents=function(){return["click","dblclick","mouseover","mouseout"]},new j}]),angular.module("leaflet-directive").factory("leafletLabelEvents",["$rootScope","$q","$log","leafletHelpers","leafletEventsHelpersFactory",function(a,b,c,d,e){var f=d,g=e,h=function(){g.call(this,"leafletDirectiveLabel","markers")};return h.prototype=new g,h.prototype.genDispatchEvent=function(a,b,c,d,e,f,h){var i=e.replace("markers.","");return g.prototype.genDispatchEvent.call(this,a,b,c,d,i,f,h)},h.prototype.getAvailableEvents=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu"]},h.prototype.genEvents=function(a,b,c,d,e,g,h){var i=this,j=this.getAvailableEvents(),k=f.getObjectArrayPath("markers."+e);j.forEach(function(a){d.label.on(a,i.genDispatchEvent(a,b,c,d.label,k,g,h))})},h.prototype.bindEvents=function(a,b,c,d,e){},new h}]),angular.module("leaflet-directive").factory("leafletMapEvents",["$rootScope","$q","$log","leafletHelpers","leafletEventsHelpers",function(a,b,c,d,e){var f=(d.safeApply,d.isDefined),g=(d.isObject,d.errorHeader,e.fire),h=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"]},i=function(a,b,c){return function(d){var e="leafletDirectiveMap."+b;g(a,e,c,d,d.target,a)}},j=function(a){a.$broadcast("boundsChanged")},k=function(a,b,c,d){if(f(c.urlHashCenter)){var e=b.getCenter(),g=e.lat.toFixed(4)+":"+e.lng.toFixed(4)+":"+b.getZoom();f(d.c)&&d.c===g||a.$emit("centerUrlHash",g)}};return{getAvailableMapEvents:h,genDispatchMapEvent:i,notifyCenterChangedToBounds:j,notifyCenterUrlHashChanged:k}}]),angular.module("leaflet-directive").factory("leafletMarkerEvents",["$rootScope","$q","$log","leafletHelpers","leafletEventsHelpersFactory","leafletLabelEvents",function(a,b,c,d,e,f){var g=d.safeApply,h=d.isDefined,i=d,j=f,k=e,l=function(){k.call(this,"leafletDirectiveMarker","markers")};return l.prototype=new k,l.prototype.genDispatchEvent=function(b,c,d,e,f,h,i){var j=k.prototype.genDispatchEvent.call(this,b,c,d,e,f,h,i);return function(c){"click"===b?g(d,function(){a.$broadcast("leafletDirectiveMarkersClick",f)}):"dragend"===b&&(g(d,function(){h.lat=e.getLatLng().lat,h.lng=e.getLatLng().lng}),h.message&&h.focus===!0&&e.openPopup()),j(c)}},l.prototype.getAvailableEvents=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu","dragstart","drag","dragend","move","remove","popupopen","popupclose","touchend","touchstart","touchmove","touchcancel","touchleave"]},l.prototype.bindEvents=function(a,b,c,d,e){var f=k.prototype.bindEvents.call(this,a,b,c,d,e);i.LabelPlugin.isLoaded()&&h(a.label)&&j.genEvents(b,f,d,a,c,e)},new l}]),angular.module("leaflet-directive").factory("leafletPathEvents",["$rootScope","$q","$log","leafletHelpers","leafletLabelEvents","leafletEventsHelpers",function(a,b,c,d,e,f){var g=(d.safeApply,d.isDefined),h=d.isObject,i=d,j=d.errorHeader,k=e,l=f.fire,m=function(a,b,c,d,e,f,g){return function(h){var i="leafletDirectivePath."+a;l(c,i,b,h,h.target||d,f,e,g)}},n=function(a,b,d,e){var f,l,n=[],p="broadcast";if(g(e.eventBroadcast))if(h(e.eventBroadcast))if(g(e.eventBroadcast.path))if(h(e.eventBroadcast.paths))c.warn(j+"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(j+"Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===e.eventBroadcast.path.logic&&(p="emit"));var q=!1,r=!1;if(void 0!==e.eventBroadcast.path.enable&&null!==e.eventBroadcast.path.enable&&"object"==typeof e.eventBroadcast.path.enable&&(q=!0),void 0!==e.eventBroadcast.path.disable&&null!==e.eventBroadcast.path.disable&&"object"==typeof e.eventBroadcast.path.disable&&(r=!0),q&&r)c.warn(j+"can not enable and disable events at the same time");else if(q||r)if(q)for(f=0;f',controller:["$scope",function(b){this._leafletMap=a.defer(),this.getMap=function(){return this._leafletMap.promise},this.getLeafletScope=function(){return b}}],link:function(a,f,g,h){function i(){isNaN(g.width)?f.css("width",g.width):f.css("width",g.width+"px")}function j(){isNaN(g.height)?f.css("height",g.height):f.css("height",g.height+"px")}var k=d.isDefined,l=c.setDefaults(a.defaults,g.id),m=e.getAvailableMapEvents(),n=e.addEvents;a.mapId=g.id,b.setDirectiveControls({},g.id),k(g.width)&&(i(),a.$watch(function(){return f[0].getAttribute("width")},function(){i(),o.invalidateSize()})),k(g.height)&&(j(),a.$watch(function(){return f[0].getAttribute("height")},function(){j(),o.invalidateSize()}));var o=new L.Map(f[0],c.getMapCreationDefaults(g.id));if(h._leafletMap.resolve(o),k(g.center)||k(g.lfCenter)||o.setView([l.center.lat,l.center.lng],l.center.zoom),!k(g.tiles)&&!k(g.layers)){var p=L.tileLayer(l.tileLayer,l.tileLayerOptions);p.addTo(o),b.setTiles(p,g.id)}if(k(o.zoomControl)&&k(l.zoomControlPosition)&&o.zoomControl.setPosition(l.zoomControlPosition),k(o.zoomControl)&&l.zoomControl===!1&&o.zoomControl.removeFrom(o),k(o.zoomsliderControl)&&k(l.zoomsliderControl)&&l.zoomsliderControl===!1&&o.zoomsliderControl.removeFrom(o),!k(g.eventBroadcast)){var q="broadcast";n(o,m,"eventName",a,q)}o.whenReady(function(){b.setMap(o,g.id)}),a.$on("$destroy",function(){c.reset(),o.remove(),b.unresolveMap(g.id)}),a.$on("invalidateSize",function(){o.invalidateSize()})}}}]),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,f=b.isFunction,g=b.isDefined;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.")},createBoundsFromLeaflet:function(b){if(!(g(b)&&f(b.getNorthEast)&&f(b.getSouthWest)))return void a.error("[AngularJS - Leaflet] The leaflet bounds is not valid object.");var c=b.getNorthEast(),d=b.getSouthWest();return{northEast:{lat:c.lat,lng:c.lng},southWest:{lat:d.lat,lng:d.lng}}}}}]),angular.module("leaflet-directive").factory("leafletControlHelpers",["$rootScope","$log","leafletHelpers","leafletLayerHelpers","leafletMapDefaults",function(a,b,c,d,e){var f=c.isDefined,g=c.isObject,h=d.createLayer,i={},j=c.errorHeader+" [Controls] ",k=function(a,b,c){var d=e.getDefaults(c);if(!d.controls.layers.visible)return!1;var h=!1;return g(a)&&Object.keys(a).forEach(function(b){var c=a[b];f(c.layerOptions)&&c.layerOptions.showOnSelector===!1||(h=!0)}),g(b)&&Object.keys(b).forEach(function(a){var c=b[a];f(c.layerParams)&&c.layerParams.showOnSelector===!1||(h=!0)}),h},l=function(a){var b=e.getDefaults(a),c={collapsed:b.controls.layers.collapsed,position:b.controls.layers.position,autoZIndex:!1};angular.extend(c,b.controls.layers.options);var d;return d=b.controls.layers&&f(b.controls.layers.control)?b.controls.layers.control.apply(this,[[],[],c]):new L.control.layers([],[],c)},m={draw:{isPluginLoaded:function(){return angular.isDefined(L.Control.Draw)?!0:(b.error(j+" Draw plugin is not loaded."),!1)},checkValidParams:function(){return!0},createControl:function(a){return new L.Control.Draw(a)}},scale:{isPluginLoaded:function(){return!0},checkValidParams:function(){return!0},createControl:function(a){return new L.control.scale(a)}},fullscreen:{isPluginLoaded:function(){return angular.isDefined(L.Control.Fullscreen)?!0:(b.error(j+" Fullscreen plugin is not loaded."),!1)},checkValidParams:function(){return!0},createControl:function(a){return new L.Control.Fullscreen(a)}},search:{isPluginLoaded:function(){return angular.isDefined(L.Control.Search)?!0:(b.error(j+" Search plugin is not loaded."),!1)},checkValidParams:function(){return!0},createControl:function(a){return new L.Control.Search(a)}},custom:{},minimap:{isPluginLoaded:function(){return angular.isDefined(L.Control.MiniMap)?!0:(b.error(j+" Minimap plugin is not loaded."),!1)},checkValidParams:function(a){return f(a.layer)?!0:(b.warn(j+' minimap "layer" option should be defined.'),!1)},createControl:function(a){var c=h(a.layer);return f(c)?new L.Control.MiniMap(c,a):void b.warn(j+' minimap control "layer" could not be created.')}}};return{layersControlMustBeVisible:k,isValidControlType:function(a){return-1!==Object.keys(m).indexOf(a)},createControl:function(a,b){return m[a].checkValidParams(b)?m[a].createControl(b):void 0},updateLayersControl:function(a,b,c,d,e,g){var h,j=i[b],m=k(d,e,b);if(f(j)&&c){for(h in g.baselayers)j.removeLayer(g.baselayers[h]);for(h in g.overlays)j.removeLayer(g.overlays[h]);a.removeControl(j),delete i[b]}if(m){j=l(b),i[b]=j;for(h in d){var n=f(d[h].layerOptions)&&d[h].layerOptions.showOnSelector===!1;!n&&f(g.baselayers[h])&&j.addBaseLayer(g.baselayers[h],d[h].name)}for(h in e){var o=f(e[h].layerParams)&&e[h].layerParams.showOnSelector===!1;!o&&f(g.overlays[h])&&j.addOverlay(g.overlays[h],e[h].name)}a.addControl(j)}return m}}}]),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=this,i=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},j=["map","tiles","layers","paths","markers","geoJSON","UTFGrid","decorations","directiveControls"];j.forEach(function(a){g[a]={}}),this.unresolveMap=function(a){var b=c.obtainEffectiveMapId(g.map,a);j.forEach(function(a){g[a][b]=void 0})},j.forEach(function(a){var b=i(a);h["set"+b]=function(b,c){var d=e(g[a],c);d.resolve(b),f(g[a],c)},h["get"+b]=function(b){var c=d(g[a],b);return c.promise}})}]),angular.module("leaflet-directive").service("leafletDirectiveControlsHelpers",["$log","leafletData","leafletHelpers",function(a,b,c){var d=c.isDefined,e=c.isString,f=c.isObject,g=c.errorHeader,h=g+"[leafletDirectiveControlsHelpers",i=function(c,g,i,j){var k=h+".extend] ",l={};if(!d(g))return void a.error(k+"thingToAddName cannot be undefined");if(e(g)&&d(i)&&d(j))l[g]={create:i,clean:j};else{if(!f(g)||d(i)||d(j))return void a.error(k+"incorrect arguments");l=g}b.getDirectiveControls().then(function(a){angular.extend(a,l),b.setDirectiveControls(a,c)})};return{extend:i}}]),angular.module("leaflet-directive").service("leafletGeoJsonHelpers",["leafletHelpers","leafletIterators",function(a,b){var c=a,d=b,e=function(a,b){return this.lat=a,this.lng=b,this},f=function(a){return Array.isArray(a)&&2===a.length?a[1]:c.isDefined(a.type)&&"Point"===a.type?+a.coordinates[1]:+a.lat},g=function(a){return Array.isArray(a)&&2===a.length?a[0]:c.isDefined(a.type)&&"Point"===a.type?+a.coordinates[0]:+a.lng},h=function(a){if(c.isUndefined(a))return!1;if(c.isArray(a)){if(2===a.length&&c.isNumber(a[0])&&c.isNumber(a[1]))return!0}else if(c.isDefined(a.type)&&"Point"===a.type&&c.isArray(a.coordinates)&&2===a.coordinates.length&&c.isNumber(a.coordinates[0])&&c.isNumber(a.coordinates[1]))return!0;var b=d.all(["lat","lng"],function(b){return c.isDefined(a[b])&&c.isNumber(a[b])});return b},i=function(a){if(a&&h(a)){var b=null;if(Array.isArray(a)&&2===a.length)b=new e(a[1],a[0]);else{if(!c.isDefined(a.type)||"Point"!==a.type)return a;b=new e(a.coordinates[1],a.coordinates[0])}return angular.extend(a,b)}};return{getLat:f,getLng:g,validateCoords:h,getCoords:i}}]),angular.module("leaflet-directive").service("leafletHelpers",["$q","$log",function(a,b){function c(a,c){var d,f;if(angular.isDefined(c))d=c;else if(0===Object.keys(a).length)d="main";else if(Object.keys(a).length>=1)for(f in a)a.hasOwnProperty(f)&&(d=f);else b.error(e+"- 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}var e="[AngularJS - Leaflet] ",f=angular.copy,g=f,h=function(a,b){var c;if(a&&angular.isObject(a))return null!==b&&angular.isString(b)?(c=a,b.split(".").forEach(function(a){c&&(c=c[a])}),c):b},i=function(a){return a.split(".").reduce(function(a,b){return a+'["'+b+'"]'})},j=function(a){return a.reduce(function(a,b){return a+"."+b})},k=function(a){return angular.isDefined(a)&&null!==a},l=function(a){return!k(a)},m=/([\:\-\_]+(.))/g,n=/^moz([A-Z])/,o=/^((?:x|data)[\:\-_])/i,p=function(a){return a.replace(m,function(a,b,c,d){return d?c.toUpperCase():c}).replace(n,"Moz$1")},q=function(a){return p(a.replace(o,""))};return{camelCase:p,directiveNormalize:q,copy:f,clone:g,errorHeader:e,getObjectValue:h,getObjectArrayPath:i,getObjectDotPath:j,defaultTo:function(a,b){return k(a)?a:b},isTruthy:function(a){return"true"===a||a===!0},isEmpty:function(a){return 0===Object.keys(a).length},isUndefinedOrEmpty:function(a){return angular.isUndefined(a)||null===a||0===Object.keys(a).length},isDefined:k,isUndefined:l,isNumber:angular.isNumber,isString:angular.isString,isArray:angular.isArray,isObject:angular.isObject,isFunction:angular.isFunction,equals:angular.equals,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.isArray(a)?2===a.length&&angular.isNumber(a[0])&&angular.isNumber(a[1]):angular.isNumber(a.lat)&&angular.isNumber(a.lng):!1},isSameCenterOnMap:function(a,b){var c=b.getCenter(),d=b.getZoom();return a.lat&&a.lng&&c.lat.toFixed(4)===a.lat.toFixed(4)&&c.lng.toFixed(4)===a.lng.toFixed(4)&&d===a.zoom?!0:!1},safeApply:function(a,b){var c=a.$root.$$phase;"$apply"===c||"$digest"===c?a.$eval(b):a.$evalAsync(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},rangeIsSupported:function(){var a=document.createElement("input");return a.setAttribute("type","range"),"range"===a.type},FullScreenControlPlugin:{isLoaded:function(){return angular.isDefined(L.Control.Fullscreen)}},MiniMapControlPlugin:{isLoaded:function(){return angular.isDefined(L.Control.MiniMap)}},AwesomeMarkersPlugin:{isLoaded:function(){return angular.isDefined(L.AwesomeMarkers)&&angular.isDefined(L.AwesomeMarkers.Icon)},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}},VectorMarkersPlugin:{isLoaded:function(){return angular.isDefined(L.VectorMarkers)&&angular.isDefined(L.VectorMarkers.Icon)},is:function(a){return this.isLoaded()?a instanceof L.VectorMarkers.Icon:!1},equal:function(a,b){return this.isLoaded()&&this.is(a)?angular.equals(a,b):!1}},DomMarkersPlugin:{isLoaded:function(){return angular.isDefined(L.DomMarkers)&&angular.isDefined(L.DomMarkers.Icon)?!0:!1},is:function(a){return this.isLoaded()?a instanceof L.DomMarkers.Icon:!1},equal:function(a,b){return this.isLoaded()&&this.is(a)?angular.equals(a,b):!1}},PolylineDecoratorPlugin:{isLoaded:function(){return angular.isDefined(L.PolylineDecorator)?!0:!1},is:function(a){return this.isLoaded()?a instanceof L.PolylineDecorator:!1},equal:function(a,b){return this.isLoaded()&&this.is(a)?angular.equals(a,b):!1}},MakiMarkersPlugin:{isLoaded:function(){return angular.isDefined(L.MakiMarkers)&&angular.isDefined(L.MakiMarkers.Icon)?!0:!1},is:function(a){return this.isLoaded()?a instanceof L.MakiMarkers.Icon:!1},equal:function(a,b){return this.isLoaded()&&this.is(a)?angular.equals(a,b):!1}},ExtraMarkersPlugin:{isLoaded:function(){return angular.isDefined(L.ExtraMarkers)&&angular.isDefined(L.ExtraMarkers.Icon)?!0:!1},is:function(a){return this.isLoaded()?a instanceof L.ExtraMarkers.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}},LeafletProviderPlugin:{isLoaded:function(){return angular.isDefined(L.TileLayer.Provider)},is:function(a){return this.isLoaded()?a instanceof L.TileLayer.Provider:!1}},ChinaLayerPlugin:{isLoaded:function(){return angular.isDefined(L.tileLayer.chinaProvider)}},HeatLayerPlugin:{isLoaded:function(){return angular.isDefined(L.heatLayer)}},WebGLHeatMapLayerPlugin:{isLoaded:function(){return angular.isDefined(L.TileLayer.WebGLHeatMap)}},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}},AGSBaseLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.basemapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.basemapLayer:!1}},AGSLayerPlugin:{isLoaded:function(){return void 0!==lvector&&void 0!==lvector.AGS},is:function(a){return this.isLoaded()?a instanceof lvector.AGS:!1}},AGSFeatureLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.featureLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.featureLayer:!1}},AGSTiledMapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.tiledMapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.tiledMapLayer:!1}},AGSDynamicMapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.dynamicMapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.dynamicMapLayer:!1}},AGSImageMapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.imageMapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.imageMapLayer:!1}},AGSClusteredLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.clusteredFeatureLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.clusteredFeatureLayer:!1}},AGSHeatmapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.heatmapFeatureLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.heatmapFeatureLayer:!1}},YandexLayerPlugin:{isLoaded:function(){return angular.isDefined(L.Yandex)},is:function(a){return this.isLoaded()?a instanceof L.Yandex:!1}},GeoJSONPlugin:{isLoaded:function(){return angular.isDefined(L.TileLayer.GeoJSON)},is:function(a){return this.isLoaded()?a instanceof L.TileLayer.GeoJSON:!1}},UTFGridPlugin:{isLoaded:function(){return angular.isDefined(L.UtfGrid)},is:function(a){return this.isLoaded()?a instanceof L.UtfGrid:(b.error("[AngularJS - Leaflet] No UtfGrid plugin found."),!1)}},CartoDB:{isLoaded:function(){return cartodb},is:function(){return!0}},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}}},watchOptions:{doWatch:!0,isDeep:!0,individual:{doWatch:!0,isDeep:!0}}}}]),angular.module("leaflet-directive").service("leafletIterators",["$log","leafletHelpers",function(a,b){var c,d=b,e=b.errorHeader+"leafletIterators: ",f=Object.keys,g=d.isFunction,h=d.isObject,i=Math.pow(2,53)-1,j=function(a){var b=null!==a&&a.length;return d.isNumber(b)&&b>=0&&i>=b},k=function(a){return a},l=function(a){return function(b){return null===b?void 0:b[a]}},m=function(a,b,c){if(void 0===b)return a;switch(null===c?3:c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return function(){return a.apply(b,arguments)}},n=function(a,b){return function(c){var d=arguments.length;if(2>d||null===c)return c;for(var e=1;d>e;e++)for(var f=arguments[e],g=a(f),h=g.length,i=0;h>i;i++){var j=g[i];b&&void 0!==c[j]||(c[j]=f[j])}return c}},o=null;c=o=n(f);var p,q=function(a,b){var c=f(b),d=c.length;if(null===a)return!d;for(var e=Object(a),g=0;d>g;g++){var h=c[g];if(b[h]!==e[h]||!(h in e))return!1}return!0},r=null;p=r=function(a){return a=c({},a),function(b){return q(b,a)}};var s,t=function(a,b,c){return null===a?k:g(a)?m(a,b,c):h(a)?p(a):l(a)},u=null;s=u=function(a,b,c){b=t(b,c);for(var d=!j(a)&&f(a),e=(d||a).length,g=0;e>g;g++){var h=d?d[g]:g;if(!b(a[h],h,a))return!1}return!0};var v=function(b,c,f,g){return f||d.isDefined(b)&&d.isDefined(c)?d.isFunction(c)?!1:(g=d.defaultTo(c,"cb"),a.error(e+g+" is not a function"),!0):!0},w=function(a,b,c){if(!v(void 0,c,!0,"internalCb")&&!v(a,b))for(var d in a)a.hasOwnProperty(d)&&c(a[d],d)},x=function(a,b){w(a,b,function(a,c){b(a,c)})};return{each:x,forEach:x,every:s,all:u}}]),angular.module("leaflet-directive").factory("leafletLayerHelpers",["$rootScope","$log","$q","leafletHelpers","leafletIterators",function($rootScope,$log,$q,leafletHelpers,leafletIterators){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].mustHaveData&&!isDefined(a.data)?($log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute'),!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):layerTypes[a.type].mustHaveKey&&!isDefined(a.key)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have key defined"),!1):!0:($log.error("[AngularJS - Leaflet] A layer must have a valid type defined."),!1)}function createLayer(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,data:a.data,options:a.layerOptions,layer:a.layer,icon:a.icon,type:a.layerType,bounds:a.bounds,key:a.key,apiKey:a.apiKey,pluginOptions:a.pluginOptions,user:a.user};return layerTypes[a.type].createLayer(c)}}function safeAddLayer(a,b){b&&"function"==typeof b.addTo?b.addTo(a):a.addLayer(b)}function safeRemoveLayer(a,b,c){if(isDefined(c)&&isDefined(c.loadedDefer))if(angular.isFunction(c.loadedDefer)){var d=c.loadedDefer();$log.debug("Loaded Deferred",d);var e=d.length;if(e>0)for(var f=function(){e--,0===e&&a.removeLayer(b)},g=0;g'+b.error.message+"";else if("arcgis"===c)for(var e=0;e'+f.layerName+"";for(var g=0;g