diff --git a/dist/angular-leaflet-directive.js b/dist/angular-leaflet-directive.js
index 766e6900..1eb66c7b 100644
--- a/dist/angular-leaflet-directive.js
+++ b/dist/angular-leaflet-directive.js
@@ -28,13 +28,13 @@
*/
/*!
-* angular-leaflet-directive 2015-11-06
+* angular-leaflet-directive 0.10.1 2017-02-15
* 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", "leafletMapEvents", function($q, leafletData, leafletMapDefaults, leafletHelpers, leafletMapEvents) {
+angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData", "leafletMapDefaults", "leafletHelpers", "leafletMapEvents", function ($q, leafletData, leafletMapDefaults, leafletHelpers, leafletMapEvents) {
return {
restrict: 'EA',
replace: true,
@@ -58,18 +58,18 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
},
transclude: true,
template: '
',
- controller: ["$scope", function($scope) {
+ controller: ["$scope", function ($scope) {
this._leafletMap = $q.defer();
- this.getMap = function() {
+ this.getMap = function () {
return this._leafletMap.promise;
};
- this.getLeafletScope = function() {
+ this.getLeafletScope = function () {
return $scope;
};
}],
- link: function(scope, element, attrs, ctrl) {
+ link: function (scope, element, attrs, ctrl) {
var isDefined = leafletHelpers.isDefined;
var defaults = leafletMapDefaults.setDefaults(scope.defaults, attrs.id);
var mapEvents = leafletMapEvents.getAvailableMapEvents();
@@ -101,11 +101,11 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
updateWidth();
scope.$watch(
- function() {
+ function () {
return element[0].getAttribute('width');
},
- function() {
+ function () {
updateWidth();
map.invalidateSize();
});
@@ -117,11 +117,11 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
updateHeight();
scope.$watch(
- function() {
+ function () {
return element[0].getAttribute('height');
},
- function() {
+ function () {
updateHeight();
map.invalidateSize();
});
@@ -165,11 +165,11 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
}
// Resolve the map object to the promises
- map.whenReady(function() {
+ map.whenReady(function () {
leafletData.setMap(map, attrs.id);
});
- scope.$on('$destroy', function() {
+ scope.$on('$destroy', function () {
leafletMapDefaults.reset();
map.remove();
leafletData.unresolveMap(attrs.id);
@@ -178,14 +178,14 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
//Handle request to invalidate the map size
//Up scope using $scope.$emit('invalidateSize')
//Down scope using $scope.$broadcast('invalidateSize')
- scope.$on('invalidateSize', function() {
+ scope.$on('invalidateSize', function () {
map.invalidateSize();
});
},
};
}]);
-angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "leafletHelpers", function($log, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "leafletHelpers", function ($log, leafletHelpers) {
var isArray = leafletHelpers.isArray;
var isNumber = leafletHelpers.isNumber;
@@ -200,7 +200,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
}
return {
- createLeafletBounds: function(bounds) {
+ createLeafletBounds: function (bounds) {
if (_isValidBounds(bounds)) {
return L.latLngBounds([bounds.southWest.lat, bounds.southWest.lng],
[bounds.northEast.lat, bounds.northEast.lng]);
@@ -209,7 +209,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
isValidBounds: _isValidBounds,
- createBoundsFromArray: function(boundsArray) {
+ createBoundsFromArray: function (boundsArray) {
if (!(isArray(boundsArray) && boundsArray.length === 2 &&
isArray(boundsArray[0]) && isArray(boundsArray[1]) &&
boundsArray[0].length === 2 && boundsArray[1].length === 2 &&
@@ -231,7 +231,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
};
},
- createBoundsFromLeaflet: function(lfBounds) {
+ createBoundsFromLeaflet: function (lfBounds) {
if (!(isDefined(lfBounds) && isFunction(lfBounds.getNorthEast) && isFunction(lfBounds.getSouthWest))) {
$log.error('[AngularJS - Leaflet] The leaflet bounds is not valid object.');
return;
@@ -254,14 +254,14 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
};
}]);
-angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScope", "$log", "leafletHelpers", "leafletLayerHelpers", "leafletMapDefaults", function($rootScope, $log, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
+angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScope", "$log", "leafletHelpers", "leafletLayerHelpers", "leafletMapDefaults", function ($rootScope, $log, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var createLayer = leafletLayerHelpers.createLayer;
var _controls = {};
var errorHeader = leafletHelpers.errorHeader + ' [Controls] ';
- var _controlLayersMustBeVisible = function(baselayers, overlays, mapId) {
+ var _controlLayersMustBeVisible = function (baselayers, overlays, mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
if (!defaults.controls.layers.visible) {
return false;
@@ -270,7 +270,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
var atLeastOneControlItemMustBeShown = false;
if (isObject(baselayers)) {
- Object.keys(baselayers).forEach(function(key) {
+ Object.keys(baselayers).forEach(function (key) {
var layer = baselayers[key];
if (!isDefined(layer.layerOptions) || layer.layerOptions.showOnSelector !== false) {
atLeastOneControlItemMustBeShown = true;
@@ -279,7 +279,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
}
if (isObject(overlays)) {
- Object.keys(overlays).forEach(function(key) {
+ Object.keys(overlays).forEach(function (key) {
var layer = overlays[key];
if (!isDefined(layer.layerParams) || layer.layerParams.showOnSelector !== false) {
atLeastOneControlItemMustBeShown = true;
@@ -290,7 +290,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return atLeastOneControlItemMustBeShown;
};
- var _createLayersControl = function(mapId) {
+ var _createLayersControl = function (mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
var controlOptions = {
collapsed: defaults.controls.layers.collapsed,
@@ -312,7 +312,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
var controlTypes = {
draw: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Draw)) {
$log.error(errorHeader + ' Draw plugin is not loaded.');
return false;
@@ -321,29 +321,29 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Draw(params);
},
},
scale: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.control.scale(params);
},
},
fullscreen: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Fullscreen)) {
$log.error(errorHeader + ' Fullscreen plugin is not loaded.');
return false;
@@ -352,16 +352,16 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Fullscreen(params);
},
},
search: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Search)) {
$log.error(errorHeader + ' Search plugin is not loaded.');
return false;
@@ -370,17 +370,17 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Search(params);
},
},
custom: {},
minimap: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.MiniMap)) {
$log.error(errorHeader + ' Minimap plugin is not loaded.');
return false;
@@ -389,7 +389,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(params) {
+ checkValidParams: function (params) {
if (!isDefined(params.layer)) {
$log.warn(errorHeader + ' minimap "layer" option should be defined.');
return false;
@@ -398,7 +398,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
var layer = createLayer(params.layer);
if (!isDefined(layer)) {
@@ -414,11 +414,11 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return {
layersControlMustBeVisible: _controlLayersMustBeVisible,
- isValidControlType: function(type) {
+ isValidControlType: function (type) {
return Object.keys(controlTypes).indexOf(type) !== -1;
},
- createControl: function(type, params) {
+ createControl: function (type, params) {
if (!controlTypes[type].checkValidParams(params)) {
return;
}
@@ -426,7 +426,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return controlTypes[type].createControl(params);
},
- updateLayersControl: function(map, mapId, loaded, baselayers, overlays, leafletLayers) {
+ updateLayersControl: function (map, mapId, loaded, baselayers, overlays, leafletLayers) {
var i;
var _layersControl = _controls[mapId];
var mustBeLoaded = _controlLayersMustBeVisible(baselayers, overlays, mapId);
@@ -471,7 +471,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
};
}]);
-angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafletHelpers", function($log, $q, leafletHelpers) {
+angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafletHelpers", function ($log, $q, leafletHelpers) {
var getDefer = leafletHelpers.getDefer,
getUnresolvedDefer = leafletHelpers.getUnresolvedDefer,
setResolvedDefer = leafletHelpers.setResolvedDefer;
@@ -479,7 +479,7 @@ angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafl
var _private = {};
var self = this;
- var upperFirst = function(string) {
+ var upperFirst = function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
@@ -492,30 +492,30 @@ angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafl
'geoJSON',
'UTFGrid', //odd ball on naming convention keeping to not break
'decorations',
- 'directiveControls',];
+ 'directiveControls', ];
//init
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
_private[itemName] = {};
});
- this.unresolveMap = function(scopeId) {
+ this.unresolveMap = function (scopeId) {
var id = leafletHelpers.obtainEffectiveMapId(_private.map, scopeId);
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
_private[itemName][id] = undefined;
});
};
//int repetitive stuff (get and sets)
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
var name = upperFirst(itemName);
- self['set' + name] = function(lObject, scopeId) {
+ self['set' + name] = function (lObject, scopeId) {
var defer = getUnresolvedDefer(_private[itemName], scopeId);
defer.resolve(lObject);
setResolvedDefer(_private[itemName], scopeId);
};
- self['get' + name] = function(scopeId) {
+ self['get' + name] = function (scopeId) {
var defer = getDefer(_private[itemName], scopeId);
return defer.promise;
};
@@ -523,7 +523,7 @@ angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafl
}]);
angular.module('leaflet-directive')
-.service('leafletDirectiveControlsHelpers', ["$log", "leafletData", "leafletHelpers", function($log, leafletData, leafletHelpers) {
+.service('leafletDirectiveControlsHelpers', ["$log", "leafletData", "leafletHelpers", function ($log, leafletData, leafletHelpers) {
var _isDefined = leafletHelpers.isDefined;
var _isString = leafletHelpers.isString;
var _isObject = leafletHelpers.isObject;
@@ -531,7 +531,7 @@ angular.module('leaflet-directive')
var _errorHeader = _mainErrorHeader + '[leafletDirectiveControlsHelpers';
- var _extend = function(id, thingToAddName, createFn, cleanFn) {
+ var _extend = function (id, thingToAddName, createFn, cleanFn) {
var _fnHeader = _errorHeader + '.extend] ';
var extender = {};
if (!_isDefined(thingToAddName)) {
@@ -552,7 +552,7 @@ angular.module('leaflet-directive')
}
//add external control to create / destroy markers without a watch
- leafletData.getDirectiveControls().then(function(controls) {
+ leafletData.getDirectiveControls().then(function (controls) {
angular.extend(controls, extender);
leafletData.setDirectiveControls(controls, id);
});
@@ -564,16 +564,16 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.service('leafletGeoJsonHelpers', ["leafletHelpers", "leafletIterators", function(leafletHelpers, leafletIterators) {
+.service('leafletGeoJsonHelpers', ["leafletHelpers", "leafletIterators", function (leafletHelpers, leafletIterators) {
var lHlp = leafletHelpers;
var lIt = leafletIterators;
- var Point = function(lat, lng) {
+ var Point = function (lat, lng) {
this.lat = lat;
this.lng = lng;
return this;
};
- var _getLat = function(value) {
+ var _getLat = function (value) {
if (Array.isArray(value) && value.length === 2) {
return value[1];
} else if (lHlp.isDefined(value.type) && value.type === 'Point') {
@@ -583,7 +583,7 @@ angular.module('leaflet-directive')
}
};
- var _getLng = function(value) {
+ var _getLng = function (value) {
if (Array.isArray(value) && value.length === 2) {
return value[0];
} else if (lHlp.isDefined(value.type) && value.type === 'Point') {
@@ -593,7 +593,7 @@ angular.module('leaflet-directive')
}
};
- var _validateCoords = function(coords) {
+ var _validateCoords = function (coords) {
if (lHlp.isUndefined(coords)) {
return false;
}
@@ -612,14 +612,14 @@ angular.module('leaflet-directive')
}
}
- var ret = lIt.all(['lat', 'lng'], function(pos) {
+ var ret = lIt.all(['lat', 'lng'], function (pos) {
return lHlp.isDefined(coords[pos]) && lHlp.isNumber(coords[pos]);
});
return ret;
};
- var _getCoords = function(value) {
+ var _getCoords = function (value) {
if (!value || !_validateCoords(value)) {
return;
}
@@ -645,7 +645,7 @@ angular.module('leaflet-directive')
};
}]);
-angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", function($q, $log) {
+angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", function ($q, $log) {
var _errorHeader = '[AngularJS - Leaflet] ';
var _copy = angular.copy;
var _clone = _copy;
@@ -662,7 +662,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
_getObjectValue(obj,"bike.1") returns 'hi'
this is getPath in ui-gmap
*/
- var _getObjectValue = function(object, pathStr) {
+ var _getObjectValue = function (object, pathStr) {
var obj;
if (!object || !angular.isObject(object))
return;
@@ -673,7 +673,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
obj = object;
- pathStr.split('.').forEach(function(value) {
+ pathStr.split('.').forEach(function (value) {
if (obj) {
obj = obj[value];
}
@@ -688,8 +688,8 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
returns:
'bike["one"]["two"]'
*/
- var _getObjectArrayPath = function(pathStr) {
- return pathStr.split('.').reduce(function(previous, current) {
+ var _getObjectArrayPath = function (pathStr) {
+ return pathStr.split('.').reduce(function (previous, current) {
return previous + '["' + current + '"]';
});
};
@@ -699,8 +699,8 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
returns:
"bike.one.two"
*/
- var _getObjectDotPath = function(arrayOfStrings) {
- return arrayOfStrings.reduce(function(previous, current) {
+ var _getObjectDotPath = function (arrayOfStrings) {
+ return arrayOfStrings.reduce(function (previous, current) {
return previous + '.' + current;
});
};
@@ -744,11 +744,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
return defer;
}
- var _isDefined = function(value) {
+ var _isDefined = function (value) {
return angular.isDefined(value) && value !== null;
};
- var _isUndefined = function(value) {
+ var _isUndefined = function (value) {
return !_isDefined(value);
};
@@ -766,8 +766,8 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
@param name Name to normalize
*/
- var camelCase = function(name) {
- return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ var camelCase = function (name) {
+ return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
if (offset) {
return letter.toUpperCase();
} else {
@@ -781,7 +781,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
@param name Name to normalize
*/
- var directiveNormalize = function(name) {
+ var directiveNormalize = function (name) {
return camelCase(name.replace(PREFIX_REGEXP, ''));
};
@@ -796,22 +796,22 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
getObjectValue: _getObjectValue,
getObjectArrayPath:_getObjectArrayPath,
getObjectDotPath: _getObjectDotPath,
- defaultTo: function(val, _default) {
+ defaultTo: function (val, _default) {
return _isDefined(val) ? val : _default;
},
//mainly for checking attributes of directives lets keep this minimal (on what we accept)
- isTruthy: function(val) {
+ isTruthy: function (val) {
return val === 'true' || val === true;
},
//Determine if a reference is {}
- isEmpty: function(value) {
+ isEmpty: function (value) {
return Object.keys(value).length === 0;
},
//Determine if a reference is undefined or {}
- isUndefinedOrEmpty: function(value) {
+ isUndefinedOrEmpty: function (value) {
return (angular.isUndefined(value) || value === null) || Object.keys(value).length === 0;
},
@@ -825,12 +825,12 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
isFunction: angular.isFunction,
equals: angular.equals,
- isValidCenter: function(center) {
+ isValidCenter: function (center) {
return angular.isDefined(center) && angular.isNumber(center.lat) &&
angular.isNumber(center.lng) && angular.isNumber(center.zoom);
},
- isValidPoint: function(point) {
+ isValidPoint: function (point) {
if (!angular.isDefined(point)) {
return false;
}
@@ -842,7 +842,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
return angular.isNumber(point.lat) && angular.isNumber(point.lng);
},
- isSameCenterOnMap: function(centerModel, map) {
+ isSameCenterOnMap: function (centerModel, map) {
var mapCenter = map.getCenter();
var zoom = map.getZoom();
if (centerModel.lat && centerModel.lng &&
@@ -855,7 +855,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
return false;
},
- safeApply: function($scope, fn) {
+ safeApply: function ($scope, fn) {
var phase = $scope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
$scope.$eval(fn);
@@ -866,7 +866,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
obtainEffectiveMapId: _obtainEffectiveMapId,
- getDefer: function(d, mapId) {
+ getDefer: function (d, mapId) {
var id = _obtainEffectiveMapId(d, mapId);
var defer;
if (!angular.isDefined(d[id]) || d[id].resolvedDefer === false) {
@@ -880,35 +880,35 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
getUnresolvedDefer: _getUnresolvedDefer,
- setResolvedDefer: function(d, mapId) {
+ setResolvedDefer: function (d, mapId) {
var id = _obtainEffectiveMapId(d, mapId);
d[id].resolvedDefer = true;
},
- rangeIsSupported: function() {
+ rangeIsSupported: function () {
var testrange = document.createElement('input');
testrange.setAttribute('type', 'range');
return testrange.type === 'range';
},
FullScreenControlPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Control.Fullscreen);
},
},
MiniMapControlPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Control.MiniMap);
},
},
AwesomeMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.AwesomeMarkers) && angular.isDefined(L.AwesomeMarkers.Icon);
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.AwesomeMarkers.Icon;
} else {
@@ -916,7 +916,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -930,11 +930,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
VectorMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.VectorMarkers) && angular.isDefined(L.VectorMarkers.Icon);
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.VectorMarkers.Icon;
} else {
@@ -942,7 +942,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -956,7 +956,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
DomMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.DomMarkers) && angular.isDefined(L.DomMarkers.Icon)) {
return true;
} else {
@@ -964,7 +964,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.DomMarkers.Icon;
} else {
@@ -972,7 +972,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -986,7 +986,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
PolylineDecoratorPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.PolylineDecorator)) {
return true;
} else {
@@ -994,7 +994,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(decoration) {
+ is: function (decoration) {
if (this.isLoaded()) {
return decoration instanceof L.PolylineDecorator;
} else {
@@ -1002,7 +1002,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(decorationA, decorationB) {
+ equal: function (decorationA, decorationB) {
if (!this.isLoaded()) {
return false;
}
@@ -1016,7 +1016,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
MakiMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.MakiMarkers) && angular.isDefined(L.MakiMarkers.Icon)) {
return true;
} else {
@@ -1024,7 +1024,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.MakiMarkers.Icon;
} else {
@@ -1032,7 +1032,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -1045,7 +1045,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
ExtraMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.ExtraMarkers) && angular.isDefined(L.ExtraMarkers.Icon)) {
return true;
} else {
@@ -1053,7 +1053,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.ExtraMarkers.Icon;
} else {
@@ -1061,7 +1061,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -1074,11 +1074,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
LabelPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Label);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.MarkerClusterGroup;
} else {
@@ -1087,11 +1087,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
MarkerClusterPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.MarkerClusterGroup);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.MarkerClusterGroup;
} else {
@@ -1100,11 +1100,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
GoogleLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Google);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.Google;
} else {
@@ -1113,11 +1113,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
LeafletProviderPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.Provider);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.Provider;
} else {
@@ -1126,26 +1126,26 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
ChinaLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.tileLayer.chinaProvider);
},
},
HeatLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.heatLayer);
},
},
WebGLHeatMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.WebGLHeatMap);
},
},
BingLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.BingLayer);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.BingLayer;
} else {
@@ -1154,11 +1154,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
WFSLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.GeoJSON.WFS !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.GeoJSON.WFS;
} else {
@@ -1167,11 +1167,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSBaseLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.basemapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.basemapLayer;
} else {
@@ -1180,11 +1180,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return lvector !== undefined && lvector.AGS !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof lvector.AGS;
} else {
@@ -1193,11 +1193,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSFeatureLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.featureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.featureLayer;
} else {
@@ -1206,11 +1206,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSTiledMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.tiledMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.tiledMapLayer;
} else {
@@ -1219,11 +1219,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSDynamicMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.dynamicMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.dynamicMapLayer;
} else {
@@ -1232,11 +1232,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSImageMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.imageMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.imageMapLayer;
} else {
@@ -1245,11 +1245,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSClusteredLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.clusteredFeatureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.clusteredFeatureLayer;
} else {
@@ -1258,11 +1258,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSHeatmapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.heatmapFeatureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.heatmapFeatureLayer;
} else {
@@ -1271,11 +1271,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
YandexLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Yandex);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.Yandex;
} else {
@@ -1284,11 +1284,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
GeoJSONPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.GeoJSON);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.GeoJSON;
} else {
@@ -1297,11 +1297,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
UTFGridPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.UtfGrid);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.UtfGrid;
} else {
@@ -1311,11 +1311,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
CartoDB: {
- isLoaded: function() {
+ isLoaded: function () {
return cartodb;
},
- is: function(/*layer*/) {
+ is: function (/*layer*/) {
return true;
/*
if (this.isLoaded()) {
@@ -1327,11 +1327,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
Leaflet: {
DivIcon: {
- is: function(icon) {
+ is: function (icon) {
return icon instanceof L.DivIcon;
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
@@ -1340,11 +1340,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
Icon: {
- is: function(icon) {
+ is: function (icon) {
return icon instanceof L.Icon;
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
@@ -1376,7 +1376,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
};
}]);
-angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafletHelpers", function($log, leafletHelpers) {
+angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafletHelpers", function ($log, leafletHelpers) {
var lHlp = leafletHelpers;
var errorHeader = leafletHelpers.errorHeader + 'leafletIterators: ';
@@ -1391,18 +1391,18 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
- var _isArrayLike = function(collection) {
+ var _isArrayLike = function (collection) {
var length = collection !== null && collection.length;
return lHlp.isNumber(length) && length >= 0 && length <= MAX_ARRAY_INDEX;
};
// Keep the identity function around for default iteratees.
- var _identity = function(value) {
+ var _identity = function (value) {
return value;
};
- var _property = function(key) {
- return function(obj) {
+ var _property = function (key) {
+ return function (obj) {
return obj === null ? void 0 : obj[key];
};
};
@@ -1410,33 +1410,33 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
- var optimizeCb = function(func, context, argCount) {
+ var optimizeCb = function (func, context, argCount) {
if (context === void 0) return func;
switch (argCount === null ? 3 : argCount) {
- case 1: return function(value) {
+ case 1: return function (value) {
return func.call(context, value);
};
- case 2: return function(value, other) {
+ case 2: return function (value, other) {
return func.call(context, value, other);
};
- case 3: return function(value, index, collection) {
+ case 3: return function (value, index, collection) {
return func.call(context, value, index, collection);
};
- case 4: return function(accumulator, value, index, collection) {
+ case 4: return function (accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
- return function() {
+ return function () {
return func.apply(context, arguments);
};
};
// An internal function for creating assigner functions.
- var createAssigner = function(keysFunc, undefinedOnly) {
- return function(obj) {
+ var createAssigner = function (keysFunc, undefinedOnly) {
+ return function (obj) {
var length = arguments.length;
if (length < 2 || obj === null) return obj;
for (var index = 1; index < length; index++) {
@@ -1461,7 +1461,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
_extendOwn = _assign = createAssigner(_keys);
// Returns whether an object has a given set of `key:value` pairs.
- var _isMatch = function(object, attrs) {
+ var _isMatch = function (object, attrs) {
var keys = _keys(attrs);
var length = keys.length;
if (object === null) return !length;
@@ -1478,9 +1478,9 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// `key:value` pairs.
var _matcher;
var _matches = null;
- _matcher = _matches = function(attrs) {
+ _matcher = _matches = function (attrs) {
attrs = _extendOwn({}, attrs);
- return function(obj) {
+ return function (obj) {
return _isMatch(obj, attrs);
};
};
@@ -1488,7 +1488,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// A mostly-internal function to generate callbacks that can be applied
// to each element in a collection, returning the desired result — either
// identity, an arbitrary callback, a property matcher, or a property accessor.
- var cb = function(value, context, argCount) {
+ var cb = function (value, context, argCount) {
if (value === null) return _identity;
if (_isFunction(value)) return optimizeCb(value, context, argCount);
if (_isObject(value)) return _matcher(value);
@@ -1497,7 +1497,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
var _every;
var _all = null;
- _every = _all = function(obj, predicate, context) {
+ _every = _all = function (obj, predicate, context) {
predicate = cb(predicate, context);
var keys = !_isArrayLike(obj) && _keys(obj);
var length = (keys || obj).length;
@@ -1511,7 +1511,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
//END COPY fron underscore
- var _hasErrors = function(collection, cb, ignoreCollection, cbName) {
+ var _hasErrors = function (collection, cb, ignoreCollection, cbName) {
if (!ignoreCollection) {
if (!lHlp.isDefined(collection) || !lHlp.isDefined(cb)) {
return true;
@@ -1527,7 +1527,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
return false;
};
- var _iterate = function(collection, externalCb, internalCb) {
+ var _iterate = function (collection, externalCb, internalCb) {
if (_hasErrors(undefined, internalCb, true, 'internalCb')) {
return;
}
@@ -1543,8 +1543,8 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
//see http://jsperf.com/iterators/3
//utilizing for in is way faster
- var _each = function(collection, cb) {
- _iterate(collection, cb, function(val, key) {
+ var _each = function (collection, cb) {
+ _iterate(collection, cb, function (val, key) {
cb(val, key);
});
};
@@ -1558,7 +1558,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
}]);
angular.module('leaflet-directive')
-.factory('leafletLayerHelpers', ["$rootScope", "$log", "$q", "leafletHelpers", "leafletIterators", function($rootScope, $log, $q, leafletHelpers, leafletIterators) {
+.factory('leafletLayerHelpers', ["$rootScope", "$log", "$q", "leafletHelpers", "leafletIterators", function ($rootScope, $log, $q, leafletHelpers, leafletIterators) {
var Helpers = leafletHelpers;
var isString = leafletHelpers.isString;
var isObject = leafletHelpers.isObject;
@@ -1567,7 +1567,7 @@ angular.module('leaflet-directive')
var errorHeader = leafletHelpers.errorHeader;
var $it = leafletIterators;
- var utfGridCreateLayer = function(params) {
+ var utfGridCreateLayer = function (params) {
if (!Helpers.UTFGridPlugin.isLoaded()) {
$log.error('[AngularJS - Leaflet] The UTFGrid plugin is not loaded.');
return;
@@ -1575,19 +1575,19 @@ angular.module('leaflet-directive')
var utfgrid = new L.UtfGrid(params.url, params.pluginOptions);
- utfgrid.on('mouseover', function(e) {
+ utfgrid.on('mouseover', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMouseover', e);
});
- utfgrid.on('mouseout', function(e) {
+ utfgrid.on('mouseout', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMouseout', e);
});
- utfgrid.on('click', function(e) {
+ utfgrid.on('click', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridClick', e);
});
- utfgrid.on('mousemove', function(e) {
+ utfgrid.on('mousemove', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMousemove', e);
});
@@ -1597,13 +1597,13 @@ angular.module('leaflet-directive')
var layerTypes = {
xyz: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer(params.url, params.options);
},
},
mapbox: {
mustHaveKey: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var version = 3;
if (isDefined(params.options.version) && params.options.version === 4) {
version = params.options.version;
@@ -1617,7 +1617,7 @@ angular.module('leaflet-directive')
},
geoJSON: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.GeoJSONPlugin.isLoaded()) {
return;
}
@@ -1627,27 +1627,27 @@ angular.module('leaflet-directive')
},
geoJSONShape: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.GeoJSON(params.data,
params.options);
},
},
geoJSONAwesomeMarker: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.geoJson(params.data, {
- pointToLayer: function(feature, latlng) {
- return L.marker(latlng, {icon: L.AwesomeMarkers.icon(params.icon)});
+ pointToLayer: function (feature, latlng) {
+ return L.marker(latlng, { icon: L.AwesomeMarkers.icon(params.icon) });
},
});
},
},
geoJSONVectorMarker: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.geoJson(params.data, {
- pointToLayer: function(feature, latlng) {
- return L.marker(latlng, {icon: L.VectorMarkers.icon(params.icon)});
+ pointToLayer: function (feature, latlng) {
+ return L.marker(latlng, { icon: L.VectorMarkers.icon(params.icon) });
},
});
},
@@ -1658,7 +1658,7 @@ angular.module('leaflet-directive')
},
cartodbTiles: {
mustHaveKey: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/{z}/{x}/{y}.png';
return L.tileLayer(url, params.options);
},
@@ -1666,7 +1666,7 @@ angular.module('leaflet-directive')
cartodbUTFGrid: {
mustHaveKey: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
params.url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/' + params.layer + '/{z}/{x}/{y}.grid.json';
return utfGridCreateLayer(params);
},
@@ -1674,7 +1674,7 @@ angular.module('leaflet-directive')
cartodbInteractive: {
mustHaveKey: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var tilesURL = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/{z}/{x}/{y}.png';
var tileLayer = L.tileLayer(tilesURL, params.options);
params.url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/' + params.layer + '/{z}/{x}/{y}.grid.json';
@@ -1684,20 +1684,20 @@ angular.module('leaflet-directive')
},
wms: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.wms(params.url, params.options);
},
},
wmts: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.wmts(params.url, params.options);
},
},
wfs: {
mustHaveUrl: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.WFSLayerPlugin.isLoaded()) {
return;
}
@@ -1713,13 +1713,13 @@ angular.module('leaflet-directive')
},
group: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var lyrs = [];
- $it.each(params.options.layers, function(l) {
+ $it.each(params.options.layers, function (l) {
lyrs.push(createLayer(l));
});
- params.options.loadedDefer = function() {
+ params.options.loadedDefer = function () {
var defers = [];
if (isDefined(params.options.layers)) {
for (var i = 0; i < params.options.layers.length; i++) {
@@ -1738,13 +1738,13 @@ angular.module('leaflet-directive')
},
featureGroup: {
mustHaveUrl: false,
- createLayer: function() {
+ createLayer: function () {
return L.featureGroup();
},
},
google: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var type = params.type || 'SATELLITE';
if (!Helpers.GoogleLayerPlugin.isLoaded()) {
return;
@@ -1755,7 +1755,7 @@ angular.module('leaflet-directive')
},
here: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var provider = params.provider || 'HERE.terrainDay';
if (!Helpers.LeafletProviderPlugin.isLoaded()) {
return;
@@ -1766,7 +1766,7 @@ angular.module('leaflet-directive')
},
china:{
mustHaveUrl:false,
- createLayer:function(params) {
+ createLayer:function (params) {
var type = params.type || '';
if (!Helpers.ChinaLayerPlugin.isLoaded()) {
return;
@@ -1777,7 +1777,7 @@ angular.module('leaflet-directive')
},
agsBase: {
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSBaseLayerPlugin.isLoaded()) {
return;
}
@@ -1787,7 +1787,7 @@ angular.module('leaflet-directive')
},
ags: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSLayerPlugin.isLoaded()) {
return;
}
@@ -1797,11 +1797,11 @@ angular.module('leaflet-directive')
url: params.url,
});
var layer = new lvector.AGS(options);
- layer.onAdd = function(map) {
+ layer.onAdd = function (map) {
this.setMap(map);
};
- layer.onRemove = function() {
+ layer.onRemove = function () {
this.setMap(null);
};
@@ -1810,7 +1810,7 @@ angular.module('leaflet-directive')
},
agsFeature: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSFeatureLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1819,13 +1819,13 @@ angular.module('leaflet-directive')
params.options.url = params.url;
var layer = L.esri.featureLayer(params.options);
- var load = function() {
+ var load = function () {
if (isDefined(params.options.loadedDefer)) {
params.options.loadedDefer.resolve();
}
};
- layer.on('loading', function() {
+ layer.on('loading', function () {
params.options.loadedDefer = $q.defer();
layer.off('load', load);
layer.on('load', load);
@@ -1836,7 +1836,7 @@ angular.module('leaflet-directive')
},
agsTiled: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSTiledMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1849,7 +1849,7 @@ angular.module('leaflet-directive')
},
agsDynamic: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSDynamicMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1862,7 +1862,7 @@ angular.module('leaflet-directive')
},
agsImage: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSImageMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1875,7 +1875,7 @@ angular.module('leaflet-directive')
},
agsClustered: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSClusteredLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri clustered layer plugin is not loaded.');
return;
@@ -1891,7 +1891,7 @@ angular.module('leaflet-directive')
},
agsHeatmap: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSHeatmapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri heatmap layer plugin is not loaded.');
return;
@@ -1907,7 +1907,7 @@ angular.module('leaflet-directive')
},
markercluster: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.MarkerClusterPlugin.isLoaded()) {
$log.warn(errorHeader + ' The markercluster plugin is not loaded.');
return;
@@ -1918,7 +1918,7 @@ angular.module('leaflet-directive')
},
bing: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.BingLayerPlugin.isLoaded()) {
return;
}
@@ -1929,7 +1929,7 @@ angular.module('leaflet-directive')
webGLHeatmap: {
mustHaveUrl: false,
mustHaveData: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.WebGLHeatMapLayerPlugin.isLoaded()) {
return;
}
@@ -1945,7 +1945,7 @@ angular.module('leaflet-directive')
heat: {
mustHaveUrl: false,
mustHaveData: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.HeatLayerPlugin.isLoaded()) {
return;
}
@@ -1965,7 +1965,7 @@ angular.module('leaflet-directive')
},
yandex: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var type = params.type || 'map';
if (!Helpers.YandexLayerPlugin.isLoaded()) {
return;
@@ -1977,13 +1977,13 @@ angular.module('leaflet-directive')
imageOverlay: {
mustHaveUrl: true,
mustHaveBounds: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.imageOverlay(params.url, params.bounds, params.options);
},
},
iip: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.iip(params.url, params.options);
},
},
@@ -1993,7 +1993,7 @@ angular.module('leaflet-directive')
// so we let user to define their own layer outside the directive,
// and pass it on "createLayer" result for next processes
custom: {
- createLayer: function(params) {
+ createLayer: function (params) {
if (params.layer instanceof L.Class) {
return angular.copy(params.layer);
} else {
@@ -2003,7 +2003,7 @@ angular.module('leaflet-directive')
},
cartodb: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return cartodb.createLayer(params.map, params.url);
},
},
@@ -2016,35 +2016,39 @@ angular.module('leaflet-directive')
return false;
}
- if (Object.keys(layerTypes).indexOf(layerDefinition.type) === -1) {
- $log.error('[AngularJS - Leaflet] A layer must have a valid type: ' + Object.keys(layerTypes));
- return false;
- }
+ // One of the known types
+ if (Object.keys(layerTypes).indexOf(layerDefinition.type) !== -1) {
- // Check if the layer must have an URL
- if (layerTypes[layerDefinition.type].mustHaveUrl && !isString(layerDefinition.url)) {
- $log.error('[AngularJS - Leaflet] A base layer must have an url');
- return false;
- }
+ // Check if the layer must have an URL
+ if (layerTypes[layerDefinition.type].mustHaveUrl && !isString(layerDefinition.url)) {
+ $log.error('[AngularJS - Leaflet] A base layer must have an url');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveData && !isDefined(layerDefinition.data)) {
- $log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveData && !isDefined(layerDefinition.data)) {
+ $log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveLayer && !isDefined(layerDefinition.layer)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have an layer defined');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveLayer && !isDefined(layerDefinition.layer)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have an layer defined');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveBounds && !isDefined(layerDefinition.bounds)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have bounds defined');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveBounds && !isDefined(layerDefinition.bounds)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have bounds defined');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveKey && !isDefined(layerDefinition.key)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have key defined');
- return false;
+ if (layerTypes[layerDefinition.type].mustHaveKey && !isDefined(layerDefinition.key)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have key defined');
+ return false;
+ }
+ } else {
+ // Type unknown at build time
+ if (typeof L.tileLayer[layerDefinition.type] !== 'function') {
+ return false;
+ }
}
return true;
@@ -2089,7 +2093,8 @@ angular.module('leaflet-directive')
};
//TODO Add $watch to the layer properties
- return layerTypes[layerDefinition.type].createLayer(params);
+ if (layerTypes[layerDefinition.type]) return layerTypes[layerDefinition.type].createLayer(params);
+ return L.tileLayer[layerDefinition.type](params.url, params.options);
}
function safeAddLayer(map, layer) {
@@ -2107,7 +2112,7 @@ angular.module('leaflet-directive')
$log.debug('Loaded Deferred', defers);
var count = defers.length;
if (count > 0) {
- var resolve = function() {
+ var resolve = function () {
count--;
if (count === 0) {
map.removeLayer(layer);
@@ -2121,7 +2126,7 @@ angular.module('leaflet-directive')
map.removeLayer(layer);
}
} else {
- layerOptions.loadedDefer.promise.then(function() {
+ layerOptions.loadedDefer.promise.then(function () {
map.removeLayer(layer);
});
}
@@ -2137,8 +2142,8 @@ angular.module('leaflet-directive')
};
}]);
-angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
- var _updateLegend = function(div, legendData, type, url) {
+angular.module('leaflet-directive').factory('leafletLegendHelpers', function () {
+ var _updateLegend = function (div, legendData, type, url) {
div.innerHTML = '';
if (legendData.error) {
div.innerHTML += '' + legendData.error.message + '
';
@@ -2160,8 +2165,8 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
}
};
- var _getOnAddLegend = function(legendData, legendClass, type, url) {
- return function(/*map*/) {
+ var _getOnAddLegend = function (legendData, legendClass, type, url) {
+ return function (/*map*/) {
var div = L.DomUtil.create('div', legendClass);
if (!L.Browser.touch) {
@@ -2176,8 +2181,8 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
};
};
- var _getOnAddArrayLegend = function(legend, legendClass) {
- return function(/*map*/) {
+ var _getOnAddArrayLegend = function (legend, legendClass) {
+ return function (/*map*/) {
var div = L.DomUtil.create('div', legendClass);
for (var i = 0; i < legend.colors.length; i++) {
div.innerHTML +=
@@ -2203,7 +2208,7 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
};
});
-angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafletHelpers", function($q, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafletHelpers", function ($q, leafletHelpers) {
function _getDefaults() {
return {
keyboard: true,
@@ -2252,16 +2257,16 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafle
// Get the _defaults dictionary, and override the properties defined by the user
return {
- reset: function() {
+ reset: function () {
defaults = {};
},
- getDefaults: function(scopeId) {
+ getDefaults: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
return defaults[mapId];
},
- getMapCreationDefaults: function(scopeId) {
+ getMapCreationDefaults: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
var d = defaults[mapId];
@@ -2304,7 +2309,7 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafle
return mapDefaults;
},
- setDefaults: function(userDefaults, scopeId) {
+ setDefaults: function (userDefaults, scopeId) {
var newDefaults = _getDefaults();
if (isDefined(userDefaults)) {
@@ -2378,7 +2383,7 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafle
};
}]);
-angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScope", "$timeout", "leafletHelpers", "$log", "$compile", "leafletGeoJsonHelpers", function($rootScope, $timeout, leafletHelpers, $log, $compile, leafletGeoJsonHelpers) {
+angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScope", "$timeout", "leafletHelpers", "$log", "$compile", "leafletGeoJsonHelpers", function ($rootScope, $timeout, leafletHelpers, $log, $compile, leafletGeoJsonHelpers) {
var isDefined = leafletHelpers.isDefined;
var defaultTo = leafletHelpers.defaultTo;
var MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin;
@@ -2396,22 +2401,22 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
var geoHlp = leafletGeoJsonHelpers;
var errorHeader = leafletHelpers.errorHeader;
- var _string = function(marker) {
+ var _string = function (marker) {
//this exists since JSON.stringify barfs on cyclic
var retStr = '';
- ['_icon', '_latlng', '_leaflet_id', '_map', '_shadow'].forEach(function(prop) {
+ ['_icon', '_latlng', '_leaflet_id', '_map', '_shadow'].forEach(function (prop) {
retStr += prop + ': ' + defaultTo(marker[prop], 'undefined') + ' \n';
});
return '[leafletMarker] : \n' + retStr;
};
- var _log = function(marker, useConsole) {
+ var _log = function (marker, useConsole) {
var logger = useConsole ? console : $log;
logger.debug(_string(marker));
};
- var createLeafletIcon = function(iconData) {
+ var createLeafletIcon = function (iconData) {
if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'awesomeMarker') {
if (!AwesomeMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The AwesomeMarkers Plugin is not loaded.');
@@ -2466,7 +2471,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
if (isDefined(iconData) && isDefined(iconData.type)) {
- return new L.Icon[iconData.type](iconData)
+ return new L.Icon[iconData.type](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==';
@@ -2486,17 +2491,17 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return new L.Icon(iconData);
};
- var _resetMarkerGroup = function(groupName) {
+ var _resetMarkerGroup = function (groupName) {
if (isDefined(groups[groupName])) {
groups.splice(groupName, 1);
}
};
- var _resetMarkerGroups = function() {
+ var _resetMarkerGroups = function () {
groups = {};
};
- var _deleteMarker = function(marker, map, layers) {
+ var _deleteMarker = function (marker, map, layers) {
marker.closePopup();
// There is no easy way to know if a marker is added to a layer, so we search for it
@@ -2525,7 +2530,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var adjustPopupPan = function(marker, map) {
+ var adjustPopupPan = function (marker, map) {
var containerHeight = marker._popup._container.offsetHeight;
var layerPos = new L.Point(marker._popup._containerLeft, -containerHeight - marker._popup._containerBottom);
var containerPos = map.layerPointToContainerPoint(layerPos);
@@ -2534,18 +2539,18 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var compilePopup = function(marker, markerScope) {
+ var compilePopup = function (marker, markerScope) {
$compile(marker._popup._contentNode)(markerScope);
};
- var updatePopup = function(marker, markerScope, map) {
+ var updatePopup = function (marker, markerScope, map) {
//The innerText should be more than 1 once angular has compiled.
//We need to keep trying until angular has compiled before we _updateLayout and _updatePosition
//This should take care of any scenario , eg ngincludes, whatever.
//Is there a better way to check for this?
var innerText = marker._popup._contentNode.innerText || marker._popup._contentNode.textContent;
if (innerText.length < 1) {
- $timeout(function() {
+ $timeout(function () {
updatePopup(marker, markerScope, map);
});
}
@@ -2564,7 +2569,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return reflow;
};
- var _manageOpenPopup = function(marker, markerData, map) {
+ var _manageOpenPopup = function (marker, markerData, map) {
// The marker may provide a scope returning function used to compile the message
// default to $rootScope otherwise
var markerScope = angular.isFunction(markerData.getMessageScope) ? markerData.getMessageScope() : $rootScope;
@@ -2581,7 +2586,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var _manageOpenLabel = function(marker, markerData) {
+ var _manageOpenLabel = function (marker, markerData) {
var markerScope = angular.isFunction(markerData.getMessageScope) ? markerData.getMessageScope() : $rootScope;
var labelScope = angular.isFunction(markerData.getLabelScope) ? markerData.getLabelScope() : markerScope;
var compileMessage = isDefined(markerData.compileMessage) ? markerData.compileMessage : true;
@@ -2597,7 +2602,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var _updateMarker = function(markerData, oldMarkerData, marker, name, leafletScope, layers, map) {
+ var _updateMarker = function (markerData, oldMarkerData, marker, name, leafletScope, layers, map) {
if (!isDefined(oldMarkerData)) {
return;
}
@@ -2835,7 +2840,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
manageOpenLabel: _manageOpenLabel,
- createMarker: function(markerData) {
+ createMarker: function (markerData) {
if (!isDefined(markerData) || !geoHlp.validateCoords(markerData)) {
$log.error(errorHeader + 'The marker definition is not valid.');
return;
@@ -2874,7 +2879,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return marker;
},
- addMarkerToGroup: function(marker, groupName, groupOptions, map) {
+ addMarkerToGroup: function (marker, groupName, groupOptions, map) {
if (!isString(groupName)) {
$log.error(errorHeader + 'The marker group you have specified is invalid.');
return;
@@ -2893,9 +2898,9 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
groups[groupName].addLayer(marker);
},
- listenMarkerEvents: function(marker, markerData, leafletScope, doWatch, map) {
- marker.on('popupopen', function(/* event */) {
- safeApply(leafletScope, function() {
+ listenMarkerEvents: function (marker, markerData, leafletScope, doWatch, map) {
+ marker.on('popupopen', function (/* event */) {
+ safeApply(leafletScope, function () {
if (isDefined(marker._popup) || isDefined(marker._popup._contentNode)) {
markerData.focus = true;
_manageOpenPopup(marker, markerData, map);//needed since markerData is now a copy
@@ -2903,14 +2908,14 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
});
});
- marker.on('popupclose', function(/* event */) {
- safeApply(leafletScope, function() {
+ marker.on('popupclose', function (/* event */) {
+ safeApply(leafletScope, function () {
markerData.focus = false;
});
});
- marker.on('add', function(/* event */) {
- safeApply(leafletScope, function() {
+ marker.on('add', function (/* event */) {
+ safeApply(leafletScope, function () {
if ('label' in markerData)
_manageOpenLabel(marker, markerData);
});
@@ -2919,11 +2924,11 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
updateMarker: _updateMarker,
- addMarkerWatcher: function(marker, name, leafletScope, layers, map, isDeepWatch) {
+ addMarkerWatcher: function (marker, name, leafletScope, layers, map, isDeepWatch) {
var markerWatchPath = Helpers.getObjectArrayPath('markers.' + name);
isDeepWatch = defaultTo(isDeepWatch, true);
- var clearWatch = leafletScope.$watch(markerWatchPath, function(markerData, oldMarkerData) {
+ var clearWatch = leafletScope.$watch(markerWatchPath, function (markerData, oldMarkerData) {
if (!isDefined(markerData)) {
_deleteMarker(marker, map, layers);
clearWatch();
@@ -2939,7 +2944,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
};
}]);
-angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope", "$log", "leafletHelpers", function($rootScope, $log, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope", "$log", "leafletHelpers", function ($rootScope, $log, leafletHelpers) {
var isDefined = leafletHelpers.isDefined;
var isArray = leafletHelpers.isArray;
var isNumber = leafletHelpers.isNumber;
@@ -2957,9 +2962,9 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
'smoothFactor', 'noClip',
];
function _convertToLeafletLatLngs(latlngs) {
- return latlngs.filter(function(latlng) {
+ return latlngs.filter(function (latlng) {
return isValidPoint(latlng);
- }).map(function(latlng) {
+ }).map(function (latlng) {
return _convertToLeafletLatLng(latlng);
});
}
@@ -2973,7 +2978,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
}
function _convertToLeafletMultiLatLngs(paths) {
- return paths.map(function(latlngs) {
+ return paths.map(function (latlngs) {
return _convertToLeafletLatLngs(latlngs);
});
}
@@ -2993,7 +2998,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return options;
}
- var _updatePathOptions = function(path, data) {
+ var _updatePathOptions = function (path, data) {
var updatedStyle = {};
for (var i = 0; i < availableOptions.length; i++) {
var optionName = availableOptions[i];
@@ -3005,7 +3010,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
path.setStyle(data);
};
- var _isValidPolyline = function(latlngs) {
+ var _isValidPolyline = function (latlngs) {
if (!isArray(latlngs)) {
return false;
}
@@ -3022,23 +3027,23 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
var pathTypes = {
polyline: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
return _isValidPolyline(latlngs);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Polyline([], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
multiPolyline: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs)) {
return false;
@@ -3054,34 +3059,34 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.multiPolyline([[[0, 0], [1, 1]]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletMultiLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
polygon: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
return _isValidPolyline(latlngs);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Polygon([], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
multiPolygon: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs)) {
@@ -3098,18 +3103,18 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.MultiPolygon([[[0, 0], [1, 1], [0, 1]]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletMultiLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
rectangle: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs) || latlngs.length !== 2) {
@@ -3126,26 +3131,26 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Rectangle([[0, 0], [1, 1]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setBounds(new L.LatLngBounds(_convertToLeafletLatLngs(data.latlngs)));
_updatePathOptions(path, data);
},
},
circle: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var point = pathData.latlngs;
return isValidPoint(point) && isNumber(pathData.radius);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Circle([0, 0], 1, options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLng(_convertToLeafletLatLng(data.latlngs));
if (isDefined(data.radius)) {
path.setRadius(data.radius);
@@ -3155,16 +3160,16 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
},
},
circleMarker: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var point = pathData.latlngs;
return isValidPoint(point) && isNumber(pathData.radius);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.CircleMarker([0, 0], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLng(_convertToLeafletLatLng(data.latlngs));
if (isDefined(data.radius)) {
path.setRadius(data.radius);
@@ -3175,7 +3180,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
},
};
- var _getPathData = function(path) {
+ var _getPathData = function (path) {
var pathData = {};
if (path.latlngs) {
pathData.latlngs = path.latlngs;
@@ -3189,7 +3194,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
};
return {
- setPathOptions: function(leafletPath, pathType, data) {
+ setPathOptions: function (leafletPath, pathType, data) {
if (!isDefined(pathType)) {
pathType = 'polyline';
}
@@ -3197,7 +3202,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
pathTypes[pathType].setPath(leafletPath, data);
},
- createPath: function(name, path, defaults) {
+ createPath: function (name, path, defaults) {
if (!isDefined(path.type)) {
path.type = 'polyline';
}
@@ -3216,11 +3221,11 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
}]);
angular.module('leaflet-directive')
-.service('leafletWatchHelpers', function() {
+.service('leafletWatchHelpers', function () {
- var _maybe = function(scope, watchFunctionName, thingToWatchStr, watchOptions, initCb) {
+ var _maybe = function (scope, watchFunctionName, thingToWatchStr, watchOptions, initCb) {
//watchOptions.isDeep is/should be ignored in $watchCollection
- var unWatch = scope[watchFunctionName](thingToWatchStr, function(newValue, oldValue) {
+ var unWatch = scope[watchFunctionName](thingToWatchStr, function (newValue, oldValue) {
initCb(newValue, oldValue);
if (!watchOptions.doWatch)
unWatch();
@@ -3236,7 +3241,7 @@ angular.module('leaflet-directive')
@param watchOptions - see markersWatchOptions and or derrivatives. This object is used
to set watching to once and its watch depth.
*/
- var _maybeWatch = function(scope, thingToWatchStr, watchOptions, initCb) {
+ var _maybeWatch = function (scope, thingToWatchStr, watchOptions, initCb) {
return _maybe(scope, '$watch', thingToWatchStr, watchOptions, initCb);
};
@@ -3247,7 +3252,7 @@ angular.module('leaflet-directive')
@param watchOptions - see markersWatchOptions and or derrivatives. This object is used
to set watching to once and its watch depth.
*/
- var _maybeWatchCollection = function(scope, thingToWatchStr, watchOptions, initCb) {
+ var _maybeWatchCollection = function (scope, thingToWatchStr, watchOptions, initCb) {
return _maybe(scope, '$watchCollection', thingToWatchStr, watchOptions, initCb);
};
@@ -3257,16 +3262,16 @@ angular.module('leaflet-directive')
};
});
-angular.module('leaflet-directive').factory('nominatimService', ["$q", "$http", "leafletHelpers", "leafletMapDefaults", function($q, $http, leafletHelpers, leafletMapDefaults) {
+angular.module('leaflet-directive').factory('nominatimService', ["$q", "$http", "leafletHelpers", "leafletMapDefaults", function ($q, $http, leafletHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined;
return {
- query: function(address, mapId) {
+ query: function (address, mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
var url = defaults.nominatim.server;
var df = $q.defer();
- $http.get(url, { params: { format: 'json', limit: 1, q: address } }).success(function(data) {
+ $http.get(url, { params: { format: 'json', limit: 1, q: address } }).success(function (data) {
if (data.length > 0 && isDefined(data[0].boundingbox)) {
df.resolve(data[0]);
} else {
@@ -3279,7 +3284,7 @@ angular.module('leaflet-directive').factory('nominatimService', ["$q", "$http",
};
}]);
-angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$http", "leafletHelpers", "nominatimService", "leafletBoundsHelpers", function($log, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
+angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$http", "leafletHelpers", "nominatimService", "leafletBoundsHelpers", function ($log, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
return {
restrict: 'A',
@@ -3287,20 +3292,20 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
replace: false,
require: ['leaflet'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var createLeafletBounds = leafletBoundsHelpers.createLeafletBounds;
var leafletScope = controller[0].getLeafletScope();
var mapController = controller[0];
var errorHeader = leafletHelpers.errorHeader + ' [Bounds] ';
- var emptyBounds = function(bounds) {
+ var emptyBounds = function (bounds) {
return (bounds._southWest.lat === 0 && bounds._southWest.lng === 0 &&
bounds._northEast.lat === 0 && bounds._northEast.lng === 0);
};
- mapController.getMap().then(function(map) {
- leafletScope.$on('boundsChanged', function(event) {
+ mapController.getMap().then(function (map) {
+ leafletScope.$on('boundsChanged', function (event) {
var scope = event.currentScope;
var bounds = map.getBounds();
@@ -3324,28 +3329,28 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
scope.bounds = newScopeBounds;
}
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromLeaflet = false;
});
});
var lastNominatimQuery;
- leafletScope.$watch('bounds', function(bounds) {
+ leafletScope.$watch('bounds', function (bounds) {
if (scope.settingBoundsFromLeaflet)
return;
if (isDefined(bounds.address) && bounds.address !== lastNominatimQuery) {
scope.settingBoundsFromScope = true;
- nominatimService.query(bounds.address, attrs.id).then(function(data) {
+ nominatimService.query(bounds.address, attrs.id).then(function (data) {
var b = data.boundingbox;
var newBounds = [[b[0], b[2]], [b[1], b[3]]];
map.fitBounds(newBounds);
- }, function(errMsg) {
+ }, function (errMsg) {
$log.error(errorHeader + ' ' + errMsg + '.');
});
lastNominatimQuery = bounds.address;
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromScope = false;
});
@@ -3356,7 +3361,7 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
if (leafletBounds && !map.getBounds().equals(leafletBounds)) {
scope.settingBoundsFromScope = true;
map.fitBounds(leafletBounds, bounds.options);
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromScope = false;
});
}
@@ -3369,10 +3374,10 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
var centerDirectiveTypes = ['center', 'lfCenter'];
var centerDirectives = {};
-centerDirectiveTypes.forEach(function(directiveName) {
+centerDirectiveTypes.forEach(function (directiveName) {
centerDirectives[directiveName] = ['$log', '$q', '$location', '$timeout', 'leafletMapDefaults', 'leafletHelpers',
'leafletBoundsHelpers', 'leafletMapEvents',
- function($log, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
+ function ($log, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
leafletBoundsHelpers, leafletMapEvents) {
var isDefined = leafletHelpers.isDefined;
@@ -3384,7 +3389,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
var isUndefinedOrEmpty = leafletHelpers.isUndefinedOrEmpty;
var errorHeader = leafletHelpers.errorHeader;
- var shouldInitializeMapWithBounds = function(bounds, center) {
+ var shouldInitializeMapWithBounds = function (bounds, center) {
return isDefined(bounds) && isValidBounds(bounds) && isUndefinedOrEmpty(center);
};
@@ -3394,18 +3399,18 @@ centerDirectiveTypes.forEach(function(directiveName) {
scope: false,
replace: false,
require: 'leaflet',
- controller: function() {
+ controller: function () {
_leafletCenter = $q.defer();
- this.getCenter = function() {
+ this.getCenter = function () {
return _leafletCenter.promise;
};
},
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var centerModel = leafletScope[directiveName];
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
if (attrs[directiveName].search('-') !== -1) {
@@ -3415,7 +3420,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
} else if (shouldInitializeMapWithBounds(leafletScope.bounds, centerModel)) {
map.fitBounds(leafletBoundsHelpers.createLeafletBounds(leafletScope.bounds), leafletScope.bounds.options);
centerModel = map.getCenter();
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
angular.extend(scope[directiveName], {
lat: map.getCenter().lat,
lng: map.getCenter().lng,
@@ -3424,7 +3429,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
});
});
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
var mapBounds = map.getBounds();
scope.bounds = {
northEast: {
@@ -3448,7 +3453,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
var urlCenterHash;
var mapReady;
if (attrs.urlHashCenter === 'yes') {
- var extractCenterFromUrl = function() {
+ var extractCenterFromUrl = function () {
var search = $location.search();
var centerParam;
if (isDefined(search.c)) {
@@ -3467,7 +3472,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
urlCenterHash = extractCenterFromUrl();
- leafletScope.$on('$locationChangeSuccess', function(event) {
+ leafletScope.$on('$locationChangeSuccess', function (event) {
var scope = event.currentScope;
//$log.debug("updated location...");
@@ -3483,7 +3488,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
});
}
- leafletScope.$watch(directiveName, function(center) {
+ leafletScope.$watch(directiveName, function (center) {
if (leafletScope.settingCenterFromLeaflet)
return;
@@ -3534,18 +3539,18 @@ centerDirectiveTypes.forEach(function(directiveName) {
leafletScope.settingCenterFromScope = true;
map.setView([center.lat, center.lng], center.zoom);
leafletMapEvents.notifyCenterChangedToBounds(leafletScope, map);
- $timeout(function() {
+ $timeout(function () {
leafletScope.settingCenterFromScope = false;
//$log.debug("allow center scope updates");
});
}, true);
- map.whenReady(function() {
+ map.whenReady(function () {
mapReady = true;
});
- map.on('moveend', function(/* event */) {
+ map.on('moveend', function (/* event */) {
// Resolve the center after the first map position
_leafletCenter.resolve();
leafletMapEvents.notifyCenterUrlHashChanged(leafletScope, map, attrs, $location.search());
@@ -3557,7 +3562,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
}
leafletScope.settingCenterFromLeaflet = true;
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
if (!leafletScope.settingCenterFromScope) {
//$log.debug("updating center model...", map.getCenter(), map.getZoom());
angular.extend(scope[directiveName], {
@@ -3569,14 +3574,14 @@ centerDirectiveTypes.forEach(function(directiveName) {
}
leafletMapEvents.notifyCenterChangedToBounds(leafletScope, map);
- $timeout(function() {
+ $timeout(function () {
leafletScope.settingCenterFromLeaflet = false;
});
});
});
if (centerModel.autoDiscover === true) {
- map.on('locationerror', function() {
+ map.on('locationerror', function () {
$log.warn(errorHeader + ' The Geolocation API is unauthorized on this page.');
if (isValidCenter(centerModel)) {
map.setView([centerModel.lat, centerModel.lng], centerModel.zoom);
@@ -3594,11 +3599,11 @@ centerDirectiveTypes.forEach(function(directiveName) {
];
});
-centerDirectiveTypes.forEach(function(dirType) {
+centerDirectiveTypes.forEach(function (dirType) {
angular.module('leaflet-directive').directive(dirType, centerDirectives[dirType]);
});
-angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpers", "leafletControlHelpers", function($log, leafletHelpers, leafletControlHelpers) {
+angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpers", "leafletControlHelpers", function ($log, leafletHelpers, leafletControlHelpers) {
return {
restrict: 'A',
@@ -3606,7 +3611,7 @@ angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpe
replace: false,
require: '?^leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
if (!controller) {
return;
}
@@ -3619,9 +3624,9 @@ angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpe
var leafletControls = {};
var errorHeader = leafletHelpers.errorHeader + ' [Controls] ';
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
- leafletScope.$watchCollection('controls', function(newControls) {
+ leafletScope.$watchCollection('controls', function (newControls) {
// Delete controls from the array
for (var name in leafletControls) {
@@ -3670,7 +3675,7 @@ angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpe
};
}]);
-angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHelpers", function($log, leafletHelpers) {
+angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHelpers", function ($log, leafletHelpers) {
return {
restrict: 'A',
@@ -3678,7 +3683,7 @@ angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHe
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var PolylineDecoratorPlugin = leafletHelpers.PolylineDecoratorPlugin;
var isDefined = leafletHelpers.isDefined;
@@ -3706,8 +3711,8 @@ angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHe
}
}
- controller.getMap().then(function(map) {
- leafletScope.$watch('decorations', function(newDecorations) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('decorations', function (newDecorations) {
for (var name in leafletDecorations) {
if (!isDefined(newDecorations[name]) || !angular.equals(newDecorations[name], leafletDecorations)) {
map.removeLayer(leafletDecorations[name]);
@@ -3731,7 +3736,7 @@ angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHe
};
}]);
-angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootScope", "leafletHelpers", "leafletMapEvents", "leafletIterators", function($log, $rootScope, leafletHelpers, leafletMapEvents, leafletIterators) {
+angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootScope", "leafletHelpers", "leafletMapEvents", "leafletIterators", function ($log, $rootScope, leafletHelpers, leafletMapEvents, leafletIterators) {
return {
restrict: 'A',
@@ -3739,7 +3744,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isObject = leafletHelpers.isObject;
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
@@ -3747,7 +3752,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
var availableMapEvents = leafletMapEvents.getAvailableMapEvents();
var addEvents = leafletMapEvents.addEvents;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var mapEvents = [];
var logic = 'broadcast';
@@ -3773,7 +3778,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
$log.warn('[AngularJS - Leaflet] event-broadcast.map.enable must be an object check your model.');
} else {
// Enable events
- leafletIterators.each(eventBroadcast.map.enable, function(eventName) {
+ leafletIterators.each(eventBroadcast.map.enable, function (eventName) {
// Do we have already the event enabled?
if (mapEvents.indexOf(eventName) === -1 && availableMapEvents.indexOf(eventName) !== -1) {
mapEvents.push(eventName);
@@ -3792,7 +3797,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
}]);
angular.module('leaflet-directive')
-.directive('geojson', ["$log", "$rootScope", "leafletData", "leafletHelpers", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", "leafletIterators", "leafletGeoJsonEvents", function($log, $rootScope, leafletData, leafletHelpers,
+.directive('geojson', ["$log", "$rootScope", "leafletData", "leafletHelpers", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", "leafletIterators", "leafletGeoJsonEvents", function ($log, $rootScope, leafletData, leafletHelpers,
leafletWatchHelpers, leafletDirectiveControlsHelpers, leafletIterators, leafletGeoJsonEvents) {
var _maybeWatch = leafletWatchHelpers.maybeWatch;
var _watchOptions = leafletHelpers.watchOptions;
@@ -3806,29 +3811,29 @@ angular.module('leaflet-directive')
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var leafletGeoJSON = {};
var _hasSetLeafletData = false;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var watchOptions = leafletScope.geojsonWatchOptions || _watchOptions;
- var _hookUpEvents = function(geojson, maybeName) {
+ var _hookUpEvents = function (geojson, maybeName) {
var onEachFeature;
if (angular.isFunction(geojson.onEachFeature)) {
onEachFeature = geojson.onEachFeature;
} else {
- onEachFeature = function(feature, layer) {
+ onEachFeature = function (feature, layer) {
if (leafletHelpers.LabelPlugin.isLoaded() && isDefined(feature.properties.description)) {
layer.bindLabel(feature.properties.description);
}
leafletGeoJsonEvents.bindEvents(attrs.id, layer, null, feature,
leafletScope, maybeName,
- {resetStyleOnMouseout: geojson.resetStyleOnMouseout,
+ { resetStyleOnMouseout: geojson.resetStyleOnMouseout,
mapId: attrs.id, });
};
}
@@ -3839,17 +3844,17 @@ angular.module('leaflet-directive')
var isNested = (hlp.isDefined(attrs.geojsonNested) &&
hlp.isTruthy(attrs.geojsonNested));
- var _clean = function() {
+ var _clean = function () {
if (!leafletGeoJSON)
return;
- var _remove = function(lObject) {
+ var _remove = function (lObject) {
if (isDefined(lObject) && map.hasLayer(lObject)) {
map.removeLayer(lObject);
}
};
if (isNested) {
- $it.each(leafletGeoJSON, function(lObject) {
+ $it.each(leafletGeoJSON, function (lObject) {
_remove(lObject);
});
@@ -3859,8 +3864,7 @@ angular.module('leaflet-directive')
_remove(leafletGeoJSON);
};
- var _addGeojson = function(model, maybeName) {
- var geojson = angular.copy(model);
+ var _addGeojson = function (geojson, maybeName) {
if (!(isDefined(geojson) && isDefined(geojson.data))) {
return;
}
@@ -3895,12 +3899,12 @@ angular.module('leaflet-directive')
}
};
- var _create = function(model) {
+ var _create = function (model) {
_clean();
if (isNested) {
if (!model || !Object.keys(model).length)
return;
- $it.each(model, function(m, name) {
+ $it.each(model, function (m, name) {
//name could be layerName and or groupName
//for now it is not tied to a layer
_addGeojson(m, name);
@@ -3914,7 +3918,7 @@ angular.module('leaflet-directive')
_extendDirectiveControls(attrs.id, 'geojson', _create, _clean);
- _maybeWatch(leafletScope, 'geojson', watchOptions, function(geojson) {
+ _maybeWatch(leafletScope, 'geojson', watchOptions, function (geojson) {
_create(geojson);
});
});
@@ -3922,7 +3926,7 @@ angular.module('leaflet-directive')
};
}]);
-angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log", "leafletData", "leafletHelpers", function($filter, $log, leafletData, leafletHelpers) {
+angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log", "leafletData", "leafletHelpers", function ($filter, $log, leafletData, leafletHelpers) {
return {
restrict: 'E',
@@ -3937,7 +3941,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
replace: true,
transclude: false,
require: '^leaflet',
- controller: ["$scope", "$element", "$sce", function($scope, $element, $sce) {
+ controller: ["$scope", "$element", "$sce", function ($scope, $element, $sce) {
$log.debug('[Angular Directive - Layers] layers', $scope, $element);
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
@@ -3947,11 +3951,11 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
layerProperties: {},
groupProperties: {},
rangeIsSupported: leafletHelpers.rangeIsSupported(),
- changeBaseLayer: function(key, e) {
- leafletHelpers.safeApply($scope, function(scp) {
+ changeBaseLayer: function (key, e) {
+ leafletHelpers.safeApply($scope, function (scp) {
scp.baselayer = key;
- leafletData.getMap().then(function(map) {
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getMap().then(function (map) {
+ leafletData.getLayers().then(function (leafletLayers) {
if (map.hasLayer(leafletLayers.baselayers[key])) {
return;
}
@@ -3972,7 +3976,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
e.preventDefault();
},
- moveLayer: function(ly, newIndex, e) {
+ moveLayer: function (ly, newIndex, e) {
var delta = Object.keys($scope.layers.baselayers).length;
if (newIndex >= (1 + delta) && newIndex <= ($scope.overlaysArray.length + delta)) {
var oldLy;
@@ -3984,7 +3988,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
}
if (oldLy) {
- safeApply($scope, function() {
+ safeApply($scope, function () {
oldLy.index = ly.index;
ly.index = newIndex;
});
@@ -3995,16 +3999,16 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
e.preventDefault();
},
- initIndex: function(layer, idx) {
+ initIndex: function (layer, idx) {
var delta = Object.keys($scope.layers.baselayers).length;
layer.index = isDefined(layer.index) ? layer.index : idx + delta + 1;
},
- initGroup: function(groupName) {
+ initGroup: function (groupName) {
$scope.groupProperties[groupName] = $scope.groupProperties[groupName] ? $scope.groupProperties[groupName] : {};
},
- toggleOpacity: function(e, layer) {
+ toggleOpacity: function (e, layer) {
if (layer.visible) {
if ($scope.autoHideOpacity && !$scope.layerProperties[layer.name].opacityControl) {
for (var k in $scope.layerProperties) {
@@ -4019,30 +4023,30 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
e.preventDefault();
},
- toggleLegend: function(layer) {
+ toggleLegend: function (layer) {
$scope.layerProperties[layer.name].showLegend = !$scope.layerProperties[layer.name].showLegend;
},
- showLegend: function(layer) {
+ showLegend: function (layer) {
return layer.legend && $scope.layerProperties[layer.name].showLegend;
},
- unsafeHTML: function(html) {
+ unsafeHTML: function (html) {
return $sce.trustAsHtml(html);
},
- getOpacityIcon: function(layer) {
+ getOpacityIcon: function (layer) {
return layer.visible && $scope.layerProperties[layer.name].opacityControl ? $scope.icons.close : $scope.icons.open;
},
- getGroupIcon: function(group) {
+ getGroupIcon: function (group) {
return group.visible ? $scope.icons.check : $scope.icons.uncheck;
},
- changeOpacity: function(layer) {
+ changeOpacity: function (layer) {
var op = $scope.layerProperties[layer.name].opacity;
- leafletData.getMap().then(function(map) {
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getMap().then(function (map) {
+ leafletData.getLayers().then(function (leafletLayers) {
var ly;
for (var k in $scope.layers.overlays) {
if ($scope.layers.overlays[k] === layer) {
@@ -4057,7 +4061,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
}
if (ly.getLayers && ly.eachLayer) {
- ly.eachLayer(function(lay) {
+ ly.eachLayer(function (lay) {
if (lay.setOpacity) {
lay.setOpacity(op / 100);
}
@@ -4068,7 +4072,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
});
},
- changeGroupVisibility: function(groupName) {
+ changeGroupVisibility: function (groupName) {
if (!isDefined($scope.groupProperties[groupName])) {
return;
}
@@ -4139,12 +4143,12 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
'' +
'' +
'',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var layers = leafletScope.layers;
- scope.$watch('icons', function() {
+ scope.$watch('icons', function () {
var defaultIcons = {
uncheck: 'fa fa-square-o',
check: 'fa fa-check-square-o',
@@ -4170,10 +4174,10 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
scope.orderNumber = attrs.order === 'normal' ? -1 : 1;
scope.layers = layers;
- controller.getMap().then(function(map) {
- leafletScope.$watch('layers.baselayers', function(newBaseLayers) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('layers.baselayers', function (newBaseLayers) {
var baselayersArray = {};
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
var key;
for (key in newBaseLayers) {
var layer = newBaseLayers[key];
@@ -4185,10 +4189,10 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
});
});
- leafletScope.$watch('layers.overlays', function(newOverlayLayers) {
+ leafletScope.$watch('layers.overlays', function (newOverlayLayers) {
var overlaysArray = [];
var groupVisibleCount = {};
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
var key;
for (key in newOverlayLayers) {
var layer = newOverlayLayers[key];
@@ -4236,21 +4240,21 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
};
}]);
-angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletData", "leafletHelpers", "leafletLayerHelpers", "leafletControlHelpers", function($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
+angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletData", "leafletHelpers", "leafletLayerHelpers", "leafletControlHelpers", function ($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
return {
restrict: 'A',
scope: false,
replace: false,
require: 'leaflet',
- controller: ["$scope", function($scope) {
+ controller: ["$scope", function ($scope) {
$scope._leafletLayers = $q.defer();
- this.getLayers = function() {
+ this.getLayers = function () {
return $scope._leafletLayers.promise;
};
}],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletLayers = {};
var leafletScope = controller.getLeafletScope();
@@ -4261,7 +4265,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
var updateLayersControl = leafletControlHelpers.updateLayersControl;
var isLayersControlVisible = false;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
// We have baselayers to add to the map
scope._leafletLayers.resolve(leafletLayers);
@@ -4317,7 +4321,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
}
// Watch for the base layers
- leafletScope.$watch('layers.baselayers', function(newBaseLayers, oldBaseLayers) {
+ leafletScope.$watch('layers.baselayers', function (newBaseLayers, oldBaseLayers) {
if (angular.equals(newBaseLayers, oldBaseLayers)) {
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, newBaseLayers, layers.overlays, leafletLayers);
return true;
@@ -4381,7 +4385,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
}, true);
// Watch for the overlay layers
- leafletScope.$watch('layers.overlays', function(newOverlayLayers, oldOverlayLayers) {
+ leafletScope.$watch('layers.overlays', function (newOverlayLayers, oldOverlayLayers) {
if (angular.equals(newOverlayLayers, oldOverlayLayers)) {
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, layers.baselayers, newOverlayLayers, leafletLayers);
return true;
@@ -4445,7 +4449,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
};
}]);
-angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafletHelpers", "leafletLegendHelpers", function($log, $http, leafletHelpers, leafletLegendHelpers) {
+angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafletHelpers", "leafletLegendHelpers", function ($log, $http, leafletHelpers, leafletLegendHelpers) {
return {
restrict: 'A',
@@ -4453,7 +4457,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isArray = leafletHelpers.isArray;
var isDefined = leafletHelpers.isDefined;
@@ -4466,7 +4470,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
var leafletLegend;
var type;
- leafletScope.$watch('legend', function(newLegend) {
+ leafletScope.$watch('legend', function (newLegend) {
if (isDefined(newLegend)) {
@@ -4480,9 +4484,9 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
}, true);
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
- leafletScope.$watch('legend', function(newLegend) {
+ leafletScope.$watch('legend', function (newLegend) {
if (!isDefined(newLegend)) {
@@ -4524,14 +4528,14 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
});
- leafletScope.$watch('legend.url', function(newURL) {
+ leafletScope.$watch('legend.url', function (newURL) {
if (!isDefined(newURL)) {
return;
}
$http.get(newURL)
- .success(function(legendData) {
+ .success(function (legendData) {
if (isDefined(leafletLegend)) {
@@ -4550,7 +4554,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
legend.loadedData();
}
})
- .error(function() {
+ .error(function () {
$log.warn('[AngularJS - Leaflet] legend.url not loaded.');
});
});
@@ -4561,7 +4565,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
}]);
angular.module('leaflet-directive').directive('markers',
- ["$log", "$rootScope", "$q", "leafletData", "leafletHelpers", "leafletMapDefaults", "leafletMarkersHelpers", "leafletMarkerEvents", "leafletIterators", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", function($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
+ ["$log", "$rootScope", "$q", "leafletData", "leafletHelpers", "leafletMapDefaults", "leafletMarkersHelpers", "leafletMarkerEvents", "leafletIterators", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", function ($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
leafletMarkersHelpers, leafletMarkerEvents, leafletIterators, leafletWatchHelpers,
leafletDirectiveControlsHelpers) {
//less terse vars to helpers
@@ -4580,7 +4584,7 @@ angular.module('leaflet-directive').directive('markers',
var maybeWatch = leafletWatchHelpers.maybeWatch;
var extendDirectiveControls = leafletDirectiveControlsHelpers.extend;
- var _getLMarker = function(leafletMarkers, name, maybeLayerName) {
+ var _getLMarker = function (leafletMarkers, name, maybeLayerName) {
if (!Object.keys(leafletMarkers).length) return;
if (maybeLayerName && isString(maybeLayerName)) {
if (!leafletMarkers[maybeLayerName] || !Object.keys(leafletMarkers[maybeLayerName]).length)
@@ -4591,7 +4595,7 @@ angular.module('leaflet-directive').directive('markers',
return leafletMarkers[name];
};
- var _setLMarker = function(lObject, leafletMarkers, name, maybeLayerName) {
+ var _setLMarker = function (lObject, leafletMarkers, name, maybeLayerName) {
if (maybeLayerName && isString(maybeLayerName)) {
if (!isDefined(leafletMarkers[maybeLayerName]))
leafletMarkers[maybeLayerName] = {};
@@ -4601,7 +4605,7 @@ angular.module('leaflet-directive').directive('markers',
return lObject;
};
- var _maybeAddMarkerToLayer = function(layerName, layers, model, marker, doIndividualWatch, map) {
+ var _maybeAddMarkerToLayer = function (layerName, layers, model, marker, doIndividualWatch, map) {
if (!isString(layerName)) {
$log.error(errorHeader + ' A layername must be a string');
@@ -4637,7 +4641,7 @@ angular.module('leaflet-directive').directive('markers',
};
//TODO: move to leafletMarkersHelpers??? or make a new class/function file (leafletMarkersHelpers is large already)
- var _addMarkers = function(mapId, markersToRender, oldModels, map, layers, leafletMarkers, leafletScope,
+ var _addMarkers = function (mapId, markersToRender, oldModels, map, layers, leafletMarkers, leafletScope,
watchOptions, maybeLayerName, skips) {
for (var newName in markersToRender) {
if (skips[newName])
@@ -4710,7 +4714,7 @@ angular.module('leaflet-directive').directive('markers',
}
};
- var _seeWhatWeAlreadyHave = function(markerModels, oldMarkerModels, lMarkers, isEqual, cb) {
+ var _seeWhatWeAlreadyHave = function (markerModels, oldMarkerModels, lMarkers, isEqual, cb) {
var hasLogged = false;
var equals = false;
var oldMarker;
@@ -4742,19 +4746,19 @@ angular.module('leaflet-directive').directive('markers',
}
};
- var _destroy = function(markerModels, oldMarkerModels, lMarkers, map, layers) {
+ var _destroy = function (markerModels, oldMarkerModels, lMarkers, map, layers) {
_seeWhatWeAlreadyHave(markerModels, oldMarkerModels, lMarkers, false,
- function(newMarker, oldMarker, lMarkerName) {
+ function (newMarker, oldMarker, lMarkerName) {
$log.debug(errorHeader + '[marker] is deleting marker: ' + lMarkerName);
deleteMarker(lMarkers[lMarkerName], map, layers);
delete lMarkers[lMarkerName];
});
};
- var _getNewModelsToSkipp = function(newModels, oldModels, lMarkers) {
+ var _getNewModelsToSkipp = function (newModels, oldModels, lMarkers) {
var skips = {};
_seeWhatWeAlreadyHave(newModels, oldModels, lMarkers, true,
- function(newMarker, oldMarker, lMarkerName) {
+ function (newMarker, oldMarker, lMarkerName) {
$log.debug(errorHeader + '[marker] is already rendered, marker: ' + lMarkerName);
skips[lMarkerName] = newMarker;
});
@@ -4768,11 +4772,11 @@ angular.module('leaflet-directive').directive('markers',
replace: false,
require: ['leaflet', '?layers'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0];
var leafletScope = mapController.getLeafletScope();
- mapController.getMap().then(function(map) {
+ mapController.getMap().then(function (map) {
var leafletMarkers = {};
var getLayers;
@@ -4780,7 +4784,7 @@ angular.module('leaflet-directive').directive('markers',
if (isDefined(controller[1])) {
getLayers = controller[1].getLayers;
} else {
- getLayers = function() {
+ getLayers = function () {
var deferred = $q.defer();
deferred.resolve();
return deferred.promise;
@@ -4796,10 +4800,10 @@ angular.module('leaflet-directive').directive('markers',
var isNested = (isDefined(attrs.markersNested) && Helpers.isTruthy(attrs.markersNested));
- getLayers().then(function(layers) {
- var _clean = function(models, oldModels) {
+ getLayers().then(function (layers) {
+ var _clean = function (models, oldModels) {
if (isNested) {
- $it.each(models, function(markerToMaybeDel, layerName) {
+ $it.each(models, function (markerToMaybeDel, layerName) {
var oldModel = isDefined(oldModel) ? oldModels[layerName] : undefined;
_destroy(markerToMaybeDel, oldModel, leafletMarkers[layerName], map, layers);
});
@@ -4810,11 +4814,11 @@ angular.module('leaflet-directive').directive('markers',
_destroy(models, oldModels, leafletMarkers, map, layers);
};
- var _create = function(models, oldModels) {
+ var _create = function (models, oldModels) {
_clean(models, oldModels);
var skips = null;
if (isNested) {
- $it.each(models, function(markersToAdd, layerName) {
+ $it.each(models, function (markersToAdd, layerName) {
var oldModel = isDefined(oldModel) ? oldModels[layerName] : undefined;
skips = _getNewModelsToSkipp(models[layerName], oldModel, leafletMarkers[layerName]);
_addMarkers(attrs.id, markersToAdd, oldModels, map, layers, leafletMarkers, leafletScope,
@@ -4832,7 +4836,7 @@ angular.module('leaflet-directive').directive('markers',
extendDirectiveControls(attrs.id, 'markers', _create, _clean);
leafletData.setMarkers(leafletMarkers, attrs.id);
- maybeWatch(leafletScope, 'markers', watchOptions, function(newMarkers, oldMarkers) {
+ maybeWatch(leafletScope, 'markers', watchOptions, function (newMarkers, oldMarkers) {
_create(newMarkers, oldMarkers);
});
});
@@ -4841,7 +4845,7 @@ angular.module('leaflet-directive').directive('markers',
};
}]);
-angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapDefaults", "leafletBoundsHelpers", "leafletHelpers", function($log, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
+angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapDefaults", "leafletBoundsHelpers", "leafletHelpers", function ($log, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
return {
restrict: 'A',
@@ -4849,13 +4853,13 @@ angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapD
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var isValidBounds = leafletBoundsHelpers.isValidBounds;
var isNumber = leafletHelpers.isNumber;
- controller.getMap().then(function(map) {
- leafletScope.$watch('maxbounds', function(maxbounds) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('maxbounds', function (maxbounds) {
if (!isValidBounds(maxbounds)) {
// Unset any previous maxbounds
map.setMaxBounds();
@@ -4877,7 +4881,7 @@ angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapD
};
}]);
-angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletData", "leafletMapDefaults", "leafletHelpers", "leafletPathsHelpers", "leafletPathEvents", function($log, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletPathEvents) {
+angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletData", "leafletMapDefaults", "leafletHelpers", "leafletPathsHelpers", "leafletPathEvents", function ($log, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletPathEvents) {
return {
restrict: 'A',
@@ -4885,7 +4889,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
replace: false,
require: ['leaflet', '?layers'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0];
var isDefined = leafletHelpers.isDefined;
var isString = leafletHelpers.isString;
@@ -4895,7 +4899,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
var bindPathEvents = leafletPathEvents.bindPathEvents;
var setPathOptions = leafletPathsHelpers.setPathOptions;
- mapController.getMap().then(function(map) {
+ mapController.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
var getLayers;
@@ -4903,7 +4907,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
if (isDefined(controller[1])) {
getLayers = controller[1].getLayers;
} else {
- getLayers = function() {
+ getLayers = function () {
var deferred = $q.defer();
deferred.resolve();
return deferred.promise;
@@ -4914,7 +4918,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
return;
}
- getLayers().then(function(layers) {
+ getLayers().then(function (layers) {
var leafletPaths = {};
leafletData.setPaths(leafletPaths, attrs.id);
@@ -4923,8 +4927,8 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
var shouldWatch = (!isDefined(attrs.watchPaths) || attrs.watchPaths === 'true');
// Function for listening every single path once created
- var watchPathFn = function(leafletPath, name) {
- var clearWatch = leafletScope.$watch('paths["' + name + '"]', function(pathData, old) {
+ var watchPathFn = function (leafletPath, name) {
+ var clearWatch = leafletScope.$watch('paths["' + name + '"]', function (pathData, old) {
if (!isDefined(pathData)) {
if (isDefined(old.layer)) {
for (var i in layers.overlays) {
@@ -4942,7 +4946,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
}, true);
};
- leafletScope.$watchCollection('paths', function(newPaths) {
+ leafletScope.$watchCollection('paths', function (newPaths) {
// Delete paths (by name) from the array
for (var name in leafletPaths) {
@@ -5034,7 +5038,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
};
}]);
-angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "leafletMapDefaults", "leafletHelpers", function($log, leafletData, leafletMapDefaults, leafletHelpers) {
+angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "leafletMapDefaults", "leafletHelpers", function ($log, leafletData, leafletMapDefaults, leafletHelpers) {
return {
restrict: 'A',
@@ -5042,7 +5046,7 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var tiles = leafletScope.tiles;
@@ -5052,10 +5056,10 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
return;
}
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
var tileLayerObj;
- leafletScope.$watch('tiles', function(tiles, oldtiles) {
+ leafletScope.$watch('tiles', function (tiles, oldtiles) {
var tileLayerOptions = defaults.tileLayerOptions;
var tileLayerUrl = defaults.tileLayer;
@@ -5120,10 +5124,10 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
instead. (when watches are disabled)
NgAnnotate does not work here due to the functional creation
*/
-['markers', 'geojson'].forEach(function(name) {
+['markers', 'geojson'].forEach(function (name) {
angular.module('leaflet-directive').directive(name + 'WatchOptions', [
'$log', '$rootScope', '$q', 'leafletData', 'leafletHelpers',
- function($log, $rootScope, $q, leafletData, leafletHelpers) {
+ function ($log, $rootScope, $q, leafletData, leafletHelpers) {
var isDefined = leafletHelpers.isDefined,
errorHeader = leafletHelpers.errorHeader,
@@ -5136,11 +5140,11 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
replace: false,
require: ['leaflet'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0],
leafletScope = mapController.getLeafletScope();
- mapController.getMap().then(function() {
+ mapController.getMap().then(function () {
if (isDefined(scope[name + 'WatchOptions'])) {
if (isObject(scope[name + 'WatchOptions']))
angular.extend(_watchOptions, scope[name + 'WatchOptions']);
@@ -5151,18 +5155,18 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
});
},
};
- },]);
+ }, ]);
});
angular.module('leaflet-directive')
-.factory('LeafletEventsHelpersFactory', ["$rootScope", "$q", "$log", "leafletHelpers", function($rootScope, $q, $log, leafletHelpers) {
+.factory('LeafletEventsHelpersFactory', ["$rootScope", "$q", "$log", "leafletHelpers", function ($rootScope, $q, $log, leafletHelpers) {
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var isArray = leafletHelpers.isArray;
var errorHeader = leafletHelpers.errorHeader;
- var EventsHelper = function(rootBroadcastName, lObjectType) {
+ var EventsHelper = function (rootBroadcastName, lObjectType) {
this.rootBroadcastName = rootBroadcastName;
$log.debug('LeafletEventsHelpersFactory: lObjectType: ' + lObjectType + 'rootBroadcastName: ' + rootBroadcastName);
@@ -5170,7 +5174,7 @@ angular.module('leaflet-directive')
this.lObjectType = lObjectType;
};
- EventsHelper.prototype.getAvailableEvents = function() {return [];};
+ EventsHelper.prototype.getAvailableEvents = function () {return [];};
/*
argument: name: Note this can be a single string or dot notation
@@ -5190,23 +5194,23 @@ angular.module('leaflet-directive')
//would yield name of
name = "cars.m1"
*/
- EventsHelper.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
+ EventsHelper.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
var _this = this;
maybeMapId = maybeMapId || '';
if (maybeMapId)
maybeMapId = '.' + maybeMapId;
- return function(e) {
+ return function (e) {
var broadcastName = _this.rootBroadcastName + maybeMapId + '.' + eventName;
$log.debug(broadcastName);
_this.fire(leafletScope, broadcastName, logic, e, e.target || lObject, model, name, layerName, extra);
};
};
- EventsHelper.prototype.fire = function(scope, broadcastName, logic, event, lObject, model, modelName, layerName) {
+ EventsHelper.prototype.fire = function (scope, broadcastName, logic, event, lObject, model, modelName, layerName) {
// Safely broadcast the event
- safeApply(scope, function() {
+ safeApply(scope, function () {
var toSend = {
leafletEvent: event,
leafletObject: lObject,
@@ -5214,7 +5218,7 @@ angular.module('leaflet-directive')
model: model,
};
if (isDefined(layerName))
- angular.extend(toSend, {layerName: layerName});
+ angular.extend(toSend, { layerName: layerName });
if (logic === 'emit') {
scope.$emit(broadcastName, toSend);
@@ -5224,7 +5228,7 @@ angular.module('leaflet-directive')
});
};
- EventsHelper.prototype.bindEvents = function(maybeMapId, lObject, name, model, leafletScope, layerName, extra) {
+ EventsHelper.prototype.bindEvents = function (maybeMapId, lObject, name, model, leafletScope, layerName, extra) {
var events = [];
var logic = 'emit';
var _this = this;
@@ -5273,7 +5277,7 @@ angular.module('leaflet-directive')
// At this point the object is OK, lets enable or disable events
if (eventsEnable) {
// Enable events
- leafletScope.eventBroadcast[this.lObjectType].enable.forEach(function(eventName) {
+ leafletScope.eventBroadcast[this.lObjectType].enable.forEach(function (eventName) {
// Do we have already the event enabled?
if (events.indexOf(eventName) !== -1) {
// Repeated event, this is an error
@@ -5292,7 +5296,7 @@ angular.module('leaflet-directive')
} else {
// Disable events
events = this.getAvailableEvents();
- leafletScope.eventBroadcast[_this.lObjectType].disable.forEach(function(eventName) {
+ leafletScope.eventBroadcast[_this.lObjectType].disable.forEach(function (eventName) {
var index = events.indexOf(eventName);
if (index === -1) {
// The event does not exist
@@ -5307,7 +5311,7 @@ angular.module('leaflet-directive')
}
}
- events.forEach(function(eventName) {
+ events.forEach(function (eventName) {
lObject.on(eventName, _this.genDispatchEvent(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra));
});
@@ -5316,31 +5320,31 @@ angular.module('leaflet-directive')
return EventsHelper;
}])
-.service('leafletEventsHelpers', ["LeafletEventsHelpersFactory", function(LeafletEventsHelpersFactory) {
+.service('leafletEventsHelpers', ["LeafletEventsHelpersFactory", function (LeafletEventsHelpersFactory) {
return new LeafletEventsHelpersFactory();
}]);
angular.module('leaflet-directive')
-.factory('leafletGeoJsonEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletData", function($rootScope, $q, $log, leafletHelpers,
+.factory('leafletGeoJsonEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletData", function ($rootScope, $q, $log, leafletHelpers,
LeafletEventsHelpersFactory, leafletData) {
var safeApply = leafletHelpers.safeApply;
var EventsHelper = LeafletEventsHelpersFactory;
- var GeoJsonEvents = function() {
+ var GeoJsonEvents = function () {
EventsHelper.call(this, 'leafletDirectiveGeoJson', 'geojson');
};
GeoJsonEvents.prototype = new EventsHelper();
- GeoJsonEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
+ GeoJsonEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
var base = EventsHelper.prototype.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName);
var _this = this;
- return function(e) {
+ return function (e) {
if (eventName === 'mouseout') {
if (extra.resetStyleOnMouseout) {
leafletData.getGeoJSON(extra.mapId)
- .then(function(leafletGeoJSON) {
+ .then(function (leafletGeoJSON) {
//this is broken on nested needs to traverse or user layerName (nested)
var lobj = layerName ? leafletGeoJSON[layerName] : leafletGeoJSON;
lobj.resetStyle(e.target);
@@ -5348,7 +5352,7 @@ angular.module('leaflet-directive')
}
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
$rootScope.$broadcast(_this.rootBroadcastName + '.mouseout', e);
});
}
@@ -5357,7 +5361,7 @@ angular.module('leaflet-directive')
};
};
- GeoJsonEvents.prototype.getAvailableEvents = function() { return [
+ GeoJsonEvents.prototype.getAvailableEvents = function () { return [
'click',
'dblclick',
'mouseover',
@@ -5369,23 +5373,23 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.factory('leafletLabelEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", function($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory) {
+.factory('leafletLabelEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", function ($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory) {
var Helpers = leafletHelpers;
var EventsHelper = LeafletEventsHelpersFactory;
- var LabelEvents = function() {
+ var LabelEvents = function () {
EventsHelper.call(this, 'leafletDirectiveLabel', 'markers');
};
LabelEvents.prototype = new EventsHelper();
- LabelEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ LabelEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var markerName = name.replace('markers.', '');
return EventsHelper.prototype
.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, markerName, model, layerName);
};
- LabelEvents.prototype.getAvailableEvents = function() {
+ LabelEvents.prototype.getAvailableEvents = function () {
return [
'click',
'dblclick',
@@ -5396,27 +5400,27 @@ angular.module('leaflet-directive')
];
};
- LabelEvents.prototype.genEvents = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ LabelEvents.prototype.genEvents = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var _this = this;
var labelEvents = this.getAvailableEvents();
var scopeWatchName = Helpers.getObjectArrayPath('markers.' + name);
- labelEvents.forEach(function(eventName) {
+ labelEvents.forEach(function (eventName) {
lObject.label.on(eventName, _this.genDispatchEvent(
maybeMapId, eventName, logic, leafletScope, lObject.label, scopeWatchName, model, layerName));
});
};
- LabelEvents.prototype.bindEvents = function() {};
+ LabelEvents.prototype.bindEvents = function () {};
return new LabelEvents();
}]);
angular.module('leaflet-directive')
-.factory('leafletMapEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletEventsHelpers", "leafletIterators", function($rootScope, $q, $log, leafletHelpers, leafletEventsHelpers, leafletIterators) {
+.factory('leafletMapEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletEventsHelpers", "leafletIterators", function ($rootScope, $q, $log, leafletHelpers, leafletEventsHelpers, leafletIterators) {
var isDefined = leafletHelpers.isDefined;
var fire = leafletEventsHelpers.fire;
- var _getAvailableMapEvents = function() {
+ var _getAvailableMapEvents = function () {
return [
'click',
'dblclick',
@@ -5465,10 +5469,10 @@ angular.module('leaflet-directive')
];
};
- var _genDispatchMapEvent = function(scope, eventName, logic, maybeMapId) {
+ var _genDispatchMapEvent = function (scope, eventName, logic, maybeMapId) {
if (maybeMapId)
maybeMapId = maybeMapId + '.';
- return function(e) {
+ return function (e) {
// Put together broadcast name
var broadcastName = 'leafletDirectiveMap.' + maybeMapId + eventName;
$log.debug(broadcastName);
@@ -5478,11 +5482,11 @@ angular.module('leaflet-directive')
};
};
- var _notifyCenterChangedToBounds = function(scope) {
+ var _notifyCenterChangedToBounds = function (scope) {
scope.$broadcast('boundsChanged');
};
- var _notifyCenterUrlHashChanged = function(scope, map, attrs, search) {
+ var _notifyCenterUrlHashChanged = function (scope, map, attrs, search) {
if (!isDefined(attrs.urlHashCenter)) {
return;
}
@@ -5495,8 +5499,8 @@ angular.module('leaflet-directive')
}
};
- var _addEvents = function(map, mapEvents, contextName, scope, logic) {
- leafletIterators.each(mapEvents, function(eventName) {
+ var _addEvents = function (map, mapEvents, contextName, scope, logic) {
+ leafletIterators.each(mapEvents, function (eventName) {
var context = {};
context[contextName] = eventName;
map.on(eventName, _genDispatchMapEvent(scope, eventName, logic, map._container.id || ''), context);
@@ -5513,30 +5517,30 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.factory('leafletMarkerEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletLabelEvents", function($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory, leafletLabelEvents) {
+.factory('leafletMarkerEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletLabelEvents", function ($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory, leafletLabelEvents) {
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
var Helpers = leafletHelpers;
var lblHelp = leafletLabelEvents;
var EventsHelper = LeafletEventsHelpersFactory;
- var MarkerEvents = function() {
+ var MarkerEvents = function () {
EventsHelper.call(this, 'leafletDirectiveMarker', 'markers');
};
MarkerEvents.prototype = new EventsHelper();
- MarkerEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ MarkerEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var handle = EventsHelper.prototype
.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName);
- return function(e) {
+ return function (e) {
// Broadcast old marker click name for backwards compatibility
if (eventName === 'click') {
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
$rootScope.$broadcast('leafletDirectiveMarkersClick', name);
});
} else if (eventName === 'dragend') {
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
model.lat = lObject.getLatLng().lat;
model.lng = lObject.getLatLng().lng;
});
@@ -5550,7 +5554,7 @@ angular.module('leaflet-directive')
};
};
- MarkerEvents.prototype.getAvailableEvents = function() { return [
+ MarkerEvents.prototype.getAvailableEvents = function () { return [
'click',
'dblclick',
'mousedown',
@@ -5572,7 +5576,7 @@ angular.module('leaflet-directive')
];
};
- MarkerEvents.prototype.bindEvents = function(maybeMapId, lObject, name, model, leafletScope, layerName) {
+ MarkerEvents.prototype.bindEvents = function (maybeMapId, lObject, name, model, leafletScope, layerName) {
var logic = EventsHelper.prototype.bindEvents.call(this, maybeMapId, lObject, name, model, leafletScope, layerName);
if (Helpers.LabelPlugin.isLoaded() && isDefined(lObject.label)) {
@@ -5584,7 +5588,7 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.factory('leafletPathEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletLabelEvents", "leafletEventsHelpers", function($rootScope, $q, $log, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
+.factory('leafletPathEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletLabelEvents", "leafletEventsHelpers", function ($rootScope, $q, $log, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var Helpers = leafletHelpers;
@@ -5596,20 +5600,20 @@ angular.module('leaflet-directive')
TODO (nmccready) This EventsHelper needs to be derrived from leafletEventsHelpers to elminate copy and paste code.
*/
- var _genDispatchPathEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ var _genDispatchPathEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
maybeMapId = maybeMapId || '';
if (maybeMapId)
maybeMapId = '.' + maybeMapId;
- return function(e) {
+ return function (e) {
var broadcastName = 'leafletDirectivePath' + maybeMapId + '.' + eventName;
$log.debug(broadcastName);
fire(leafletScope, broadcastName, logic, e, e.target || lObject, model, name, layerName);
};
};
- var _bindPathEvents = function(maybeMapId, lObject, name, model, leafletScope) {
+ var _bindPathEvents = function (maybeMapId, lObject, name, model, leafletScope) {
var pathEvents = [];
var i;
var eventName;
@@ -5714,7 +5718,7 @@ angular.module('leaflet-directive')
}
};
- var _getAvailablePathEvents = function() {
+ var _getAvailablePathEvents = function () {
return [
'click',
'dblclick',
diff --git a/dist/angular-leaflet-directive.min.js b/dist/angular-leaflet-directive.min.js
index cbcd8406..f45124b2 100644
--- a/dist/angular-leaflet-directive.min.js
+++ b/dist/angular-leaflet-directive.min.js
@@ -28,13 +28,13 @@
*/
/*!
-* angular-leaflet-directive 2015-11-06
+* angular-leaflet-directive 0.10.1 2017-02-15
* angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps
* git: https://github.com/tombatossals/angular-leaflet-directive
*/
(function(angular){
'use strict';
-!function(angular){"use strict";angular.module("leaflet-directive",[]).directive("leaflet",["$q","leafletData","leafletMapDefaults","leafletHelpers","leafletMapEvents",function(a,b,c,d,e){return{restrict:"EA",replace:!0,scope:{center:"=",lfCenter:"=",defaults:"=",maxbounds:"=",bounds:"=",markers:"=",legend:"=",geojson:"=",paths:"=",tiles:"=",layers:"=",controls:"=",decorations:"=",eventBroadcast:"=",markersWatchOptions:"=",geojsonWatchOptions:"="},transclude:!0,template:'',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![](data:'+h.contentType+)
'+h.label+"
"}}else"image"===c&&(a.innerHTML='
')},b=function(b,c,d,e){return function(){var f=L.DomUtil.create("div",c);return L.Browser.touch?L.DomEvent.on(f,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(f),L.DomEvent.on(f,"mousewheel",L.DomEvent.stopPropagation)),a(f,b,d,e),f}},c=function(a,b){return function(){for(var c=L.DomUtil.create("div",b),d=0;d'+a.labels[d]+"
";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{getOnAddLegend:b,getOnAddArrayLegend:c,updateLegend:a}}),angular.module("leaflet-directive").factory("leafletMapDefaults",["$q","leafletHelpers",function(a,b){function c(){return{keyboard:!0,dragging:!0,worldCopyJump:!1,doubleClickZoom:!0,scrollWheelZoom:!0,tap:!0,touchZoom:!0,zoomControl:!0,zoomsliderControl:!1,zoomControlPosition:"topleft",attributionControl:!0,controls:{layers:{visible:!0,position:"topright",collapsed:!0}},nominatim:{server:" http://nominatim.openstreetmap.org/search"},crs:L.CRS.EPSG3857,tileLayer:"//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",tileLayerOptions:{attribution:'© OpenStreetMap contributors'},path:{weight:10,opacity:1,color:"#0000ff"},center:{lat:0,lng:0,zoom:1}}}var d=b.isDefined,e=b.isObject,f=b.obtainEffectiveMapId,g={};return{reset:function(){g={}},getDefaults:function(a){var b=f(g,a);return g[b]},getMapCreationDefaults:function(a){var b=f(g,a),c=g[b],e={maxZoom:c.maxZoom,keyboard:c.keyboard,dragging:c.dragging,zoomControl:c.zoomControl,doubleClickZoom:c.doubleClickZoom,scrollWheelZoom:c.scrollWheelZoom,tap:c.tap,touchZoom:c.touchZoom,attributionControl:c.attributionControl,worldCopyJump:c.worldCopyJump,crs:c.crs};if(d(c.minZoom)&&(e.minZoom=c.minZoom),d(c.zoomAnimation)&&(e.zoomAnimation=c.zoomAnimation),d(c.fadeAnimation)&&(e.fadeAnimation=c.fadeAnimation),d(c.markerZoomAnimation)&&(e.markerZoomAnimation=c.markerZoomAnimation),c.map)for(var h in c.map)e[h]=c.map[h];return e},setDefaults:function(a,b){var h=c();d(a)&&(h.doubleClickZoom=d(a.doubleClickZoom)?a.doubleClickZoom:h.doubleClickZoom,h.scrollWheelZoom=d(a.scrollWheelZoom)?a.scrollWheelZoom:h.doubleClickZoom,h.tap=d(a.tap)?a.tap:h.tap,h.touchZoom=d(a.touchZoom)?a.touchZoom:h.doubleClickZoom,h.zoomControl=d(a.zoomControl)?a.zoomControl:h.zoomControl,h.zoomsliderControl=d(a.zoomsliderControl)?a.zoomsliderControl:h.zoomsliderControl,h.attributionControl=d(a.attributionControl)?a.attributionControl:h.attributionControl,h.tileLayer=d(a.tileLayer)?a.tileLayer:h.tileLayer,h.zoomControlPosition=d(a.zoomControlPosition)?a.zoomControlPosition:h.zoomControlPosition,h.keyboard=d(a.keyboard)?a.keyboard:h.keyboard,h.dragging=d(a.dragging)?a.dragging:h.dragging,d(a.controls)&&angular.extend(h.controls,a.controls),e(a.crs)?h.crs=a.crs:d(L.CRS[a.crs])&&(h.crs=L.CRS[a.crs]),d(a.center)&&angular.copy(a.center,h.center),d(a.tileLayerOptions)&&angular.copy(a.tileLayerOptions,h.tileLayerOptions),d(a.maxZoom)&&(h.maxZoom=a.maxZoom),d(a.minZoom)&&(h.minZoom=a.minZoom),d(a.zoomAnimation)&&(h.zoomAnimation=a.zoomAnimation),d(a.fadeAnimation)&&(h.fadeAnimation=a.fadeAnimation),d(a.markerZoomAnimation)&&(h.markerZoomAnimation=a.markerZoomAnimation),d(a.worldCopyJump)&&(h.worldCopyJump=a.worldCopyJump),d(a.map)&&(h.map=a.map),d(a.path)&&(h.path=a.path));var i=f(g,b);return g[i]=h,h}}}]),angular.module("leaflet-directive").service("leafletMarkersHelpers",["$rootScope","$timeout","leafletHelpers","$log","$compile","leafletGeoJsonHelpers",function(a,b,c,d,e,f){var g=c.isDefined,h=c.defaultTo,i=c.MarkerClusterPlugin,j=c.AwesomeMarkersPlugin,k=c.VectorMarkersPlugin,l=c.MakiMarkersPlugin,m=c.ExtraMarkersPlugin,n=c.DomMarkersPlugin,o=c.safeApply,p=c,q=c.isString,r=c.isNumber,s=c.isObject,t={},u=f,v=c.errorHeader,w=function(a){
-var b="";return["_icon","_latlng","_leaflet_id","_map","_shadow"].forEach(function(c){b+=c+": "+h(a[c],"undefined")+" \n"}),"[leafletMarker] : \n"+b},x=function(a,b){var c=b?console:d;c.debug(w(a))},y=function(b){if(g(b)&&g(b.type)&&"awesomeMarker"===b.type)return j.isLoaded()||d.error(v+" The AwesomeMarkers Plugin is not loaded."),new L.AwesomeMarkers.icon(b);if(g(b)&&g(b.type)&&"vectorMarker"===b.type)return k.isLoaded()||d.error(v+" The VectorMarkers Plugin is not loaded."),new L.VectorMarkers.icon(b);if(g(b)&&g(b.type)&&"makiMarker"===b.type)return l.isLoaded()||d.error(v+"The MakiMarkers Plugin is not loaded."),new L.MakiMarkers.icon(b);if(g(b)&&g(b.type)&&"extraMarker"===b.type)return m.isLoaded()||d.error(v+"The ExtraMarkers Plugin is not loaded."),new L.ExtraMarkers.icon(b);if(g(b)&&g(b.type)&&"div"===b.type)return new L.divIcon(b);if(g(b)&&g(b.type)&&"dom"===b.type){n.isLoaded()||d.error(v+"The DomMarkers Plugin is not loaded.");var c=angular.isFunction(b.getMarkerScope)?b.getMarkerScope():a,f=e(b.template)(c),h=angular.copy(b);return h.element=f[0],new L.DomMarkers.icon(h)}if(g(b)&&g(b.type)&&"icon"===b.type)return b.icon;var i="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==",o="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 g(b)&&g(b.iconUrl)?new L.Icon(b):new L.Icon.Default({iconUrl:i,shadowUrl:o,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]})},z=function(a){g(t[a])&&t.splice(a,1)},A=function(){t={}},B=function(a,b,c){if(a.closePopup(),g(c)&&g(c.overlays))for(var d in c.overlays)if((c.overlays[d]instanceof L.LayerGroup||c.overlays[d]instanceof L.FeatureGroup)&&c.overlays[d].hasLayer(a))return void c.overlays[d].removeLayer(a);if(g(t))for(var e in t)t[e].hasLayer(a)&&t[e].removeLayer(a);b.hasLayer(a)&&b.removeLayer(a)},C=function(a,b){var c=a._popup._container.offsetHeight,d=new L.Point(a._popup._containerLeft,-c-a._popup._containerBottom),e=b.layerPointToContainerPoint(d);null!==e&&a._popup._adjustPan()},D=function(a,b){e(a._popup._contentNode)(b)},E=function(a,c,d){var e=a._popup._contentNode.innerText||a._popup._contentNode.textContent;e.length<1&&b(function(){E(a,c,d)});var f=a._popup._contentNode.offsetWidth;return a._popup._updateLayout(),a._popup._updatePosition(),a._popup.options.autoPan&&C(a,d),f},F=function(b,c,e){var f=angular.isFunction(c.getMessageScope)?c.getMessageScope():a,h=g(c.compileMessage)?c.compileMessage:!0;if(h){if(!g(b._popup)||!g(b._popup._contentNode))return d.error(v+"Popup is invalid or does not have any content."),!1;D(b,f),E(b,c,e)}},G=function(b,c){var d=angular.isFunction(c.getMessageScope)?c.getMessageScope():a,f=angular.isFunction(c.getLabelScope)?c.getLabelScope():d,h=g(c.compileMessage)?c.compileMessage:!0;p.LabelPlugin.isLoaded()&&g(c.label)&&(g(c.label.options)&&c.label.options.noHide===!0&&b.showLabel(),h&&g(b.label)&&e(b.label._container)(f))},H=function(a,b,c,e,f,h,i){if(g(b)){if(!u.validateCoords(a))return d.warn("There are problems with lat-lng data, please verify your marker model"),void B(c,i,h);var j=a===b;if(g(a.iconAngle)&&b.iconAngle!==a.iconAngle&&c.setIconAngle(a.iconAngle),q(a.layer)||q(b.layer)&&(g(h.overlays[b.layer])&&h.overlays[b.layer].hasLayer(c)&&(h.overlays[b.layer].removeLayer(c),c.closePopup()),i.hasLayer(c)||i.addLayer(c)),(r(a.opacity)||r(parseFloat(a.opacity)))&&a.opacity!==b.opacity&&c.setOpacity(a.opacity),q(a.layer)&&b.layer!==a.layer){if(q(b.layer)&&g(h.overlays[b.layer])&&h.overlays[b.layer].hasLayer(c)&&h.overlays[b.layer].removeLayer(c),c.closePopup(),i.hasLayer(c)&&i.removeLayer(c),!g(h.overlays[a.layer]))return void d.error(v+"You must use a name of an existing layer");var k=h.overlays[a.layer];if(!(k instanceof L.LayerGroup||k instanceof L.FeatureGroup))return void d.error(v+'A marker can only be added to a layer of type "group" or "featureGroup"');k.addLayer(c),i.hasLayer(c)&&a.focus===!0&&c.openPopup()}if(a.draggable!==!0&&b.draggable===!0&&g(c.dragging)&&c.dragging.disable(),a.draggable===!0&&b.draggable!==!0&&(c.dragging?c.dragging.enable():L.Handler.MarkerDrag&&(c.dragging=new L.Handler.MarkerDrag(c),c.options.draggable=!0,c.dragging.enable())),s(a.icon)||s(b.icon)&&(c.setIcon(y()),c.closePopup(),c.unbindPopup(),q(a.message)&&c.bindPopup(a.message,a.popupOptions)),s(a.icon)&&s(b.icon)&&!angular.equals(a.icon,b.icon)){var l=!1;c.dragging&&(l=c.dragging.enabled()),c.setIcon(y(a.icon)),l&&c.dragging.enable(),c.closePopup(),c.unbindPopup(),q(a.message)&&(c.bindPopup(a.message,a.popupOptions),i.hasLayer(c)&&a.focus===!0&&c.openPopup())}!q(a.message)&&q(b.message)&&(c.closePopup(),c.unbindPopup()),p.LabelPlugin.isLoaded()&&(g(a.label)&&g(a.label.message)?"label"in b&&"message"in b.label&&!angular.equals(a.label.message,b.label.message)?c.updateLabelContent(a.label.message):!angular.isFunction(c.getLabel)||angular.isFunction(c.getLabel)&&!g(c.getLabel())?(c.bindLabel(a.label.message,a.label.options),G(c,a)):G(c,a):(!("label"in a)||"message"in a.label)&&angular.isFunction(c.unbindLabel)&&c.unbindLabel()),q(a.message)&&!q(b.message)&&c.bindPopup(a.message,a.popupOptions),q(a.message)&&q(b.message)&&a.message!==b.message&&c.setPopupContent(a.message);var m=!1;a.focus!==!0&&b.focus===!0&&(c.closePopup(),m=!0),(a.focus===!0&&(!g(b.focus)||b.focus===!1)||j&&a.focus===!0)&&(c.openPopup(),m=!0),b.zIndexOffset!==a.zIndexOffset&&c.setZIndexOffset(a.zIndexOffset);var n=c.getLatLng(),o=q(a.layer)&&p.MarkerClusterPlugin.is(h.overlays[a.layer]);o?m?(a.lat!==b.lat||a.lng!==b.lng)&&(h.overlays[a.layer].removeLayer(c),c.setLatLng([a.lat,a.lng]),h.overlays[a.layer].addLayer(c)):n.lat!==a.lat||n.lng!==a.lng?(h.overlays[a.layer].removeLayer(c),c.setLatLng([a.lat,a.lng]),h.overlays[a.layer].addLayer(c)):a.lat!==b.lat||a.lng!==b.lng?(h.overlays[a.layer].removeLayer(c),c.setLatLng([a.lat,a.lng]),h.overlays[a.layer].addLayer(c)):s(a.icon)&&s(b.icon)&&!angular.equals(a.icon,b.icon)&&(h.overlays[a.layer].removeLayer(c),h.overlays[a.layer].addLayer(c)):(n.lat!==a.lat||n.lng!==a.lng)&&c.setLatLng([a.lat,a.lng])}};return{resetMarkerGroup:z,resetMarkerGroups:A,deleteMarker:B,manageOpenPopup:F,manageOpenLabel:G,createMarker:function(a){if(!g(a)||!u.validateCoords(a))return void d.error(v+"The marker definition is not valid.");var b=u.getCoords(a);if(!g(b))return void d.error(v+"Unable to get coordinates from markerData.");var c={icon:y(a.icon),title:g(a.title)?a.title:"",draggable:g(a.draggable)?a.draggable:!1,clickable:g(a.clickable)?a.clickable:!0,riseOnHover:g(a.riseOnHover)?a.riseOnHover:!1,zIndexOffset:g(a.zIndexOffset)?a.zIndexOffset:0,iconAngle:g(a.iconAngle)?a.iconAngle:0};for(var e in a)a.hasOwnProperty(e)&&!c.hasOwnProperty(e)&&(c[e]=a[e]);var f=new L.marker(b,c);return q(a.message)||f.unbindPopup(),f},addMarkerToGroup:function(a,b,c,e){return q(b)?i.isLoaded()?(g(t[b])||(t[b]=new L.MarkerClusterGroup(c),e.addLayer(t[b])),void t[b].addLayer(a)):void d.error(v+"The MarkerCluster plugin is not loaded."):void d.error(v+"The marker group you have specified is invalid.")},listenMarkerEvents:function(a,b,c,d,e){a.on("popupopen",function(){o(c,function(){(g(a._popup)||g(a._popup._contentNode))&&(b.focus=!0,F(a,b,e))})}),a.on("popupclose",function(){o(c,function(){b.focus=!1})}),a.on("add",function(){o(c,function(){"label"in b&&G(a,b)})})},updateMarker:H,addMarkerWatcher:function(a,b,c,d,e,f){var i=p.getObjectArrayPath("markers."+b);f=h(f,!0);var j=c.$watch(i,function(f,h){return g(f)?void H(f,h,a,b,c,d,e):(B(a,e,d),void j())},f)},string:w,log:x}}]),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 e(a)})}function e(a){return i(a)?new L.LatLng(a[0],a[1]):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={},d=0;d0&&e(a[0].boundingbox)?i.resolve(a[0]):i.reject("[Nominatim] Invalid address")}),i.promise}}}]),angular.module("leaflet-directive").directive("bounds",["$log","$timeout","$http","leafletHelpers","nominatimService","leafletBoundsHelpers",function(a,b,c,d,e,f){return{restrict:"A",scope:!1,replace:!1,require:["leaflet"],link:function(c,g,h,i){var j=d.isDefined,k=f.createLeafletBounds,l=i[0].getLeafletScope(),m=i[0],n=d.errorHeader+" [Bounds] ",o=function(a){return 0===a._southWest.lat&&0===a._southWest.lng&&0===a._northEast.lat&&0===a._northEast.lng};m.getMap().then(function(d){l.$on("boundsChanged",function(a){var c=a.currentScope,e=d.getBounds();if(!o(e)&&!c.settingBoundsFromScope){c.settingBoundsFromLeaflet=!0;var f={northEast:{lat:e._northEast.lat,lng:e._northEast.lng},southWest:{lat:e._southWest.lat,lng:e._southWest.lng},options:e.options};angular.equals(c.bounds,f)||(c.bounds=f),b(function(){c.settingBoundsFromLeaflet=!1})}});var f;l.$watch("bounds",function(g){if(!c.settingBoundsFromLeaflet){if(j(g.address)&&g.address!==f)return c.settingBoundsFromScope=!0,e.query(g.address,h.id).then(function(a){var b=a.boundingbox,c=[[b[0],b[2]],[b[1],b[3]]];d.fitBounds(c)},function(b){a.error(n+" "+b+".")}),f=g.address,void b(function(){c.settingBoundsFromScope=!1});var i=k(g);i&&!d.getBounds().equals(i)&&(c.settingBoundsFromScope=!0,d.fitBounds(i,g.options),b(function(){c.settingBoundsFromScope=!1}))}},!0)})}}}]);var centerDirectiveTypes=["center","lfCenter"],centerDirectives={};centerDirectiveTypes.forEach(function(a){centerDirectives[a]=["$log","$q","$location","$timeout","leafletMapDefaults","leafletHelpers","leafletBoundsHelpers","leafletMapEvents",function(b,c,d,e,f,g,h,i){var j,k=g.isDefined,l=g.isNumber,m=g.isSameCenterOnMap,n=g.safeApply,o=g.isValidCenter,p=h.isValidBounds,q=g.isUndefinedOrEmpty,r=g.errorHeader,s=function(a,b){return k(a)&&p(a)&&q(b)};return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){j=c.defer(),this.getCenter=function(){return j.promise}},link:function(c,g,p,q){var t=q.getLeafletScope(),u=t[a];q.getMap().then(function(c){var g=f.getDefaults(p.id);if(-1!==p[a].search("-"))return b.error(r+' The "center" variable can\'t use a "-" on its key name: "'+p[a]+'".'),void c.setView([g.center.lat,g.center.lng],g.center.zoom);if(s(t.bounds,u))c.fitBounds(h.createLeafletBounds(t.bounds),t.bounds.options),u=c.getCenter(),n(t,function(b){angular.extend(b[a],{lat:c.getCenter().lat,lng:c.getCenter().lng,zoom:c.getZoom(),autoDiscover:!1})}),n(t,function(a){var b=c.getBounds();a.bounds={northEast:{lat:b._northEast.lat,lng:b._northEast.lng},southWest:{lat:b._southWest.lat,lng:b._southWest.lng}}});else{if(!k(u))return b.error(r+' The "center" property is not defined in the main scope'),void c.setView([g.center.lat,g.center.lng],g.center.zoom);k(u.lat)&&k(u.lng)||k(u.autoDiscover)||angular.copy(g.center,u)}var q,v;if("yes"===p.urlHashCenter){var w=function(){var a,b=d.search();if(k(b.c)){var c=b.c.split(":");3===c.length&&(a={lat:parseFloat(c[0]),lng:parseFloat(c[1]),zoom:parseInt(c[2],10)})}return a};q=w(),t.$on("$locationChangeSuccess",function(b){var d=b.currentScope,e=w();k(e)&&!m(e,c)&&angular.extend(d[a],{lat:e.lat,lng:e.lng,zoom:e.zoom})})}t.$watch(a,function(a){return t.settingCenterFromLeaflet?void 0:(k(q)&&(angular.copy(q,a),q=void 0),o(a)||a.autoDiscover===!0?a.autoDiscover===!0?(l(a.zoom)||c.setView([g.center.lat,g.center.lng],g.center.zoom),void(l(a.zoom)&&a.zoom>g.center.zoom?c.locate({setView:!0,maxZoom:a.zoom}):k(g.maxZoom)?c.locate({setView:!0,maxZoom:g.maxZoom}):c.locate({setView:!0}))):void(v&&m(a,c)||(t.settingCenterFromScope=!0,c.setView([a.lat,a.lng],a.zoom),i.notifyCenterChangedToBounds(t,c),e(function(){t.settingCenterFromScope=!1}))):void b.warn(r+" invalid 'center'"))},!0),c.whenReady(function(){v=!0}),c.on("moveend",function(){j.resolve(),i.notifyCenterUrlHashChanged(t,c,p,d.search()),m(u,c)||t.settingCenterFromScope||(t.settingCenterFromLeaflet=!0,n(t,function(b){t.settingCenterFromScope||angular.extend(b[a],{lat:c.getCenter().lat,lng:c.getCenter().lng,zoom:c.getZoom(),autoDiscover:!1}),i.notifyCenterChangedToBounds(t,c),e(function(){t.settingCenterFromLeaflet=!1})}))}),u.autoDiscover===!0&&c.on("locationerror",function(){b.warn(r+" The Geolocation API is unauthorized on this page."),o(u)?(c.setView([u.lat,u.lng],u.zoom),i.notifyCenterChangedToBounds(t,c)):(c.setView([g.center.lat,g.center.lng],g.center.zoom),i.notifyCenterChangedToBounds(t,c))})})}}}]}),centerDirectiveTypes.forEach(function(a){angular.module("leaflet-directive").directive(a,centerDirectives[a])}),angular.module("leaflet-directive").directive("controls",["$log","leafletHelpers","leafletControlHelpers",function(a,b,c){return{restrict:"A",scope:!1,replace:!1,require:"?^leaflet",link:function(d,e,f,g){if(g){var h=c.createControl,i=c.isValidControlType,j=g.getLeafletScope(),k=b.isDefined,l=b.isArray,m={},n=b.errorHeader+" [Controls] ";g.getMap().then(function(b){j.$watchCollection("controls",function(c){for(var d in m)k(c[d])||(b.hasControl(m[d])&&b.removeControl(m[d]),delete m[d]);for(var e in c){var f,g=k(c[e].type)?c[e].type:e;if(!i(g))return void a.error(n+" Invalid control type: "+g+".");if("custom"!==g)f=h(g,c[e]),b.addControl(f),m[e]=f;else{var j=c[e];if(l(j))for(var o in j){var p=j[o];b.addControl(p),m[e]=k(m[e])?m[e].concat([p]):[p]}else b.addControl(j),m[e]=j}}})})}}}}]),angular.module("leaflet-directive").directive("decorations",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(c,d,e,f){function g(b){return k(b)&&k(b.coordinates)&&(j.isLoaded()||a.error("[AngularJS - Leaflet] The PolylineDecorator Plugin is not loaded.")),L.polylineDecorator(b.coordinates)}function h(a,b){return k(a)&&k(b)&&k(b.coordinates)&&k(b.patterns)?(a.setPaths(b.coordinates),a.setPatterns(b.patterns),a):void 0}var i=f.getLeafletScope(),j=b.PolylineDecoratorPlugin,k=b.isDefined,l={};f.getMap().then(function(a){i.$watch("decorations",function(b){for(var c in l)k(b[c])&&angular.equals(b[c],l)||(a.removeLayer(l[c]),delete l[c]);for(var d in b){var e=b[d],f=g(e);k(f)&&(l[d]=f,a.addLayer(f),h(f,e))}},!0)})}}}]),angular.module("leaflet-directive").directive("eventBroadcast",["$log","$rootScope","leafletHelpers","leafletMapEvents","leafletIterators",function(a,b,c,d,e){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(b,f,g,h){var i=c.isObject,j=c.isDefined,k=h.getLeafletScope(),l=k.eventBroadcast,m=d.getAvailableMapEvents(),n=d.addEvents;h.getMap().then(function(b){var c=[],d="broadcast";j(l.map)?i(l.map)?("emit"!==l.map.logic&&"broadcast"!==l.map.logic?a.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):d=l.map.logic,i(l.map.enable)&&l.map.enable.length>=0?e.each(l.map.enable,function(a){-1===c.indexOf(a)&&-1!==m.indexOf(a)&&c.push(a)}):a.warn("[AngularJS - Leaflet] event-broadcast.map.enable must be an object check your model.")):a.warn("[AngularJS - Leaflet] event-broadcast.map must be an object check your model."):c=m,n(b,c,"eventName",k,d)})}}}]),angular.module("leaflet-directive").directive("geojson",["$log","$rootScope","leafletData","leafletHelpers","leafletWatchHelpers","leafletDirectiveControlsHelpers","leafletIterators","leafletGeoJsonEvents",function(a,b,c,d,e,f,g,h){var i=e.maybeWatch,j=d.watchOptions,k=f.extend,l=d,m=g;return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,b,e,f){var g=d.isDefined,n=f.getLeafletScope(),o={},p=!1;f.getMap().then(function(a){var b=n.geojsonWatchOptions||j,f=function(a,b){var c;return c=angular.isFunction(a.onEachFeature)?a.onEachFeature:function(c,f){d.LabelPlugin.isLoaded()&&g(c.properties.description)&&f.bindLabel(c.properties.description),h.bindEvents(e.id,f,null,c,n,b,{resetStyleOnMouseout:a.resetStyleOnMouseout,mapId:e.id})}},q=l.isDefined(e.geojsonNested)&&l.isTruthy(e.geojsonNested),r=function(){if(o){var b=function(b){g(b)&&a.hasLayer(b)&&a.removeLayer(b)};return q?void m.each(o,function(a){b(a)}):void b(o)}},s=function(b,d){var h=angular.copy(b);if(g(h)&&g(h.data)){var i=f(h,d);g(h.options)||(h.options={style:h.style,filter:h.filter,onEachFeature:i,pointToLayer:h.pointToLayer});var j=L.geoJson(h.data,h.options);d&&l.isString(d)?o[d]=j:o=j,j.addTo(a),p||(p=!0,c.setGeoJSON(o,e.id))}},t=function(a){if(r(),q){if(!a||!Object.keys(a).length)return;return void m.each(a,function(a,b){s(a,b)})}s(a)};k(e.id,"geojson",t,r),i(n,"geojson",b,function(a){t(a)})})}}}]),angular.module("leaflet-directive").directive("layercontrol",["$filter","$log","leafletData","leafletHelpers",function(a,b,c,d){return{restrict:"E",scope:{icons:"=?",autoHideOpacity:"=?",showGroups:"=?",title:"@",baseTitle:"@",overlaysTitle:"@"},replace:!0,transclude:!1,require:"^leaflet",controller:["$scope","$element","$sce",function(a,e,f){b.debug("[Angular Directive - Layers] layers",a,e);var g=d.safeApply,h=d.isDefined;angular.extend(a,{baselayer:"",oldGroup:"",layerProperties:{},groupProperties:{},rangeIsSupported:d.rangeIsSupported(),changeBaseLayer:function(b,e){d.safeApply(a,function(d){d.baselayer=b,c.getMap().then(function(e){c.getLayers().then(function(c){if(!e.hasLayer(c.baselayers[b])){for(var f in d.layers.baselayers)d.layers.baselayers[f].icon=d.icons.unradio,e.hasLayer(c.baselayers[f])&&e.removeLayer(c.baselayers[f]);e.addLayer(c.baselayers[b]),d.layers.baselayers[b].icon=a.icons.radio}})})}),e.preventDefault()},moveLayer:function(b,c,d){var e=Object.keys(a.layers.baselayers).length;if(c>=1+e&&c<=a.overlaysArray.length+e){var f;for(var h in a.layers.overlays)if(a.layers.overlays[h].index===c){f=a.layers.overlays[h];break}f&&g(a,function(){f.index=b.index,b.index=c})}d.stopPropagation(),d.preventDefault()},initIndex:function(b,c){var d=Object.keys(a.layers.baselayers).length;b.index=h(b.index)?b.index:c+d+1},initGroup:function(b){a.groupProperties[b]=a.groupProperties[b]?a.groupProperties[b]:{}},toggleOpacity:function(b,c){if(c.visible){if(a.autoHideOpacity&&!a.layerProperties[c.name].opacityControl)for(var d in a.layerProperties)a.layerProperties[d].opacityControl=!1;a.layerProperties[c.name].opacityControl=!a.layerProperties[c.name].opacityControl}b.stopPropagation(),b.preventDefault()},toggleLegend:function(b){a.layerProperties[b.name].showLegend=!a.layerProperties[b.name].showLegend},showLegend:function(b){return b.legend&&a.layerProperties[b.name].showLegend},unsafeHTML:function(a){return f.trustAsHtml(a)},getOpacityIcon:function(b){return b.visible&&a.layerProperties[b.name].opacityControl?a.icons.close:a.icons.open},getGroupIcon:function(b){return b.visible?a.icons.check:a.icons.uncheck},changeOpacity:function(b){var d=a.layerProperties[b.name].opacity;c.getMap().then(function(e){c.getLayers().then(function(c){var f;for(var g in a.layers.overlays)if(a.layers.overlays[g]===b){f=c.overlays[g];break}e.hasLayer(f)&&(f.setOpacity&&f.setOpacity(d/100),f.getLayers&&f.eachLayer&&f.eachLayer(function(a){a.setOpacity&&a.setOpacity(d/100)}))})})},changeGroupVisibility:function(b){if(h(a.groupProperties[b])){var c=a.groupProperties[b].visible;for(var d in a.layers.overlays){var e=a.layers.overlays[d];e.group===b&&(e.visible=c)}}}});var i=e.get(0);L.Browser.touch?L.DomEvent.on(i,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"mousewheel",L.DomEvent.stopPropagation))}],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=e.safeAddLayer,o=e.safeRemoveLayer,p=f.updateLayersControl,q=!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&&(n(b,j.baselayers[f]),e=!0)):delete l.baselayers[f]}!e&&Object.keys(j.baselayers).length>0&&n(b,j.baselayers[Object.keys(l.baselayers)[0]]);for(f in l.overlays){var r=m(l.overlays[f]);i(r)?(j.overlays[f]=r,l.overlays[f].visible===!0&&n(b,j.overlays[f])):delete l.overlays[f]}k.$watch("layers.baselayers",function(a,c){if(angular.equals(a,c))return q=p(b,d,q,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]):n(b,j.baselayers[f]);else{var g=m(a[f]);i(g)&&(j.baselayers[f]=g,a[f].top===!0&&n(b,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&&n(b,j.baselayers[Object.keys(j.baselayers)[0]]),q=p(b,d,q,a,l.overlays,j)},!0),k.$watch("layers.overlays",function(a,c){if(angular.equals(a,c))return q=p(b,d,q,l.baselayers,a,j),!0;for(var e in j.overlays)if(!i(a[e])||a[e].doRefresh){if(b.hasLayer(j.overlays[e])){var f=i(a[e])?a[e].layerOptions:null;o(b,j.overlays[e],f)}delete j.overlays[e],a[e]&&a[e].doRefresh&&(a[e].doRefresh=!1)}for(var g in a){if(i(j.overlays[g]))a[g].visible&&!b.hasLayer(j.overlays[g])?n(b,j.overlays[g]):a[g].visible===!1&&b.hasLayer(j.overlays[g])&&o(b,j.overlays[g],a[g].layerOptions);else{
-var h=m(a[g]);if(!i(h))continue;j.overlays[g]=h,a[g].visible===!0&&n(b,j.overlays[g])}a[g].visible&&b._loaded&&a[g].data&&"heatmap"===a[g].type&&(j.overlays[g].setData(a[g].data),j.overlays[g].update())}q=p(b,d,q,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,o){for(var u in c)if(!o[u])if(-1===u.search("-")){var v=n.copy(c[u]),w=n.getObjectDotPath(k?[k,u]:[u]),x=z(g,u,k);if(l(x)){var y=l(y)?d[u]:void 0;q(v,y,x,w,i,f,e)}else{var C=t(v),D=(v?v.layer:void 0)||k;if(!l(C)){a.error(m+" Received invalid data on the marker "+u+".");continue}if(A(C,g,u,k),l(v.message)&&C.bindPopup(v.message,v.popupOptions),l(v.group)){var E=l(v.groupOption)?v.groupOption:null;s(C,v.group,E,e)}if(n.LabelPlugin.isLoaded()&&l(v.label)&&l(v.label.message)&&C.bindLabel(v.label.message,v.label.options),l(v)&&(l(v.layer)||l(k))){var F=B(D,f,v,C,j.individual.doWatch,e);if(!F)continue}else l(v.group)||(e.addLayer(C),j.individual.doWatch||v.focus!==!0||C.openPopup());j.individual.doWatch&&p(C,w,i,f,e,j.individual.isDeep),r(C,v,i,j.individual.doWatch,e),h.bindEvents(b,C,w,v,i,D)}}else a.error('The marker can\'t use a "-" on his key name: "'+u+'".')},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,f){c(d,f);var k=null;return j?void v.each(d,function(c,j){var m=l(m)?f[j]:void 0;k=F(d[j],m,g[j]),C(e.id,c,f,a,b,g,h,i,j,k)}):(k=F(d,f,g),void C(e.id,d,f,a,b,g,h,i,void 0,k))};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||e.lfCenter||a.fitBounds(d)})})}}}]),angular.module("leaflet-directive").directive("paths",["$log","$q","leafletData","leafletMapDefaults","leafletHelpers","leafletPathsHelpers","leafletPathEvents",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 k in d)m(c[k])||(f.removeLayer(d[k]),delete d[k]);for(var l in c)if(0!==l.search("\\$"))if(-1===l.search("-")){if(!m(d[l])){var p=c[l],t=q(l,c[l],h);if(m(t)&&m(p.message)&&t.bindPopup(p.message,p.popupOptions),e.LabelPlugin.isLoaded()&&m(p.label)&&m(p.label.message)&&t.bindLabel(p.label.message,p.label.options),m(p)&&m(p.layer)){if(!n(p.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[p.layer])){a.error('[AngularJS - Leaflet] A path can only be added to a layer of type "group"');continue}var u=b.overlays[p.layer];if(!(u instanceof L.LayerGroup||u instanceof L.FeatureGroup)){a.error('[AngularJS - Leaflet] Adding a path to an overlay needs a overlay of the type "group" or "featureGroup"');continue}d[l]=t,u.addLayer(t),g?i(t,l):s(t,p.type,p)}else m(t)&&(d[l]=t,f.addLayer(t),g?i(t,l):s(t,p.type,p));r(j.id,t,l,p,o)}}else a.error('[AngularJS - Leaflet] The path name "'+l+'" 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,f){var h=e.tileLayerOptions,j=e.tileLayer;return!i(c.url)&&i(d)?void a.removeLayer(d):i(d)?!i(c.url)||!i(c.options)||c.type===f.type&&angular.equals(c.options,h)?void(i(c.url)&&d.setUrl(c.url)):(a.removeLayer(d),h=e.tileLayerOptions,angular.copy(c.options,h),j=c.url,d="wms"===c.type?L.tileLayer.wms(j,h):L.tileLayer(j,h),d.addTo(a),void b.setTiles(d,g.id)):(i(c.options)&&angular.copy(c.options,h),i(c.url)&&(j=c.url),d="wms"===c.type?L.tileLayer.wms(j,h):L.tileLayer(j,h),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,c.debug("LeafletEventsHelpersFactory: lObjectType: "+b+"rootBroadcastName: "+a),this.lObjectType=b};return j.prototype.getAvailableEvents=function(){return[]},j.prototype.genDispatchEvent=function(a,b,d,e,f,g,h,i,j){var k=this;return a=a||"",a&&(a="."+a),function(l){var m=k.rootBroadcastName+a+"."+b;c.debug(m),k.fire(e,m,d,l,l.target||f,h,g,i,j)}},j.prototype.fire=function(b,c,d,g,h,i,j,k){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,l){var m=[],n="emit",o=this;if(f(j.eventBroadcast))if(g(j.eventBroadcast))if(f(j.eventBroadcast[o.lObjectType]))if(g(j.eventBroadcast[o.lObjectType])){f(j.eventBroadcast[this.lObjectType].logic)&&"emit"!==j.eventBroadcast[o.lObjectType].logic&&"broadcast"!==j.eventBroadcast[o.lObjectType].logic&&c.warn(i+"Available event propagation logic are: 'emit' or 'broadcast'.");var p=!1,q=!1;f(j.eventBroadcast[o.lObjectType].enable)&&h(j.eventBroadcast[o.lObjectType].enable)&&(p=!0),f(j.eventBroadcast[o.lObjectType].disable)&&h(j.eventBroadcast[o.lObjectType].disable)&&(q=!0),p&&q?c.warn(i+"can not enable and disable events at the same time"):p||q?p?j.eventBroadcast[this.lObjectType].enable.forEach(function(a){-1!==m.indexOf(a)?c.warn(i+"This event "+a+" is already enabled"):-1===o.getAvailableEvents().indexOf(a)?c.warn(i+"This event "+a+" does not exist"):m.push(a)}):(m=this.getAvailableEvents(),j.eventBroadcast[o.lObjectType].disable.forEach(function(a){var b=m.indexOf(a);-1===b?c.warn(i+"This event "+a+" does not exist or has been already disabled"):m.splice(b,1)})):c.warn(i+"must enable or disable events")}else c.warn(i+"event-broadcast."+[o.lObjectType]+" must be an object check your model.");else m=this.getAvailableEvents();else c.error(i+"event-broadcast must be an object check your model.");else m=this.getAvailableEvents();return m.forEach(function(c){b.on(c,o.genDispatchEvent(a,c,n,j,b,d,e,k,l))}),n},j}]).service("leafletEventsHelpers",["LeafletEventsHelpersFactory",function(a){return new a}]),angular.module("leaflet-directive").factory("leafletGeoJsonEvents",["$rootScope","$q","$log","leafletHelpers","LeafletEventsHelpersFactory","leafletData",function(a,b,c,d,e,f){var g=d.safeApply,h=e,i=function(){h.call(this,"leafletDirectiveGeoJson","geojson")};return i.prototype=new h,i.prototype.genDispatchEvent=function(b,c,d,e,i,j,k,l,m){var n=h.prototype.genDispatchEvent.call(this,b,c,d,e,i,j,k,l),o=this;return function(b){"mouseout"===c&&(m.resetStyleOnMouseout&&f.getGeoJSON(m.mapId).then(function(a){var c=l?a[l]:a;c.resetStyle(b.target)}),g(e,function(){a.$broadcast(o.rootBroadcastName+".mouseout",b)})),n(b)}},i.prototype.getAvailableEvents=function(){return["click","dblclick","mouseover","mouseout"]},new i}]),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,i){var j=f.replace("markers.","");return g.prototype.genDispatchEvent.call(this,a,b,c,d,e,j,h,i)},h.prototype.getAvailableEvents=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu"]},h.prototype.genEvents=function(a,b,c,d,e,g,h,i){var j=this,k=this.getAvailableEvents(),l=f.getObjectArrayPath("markers."+g);k.forEach(function(b){e.label.on(b,j.genDispatchEvent(a,b,c,d,e.label,l,h,i))})},h.prototype.bindEvents=function(){},new h}]),angular.module("leaflet-directive").factory("leafletMapEvents",["$rootScope","$q","$log","leafletHelpers","leafletEventsHelpers","leafletIterators",function(a,b,c,d,e,f){var g=d.isDefined,h=e.fire,i=function(){return["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focus","blur","preclick","load","unload","viewreset","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoomanim","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"]},j=function(a,b,d,e){return e&&(e+="."),function(f){var g="leafletDirectiveMap."+e+b;c.debug(g),h(a,g,d,f,f.target,a)}},k=function(a){a.$broadcast("boundsChanged")},l=function(a,b,c,d){if(g(c.urlHashCenter)){var e=b.getCenter(),f=e.lat.toFixed(4)+":"+e.lng.toFixed(4)+":"+b.getZoom();g(d.c)&&d.c===f||a.$emit("centerUrlHash",f)}},m=function(a,b,c,d,e){f.each(b,function(b){var f={};f[c]=b,a.on(b,j(d,b,e,a._container.id||""),f)})};return{getAvailableMapEvents:i,genDispatchMapEvent:j,notifyCenterChangedToBounds:k,notifyCenterUrlHashChanged:l,addEvents:m}}]),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,j){var l=k.prototype.genDispatchEvent.call(this,b,c,d,e,f,h,i,j);return function(b){"click"===c?g(e,function(){a.$broadcast("leafletDirectiveMarkersClick",h)}):"dragend"===c&&(g(e,function(){i.lat=f.getLatLng().lat,i.lng=f.getLatLng().lng}),i.message&&i.focus===!0&&f.openPopup()),l(b)}},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,f){var g=k.prototype.bindEvents.call(this,a,b,c,d,e,f);i.LabelPlugin.isLoaded()&&h(b.label)&&j.genEvents(a,c,g,e,b,d,f)},new l}]),angular.module("leaflet-directive").factory("leafletPathEvents",["$rootScope","$q","$log","leafletHelpers","leafletLabelEvents","leafletEventsHelpers",function(a,b,c,d,e,f){var g=d.isDefined,h=d.isObject,i=d,j=d.errorHeader,k=e,l=f.fire,m=function(a,b,d,e,f,g,h,i){return a=a||"",a&&(a="."+a),function(j){var k="leafletDirectivePath"+a+"."+b;c.debug(k),l(e,k,d,j,j.target||f,h,g,i)}},n=function(a,b,d,e,f){var l,n,p=[],q="broadcast";if(g(f.eventBroadcast))if(h(f.eventBroadcast))if(g(f.eventBroadcast.path))if(h(f.eventBroadcast.paths))c.warn(j+"event-broadcast.path must be an object check your model.");else{void 0!==f.eventBroadcast.path.logic&&null!==f.eventBroadcast.path.logic&&("emit"!==f.eventBroadcast.path.logic&&"broadcast"!==f.eventBroadcast.path.logic?c.warn(j+"Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===f.eventBroadcast.path.logic&&(q="emit"));var r=!1,s=!1;if(void 0!==f.eventBroadcast.path.enable&&null!==f.eventBroadcast.path.enable&&"object"==typeof f.eventBroadcast.path.enable&&(r=!0),void 0!==f.eventBroadcast.path.disable&&null!==f.eventBroadcast.path.disable&&"object"==typeof f.eventBroadcast.path.disable&&(s=!0),r&&s)c.warn(j+"can not enable and disable events at the same time");else if(r||s)if(r)for(l=0;l',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){if(!isString(a.type))return $log.error("[AngularJS - Leaflet] A layer must have a valid type defined."),!1;if(-1!==Object.keys(layerTypes).indexOf(a.type)){if(layerTypes[a.type].mustHaveUrl&&!isString(a.url))return $log.error("[AngularJS - Leaflet] A base layer must have an url"),!1;if(layerTypes[a.type].mustHaveData&&!isDefined(a.data))return $log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute'),!1;if(layerTypes[a.type].mustHaveLayer&&!isDefined(a.layer))return $log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have an layer defined"),!1;if(layerTypes[a.type].mustHaveBounds&&!isDefined(a.bounds))return $log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have bounds defined"),!1;if(layerTypes[a.type].mustHaveKey&&!isDefined(a.key))return $log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have key defined"),!1}else if("function"!=typeof L.tileLayer[a.type])return!1;return!0}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]?layerTypes[a.type].createLayer(c):L.tileLayer[a.type](c.url,c.options)}}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![](data:'+h.contentType+)
'+h.label+"
"}}else"image"===c&&(a.innerHTML='
')},b=function(b,c,d,e){return function(){var f=L.DomUtil.create("div",c);return L.Browser.touch?L.DomEvent.on(f,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(f),L.DomEvent.on(f,"mousewheel",L.DomEvent.stopPropagation)),a(f,b,d,e),f}},c=function(a,b){return function(){for(var c=L.DomUtil.create("div",b),d=0;d'+a.labels[d]+"
";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{getOnAddLegend:b,getOnAddArrayLegend:c,updateLegend:a}}),angular.module("leaflet-directive").factory("leafletMapDefaults",["$q","leafletHelpers",function(a,b){function c(){return{keyboard:!0,dragging:!0,worldCopyJump:!1,doubleClickZoom:!0,scrollWheelZoom:!0,tap:!0,touchZoom:!0,zoomControl:!0,zoomsliderControl:!1,zoomControlPosition:"topleft",attributionControl:!0,controls:{layers:{visible:!0,position:"topright",collapsed:!0}},nominatim:{server:" http://nominatim.openstreetmap.org/search"},crs:L.CRS.EPSG3857,tileLayer:"//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",tileLayerOptions:{attribution:'© OpenStreetMap contributors'},path:{weight:10,opacity:1,color:"#0000ff"},center:{lat:0,lng:0,zoom:1}}}var d=b.isDefined,e=b.isObject,f=b.obtainEffectiveMapId,g={};return{reset:function(){g={}},getDefaults:function(a){var b=f(g,a);return g[b]},getMapCreationDefaults:function(a){var b=f(g,a),c=g[b],e={maxZoom:c.maxZoom,keyboard:c.keyboard,dragging:c.dragging,zoomControl:c.zoomControl,doubleClickZoom:c.doubleClickZoom,scrollWheelZoom:c.scrollWheelZoom,tap:c.tap,touchZoom:c.touchZoom,attributionControl:c.attributionControl,worldCopyJump:c.worldCopyJump,crs:c.crs};if(d(c.minZoom)&&(e.minZoom=c.minZoom),d(c.zoomAnimation)&&(e.zoomAnimation=c.zoomAnimation),d(c.fadeAnimation)&&(e.fadeAnimation=c.fadeAnimation),d(c.markerZoomAnimation)&&(e.markerZoomAnimation=c.markerZoomAnimation),c.map)for(var h in c.map)e[h]=c.map[h];return e},setDefaults:function(a,b){var h=c();d(a)&&(h.doubleClickZoom=d(a.doubleClickZoom)?a.doubleClickZoom:h.doubleClickZoom,h.scrollWheelZoom=d(a.scrollWheelZoom)?a.scrollWheelZoom:h.doubleClickZoom,h.tap=d(a.tap)?a.tap:h.tap,h.touchZoom=d(a.touchZoom)?a.touchZoom:h.doubleClickZoom,h.zoomControl=d(a.zoomControl)?a.zoomControl:h.zoomControl,h.zoomsliderControl=d(a.zoomsliderControl)?a.zoomsliderControl:h.zoomsliderControl,h.attributionControl=d(a.attributionControl)?a.attributionControl:h.attributionControl,h.tileLayer=d(a.tileLayer)?a.tileLayer:h.tileLayer,h.zoomControlPosition=d(a.zoomControlPosition)?a.zoomControlPosition:h.zoomControlPosition,h.keyboard=d(a.keyboard)?a.keyboard:h.keyboard,h.dragging=d(a.dragging)?a.dragging:h.dragging,d(a.controls)&&angular.extend(h.controls,a.controls),e(a.crs)?h.crs=a.crs:d(L.CRS[a.crs])&&(h.crs=L.CRS[a.crs]),d(a.center)&&angular.copy(a.center,h.center),d(a.tileLayerOptions)&&angular.copy(a.tileLayerOptions,h.tileLayerOptions),d(a.maxZoom)&&(h.maxZoom=a.maxZoom),d(a.minZoom)&&(h.minZoom=a.minZoom),d(a.zoomAnimation)&&(h.zoomAnimation=a.zoomAnimation),d(a.fadeAnimation)&&(h.fadeAnimation=a.fadeAnimation),d(a.markerZoomAnimation)&&(h.markerZoomAnimation=a.markerZoomAnimation),d(a.worldCopyJump)&&(h.worldCopyJump=a.worldCopyJump),d(a.map)&&(h.map=a.map),d(a.path)&&(h.path=a.path));var i=f(g,b);return g[i]=h,h}}}]),angular.module("leaflet-directive").service("leafletMarkersHelpers",["$rootScope","$timeout","leafletHelpers","$log","$compile","leafletGeoJsonHelpers",function(a,b,c,d,e,f){
+var g=c.isDefined,h=c.defaultTo,i=c.MarkerClusterPlugin,j=c.AwesomeMarkersPlugin,k=c.VectorMarkersPlugin,l=c.MakiMarkersPlugin,m=c.ExtraMarkersPlugin,n=c.DomMarkersPlugin,o=c.safeApply,p=c,q=c.isString,r=c.isNumber,s=c.isObject,t={},u=f,v=c.errorHeader,w=function(a){var b="";return["_icon","_latlng","_leaflet_id","_map","_shadow"].forEach(function(c){b+=c+": "+h(a[c],"undefined")+" \n"}),"[leafletMarker] : \n"+b},x=function(a,b){var c=b?console:d;c.debug(w(a))},y=function(b){if(g(b)&&g(b.type)&&"awesomeMarker"===b.type)return j.isLoaded()||d.error(v+" The AwesomeMarkers Plugin is not loaded."),new L.AwesomeMarkers.icon(b);if(g(b)&&g(b.type)&&"vectorMarker"===b.type)return k.isLoaded()||d.error(v+" The VectorMarkers Plugin is not loaded."),new L.VectorMarkers.icon(b);if(g(b)&&g(b.type)&&"makiMarker"===b.type)return l.isLoaded()||d.error(v+"The MakiMarkers Plugin is not loaded."),new L.MakiMarkers.icon(b);if(g(b)&&g(b.type)&&"extraMarker"===b.type)return m.isLoaded()||d.error(v+"The ExtraMarkers Plugin is not loaded."),new L.ExtraMarkers.icon(b);if(g(b)&&g(b.type)&&"div"===b.type)return new L.divIcon(b);if(g(b)&&g(b.type)&&"dom"===b.type){n.isLoaded()||d.error(v+"The DomMarkers Plugin is not loaded.");var c=angular.isFunction(b.getMarkerScope)?b.getMarkerScope():a,f=e(b.template)(c),h=angular.copy(b);return h.element=f[0],new L.DomMarkers.icon(h)}if(g(b)&&g(b.type)&&"icon"===b.type)return b.icon;if(g(b)&&g(b.type))return new L.Icon[b.type](b);var i="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==",o="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 g(b)&&g(b.iconUrl)?new L.Icon(b):new L.Icon.Default({iconUrl:i,shadowUrl:o,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]})},z=function(a){g(t[a])&&t.splice(a,1)},A=function(){t={}},B=function(a,b,c){if(a.closePopup(),g(c)&&g(c.overlays))for(var d in c.overlays)if((c.overlays[d]instanceof L.LayerGroup||c.overlays[d]instanceof L.FeatureGroup)&&c.overlays[d].hasLayer(a))return void c.overlays[d].removeLayer(a);if(g(t))for(var e in t)t[e].hasLayer(a)&&t[e].removeLayer(a);b.hasLayer(a)&&b.removeLayer(a)},C=function(a,b){var c=a._popup._container.offsetHeight,d=new L.Point(a._popup._containerLeft,-c-a._popup._containerBottom),e=b.layerPointToContainerPoint(d);null!==e&&a._popup._adjustPan()},D=function(a,b){e(a._popup._contentNode)(b)},E=function(a,c,d){var e=a._popup._contentNode.innerText||a._popup._contentNode.textContent;e.length<1&&b(function(){E(a,c,d)});var f=a._popup._contentNode.offsetWidth;return a._popup._updateLayout(),a._popup._updatePosition(),a._popup.options.autoPan&&C(a,d),f},F=function(b,c,e){var f=angular.isFunction(c.getMessageScope)?c.getMessageScope():a,h=g(c.compileMessage)?c.compileMessage:!0;if(h){if(!g(b._popup)||!g(b._popup._contentNode))return d.error(v+"Popup is invalid or does not have any content."),!1;D(b,f),E(b,c,e)}},G=function(b,c){var d=angular.isFunction(c.getMessageScope)?c.getMessageScope():a,f=angular.isFunction(c.getLabelScope)?c.getLabelScope():d,h=g(c.compileMessage)?c.compileMessage:!0;p.LabelPlugin.isLoaded()&&g(c.label)&&(g(c.label.options)&&c.label.options.noHide===!0&&b.showLabel(),h&&g(b.label)&&e(b.label._container)(f))},H=function(a,b,c,e,f,h,i){if(g(b)){if(!u.validateCoords(a))return d.warn("There are problems with lat-lng data, please verify your marker model"),void B(c,i,h);var j=a===b;if(g(a.iconAngle)&&b.iconAngle!==a.iconAngle&&c.setIconAngle(a.iconAngle),q(a.layer)||q(b.layer)&&(g(h.overlays[b.layer])&&h.overlays[b.layer].hasLayer(c)&&(h.overlays[b.layer].removeLayer(c),c.closePopup()),i.hasLayer(c)||i.addLayer(c)),(r(a.opacity)||r(parseFloat(a.opacity)))&&a.opacity!==b.opacity&&c.setOpacity(a.opacity),q(a.layer)&&b.layer!==a.layer){if(q(b.layer)&&g(h.overlays[b.layer])&&h.overlays[b.layer].hasLayer(c)&&h.overlays[b.layer].removeLayer(c),c.closePopup(),i.hasLayer(c)&&i.removeLayer(c),!g(h.overlays[a.layer]))return void d.error(v+"You must use a name of an existing layer");var k=h.overlays[a.layer];if(!(k instanceof L.LayerGroup||k instanceof L.FeatureGroup))return void d.error(v+'A marker can only be added to a layer of type "group" or "featureGroup"');k.addLayer(c),i.hasLayer(c)&&a.focus===!0&&c.openPopup()}if(a.draggable!==!0&&b.draggable===!0&&g(c.dragging)&&c.dragging.disable(),a.draggable===!0&&b.draggable!==!0&&(c.dragging?c.dragging.enable():L.Handler.MarkerDrag&&(c.dragging=new L.Handler.MarkerDrag(c),c.options.draggable=!0,c.dragging.enable())),s(a.icon)||s(b.icon)&&(c.setIcon(y()),c.closePopup(),c.unbindPopup(),q(a.message)&&c.bindPopup(a.message,a.popupOptions)),s(a.icon)&&s(b.icon)&&!angular.equals(a.icon,b.icon)){var l=!1;c.dragging&&(l=c.dragging.enabled()),c.setIcon(y(a.icon)),l&&c.dragging.enable(),c.closePopup(),c.unbindPopup(),q(a.message)&&(c.bindPopup(a.message,a.popupOptions),i.hasLayer(c)&&a.focus===!0&&c.openPopup())}!q(a.message)&&q(b.message)&&(c.closePopup(),c.unbindPopup()),p.LabelPlugin.isLoaded()&&(g(a.label)&&g(a.label.message)?"label"in b&&"message"in b.label&&!angular.equals(a.label.message,b.label.message)?c.updateLabelContent(a.label.message):!angular.isFunction(c.getLabel)||angular.isFunction(c.getLabel)&&!g(c.getLabel())?(c.bindLabel(a.label.message,a.label.options),G(c,a)):G(c,a):(!("label"in a)||"message"in a.label)&&angular.isFunction(c.unbindLabel)&&c.unbindLabel()),q(a.message)&&!q(b.message)&&c.bindPopup(a.message,a.popupOptions),q(a.message)&&q(b.message)&&a.message!==b.message&&c.setPopupContent(a.message);var m=!1;a.focus!==!0&&b.focus===!0&&(c.closePopup(),m=!0),(a.focus===!0&&(!g(b.focus)||b.focus===!1)||j&&a.focus===!0)&&(c.openPopup(),m=!0),b.zIndexOffset!==a.zIndexOffset&&c.setZIndexOffset(a.zIndexOffset);var n=c.getLatLng(),o=q(a.layer)&&p.MarkerClusterPlugin.is(h.overlays[a.layer]);o?m?(a.lat!==b.lat||a.lng!==b.lng)&&(h.overlays[a.layer].removeLayer(c),c.setLatLng([a.lat,a.lng]),h.overlays[a.layer].addLayer(c)):n.lat!==a.lat||n.lng!==a.lng?(h.overlays[a.layer].removeLayer(c),c.setLatLng([a.lat,a.lng]),h.overlays[a.layer].addLayer(c)):a.lat!==b.lat||a.lng!==b.lng?(h.overlays[a.layer].removeLayer(c),c.setLatLng([a.lat,a.lng]),h.overlays[a.layer].addLayer(c)):s(a.icon)&&s(b.icon)&&!angular.equals(a.icon,b.icon)&&(h.overlays[a.layer].removeLayer(c),h.overlays[a.layer].addLayer(c)):(n.lat!==a.lat||n.lng!==a.lng)&&c.setLatLng([a.lat,a.lng])}};return{resetMarkerGroup:z,resetMarkerGroups:A,deleteMarker:B,manageOpenPopup:F,manageOpenLabel:G,createMarker:function(a){if(!g(a)||!u.validateCoords(a))return void d.error(v+"The marker definition is not valid.");var b=u.getCoords(a);if(!g(b))return void d.error(v+"Unable to get coordinates from markerData.");var c={icon:y(a.icon),title:g(a.title)?a.title:"",draggable:g(a.draggable)?a.draggable:!1,clickable:g(a.clickable)?a.clickable:!0,riseOnHover:g(a.riseOnHover)?a.riseOnHover:!1,zIndexOffset:g(a.zIndexOffset)?a.zIndexOffset:0,iconAngle:g(a.iconAngle)?a.iconAngle:0};for(var e in a)a.hasOwnProperty(e)&&!c.hasOwnProperty(e)&&(c[e]=a[e]);var f=new L.marker(b,c);return q(a.message)||f.unbindPopup(),f},addMarkerToGroup:function(a,b,c,e){return q(b)?i.isLoaded()?(g(t[b])||(t[b]=new L.MarkerClusterGroup(c),e.addLayer(t[b])),void t[b].addLayer(a)):void d.error(v+"The MarkerCluster plugin is not loaded."):void d.error(v+"The marker group you have specified is invalid.")},listenMarkerEvents:function(a,b,c,d,e){a.on("popupopen",function(){o(c,function(){(g(a._popup)||g(a._popup._contentNode))&&(b.focus=!0,F(a,b,e))})}),a.on("popupclose",function(){o(c,function(){b.focus=!1})}),a.on("add",function(){o(c,function(){"label"in b&&G(a,b)})})},updateMarker:H,addMarkerWatcher:function(a,b,c,d,e,f){var i=p.getObjectArrayPath("markers."+b);f=h(f,!0);var j=c.$watch(i,function(f,h){return g(f)?void H(f,h,a,b,c,d,e):(B(a,e,d),void j())},f)},string:w,log:x}}]),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 e(a)})}function e(a){return i(a)?new L.LatLng(a[0],a[1]):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={},d=0;d0&&e(a[0].boundingbox)?i.resolve(a[0]):i.reject("[Nominatim] Invalid address")}),i.promise}}}]),angular.module("leaflet-directive").directive("bounds",["$log","$timeout","$http","leafletHelpers","nominatimService","leafletBoundsHelpers",function(a,b,c,d,e,f){return{restrict:"A",scope:!1,replace:!1,require:["leaflet"],link:function(c,g,h,i){var j=d.isDefined,k=f.createLeafletBounds,l=i[0].getLeafletScope(),m=i[0],n=d.errorHeader+" [Bounds] ",o=function(a){return 0===a._southWest.lat&&0===a._southWest.lng&&0===a._northEast.lat&&0===a._northEast.lng};m.getMap().then(function(d){l.$on("boundsChanged",function(a){var c=a.currentScope,e=d.getBounds();if(!o(e)&&!c.settingBoundsFromScope){c.settingBoundsFromLeaflet=!0;var f={northEast:{lat:e._northEast.lat,lng:e._northEast.lng},southWest:{lat:e._southWest.lat,lng:e._southWest.lng},options:e.options};angular.equals(c.bounds,f)||(c.bounds=f),b(function(){c.settingBoundsFromLeaflet=!1})}});var f;l.$watch("bounds",function(g){if(!c.settingBoundsFromLeaflet){if(j(g.address)&&g.address!==f)return c.settingBoundsFromScope=!0,e.query(g.address,h.id).then(function(a){var b=a.boundingbox,c=[[b[0],b[2]],[b[1],b[3]]];d.fitBounds(c)},function(b){a.error(n+" "+b+".")}),f=g.address,void b(function(){c.settingBoundsFromScope=!1});var i=k(g);i&&!d.getBounds().equals(i)&&(c.settingBoundsFromScope=!0,d.fitBounds(i,g.options),b(function(){c.settingBoundsFromScope=!1}))}},!0)})}}}]);var centerDirectiveTypes=["center","lfCenter"],centerDirectives={};centerDirectiveTypes.forEach(function(a){centerDirectives[a]=["$log","$q","$location","$timeout","leafletMapDefaults","leafletHelpers","leafletBoundsHelpers","leafletMapEvents",function(b,c,d,e,f,g,h,i){var j,k=g.isDefined,l=g.isNumber,m=g.isSameCenterOnMap,n=g.safeApply,o=g.isValidCenter,p=h.isValidBounds,q=g.isUndefinedOrEmpty,r=g.errorHeader,s=function(a,b){return k(a)&&p(a)&&q(b)};return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){j=c.defer(),this.getCenter=function(){return j.promise}},link:function(c,g,p,q){var t=q.getLeafletScope(),u=t[a];q.getMap().then(function(c){var g=f.getDefaults(p.id);if(-1!==p[a].search("-"))return b.error(r+' The "center" variable can\'t use a "-" on its key name: "'+p[a]+'".'),void c.setView([g.center.lat,g.center.lng],g.center.zoom);if(s(t.bounds,u))c.fitBounds(h.createLeafletBounds(t.bounds),t.bounds.options),u=c.getCenter(),n(t,function(b){angular.extend(b[a],{lat:c.getCenter().lat,lng:c.getCenter().lng,zoom:c.getZoom(),autoDiscover:!1})}),n(t,function(a){var b=c.getBounds();a.bounds={northEast:{lat:b._northEast.lat,lng:b._northEast.lng},southWest:{lat:b._southWest.lat,lng:b._southWest.lng}}});else{if(!k(u))return b.error(r+' The "center" property is not defined in the main scope'),void c.setView([g.center.lat,g.center.lng],g.center.zoom);k(u.lat)&&k(u.lng)||k(u.autoDiscover)||angular.copy(g.center,u)}var q,v;if("yes"===p.urlHashCenter){var w=function(){var a,b=d.search();if(k(b.c)){var c=b.c.split(":");3===c.length&&(a={lat:parseFloat(c[0]),lng:parseFloat(c[1]),zoom:parseInt(c[2],10)})}return a};q=w(),t.$on("$locationChangeSuccess",function(b){var d=b.currentScope,e=w();k(e)&&!m(e,c)&&angular.extend(d[a],{lat:e.lat,lng:e.lng,zoom:e.zoom})})}t.$watch(a,function(a){return t.settingCenterFromLeaflet?void 0:(k(q)&&(angular.copy(q,a),q=void 0),o(a)||a.autoDiscover===!0?a.autoDiscover===!0?(l(a.zoom)||c.setView([g.center.lat,g.center.lng],g.center.zoom),void(l(a.zoom)&&a.zoom>g.center.zoom?c.locate({setView:!0,maxZoom:a.zoom}):k(g.maxZoom)?c.locate({setView:!0,maxZoom:g.maxZoom}):c.locate({setView:!0}))):void(v&&m(a,c)||(t.settingCenterFromScope=!0,c.setView([a.lat,a.lng],a.zoom),i.notifyCenterChangedToBounds(t,c),e(function(){t.settingCenterFromScope=!1}))):void b.warn(r+" invalid 'center'"))},!0),c.whenReady(function(){v=!0}),c.on("moveend",function(){j.resolve(),i.notifyCenterUrlHashChanged(t,c,p,d.search()),m(u,c)||t.settingCenterFromScope||(t.settingCenterFromLeaflet=!0,n(t,function(b){t.settingCenterFromScope||angular.extend(b[a],{lat:c.getCenter().lat,lng:c.getCenter().lng,zoom:c.getZoom(),autoDiscover:!1}),i.notifyCenterChangedToBounds(t,c),e(function(){t.settingCenterFromLeaflet=!1})}))}),u.autoDiscover===!0&&c.on("locationerror",function(){b.warn(r+" The Geolocation API is unauthorized on this page."),o(u)?(c.setView([u.lat,u.lng],u.zoom),i.notifyCenterChangedToBounds(t,c)):(c.setView([g.center.lat,g.center.lng],g.center.zoom),i.notifyCenterChangedToBounds(t,c))})})}}}]}),centerDirectiveTypes.forEach(function(a){angular.module("leaflet-directive").directive(a,centerDirectives[a])}),angular.module("leaflet-directive").directive("controls",["$log","leafletHelpers","leafletControlHelpers",function(a,b,c){return{restrict:"A",scope:!1,replace:!1,require:"?^leaflet",link:function(d,e,f,g){if(g){var h=c.createControl,i=c.isValidControlType,j=g.getLeafletScope(),k=b.isDefined,l=b.isArray,m={},n=b.errorHeader+" [Controls] ";g.getMap().then(function(b){j.$watchCollection("controls",function(c){for(var d in m)k(c[d])||(b.hasControl(m[d])&&b.removeControl(m[d]),delete m[d]);for(var e in c){var f,g=k(c[e].type)?c[e].type:e;if(!i(g))return void a.error(n+" Invalid control type: "+g+".");if("custom"!==g)f=h(g,c[e]),b.addControl(f),m[e]=f;else{var j=c[e];if(l(j))for(var o in j){var p=j[o];b.addControl(p),m[e]=k(m[e])?m[e].concat([p]):[p]}else b.addControl(j),m[e]=j}}})})}}}}]),angular.module("leaflet-directive").directive("decorations",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(c,d,e,f){function g(b){return k(b)&&k(b.coordinates)&&(j.isLoaded()||a.error("[AngularJS - Leaflet] The PolylineDecorator Plugin is not loaded.")),L.polylineDecorator(b.coordinates)}function h(a,b){return k(a)&&k(b)&&k(b.coordinates)&&k(b.patterns)?(a.setPaths(b.coordinates),a.setPatterns(b.patterns),a):void 0}var i=f.getLeafletScope(),j=b.PolylineDecoratorPlugin,k=b.isDefined,l={};f.getMap().then(function(a){i.$watch("decorations",function(b){for(var c in l)k(b[c])&&angular.equals(b[c],l)||(a.removeLayer(l[c]),delete l[c]);for(var d in b){var e=b[d],f=g(e);k(f)&&(l[d]=f,a.addLayer(f),h(f,e))}},!0)})}}}]),angular.module("leaflet-directive").directive("eventBroadcast",["$log","$rootScope","leafletHelpers","leafletMapEvents","leafletIterators",function(a,b,c,d,e){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(b,f,g,h){var i=c.isObject,j=c.isDefined,k=h.getLeafletScope(),l=k.eventBroadcast,m=d.getAvailableMapEvents(),n=d.addEvents;h.getMap().then(function(b){var c=[],d="broadcast";j(l.map)?i(l.map)?("emit"!==l.map.logic&&"broadcast"!==l.map.logic?a.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):d=l.map.logic,i(l.map.enable)&&l.map.enable.length>=0?e.each(l.map.enable,function(a){-1===c.indexOf(a)&&-1!==m.indexOf(a)&&c.push(a)}):a.warn("[AngularJS - Leaflet] event-broadcast.map.enable must be an object check your model.")):a.warn("[AngularJS - Leaflet] event-broadcast.map must be an object check your model."):c=m,n(b,c,"eventName",k,d)})}}}]),angular.module("leaflet-directive").directive("geojson",["$log","$rootScope","leafletData","leafletHelpers","leafletWatchHelpers","leafletDirectiveControlsHelpers","leafletIterators","leafletGeoJsonEvents",function(a,b,c,d,e,f,g,h){var i=e.maybeWatch,j=d.watchOptions,k=f.extend,l=d,m=g;return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,b,e,f){var g=d.isDefined,n=f.getLeafletScope(),o={},p=!1;f.getMap().then(function(a){var b=n.geojsonWatchOptions||j,f=function(a,b){var c;return c=angular.isFunction(a.onEachFeature)?a.onEachFeature:function(c,f){d.LabelPlugin.isLoaded()&&g(c.properties.description)&&f.bindLabel(c.properties.description),h.bindEvents(e.id,f,null,c,n,b,{resetStyleOnMouseout:a.resetStyleOnMouseout,mapId:e.id})}},q=l.isDefined(e.geojsonNested)&&l.isTruthy(e.geojsonNested),r=function(){if(o){var b=function(b){g(b)&&a.hasLayer(b)&&a.removeLayer(b)};return q?void m.each(o,function(a){b(a)}):void b(o)}},s=function(b,d){if(g(b)&&g(b.data)){var h=f(b,d);g(b.options)||(b.options={style:b.style,filter:b.filter,onEachFeature:h,pointToLayer:b.pointToLayer});var i=L.geoJson(b.data,b.options);d&&l.isString(d)?o[d]=i:o=i,i.addTo(a),p||(p=!0,c.setGeoJSON(o,e.id))}},t=function(a){if(r(),q){if(!a||!Object.keys(a).length)return;return void m.each(a,function(a,b){s(a,b)})}s(a)};k(e.id,"geojson",t,r),i(n,"geojson",b,function(a){t(a)})})}}}]),angular.module("leaflet-directive").directive("layercontrol",["$filter","$log","leafletData","leafletHelpers",function(a,b,c,d){return{restrict:"E",scope:{icons:"=?",autoHideOpacity:"=?",showGroups:"=?",title:"@",baseTitle:"@",overlaysTitle:"@"},replace:!0,transclude:!1,require:"^leaflet",controller:["$scope","$element","$sce",function(a,e,f){b.debug("[Angular Directive - Layers] layers",a,e);var g=d.safeApply,h=d.isDefined;angular.extend(a,{baselayer:"",oldGroup:"",layerProperties:{},groupProperties:{},rangeIsSupported:d.rangeIsSupported(),changeBaseLayer:function(b,e){d.safeApply(a,function(d){d.baselayer=b,c.getMap().then(function(e){c.getLayers().then(function(c){if(!e.hasLayer(c.baselayers[b])){for(var f in d.layers.baselayers)d.layers.baselayers[f].icon=d.icons.unradio,e.hasLayer(c.baselayers[f])&&e.removeLayer(c.baselayers[f]);e.addLayer(c.baselayers[b]),d.layers.baselayers[b].icon=a.icons.radio}})})}),e.preventDefault()},moveLayer:function(b,c,d){var e=Object.keys(a.layers.baselayers).length;if(c>=1+e&&c<=a.overlaysArray.length+e){var f;for(var h in a.layers.overlays)if(a.layers.overlays[h].index===c){f=a.layers.overlays[h];break}f&&g(a,function(){f.index=b.index,b.index=c})}d.stopPropagation(),d.preventDefault()},initIndex:function(b,c){var d=Object.keys(a.layers.baselayers).length;b.index=h(b.index)?b.index:c+d+1},initGroup:function(b){a.groupProperties[b]=a.groupProperties[b]?a.groupProperties[b]:{}},toggleOpacity:function(b,c){if(c.visible){if(a.autoHideOpacity&&!a.layerProperties[c.name].opacityControl)for(var d in a.layerProperties)a.layerProperties[d].opacityControl=!1;a.layerProperties[c.name].opacityControl=!a.layerProperties[c.name].opacityControl}b.stopPropagation(),b.preventDefault()},toggleLegend:function(b){a.layerProperties[b.name].showLegend=!a.layerProperties[b.name].showLegend},showLegend:function(b){return b.legend&&a.layerProperties[b.name].showLegend},unsafeHTML:function(a){return f.trustAsHtml(a)},getOpacityIcon:function(b){return b.visible&&a.layerProperties[b.name].opacityControl?a.icons.close:a.icons.open},getGroupIcon:function(b){return b.visible?a.icons.check:a.icons.uncheck},changeOpacity:function(b){var d=a.layerProperties[b.name].opacity;c.getMap().then(function(e){c.getLayers().then(function(c){var f;for(var g in a.layers.overlays)if(a.layers.overlays[g]===b){f=c.overlays[g];break}e.hasLayer(f)&&(f.setOpacity&&f.setOpacity(d/100),f.getLayers&&f.eachLayer&&f.eachLayer(function(a){a.setOpacity&&a.setOpacity(d/100)}))})})},changeGroupVisibility:function(b){if(h(a.groupProperties[b])){var c=a.groupProperties[b].visible;for(var d in a.layers.overlays){var e=a.layers.overlays[d];e.group===b&&(e.visible=c)}}}});var i=e.get(0);L.Browser.touch?L.DomEvent.on(i,"click",L.DomEvent.stopPropagation):(L.DomEvent.disableClickPropagation(i),L.DomEvent.on(i,"mousewheel",L.DomEvent.stopPropagation))}],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=e.safeAddLayer,o=e.safeRemoveLayer,p=f.updateLayersControl,q=!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&&(n(b,j.baselayers[f]),e=!0)):delete l.baselayers[f]}!e&&Object.keys(j.baselayers).length>0&&n(b,j.baselayers[Object.keys(l.baselayers)[0]]);for(f in l.overlays){var r=m(l.overlays[f]);i(r)?(j.overlays[f]=r,l.overlays[f].visible===!0&&n(b,j.overlays[f])):delete l.overlays[f]}k.$watch("layers.baselayers",function(a,c){if(angular.equals(a,c))return q=p(b,d,q,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]):n(b,j.baselayers[f]);else{var g=m(a[f]);i(g)&&(j.baselayers[f]=g,a[f].top===!0&&n(b,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&&n(b,j.baselayers[Object.keys(j.baselayers)[0]]),q=p(b,d,q,a,l.overlays,j)},!0),k.$watch("layers.overlays",function(a,c){if(angular.equals(a,c))return q=p(b,d,q,l.baselayers,a,j),!0;for(var e in j.overlays)if(!i(a[e])||a[e].doRefresh){
+if(b.hasLayer(j.overlays[e])){var f=i(a[e])?a[e].layerOptions:null;o(b,j.overlays[e],f)}delete j.overlays[e],a[e]&&a[e].doRefresh&&(a[e].doRefresh=!1)}for(var g in a){if(i(j.overlays[g]))a[g].visible&&!b.hasLayer(j.overlays[g])?n(b,j.overlays[g]):a[g].visible===!1&&b.hasLayer(j.overlays[g])&&o(b,j.overlays[g],a[g].layerOptions);else{var h=m(a[g]);if(!i(h))continue;j.overlays[g]=h,a[g].visible===!0&&n(b,j.overlays[g])}a[g].visible&&b._loaded&&a[g].data&&"heatmap"===a[g].type&&(j.overlays[g].setData(a[g].data),j.overlays[g].update())}q=p(b,d,q,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,o){for(var u in c)if(!o[u])if(-1===u.search("-")){var v=n.copy(c[u]),w=n.getObjectDotPath(k?[k,u]:[u]),x=z(g,u,k);if(l(x)){var y=l(y)?d[u]:void 0;q(v,y,x,w,i,f,e)}else{var C=t(v),D=(v?v.layer:void 0)||k;if(!l(C)){a.error(m+" Received invalid data on the marker "+u+".");continue}if(A(C,g,u,k),l(v.message)&&C.bindPopup(v.message,v.popupOptions),l(v.group)){var E=l(v.groupOption)?v.groupOption:null;s(C,v.group,E,e)}if(n.LabelPlugin.isLoaded()&&l(v.label)&&l(v.label.message)&&C.bindLabel(v.label.message,v.label.options),l(v)&&(l(v.layer)||l(k))){var F=B(D,f,v,C,j.individual.doWatch,e);if(!F)continue}else l(v.group)||(e.addLayer(C),j.individual.doWatch||v.focus!==!0||C.openPopup());j.individual.doWatch&&p(C,w,i,f,e,j.individual.isDeep),r(C,v,i,j.individual.doWatch,e),h.bindEvents(b,C,w,v,i,D)}}else a.error('The marker can\'t use a "-" on his key name: "'+u+'".')},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,f){c(d,f);var k=null;return j?void v.each(d,function(c,j){var m=l(m)?f[j]:void 0;k=F(d[j],m,g[j]),C(e.id,c,f,a,b,g,h,i,j,k)}):(k=F(d,f,g),void C(e.id,d,f,a,b,g,h,i,void 0,k))};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||e.lfCenter||a.fitBounds(d)})})}}}]),angular.module("leaflet-directive").directive("paths",["$log","$q","leafletData","leafletMapDefaults","leafletHelpers","leafletPathsHelpers","leafletPathEvents",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 k in d)m(c[k])||(f.removeLayer(d[k]),delete d[k]);for(var l in c)if(0!==l.search("\\$"))if(-1===l.search("-")){if(!m(d[l])){var p=c[l],t=q(l,c[l],h);if(m(t)&&m(p.message)&&t.bindPopup(p.message,p.popupOptions),e.LabelPlugin.isLoaded()&&m(p.label)&&m(p.label.message)&&t.bindLabel(p.label.message,p.label.options),m(p)&&m(p.layer)){if(!n(p.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[p.layer])){a.error('[AngularJS - Leaflet] A path can only be added to a layer of type "group"');continue}var u=b.overlays[p.layer];if(!(u instanceof L.LayerGroup||u instanceof L.FeatureGroup)){a.error('[AngularJS - Leaflet] Adding a path to an overlay needs a overlay of the type "group" or "featureGroup"');continue}d[l]=t,u.addLayer(t),g?i(t,l):s(t,p.type,p)}else m(t)&&(d[l]=t,f.addLayer(t),g?i(t,l):s(t,p.type,p));r(j.id,t,l,p,o)}}else a.error('[AngularJS - Leaflet] The path name "'+l+'" 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,f){var h=e.tileLayerOptions,j=e.tileLayer;return!i(c.url)&&i(d)?void a.removeLayer(d):i(d)?!i(c.url)||!i(c.options)||c.type===f.type&&angular.equals(c.options,h)?void(i(c.url)&&d.setUrl(c.url)):(a.removeLayer(d),h=e.tileLayerOptions,angular.copy(c.options,h),j=c.url,d="wms"===c.type?L.tileLayer.wms(j,h):L.tileLayer(j,h),d.addTo(a),void b.setTiles(d,g.id)):(i(c.options)&&angular.copy(c.options,h),i(c.url)&&(j=c.url),d="wms"===c.type?L.tileLayer.wms(j,h):L.tileLayer(j,h),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,c.debug("LeafletEventsHelpersFactory: lObjectType: "+b+"rootBroadcastName: "+a),this.lObjectType=b};return j.prototype.getAvailableEvents=function(){return[]},j.prototype.genDispatchEvent=function(a,b,d,e,f,g,h,i,j){var k=this;return a=a||"",a&&(a="."+a),function(l){var m=k.rootBroadcastName+a+"."+b;c.debug(m),k.fire(e,m,d,l,l.target||f,h,g,i,j)}},j.prototype.fire=function(b,c,d,g,h,i,j,k){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,l){var m=[],n="emit",o=this;if(f(j.eventBroadcast))if(g(j.eventBroadcast))if(f(j.eventBroadcast[o.lObjectType]))if(g(j.eventBroadcast[o.lObjectType])){f(j.eventBroadcast[this.lObjectType].logic)&&"emit"!==j.eventBroadcast[o.lObjectType].logic&&"broadcast"!==j.eventBroadcast[o.lObjectType].logic&&c.warn(i+"Available event propagation logic are: 'emit' or 'broadcast'.");var p=!1,q=!1;f(j.eventBroadcast[o.lObjectType].enable)&&h(j.eventBroadcast[o.lObjectType].enable)&&(p=!0),f(j.eventBroadcast[o.lObjectType].disable)&&h(j.eventBroadcast[o.lObjectType].disable)&&(q=!0),p&&q?c.warn(i+"can not enable and disable events at the same time"):p||q?p?j.eventBroadcast[this.lObjectType].enable.forEach(function(a){-1!==m.indexOf(a)?c.warn(i+"This event "+a+" is already enabled"):-1===o.getAvailableEvents().indexOf(a)?c.warn(i+"This event "+a+" does not exist"):m.push(a)}):(m=this.getAvailableEvents(),j.eventBroadcast[o.lObjectType].disable.forEach(function(a){var b=m.indexOf(a);-1===b?c.warn(i+"This event "+a+" does not exist or has been already disabled"):m.splice(b,1)})):c.warn(i+"must enable or disable events")}else c.warn(i+"event-broadcast."+[o.lObjectType]+" must be an object check your model.");else m=this.getAvailableEvents();else c.error(i+"event-broadcast must be an object check your model.");else m=this.getAvailableEvents();return m.forEach(function(c){b.on(c,o.genDispatchEvent(a,c,n,j,b,d,e,k,l))}),n},j}]).service("leafletEventsHelpers",["LeafletEventsHelpersFactory",function(a){return new a}]),angular.module("leaflet-directive").factory("leafletGeoJsonEvents",["$rootScope","$q","$log","leafletHelpers","LeafletEventsHelpersFactory","leafletData",function(a,b,c,d,e,f){var g=d.safeApply,h=e,i=function(){h.call(this,"leafletDirectiveGeoJson","geojson")};return i.prototype=new h,i.prototype.genDispatchEvent=function(b,c,d,e,i,j,k,l,m){var n=h.prototype.genDispatchEvent.call(this,b,c,d,e,i,j,k,l),o=this;return function(b){"mouseout"===c&&(m.resetStyleOnMouseout&&f.getGeoJSON(m.mapId).then(function(a){var c=l?a[l]:a;c.resetStyle(b.target)}),g(e,function(){a.$broadcast(o.rootBroadcastName+".mouseout",b)})),n(b)}},i.prototype.getAvailableEvents=function(){return["click","dblclick","mouseover","mouseout"]},new i}]),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,i){var j=f.replace("markers.","");return g.prototype.genDispatchEvent.call(this,a,b,c,d,e,j,h,i)},h.prototype.getAvailableEvents=function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu"]},h.prototype.genEvents=function(a,b,c,d,e,g,h,i){var j=this,k=this.getAvailableEvents(),l=f.getObjectArrayPath("markers."+g);k.forEach(function(b){e.label.on(b,j.genDispatchEvent(a,b,c,d,e.label,l,h,i))})},h.prototype.bindEvents=function(){},new h}]),angular.module("leaflet-directive").factory("leafletMapEvents",["$rootScope","$q","$log","leafletHelpers","leafletEventsHelpers","leafletIterators",function(a,b,c,d,e,f){var g=d.isDefined,h=e.fire,i=function(){return["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focus","blur","preclick","load","unload","viewreset","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoomanim","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"]},j=function(a,b,d,e){return e&&(e+="."),function(f){var g="leafletDirectiveMap."+e+b;c.debug(g),h(a,g,d,f,f.target,a)}},k=function(a){a.$broadcast("boundsChanged")},l=function(a,b,c,d){if(g(c.urlHashCenter)){var e=b.getCenter(),f=e.lat.toFixed(4)+":"+e.lng.toFixed(4)+":"+b.getZoom();g(d.c)&&d.c===f||a.$emit("centerUrlHash",f)}},m=function(a,b,c,d,e){f.each(b,function(b){var f={};f[c]=b,a.on(b,j(d,b,e,a._container.id||""),f)})};return{getAvailableMapEvents:i,genDispatchMapEvent:j,notifyCenterChangedToBounds:k,notifyCenterUrlHashChanged:l,addEvents:m}}]),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,j){var l=k.prototype.genDispatchEvent.call(this,b,c,d,e,f,h,i,j);return function(b){"click"===c?g(e,function(){a.$broadcast("leafletDirectiveMarkersClick",h)}):"dragend"===c&&(g(e,function(){i.lat=f.getLatLng().lat,i.lng=f.getLatLng().lng}),i.message&&i.focus===!0&&f.openPopup()),l(b)}},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,f){var g=k.prototype.bindEvents.call(this,a,b,c,d,e,f);i.LabelPlugin.isLoaded()&&h(b.label)&&j.genEvents(a,c,g,e,b,d,f)},new l}]),angular.module("leaflet-directive").factory("leafletPathEvents",["$rootScope","$q","$log","leafletHelpers","leafletLabelEvents","leafletEventsHelpers",function(a,b,c,d,e,f){var g=d.isDefined,h=d.isObject,i=d,j=d.errorHeader,k=e,l=f.fire,m=function(a,b,d,e,f,g,h,i){return a=a||"",a&&(a="."+a),function(j){var k="leafletDirectivePath"+a+"."+b;c.debug(k),l(e,k,d,j,j.target||f,h,g,i)}},n=function(a,b,d,e,f){var l,n,p=[],q="broadcast";if(g(f.eventBroadcast))if(h(f.eventBroadcast))if(g(f.eventBroadcast.path))if(h(f.eventBroadcast.paths))c.warn(j+"event-broadcast.path must be an object check your model.");else{void 0!==f.eventBroadcast.path.logic&&null!==f.eventBroadcast.path.logic&&("emit"!==f.eventBroadcast.path.logic&&"broadcast"!==f.eventBroadcast.path.logic?c.warn(j+"Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===f.eventBroadcast.path.logic&&(q="emit"));var r=!1,s=!1;if(void 0!==f.eventBroadcast.path.enable&&null!==f.eventBroadcast.path.enable&&"object"==typeof f.eventBroadcast.path.enable&&(r=!0),void 0!==f.eventBroadcast.path.disable&&null!==f.eventBroadcast.path.disable&&"object"==typeof f.eventBroadcast.path.disable&&(s=!0),r&&s)c.warn(j+"can not enable and disable events at the same time");else if(r||s)if(r)for(l=0;l',
- controller: ["$scope", function($scope) {
+ controller: ["$scope", function ($scope) {
this._leafletMap = $q.defer();
- this.getMap = function() {
+ this.getMap = function () {
return this._leafletMap.promise;
};
- this.getLeafletScope = function() {
+ this.getLeafletScope = function () {
return $scope;
};
}],
- link: function(scope, element, attrs, ctrl) {
+ link: function (scope, element, attrs, ctrl) {
var isDefined = leafletHelpers.isDefined;
var defaults = leafletMapDefaults.setDefaults(scope.defaults, attrs.id);
var mapEvents = leafletMapEvents.getAvailableMapEvents();
@@ -72,11 +72,11 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
updateWidth();
scope.$watch(
- function() {
+ function () {
return element[0].getAttribute('width');
},
- function() {
+ function () {
updateWidth();
map.invalidateSize();
});
@@ -88,11 +88,11 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
updateHeight();
scope.$watch(
- function() {
+ function () {
return element[0].getAttribute('height');
},
- function() {
+ function () {
updateHeight();
map.invalidateSize();
});
@@ -136,11 +136,11 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
}
// Resolve the map object to the promises
- map.whenReady(function() {
+ map.whenReady(function () {
leafletData.setMap(map, attrs.id);
});
- scope.$on('$destroy', function() {
+ scope.$on('$destroy', function () {
leafletMapDefaults.reset();
map.remove();
leafletData.unresolveMap(attrs.id);
@@ -149,14 +149,14 @@ angular.module('leaflet-directive', []).directive('leaflet', ["$q", "leafletData
//Handle request to invalidate the map size
//Up scope using $scope.$emit('invalidateSize')
//Down scope using $scope.$broadcast('invalidateSize')
- scope.$on('invalidateSize', function() {
+ scope.$on('invalidateSize', function () {
map.invalidateSize();
});
},
};
}]);
-angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "leafletHelpers", function($log, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "leafletHelpers", function ($log, leafletHelpers) {
var isArray = leafletHelpers.isArray;
var isNumber = leafletHelpers.isNumber;
@@ -171,7 +171,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
}
return {
- createLeafletBounds: function(bounds) {
+ createLeafletBounds: function (bounds) {
if (_isValidBounds(bounds)) {
return L.latLngBounds([bounds.southWest.lat, bounds.southWest.lng],
[bounds.northEast.lat, bounds.northEast.lng]);
@@ -180,7 +180,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
isValidBounds: _isValidBounds,
- createBoundsFromArray: function(boundsArray) {
+ createBoundsFromArray: function (boundsArray) {
if (!(isArray(boundsArray) && boundsArray.length === 2 &&
isArray(boundsArray[0]) && isArray(boundsArray[1]) &&
boundsArray[0].length === 2 && boundsArray[1].length === 2 &&
@@ -202,7 +202,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
};
},
- createBoundsFromLeaflet: function(lfBounds) {
+ createBoundsFromLeaflet: function (lfBounds) {
if (!(isDefined(lfBounds) && isFunction(lfBounds.getNorthEast) && isFunction(lfBounds.getSouthWest))) {
$log.error('[AngularJS - Leaflet] The leaflet bounds is not valid object.');
return;
@@ -225,14 +225,14 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', ["$log", "le
};
}]);
-angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScope", "$log", "leafletHelpers", "leafletLayerHelpers", "leafletMapDefaults", function($rootScope, $log, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
+angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScope", "$log", "leafletHelpers", "leafletLayerHelpers", "leafletMapDefaults", function ($rootScope, $log, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var createLayer = leafletLayerHelpers.createLayer;
var _controls = {};
var errorHeader = leafletHelpers.errorHeader + ' [Controls] ';
- var _controlLayersMustBeVisible = function(baselayers, overlays, mapId) {
+ var _controlLayersMustBeVisible = function (baselayers, overlays, mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
if (!defaults.controls.layers.visible) {
return false;
@@ -241,7 +241,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
var atLeastOneControlItemMustBeShown = false;
if (isObject(baselayers)) {
- Object.keys(baselayers).forEach(function(key) {
+ Object.keys(baselayers).forEach(function (key) {
var layer = baselayers[key];
if (!isDefined(layer.layerOptions) || layer.layerOptions.showOnSelector !== false) {
atLeastOneControlItemMustBeShown = true;
@@ -250,7 +250,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
}
if (isObject(overlays)) {
- Object.keys(overlays).forEach(function(key) {
+ Object.keys(overlays).forEach(function (key) {
var layer = overlays[key];
if (!isDefined(layer.layerParams) || layer.layerParams.showOnSelector !== false) {
atLeastOneControlItemMustBeShown = true;
@@ -261,7 +261,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return atLeastOneControlItemMustBeShown;
};
- var _createLayersControl = function(mapId) {
+ var _createLayersControl = function (mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
var controlOptions = {
collapsed: defaults.controls.layers.collapsed,
@@ -283,7 +283,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
var controlTypes = {
draw: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Draw)) {
$log.error(errorHeader + ' Draw plugin is not loaded.');
return false;
@@ -292,29 +292,29 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Draw(params);
},
},
scale: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.control.scale(params);
},
},
fullscreen: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Fullscreen)) {
$log.error(errorHeader + ' Fullscreen plugin is not loaded.');
return false;
@@ -323,16 +323,16 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Fullscreen(params);
},
},
search: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Search)) {
$log.error(errorHeader + ' Search plugin is not loaded.');
return false;
@@ -341,17 +341,17 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Search(params);
},
},
custom: {},
minimap: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.MiniMap)) {
$log.error(errorHeader + ' Minimap plugin is not loaded.');
return false;
@@ -360,7 +360,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- checkValidParams: function(params) {
+ checkValidParams: function (params) {
if (!isDefined(params.layer)) {
$log.warn(errorHeader + ' minimap "layer" option should be defined.');
return false;
@@ -369,7 +369,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
var layer = createLayer(params.layer);
if (!isDefined(layer)) {
@@ -385,11 +385,11 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return {
layersControlMustBeVisible: _controlLayersMustBeVisible,
- isValidControlType: function(type) {
+ isValidControlType: function (type) {
return Object.keys(controlTypes).indexOf(type) !== -1;
},
- createControl: function(type, params) {
+ createControl: function (type, params) {
if (!controlTypes[type].checkValidParams(params)) {
return;
}
@@ -397,7 +397,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
return controlTypes[type].createControl(params);
},
- updateLayersControl: function(map, mapId, loaded, baselayers, overlays, leafletLayers) {
+ updateLayersControl: function (map, mapId, loaded, baselayers, overlays, leafletLayers) {
var i;
var _layersControl = _controls[mapId];
var mustBeLoaded = _controlLayersMustBeVisible(baselayers, overlays, mapId);
@@ -442,7 +442,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', ["$rootScop
};
}]);
-angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafletHelpers", function($log, $q, leafletHelpers) {
+angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafletHelpers", function ($log, $q, leafletHelpers) {
var getDefer = leafletHelpers.getDefer,
getUnresolvedDefer = leafletHelpers.getUnresolvedDefer,
setResolvedDefer = leafletHelpers.setResolvedDefer;
@@ -450,7 +450,7 @@ angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafl
var _private = {};
var self = this;
- var upperFirst = function(string) {
+ var upperFirst = function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
@@ -463,30 +463,30 @@ angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafl
'geoJSON',
'UTFGrid', //odd ball on naming convention keeping to not break
'decorations',
- 'directiveControls',];
+ 'directiveControls', ];
//init
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
_private[itemName] = {};
});
- this.unresolveMap = function(scopeId) {
+ this.unresolveMap = function (scopeId) {
var id = leafletHelpers.obtainEffectiveMapId(_private.map, scopeId);
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
_private[itemName][id] = undefined;
});
};
//int repetitive stuff (get and sets)
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
var name = upperFirst(itemName);
- self['set' + name] = function(lObject, scopeId) {
+ self['set' + name] = function (lObject, scopeId) {
var defer = getUnresolvedDefer(_private[itemName], scopeId);
defer.resolve(lObject);
setResolvedDefer(_private[itemName], scopeId);
};
- self['get' + name] = function(scopeId) {
+ self['get' + name] = function (scopeId) {
var defer = getDefer(_private[itemName], scopeId);
return defer.promise;
};
@@ -494,7 +494,7 @@ angular.module('leaflet-directive').service('leafletData', ["$log", "$q", "leafl
}]);
angular.module('leaflet-directive')
-.service('leafletDirectiveControlsHelpers', ["$log", "leafletData", "leafletHelpers", function($log, leafletData, leafletHelpers) {
+.service('leafletDirectiveControlsHelpers', ["$log", "leafletData", "leafletHelpers", function ($log, leafletData, leafletHelpers) {
var _isDefined = leafletHelpers.isDefined;
var _isString = leafletHelpers.isString;
var _isObject = leafletHelpers.isObject;
@@ -502,7 +502,7 @@ angular.module('leaflet-directive')
var _errorHeader = _mainErrorHeader + '[leafletDirectiveControlsHelpers';
- var _extend = function(id, thingToAddName, createFn, cleanFn) {
+ var _extend = function (id, thingToAddName, createFn, cleanFn) {
var _fnHeader = _errorHeader + '.extend] ';
var extender = {};
if (!_isDefined(thingToAddName)) {
@@ -523,7 +523,7 @@ angular.module('leaflet-directive')
}
//add external control to create / destroy markers without a watch
- leafletData.getDirectiveControls().then(function(controls) {
+ leafletData.getDirectiveControls().then(function (controls) {
angular.extend(controls, extender);
leafletData.setDirectiveControls(controls, id);
});
@@ -535,16 +535,16 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.service('leafletGeoJsonHelpers', ["leafletHelpers", "leafletIterators", function(leafletHelpers, leafletIterators) {
+.service('leafletGeoJsonHelpers', ["leafletHelpers", "leafletIterators", function (leafletHelpers, leafletIterators) {
var lHlp = leafletHelpers;
var lIt = leafletIterators;
- var Point = function(lat, lng) {
+ var Point = function (lat, lng) {
this.lat = lat;
this.lng = lng;
return this;
};
- var _getLat = function(value) {
+ var _getLat = function (value) {
if (Array.isArray(value) && value.length === 2) {
return value[1];
} else if (lHlp.isDefined(value.type) && value.type === 'Point') {
@@ -554,7 +554,7 @@ angular.module('leaflet-directive')
}
};
- var _getLng = function(value) {
+ var _getLng = function (value) {
if (Array.isArray(value) && value.length === 2) {
return value[0];
} else if (lHlp.isDefined(value.type) && value.type === 'Point') {
@@ -564,7 +564,7 @@ angular.module('leaflet-directive')
}
};
- var _validateCoords = function(coords) {
+ var _validateCoords = function (coords) {
if (lHlp.isUndefined(coords)) {
return false;
}
@@ -583,14 +583,14 @@ angular.module('leaflet-directive')
}
}
- var ret = lIt.all(['lat', 'lng'], function(pos) {
+ var ret = lIt.all(['lat', 'lng'], function (pos) {
return lHlp.isDefined(coords[pos]) && lHlp.isNumber(coords[pos]);
});
return ret;
};
- var _getCoords = function(value) {
+ var _getCoords = function (value) {
if (!value || !_validateCoords(value)) {
return;
}
@@ -616,7 +616,7 @@ angular.module('leaflet-directive')
};
}]);
-angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", function($q, $log) {
+angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", function ($q, $log) {
var _errorHeader = '[AngularJS - Leaflet] ';
var _copy = angular.copy;
var _clone = _copy;
@@ -633,7 +633,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
_getObjectValue(obj,"bike.1") returns 'hi'
this is getPath in ui-gmap
*/
- var _getObjectValue = function(object, pathStr) {
+ var _getObjectValue = function (object, pathStr) {
var obj;
if (!object || !angular.isObject(object))
return;
@@ -644,7 +644,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
obj = object;
- pathStr.split('.').forEach(function(value) {
+ pathStr.split('.').forEach(function (value) {
if (obj) {
obj = obj[value];
}
@@ -659,8 +659,8 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
returns:
'bike["one"]["two"]'
*/
- var _getObjectArrayPath = function(pathStr) {
- return pathStr.split('.').reduce(function(previous, current) {
+ var _getObjectArrayPath = function (pathStr) {
+ return pathStr.split('.').reduce(function (previous, current) {
return previous + '["' + current + '"]';
});
};
@@ -670,8 +670,8 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
returns:
"bike.one.two"
*/
- var _getObjectDotPath = function(arrayOfStrings) {
- return arrayOfStrings.reduce(function(previous, current) {
+ var _getObjectDotPath = function (arrayOfStrings) {
+ return arrayOfStrings.reduce(function (previous, current) {
return previous + '.' + current;
});
};
@@ -715,11 +715,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
return defer;
}
- var _isDefined = function(value) {
+ var _isDefined = function (value) {
return angular.isDefined(value) && value !== null;
};
- var _isUndefined = function(value) {
+ var _isUndefined = function (value) {
return !_isDefined(value);
};
@@ -737,8 +737,8 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
@param name Name to normalize
*/
- var camelCase = function(name) {
- return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ var camelCase = function (name) {
+ return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
if (offset) {
return letter.toUpperCase();
} else {
@@ -752,7 +752,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
@param name Name to normalize
*/
- var directiveNormalize = function(name) {
+ var directiveNormalize = function (name) {
return camelCase(name.replace(PREFIX_REGEXP, ''));
};
@@ -767,22 +767,22 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
getObjectValue: _getObjectValue,
getObjectArrayPath:_getObjectArrayPath,
getObjectDotPath: _getObjectDotPath,
- defaultTo: function(val, _default) {
+ defaultTo: function (val, _default) {
return _isDefined(val) ? val : _default;
},
//mainly for checking attributes of directives lets keep this minimal (on what we accept)
- isTruthy: function(val) {
+ isTruthy: function (val) {
return val === 'true' || val === true;
},
//Determine if a reference is {}
- isEmpty: function(value) {
+ isEmpty: function (value) {
return Object.keys(value).length === 0;
},
//Determine if a reference is undefined or {}
- isUndefinedOrEmpty: function(value) {
+ isUndefinedOrEmpty: function (value) {
return (angular.isUndefined(value) || value === null) || Object.keys(value).length === 0;
},
@@ -796,12 +796,12 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
isFunction: angular.isFunction,
equals: angular.equals,
- isValidCenter: function(center) {
+ isValidCenter: function (center) {
return angular.isDefined(center) && angular.isNumber(center.lat) &&
angular.isNumber(center.lng) && angular.isNumber(center.zoom);
},
- isValidPoint: function(point) {
+ isValidPoint: function (point) {
if (!angular.isDefined(point)) {
return false;
}
@@ -813,7 +813,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
return angular.isNumber(point.lat) && angular.isNumber(point.lng);
},
- isSameCenterOnMap: function(centerModel, map) {
+ isSameCenterOnMap: function (centerModel, map) {
var mapCenter = map.getCenter();
var zoom = map.getZoom();
if (centerModel.lat && centerModel.lng &&
@@ -826,7 +826,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
return false;
},
- safeApply: function($scope, fn) {
+ safeApply: function ($scope, fn) {
var phase = $scope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
$scope.$eval(fn);
@@ -837,7 +837,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
obtainEffectiveMapId: _obtainEffectiveMapId,
- getDefer: function(d, mapId) {
+ getDefer: function (d, mapId) {
var id = _obtainEffectiveMapId(d, mapId);
var defer;
if (!angular.isDefined(d[id]) || d[id].resolvedDefer === false) {
@@ -851,35 +851,35 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
getUnresolvedDefer: _getUnresolvedDefer,
- setResolvedDefer: function(d, mapId) {
+ setResolvedDefer: function (d, mapId) {
var id = _obtainEffectiveMapId(d, mapId);
d[id].resolvedDefer = true;
},
- rangeIsSupported: function() {
+ rangeIsSupported: function () {
var testrange = document.createElement('input');
testrange.setAttribute('type', 'range');
return testrange.type === 'range';
},
FullScreenControlPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Control.Fullscreen);
},
},
MiniMapControlPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Control.MiniMap);
},
},
AwesomeMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.AwesomeMarkers) && angular.isDefined(L.AwesomeMarkers.Icon);
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.AwesomeMarkers.Icon;
} else {
@@ -887,7 +887,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -901,11 +901,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
VectorMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.VectorMarkers) && angular.isDefined(L.VectorMarkers.Icon);
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.VectorMarkers.Icon;
} else {
@@ -913,7 +913,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -927,7 +927,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
DomMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.DomMarkers) && angular.isDefined(L.DomMarkers.Icon)) {
return true;
} else {
@@ -935,7 +935,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.DomMarkers.Icon;
} else {
@@ -943,7 +943,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -957,7 +957,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
PolylineDecoratorPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.PolylineDecorator)) {
return true;
} else {
@@ -965,7 +965,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(decoration) {
+ is: function (decoration) {
if (this.isLoaded()) {
return decoration instanceof L.PolylineDecorator;
} else {
@@ -973,7 +973,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(decorationA, decorationB) {
+ equal: function (decorationA, decorationB) {
if (!this.isLoaded()) {
return false;
}
@@ -987,7 +987,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
MakiMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.MakiMarkers) && angular.isDefined(L.MakiMarkers.Icon)) {
return true;
} else {
@@ -995,7 +995,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.MakiMarkers.Icon;
} else {
@@ -1003,7 +1003,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -1016,7 +1016,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
ExtraMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.ExtraMarkers) && angular.isDefined(L.ExtraMarkers.Icon)) {
return true;
} else {
@@ -1024,7 +1024,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.ExtraMarkers.Icon;
} else {
@@ -1032,7 +1032,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -1045,11 +1045,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
LabelPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Label);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.MarkerClusterGroup;
} else {
@@ -1058,11 +1058,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
MarkerClusterPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.MarkerClusterGroup);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.MarkerClusterGroup;
} else {
@@ -1071,11 +1071,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
GoogleLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Google);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.Google;
} else {
@@ -1084,11 +1084,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
LeafletProviderPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.Provider);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.Provider;
} else {
@@ -1097,26 +1097,26 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
ChinaLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.tileLayer.chinaProvider);
},
},
HeatLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.heatLayer);
},
},
WebGLHeatMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.WebGLHeatMap);
},
},
BingLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.BingLayer);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.BingLayer;
} else {
@@ -1125,11 +1125,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
WFSLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.GeoJSON.WFS !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.GeoJSON.WFS;
} else {
@@ -1138,11 +1138,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSBaseLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.basemapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.basemapLayer;
} else {
@@ -1151,11 +1151,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return lvector !== undefined && lvector.AGS !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof lvector.AGS;
} else {
@@ -1164,11 +1164,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSFeatureLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.featureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.featureLayer;
} else {
@@ -1177,11 +1177,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSTiledMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.tiledMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.tiledMapLayer;
} else {
@@ -1190,11 +1190,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSDynamicMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.dynamicMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.dynamicMapLayer;
} else {
@@ -1203,11 +1203,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSImageMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.imageMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.imageMapLayer;
} else {
@@ -1216,11 +1216,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSClusteredLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.clusteredFeatureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.clusteredFeatureLayer;
} else {
@@ -1229,11 +1229,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
AGSHeatmapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.heatmapFeatureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.heatmapFeatureLayer;
} else {
@@ -1242,11 +1242,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
YandexLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Yandex);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.Yandex;
} else {
@@ -1255,11 +1255,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
GeoJSONPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.GeoJSON);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.GeoJSON;
} else {
@@ -1268,11 +1268,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
UTFGridPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.UtfGrid);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.UtfGrid;
} else {
@@ -1282,11 +1282,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
CartoDB: {
- isLoaded: function() {
+ isLoaded: function () {
return cartodb;
},
- is: function(/*layer*/) {
+ is: function (/*layer*/) {
return true;
/*
if (this.isLoaded()) {
@@ -1298,11 +1298,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
Leaflet: {
DivIcon: {
- is: function(icon) {
+ is: function (icon) {
return icon instanceof L.DivIcon;
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
@@ -1311,11 +1311,11 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},
Icon: {
- is: function(icon) {
+ is: function (icon) {
return icon instanceof L.Icon;
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
@@ -1347,7 +1347,7 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
};
}]);
-angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafletHelpers", function($log, leafletHelpers) {
+angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafletHelpers", function ($log, leafletHelpers) {
var lHlp = leafletHelpers;
var errorHeader = leafletHelpers.errorHeader + 'leafletIterators: ';
@@ -1362,18 +1362,18 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
- var _isArrayLike = function(collection) {
+ var _isArrayLike = function (collection) {
var length = collection !== null && collection.length;
return lHlp.isNumber(length) && length >= 0 && length <= MAX_ARRAY_INDEX;
};
// Keep the identity function around for default iteratees.
- var _identity = function(value) {
+ var _identity = function (value) {
return value;
};
- var _property = function(key) {
- return function(obj) {
+ var _property = function (key) {
+ return function (obj) {
return obj === null ? void 0 : obj[key];
};
};
@@ -1381,33 +1381,33 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
- var optimizeCb = function(func, context, argCount) {
+ var optimizeCb = function (func, context, argCount) {
if (context === void 0) return func;
switch (argCount === null ? 3 : argCount) {
- case 1: return function(value) {
+ case 1: return function (value) {
return func.call(context, value);
};
- case 2: return function(value, other) {
+ case 2: return function (value, other) {
return func.call(context, value, other);
};
- case 3: return function(value, index, collection) {
+ case 3: return function (value, index, collection) {
return func.call(context, value, index, collection);
};
- case 4: return function(accumulator, value, index, collection) {
+ case 4: return function (accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
- return function() {
+ return function () {
return func.apply(context, arguments);
};
};
// An internal function for creating assigner functions.
- var createAssigner = function(keysFunc, undefinedOnly) {
- return function(obj) {
+ var createAssigner = function (keysFunc, undefinedOnly) {
+ return function (obj) {
var length = arguments.length;
if (length < 2 || obj === null) return obj;
for (var index = 1; index < length; index++) {
@@ -1432,7 +1432,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
_extendOwn = _assign = createAssigner(_keys);
// Returns whether an object has a given set of `key:value` pairs.
- var _isMatch = function(object, attrs) {
+ var _isMatch = function (object, attrs) {
var keys = _keys(attrs);
var length = keys.length;
if (object === null) return !length;
@@ -1449,9 +1449,9 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// `key:value` pairs.
var _matcher;
var _matches = null;
- _matcher = _matches = function(attrs) {
+ _matcher = _matches = function (attrs) {
attrs = _extendOwn({}, attrs);
- return function(obj) {
+ return function (obj) {
return _isMatch(obj, attrs);
};
};
@@ -1459,7 +1459,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
// A mostly-internal function to generate callbacks that can be applied
// to each element in a collection, returning the desired result — either
// identity, an arbitrary callback, a property matcher, or a property accessor.
- var cb = function(value, context, argCount) {
+ var cb = function (value, context, argCount) {
if (value === null) return _identity;
if (_isFunction(value)) return optimizeCb(value, context, argCount);
if (_isObject(value)) return _matcher(value);
@@ -1468,7 +1468,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
var _every;
var _all = null;
- _every = _all = function(obj, predicate, context) {
+ _every = _all = function (obj, predicate, context) {
predicate = cb(predicate, context);
var keys = !_isArrayLike(obj) && _keys(obj);
var length = (keys || obj).length;
@@ -1482,7 +1482,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
//END COPY fron underscore
- var _hasErrors = function(collection, cb, ignoreCollection, cbName) {
+ var _hasErrors = function (collection, cb, ignoreCollection, cbName) {
if (!ignoreCollection) {
if (!lHlp.isDefined(collection) || !lHlp.isDefined(cb)) {
return true;
@@ -1498,7 +1498,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
return false;
};
- var _iterate = function(collection, externalCb, internalCb) {
+ var _iterate = function (collection, externalCb, internalCb) {
if (_hasErrors(undefined, internalCb, true, 'internalCb')) {
return;
}
@@ -1514,8 +1514,8 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
//see http://jsperf.com/iterators/3
//utilizing for in is way faster
- var _each = function(collection, cb) {
- _iterate(collection, cb, function(val, key) {
+ var _each = function (collection, cb) {
+ _iterate(collection, cb, function (val, key) {
cb(val, key);
});
};
@@ -1529,7 +1529,7 @@ angular.module('leaflet-directive').service('leafletIterators', ["$log", "leafle
}]);
angular.module('leaflet-directive')
-.factory('leafletLayerHelpers', ["$rootScope", "$log", "$q", "leafletHelpers", "leafletIterators", function($rootScope, $log, $q, leafletHelpers, leafletIterators) {
+.factory('leafletLayerHelpers', ["$rootScope", "$log", "$q", "leafletHelpers", "leafletIterators", function ($rootScope, $log, $q, leafletHelpers, leafletIterators) {
var Helpers = leafletHelpers;
var isString = leafletHelpers.isString;
var isObject = leafletHelpers.isObject;
@@ -1538,7 +1538,7 @@ angular.module('leaflet-directive')
var errorHeader = leafletHelpers.errorHeader;
var $it = leafletIterators;
- var utfGridCreateLayer = function(params) {
+ var utfGridCreateLayer = function (params) {
if (!Helpers.UTFGridPlugin.isLoaded()) {
$log.error('[AngularJS - Leaflet] The UTFGrid plugin is not loaded.');
return;
@@ -1546,19 +1546,19 @@ angular.module('leaflet-directive')
var utfgrid = new L.UtfGrid(params.url, params.pluginOptions);
- utfgrid.on('mouseover', function(e) {
+ utfgrid.on('mouseover', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMouseover', e);
});
- utfgrid.on('mouseout', function(e) {
+ utfgrid.on('mouseout', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMouseout', e);
});
- utfgrid.on('click', function(e) {
+ utfgrid.on('click', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridClick', e);
});
- utfgrid.on('mousemove', function(e) {
+ utfgrid.on('mousemove', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMousemove', e);
});
@@ -1568,13 +1568,13 @@ angular.module('leaflet-directive')
var layerTypes = {
xyz: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer(params.url, params.options);
},
},
mapbox: {
mustHaveKey: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var version = 3;
if (isDefined(params.options.version) && params.options.version === 4) {
version = params.options.version;
@@ -1588,7 +1588,7 @@ angular.module('leaflet-directive')
},
geoJSON: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.GeoJSONPlugin.isLoaded()) {
return;
}
@@ -1598,27 +1598,27 @@ angular.module('leaflet-directive')
},
geoJSONShape: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.GeoJSON(params.data,
params.options);
},
},
geoJSONAwesomeMarker: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.geoJson(params.data, {
- pointToLayer: function(feature, latlng) {
- return L.marker(latlng, {icon: L.AwesomeMarkers.icon(params.icon)});
+ pointToLayer: function (feature, latlng) {
+ return L.marker(latlng, { icon: L.AwesomeMarkers.icon(params.icon) });
},
});
},
},
geoJSONVectorMarker: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.geoJson(params.data, {
- pointToLayer: function(feature, latlng) {
- return L.marker(latlng, {icon: L.VectorMarkers.icon(params.icon)});
+ pointToLayer: function (feature, latlng) {
+ return L.marker(latlng, { icon: L.VectorMarkers.icon(params.icon) });
},
});
},
@@ -1629,7 +1629,7 @@ angular.module('leaflet-directive')
},
cartodbTiles: {
mustHaveKey: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/{z}/{x}/{y}.png';
return L.tileLayer(url, params.options);
},
@@ -1637,7 +1637,7 @@ angular.module('leaflet-directive')
cartodbUTFGrid: {
mustHaveKey: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
params.url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/' + params.layer + '/{z}/{x}/{y}.grid.json';
return utfGridCreateLayer(params);
},
@@ -1645,7 +1645,7 @@ angular.module('leaflet-directive')
cartodbInteractive: {
mustHaveKey: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var tilesURL = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/{z}/{x}/{y}.png';
var tileLayer = L.tileLayer(tilesURL, params.options);
params.url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/' + params.layer + '/{z}/{x}/{y}.grid.json';
@@ -1655,20 +1655,20 @@ angular.module('leaflet-directive')
},
wms: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.wms(params.url, params.options);
},
},
wmts: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.wmts(params.url, params.options);
},
},
wfs: {
mustHaveUrl: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.WFSLayerPlugin.isLoaded()) {
return;
}
@@ -1684,13 +1684,13 @@ angular.module('leaflet-directive')
},
group: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var lyrs = [];
- $it.each(params.options.layers, function(l) {
+ $it.each(params.options.layers, function (l) {
lyrs.push(createLayer(l));
});
- params.options.loadedDefer = function() {
+ params.options.loadedDefer = function () {
var defers = [];
if (isDefined(params.options.layers)) {
for (var i = 0; i < params.options.layers.length; i++) {
@@ -1709,13 +1709,13 @@ angular.module('leaflet-directive')
},
featureGroup: {
mustHaveUrl: false,
- createLayer: function() {
+ createLayer: function () {
return L.featureGroup();
},
},
google: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var type = params.type || 'SATELLITE';
if (!Helpers.GoogleLayerPlugin.isLoaded()) {
return;
@@ -1726,7 +1726,7 @@ angular.module('leaflet-directive')
},
here: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var provider = params.provider || 'HERE.terrainDay';
if (!Helpers.LeafletProviderPlugin.isLoaded()) {
return;
@@ -1737,7 +1737,7 @@ angular.module('leaflet-directive')
},
china:{
mustHaveUrl:false,
- createLayer:function(params) {
+ createLayer:function (params) {
var type = params.type || '';
if (!Helpers.ChinaLayerPlugin.isLoaded()) {
return;
@@ -1748,7 +1748,7 @@ angular.module('leaflet-directive')
},
agsBase: {
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSBaseLayerPlugin.isLoaded()) {
return;
}
@@ -1758,7 +1758,7 @@ angular.module('leaflet-directive')
},
ags: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSLayerPlugin.isLoaded()) {
return;
}
@@ -1768,11 +1768,11 @@ angular.module('leaflet-directive')
url: params.url,
});
var layer = new lvector.AGS(options);
- layer.onAdd = function(map) {
+ layer.onAdd = function (map) {
this.setMap(map);
};
- layer.onRemove = function() {
+ layer.onRemove = function () {
this.setMap(null);
};
@@ -1781,7 +1781,7 @@ angular.module('leaflet-directive')
},
agsFeature: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSFeatureLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1790,13 +1790,13 @@ angular.module('leaflet-directive')
params.options.url = params.url;
var layer = L.esri.featureLayer(params.options);
- var load = function() {
+ var load = function () {
if (isDefined(params.options.loadedDefer)) {
params.options.loadedDefer.resolve();
}
};
- layer.on('loading', function() {
+ layer.on('loading', function () {
params.options.loadedDefer = $q.defer();
layer.off('load', load);
layer.on('load', load);
@@ -1807,7 +1807,7 @@ angular.module('leaflet-directive')
},
agsTiled: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSTiledMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1820,7 +1820,7 @@ angular.module('leaflet-directive')
},
agsDynamic: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSDynamicMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1833,7 +1833,7 @@ angular.module('leaflet-directive')
},
agsImage: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSImageMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -1846,7 +1846,7 @@ angular.module('leaflet-directive')
},
agsClustered: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSClusteredLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri clustered layer plugin is not loaded.');
return;
@@ -1862,7 +1862,7 @@ angular.module('leaflet-directive')
},
agsHeatmap: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSHeatmapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri heatmap layer plugin is not loaded.');
return;
@@ -1878,7 +1878,7 @@ angular.module('leaflet-directive')
},
markercluster: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.MarkerClusterPlugin.isLoaded()) {
$log.warn(errorHeader + ' The markercluster plugin is not loaded.');
return;
@@ -1889,7 +1889,7 @@ angular.module('leaflet-directive')
},
bing: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.BingLayerPlugin.isLoaded()) {
return;
}
@@ -1900,7 +1900,7 @@ angular.module('leaflet-directive')
webGLHeatmap: {
mustHaveUrl: false,
mustHaveData: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.WebGLHeatMapLayerPlugin.isLoaded()) {
return;
}
@@ -1916,7 +1916,7 @@ angular.module('leaflet-directive')
heat: {
mustHaveUrl: false,
mustHaveData: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.HeatLayerPlugin.isLoaded()) {
return;
}
@@ -1936,7 +1936,7 @@ angular.module('leaflet-directive')
},
yandex: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var type = params.type || 'map';
if (!Helpers.YandexLayerPlugin.isLoaded()) {
return;
@@ -1948,13 +1948,13 @@ angular.module('leaflet-directive')
imageOverlay: {
mustHaveUrl: true,
mustHaveBounds: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.imageOverlay(params.url, params.bounds, params.options);
},
},
iip: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.iip(params.url, params.options);
},
},
@@ -1964,7 +1964,7 @@ angular.module('leaflet-directive')
// so we let user to define their own layer outside the directive,
// and pass it on "createLayer" result for next processes
custom: {
- createLayer: function(params) {
+ createLayer: function (params) {
if (params.layer instanceof L.Class) {
return angular.copy(params.layer);
} else {
@@ -1974,7 +1974,7 @@ angular.module('leaflet-directive')
},
cartodb: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return cartodb.createLayer(params.map, params.url);
},
},
@@ -1987,35 +1987,39 @@ angular.module('leaflet-directive')
return false;
}
- if (Object.keys(layerTypes).indexOf(layerDefinition.type) === -1) {
- $log.error('[AngularJS - Leaflet] A layer must have a valid type: ' + Object.keys(layerTypes));
- return false;
- }
+ // One of the known types
+ if (Object.keys(layerTypes).indexOf(layerDefinition.type) !== -1) {
- // Check if the layer must have an URL
- if (layerTypes[layerDefinition.type].mustHaveUrl && !isString(layerDefinition.url)) {
- $log.error('[AngularJS - Leaflet] A base layer must have an url');
- return false;
- }
+ // Check if the layer must have an URL
+ if (layerTypes[layerDefinition.type].mustHaveUrl && !isString(layerDefinition.url)) {
+ $log.error('[AngularJS - Leaflet] A base layer must have an url');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveData && !isDefined(layerDefinition.data)) {
- $log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveData && !isDefined(layerDefinition.data)) {
+ $log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveLayer && !isDefined(layerDefinition.layer)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have an layer defined');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveLayer && !isDefined(layerDefinition.layer)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have an layer defined');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveBounds && !isDefined(layerDefinition.bounds)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have bounds defined');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveBounds && !isDefined(layerDefinition.bounds)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have bounds defined');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveKey && !isDefined(layerDefinition.key)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have key defined');
- return false;
+ if (layerTypes[layerDefinition.type].mustHaveKey && !isDefined(layerDefinition.key)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have key defined');
+ return false;
+ }
+ } else {
+ // Type unknown at build time
+ if (typeof L.tileLayer[layerDefinition.type] !== 'function') {
+ return false;
+ }
}
return true;
@@ -2060,7 +2064,8 @@ angular.module('leaflet-directive')
};
//TODO Add $watch to the layer properties
- return layerTypes[layerDefinition.type].createLayer(params);
+ if (layerTypes[layerDefinition.type]) return layerTypes[layerDefinition.type].createLayer(params);
+ return L.tileLayer[layerDefinition.type](params.url, params.options);
}
function safeAddLayer(map, layer) {
@@ -2078,7 +2083,7 @@ angular.module('leaflet-directive')
$log.debug('Loaded Deferred', defers);
var count = defers.length;
if (count > 0) {
- var resolve = function() {
+ var resolve = function () {
count--;
if (count === 0) {
map.removeLayer(layer);
@@ -2092,7 +2097,7 @@ angular.module('leaflet-directive')
map.removeLayer(layer);
}
} else {
- layerOptions.loadedDefer.promise.then(function() {
+ layerOptions.loadedDefer.promise.then(function () {
map.removeLayer(layer);
});
}
@@ -2108,8 +2113,8 @@ angular.module('leaflet-directive')
};
}]);
-angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
- var _updateLegend = function(div, legendData, type, url) {
+angular.module('leaflet-directive').factory('leafletLegendHelpers', function () {
+ var _updateLegend = function (div, legendData, type, url) {
div.innerHTML = '';
if (legendData.error) {
div.innerHTML += '' + legendData.error.message + '
';
@@ -2131,8 +2136,8 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
}
};
- var _getOnAddLegend = function(legendData, legendClass, type, url) {
- return function(/*map*/) {
+ var _getOnAddLegend = function (legendData, legendClass, type, url) {
+ return function (/*map*/) {
var div = L.DomUtil.create('div', legendClass);
if (!L.Browser.touch) {
@@ -2147,8 +2152,8 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
};
};
- var _getOnAddArrayLegend = function(legend, legendClass) {
- return function(/*map*/) {
+ var _getOnAddArrayLegend = function (legend, legendClass) {
+ return function (/*map*/) {
var div = L.DomUtil.create('div', legendClass);
for (var i = 0; i < legend.colors.length; i++) {
div.innerHTML +=
@@ -2174,7 +2179,7 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
};
});
-angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafletHelpers", function($q, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafletHelpers", function ($q, leafletHelpers) {
function _getDefaults() {
return {
keyboard: true,
@@ -2223,16 +2228,16 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafle
// Get the _defaults dictionary, and override the properties defined by the user
return {
- reset: function() {
+ reset: function () {
defaults = {};
},
- getDefaults: function(scopeId) {
+ getDefaults: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
return defaults[mapId];
},
- getMapCreationDefaults: function(scopeId) {
+ getMapCreationDefaults: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
var d = defaults[mapId];
@@ -2275,7 +2280,7 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafle
return mapDefaults;
},
- setDefaults: function(userDefaults, scopeId) {
+ setDefaults: function (userDefaults, scopeId) {
var newDefaults = _getDefaults();
if (isDefined(userDefaults)) {
@@ -2349,7 +2354,7 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', ["$q", "leafle
};
}]);
-angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScope", "$timeout", "leafletHelpers", "$log", "$compile", "leafletGeoJsonHelpers", function($rootScope, $timeout, leafletHelpers, $log, $compile, leafletGeoJsonHelpers) {
+angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScope", "$timeout", "leafletHelpers", "$log", "$compile", "leafletGeoJsonHelpers", function ($rootScope, $timeout, leafletHelpers, $log, $compile, leafletGeoJsonHelpers) {
var isDefined = leafletHelpers.isDefined;
var defaultTo = leafletHelpers.defaultTo;
var MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin;
@@ -2367,22 +2372,22 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
var geoHlp = leafletGeoJsonHelpers;
var errorHeader = leafletHelpers.errorHeader;
- var _string = function(marker) {
+ var _string = function (marker) {
//this exists since JSON.stringify barfs on cyclic
var retStr = '';
- ['_icon', '_latlng', '_leaflet_id', '_map', '_shadow'].forEach(function(prop) {
+ ['_icon', '_latlng', '_leaflet_id', '_map', '_shadow'].forEach(function (prop) {
retStr += prop + ': ' + defaultTo(marker[prop], 'undefined') + ' \n';
});
return '[leafletMarker] : \n' + retStr;
};
- var _log = function(marker, useConsole) {
+ var _log = function (marker, useConsole) {
var logger = useConsole ? console : $log;
logger.debug(_string(marker));
};
- var createLeafletIcon = function(iconData) {
+ var createLeafletIcon = function (iconData) {
if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'awesomeMarker') {
if (!AwesomeMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The AwesomeMarkers Plugin is not loaded.');
@@ -2436,6 +2441,10 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return iconData.icon;
}
+ if (isDefined(iconData) && isDefined(iconData.type)) {
+ return new L.Icon[iconData.type](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=';
@@ -2453,17 +2462,17 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return new L.Icon(iconData);
};
- var _resetMarkerGroup = function(groupName) {
+ var _resetMarkerGroup = function (groupName) {
if (isDefined(groups[groupName])) {
groups.splice(groupName, 1);
}
};
- var _resetMarkerGroups = function() {
+ var _resetMarkerGroups = function () {
groups = {};
};
- var _deleteMarker = function(marker, map, layers) {
+ var _deleteMarker = function (marker, map, layers) {
marker.closePopup();
// There is no easy way to know if a marker is added to a layer, so we search for it
@@ -2492,7 +2501,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var adjustPopupPan = function(marker, map) {
+ var adjustPopupPan = function (marker, map) {
var containerHeight = marker._popup._container.offsetHeight;
var layerPos = new L.Point(marker._popup._containerLeft, -containerHeight - marker._popup._containerBottom);
var containerPos = map.layerPointToContainerPoint(layerPos);
@@ -2501,18 +2510,18 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var compilePopup = function(marker, markerScope) {
+ var compilePopup = function (marker, markerScope) {
$compile(marker._popup._contentNode)(markerScope);
};
- var updatePopup = function(marker, markerScope, map) {
+ var updatePopup = function (marker, markerScope, map) {
//The innerText should be more than 1 once angular has compiled.
//We need to keep trying until angular has compiled before we _updateLayout and _updatePosition
//This should take care of any scenario , eg ngincludes, whatever.
//Is there a better way to check for this?
var innerText = marker._popup._contentNode.innerText || marker._popup._contentNode.textContent;
if (innerText.length < 1) {
- $timeout(function() {
+ $timeout(function () {
updatePopup(marker, markerScope, map);
});
}
@@ -2531,7 +2540,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return reflow;
};
- var _manageOpenPopup = function(marker, markerData, map) {
+ var _manageOpenPopup = function (marker, markerData, map) {
// The marker may provide a scope returning function used to compile the message
// default to $rootScope otherwise
var markerScope = angular.isFunction(markerData.getMessageScope) ? markerData.getMessageScope() : $rootScope;
@@ -2548,7 +2557,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var _manageOpenLabel = function(marker, markerData) {
+ var _manageOpenLabel = function (marker, markerData) {
var markerScope = angular.isFunction(markerData.getMessageScope) ? markerData.getMessageScope() : $rootScope;
var labelScope = angular.isFunction(markerData.getLabelScope) ? markerData.getLabelScope() : markerScope;
var compileMessage = isDefined(markerData.compileMessage) ? markerData.compileMessage : true;
@@ -2564,7 +2573,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
}
};
- var _updateMarker = function(markerData, oldMarkerData, marker, name, leafletScope, layers, map) {
+ var _updateMarker = function (markerData, oldMarkerData, marker, name, leafletScope, layers, map) {
if (!isDefined(oldMarkerData)) {
return;
}
@@ -2802,7 +2811,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
manageOpenLabel: _manageOpenLabel,
- createMarker: function(markerData) {
+ createMarker: function (markerData) {
if (!isDefined(markerData) || !geoHlp.validateCoords(markerData)) {
$log.error(errorHeader + 'The marker definition is not valid.');
return;
@@ -2841,7 +2850,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return marker;
},
- addMarkerToGroup: function(marker, groupName, groupOptions, map) {
+ addMarkerToGroup: function (marker, groupName, groupOptions, map) {
if (!isString(groupName)) {
$log.error(errorHeader + 'The marker group you have specified is invalid.');
return;
@@ -2860,9 +2869,9 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
groups[groupName].addLayer(marker);
},
- listenMarkerEvents: function(marker, markerData, leafletScope, doWatch, map) {
- marker.on('popupopen', function(/* event */) {
- safeApply(leafletScope, function() {
+ listenMarkerEvents: function (marker, markerData, leafletScope, doWatch, map) {
+ marker.on('popupopen', function (/* event */) {
+ safeApply(leafletScope, function () {
if (isDefined(marker._popup) || isDefined(marker._popup._contentNode)) {
markerData.focus = true;
_manageOpenPopup(marker, markerData, map);//needed since markerData is now a copy
@@ -2870,14 +2879,14 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
});
});
- marker.on('popupclose', function(/* event */) {
- safeApply(leafletScope, function() {
+ marker.on('popupclose', function (/* event */) {
+ safeApply(leafletScope, function () {
markerData.focus = false;
});
});
- marker.on('add', function(/* event */) {
- safeApply(leafletScope, function() {
+ marker.on('add', function (/* event */) {
+ safeApply(leafletScope, function () {
if ('label' in markerData)
_manageOpenLabel(marker, markerData);
});
@@ -2886,11 +2895,11 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
updateMarker: _updateMarker,
- addMarkerWatcher: function(marker, name, leafletScope, layers, map, isDeepWatch) {
+ addMarkerWatcher: function (marker, name, leafletScope, layers, map, isDeepWatch) {
var markerWatchPath = Helpers.getObjectArrayPath('markers.' + name);
isDeepWatch = defaultTo(isDeepWatch, true);
- var clearWatch = leafletScope.$watch(markerWatchPath, function(markerData, oldMarkerData) {
+ var clearWatch = leafletScope.$watch(markerWatchPath, function (markerData, oldMarkerData) {
if (!isDefined(markerData)) {
_deleteMarker(marker, map, layers);
clearWatch();
@@ -2906,7 +2915,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
};
}]);
-angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope", "$log", "leafletHelpers", function($rootScope, $log, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope", "$log", "leafletHelpers", function ($rootScope, $log, leafletHelpers) {
var isDefined = leafletHelpers.isDefined;
var isArray = leafletHelpers.isArray;
var isNumber = leafletHelpers.isNumber;
@@ -2924,9 +2933,9 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
'smoothFactor', 'noClip',
];
function _convertToLeafletLatLngs(latlngs) {
- return latlngs.filter(function(latlng) {
+ return latlngs.filter(function (latlng) {
return isValidPoint(latlng);
- }).map(function(latlng) {
+ }).map(function (latlng) {
return _convertToLeafletLatLng(latlng);
});
}
@@ -2940,7 +2949,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
}
function _convertToLeafletMultiLatLngs(paths) {
- return paths.map(function(latlngs) {
+ return paths.map(function (latlngs) {
return _convertToLeafletLatLngs(latlngs);
});
}
@@ -2960,7 +2969,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return options;
}
- var _updatePathOptions = function(path, data) {
+ var _updatePathOptions = function (path, data) {
var updatedStyle = {};
for (var i = 0; i < availableOptions.length; i++) {
var optionName = availableOptions[i];
@@ -2972,7 +2981,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
path.setStyle(data);
};
- var _isValidPolyline = function(latlngs) {
+ var _isValidPolyline = function (latlngs) {
if (!isArray(latlngs)) {
return false;
}
@@ -2989,23 +2998,23 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
var pathTypes = {
polyline: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
return _isValidPolyline(latlngs);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Polyline([], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
multiPolyline: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs)) {
return false;
@@ -3021,34 +3030,34 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.multiPolyline([[[0, 0], [1, 1]]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletMultiLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
polygon: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
return _isValidPolyline(latlngs);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Polygon([], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
multiPolygon: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs)) {
@@ -3065,18 +3074,18 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.MultiPolygon([[[0, 0], [1, 1], [0, 1]]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletMultiLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
rectangle: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs) || latlngs.length !== 2) {
@@ -3093,26 +3102,26 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Rectangle([[0, 0], [1, 1]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setBounds(new L.LatLngBounds(_convertToLeafletLatLngs(data.latlngs)));
_updatePathOptions(path, data);
},
},
circle: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var point = pathData.latlngs;
return isValidPoint(point) && isNumber(pathData.radius);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Circle([0, 0], 1, options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLng(_convertToLeafletLatLng(data.latlngs));
if (isDefined(data.radius)) {
path.setRadius(data.radius);
@@ -3122,16 +3131,16 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
},
},
circleMarker: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var point = pathData.latlngs;
return isValidPoint(point) && isNumber(pathData.radius);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.CircleMarker([0, 0], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLng(_convertToLeafletLatLng(data.latlngs));
if (isDefined(data.radius)) {
path.setRadius(data.radius);
@@ -3142,7 +3151,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
},
};
- var _getPathData = function(path) {
+ var _getPathData = function (path) {
var pathData = {};
if (path.latlngs) {
pathData.latlngs = path.latlngs;
@@ -3156,7 +3165,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
};
return {
- setPathOptions: function(leafletPath, pathType, data) {
+ setPathOptions: function (leafletPath, pathType, data) {
if (!isDefined(pathType)) {
pathType = 'polyline';
}
@@ -3164,7 +3173,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
pathTypes[pathType].setPath(leafletPath, data);
},
- createPath: function(name, path, defaults) {
+ createPath: function (name, path, defaults) {
if (!isDefined(path.type)) {
path.type = 'polyline';
}
@@ -3183,11 +3192,11 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', ["$rootScope"
}]);
angular.module('leaflet-directive')
-.service('leafletWatchHelpers', function() {
+.service('leafletWatchHelpers', function () {
- var _maybe = function(scope, watchFunctionName, thingToWatchStr, watchOptions, initCb) {
+ var _maybe = function (scope, watchFunctionName, thingToWatchStr, watchOptions, initCb) {
//watchOptions.isDeep is/should be ignored in $watchCollection
- var unWatch = scope[watchFunctionName](thingToWatchStr, function(newValue, oldValue) {
+ var unWatch = scope[watchFunctionName](thingToWatchStr, function (newValue, oldValue) {
initCb(newValue, oldValue);
if (!watchOptions.doWatch)
unWatch();
@@ -3203,7 +3212,7 @@ angular.module('leaflet-directive')
@param watchOptions - see markersWatchOptions and or derrivatives. This object is used
to set watching to once and its watch depth.
*/
- var _maybeWatch = function(scope, thingToWatchStr, watchOptions, initCb) {
+ var _maybeWatch = function (scope, thingToWatchStr, watchOptions, initCb) {
return _maybe(scope, '$watch', thingToWatchStr, watchOptions, initCb);
};
@@ -3214,7 +3223,7 @@ angular.module('leaflet-directive')
@param watchOptions - see markersWatchOptions and or derrivatives. This object is used
to set watching to once and its watch depth.
*/
- var _maybeWatchCollection = function(scope, thingToWatchStr, watchOptions, initCb) {
+ var _maybeWatchCollection = function (scope, thingToWatchStr, watchOptions, initCb) {
return _maybe(scope, '$watchCollection', thingToWatchStr, watchOptions, initCb);
};
@@ -3224,16 +3233,16 @@ angular.module('leaflet-directive')
};
});
-angular.module('leaflet-directive').factory('nominatimService', ["$q", "$http", "leafletHelpers", "leafletMapDefaults", function($q, $http, leafletHelpers, leafletMapDefaults) {
+angular.module('leaflet-directive').factory('nominatimService', ["$q", "$http", "leafletHelpers", "leafletMapDefaults", function ($q, $http, leafletHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined;
return {
- query: function(address, mapId) {
+ query: function (address, mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
var url = defaults.nominatim.server;
var df = $q.defer();
- $http.get(url, { params: { format: 'json', limit: 1, q: address } }).success(function(data) {
+ $http.get(url, { params: { format: 'json', limit: 1, q: address } }).success(function (data) {
if (data.length > 0 && isDefined(data[0].boundingbox)) {
df.resolve(data[0]);
} else {
@@ -3246,7 +3255,7 @@ angular.module('leaflet-directive').factory('nominatimService', ["$q", "$http",
};
}]);
-angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$http", "leafletHelpers", "nominatimService", "leafletBoundsHelpers", function($log, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
+angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$http", "leafletHelpers", "nominatimService", "leafletBoundsHelpers", function ($log, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
return {
restrict: 'A',
@@ -3254,20 +3263,20 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
replace: false,
require: ['leaflet'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var createLeafletBounds = leafletBoundsHelpers.createLeafletBounds;
var leafletScope = controller[0].getLeafletScope();
var mapController = controller[0];
var errorHeader = leafletHelpers.errorHeader + ' [Bounds] ';
- var emptyBounds = function(bounds) {
+ var emptyBounds = function (bounds) {
return (bounds._southWest.lat === 0 && bounds._southWest.lng === 0 &&
bounds._northEast.lat === 0 && bounds._northEast.lng === 0);
};
- mapController.getMap().then(function(map) {
- leafletScope.$on('boundsChanged', function(event) {
+ mapController.getMap().then(function (map) {
+ leafletScope.$on('boundsChanged', function (event) {
var scope = event.currentScope;
var bounds = map.getBounds();
@@ -3291,28 +3300,28 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
scope.bounds = newScopeBounds;
}
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromLeaflet = false;
});
});
var lastNominatimQuery;
- leafletScope.$watch('bounds', function(bounds) {
+ leafletScope.$watch('bounds', function (bounds) {
if (scope.settingBoundsFromLeaflet)
return;
if (isDefined(bounds.address) && bounds.address !== lastNominatimQuery) {
scope.settingBoundsFromScope = true;
- nominatimService.query(bounds.address, attrs.id).then(function(data) {
+ nominatimService.query(bounds.address, attrs.id).then(function (data) {
var b = data.boundingbox;
var newBounds = [[b[0], b[2]], [b[1], b[3]]];
map.fitBounds(newBounds);
- }, function(errMsg) {
+ }, function (errMsg) {
$log.error(errorHeader + ' ' + errMsg + '.');
});
lastNominatimQuery = bounds.address;
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromScope = false;
});
@@ -3323,7 +3332,7 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
if (leafletBounds && !map.getBounds().equals(leafletBounds)) {
scope.settingBoundsFromScope = true;
map.fitBounds(leafletBounds, bounds.options);
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromScope = false;
});
}
@@ -3336,10 +3345,10 @@ angular.module('leaflet-directive').directive('bounds', ["$log", "$timeout", "$h
var centerDirectiveTypes = ['center', 'lfCenter'];
var centerDirectives = {};
-centerDirectiveTypes.forEach(function(directiveName) {
+centerDirectiveTypes.forEach(function (directiveName) {
centerDirectives[directiveName] = ['$log', '$q', '$location', '$timeout', 'leafletMapDefaults', 'leafletHelpers',
'leafletBoundsHelpers', 'leafletMapEvents',
- function($log, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
+ function ($log, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
leafletBoundsHelpers, leafletMapEvents) {
var isDefined = leafletHelpers.isDefined;
@@ -3351,7 +3360,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
var isUndefinedOrEmpty = leafletHelpers.isUndefinedOrEmpty;
var errorHeader = leafletHelpers.errorHeader;
- var shouldInitializeMapWithBounds = function(bounds, center) {
+ var shouldInitializeMapWithBounds = function (bounds, center) {
return isDefined(bounds) && isValidBounds(bounds) && isUndefinedOrEmpty(center);
};
@@ -3361,18 +3370,18 @@ centerDirectiveTypes.forEach(function(directiveName) {
scope: false,
replace: false,
require: 'leaflet',
- controller: function() {
+ controller: function () {
_leafletCenter = $q.defer();
- this.getCenter = function() {
+ this.getCenter = function () {
return _leafletCenter.promise;
};
},
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var centerModel = leafletScope[directiveName];
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
if (attrs[directiveName].search('-') !== -1) {
@@ -3382,7 +3391,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
} else if (shouldInitializeMapWithBounds(leafletScope.bounds, centerModel)) {
map.fitBounds(leafletBoundsHelpers.createLeafletBounds(leafletScope.bounds), leafletScope.bounds.options);
centerModel = map.getCenter();
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
angular.extend(scope[directiveName], {
lat: map.getCenter().lat,
lng: map.getCenter().lng,
@@ -3391,7 +3400,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
});
});
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
var mapBounds = map.getBounds();
scope.bounds = {
northEast: {
@@ -3415,7 +3424,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
var urlCenterHash;
var mapReady;
if (attrs.urlHashCenter === 'yes') {
- var extractCenterFromUrl = function() {
+ var extractCenterFromUrl = function () {
var search = $location.search();
var centerParam;
if (isDefined(search.c)) {
@@ -3434,7 +3443,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
urlCenterHash = extractCenterFromUrl();
- leafletScope.$on('$locationChangeSuccess', function(event) {
+ leafletScope.$on('$locationChangeSuccess', function (event) {
var scope = event.currentScope;
//$log.debug("updated location...");
@@ -3450,7 +3459,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
});
}
- leafletScope.$watch(directiveName, function(center) {
+ leafletScope.$watch(directiveName, function (center) {
if (leafletScope.settingCenterFromLeaflet)
return;
@@ -3501,18 +3510,18 @@ centerDirectiveTypes.forEach(function(directiveName) {
leafletScope.settingCenterFromScope = true;
map.setView([center.lat, center.lng], center.zoom);
leafletMapEvents.notifyCenterChangedToBounds(leafletScope, map);
- $timeout(function() {
+ $timeout(function () {
leafletScope.settingCenterFromScope = false;
//$log.debug("allow center scope updates");
});
}, true);
- map.whenReady(function() {
+ map.whenReady(function () {
mapReady = true;
});
- map.on('moveend', function(/* event */) {
+ map.on('moveend', function (/* event */) {
// Resolve the center after the first map position
_leafletCenter.resolve();
leafletMapEvents.notifyCenterUrlHashChanged(leafletScope, map, attrs, $location.search());
@@ -3524,7 +3533,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
}
leafletScope.settingCenterFromLeaflet = true;
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
if (!leafletScope.settingCenterFromScope) {
//$log.debug("updating center model...", map.getCenter(), map.getZoom());
angular.extend(scope[directiveName], {
@@ -3536,14 +3545,14 @@ centerDirectiveTypes.forEach(function(directiveName) {
}
leafletMapEvents.notifyCenterChangedToBounds(leafletScope, map);
- $timeout(function() {
+ $timeout(function () {
leafletScope.settingCenterFromLeaflet = false;
});
});
});
if (centerModel.autoDiscover === true) {
- map.on('locationerror', function() {
+ map.on('locationerror', function () {
$log.warn(errorHeader + ' The Geolocation API is unauthorized on this page.');
if (isValidCenter(centerModel)) {
map.setView([centerModel.lat, centerModel.lng], centerModel.zoom);
@@ -3561,11 +3570,11 @@ centerDirectiveTypes.forEach(function(directiveName) {
];
});
-centerDirectiveTypes.forEach(function(dirType) {
+centerDirectiveTypes.forEach(function (dirType) {
angular.module('leaflet-directive').directive(dirType, centerDirectives[dirType]);
});
-angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpers", "leafletControlHelpers", function($log, leafletHelpers, leafletControlHelpers) {
+angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpers", "leafletControlHelpers", function ($log, leafletHelpers, leafletControlHelpers) {
return {
restrict: 'A',
@@ -3573,7 +3582,7 @@ angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpe
replace: false,
require: '?^leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
if (!controller) {
return;
}
@@ -3586,9 +3595,9 @@ angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpe
var leafletControls = {};
var errorHeader = leafletHelpers.errorHeader + ' [Controls] ';
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
- leafletScope.$watchCollection('controls', function(newControls) {
+ leafletScope.$watchCollection('controls', function (newControls) {
// Delete controls from the array
for (var name in leafletControls) {
@@ -3637,7 +3646,7 @@ angular.module('leaflet-directive').directive('controls', ["$log", "leafletHelpe
};
}]);
-angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHelpers", function($log, leafletHelpers) {
+angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHelpers", function ($log, leafletHelpers) {
return {
restrict: 'A',
@@ -3645,7 +3654,7 @@ angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHe
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var PolylineDecoratorPlugin = leafletHelpers.PolylineDecoratorPlugin;
var isDefined = leafletHelpers.isDefined;
@@ -3673,8 +3682,8 @@ angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHe
}
}
- controller.getMap().then(function(map) {
- leafletScope.$watch('decorations', function(newDecorations) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('decorations', function (newDecorations) {
for (var name in leafletDecorations) {
if (!isDefined(newDecorations[name]) || !angular.equals(newDecorations[name], leafletDecorations)) {
map.removeLayer(leafletDecorations[name]);
@@ -3698,7 +3707,7 @@ angular.module('leaflet-directive').directive('decorations', ["$log", "leafletHe
};
}]);
-angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootScope", "leafletHelpers", "leafletMapEvents", "leafletIterators", function($log, $rootScope, leafletHelpers, leafletMapEvents, leafletIterators) {
+angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootScope", "leafletHelpers", "leafletMapEvents", "leafletIterators", function ($log, $rootScope, leafletHelpers, leafletMapEvents, leafletIterators) {
return {
restrict: 'A',
@@ -3706,7 +3715,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isObject = leafletHelpers.isObject;
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
@@ -3714,7 +3723,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
var availableMapEvents = leafletMapEvents.getAvailableMapEvents();
var addEvents = leafletMapEvents.addEvents;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var mapEvents = [];
var logic = 'broadcast';
@@ -3740,7 +3749,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
$log.warn('[AngularJS - Leaflet] event-broadcast.map.enable must be an object check your model.');
} else {
// Enable events
- leafletIterators.each(eventBroadcast.map.enable, function(eventName) {
+ leafletIterators.each(eventBroadcast.map.enable, function (eventName) {
// Do we have already the event enabled?
if (mapEvents.indexOf(eventName) === -1 && availableMapEvents.indexOf(eventName) !== -1) {
mapEvents.push(eventName);
@@ -3759,7 +3768,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', ["$log", "$rootS
}]);
angular.module('leaflet-directive')
-.directive('geojson', ["$log", "$rootScope", "leafletData", "leafletHelpers", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", "leafletIterators", "leafletGeoJsonEvents", function($log, $rootScope, leafletData, leafletHelpers,
+.directive('geojson', ["$log", "$rootScope", "leafletData", "leafletHelpers", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", "leafletIterators", "leafletGeoJsonEvents", function ($log, $rootScope, leafletData, leafletHelpers,
leafletWatchHelpers, leafletDirectiveControlsHelpers, leafletIterators, leafletGeoJsonEvents) {
var _maybeWatch = leafletWatchHelpers.maybeWatch;
var _watchOptions = leafletHelpers.watchOptions;
@@ -3773,29 +3782,29 @@ angular.module('leaflet-directive')
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var leafletGeoJSON = {};
var _hasSetLeafletData = false;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var watchOptions = leafletScope.geojsonWatchOptions || _watchOptions;
- var _hookUpEvents = function(geojson, maybeName) {
+ var _hookUpEvents = function (geojson, maybeName) {
var onEachFeature;
if (angular.isFunction(geojson.onEachFeature)) {
onEachFeature = geojson.onEachFeature;
} else {
- onEachFeature = function(feature, layer) {
+ onEachFeature = function (feature, layer) {
if (leafletHelpers.LabelPlugin.isLoaded() && isDefined(feature.properties.description)) {
layer.bindLabel(feature.properties.description);
}
leafletGeoJsonEvents.bindEvents(attrs.id, layer, null, feature,
leafletScope, maybeName,
- {resetStyleOnMouseout: geojson.resetStyleOnMouseout,
+ { resetStyleOnMouseout: geojson.resetStyleOnMouseout,
mapId: attrs.id, });
};
}
@@ -3806,17 +3815,17 @@ angular.module('leaflet-directive')
var isNested = (hlp.isDefined(attrs.geojsonNested) &&
hlp.isTruthy(attrs.geojsonNested));
- var _clean = function() {
+ var _clean = function () {
if (!leafletGeoJSON)
return;
- var _remove = function(lObject) {
+ var _remove = function (lObject) {
if (isDefined(lObject) && map.hasLayer(lObject)) {
map.removeLayer(lObject);
}
};
if (isNested) {
- $it.each(leafletGeoJSON, function(lObject) {
+ $it.each(leafletGeoJSON, function (lObject) {
_remove(lObject);
});
@@ -3826,8 +3835,7 @@ angular.module('leaflet-directive')
_remove(leafletGeoJSON);
};
- var _addGeojson = function(model, maybeName) {
- var geojson = angular.copy(model);
+ var _addGeojson = function (geojson, maybeName) {
if (!(isDefined(geojson) && isDefined(geojson.data))) {
return;
}
@@ -3862,12 +3870,12 @@ angular.module('leaflet-directive')
}
};
- var _create = function(model) {
+ var _create = function (model) {
_clean();
if (isNested) {
if (!model || !Object.keys(model).length)
return;
- $it.each(model, function(m, name) {
+ $it.each(model, function (m, name) {
//name could be layerName and or groupName
//for now it is not tied to a layer
_addGeojson(m, name);
@@ -3881,7 +3889,7 @@ angular.module('leaflet-directive')
_extendDirectiveControls(attrs.id, 'geojson', _create, _clean);
- _maybeWatch(leafletScope, 'geojson', watchOptions, function(geojson) {
+ _maybeWatch(leafletScope, 'geojson', watchOptions, function (geojson) {
_create(geojson);
});
});
@@ -3889,7 +3897,7 @@ angular.module('leaflet-directive')
};
}]);
-angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log", "leafletData", "leafletHelpers", function($filter, $log, leafletData, leafletHelpers) {
+angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log", "leafletData", "leafletHelpers", function ($filter, $log, leafletData, leafletHelpers) {
return {
restrict: 'E',
@@ -3904,7 +3912,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
replace: true,
transclude: false,
require: '^leaflet',
- controller: ["$scope", "$element", "$sce", function($scope, $element, $sce) {
+ controller: ["$scope", "$element", "$sce", function ($scope, $element, $sce) {
$log.debug('[Angular Directive - Layers] layers', $scope, $element);
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
@@ -3914,11 +3922,11 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
layerProperties: {},
groupProperties: {},
rangeIsSupported: leafletHelpers.rangeIsSupported(),
- changeBaseLayer: function(key, e) {
- leafletHelpers.safeApply($scope, function(scp) {
+ changeBaseLayer: function (key, e) {
+ leafletHelpers.safeApply($scope, function (scp) {
scp.baselayer = key;
- leafletData.getMap().then(function(map) {
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getMap().then(function (map) {
+ leafletData.getLayers().then(function (leafletLayers) {
if (map.hasLayer(leafletLayers.baselayers[key])) {
return;
}
@@ -3939,7 +3947,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
e.preventDefault();
},
- moveLayer: function(ly, newIndex, e) {
+ moveLayer: function (ly, newIndex, e) {
var delta = Object.keys($scope.layers.baselayers).length;
if (newIndex >= (1 + delta) && newIndex <= ($scope.overlaysArray.length + delta)) {
var oldLy;
@@ -3951,7 +3959,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
}
if (oldLy) {
- safeApply($scope, function() {
+ safeApply($scope, function () {
oldLy.index = ly.index;
ly.index = newIndex;
});
@@ -3962,16 +3970,16 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
e.preventDefault();
},
- initIndex: function(layer, idx) {
+ initIndex: function (layer, idx) {
var delta = Object.keys($scope.layers.baselayers).length;
layer.index = isDefined(layer.index) ? layer.index : idx + delta + 1;
},
- initGroup: function(groupName) {
+ initGroup: function (groupName) {
$scope.groupProperties[groupName] = $scope.groupProperties[groupName] ? $scope.groupProperties[groupName] : {};
},
- toggleOpacity: function(e, layer) {
+ toggleOpacity: function (e, layer) {
if (layer.visible) {
if ($scope.autoHideOpacity && !$scope.layerProperties[layer.name].opacityControl) {
for (var k in $scope.layerProperties) {
@@ -3986,30 +3994,30 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
e.preventDefault();
},
- toggleLegend: function(layer) {
+ toggleLegend: function (layer) {
$scope.layerProperties[layer.name].showLegend = !$scope.layerProperties[layer.name].showLegend;
},
- showLegend: function(layer) {
+ showLegend: function (layer) {
return layer.legend && $scope.layerProperties[layer.name].showLegend;
},
- unsafeHTML: function(html) {
+ unsafeHTML: function (html) {
return $sce.trustAsHtml(html);
},
- getOpacityIcon: function(layer) {
+ getOpacityIcon: function (layer) {
return layer.visible && $scope.layerProperties[layer.name].opacityControl ? $scope.icons.close : $scope.icons.open;
},
- getGroupIcon: function(group) {
+ getGroupIcon: function (group) {
return group.visible ? $scope.icons.check : $scope.icons.uncheck;
},
- changeOpacity: function(layer) {
+ changeOpacity: function (layer) {
var op = $scope.layerProperties[layer.name].opacity;
- leafletData.getMap().then(function(map) {
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getMap().then(function (map) {
+ leafletData.getLayers().then(function (leafletLayers) {
var ly;
for (var k in $scope.layers.overlays) {
if ($scope.layers.overlays[k] === layer) {
@@ -4024,7 +4032,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
}
if (ly.getLayers && ly.eachLayer) {
- ly.eachLayer(function(lay) {
+ ly.eachLayer(function (lay) {
if (lay.setOpacity) {
lay.setOpacity(op / 100);
}
@@ -4035,7 +4043,7 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
});
},
- changeGroupVisibility: function(groupName) {
+ changeGroupVisibility: function (groupName) {
if (!isDefined($scope.groupProperties[groupName])) {
return;
}
@@ -4106,12 +4114,12 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
'' +
'' +
'',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var layers = leafletScope.layers;
- scope.$watch('icons', function() {
+ scope.$watch('icons', function () {
var defaultIcons = {
uncheck: 'fa fa-square-o',
check: 'fa fa-check-square-o',
@@ -4137,10 +4145,10 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
scope.orderNumber = attrs.order === 'normal' ? -1 : 1;
scope.layers = layers;
- controller.getMap().then(function(map) {
- leafletScope.$watch('layers.baselayers', function(newBaseLayers) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('layers.baselayers', function (newBaseLayers) {
var baselayersArray = {};
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
var key;
for (key in newBaseLayers) {
var layer = newBaseLayers[key];
@@ -4152,10 +4160,10 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
});
});
- leafletScope.$watch('layers.overlays', function(newOverlayLayers) {
+ leafletScope.$watch('layers.overlays', function (newOverlayLayers) {
var overlaysArray = [];
var groupVisibleCount = {};
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
var key;
for (key in newOverlayLayers) {
var layer = newOverlayLayers[key];
@@ -4203,21 +4211,21 @@ angular.module('leaflet-directive').directive('layercontrol', ["$filter", "$log"
};
}]);
-angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletData", "leafletHelpers", "leafletLayerHelpers", "leafletControlHelpers", function($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
+angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletData", "leafletHelpers", "leafletLayerHelpers", "leafletControlHelpers", function ($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
return {
restrict: 'A',
scope: false,
replace: false,
require: 'leaflet',
- controller: ["$scope", function($scope) {
+ controller: ["$scope", function ($scope) {
$scope._leafletLayers = $q.defer();
- this.getLayers = function() {
+ this.getLayers = function () {
return $scope._leafletLayers.promise;
};
}],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletLayers = {};
var leafletScope = controller.getLeafletScope();
@@ -4228,7 +4236,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
var updateLayersControl = leafletControlHelpers.updateLayersControl;
var isLayersControlVisible = false;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
// We have baselayers to add to the map
scope._leafletLayers.resolve(leafletLayers);
@@ -4284,7 +4292,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
}
// Watch for the base layers
- leafletScope.$watch('layers.baselayers', function(newBaseLayers, oldBaseLayers) {
+ leafletScope.$watch('layers.baselayers', function (newBaseLayers, oldBaseLayers) {
if (angular.equals(newBaseLayers, oldBaseLayers)) {
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, newBaseLayers, layers.overlays, leafletLayers);
return true;
@@ -4348,7 +4356,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
}, true);
// Watch for the overlay layers
- leafletScope.$watch('layers.overlays', function(newOverlayLayers, oldOverlayLayers) {
+ leafletScope.$watch('layers.overlays', function (newOverlayLayers, oldOverlayLayers) {
if (angular.equals(newOverlayLayers, oldOverlayLayers)) {
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, layers.baselayers, newOverlayLayers, leafletLayers);
return true;
@@ -4412,7 +4420,7 @@ angular.module('leaflet-directive').directive('layers', ["$log", "$q", "leafletD
};
}]);
-angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafletHelpers", "leafletLegendHelpers", function($log, $http, leafletHelpers, leafletLegendHelpers) {
+angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafletHelpers", "leafletLegendHelpers", function ($log, $http, leafletHelpers, leafletLegendHelpers) {
return {
restrict: 'A',
@@ -4420,7 +4428,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isArray = leafletHelpers.isArray;
var isDefined = leafletHelpers.isDefined;
@@ -4433,7 +4441,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
var leafletLegend;
var type;
- leafletScope.$watch('legend', function(newLegend) {
+ leafletScope.$watch('legend', function (newLegend) {
if (isDefined(newLegend)) {
@@ -4447,9 +4455,9 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
}, true);
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
- leafletScope.$watch('legend', function(newLegend) {
+ leafletScope.$watch('legend', function (newLegend) {
if (!isDefined(newLegend)) {
@@ -4491,14 +4499,14 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
});
- leafletScope.$watch('legend.url', function(newURL) {
+ leafletScope.$watch('legend.url', function (newURL) {
if (!isDefined(newURL)) {
return;
}
$http.get(newURL)
- .success(function(legendData) {
+ .success(function (legendData) {
if (isDefined(leafletLegend)) {
@@ -4517,7 +4525,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
legend.loadedData();
}
})
- .error(function() {
+ .error(function () {
$log.warn('[AngularJS - Leaflet] legend.url not loaded.');
});
});
@@ -4528,7 +4536,7 @@ angular.module('leaflet-directive').directive('legend', ["$log", "$http", "leafl
}]);
angular.module('leaflet-directive').directive('markers',
- ["$log", "$rootScope", "$q", "leafletData", "leafletHelpers", "leafletMapDefaults", "leafletMarkersHelpers", "leafletMarkerEvents", "leafletIterators", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", function($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
+ ["$log", "$rootScope", "$q", "leafletData", "leafletHelpers", "leafletMapDefaults", "leafletMarkersHelpers", "leafletMarkerEvents", "leafletIterators", "leafletWatchHelpers", "leafletDirectiveControlsHelpers", function ($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
leafletMarkersHelpers, leafletMarkerEvents, leafletIterators, leafletWatchHelpers,
leafletDirectiveControlsHelpers) {
//less terse vars to helpers
@@ -4547,7 +4555,7 @@ angular.module('leaflet-directive').directive('markers',
var maybeWatch = leafletWatchHelpers.maybeWatch;
var extendDirectiveControls = leafletDirectiveControlsHelpers.extend;
- var _getLMarker = function(leafletMarkers, name, maybeLayerName) {
+ var _getLMarker = function (leafletMarkers, name, maybeLayerName) {
if (!Object.keys(leafletMarkers).length) return;
if (maybeLayerName && isString(maybeLayerName)) {
if (!leafletMarkers[maybeLayerName] || !Object.keys(leafletMarkers[maybeLayerName]).length)
@@ -4558,7 +4566,7 @@ angular.module('leaflet-directive').directive('markers',
return leafletMarkers[name];
};
- var _setLMarker = function(lObject, leafletMarkers, name, maybeLayerName) {
+ var _setLMarker = function (lObject, leafletMarkers, name, maybeLayerName) {
if (maybeLayerName && isString(maybeLayerName)) {
if (!isDefined(leafletMarkers[maybeLayerName]))
leafletMarkers[maybeLayerName] = {};
@@ -4568,7 +4576,7 @@ angular.module('leaflet-directive').directive('markers',
return lObject;
};
- var _maybeAddMarkerToLayer = function(layerName, layers, model, marker, doIndividualWatch, map) {
+ var _maybeAddMarkerToLayer = function (layerName, layers, model, marker, doIndividualWatch, map) {
if (!isString(layerName)) {
$log.error(errorHeader + ' A layername must be a string');
@@ -4604,7 +4612,7 @@ angular.module('leaflet-directive').directive('markers',
};
//TODO: move to leafletMarkersHelpers??? or make a new class/function file (leafletMarkersHelpers is large already)
- var _addMarkers = function(mapId, markersToRender, oldModels, map, layers, leafletMarkers, leafletScope,
+ var _addMarkers = function (mapId, markersToRender, oldModels, map, layers, leafletMarkers, leafletScope,
watchOptions, maybeLayerName, skips) {
for (var newName in markersToRender) {
if (skips[newName])
@@ -4677,7 +4685,7 @@ angular.module('leaflet-directive').directive('markers',
}
};
- var _seeWhatWeAlreadyHave = function(markerModels, oldMarkerModels, lMarkers, isEqual, cb) {
+ var _seeWhatWeAlreadyHave = function (markerModels, oldMarkerModels, lMarkers, isEqual, cb) {
var hasLogged = false;
var equals = false;
var oldMarker;
@@ -4709,19 +4717,19 @@ angular.module('leaflet-directive').directive('markers',
}
};
- var _destroy = function(markerModels, oldMarkerModels, lMarkers, map, layers) {
+ var _destroy = function (markerModels, oldMarkerModels, lMarkers, map, layers) {
_seeWhatWeAlreadyHave(markerModels, oldMarkerModels, lMarkers, false,
- function(newMarker, oldMarker, lMarkerName) {
+ function (newMarker, oldMarker, lMarkerName) {
$log.debug(errorHeader + '[marker] is deleting marker: ' + lMarkerName);
deleteMarker(lMarkers[lMarkerName], map, layers);
delete lMarkers[lMarkerName];
});
};
- var _getNewModelsToSkipp = function(newModels, oldModels, lMarkers) {
+ var _getNewModelsToSkipp = function (newModels, oldModels, lMarkers) {
var skips = {};
_seeWhatWeAlreadyHave(newModels, oldModels, lMarkers, true,
- function(newMarker, oldMarker, lMarkerName) {
+ function (newMarker, oldMarker, lMarkerName) {
$log.debug(errorHeader + '[marker] is already rendered, marker: ' + lMarkerName);
skips[lMarkerName] = newMarker;
});
@@ -4735,11 +4743,11 @@ angular.module('leaflet-directive').directive('markers',
replace: false,
require: ['leaflet', '?layers'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0];
var leafletScope = mapController.getLeafletScope();
- mapController.getMap().then(function(map) {
+ mapController.getMap().then(function (map) {
var leafletMarkers = {};
var getLayers;
@@ -4747,7 +4755,7 @@ angular.module('leaflet-directive').directive('markers',
if (isDefined(controller[1])) {
getLayers = controller[1].getLayers;
} else {
- getLayers = function() {
+ getLayers = function () {
var deferred = $q.defer();
deferred.resolve();
return deferred.promise;
@@ -4763,10 +4771,10 @@ angular.module('leaflet-directive').directive('markers',
var isNested = (isDefined(attrs.markersNested) && Helpers.isTruthy(attrs.markersNested));
- getLayers().then(function(layers) {
- var _clean = function(models, oldModels) {
+ getLayers().then(function (layers) {
+ var _clean = function (models, oldModels) {
if (isNested) {
- $it.each(models, function(markerToMaybeDel, layerName) {
+ $it.each(models, function (markerToMaybeDel, layerName) {
var oldModel = isDefined(oldModel) ? oldModels[layerName] : undefined;
_destroy(markerToMaybeDel, oldModel, leafletMarkers[layerName], map, layers);
});
@@ -4777,11 +4785,11 @@ angular.module('leaflet-directive').directive('markers',
_destroy(models, oldModels, leafletMarkers, map, layers);
};
- var _create = function(models, oldModels) {
+ var _create = function (models, oldModels) {
_clean(models, oldModels);
var skips = null;
if (isNested) {
- $it.each(models, function(markersToAdd, layerName) {
+ $it.each(models, function (markersToAdd, layerName) {
var oldModel = isDefined(oldModel) ? oldModels[layerName] : undefined;
skips = _getNewModelsToSkipp(models[layerName], oldModel, leafletMarkers[layerName]);
_addMarkers(attrs.id, markersToAdd, oldModels, map, layers, leafletMarkers, leafletScope,
@@ -4799,7 +4807,7 @@ angular.module('leaflet-directive').directive('markers',
extendDirectiveControls(attrs.id, 'markers', _create, _clean);
leafletData.setMarkers(leafletMarkers, attrs.id);
- maybeWatch(leafletScope, 'markers', watchOptions, function(newMarkers, oldMarkers) {
+ maybeWatch(leafletScope, 'markers', watchOptions, function (newMarkers, oldMarkers) {
_create(newMarkers, oldMarkers);
});
});
@@ -4808,7 +4816,7 @@ angular.module('leaflet-directive').directive('markers',
};
}]);
-angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapDefaults", "leafletBoundsHelpers", "leafletHelpers", function($log, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
+angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapDefaults", "leafletBoundsHelpers", "leafletHelpers", function ($log, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
return {
restrict: 'A',
@@ -4816,13 +4824,13 @@ angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapD
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var isValidBounds = leafletBoundsHelpers.isValidBounds;
var isNumber = leafletHelpers.isNumber;
- controller.getMap().then(function(map) {
- leafletScope.$watch('maxbounds', function(maxbounds) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('maxbounds', function (maxbounds) {
if (!isValidBounds(maxbounds)) {
// Unset any previous maxbounds
map.setMaxBounds();
@@ -4844,7 +4852,7 @@ angular.module('leaflet-directive').directive('maxbounds', ["$log", "leafletMapD
};
}]);
-angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletData", "leafletMapDefaults", "leafletHelpers", "leafletPathsHelpers", "leafletPathEvents", function($log, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletPathEvents) {
+angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletData", "leafletMapDefaults", "leafletHelpers", "leafletPathsHelpers", "leafletPathEvents", function ($log, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletPathEvents) {
return {
restrict: 'A',
@@ -4852,7 +4860,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
replace: false,
require: ['leaflet', '?layers'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0];
var isDefined = leafletHelpers.isDefined;
var isString = leafletHelpers.isString;
@@ -4862,7 +4870,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
var bindPathEvents = leafletPathEvents.bindPathEvents;
var setPathOptions = leafletPathsHelpers.setPathOptions;
- mapController.getMap().then(function(map) {
+ mapController.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
var getLayers;
@@ -4870,7 +4878,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
if (isDefined(controller[1])) {
getLayers = controller[1].getLayers;
} else {
- getLayers = function() {
+ getLayers = function () {
var deferred = $q.defer();
deferred.resolve();
return deferred.promise;
@@ -4881,7 +4889,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
return;
}
- getLayers().then(function(layers) {
+ getLayers().then(function (layers) {
var leafletPaths = {};
leafletData.setPaths(leafletPaths, attrs.id);
@@ -4890,8 +4898,8 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
var shouldWatch = (!isDefined(attrs.watchPaths) || attrs.watchPaths === 'true');
// Function for listening every single path once created
- var watchPathFn = function(leafletPath, name) {
- var clearWatch = leafletScope.$watch('paths["' + name + '"]', function(pathData, old) {
+ var watchPathFn = function (leafletPath, name) {
+ var clearWatch = leafletScope.$watch('paths["' + name + '"]', function (pathData, old) {
if (!isDefined(pathData)) {
if (isDefined(old.layer)) {
for (var i in layers.overlays) {
@@ -4909,7 +4917,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
}, true);
};
- leafletScope.$watchCollection('paths', function(newPaths) {
+ leafletScope.$watchCollection('paths', function (newPaths) {
// Delete paths (by name) from the array
for (var name in leafletPaths) {
@@ -5001,7 +5009,7 @@ angular.module('leaflet-directive').directive('paths', ["$log", "$q", "leafletDa
};
}]);
-angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "leafletMapDefaults", "leafletHelpers", function($log, leafletData, leafletMapDefaults, leafletHelpers) {
+angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "leafletMapDefaults", "leafletHelpers", function ($log, leafletData, leafletMapDefaults, leafletHelpers) {
return {
restrict: 'A',
@@ -5009,7 +5017,7 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var tiles = leafletScope.tiles;
@@ -5019,10 +5027,10 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
return;
}
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
var tileLayerObj;
- leafletScope.$watch('tiles', function(tiles, oldtiles) {
+ leafletScope.$watch('tiles', function (tiles, oldtiles) {
var tileLayerOptions = defaults.tileLayerOptions;
var tileLayerUrl = defaults.tileLayer;
@@ -5087,10 +5095,10 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
instead. (when watches are disabled)
NgAnnotate does not work here due to the functional creation
*/
-['markers', 'geojson'].forEach(function(name) {
+['markers', 'geojson'].forEach(function (name) {
angular.module('leaflet-directive').directive(name + 'WatchOptions', [
'$log', '$rootScope', '$q', 'leafletData', 'leafletHelpers',
- function($log, $rootScope, $q, leafletData, leafletHelpers) {
+ function ($log, $rootScope, $q, leafletData, leafletHelpers) {
var isDefined = leafletHelpers.isDefined,
errorHeader = leafletHelpers.errorHeader,
@@ -5103,11 +5111,11 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
replace: false,
require: ['leaflet'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0],
leafletScope = mapController.getLeafletScope();
- mapController.getMap().then(function() {
+ mapController.getMap().then(function () {
if (isDefined(scope[name + 'WatchOptions'])) {
if (isObject(scope[name + 'WatchOptions']))
angular.extend(_watchOptions, scope[name + 'WatchOptions']);
@@ -5118,18 +5126,18 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
});
},
};
- },]);
+ }, ]);
});
angular.module('leaflet-directive')
-.factory('LeafletEventsHelpersFactory', ["$rootScope", "$q", "$log", "leafletHelpers", function($rootScope, $q, $log, leafletHelpers) {
+.factory('LeafletEventsHelpersFactory', ["$rootScope", "$q", "$log", "leafletHelpers", function ($rootScope, $q, $log, leafletHelpers) {
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var isArray = leafletHelpers.isArray;
var errorHeader = leafletHelpers.errorHeader;
- var EventsHelper = function(rootBroadcastName, lObjectType) {
+ var EventsHelper = function (rootBroadcastName, lObjectType) {
this.rootBroadcastName = rootBroadcastName;
$log.debug('LeafletEventsHelpersFactory: lObjectType: ' + lObjectType + 'rootBroadcastName: ' + rootBroadcastName);
@@ -5137,7 +5145,7 @@ angular.module('leaflet-directive')
this.lObjectType = lObjectType;
};
- EventsHelper.prototype.getAvailableEvents = function() {return [];};
+ EventsHelper.prototype.getAvailableEvents = function () {return [];};
/*
argument: name: Note this can be a single string or dot notation
@@ -5157,23 +5165,23 @@ angular.module('leaflet-directive')
//would yield name of
name = "cars.m1"
*/
- EventsHelper.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
+ EventsHelper.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
var _this = this;
maybeMapId = maybeMapId || '';
if (maybeMapId)
maybeMapId = '.' + maybeMapId;
- return function(e) {
+ return function (e) {
var broadcastName = _this.rootBroadcastName + maybeMapId + '.' + eventName;
$log.debug(broadcastName);
_this.fire(leafletScope, broadcastName, logic, e, e.target || lObject, model, name, layerName, extra);
};
};
- EventsHelper.prototype.fire = function(scope, broadcastName, logic, event, lObject, model, modelName, layerName) {
+ EventsHelper.prototype.fire = function (scope, broadcastName, logic, event, lObject, model, modelName, layerName) {
// Safely broadcast the event
- safeApply(scope, function() {
+ safeApply(scope, function () {
var toSend = {
leafletEvent: event,
leafletObject: lObject,
@@ -5181,7 +5189,7 @@ angular.module('leaflet-directive')
model: model,
};
if (isDefined(layerName))
- angular.extend(toSend, {layerName: layerName});
+ angular.extend(toSend, { layerName: layerName });
if (logic === 'emit') {
scope.$emit(broadcastName, toSend);
@@ -5191,7 +5199,7 @@ angular.module('leaflet-directive')
});
};
- EventsHelper.prototype.bindEvents = function(maybeMapId, lObject, name, model, leafletScope, layerName, extra) {
+ EventsHelper.prototype.bindEvents = function (maybeMapId, lObject, name, model, leafletScope, layerName, extra) {
var events = [];
var logic = 'emit';
var _this = this;
@@ -5240,7 +5248,7 @@ angular.module('leaflet-directive')
// At this point the object is OK, lets enable or disable events
if (eventsEnable) {
// Enable events
- leafletScope.eventBroadcast[this.lObjectType].enable.forEach(function(eventName) {
+ leafletScope.eventBroadcast[this.lObjectType].enable.forEach(function (eventName) {
// Do we have already the event enabled?
if (events.indexOf(eventName) !== -1) {
// Repeated event, this is an error
@@ -5259,7 +5267,7 @@ angular.module('leaflet-directive')
} else {
// Disable events
events = this.getAvailableEvents();
- leafletScope.eventBroadcast[_this.lObjectType].disable.forEach(function(eventName) {
+ leafletScope.eventBroadcast[_this.lObjectType].disable.forEach(function (eventName) {
var index = events.indexOf(eventName);
if (index === -1) {
// The event does not exist
@@ -5274,7 +5282,7 @@ angular.module('leaflet-directive')
}
}
- events.forEach(function(eventName) {
+ events.forEach(function (eventName) {
lObject.on(eventName, _this.genDispatchEvent(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra));
});
@@ -5283,31 +5291,31 @@ angular.module('leaflet-directive')
return EventsHelper;
}])
-.service('leafletEventsHelpers', ["LeafletEventsHelpersFactory", function(LeafletEventsHelpersFactory) {
+.service('leafletEventsHelpers', ["LeafletEventsHelpersFactory", function (LeafletEventsHelpersFactory) {
return new LeafletEventsHelpersFactory();
}]);
angular.module('leaflet-directive')
-.factory('leafletGeoJsonEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletData", function($rootScope, $q, $log, leafletHelpers,
+.factory('leafletGeoJsonEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletData", function ($rootScope, $q, $log, leafletHelpers,
LeafletEventsHelpersFactory, leafletData) {
var safeApply = leafletHelpers.safeApply;
var EventsHelper = LeafletEventsHelpersFactory;
- var GeoJsonEvents = function() {
+ var GeoJsonEvents = function () {
EventsHelper.call(this, 'leafletDirectiveGeoJson', 'geojson');
};
GeoJsonEvents.prototype = new EventsHelper();
- GeoJsonEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
+ GeoJsonEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
var base = EventsHelper.prototype.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName);
var _this = this;
- return function(e) {
+ return function (e) {
if (eventName === 'mouseout') {
if (extra.resetStyleOnMouseout) {
leafletData.getGeoJSON(extra.mapId)
- .then(function(leafletGeoJSON) {
+ .then(function (leafletGeoJSON) {
//this is broken on nested needs to traverse or user layerName (nested)
var lobj = layerName ? leafletGeoJSON[layerName] : leafletGeoJSON;
lobj.resetStyle(e.target);
@@ -5315,7 +5323,7 @@ angular.module('leaflet-directive')
}
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
$rootScope.$broadcast(_this.rootBroadcastName + '.mouseout', e);
});
}
@@ -5324,7 +5332,7 @@ angular.module('leaflet-directive')
};
};
- GeoJsonEvents.prototype.getAvailableEvents = function() { return [
+ GeoJsonEvents.prototype.getAvailableEvents = function () { return [
'click',
'dblclick',
'mouseover',
@@ -5336,23 +5344,23 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.factory('leafletLabelEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", function($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory) {
+.factory('leafletLabelEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", function ($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory) {
var Helpers = leafletHelpers;
var EventsHelper = LeafletEventsHelpersFactory;
- var LabelEvents = function() {
+ var LabelEvents = function () {
EventsHelper.call(this, 'leafletDirectiveLabel', 'markers');
};
LabelEvents.prototype = new EventsHelper();
- LabelEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ LabelEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var markerName = name.replace('markers.', '');
return EventsHelper.prototype
.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, markerName, model, layerName);
};
- LabelEvents.prototype.getAvailableEvents = function() {
+ LabelEvents.prototype.getAvailableEvents = function () {
return [
'click',
'dblclick',
@@ -5363,27 +5371,27 @@ angular.module('leaflet-directive')
];
};
- LabelEvents.prototype.genEvents = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ LabelEvents.prototype.genEvents = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var _this = this;
var labelEvents = this.getAvailableEvents();
var scopeWatchName = Helpers.getObjectArrayPath('markers.' + name);
- labelEvents.forEach(function(eventName) {
+ labelEvents.forEach(function (eventName) {
lObject.label.on(eventName, _this.genDispatchEvent(
maybeMapId, eventName, logic, leafletScope, lObject.label, scopeWatchName, model, layerName));
});
};
- LabelEvents.prototype.bindEvents = function() {};
+ LabelEvents.prototype.bindEvents = function () {};
return new LabelEvents();
}]);
angular.module('leaflet-directive')
-.factory('leafletMapEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletEventsHelpers", "leafletIterators", function($rootScope, $q, $log, leafletHelpers, leafletEventsHelpers, leafletIterators) {
+.factory('leafletMapEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletEventsHelpers", "leafletIterators", function ($rootScope, $q, $log, leafletHelpers, leafletEventsHelpers, leafletIterators) {
var isDefined = leafletHelpers.isDefined;
var fire = leafletEventsHelpers.fire;
- var _getAvailableMapEvents = function() {
+ var _getAvailableMapEvents = function () {
return [
'click',
'dblclick',
@@ -5432,10 +5440,10 @@ angular.module('leaflet-directive')
];
};
- var _genDispatchMapEvent = function(scope, eventName, logic, maybeMapId) {
+ var _genDispatchMapEvent = function (scope, eventName, logic, maybeMapId) {
if (maybeMapId)
maybeMapId = maybeMapId + '.';
- return function(e) {
+ return function (e) {
// Put together broadcast name
var broadcastName = 'leafletDirectiveMap.' + maybeMapId + eventName;
$log.debug(broadcastName);
@@ -5445,11 +5453,11 @@ angular.module('leaflet-directive')
};
};
- var _notifyCenterChangedToBounds = function(scope) {
+ var _notifyCenterChangedToBounds = function (scope) {
scope.$broadcast('boundsChanged');
};
- var _notifyCenterUrlHashChanged = function(scope, map, attrs, search) {
+ var _notifyCenterUrlHashChanged = function (scope, map, attrs, search) {
if (!isDefined(attrs.urlHashCenter)) {
return;
}
@@ -5462,8 +5470,8 @@ angular.module('leaflet-directive')
}
};
- var _addEvents = function(map, mapEvents, contextName, scope, logic) {
- leafletIterators.each(mapEvents, function(eventName) {
+ var _addEvents = function (map, mapEvents, contextName, scope, logic) {
+ leafletIterators.each(mapEvents, function (eventName) {
var context = {};
context[contextName] = eventName;
map.on(eventName, _genDispatchMapEvent(scope, eventName, logic, map._container.id || ''), context);
@@ -5480,30 +5488,30 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.factory('leafletMarkerEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletLabelEvents", function($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory, leafletLabelEvents) {
+.factory('leafletMarkerEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "LeafletEventsHelpersFactory", "leafletLabelEvents", function ($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory, leafletLabelEvents) {
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
var Helpers = leafletHelpers;
var lblHelp = leafletLabelEvents;
var EventsHelper = LeafletEventsHelpersFactory;
- var MarkerEvents = function() {
+ var MarkerEvents = function () {
EventsHelper.call(this, 'leafletDirectiveMarker', 'markers');
};
MarkerEvents.prototype = new EventsHelper();
- MarkerEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ MarkerEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var handle = EventsHelper.prototype
.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName);
- return function(e) {
+ return function (e) {
// Broadcast old marker click name for backwards compatibility
if (eventName === 'click') {
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
$rootScope.$broadcast('leafletDirectiveMarkersClick', name);
});
} else if (eventName === 'dragend') {
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
model.lat = lObject.getLatLng().lat;
model.lng = lObject.getLatLng().lng;
});
@@ -5517,7 +5525,7 @@ angular.module('leaflet-directive')
};
};
- MarkerEvents.prototype.getAvailableEvents = function() { return [
+ MarkerEvents.prototype.getAvailableEvents = function () { return [
'click',
'dblclick',
'mousedown',
@@ -5539,7 +5547,7 @@ angular.module('leaflet-directive')
];
};
- MarkerEvents.prototype.bindEvents = function(maybeMapId, lObject, name, model, leafletScope, layerName) {
+ MarkerEvents.prototype.bindEvents = function (maybeMapId, lObject, name, model, leafletScope, layerName) {
var logic = EventsHelper.prototype.bindEvents.call(this, maybeMapId, lObject, name, model, leafletScope, layerName);
if (Helpers.LabelPlugin.isLoaded() && isDefined(lObject.label)) {
@@ -5551,7 +5559,7 @@ angular.module('leaflet-directive')
}]);
angular.module('leaflet-directive')
-.factory('leafletPathEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletLabelEvents", "leafletEventsHelpers", function($rootScope, $q, $log, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
+.factory('leafletPathEvents', ["$rootScope", "$q", "$log", "leafletHelpers", "leafletLabelEvents", "leafletEventsHelpers", function ($rootScope, $q, $log, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var Helpers = leafletHelpers;
@@ -5563,20 +5571,20 @@ angular.module('leaflet-directive')
TODO (nmccready) This EventsHelper needs to be derrived from leafletEventsHelpers to elminate copy and paste code.
*/
- var _genDispatchPathEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ var _genDispatchPathEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
maybeMapId = maybeMapId || '';
if (maybeMapId)
maybeMapId = '.' + maybeMapId;
- return function(e) {
+ return function (e) {
var broadcastName = 'leafletDirectivePath' + maybeMapId + '.' + eventName;
$log.debug(broadcastName);
fire(leafletScope, broadcastName, logic, e, e.target || lObject, model, name, layerName);
};
};
- var _bindPathEvents = function(maybeMapId, lObject, name, model, leafletScope) {
+ var _bindPathEvents = function (maybeMapId, lObject, name, model, leafletScope) {
var pathEvents = [];
var i;
var eventName;
@@ -5681,7 +5689,7 @@ angular.module('leaflet-directive')
}
};
- var _getAvailablePathEvents = function() {
+ var _getAvailablePathEvents = function () {
return [
'click',
'dblclick',
diff --git a/package.json b/package.json
index 86297bca..34ff2ed6 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"devDependencies": {
"grunt": "^0.4.5",
"grunt-bower-task": "^0.4.0",
+ "grunt-cli": "^1.2.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-connect": "^0.11.2",
@@ -52,7 +53,8 @@
"test": "grunt travis --verbose",
"karmaChrome": "grunt test-unit-chrome",
"karmaChromeOnce": "grunt karma:unit-chrome-once",
- "semantic-release": "semantic-release pre && npm publish && semantic-release post"
+ "semantic-release": "semantic-release pre && npm publish && semantic-release post",
+ "build": "grunt --force"
},
"main": "dist/angular-leaflet-directive",
"dependencies": {
diff --git a/src/directives/bounds.js b/src/directives/bounds.js
index d1b1764f..eabff506 100644
--- a/src/directives/bounds.js
+++ b/src/directives/bounds.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('bounds', function($log, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
+angular.module('leaflet-directive').directive('bounds', function ($log, $timeout, $http, leafletHelpers, nominatimService, leafletBoundsHelpers) {
return {
restrict: 'A',
@@ -6,20 +6,20 @@ angular.module('leaflet-directive').directive('bounds', function($log, $timeout,
replace: false,
require: ['leaflet'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var createLeafletBounds = leafletBoundsHelpers.createLeafletBounds;
var leafletScope = controller[0].getLeafletScope();
var mapController = controller[0];
var errorHeader = leafletHelpers.errorHeader + ' [Bounds] ';
- var emptyBounds = function(bounds) {
+ var emptyBounds = function (bounds) {
return (bounds._southWest.lat === 0 && bounds._southWest.lng === 0 &&
bounds._northEast.lat === 0 && bounds._northEast.lng === 0);
};
- mapController.getMap().then(function(map) {
- leafletScope.$on('boundsChanged', function(event) {
+ mapController.getMap().then(function (map) {
+ leafletScope.$on('boundsChanged', function (event) {
var scope = event.currentScope;
var bounds = map.getBounds();
@@ -43,28 +43,28 @@ angular.module('leaflet-directive').directive('bounds', function($log, $timeout,
scope.bounds = newScopeBounds;
}
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromLeaflet = false;
});
});
var lastNominatimQuery;
- leafletScope.$watch('bounds', function(bounds) {
+ leafletScope.$watch('bounds', function (bounds) {
if (scope.settingBoundsFromLeaflet)
return;
if (isDefined(bounds.address) && bounds.address !== lastNominatimQuery) {
scope.settingBoundsFromScope = true;
- nominatimService.query(bounds.address, attrs.id).then(function(data) {
+ nominatimService.query(bounds.address, attrs.id).then(function (data) {
var b = data.boundingbox;
var newBounds = [[b[0], b[2]], [b[1], b[3]]];
map.fitBounds(newBounds);
- }, function(errMsg) {
+ }, function (errMsg) {
$log.error(errorHeader + ' ' + errMsg + '.');
});
lastNominatimQuery = bounds.address;
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromScope = false;
});
@@ -75,7 +75,7 @@ angular.module('leaflet-directive').directive('bounds', function($log, $timeout,
if (leafletBounds && !map.getBounds().equals(leafletBounds)) {
scope.settingBoundsFromScope = true;
map.fitBounds(leafletBounds, bounds.options);
- $timeout(function() {
+ $timeout(function () {
scope.settingBoundsFromScope = false;
});
}
diff --git a/src/directives/center.js b/src/directives/center.js
index afad58fb..ac087929 100644
--- a/src/directives/center.js
+++ b/src/directives/center.js
@@ -1,10 +1,10 @@
var centerDirectiveTypes = ['center', 'lfCenter'];
var centerDirectives = {};
-centerDirectiveTypes.forEach(function(directiveName) {
+centerDirectiveTypes.forEach(function (directiveName) {
centerDirectives[directiveName] = ['$log', '$q', '$location', '$timeout', 'leafletMapDefaults', 'leafletHelpers',
'leafletBoundsHelpers', 'leafletMapEvents',
- function($log, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
+ function ($log, $q, $location, $timeout, leafletMapDefaults, leafletHelpers,
leafletBoundsHelpers, leafletMapEvents) {
var isDefined = leafletHelpers.isDefined;
@@ -16,7 +16,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
var isUndefinedOrEmpty = leafletHelpers.isUndefinedOrEmpty;
var errorHeader = leafletHelpers.errorHeader;
- var shouldInitializeMapWithBounds = function(bounds, center) {
+ var shouldInitializeMapWithBounds = function (bounds, center) {
return isDefined(bounds) && isValidBounds(bounds) && isUndefinedOrEmpty(center);
};
@@ -26,18 +26,18 @@ centerDirectiveTypes.forEach(function(directiveName) {
scope: false,
replace: false,
require: 'leaflet',
- controller: function() {
+ controller: function () {
_leafletCenter = $q.defer();
- this.getCenter = function() {
+ this.getCenter = function () {
return _leafletCenter.promise;
};
},
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var centerModel = leafletScope[directiveName];
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
if (attrs[directiveName].search('-') !== -1) {
@@ -47,7 +47,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
} else if (shouldInitializeMapWithBounds(leafletScope.bounds, centerModel)) {
map.fitBounds(leafletBoundsHelpers.createLeafletBounds(leafletScope.bounds), leafletScope.bounds.options);
centerModel = map.getCenter();
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
angular.extend(scope[directiveName], {
lat: map.getCenter().lat,
lng: map.getCenter().lng,
@@ -56,7 +56,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
});
});
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
var mapBounds = map.getBounds();
scope.bounds = {
northEast: {
@@ -80,7 +80,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
var urlCenterHash;
var mapReady;
if (attrs.urlHashCenter === 'yes') {
- var extractCenterFromUrl = function() {
+ var extractCenterFromUrl = function () {
var search = $location.search();
var centerParam;
if (isDefined(search.c)) {
@@ -99,7 +99,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
urlCenterHash = extractCenterFromUrl();
- leafletScope.$on('$locationChangeSuccess', function(event) {
+ leafletScope.$on('$locationChangeSuccess', function (event) {
var scope = event.currentScope;
//$log.debug("updated location...");
@@ -115,7 +115,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
});
}
- leafletScope.$watch(directiveName, function(center) {
+ leafletScope.$watch(directiveName, function (center) {
if (leafletScope.settingCenterFromLeaflet)
return;
@@ -166,18 +166,18 @@ centerDirectiveTypes.forEach(function(directiveName) {
leafletScope.settingCenterFromScope = true;
map.setView([center.lat, center.lng], center.zoom);
leafletMapEvents.notifyCenterChangedToBounds(leafletScope, map);
- $timeout(function() {
+ $timeout(function () {
leafletScope.settingCenterFromScope = false;
//$log.debug("allow center scope updates");
});
}, true);
- map.whenReady(function() {
+ map.whenReady(function () {
mapReady = true;
});
- map.on('moveend', function(/* event */) {
+ map.on('moveend', function (/* event */) {
// Resolve the center after the first map position
_leafletCenter.resolve();
leafletMapEvents.notifyCenterUrlHashChanged(leafletScope, map, attrs, $location.search());
@@ -189,7 +189,7 @@ centerDirectiveTypes.forEach(function(directiveName) {
}
leafletScope.settingCenterFromLeaflet = true;
- safeApply(leafletScope, function(scope) {
+ safeApply(leafletScope, function (scope) {
if (!leafletScope.settingCenterFromScope) {
//$log.debug("updating center model...", map.getCenter(), map.getZoom());
angular.extend(scope[directiveName], {
@@ -201,14 +201,14 @@ centerDirectiveTypes.forEach(function(directiveName) {
}
leafletMapEvents.notifyCenterChangedToBounds(leafletScope, map);
- $timeout(function() {
+ $timeout(function () {
leafletScope.settingCenterFromLeaflet = false;
});
});
});
if (centerModel.autoDiscover === true) {
- map.on('locationerror', function() {
+ map.on('locationerror', function () {
$log.warn(errorHeader + ' The Geolocation API is unauthorized on this page.');
if (isValidCenter(centerModel)) {
map.setView([centerModel.lat, centerModel.lng], centerModel.zoom);
@@ -226,6 +226,6 @@ centerDirectiveTypes.forEach(function(directiveName) {
];
});
-centerDirectiveTypes.forEach(function(dirType) {
+centerDirectiveTypes.forEach(function (dirType) {
angular.module('leaflet-directive').directive(dirType, centerDirectives[dirType]);
});
diff --git a/src/directives/controls.js b/src/directives/controls.js
index eeba332c..52d862c4 100644
--- a/src/directives/controls.js
+++ b/src/directives/controls.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('controls', function($log, leafletHelpers, leafletControlHelpers) {
+angular.module('leaflet-directive').directive('controls', function ($log, leafletHelpers, leafletControlHelpers) {
return {
restrict: 'A',
@@ -6,7 +6,7 @@ angular.module('leaflet-directive').directive('controls', function($log, leaflet
replace: false,
require: '?^leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
if (!controller) {
return;
}
@@ -19,9 +19,9 @@ angular.module('leaflet-directive').directive('controls', function($log, leaflet
var leafletControls = {};
var errorHeader = leafletHelpers.errorHeader + ' [Controls] ';
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
- leafletScope.$watchCollection('controls', function(newControls) {
+ leafletScope.$watchCollection('controls', function (newControls) {
// Delete controls from the array
for (var name in leafletControls) {
diff --git a/src/directives/decorations.js b/src/directives/decorations.js
index 89ca1c03..4d6c47d5 100644
--- a/src/directives/decorations.js
+++ b/src/directives/decorations.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('decorations', function($log, leafletHelpers) {
+angular.module('leaflet-directive').directive('decorations', function ($log, leafletHelpers) {
return {
restrict: 'A',
@@ -6,7 +6,7 @@ angular.module('leaflet-directive').directive('decorations', function($log, leaf
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var PolylineDecoratorPlugin = leafletHelpers.PolylineDecoratorPlugin;
var isDefined = leafletHelpers.isDefined;
@@ -34,8 +34,8 @@ angular.module('leaflet-directive').directive('decorations', function($log, leaf
}
}
- controller.getMap().then(function(map) {
- leafletScope.$watch('decorations', function(newDecorations) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('decorations', function (newDecorations) {
for (var name in leafletDecorations) {
if (!isDefined(newDecorations[name]) || !angular.equals(newDecorations[name], leafletDecorations)) {
map.removeLayer(leafletDecorations[name]);
diff --git a/src/directives/eventBroadcast.js b/src/directives/eventBroadcast.js
index 3b8a80d1..ccef9a88 100644
--- a/src/directives/eventBroadcast.js
+++ b/src/directives/eventBroadcast.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('eventBroadcast', function($log, $rootScope, leafletHelpers, leafletMapEvents, leafletIterators) {
+angular.module('leaflet-directive').directive('eventBroadcast', function ($log, $rootScope, leafletHelpers, leafletMapEvents, leafletIterators) {
return {
restrict: 'A',
@@ -6,7 +6,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', function($log, $
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isObject = leafletHelpers.isObject;
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
@@ -14,7 +14,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', function($log, $
var availableMapEvents = leafletMapEvents.getAvailableMapEvents();
var addEvents = leafletMapEvents.addEvents;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var mapEvents = [];
var logic = 'broadcast';
@@ -40,7 +40,7 @@ angular.module('leaflet-directive').directive('eventBroadcast', function($log, $
$log.warn('[AngularJS - Leaflet] event-broadcast.map.enable must be an object check your model.');
} else {
// Enable events
- leafletIterators.each(eventBroadcast.map.enable, function(eventName) {
+ leafletIterators.each(eventBroadcast.map.enable, function (eventName) {
// Do we have already the event enabled?
if (mapEvents.indexOf(eventName) === -1 && availableMapEvents.indexOf(eventName) !== -1) {
mapEvents.push(eventName);
diff --git a/src/directives/geojson.js b/src/directives/geojson.js
index 71f71b63..14ac1cc2 100644
--- a/src/directives/geojson.js
+++ b/src/directives/geojson.js
@@ -1,5 +1,5 @@
angular.module('leaflet-directive')
-.directive('geojson', function($log, $rootScope, leafletData, leafletHelpers,
+.directive('geojson', function ($log, $rootScope, leafletData, leafletHelpers,
leafletWatchHelpers, leafletDirectiveControlsHelpers, leafletIterators, leafletGeoJsonEvents) {
var _maybeWatch = leafletWatchHelpers.maybeWatch;
var _watchOptions = leafletHelpers.watchOptions;
@@ -13,29 +13,29 @@ angular.module('leaflet-directive')
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var leafletGeoJSON = {};
var _hasSetLeafletData = false;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var watchOptions = leafletScope.geojsonWatchOptions || _watchOptions;
- var _hookUpEvents = function(geojson, maybeName) {
+ var _hookUpEvents = function (geojson, maybeName) {
var onEachFeature;
if (angular.isFunction(geojson.onEachFeature)) {
onEachFeature = geojson.onEachFeature;
} else {
- onEachFeature = function(feature, layer) {
+ onEachFeature = function (feature, layer) {
if (leafletHelpers.LabelPlugin.isLoaded() && isDefined(feature.properties.description)) {
layer.bindLabel(feature.properties.description);
}
leafletGeoJsonEvents.bindEvents(attrs.id, layer, null, feature,
leafletScope, maybeName,
- {resetStyleOnMouseout: geojson.resetStyleOnMouseout,
+ { resetStyleOnMouseout: geojson.resetStyleOnMouseout,
mapId: attrs.id, });
};
}
@@ -46,17 +46,17 @@ angular.module('leaflet-directive')
var isNested = (hlp.isDefined(attrs.geojsonNested) &&
hlp.isTruthy(attrs.geojsonNested));
- var _clean = function() {
+ var _clean = function () {
if (!leafletGeoJSON)
return;
- var _remove = function(lObject) {
+ var _remove = function (lObject) {
if (isDefined(lObject) && map.hasLayer(lObject)) {
map.removeLayer(lObject);
}
};
if (isNested) {
- $it.each(leafletGeoJSON, function(lObject) {
+ $it.each(leafletGeoJSON, function (lObject) {
_remove(lObject);
});
@@ -66,7 +66,7 @@ angular.module('leaflet-directive')
_remove(leafletGeoJSON);
};
- var _addGeojson = function(geojson, maybeName) {
+ var _addGeojson = function (geojson, maybeName) {
if (!(isDefined(geojson) && isDefined(geojson.data))) {
return;
}
@@ -101,12 +101,12 @@ angular.module('leaflet-directive')
}
};
- var _create = function(model) {
+ var _create = function (model) {
_clean();
if (isNested) {
if (!model || !Object.keys(model).length)
return;
- $it.each(model, function(m, name) {
+ $it.each(model, function (m, name) {
//name could be layerName and or groupName
//for now it is not tied to a layer
_addGeojson(m, name);
@@ -120,7 +120,7 @@ angular.module('leaflet-directive')
_extendDirectiveControls(attrs.id, 'geojson', _create, _clean);
- _maybeWatch(leafletScope, 'geojson', watchOptions, function(geojson) {
+ _maybeWatch(leafletScope, 'geojson', watchOptions, function (geojson) {
_create(geojson);
});
});
diff --git a/src/directives/layercontrol.js b/src/directives/layercontrol.js
index 0c0d661e..8eb5c60f 100644
--- a/src/directives/layercontrol.js
+++ b/src/directives/layercontrol.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('layercontrol', function($filter, $log, leafletData, leafletHelpers) {
+angular.module('leaflet-directive').directive('layercontrol', function ($filter, $log, leafletData, leafletHelpers) {
return {
restrict: 'E',
@@ -13,7 +13,7 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
replace: true,
transclude: false,
require: '^leaflet',
- controller: function($scope, $element, $sce) {
+ controller: function ($scope, $element, $sce) {
$log.debug('[Angular Directive - Layers] layers', $scope, $element);
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
@@ -23,11 +23,11 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
layerProperties: {},
groupProperties: {},
rangeIsSupported: leafletHelpers.rangeIsSupported(),
- changeBaseLayer: function(key, e) {
- leafletHelpers.safeApply($scope, function(scp) {
+ changeBaseLayer: function (key, e) {
+ leafletHelpers.safeApply($scope, function (scp) {
scp.baselayer = key;
- leafletData.getMap().then(function(map) {
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getMap().then(function (map) {
+ leafletData.getLayers().then(function (leafletLayers) {
if (map.hasLayer(leafletLayers.baselayers[key])) {
return;
}
@@ -48,7 +48,7 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
e.preventDefault();
},
- moveLayer: function(ly, newIndex, e) {
+ moveLayer: function (ly, newIndex, e) {
var delta = Object.keys($scope.layers.baselayers).length;
if (newIndex >= (1 + delta) && newIndex <= ($scope.overlaysArray.length + delta)) {
var oldLy;
@@ -60,7 +60,7 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
}
if (oldLy) {
- safeApply($scope, function() {
+ safeApply($scope, function () {
oldLy.index = ly.index;
ly.index = newIndex;
});
@@ -71,16 +71,16 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
e.preventDefault();
},
- initIndex: function(layer, idx) {
+ initIndex: function (layer, idx) {
var delta = Object.keys($scope.layers.baselayers).length;
layer.index = isDefined(layer.index) ? layer.index : idx + delta + 1;
},
- initGroup: function(groupName) {
+ initGroup: function (groupName) {
$scope.groupProperties[groupName] = $scope.groupProperties[groupName] ? $scope.groupProperties[groupName] : {};
},
- toggleOpacity: function(e, layer) {
+ toggleOpacity: function (e, layer) {
if (layer.visible) {
if ($scope.autoHideOpacity && !$scope.layerProperties[layer.name].opacityControl) {
for (var k in $scope.layerProperties) {
@@ -95,30 +95,30 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
e.preventDefault();
},
- toggleLegend: function(layer) {
+ toggleLegend: function (layer) {
$scope.layerProperties[layer.name].showLegend = !$scope.layerProperties[layer.name].showLegend;
},
- showLegend: function(layer) {
+ showLegend: function (layer) {
return layer.legend && $scope.layerProperties[layer.name].showLegend;
},
- unsafeHTML: function(html) {
+ unsafeHTML: function (html) {
return $sce.trustAsHtml(html);
},
- getOpacityIcon: function(layer) {
+ getOpacityIcon: function (layer) {
return layer.visible && $scope.layerProperties[layer.name].opacityControl ? $scope.icons.close : $scope.icons.open;
},
- getGroupIcon: function(group) {
+ getGroupIcon: function (group) {
return group.visible ? $scope.icons.check : $scope.icons.uncheck;
},
- changeOpacity: function(layer) {
+ changeOpacity: function (layer) {
var op = $scope.layerProperties[layer.name].opacity;
- leafletData.getMap().then(function(map) {
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getMap().then(function (map) {
+ leafletData.getLayers().then(function (leafletLayers) {
var ly;
for (var k in $scope.layers.overlays) {
if ($scope.layers.overlays[k] === layer) {
@@ -133,7 +133,7 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
}
if (ly.getLayers && ly.eachLayer) {
- ly.eachLayer(function(lay) {
+ ly.eachLayer(function (lay) {
if (lay.setOpacity) {
lay.setOpacity(op / 100);
}
@@ -144,7 +144,7 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
});
},
- changeGroupVisibility: function(groupName) {
+ changeGroupVisibility: function (groupName) {
if (!isDefined($scope.groupProperties[groupName])) {
return;
}
@@ -215,12 +215,12 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
'' +
'' +
'',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var layers = leafletScope.layers;
- scope.$watch('icons', function() {
+ scope.$watch('icons', function () {
var defaultIcons = {
uncheck: 'fa fa-square-o',
check: 'fa fa-check-square-o',
@@ -246,10 +246,10 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
scope.orderNumber = attrs.order === 'normal' ? -1 : 1;
scope.layers = layers;
- controller.getMap().then(function(map) {
- leafletScope.$watch('layers.baselayers', function(newBaseLayers) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('layers.baselayers', function (newBaseLayers) {
var baselayersArray = {};
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
var key;
for (key in newBaseLayers) {
var layer = newBaseLayers[key];
@@ -261,10 +261,10 @@ angular.module('leaflet-directive').directive('layercontrol', function($filter,
});
});
- leafletScope.$watch('layers.overlays', function(newOverlayLayers) {
+ leafletScope.$watch('layers.overlays', function (newOverlayLayers) {
var overlaysArray = [];
var groupVisibleCount = {};
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
var key;
for (key in newOverlayLayers) {
var layer = newOverlayLayers[key];
diff --git a/src/directives/layers.js b/src/directives/layers.js
index c2a0bf93..b8cfc927 100644
--- a/src/directives/layers.js
+++ b/src/directives/layers.js
@@ -1,18 +1,18 @@
-angular.module('leaflet-directive').directive('layers', function($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
+angular.module('leaflet-directive').directive('layers', function ($log, $q, leafletData, leafletHelpers, leafletLayerHelpers, leafletControlHelpers) {
return {
restrict: 'A',
scope: false,
replace: false,
require: 'leaflet',
- controller: function($scope) {
+ controller: function ($scope) {
$scope._leafletLayers = $q.defer();
- this.getLayers = function() {
+ this.getLayers = function () {
return $scope._leafletLayers.promise;
};
},
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletLayers = {};
var leafletScope = controller.getLeafletScope();
@@ -23,7 +23,7 @@ angular.module('leaflet-directive').directive('layers', function($log, $q, leafl
var updateLayersControl = leafletControlHelpers.updateLayersControl;
var isLayersControlVisible = false;
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
// We have baselayers to add to the map
scope._leafletLayers.resolve(leafletLayers);
@@ -79,7 +79,7 @@ angular.module('leaflet-directive').directive('layers', function($log, $q, leafl
}
// Watch for the base layers
- leafletScope.$watch('layers.baselayers', function(newBaseLayers, oldBaseLayers) {
+ leafletScope.$watch('layers.baselayers', function (newBaseLayers, oldBaseLayers) {
if (angular.equals(newBaseLayers, oldBaseLayers)) {
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, newBaseLayers, layers.overlays, leafletLayers);
return true;
@@ -143,7 +143,7 @@ angular.module('leaflet-directive').directive('layers', function($log, $q, leafl
}, true);
// Watch for the overlay layers
- leafletScope.$watch('layers.overlays', function(newOverlayLayers, oldOverlayLayers) {
+ leafletScope.$watch('layers.overlays', function (newOverlayLayers, oldOverlayLayers) {
if (angular.equals(newOverlayLayers, oldOverlayLayers)) {
isLayersControlVisible = updateLayersControl(map, mapId, isLayersControlVisible, layers.baselayers, newOverlayLayers, leafletLayers);
return true;
diff --git a/src/directives/leaflet.js b/src/directives/leaflet.js
index f3595fe4..bfab700a 100644
--- a/src/directives/leaflet.js
+++ b/src/directives/leaflet.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive', []).directive('leaflet', function($q, leafletData, leafletMapDefaults, leafletHelpers, leafletMapEvents) {
+angular.module('leaflet-directive', []).directive('leaflet', function ($q, leafletData, leafletMapDefaults, leafletHelpers, leafletMapEvents) {
return {
restrict: 'EA',
replace: true,
@@ -22,18 +22,18 @@ angular.module('leaflet-directive', []).directive('leaflet', function($q, leafle
},
transclude: true,
template: '',
- controller: function($scope) {
+ controller: function ($scope) {
this._leafletMap = $q.defer();
- this.getMap = function() {
+ this.getMap = function () {
return this._leafletMap.promise;
};
- this.getLeafletScope = function() {
+ this.getLeafletScope = function () {
return $scope;
};
},
- link: function(scope, element, attrs, ctrl) {
+ link: function (scope, element, attrs, ctrl) {
var isDefined = leafletHelpers.isDefined;
var defaults = leafletMapDefaults.setDefaults(scope.defaults, attrs.id);
var mapEvents = leafletMapEvents.getAvailableMapEvents();
@@ -65,11 +65,11 @@ angular.module('leaflet-directive', []).directive('leaflet', function($q, leafle
updateWidth();
scope.$watch(
- function() {
+ function () {
return element[0].getAttribute('width');
},
- function() {
+ function () {
updateWidth();
map.invalidateSize();
});
@@ -81,11 +81,11 @@ angular.module('leaflet-directive', []).directive('leaflet', function($q, leafle
updateHeight();
scope.$watch(
- function() {
+ function () {
return element[0].getAttribute('height');
},
- function() {
+ function () {
updateHeight();
map.invalidateSize();
});
@@ -129,11 +129,11 @@ angular.module('leaflet-directive', []).directive('leaflet', function($q, leafle
}
// Resolve the map object to the promises
- map.whenReady(function() {
+ map.whenReady(function () {
leafletData.setMap(map, attrs.id);
});
- scope.$on('$destroy', function() {
+ scope.$on('$destroy', function () {
leafletMapDefaults.reset();
map.remove();
leafletData.unresolveMap(attrs.id);
@@ -142,7 +142,7 @@ angular.module('leaflet-directive', []).directive('leaflet', function($q, leafle
//Handle request to invalidate the map size
//Up scope using $scope.$emit('invalidateSize')
//Down scope using $scope.$broadcast('invalidateSize')
- scope.$on('invalidateSize', function() {
+ scope.$on('invalidateSize', function () {
map.invalidateSize();
});
},
diff --git a/src/directives/legend.js b/src/directives/legend.js
index e330228f..df64b257 100644
--- a/src/directives/legend.js
+++ b/src/directives/legend.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('legend', function($log, $http, leafletHelpers, leafletLegendHelpers) {
+angular.module('leaflet-directive').directive('legend', function ($log, $http, leafletHelpers, leafletLegendHelpers) {
return {
restrict: 'A',
@@ -6,7 +6,7 @@ angular.module('leaflet-directive').directive('legend', function($log, $http, le
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isArray = leafletHelpers.isArray;
var isDefined = leafletHelpers.isDefined;
@@ -19,7 +19,7 @@ angular.module('leaflet-directive').directive('legend', function($log, $http, le
var leafletLegend;
var type;
- leafletScope.$watch('legend', function(newLegend) {
+ leafletScope.$watch('legend', function (newLegend) {
if (isDefined(newLegend)) {
@@ -33,9 +33,9 @@ angular.module('leaflet-directive').directive('legend', function($log, $http, le
}, true);
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
- leafletScope.$watch('legend', function(newLegend) {
+ leafletScope.$watch('legend', function (newLegend) {
if (!isDefined(newLegend)) {
@@ -77,14 +77,14 @@ angular.module('leaflet-directive').directive('legend', function($log, $http, le
});
- leafletScope.$watch('legend.url', function(newURL) {
+ leafletScope.$watch('legend.url', function (newURL) {
if (!isDefined(newURL)) {
return;
}
$http.get(newURL)
- .success(function(legendData) {
+ .success(function (legendData) {
if (isDefined(leafletLegend)) {
@@ -103,7 +103,7 @@ angular.module('leaflet-directive').directive('legend', function($log, $http, le
legend.loadedData();
}
})
- .error(function() {
+ .error(function () {
$log.warn('[AngularJS - Leaflet] legend.url not loaded.');
});
});
diff --git a/src/directives/markers.js b/src/directives/markers.js
index 6a020e63..5b9240ca 100644
--- a/src/directives/markers.js
+++ b/src/directives/markers.js
@@ -1,5 +1,5 @@
angular.module('leaflet-directive').directive('markers',
- function($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
+ function ($log, $rootScope, $q, leafletData, leafletHelpers, leafletMapDefaults,
leafletMarkersHelpers, leafletMarkerEvents, leafletIterators, leafletWatchHelpers,
leafletDirectiveControlsHelpers) {
//less terse vars to helpers
@@ -18,7 +18,7 @@ angular.module('leaflet-directive').directive('markers',
var maybeWatch = leafletWatchHelpers.maybeWatch;
var extendDirectiveControls = leafletDirectiveControlsHelpers.extend;
- var _getLMarker = function(leafletMarkers, name, maybeLayerName) {
+ var _getLMarker = function (leafletMarkers, name, maybeLayerName) {
if (!Object.keys(leafletMarkers).length) return;
if (maybeLayerName && isString(maybeLayerName)) {
if (!leafletMarkers[maybeLayerName] || !Object.keys(leafletMarkers[maybeLayerName]).length)
@@ -29,7 +29,7 @@ angular.module('leaflet-directive').directive('markers',
return leafletMarkers[name];
};
- var _setLMarker = function(lObject, leafletMarkers, name, maybeLayerName) {
+ var _setLMarker = function (lObject, leafletMarkers, name, maybeLayerName) {
if (maybeLayerName && isString(maybeLayerName)) {
if (!isDefined(leafletMarkers[maybeLayerName]))
leafletMarkers[maybeLayerName] = {};
@@ -39,7 +39,7 @@ angular.module('leaflet-directive').directive('markers',
return lObject;
};
- var _maybeAddMarkerToLayer = function(layerName, layers, model, marker, doIndividualWatch, map) {
+ var _maybeAddMarkerToLayer = function (layerName, layers, model, marker, doIndividualWatch, map) {
if (!isString(layerName)) {
$log.error(errorHeader + ' A layername must be a string');
@@ -75,7 +75,7 @@ angular.module('leaflet-directive').directive('markers',
};
//TODO: move to leafletMarkersHelpers??? or make a new class/function file (leafletMarkersHelpers is large already)
- var _addMarkers = function(mapId, markersToRender, oldModels, map, layers, leafletMarkers, leafletScope,
+ var _addMarkers = function (mapId, markersToRender, oldModels, map, layers, leafletMarkers, leafletScope,
watchOptions, maybeLayerName, skips) {
for (var newName in markersToRender) {
if (skips[newName])
@@ -148,7 +148,7 @@ angular.module('leaflet-directive').directive('markers',
}
};
- var _seeWhatWeAlreadyHave = function(markerModels, oldMarkerModels, lMarkers, isEqual, cb) {
+ var _seeWhatWeAlreadyHave = function (markerModels, oldMarkerModels, lMarkers, isEqual, cb) {
var hasLogged = false;
var equals = false;
var oldMarker;
@@ -180,19 +180,19 @@ angular.module('leaflet-directive').directive('markers',
}
};
- var _destroy = function(markerModels, oldMarkerModels, lMarkers, map, layers) {
+ var _destroy = function (markerModels, oldMarkerModels, lMarkers, map, layers) {
_seeWhatWeAlreadyHave(markerModels, oldMarkerModels, lMarkers, false,
- function(newMarker, oldMarker, lMarkerName) {
+ function (newMarker, oldMarker, lMarkerName) {
$log.debug(errorHeader + '[marker] is deleting marker: ' + lMarkerName);
deleteMarker(lMarkers[lMarkerName], map, layers);
delete lMarkers[lMarkerName];
});
};
- var _getNewModelsToSkipp = function(newModels, oldModels, lMarkers) {
+ var _getNewModelsToSkipp = function (newModels, oldModels, lMarkers) {
var skips = {};
_seeWhatWeAlreadyHave(newModels, oldModels, lMarkers, true,
- function(newMarker, oldMarker, lMarkerName) {
+ function (newMarker, oldMarker, lMarkerName) {
$log.debug(errorHeader + '[marker] is already rendered, marker: ' + lMarkerName);
skips[lMarkerName] = newMarker;
});
@@ -206,11 +206,11 @@ angular.module('leaflet-directive').directive('markers',
replace: false,
require: ['leaflet', '?layers'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0];
var leafletScope = mapController.getLeafletScope();
- mapController.getMap().then(function(map) {
+ mapController.getMap().then(function (map) {
var leafletMarkers = {};
var getLayers;
@@ -218,7 +218,7 @@ angular.module('leaflet-directive').directive('markers',
if (isDefined(controller[1])) {
getLayers = controller[1].getLayers;
} else {
- getLayers = function() {
+ getLayers = function () {
var deferred = $q.defer();
deferred.resolve();
return deferred.promise;
@@ -234,10 +234,10 @@ angular.module('leaflet-directive').directive('markers',
var isNested = (isDefined(attrs.markersNested) && Helpers.isTruthy(attrs.markersNested));
- getLayers().then(function(layers) {
- var _clean = function(models, oldModels) {
+ getLayers().then(function (layers) {
+ var _clean = function (models, oldModels) {
if (isNested) {
- $it.each(models, function(markerToMaybeDel, layerName) {
+ $it.each(models, function (markerToMaybeDel, layerName) {
var oldModel = isDefined(oldModel) ? oldModels[layerName] : undefined;
_destroy(markerToMaybeDel, oldModel, leafletMarkers[layerName], map, layers);
});
@@ -248,11 +248,11 @@ angular.module('leaflet-directive').directive('markers',
_destroy(models, oldModels, leafletMarkers, map, layers);
};
- var _create = function(models, oldModels) {
+ var _create = function (models, oldModels) {
_clean(models, oldModels);
var skips = null;
if (isNested) {
- $it.each(models, function(markersToAdd, layerName) {
+ $it.each(models, function (markersToAdd, layerName) {
var oldModel = isDefined(oldModel) ? oldModels[layerName] : undefined;
skips = _getNewModelsToSkipp(models[layerName], oldModel, leafletMarkers[layerName]);
_addMarkers(attrs.id, markersToAdd, oldModels, map, layers, leafletMarkers, leafletScope,
@@ -270,7 +270,7 @@ angular.module('leaflet-directive').directive('markers',
extendDirectiveControls(attrs.id, 'markers', _create, _clean);
leafletData.setMarkers(leafletMarkers, attrs.id);
- maybeWatch(leafletScope, 'markers', watchOptions, function(newMarkers, oldMarkers) {
+ maybeWatch(leafletScope, 'markers', watchOptions, function (newMarkers, oldMarkers) {
_create(newMarkers, oldMarkers);
});
});
diff --git a/src/directives/maxbounds.js b/src/directives/maxbounds.js
index efc9968b..fd892faf 100644
--- a/src/directives/maxbounds.js
+++ b/src/directives/maxbounds.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('maxbounds', function($log, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
+angular.module('leaflet-directive').directive('maxbounds', function ($log, leafletMapDefaults, leafletBoundsHelpers, leafletHelpers) {
return {
restrict: 'A',
@@ -6,13 +6,13 @@ angular.module('leaflet-directive').directive('maxbounds', function($log, leafle
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var leafletScope = controller.getLeafletScope();
var isValidBounds = leafletBoundsHelpers.isValidBounds;
var isNumber = leafletHelpers.isNumber;
- controller.getMap().then(function(map) {
- leafletScope.$watch('maxbounds', function(maxbounds) {
+ controller.getMap().then(function (map) {
+ leafletScope.$watch('maxbounds', function (maxbounds) {
if (!isValidBounds(maxbounds)) {
// Unset any previous maxbounds
map.setMaxBounds();
diff --git a/src/directives/paths.js b/src/directives/paths.js
index 0cb5f4fd..7777e5b7 100644
--- a/src/directives/paths.js
+++ b/src/directives/paths.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('paths', function($log, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletPathEvents) {
+angular.module('leaflet-directive').directive('paths', function ($log, $q, leafletData, leafletMapDefaults, leafletHelpers, leafletPathsHelpers, leafletPathEvents) {
return {
restrict: 'A',
@@ -6,7 +6,7 @@ angular.module('leaflet-directive').directive('paths', function($log, $q, leafle
replace: false,
require: ['leaflet', '?layers'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0];
var isDefined = leafletHelpers.isDefined;
var isString = leafletHelpers.isString;
@@ -16,7 +16,7 @@ angular.module('leaflet-directive').directive('paths', function($log, $q, leafle
var bindPathEvents = leafletPathEvents.bindPathEvents;
var setPathOptions = leafletPathsHelpers.setPathOptions;
- mapController.getMap().then(function(map) {
+ mapController.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
var getLayers;
@@ -24,7 +24,7 @@ angular.module('leaflet-directive').directive('paths', function($log, $q, leafle
if (isDefined(controller[1])) {
getLayers = controller[1].getLayers;
} else {
- getLayers = function() {
+ getLayers = function () {
var deferred = $q.defer();
deferred.resolve();
return deferred.promise;
@@ -35,7 +35,7 @@ angular.module('leaflet-directive').directive('paths', function($log, $q, leafle
return;
}
- getLayers().then(function(layers) {
+ getLayers().then(function (layers) {
var leafletPaths = {};
leafletData.setPaths(leafletPaths, attrs.id);
@@ -44,8 +44,8 @@ angular.module('leaflet-directive').directive('paths', function($log, $q, leafle
var shouldWatch = (!isDefined(attrs.watchPaths) || attrs.watchPaths === 'true');
// Function for listening every single path once created
- var watchPathFn = function(leafletPath, name) {
- var clearWatch = leafletScope.$watch('paths["' + name + '"]', function(pathData, old) {
+ var watchPathFn = function (leafletPath, name) {
+ var clearWatch = leafletScope.$watch('paths["' + name + '"]', function (pathData, old) {
if (!isDefined(pathData)) {
if (isDefined(old.layer)) {
for (var i in layers.overlays) {
@@ -63,7 +63,7 @@ angular.module('leaflet-directive').directive('paths', function($log, $q, leafle
}, true);
};
- leafletScope.$watchCollection('paths', function(newPaths) {
+ leafletScope.$watchCollection('paths', function (newPaths) {
// Delete paths (by name) from the array
for (var name in leafletPaths) {
diff --git a/src/directives/tiles.js b/src/directives/tiles.js
index 57be0a85..732d28f7 100644
--- a/src/directives/tiles.js
+++ b/src/directives/tiles.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').directive('tiles', function($log, leafletData, leafletMapDefaults, leafletHelpers) {
+angular.module('leaflet-directive').directive('tiles', function ($log, leafletData, leafletMapDefaults, leafletHelpers) {
return {
restrict: 'A',
@@ -6,7 +6,7 @@ angular.module('leaflet-directive').directive('tiles', function($log, leafletDat
replace: false,
require: 'leaflet',
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var isDefined = leafletHelpers.isDefined;
var leafletScope = controller.getLeafletScope();
var tiles = leafletScope.tiles;
@@ -16,10 +16,10 @@ angular.module('leaflet-directive').directive('tiles', function($log, leafletDat
return;
}
- controller.getMap().then(function(map) {
+ controller.getMap().then(function (map) {
var defaults = leafletMapDefaults.getDefaults(attrs.id);
var tileLayerObj;
- leafletScope.$watch('tiles', function(tiles, oldtiles) {
+ leafletScope.$watch('tiles', function (tiles, oldtiles) {
var tileLayerOptions = defaults.tileLayerOptions;
var tileLayerUrl = defaults.tileLayer;
diff --git a/src/directives/watchOptions.js b/src/directives/watchOptions.js
index 2ae644f5..7377f28e 100644
--- a/src/directives/watchOptions.js
+++ b/src/directives/watchOptions.js
@@ -3,10 +3,10 @@
instead. (when watches are disabled)
NgAnnotate does not work here due to the functional creation
*/
-['markers', 'geojson'].forEach(function(name) {
+['markers', 'geojson'].forEach(function (name) {
angular.module('leaflet-directive').directive(name + 'WatchOptions', [
'$log', '$rootScope', '$q', 'leafletData', 'leafletHelpers',
- function($log, $rootScope, $q, leafletData, leafletHelpers) {
+ function ($log, $rootScope, $q, leafletData, leafletHelpers) {
var isDefined = leafletHelpers.isDefined,
errorHeader = leafletHelpers.errorHeader,
@@ -19,11 +19,11 @@
replace: false,
require: ['leaflet'],
- link: function(scope, element, attrs, controller) {
+ link: function (scope, element, attrs, controller) {
var mapController = controller[0],
leafletScope = mapController.getLeafletScope();
- mapController.getMap().then(function() {
+ mapController.getMap().then(function () {
if (isDefined(scope[name + 'WatchOptions'])) {
if (isObject(scope[name + 'WatchOptions']))
angular.extend(_watchOptions, scope[name + 'WatchOptions']);
diff --git a/src/services/events/leafletEventsHelpers.js b/src/services/events/leafletEventsHelpers.js
index de9afd32..2a51f695 100644
--- a/src/services/events/leafletEventsHelpers.js
+++ b/src/services/events/leafletEventsHelpers.js
@@ -1,12 +1,12 @@
angular.module('leaflet-directive')
-.factory('LeafletEventsHelpersFactory', function($rootScope, $q, $log, leafletHelpers) {
+.factory('LeafletEventsHelpersFactory', function ($rootScope, $q, $log, leafletHelpers) {
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var isArray = leafletHelpers.isArray;
var errorHeader = leafletHelpers.errorHeader;
- var EventsHelper = function(rootBroadcastName, lObjectType) {
+ var EventsHelper = function (rootBroadcastName, lObjectType) {
this.rootBroadcastName = rootBroadcastName;
$log.debug('LeafletEventsHelpersFactory: lObjectType: ' + lObjectType + 'rootBroadcastName: ' + rootBroadcastName);
@@ -14,7 +14,7 @@ angular.module('leaflet-directive')
this.lObjectType = lObjectType;
};
- EventsHelper.prototype.getAvailableEvents = function() {return [];};
+ EventsHelper.prototype.getAvailableEvents = function () {return [];};
/*
argument: name: Note this can be a single string or dot notation
@@ -34,23 +34,23 @@ angular.module('leaflet-directive')
//would yield name of
name = "cars.m1"
*/
- EventsHelper.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
+ EventsHelper.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
var _this = this;
maybeMapId = maybeMapId || '';
if (maybeMapId)
maybeMapId = '.' + maybeMapId;
- return function(e) {
+ return function (e) {
var broadcastName = _this.rootBroadcastName + maybeMapId + '.' + eventName;
$log.debug(broadcastName);
_this.fire(leafletScope, broadcastName, logic, e, e.target || lObject, model, name, layerName, extra);
};
};
- EventsHelper.prototype.fire = function(scope, broadcastName, logic, event, lObject, model, modelName, layerName) {
+ EventsHelper.prototype.fire = function (scope, broadcastName, logic, event, lObject, model, modelName, layerName) {
// Safely broadcast the event
- safeApply(scope, function() {
+ safeApply(scope, function () {
var toSend = {
leafletEvent: event,
leafletObject: lObject,
@@ -58,7 +58,7 @@ angular.module('leaflet-directive')
model: model,
};
if (isDefined(layerName))
- angular.extend(toSend, {layerName: layerName});
+ angular.extend(toSend, { layerName: layerName });
if (logic === 'emit') {
scope.$emit(broadcastName, toSend);
@@ -68,7 +68,7 @@ angular.module('leaflet-directive')
});
};
- EventsHelper.prototype.bindEvents = function(maybeMapId, lObject, name, model, leafletScope, layerName, extra) {
+ EventsHelper.prototype.bindEvents = function (maybeMapId, lObject, name, model, leafletScope, layerName, extra) {
var events = [];
var logic = 'emit';
var _this = this;
@@ -117,7 +117,7 @@ angular.module('leaflet-directive')
// At this point the object is OK, lets enable or disable events
if (eventsEnable) {
// Enable events
- leafletScope.eventBroadcast[this.lObjectType].enable.forEach(function(eventName) {
+ leafletScope.eventBroadcast[this.lObjectType].enable.forEach(function (eventName) {
// Do we have already the event enabled?
if (events.indexOf(eventName) !== -1) {
// Repeated event, this is an error
@@ -136,7 +136,7 @@ angular.module('leaflet-directive')
} else {
// Disable events
events = this.getAvailableEvents();
- leafletScope.eventBroadcast[_this.lObjectType].disable.forEach(function(eventName) {
+ leafletScope.eventBroadcast[_this.lObjectType].disable.forEach(function (eventName) {
var index = events.indexOf(eventName);
if (index === -1) {
// The event does not exist
@@ -151,7 +151,7 @@ angular.module('leaflet-directive')
}
}
- events.forEach(function(eventName) {
+ events.forEach(function (eventName) {
lObject.on(eventName, _this.genDispatchEvent(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra));
});
@@ -160,6 +160,6 @@ angular.module('leaflet-directive')
return EventsHelper;
})
-.service('leafletEventsHelpers', function(LeafletEventsHelpersFactory) {
+.service('leafletEventsHelpers', function (LeafletEventsHelpersFactory) {
return new LeafletEventsHelpersFactory();
});
diff --git a/src/services/events/leafletGeoJsonEvents.js b/src/services/events/leafletGeoJsonEvents.js
index f7b33e05..fbc9722e 100644
--- a/src/services/events/leafletGeoJsonEvents.js
+++ b/src/services/events/leafletGeoJsonEvents.js
@@ -1,24 +1,24 @@
angular.module('leaflet-directive')
-.factory('leafletGeoJsonEvents', function($rootScope, $q, $log, leafletHelpers,
+.factory('leafletGeoJsonEvents', function ($rootScope, $q, $log, leafletHelpers,
LeafletEventsHelpersFactory, leafletData) {
var safeApply = leafletHelpers.safeApply;
var EventsHelper = LeafletEventsHelpersFactory;
- var GeoJsonEvents = function() {
+ var GeoJsonEvents = function () {
EventsHelper.call(this, 'leafletDirectiveGeoJson', 'geojson');
};
GeoJsonEvents.prototype = new EventsHelper();
- GeoJsonEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
+ GeoJsonEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName, extra) {
var base = EventsHelper.prototype.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName);
var _this = this;
- return function(e) {
+ return function (e) {
if (eventName === 'mouseout') {
if (extra.resetStyleOnMouseout) {
leafletData.getGeoJSON(extra.mapId)
- .then(function(leafletGeoJSON) {
+ .then(function (leafletGeoJSON) {
//this is broken on nested needs to traverse or user layerName (nested)
var lobj = layerName ? leafletGeoJSON[layerName] : leafletGeoJSON;
lobj.resetStyle(e.target);
@@ -26,7 +26,7 @@ angular.module('leaflet-directive')
}
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
$rootScope.$broadcast(_this.rootBroadcastName + '.mouseout', e);
});
}
@@ -35,7 +35,7 @@ angular.module('leaflet-directive')
};
};
- GeoJsonEvents.prototype.getAvailableEvents = function() { return [
+ GeoJsonEvents.prototype.getAvailableEvents = function () { return [
'click',
'dblclick',
'mouseover',
diff --git a/src/services/events/leafletLabelEvents.js b/src/services/events/leafletLabelEvents.js
index f0283ad5..cb4d9bd7 100644
--- a/src/services/events/leafletLabelEvents.js
+++ b/src/services/events/leafletLabelEvents.js
@@ -1,21 +1,21 @@
angular.module('leaflet-directive')
-.factory('leafletLabelEvents', function($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory) {
+.factory('leafletLabelEvents', function ($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory) {
var Helpers = leafletHelpers;
var EventsHelper = LeafletEventsHelpersFactory;
- var LabelEvents = function() {
+ var LabelEvents = function () {
EventsHelper.call(this, 'leafletDirectiveLabel', 'markers');
};
LabelEvents.prototype = new EventsHelper();
- LabelEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ LabelEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var markerName = name.replace('markers.', '');
return EventsHelper.prototype
.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, markerName, model, layerName);
};
- LabelEvents.prototype.getAvailableEvents = function() {
+ LabelEvents.prototype.getAvailableEvents = function () {
return [
'click',
'dblclick',
@@ -26,17 +26,17 @@ angular.module('leaflet-directive')
];
};
- LabelEvents.prototype.genEvents = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ LabelEvents.prototype.genEvents = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var _this = this;
var labelEvents = this.getAvailableEvents();
var scopeWatchName = Helpers.getObjectArrayPath('markers.' + name);
- labelEvents.forEach(function(eventName) {
+ labelEvents.forEach(function (eventName) {
lObject.label.on(eventName, _this.genDispatchEvent(
maybeMapId, eventName, logic, leafletScope, lObject.label, scopeWatchName, model, layerName));
});
};
- LabelEvents.prototype.bindEvents = function() {};
+ LabelEvents.prototype.bindEvents = function () {};
return new LabelEvents();
});
diff --git a/src/services/events/leafletMapEvents.js b/src/services/events/leafletMapEvents.js
index ed665555..6713c3ad 100644
--- a/src/services/events/leafletMapEvents.js
+++ b/src/services/events/leafletMapEvents.js
@@ -1,9 +1,9 @@
angular.module('leaflet-directive')
-.factory('leafletMapEvents', function($rootScope, $q, $log, leafletHelpers, leafletEventsHelpers, leafletIterators) {
+.factory('leafletMapEvents', function ($rootScope, $q, $log, leafletHelpers, leafletEventsHelpers, leafletIterators) {
var isDefined = leafletHelpers.isDefined;
var fire = leafletEventsHelpers.fire;
- var _getAvailableMapEvents = function() {
+ var _getAvailableMapEvents = function () {
return [
'click',
'dblclick',
@@ -52,10 +52,10 @@ angular.module('leaflet-directive')
];
};
- var _genDispatchMapEvent = function(scope, eventName, logic, maybeMapId) {
+ var _genDispatchMapEvent = function (scope, eventName, logic, maybeMapId) {
if (maybeMapId)
maybeMapId = maybeMapId + '.';
- return function(e) {
+ return function (e) {
// Put together broadcast name
var broadcastName = 'leafletDirectiveMap.' + maybeMapId + eventName;
$log.debug(broadcastName);
@@ -65,11 +65,11 @@ angular.module('leaflet-directive')
};
};
- var _notifyCenterChangedToBounds = function(scope) {
+ var _notifyCenterChangedToBounds = function (scope) {
scope.$broadcast('boundsChanged');
};
- var _notifyCenterUrlHashChanged = function(scope, map, attrs, search) {
+ var _notifyCenterUrlHashChanged = function (scope, map, attrs, search) {
if (!isDefined(attrs.urlHashCenter)) {
return;
}
@@ -82,8 +82,8 @@ angular.module('leaflet-directive')
}
};
- var _addEvents = function(map, mapEvents, contextName, scope, logic) {
- leafletIterators.each(mapEvents, function(eventName) {
+ var _addEvents = function (map, mapEvents, contextName, scope, logic) {
+ leafletIterators.each(mapEvents, function (eventName) {
var context = {};
context[contextName] = eventName;
map.on(eventName, _genDispatchMapEvent(scope, eventName, logic, map._container.id || ''), context);
diff --git a/src/services/events/leafletMarkerEvents.js b/src/services/events/leafletMarkerEvents.js
index 2bf27a82..ec5d5088 100644
--- a/src/services/events/leafletMarkerEvents.js
+++ b/src/services/events/leafletMarkerEvents.js
@@ -1,28 +1,28 @@
angular.module('leaflet-directive')
-.factory('leafletMarkerEvents', function($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory, leafletLabelEvents) {
+.factory('leafletMarkerEvents', function ($rootScope, $q, $log, leafletHelpers, LeafletEventsHelpersFactory, leafletLabelEvents) {
var safeApply = leafletHelpers.safeApply;
var isDefined = leafletHelpers.isDefined;
var Helpers = leafletHelpers;
var lblHelp = leafletLabelEvents;
var EventsHelper = LeafletEventsHelpersFactory;
- var MarkerEvents = function() {
+ var MarkerEvents = function () {
EventsHelper.call(this, 'leafletDirectiveMarker', 'markers');
};
MarkerEvents.prototype = new EventsHelper();
- MarkerEvents.prototype.genDispatchEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ MarkerEvents.prototype.genDispatchEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
var handle = EventsHelper.prototype
.genDispatchEvent.call(this, maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName);
- return function(e) {
+ return function (e) {
// Broadcast old marker click name for backwards compatibility
if (eventName === 'click') {
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
$rootScope.$broadcast('leafletDirectiveMarkersClick', name);
});
} else if (eventName === 'dragend') {
- safeApply(leafletScope, function() {
+ safeApply(leafletScope, function () {
model.lat = lObject.getLatLng().lat;
model.lng = lObject.getLatLng().lng;
});
@@ -36,7 +36,7 @@ angular.module('leaflet-directive')
};
};
- MarkerEvents.prototype.getAvailableEvents = function() { return [
+ MarkerEvents.prototype.getAvailableEvents = function () { return [
'click',
'dblclick',
'mousedown',
@@ -58,7 +58,7 @@ angular.module('leaflet-directive')
];
};
- MarkerEvents.prototype.bindEvents = function(maybeMapId, lObject, name, model, leafletScope, layerName) {
+ MarkerEvents.prototype.bindEvents = function (maybeMapId, lObject, name, model, leafletScope, layerName) {
var logic = EventsHelper.prototype.bindEvents.call(this, maybeMapId, lObject, name, model, leafletScope, layerName);
if (Helpers.LabelPlugin.isLoaded() && isDefined(lObject.label)) {
diff --git a/src/services/events/leafletPathEvents.js b/src/services/events/leafletPathEvents.js
index 2690f835..6b2cd6d1 100644
--- a/src/services/events/leafletPathEvents.js
+++ b/src/services/events/leafletPathEvents.js
@@ -1,5 +1,5 @@
angular.module('leaflet-directive')
-.factory('leafletPathEvents', function($rootScope, $q, $log, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
+.factory('leafletPathEvents', function ($rootScope, $q, $log, leafletHelpers, leafletLabelEvents, leafletEventsHelpers) {
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var Helpers = leafletHelpers;
@@ -11,20 +11,20 @@ angular.module('leaflet-directive')
TODO (nmccready) This EventsHelper needs to be derrived from leafletEventsHelpers to elminate copy and paste code.
*/
- var _genDispatchPathEvent = function(maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
+ var _genDispatchPathEvent = function (maybeMapId, eventName, logic, leafletScope, lObject, name, model, layerName) {
maybeMapId = maybeMapId || '';
if (maybeMapId)
maybeMapId = '.' + maybeMapId;
- return function(e) {
+ return function (e) {
var broadcastName = 'leafletDirectivePath' + maybeMapId + '.' + eventName;
$log.debug(broadcastName);
fire(leafletScope, broadcastName, logic, e, e.target || lObject, model, name, layerName);
};
};
- var _bindPathEvents = function(maybeMapId, lObject, name, model, leafletScope) {
+ var _bindPathEvents = function (maybeMapId, lObject, name, model, leafletScope) {
var pathEvents = [];
var i;
var eventName;
@@ -129,7 +129,7 @@ angular.module('leaflet-directive')
}
};
- var _getAvailablePathEvents = function() {
+ var _getAvailablePathEvents = function () {
return [
'click',
'dblclick',
diff --git a/src/services/leafletBoundsHelpers.js b/src/services/leafletBoundsHelpers.js
index 5e869162..a09748bd 100644
--- a/src/services/leafletBoundsHelpers.js
+++ b/src/services/leafletBoundsHelpers.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').factory('leafletBoundsHelpers', function($log, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletBoundsHelpers', function ($log, leafletHelpers) {
var isArray = leafletHelpers.isArray;
var isNumber = leafletHelpers.isNumber;
@@ -13,7 +13,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', function($lo
}
return {
- createLeafletBounds: function(bounds) {
+ createLeafletBounds: function (bounds) {
if (_isValidBounds(bounds)) {
return L.latLngBounds([bounds.southWest.lat, bounds.southWest.lng],
[bounds.northEast.lat, bounds.northEast.lng]);
@@ -22,7 +22,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', function($lo
isValidBounds: _isValidBounds,
- createBoundsFromArray: function(boundsArray) {
+ createBoundsFromArray: function (boundsArray) {
if (!(isArray(boundsArray) && boundsArray.length === 2 &&
isArray(boundsArray[0]) && isArray(boundsArray[1]) &&
boundsArray[0].length === 2 && boundsArray[1].length === 2 &&
@@ -44,7 +44,7 @@ angular.module('leaflet-directive').factory('leafletBoundsHelpers', function($lo
};
},
- createBoundsFromLeaflet: function(lfBounds) {
+ createBoundsFromLeaflet: function (lfBounds) {
if (!(isDefined(lfBounds) && isFunction(lfBounds.getNorthEast) && isFunction(lfBounds.getSouthWest))) {
$log.error('[AngularJS - Leaflet] The leaflet bounds is not valid object.');
return;
diff --git a/src/services/leafletControlHelpers.js b/src/services/leafletControlHelpers.js
index a2d5684f..8584e4f0 100644
--- a/src/services/leafletControlHelpers.js
+++ b/src/services/leafletControlHelpers.js
@@ -1,11 +1,11 @@
-angular.module('leaflet-directive').factory('leafletControlHelpers', function($rootScope, $log, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
+angular.module('leaflet-directive').factory('leafletControlHelpers', function ($rootScope, $log, leafletHelpers, leafletLayerHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined;
var isObject = leafletHelpers.isObject;
var createLayer = leafletLayerHelpers.createLayer;
var _controls = {};
var errorHeader = leafletHelpers.errorHeader + ' [Controls] ';
- var _controlLayersMustBeVisible = function(baselayers, overlays, mapId) {
+ var _controlLayersMustBeVisible = function (baselayers, overlays, mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
if (!defaults.controls.layers.visible) {
return false;
@@ -14,7 +14,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
var atLeastOneControlItemMustBeShown = false;
if (isObject(baselayers)) {
- Object.keys(baselayers).forEach(function(key) {
+ Object.keys(baselayers).forEach(function (key) {
var layer = baselayers[key];
if (!isDefined(layer.layerOptions) || layer.layerOptions.showOnSelector !== false) {
atLeastOneControlItemMustBeShown = true;
@@ -23,7 +23,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
}
if (isObject(overlays)) {
- Object.keys(overlays).forEach(function(key) {
+ Object.keys(overlays).forEach(function (key) {
var layer = overlays[key];
if (!isDefined(layer.layerParams) || layer.layerParams.showOnSelector !== false) {
atLeastOneControlItemMustBeShown = true;
@@ -34,7 +34,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return atLeastOneControlItemMustBeShown;
};
- var _createLayersControl = function(mapId) {
+ var _createLayersControl = function (mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
var controlOptions = {
collapsed: defaults.controls.layers.collapsed,
@@ -56,7 +56,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
var controlTypes = {
draw: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Draw)) {
$log.error(errorHeader + ' Draw plugin is not loaded.');
return false;
@@ -65,29 +65,29 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Draw(params);
},
},
scale: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.control.scale(params);
},
},
fullscreen: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Fullscreen)) {
$log.error(errorHeader + ' Fullscreen plugin is not loaded.');
return false;
@@ -96,16 +96,16 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Fullscreen(params);
},
},
search: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.Search)) {
$log.error(errorHeader + ' Search plugin is not loaded.');
return false;
@@ -114,17 +114,17 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return true;
},
- checkValidParams: function(/* params */) {
+ checkValidParams: function (/* params */) {
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
return new L.Control.Search(params);
},
},
custom: {},
minimap: {
- isPluginLoaded: function() {
+ isPluginLoaded: function () {
if (!angular.isDefined(L.Control.MiniMap)) {
$log.error(errorHeader + ' Minimap plugin is not loaded.');
return false;
@@ -133,7 +133,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return true;
},
- checkValidParams: function(params) {
+ checkValidParams: function (params) {
if (!isDefined(params.layer)) {
$log.warn(errorHeader + ' minimap "layer" option should be defined.');
return false;
@@ -142,7 +142,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return true;
},
- createControl: function(params) {
+ createControl: function (params) {
var layer = createLayer(params.layer);
if (!isDefined(layer)) {
@@ -158,11 +158,11 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return {
layersControlMustBeVisible: _controlLayersMustBeVisible,
- isValidControlType: function(type) {
+ isValidControlType: function (type) {
return Object.keys(controlTypes).indexOf(type) !== -1;
},
- createControl: function(type, params) {
+ createControl: function (type, params) {
if (!controlTypes[type].checkValidParams(params)) {
return;
}
@@ -170,7 +170,7 @@ angular.module('leaflet-directive').factory('leafletControlHelpers', function($r
return controlTypes[type].createControl(params);
},
- updateLayersControl: function(map, mapId, loaded, baselayers, overlays, leafletLayers) {
+ updateLayersControl: function (map, mapId, loaded, baselayers, overlays, leafletLayers) {
var i;
var _layersControl = _controls[mapId];
var mustBeLoaded = _controlLayersMustBeVisible(baselayers, overlays, mapId);
diff --git a/src/services/leafletData.js b/src/services/leafletData.js
index 181d93e3..f9e7ef85 100644
--- a/src/services/leafletData.js
+++ b/src/services/leafletData.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').service('leafletData', function($log, $q, leafletHelpers) {
+angular.module('leaflet-directive').service('leafletData', function ($log, $q, leafletHelpers) {
var getDefer = leafletHelpers.getDefer,
getUnresolvedDefer = leafletHelpers.getUnresolvedDefer,
setResolvedDefer = leafletHelpers.setResolvedDefer;
@@ -6,7 +6,7 @@ angular.module('leaflet-directive').service('leafletData', function($log, $q, le
var _private = {};
var self = this;
- var upperFirst = function(string) {
+ var upperFirst = function (string) {
return string.charAt(0).toUpperCase() + string.slice(1);
};
@@ -22,27 +22,27 @@ angular.module('leaflet-directive').service('leafletData', function($log, $q, le
'directiveControls', ];
//init
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
_private[itemName] = {};
});
- this.unresolveMap = function(scopeId) {
+ this.unresolveMap = function (scopeId) {
var id = leafletHelpers.obtainEffectiveMapId(_private.map, scopeId);
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
_private[itemName][id] = undefined;
});
};
//int repetitive stuff (get and sets)
- _privateItems.forEach(function(itemName) {
+ _privateItems.forEach(function (itemName) {
var name = upperFirst(itemName);
- self['set' + name] = function(lObject, scopeId) {
+ self['set' + name] = function (lObject, scopeId) {
var defer = getUnresolvedDefer(_private[itemName], scopeId);
defer.resolve(lObject);
setResolvedDefer(_private[itemName], scopeId);
};
- self['get' + name] = function(scopeId) {
+ self['get' + name] = function (scopeId) {
var defer = getDefer(_private[itemName], scopeId);
return defer.promise;
};
diff --git a/src/services/leafletDirectiveControlsHelpers.js b/src/services/leafletDirectiveControlsHelpers.js
index d0bdc362..fad5253b 100644
--- a/src/services/leafletDirectiveControlsHelpers.js
+++ b/src/services/leafletDirectiveControlsHelpers.js
@@ -1,5 +1,5 @@
angular.module('leaflet-directive')
-.service('leafletDirectiveControlsHelpers', function($log, leafletData, leafletHelpers) {
+.service('leafletDirectiveControlsHelpers', function ($log, leafletData, leafletHelpers) {
var _isDefined = leafletHelpers.isDefined;
var _isString = leafletHelpers.isString;
var _isObject = leafletHelpers.isObject;
@@ -7,7 +7,7 @@ angular.module('leaflet-directive')
var _errorHeader = _mainErrorHeader + '[leafletDirectiveControlsHelpers';
- var _extend = function(id, thingToAddName, createFn, cleanFn) {
+ var _extend = function (id, thingToAddName, createFn, cleanFn) {
var _fnHeader = _errorHeader + '.extend] ';
var extender = {};
if (!_isDefined(thingToAddName)) {
@@ -28,7 +28,7 @@ angular.module('leaflet-directive')
}
//add external control to create / destroy markers without a watch
- leafletData.getDirectiveControls().then(function(controls) {
+ leafletData.getDirectiveControls().then(function (controls) {
angular.extend(controls, extender);
leafletData.setDirectiveControls(controls, id);
});
diff --git a/src/services/leafletGeoJsonHelpers.js b/src/services/leafletGeoJsonHelpers.js
index 3d02d094..d40820be 100644
--- a/src/services/leafletGeoJsonHelpers.js
+++ b/src/services/leafletGeoJsonHelpers.js
@@ -1,14 +1,14 @@
angular.module('leaflet-directive')
-.service('leafletGeoJsonHelpers', function(leafletHelpers, leafletIterators) {
+.service('leafletGeoJsonHelpers', function (leafletHelpers, leafletIterators) {
var lHlp = leafletHelpers;
var lIt = leafletIterators;
- var Point = function(lat, lng) {
+ var Point = function (lat, lng) {
this.lat = lat;
this.lng = lng;
return this;
};
- var _getLat = function(value) {
+ var _getLat = function (value) {
if (Array.isArray(value) && value.length === 2) {
return value[1];
} else if (lHlp.isDefined(value.type) && value.type === 'Point') {
@@ -18,7 +18,7 @@ angular.module('leaflet-directive')
}
};
- var _getLng = function(value) {
+ var _getLng = function (value) {
if (Array.isArray(value) && value.length === 2) {
return value[0];
} else if (lHlp.isDefined(value.type) && value.type === 'Point') {
@@ -28,7 +28,7 @@ angular.module('leaflet-directive')
}
};
- var _validateCoords = function(coords) {
+ var _validateCoords = function (coords) {
if (lHlp.isUndefined(coords)) {
return false;
}
@@ -47,14 +47,14 @@ angular.module('leaflet-directive')
}
}
- var ret = lIt.all(['lat', 'lng'], function(pos) {
+ var ret = lIt.all(['lat', 'lng'], function (pos) {
return lHlp.isDefined(coords[pos]) && lHlp.isNumber(coords[pos]);
});
return ret;
};
- var _getCoords = function(value) {
+ var _getCoords = function (value) {
if (!value || !_validateCoords(value)) {
return;
}
diff --git a/src/services/leafletHelpers.js b/src/services/leafletHelpers.js
index 8a161586..8be02617 100644
--- a/src/services/leafletHelpers.js
+++ b/src/services/leafletHelpers.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').service('leafletHelpers', function($q, $log) {
+angular.module('leaflet-directive').service('leafletHelpers', function ($q, $log) {
var _errorHeader = '[AngularJS - Leaflet] ';
var _copy = angular.copy;
var _clone = _copy;
@@ -15,7 +15,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
_getObjectValue(obj,"bike.1") returns 'hi'
this is getPath in ui-gmap
*/
- var _getObjectValue = function(object, pathStr) {
+ var _getObjectValue = function (object, pathStr) {
var obj;
if (!object || !angular.isObject(object))
return;
@@ -26,7 +26,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
obj = object;
- pathStr.split('.').forEach(function(value) {
+ pathStr.split('.').forEach(function (value) {
if (obj) {
obj = obj[value];
}
@@ -41,8 +41,8 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
returns:
'bike["one"]["two"]'
*/
- var _getObjectArrayPath = function(pathStr) {
- return pathStr.split('.').reduce(function(previous, current) {
+ var _getObjectArrayPath = function (pathStr) {
+ return pathStr.split('.').reduce(function (previous, current) {
return previous + '["' + current + '"]';
});
};
@@ -52,8 +52,8 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
returns:
"bike.one.two"
*/
- var _getObjectDotPath = function(arrayOfStrings) {
- return arrayOfStrings.reduce(function(previous, current) {
+ var _getObjectDotPath = function (arrayOfStrings) {
+ return arrayOfStrings.reduce(function (previous, current) {
return previous + '.' + current;
});
};
@@ -97,11 +97,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
return defer;
}
- var _isDefined = function(value) {
+ var _isDefined = function (value) {
return angular.isDefined(value) && value !== null;
};
- var _isUndefined = function(value) {
+ var _isUndefined = function (value) {
return !_isDefined(value);
};
@@ -119,8 +119,8 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
@param name Name to normalize
*/
- var camelCase = function(name) {
- return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ var camelCase = function (name) {
+ return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
if (offset) {
return letter.toUpperCase();
} else {
@@ -134,7 +134,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
@param name Name to normalize
*/
- var directiveNormalize = function(name) {
+ var directiveNormalize = function (name) {
return camelCase(name.replace(PREFIX_REGEXP, ''));
};
@@ -149,22 +149,22 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
getObjectValue: _getObjectValue,
getObjectArrayPath:_getObjectArrayPath,
getObjectDotPath: _getObjectDotPath,
- defaultTo: function(val, _default) {
+ defaultTo: function (val, _default) {
return _isDefined(val) ? val : _default;
},
//mainly for checking attributes of directives lets keep this minimal (on what we accept)
- isTruthy: function(val) {
+ isTruthy: function (val) {
return val === 'true' || val === true;
},
//Determine if a reference is {}
- isEmpty: function(value) {
+ isEmpty: function (value) {
return Object.keys(value).length === 0;
},
//Determine if a reference is undefined or {}
- isUndefinedOrEmpty: function(value) {
+ isUndefinedOrEmpty: function (value) {
return (angular.isUndefined(value) || value === null) || Object.keys(value).length === 0;
},
@@ -178,12 +178,12 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
isFunction: angular.isFunction,
equals: angular.equals,
- isValidCenter: function(center) {
+ isValidCenter: function (center) {
return angular.isDefined(center) && angular.isNumber(center.lat) &&
angular.isNumber(center.lng) && angular.isNumber(center.zoom);
},
- isValidPoint: function(point) {
+ isValidPoint: function (point) {
if (!angular.isDefined(point)) {
return false;
}
@@ -195,7 +195,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
return angular.isNumber(point.lat) && angular.isNumber(point.lng);
},
- isSameCenterOnMap: function(centerModel, map) {
+ isSameCenterOnMap: function (centerModel, map) {
var mapCenter = map.getCenter();
var zoom = map.getZoom();
if (centerModel.lat && centerModel.lng &&
@@ -208,7 +208,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
return false;
},
- safeApply: function($scope, fn) {
+ safeApply: function ($scope, fn) {
var phase = $scope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
$scope.$eval(fn);
@@ -219,7 +219,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
obtainEffectiveMapId: _obtainEffectiveMapId,
- getDefer: function(d, mapId) {
+ getDefer: function (d, mapId) {
var id = _obtainEffectiveMapId(d, mapId);
var defer;
if (!angular.isDefined(d[id]) || d[id].resolvedDefer === false) {
@@ -233,35 +233,35 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
getUnresolvedDefer: _getUnresolvedDefer,
- setResolvedDefer: function(d, mapId) {
+ setResolvedDefer: function (d, mapId) {
var id = _obtainEffectiveMapId(d, mapId);
d[id].resolvedDefer = true;
},
- rangeIsSupported: function() {
+ rangeIsSupported: function () {
var testrange = document.createElement('input');
testrange.setAttribute('type', 'range');
return testrange.type === 'range';
},
FullScreenControlPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Control.Fullscreen);
},
},
MiniMapControlPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Control.MiniMap);
},
},
AwesomeMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.AwesomeMarkers) && angular.isDefined(L.AwesomeMarkers.Icon);
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.AwesomeMarkers.Icon;
} else {
@@ -269,7 +269,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -283,11 +283,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
VectorMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.VectorMarkers) && angular.isDefined(L.VectorMarkers.Icon);
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.VectorMarkers.Icon;
} else {
@@ -295,7 +295,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -309,7 +309,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
DomMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.DomMarkers) && angular.isDefined(L.DomMarkers.Icon)) {
return true;
} else {
@@ -317,7 +317,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.DomMarkers.Icon;
} else {
@@ -325,7 +325,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -339,7 +339,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
PolylineDecoratorPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.PolylineDecorator)) {
return true;
} else {
@@ -347,7 +347,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- is: function(decoration) {
+ is: function (decoration) {
if (this.isLoaded()) {
return decoration instanceof L.PolylineDecorator;
} else {
@@ -355,7 +355,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- equal: function(decorationA, decorationB) {
+ equal: function (decorationA, decorationB) {
if (!this.isLoaded()) {
return false;
}
@@ -369,7 +369,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
MakiMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.MakiMarkers) && angular.isDefined(L.MakiMarkers.Icon)) {
return true;
} else {
@@ -377,7 +377,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.MakiMarkers.Icon;
} else {
@@ -385,7 +385,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -398,7 +398,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
ExtraMarkersPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
if (angular.isDefined(L.ExtraMarkers) && angular.isDefined(L.ExtraMarkers.Icon)) {
return true;
} else {
@@ -406,7 +406,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- is: function(icon) {
+ is: function (icon) {
if (this.isLoaded()) {
return icon instanceof L.ExtraMarkers.Icon;
} else {
@@ -414,7 +414,7 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
}
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (!this.isLoaded()) {
return false;
}
@@ -427,11 +427,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
LabelPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Label);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.MarkerClusterGroup;
} else {
@@ -440,11 +440,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
MarkerClusterPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.MarkerClusterGroup);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.MarkerClusterGroup;
} else {
@@ -453,11 +453,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
GoogleLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Google);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.Google;
} else {
@@ -466,11 +466,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
LeafletProviderPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.Provider);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.Provider;
} else {
@@ -479,26 +479,26 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
ChinaLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.tileLayer.chinaProvider);
},
},
HeatLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.heatLayer);
},
},
WebGLHeatMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.WebGLHeatMap);
},
},
BingLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.BingLayer);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.BingLayer;
} else {
@@ -507,11 +507,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
WFSLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.GeoJSON.WFS !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.GeoJSON.WFS;
} else {
@@ -520,11 +520,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSBaseLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.basemapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.basemapLayer;
} else {
@@ -533,11 +533,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return lvector !== undefined && lvector.AGS !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof lvector.AGS;
} else {
@@ -546,11 +546,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSFeatureLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.featureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.featureLayer;
} else {
@@ -559,11 +559,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSTiledMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.tiledMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.tiledMapLayer;
} else {
@@ -572,11 +572,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSDynamicMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.dynamicMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.dynamicMapLayer;
} else {
@@ -585,11 +585,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSImageMapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.imageMapLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.imageMapLayer;
} else {
@@ -598,11 +598,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSClusteredLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.clusteredFeatureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.clusteredFeatureLayer;
} else {
@@ -611,11 +611,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
AGSHeatmapLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return L.esri !== undefined && L.esri.heatmapFeatureLayer !== undefined;
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.esri.heatmapFeatureLayer;
} else {
@@ -624,11 +624,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
YandexLayerPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.Yandex);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.Yandex;
} else {
@@ -637,11 +637,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
GeoJSONPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.TileLayer.GeoJSON);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.GeoJSON;
} else {
@@ -650,11 +650,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
UTFGridPlugin: {
- isLoaded: function() {
+ isLoaded: function () {
return angular.isDefined(L.UtfGrid);
},
- is: function(layer) {
+ is: function (layer) {
if (this.isLoaded()) {
return layer instanceof L.UtfGrid;
} else {
@@ -664,11 +664,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
CartoDB: {
- isLoaded: function() {
+ isLoaded: function () {
return cartodb;
},
- is: function(/*layer*/) {
+ is: function (/*layer*/) {
return true;
/*
if (this.isLoaded()) {
@@ -680,11 +680,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
Leaflet: {
DivIcon: {
- is: function(icon) {
+ is: function (icon) {
return icon instanceof L.DivIcon;
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
@@ -693,11 +693,11 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},
Icon: {
- is: function(icon) {
+ is: function (icon) {
return icon instanceof L.Icon;
},
- equal: function(iconA, iconB) {
+ equal: function (iconA, iconB) {
if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
diff --git a/src/services/leafletIterators.js b/src/services/leafletIterators.js
index cecab215..7ed87338 100644
--- a/src/services/leafletIterators.js
+++ b/src/services/leafletIterators.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').service('leafletIterators', function($log, leafletHelpers) {
+angular.module('leaflet-directive').service('leafletIterators', function ($log, leafletHelpers) {
var lHlp = leafletHelpers;
var errorHeader = leafletHelpers.errorHeader + 'leafletIterators: ';
@@ -13,18 +13,18 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
- var _isArrayLike = function(collection) {
+ var _isArrayLike = function (collection) {
var length = collection !== null && collection.length;
return lHlp.isNumber(length) && length >= 0 && length <= MAX_ARRAY_INDEX;
};
// Keep the identity function around for default iteratees.
- var _identity = function(value) {
+ var _identity = function (value) {
return value;
};
- var _property = function(key) {
- return function(obj) {
+ var _property = function (key) {
+ return function (obj) {
return obj === null ? void 0 : obj[key];
};
};
@@ -32,33 +32,33 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
// Internal function that returns an efficient (for current engines) version
// of the passed-in callback, to be repeatedly applied in other Underscore
// functions.
- var optimizeCb = function(func, context, argCount) {
+ var optimizeCb = function (func, context, argCount) {
if (context === void 0) return func;
switch (argCount === null ? 3 : argCount) {
- case 1: return function(value) {
+ case 1: return function (value) {
return func.call(context, value);
};
- case 2: return function(value, other) {
+ case 2: return function (value, other) {
return func.call(context, value, other);
};
- case 3: return function(value, index, collection) {
+ case 3: return function (value, index, collection) {
return func.call(context, value, index, collection);
};
- case 4: return function(accumulator, value, index, collection) {
+ case 4: return function (accumulator, value, index, collection) {
return func.call(context, accumulator, value, index, collection);
};
}
- return function() {
+ return function () {
return func.apply(context, arguments);
};
};
// An internal function for creating assigner functions.
- var createAssigner = function(keysFunc, undefinedOnly) {
- return function(obj) {
+ var createAssigner = function (keysFunc, undefinedOnly) {
+ return function (obj) {
var length = arguments.length;
if (length < 2 || obj === null) return obj;
for (var index = 1; index < length; index++) {
@@ -83,7 +83,7 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
_extendOwn = _assign = createAssigner(_keys);
// Returns whether an object has a given set of `key:value` pairs.
- var _isMatch = function(object, attrs) {
+ var _isMatch = function (object, attrs) {
var keys = _keys(attrs);
var length = keys.length;
if (object === null) return !length;
@@ -100,9 +100,9 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
// `key:value` pairs.
var _matcher;
var _matches = null;
- _matcher = _matches = function(attrs) {
+ _matcher = _matches = function (attrs) {
attrs = _extendOwn({}, attrs);
- return function(obj) {
+ return function (obj) {
return _isMatch(obj, attrs);
};
};
@@ -110,7 +110,7 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
// A mostly-internal function to generate callbacks that can be applied
// to each element in a collection, returning the desired result — either
// identity, an arbitrary callback, a property matcher, or a property accessor.
- var cb = function(value, context, argCount) {
+ var cb = function (value, context, argCount) {
if (value === null) return _identity;
if (_isFunction(value)) return optimizeCb(value, context, argCount);
if (_isObject(value)) return _matcher(value);
@@ -119,7 +119,7 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
var _every;
var _all = null;
- _every = _all = function(obj, predicate, context) {
+ _every = _all = function (obj, predicate, context) {
predicate = cb(predicate, context);
var keys = !_isArrayLike(obj) && _keys(obj);
var length = (keys || obj).length;
@@ -133,7 +133,7 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
//END COPY fron underscore
- var _hasErrors = function(collection, cb, ignoreCollection, cbName) {
+ var _hasErrors = function (collection, cb, ignoreCollection, cbName) {
if (!ignoreCollection) {
if (!lHlp.isDefined(collection) || !lHlp.isDefined(cb)) {
return true;
@@ -149,7 +149,7 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
return false;
};
- var _iterate = function(collection, externalCb, internalCb) {
+ var _iterate = function (collection, externalCb, internalCb) {
if (_hasErrors(undefined, internalCb, true, 'internalCb')) {
return;
}
@@ -165,8 +165,8 @@ angular.module('leaflet-directive').service('leafletIterators', function($log, l
//see http://jsperf.com/iterators/3
//utilizing for in is way faster
- var _each = function(collection, cb) {
- _iterate(collection, cb, function(val, key) {
+ var _each = function (collection, cb) {
+ _iterate(collection, cb, function (val, key) {
cb(val, key);
});
};
diff --git a/src/services/leafletLayerHelpers.js b/src/services/leafletLayerHelpers.js
index d2d5b319..36330efa 100644
--- a/src/services/leafletLayerHelpers.js
+++ b/src/services/leafletLayerHelpers.js
@@ -1,5 +1,5 @@
angular.module('leaflet-directive')
-.factory('leafletLayerHelpers', function($rootScope, $log, $q, leafletHelpers, leafletIterators) {
+.factory('leafletLayerHelpers', function ($rootScope, $log, $q, leafletHelpers, leafletIterators) {
var Helpers = leafletHelpers;
var isString = leafletHelpers.isString;
var isObject = leafletHelpers.isObject;
@@ -8,7 +8,7 @@ angular.module('leaflet-directive')
var errorHeader = leafletHelpers.errorHeader;
var $it = leafletIterators;
- var utfGridCreateLayer = function(params) {
+ var utfGridCreateLayer = function (params) {
if (!Helpers.UTFGridPlugin.isLoaded()) {
$log.error('[AngularJS - Leaflet] The UTFGrid plugin is not loaded.');
return;
@@ -16,19 +16,19 @@ angular.module('leaflet-directive')
var utfgrid = new L.UtfGrid(params.url, params.pluginOptions);
- utfgrid.on('mouseover', function(e) {
+ utfgrid.on('mouseover', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMouseover', e);
});
- utfgrid.on('mouseout', function(e) {
+ utfgrid.on('mouseout', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMouseout', e);
});
- utfgrid.on('click', function(e) {
+ utfgrid.on('click', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridClick', e);
});
- utfgrid.on('mousemove', function(e) {
+ utfgrid.on('mousemove', function (e) {
$rootScope.$broadcast('leafletDirectiveMap.utfgridMousemove', e);
});
@@ -38,13 +38,13 @@ angular.module('leaflet-directive')
var layerTypes = {
xyz: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer(params.url, params.options);
},
},
mapbox: {
mustHaveKey: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var version = 3;
if (isDefined(params.options.version) && params.options.version === 4) {
version = params.options.version;
@@ -58,7 +58,7 @@ angular.module('leaflet-directive')
},
geoJSON: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.GeoJSONPlugin.isLoaded()) {
return;
}
@@ -68,27 +68,27 @@ angular.module('leaflet-directive')
},
geoJSONShape: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.GeoJSON(params.data,
params.options);
},
},
geoJSONAwesomeMarker: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.geoJson(params.data, {
- pointToLayer: function(feature, latlng) {
- return L.marker(latlng, {icon: L.AwesomeMarkers.icon(params.icon)});
+ pointToLayer: function (feature, latlng) {
+ return L.marker(latlng, { icon: L.AwesomeMarkers.icon(params.icon) });
},
});
},
},
geoJSONVectorMarker: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
return new L.geoJson(params.data, {
- pointToLayer: function(feature, latlng) {
- return L.marker(latlng, {icon: L.VectorMarkers.icon(params.icon)});
+ pointToLayer: function (feature, latlng) {
+ return L.marker(latlng, { icon: L.VectorMarkers.icon(params.icon) });
},
});
},
@@ -99,7 +99,7 @@ angular.module('leaflet-directive')
},
cartodbTiles: {
mustHaveKey: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/{z}/{x}/{y}.png';
return L.tileLayer(url, params.options);
},
@@ -107,7 +107,7 @@ angular.module('leaflet-directive')
cartodbUTFGrid: {
mustHaveKey: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
params.url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/' + params.layer + '/{z}/{x}/{y}.grid.json';
return utfGridCreateLayer(params);
},
@@ -115,7 +115,7 @@ angular.module('leaflet-directive')
cartodbInteractive: {
mustHaveKey: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
var tilesURL = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/{z}/{x}/{y}.png';
var tileLayer = L.tileLayer(tilesURL, params.options);
params.url = '//' + params.user + '.cartodb.com/api/v1/map/' + params.key + '/' + params.layer + '/{z}/{x}/{y}.grid.json';
@@ -125,20 +125,20 @@ angular.module('leaflet-directive')
},
wms: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.wms(params.url, params.options);
},
},
wmts: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.wmts(params.url, params.options);
},
},
wfs: {
mustHaveUrl: true,
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.WFSLayerPlugin.isLoaded()) {
return;
}
@@ -154,13 +154,13 @@ angular.module('leaflet-directive')
},
group: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var lyrs = [];
- $it.each(params.options.layers, function(l) {
+ $it.each(params.options.layers, function (l) {
lyrs.push(createLayer(l));
});
- params.options.loadedDefer = function() {
+ params.options.loadedDefer = function () {
var defers = [];
if (isDefined(params.options.layers)) {
for (var i = 0; i < params.options.layers.length; i++) {
@@ -179,13 +179,13 @@ angular.module('leaflet-directive')
},
featureGroup: {
mustHaveUrl: false,
- createLayer: function() {
+ createLayer: function () {
return L.featureGroup();
},
},
google: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var type = params.type || 'SATELLITE';
if (!Helpers.GoogleLayerPlugin.isLoaded()) {
return;
@@ -196,7 +196,7 @@ angular.module('leaflet-directive')
},
here: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var provider = params.provider || 'HERE.terrainDay';
if (!Helpers.LeafletProviderPlugin.isLoaded()) {
return;
@@ -207,7 +207,7 @@ angular.module('leaflet-directive')
},
china:{
mustHaveUrl:false,
- createLayer:function(params) {
+ createLayer:function (params) {
var type = params.type || '';
if (!Helpers.ChinaLayerPlugin.isLoaded()) {
return;
@@ -218,7 +218,7 @@ angular.module('leaflet-directive')
},
agsBase: {
mustHaveLayer: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSBaseLayerPlugin.isLoaded()) {
return;
}
@@ -228,7 +228,7 @@ angular.module('leaflet-directive')
},
ags: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSLayerPlugin.isLoaded()) {
return;
}
@@ -238,11 +238,11 @@ angular.module('leaflet-directive')
url: params.url,
});
var layer = new lvector.AGS(options);
- layer.onAdd = function(map) {
+ layer.onAdd = function (map) {
this.setMap(map);
};
- layer.onRemove = function() {
+ layer.onRemove = function () {
this.setMap(null);
};
@@ -251,7 +251,7 @@ angular.module('leaflet-directive')
},
agsFeature: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSFeatureLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -260,13 +260,13 @@ angular.module('leaflet-directive')
params.options.url = params.url;
var layer = L.esri.featureLayer(params.options);
- var load = function() {
+ var load = function () {
if (isDefined(params.options.loadedDefer)) {
params.options.loadedDefer.resolve();
}
};
- layer.on('loading', function() {
+ layer.on('loading', function () {
params.options.loadedDefer = $q.defer();
layer.off('load', load);
layer.on('load', load);
@@ -277,7 +277,7 @@ angular.module('leaflet-directive')
},
agsTiled: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSTiledMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -290,7 +290,7 @@ angular.module('leaflet-directive')
},
agsDynamic: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSDynamicMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -303,7 +303,7 @@ angular.module('leaflet-directive')
},
agsImage: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSImageMapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri plugin is not loaded.');
return;
@@ -316,7 +316,7 @@ angular.module('leaflet-directive')
},
agsClustered: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSClusteredLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri clustered layer plugin is not loaded.');
return;
@@ -332,7 +332,7 @@ angular.module('leaflet-directive')
},
agsHeatmap: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.AGSHeatmapLayerPlugin.isLoaded()) {
$log.warn(errorHeader + ' The esri heatmap layer plugin is not loaded.');
return;
@@ -348,7 +348,7 @@ angular.module('leaflet-directive')
},
markercluster: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.MarkerClusterPlugin.isLoaded()) {
$log.warn(errorHeader + ' The markercluster plugin is not loaded.');
return;
@@ -359,7 +359,7 @@ angular.module('leaflet-directive')
},
bing: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.BingLayerPlugin.isLoaded()) {
return;
}
@@ -370,7 +370,7 @@ angular.module('leaflet-directive')
webGLHeatmap: {
mustHaveUrl: false,
mustHaveData: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.WebGLHeatMapLayerPlugin.isLoaded()) {
return;
}
@@ -386,7 +386,7 @@ angular.module('leaflet-directive')
heat: {
mustHaveUrl: false,
mustHaveData: true,
- createLayer: function(params) {
+ createLayer: function (params) {
if (!Helpers.HeatLayerPlugin.isLoaded()) {
return;
}
@@ -406,7 +406,7 @@ angular.module('leaflet-directive')
},
yandex: {
mustHaveUrl: false,
- createLayer: function(params) {
+ createLayer: function (params) {
var type = params.type || 'map';
if (!Helpers.YandexLayerPlugin.isLoaded()) {
return;
@@ -418,13 +418,13 @@ angular.module('leaflet-directive')
imageOverlay: {
mustHaveUrl: true,
mustHaveBounds: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.imageOverlay(params.url, params.bounds, params.options);
},
},
iip: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return L.tileLayer.iip(params.url, params.options);
},
},
@@ -434,7 +434,7 @@ angular.module('leaflet-directive')
// so we let user to define their own layer outside the directive,
// and pass it on "createLayer" result for next processes
custom: {
- createLayer: function(params) {
+ createLayer: function (params) {
if (params.layer instanceof L.Class) {
return angular.copy(params.layer);
} else {
@@ -444,7 +444,7 @@ angular.module('leaflet-directive')
},
cartodb: {
mustHaveUrl: true,
- createLayer: function(params) {
+ createLayer: function (params) {
return cartodb.createLayer(params.map, params.url);
},
},
@@ -457,35 +457,39 @@ angular.module('leaflet-directive')
return false;
}
- if (Object.keys(layerTypes).indexOf(layerDefinition.type) === -1) {
- $log.error('[AngularJS - Leaflet] A layer must have a valid type: ' + Object.keys(layerTypes));
- return false;
- }
+ // One of the known types
+ if (Object.keys(layerTypes).indexOf(layerDefinition.type) !== -1) {
- // Check if the layer must have an URL
- if (layerTypes[layerDefinition.type].mustHaveUrl && !isString(layerDefinition.url)) {
- $log.error('[AngularJS - Leaflet] A base layer must have an url');
- return false;
- }
+ // Check if the layer must have an URL
+ if (layerTypes[layerDefinition.type].mustHaveUrl && !isString(layerDefinition.url)) {
+ $log.error('[AngularJS - Leaflet] A base layer must have an url');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveData && !isDefined(layerDefinition.data)) {
- $log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveData && !isDefined(layerDefinition.data)) {
+ $log.error('[AngularJS - Leaflet] The base layer must have a "data" array attribute');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveLayer && !isDefined(layerDefinition.layer)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have an layer defined');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveLayer && !isDefined(layerDefinition.layer)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have an layer defined');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveBounds && !isDefined(layerDefinition.bounds)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have bounds defined');
- return false;
- }
+ if (layerTypes[layerDefinition.type].mustHaveBounds && !isDefined(layerDefinition.bounds)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have bounds defined');
+ return false;
+ }
- if (layerTypes[layerDefinition.type].mustHaveKey && !isDefined(layerDefinition.key)) {
- $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have key defined');
- return false;
+ if (layerTypes[layerDefinition.type].mustHaveKey && !isDefined(layerDefinition.key)) {
+ $log.error('[AngularJS - Leaflet] The type of layer ' + layerDefinition.type + ' must have key defined');
+ return false;
+ }
+ } else {
+ // Type unknown at build time
+ if (typeof L.tileLayer[layerDefinition.type] !== 'function') {
+ return false;
+ }
}
return true;
@@ -530,7 +534,8 @@ angular.module('leaflet-directive')
};
//TODO Add $watch to the layer properties
- return layerTypes[layerDefinition.type].createLayer(params);
+ if (layerTypes[layerDefinition.type]) return layerTypes[layerDefinition.type].createLayer(params);
+ return L.tileLayer[layerDefinition.type](params.url, params.options);
}
function safeAddLayer(map, layer) {
@@ -548,7 +553,7 @@ angular.module('leaflet-directive')
$log.debug('Loaded Deferred', defers);
var count = defers.length;
if (count > 0) {
- var resolve = function() {
+ var resolve = function () {
count--;
if (count === 0) {
map.removeLayer(layer);
@@ -562,7 +567,7 @@ angular.module('leaflet-directive')
map.removeLayer(layer);
}
} else {
- layerOptions.loadedDefer.promise.then(function() {
+ layerOptions.loadedDefer.promise.then(function () {
map.removeLayer(layer);
});
}
diff --git a/src/services/leafletLegendHelpers.js b/src/services/leafletLegendHelpers.js
index 01e25fe2..d4866db6 100644
--- a/src/services/leafletLegendHelpers.js
+++ b/src/services/leafletLegendHelpers.js
@@ -1,5 +1,5 @@
-angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
- var _updateLegend = function(div, legendData, type, url) {
+angular.module('leaflet-directive').factory('leafletLegendHelpers', function () {
+ var _updateLegend = function (div, legendData, type, url) {
div.innerHTML = '';
if (legendData.error) {
div.innerHTML += '' + legendData.error.message + '
';
@@ -21,8 +21,8 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
}
};
- var _getOnAddLegend = function(legendData, legendClass, type, url) {
- return function(/*map*/) {
+ var _getOnAddLegend = function (legendData, legendClass, type, url) {
+ return function (/*map*/) {
var div = L.DomUtil.create('div', legendClass);
if (!L.Browser.touch) {
@@ -37,8 +37,8 @@ angular.module('leaflet-directive').factory('leafletLegendHelpers', function() {
};
};
- var _getOnAddArrayLegend = function(legend, legendClass) {
- return function(/*map*/) {
+ var _getOnAddArrayLegend = function (legend, legendClass) {
+ return function (/*map*/) {
var div = L.DomUtil.create('div', legendClass);
for (var i = 0; i < legend.colors.length; i++) {
div.innerHTML +=
diff --git a/src/services/leafletMapDefaults.js b/src/services/leafletMapDefaults.js
index d2319632..bfc08ca8 100644
--- a/src/services/leafletMapDefaults.js
+++ b/src/services/leafletMapDefaults.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').factory('leafletMapDefaults', function($q, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletMapDefaults', function ($q, leafletHelpers) {
function _getDefaults() {
return {
keyboard: true,
@@ -47,16 +47,16 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', function($q, l
// Get the _defaults dictionary, and override the properties defined by the user
return {
- reset: function() {
+ reset: function () {
defaults = {};
},
- getDefaults: function(scopeId) {
+ getDefaults: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
return defaults[mapId];
},
- getMapCreationDefaults: function(scopeId) {
+ getMapCreationDefaults: function (scopeId) {
var mapId = obtainEffectiveMapId(defaults, scopeId);
var d = defaults[mapId];
@@ -99,7 +99,7 @@ angular.module('leaflet-directive').factory('leafletMapDefaults', function($q, l
return mapDefaults;
},
- setDefaults: function(userDefaults, scopeId) {
+ setDefaults: function (userDefaults, scopeId) {
var newDefaults = _getDefaults();
if (isDefined(userDefaults)) {
diff --git a/src/services/leafletMarkersHelpers.js b/src/services/leafletMarkersHelpers.js
index 3c2c3498..4a2850c8 100644
--- a/src/services/leafletMarkersHelpers.js
+++ b/src/services/leafletMarkersHelpers.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').service('leafletMarkersHelpers', function($rootScope, $timeout, leafletHelpers, $log, $compile, leafletGeoJsonHelpers) {
+angular.module('leaflet-directive').service('leafletMarkersHelpers', function ($rootScope, $timeout, leafletHelpers, $log, $compile, leafletGeoJsonHelpers) {
var isDefined = leafletHelpers.isDefined;
var defaultTo = leafletHelpers.defaultTo;
var MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin;
@@ -16,22 +16,22 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
var geoHlp = leafletGeoJsonHelpers;
var errorHeader = leafletHelpers.errorHeader;
- var _string = function(marker) {
+ var _string = function (marker) {
//this exists since JSON.stringify barfs on cyclic
var retStr = '';
- ['_icon', '_latlng', '_leaflet_id', '_map', '_shadow'].forEach(function(prop) {
+ ['_icon', '_latlng', '_leaflet_id', '_map', '_shadow'].forEach(function (prop) {
retStr += prop + ': ' + defaultTo(marker[prop], 'undefined') + ' \n';
});
return '[leafletMarker] : \n' + retStr;
};
- var _log = function(marker, useConsole) {
+ var _log = function (marker, useConsole) {
var logger = useConsole ? console : $log;
logger.debug(_string(marker));
};
- var createLeafletIcon = function(iconData) {
+ var createLeafletIcon = function (iconData) {
if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'awesomeMarker') {
if (!AwesomeMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The AwesomeMarkers Plugin is not loaded.');
@@ -85,6 +85,10 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
return iconData.icon;
}
+ if (isDefined(iconData) && isDefined(iconData.type)) {
+ return new L.Icon[iconData.type](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=';
@@ -102,17 +106,17 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
return new L.Icon(iconData);
};
- var _resetMarkerGroup = function(groupName) {
+ var _resetMarkerGroup = function (groupName) {
if (isDefined(groups[groupName])) {
groups.splice(groupName, 1);
}
};
- var _resetMarkerGroups = function() {
+ var _resetMarkerGroups = function () {
groups = {};
};
- var _deleteMarker = function(marker, map, layers) {
+ var _deleteMarker = function (marker, map, layers) {
marker.closePopup();
// There is no easy way to know if a marker is added to a layer, so we search for it
@@ -141,7 +145,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
}
};
- var adjustPopupPan = function(marker, map) {
+ var adjustPopupPan = function (marker, map) {
var containerHeight = marker._popup._container.offsetHeight;
var layerPos = new L.Point(marker._popup._containerLeft, -containerHeight - marker._popup._containerBottom);
var containerPos = map.layerPointToContainerPoint(layerPos);
@@ -150,18 +154,18 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
}
};
- var compilePopup = function(marker, markerScope) {
+ var compilePopup = function (marker, markerScope) {
$compile(marker._popup._contentNode)(markerScope);
};
- var updatePopup = function(marker, markerScope, map) {
+ var updatePopup = function (marker, markerScope, map) {
//The innerText should be more than 1 once angular has compiled.
//We need to keep trying until angular has compiled before we _updateLayout and _updatePosition
//This should take care of any scenario , eg ngincludes, whatever.
//Is there a better way to check for this?
var innerText = marker._popup._contentNode.innerText || marker._popup._contentNode.textContent;
if (innerText.length < 1) {
- $timeout(function() {
+ $timeout(function () {
updatePopup(marker, markerScope, map);
});
}
@@ -180,7 +184,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
return reflow;
};
- var _manageOpenPopup = function(marker, markerData, map) {
+ var _manageOpenPopup = function (marker, markerData, map) {
// The marker may provide a scope returning function used to compile the message
// default to $rootScope otherwise
var markerScope = angular.isFunction(markerData.getMessageScope) ? markerData.getMessageScope() : $rootScope;
@@ -197,7 +201,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
}
};
- var _manageOpenLabel = function(marker, markerData) {
+ var _manageOpenLabel = function (marker, markerData) {
var markerScope = angular.isFunction(markerData.getMessageScope) ? markerData.getMessageScope() : $rootScope;
var labelScope = angular.isFunction(markerData.getLabelScope) ? markerData.getLabelScope() : markerScope;
var compileMessage = isDefined(markerData.compileMessage) ? markerData.compileMessage : true;
@@ -213,7 +217,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
}
};
- var _updateMarker = function(markerData, oldMarkerData, marker, name, leafletScope, layers, map) {
+ var _updateMarker = function (markerData, oldMarkerData, marker, name, leafletScope, layers, map) {
if (!isDefined(oldMarkerData)) {
return;
}
@@ -451,7 +455,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
manageOpenLabel: _manageOpenLabel,
- createMarker: function(markerData) {
+ createMarker: function (markerData) {
if (!isDefined(markerData) || !geoHlp.validateCoords(markerData)) {
$log.error(errorHeader + 'The marker definition is not valid.');
return;
@@ -490,7 +494,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
return marker;
},
- addMarkerToGroup: function(marker, groupName, groupOptions, map) {
+ addMarkerToGroup: function (marker, groupName, groupOptions, map) {
if (!isString(groupName)) {
$log.error(errorHeader + 'The marker group you have specified is invalid.');
return;
@@ -509,9 +513,9 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
groups[groupName].addLayer(marker);
},
- listenMarkerEvents: function(marker, markerData, leafletScope, doWatch, map) {
- marker.on('popupopen', function(/* event */) {
- safeApply(leafletScope, function() {
+ listenMarkerEvents: function (marker, markerData, leafletScope, doWatch, map) {
+ marker.on('popupopen', function (/* event */) {
+ safeApply(leafletScope, function () {
if (isDefined(marker._popup) || isDefined(marker._popup._contentNode)) {
markerData.focus = true;
_manageOpenPopup(marker, markerData, map);//needed since markerData is now a copy
@@ -519,14 +523,14 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
});
});
- marker.on('popupclose', function(/* event */) {
- safeApply(leafletScope, function() {
+ marker.on('popupclose', function (/* event */) {
+ safeApply(leafletScope, function () {
markerData.focus = false;
});
});
- marker.on('add', function(/* event */) {
- safeApply(leafletScope, function() {
+ marker.on('add', function (/* event */) {
+ safeApply(leafletScope, function () {
if ('label' in markerData)
_manageOpenLabel(marker, markerData);
});
@@ -535,11 +539,11 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
updateMarker: _updateMarker,
- addMarkerWatcher: function(marker, name, leafletScope, layers, map, isDeepWatch) {
+ addMarkerWatcher: function (marker, name, leafletScope, layers, map, isDeepWatch) {
var markerWatchPath = Helpers.getObjectArrayPath('markers.' + name);
isDeepWatch = defaultTo(isDeepWatch, true);
- var clearWatch = leafletScope.$watch(markerWatchPath, function(markerData, oldMarkerData) {
+ var clearWatch = leafletScope.$watch(markerWatchPath, function (markerData, oldMarkerData) {
if (!isDefined(markerData)) {
_deleteMarker(marker, map, layers);
clearWatch();
diff --git a/src/services/leafletPathsHelpers.js b/src/services/leafletPathsHelpers.js
index e763433c..aa1fc864 100644
--- a/src/services/leafletPathsHelpers.js
+++ b/src/services/leafletPathsHelpers.js
@@ -1,4 +1,4 @@
-angular.module('leaflet-directive').factory('leafletPathsHelpers', function($rootScope, $log, leafletHelpers) {
+angular.module('leaflet-directive').factory('leafletPathsHelpers', function ($rootScope, $log, leafletHelpers) {
var isDefined = leafletHelpers.isDefined;
var isArray = leafletHelpers.isArray;
var isNumber = leafletHelpers.isNumber;
@@ -16,9 +16,9 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
'smoothFactor', 'noClip',
];
function _convertToLeafletLatLngs(latlngs) {
- return latlngs.filter(function(latlng) {
+ return latlngs.filter(function (latlng) {
return isValidPoint(latlng);
- }).map(function(latlng) {
+ }).map(function (latlng) {
return _convertToLeafletLatLng(latlng);
});
}
@@ -32,7 +32,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
}
function _convertToLeafletMultiLatLngs(paths) {
- return paths.map(function(latlngs) {
+ return paths.map(function (latlngs) {
return _convertToLeafletLatLngs(latlngs);
});
}
@@ -52,7 +52,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
return options;
}
- var _updatePathOptions = function(path, data) {
+ var _updatePathOptions = function (path, data) {
var updatedStyle = {};
for (var i = 0; i < availableOptions.length; i++) {
var optionName = availableOptions[i];
@@ -64,7 +64,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
path.setStyle(data);
};
- var _isValidPolyline = function(latlngs) {
+ var _isValidPolyline = function (latlngs) {
if (!isArray(latlngs)) {
return false;
}
@@ -81,23 +81,23 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
var pathTypes = {
polyline: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
return _isValidPolyline(latlngs);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Polyline([], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
multiPolyline: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs)) {
return false;
@@ -113,34 +113,34 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.multiPolyline([[[0, 0], [1, 1]]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletMultiLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
polygon: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
return _isValidPolyline(latlngs);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Polygon([], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
multiPolygon: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs)) {
@@ -157,18 +157,18 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.MultiPolygon([[[0, 0], [1, 1], [0, 1]]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLngs(_convertToLeafletMultiLatLngs(data.latlngs));
_updatePathOptions(path, data);
return;
},
},
rectangle: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var latlngs = pathData.latlngs;
if (!isArray(latlngs) || latlngs.length !== 2) {
@@ -185,26 +185,26 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
return true;
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Rectangle([[0, 0], [1, 1]], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setBounds(new L.LatLngBounds(_convertToLeafletLatLngs(data.latlngs)));
_updatePathOptions(path, data);
},
},
circle: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var point = pathData.latlngs;
return isValidPoint(point) && isNumber(pathData.radius);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.Circle([0, 0], 1, options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLng(_convertToLeafletLatLng(data.latlngs));
if (isDefined(data.radius)) {
path.setRadius(data.radius);
@@ -214,16 +214,16 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
},
},
circleMarker: {
- isValid: function(pathData) {
+ isValid: function (pathData) {
var point = pathData.latlngs;
return isValidPoint(point) && isNumber(pathData.radius);
},
- createPath: function(options) {
+ createPath: function (options) {
return new L.CircleMarker([0, 0], options);
},
- setPath: function(path, data) {
+ setPath: function (path, data) {
path.setLatLng(_convertToLeafletLatLng(data.latlngs));
if (isDefined(data.radius)) {
path.setRadius(data.radius);
@@ -234,7 +234,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
},
};
- var _getPathData = function(path) {
+ var _getPathData = function (path) {
var pathData = {};
if (path.latlngs) {
pathData.latlngs = path.latlngs;
@@ -248,7 +248,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
};
return {
- setPathOptions: function(leafletPath, pathType, data) {
+ setPathOptions: function (leafletPath, pathType, data) {
if (!isDefined(pathType)) {
pathType = 'polyline';
}
@@ -256,7 +256,7 @@ angular.module('leaflet-directive').factory('leafletPathsHelpers', function($roo
pathTypes[pathType].setPath(leafletPath, data);
},
- createPath: function(name, path, defaults) {
+ createPath: function (name, path, defaults) {
if (!isDefined(path.type)) {
path.type = 'polyline';
}
diff --git a/src/services/leafletWatchHelpers.js b/src/services/leafletWatchHelpers.js
index b7fe4b84..0d57d177 100644
--- a/src/services/leafletWatchHelpers.js
+++ b/src/services/leafletWatchHelpers.js
@@ -1,9 +1,9 @@
angular.module('leaflet-directive')
-.service('leafletWatchHelpers', function() {
+.service('leafletWatchHelpers', function () {
- var _maybe = function(scope, watchFunctionName, thingToWatchStr, watchOptions, initCb) {
+ var _maybe = function (scope, watchFunctionName, thingToWatchStr, watchOptions, initCb) {
//watchOptions.isDeep is/should be ignored in $watchCollection
- var unWatch = scope[watchFunctionName](thingToWatchStr, function(newValue, oldValue) {
+ var unWatch = scope[watchFunctionName](thingToWatchStr, function (newValue, oldValue) {
initCb(newValue, oldValue);
if (!watchOptions.doWatch)
unWatch();
@@ -19,7 +19,7 @@ angular.module('leaflet-directive')
@param watchOptions - see markersWatchOptions and or derrivatives. This object is used
to set watching to once and its watch depth.
*/
- var _maybeWatch = function(scope, thingToWatchStr, watchOptions, initCb) {
+ var _maybeWatch = function (scope, thingToWatchStr, watchOptions, initCb) {
return _maybe(scope, '$watch', thingToWatchStr, watchOptions, initCb);
};
@@ -30,7 +30,7 @@ angular.module('leaflet-directive')
@param watchOptions - see markersWatchOptions and or derrivatives. This object is used
to set watching to once and its watch depth.
*/
- var _maybeWatchCollection = function(scope, thingToWatchStr, watchOptions, initCb) {
+ var _maybeWatchCollection = function (scope, thingToWatchStr, watchOptions, initCb) {
return _maybe(scope, '$watchCollection', thingToWatchStr, watchOptions, initCb);
};
diff --git a/src/services/nominatim.js b/src/services/nominatim.js
index 5dc1476b..c494add7 100644
--- a/src/services/nominatim.js
+++ b/src/services/nominatim.js
@@ -1,13 +1,13 @@
-angular.module('leaflet-directive').factory('nominatimService', function($q, $http, leafletHelpers, leafletMapDefaults) {
+angular.module('leaflet-directive').factory('nominatimService', function ($q, $http, leafletHelpers, leafletMapDefaults) {
var isDefined = leafletHelpers.isDefined;
return {
- query: function(address, mapId) {
+ query: function (address, mapId) {
var defaults = leafletMapDefaults.getDefaults(mapId);
var url = defaults.nominatim.server;
var df = $q.defer();
- $http.get(url, { params: { format: 'json', limit: 1, q: address } }).success(function(data) {
+ $http.get(url, { params: { format: 'json', limit: 1, q: address } }).success(function (data) {
if (data.length > 0 && isDefined(data[0].boundingbox)) {
df.resolve(data[0]);
} else {
diff --git a/test/e2e/0100-basic-first-example.js b/test/e2e/0100-basic-first-example.js
index 4221ec55..a428ee4d 100644
--- a/test/e2e/0100-basic-first-example.js
+++ b/test/e2e/0100-basic-first-example.js
@@ -1,16 +1,16 @@
'use strict';
-describe('Loading 0100-basic-first-example.html', function() {
+describe('Loading 0100-basic-first-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0100-basic-first-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
}, 30000);
- it('should load the Leaflet map inside the directive tag', function() {
- element(by.className('angular-leaflet-map')).getText().then(function(text) {
+ it('should load the Leaflet map inside the directive tag', function () {
+ element(by.className('angular-leaflet-map')).getText().then(function (text) {
expect(text).toBe('+\n-\nLeaflet | © OpenStreetMap contributors');
});
});
diff --git a/test/e2e/0101-basic-center-example.js b/test/e2e/0101-basic-center-example.js
index 75316273..1b611418 100644
--- a/test/e2e/0101-basic-center-example.js
+++ b/test/e2e/0101-basic-center-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0101-basic-center-example.html', function() {
+describe('Loading 0101-basic-center-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0101-basic-center-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
}, 30000);
- it('should update the zoom value in the input if clicked the zoom control', function() {
+ it('should update the zoom value in the input if clicked the zoom control', function () {
element(by.className('leaflet-control-zoom-in')).click();
// Wait for zoom animation
@@ -17,13 +17,13 @@ describe('Loading 0101-basic-center-example.html', function() {
expect(element(by.model('london.zoom')).getAttribute('value')).toBe('5');
});
- xit('should update the center value if the map is dragged', function() {
+ xit('should update the center value if the map is dragged', function () {
expect(element(by.model('london.lat')).getAttribute('value')).toBe('51.505');
expect(element(by.model('london.lng')).getAttribute('value')).toBe('-0.09');
var el = element(by.xpath('.//img[contains(@class, "leaflet-tile-loaded")][1]'));
var el2 = element(by.xpath('.//img[contains(@class, "leaflet-tile-loaded")][2]'));
browser.actions()
- .mouseMove(el, {x: 5, y: 5})
+ .mouseMove(el, { x: 5, y: 5 })
.mouseDown()
.mouseMove(el2)
.mouseUp()
diff --git a/test/e2e/0103-basic-center-url-hash-example.js b/test/e2e/0103-basic-center-url-hash-example.js
index 9d927378..bb6d8916 100644
--- a/test/e2e/0103-basic-center-url-hash-example.js
+++ b/test/e2e/0103-basic-center-url-hash-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0103-basic-center-url-hash-example.html', function() {
+describe('Loading 0103-basic-center-url-hash-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0103-basic-center-url-hash-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
}, 30000);
- it('should update the url if the center value is changed from the form', function() {
+ it('should update the url if the center value is changed from the form', function () {
element(by.xpath('//ul/li[1]/input[1]')).clear();
element(by.xpath('//ul/li[1]/input[1]')).sendKeys('9');
browser.driver.sleep(500);
@@ -24,13 +24,13 @@ describe('Loading 0103-basic-center-url-hash-example.html', function() {
expect(browser.driver.getCurrentUrl()).toMatch(/c=9.0153:6.9873:4$/);
});
- it('should update the url if the zoom is changed from the map', function() {
+ it('should update the url if the zoom is changed from the map', function () {
element(by.xpath('.//*[@title="Zoom out"]')).click();
browser.driver.sleep(500);
expect(browser.getCurrentUrl()).toMatch(/51.5050:-0.0900:3/);
});
- it('should update the map center model if the url changes', function() {
+ it('should update the map center model if the url changes', function () {
element(by.xpath('//ul/li[1]/a[1]')).click();
expect(element(by.xpath('//ul/li[1]/input[1]')).getAttribute('value')).toBe('36.8899');
expect(element(by.xpath('//ul/li[2]/input[1]')).getAttribute('value')).toBe('-121.8008');
diff --git a/test/e2e/0104-basic-custom-parameters-example.js b/test/e2e/0104-basic-custom-parameters-example.js
index c09ca39f..f267913f 100644
--- a/test/e2e/0104-basic-custom-parameters-example.js
+++ b/test/e2e/0104-basic-custom-parameters-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0104-basic-custom-parameters-example.html', function() {
+describe('Loading 0104-basic-custom-parameters-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0104-basic-custom-parameters-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should have loaded the opencyclemaps tiles', function() {
+ it('should have loaded the opencyclemaps tiles', function () {
expect(element(by.css('img.leaflet-tile-loaded')).getAttribute('src')).toContain('tile.opencyclemap.org');
});
});
diff --git a/test/e2e/0105-basic-bounds-example.js b/test/e2e/0105-basic-bounds-example.js
index 40de08ee..90cb87b6 100644
--- a/test/e2e/0105-basic-bounds-example.js
+++ b/test/e2e/0105-basic-bounds-example.js
@@ -1,21 +1,21 @@
'use strict';
-describe('Loading 0105-basic-bounds-example.html', function() {
+describe('Loading 0105-basic-bounds-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0105-basic-bounds-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should update the bounds values in the input if clicked the zoom control', function() {
+ it('should update the bounds values in the input if clicked the zoom control', function () {
expect(element(by.model('bounds.southWest.lat')).getAttribute('value')).toBe('51.507941142609155');
expect(element(by.model('bounds.southWest.lng')).getAttribute('value')).toBe('-0.09059429168701172');
expect(element(by.model('bounds.northEast.lat')).getAttribute('value')).toBe('51.50954376090435');
expect(element(by.model('bounds.northEast.lng')).getAttribute('value')).toBe('-0.0851815938949585');
- element(by.xpath('.//*[@title="Zoom out"]')).click().then(function() {
+ element(by.xpath('.//*[@title="Zoom out"]')).click().then(function () {
browser.driver.sleep(400);
expect(element(by.model('bounds.southWest.lat')).getAttribute('value')).toBe('51.50713981232172');
expect(element(by.model('bounds.southWest.lng')).getAttribute('value')).toBe('-0.09329795837402344');
diff --git a/test/e2e/0106-basic-maxbounds-example.js b/test/e2e/0106-basic-maxbounds-example.js
index fd5218d1..1fb29e08 100644
--- a/test/e2e/0106-basic-maxbounds-example.js
+++ b/test/e2e/0106-basic-maxbounds-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0106-basic-maxbounds-example.html', function() {
+describe('Loading 0106-basic-maxbounds-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0106-basic-maxbounds-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should update the maxbounds values if clicked the buttons', function() {
+ it('should update the maxbounds values if clicked the buttons', function () {
element(by.xpath('.//button[text()="London region"]')).click();
expect(element(by.css('p.result')).getText()).toBe('Maxbounds: NE(lat: 51.51280224425956, lng: -0.11681556701660155) SW(lat: 51.50211782162702, lng: -0.14428138732910156)');
diff --git a/test/e2e/0107-basic-tiles-example.js b/test/e2e/0107-basic-tiles-example.js
index 94cbb0b9..3c66f2ad 100644
--- a/test/e2e/0107-basic-tiles-example.js
+++ b/test/e2e/0107-basic-tiles-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0107-basic-tiles-example.html', function() {
+describe('Loading 0107-basic-tiles-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0107-basic-tiles-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should update the map tiles if clicked on the tiles changer buttons', function() {
+ it('should update the map tiles if clicked on the tiles changer buttons', function () {
expect(element(by.xpath('//img[contains(@src, "http://api.tiles.mapbox.com/v4/bufanuvols.lia35jfp/")]')).isPresent()).toBe(true);
element(by.xpath('//button[text()="OpenStreetMaps"]')).click();
diff --git a/test/e2e/0108-basic-tiles-zoom-changer-example.js b/test/e2e/0108-basic-tiles-zoom-changer-example.js
index 5e84674b..588536db 100644
--- a/test/e2e/0108-basic-tiles-zoom-changer-example.js
+++ b/test/e2e/0108-basic-tiles-zoom-changer-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0108-basic-tiles-zoom-changer-example.html', function() {
+describe('Loading 0108-basic-tiles-zoom-changer-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0108-basic-tiles-zoom-changer-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should update the map tiles if zoom in the map', function() {
+ it('should update the map tiles if zoom in the map', function () {
expect(element(by.xpath('//img[contains(@src, "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/")]')).isPresent()).toBe(true);
var zoomin = element(by.xpath('.//*[@title="Zoom in"]'));
@@ -18,7 +18,7 @@ describe('Loading 0108-basic-tiles-zoom-changer-example.html', function() {
zoomin.click();
browser.driver.sleep(300);
zoomin.click();
- browser.wait(function() {
+ browser.wait(function () {
return element(by.xpath('//img[contains(@src, "http://a.tile.openstreetmap.org/")]')).isPresent();
}, 5000);
diff --git a/test/e2e/0201-layers-simple-example.js b/test/e2e/0201-layers-simple-example.js
index 71aa8cca..f2980ede 100644
--- a/test/e2e/0201-layers-simple-example.js
+++ b/test/e2e/0201-layers-simple-example.js
@@ -1,22 +1,22 @@
'use strict';
-describe('Loading 0201-layers-simple-example.html', function() {
+describe('Loading 0201-layers-simple-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0201-layers-simple-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should change the layer tiles if clicked on the leaflet control switch layer', function() {
+ it('should change the layer tiles if clicked on the leaflet control switch layer', function () {
expect(element(by.xpath('//img[contains(@src, "http://api.tiles.mapbox.com/v4/bufanuvols.lia22g09/")]')).isPresent()).toBe(true);
browser.actions().mouseMove(element(by.xpath('//a[contains(@class, "leaflet-control-layers-toggle")][1]'))).perform();
- browser.findElements(by.css('input.leaflet-control-layers-selector')).then(function(inputs) {
+ browser.findElements(by.css('input.leaflet-control-layers-selector')).then(function (inputs) {
var input = inputs[1];
- input.click().then(function() {
- browser.wait(function() {
+ input.click().then(function () {
+ browser.wait(function () {
return element(by.xpath('//img[contains(@src, "http://b.tile.openstreetmap.org")]')).isPresent();
}, 5000);
diff --git a/test/e2e/0202-layers-overlays-simple-example.js b/test/e2e/0202-layers-overlays-simple-example.js
index f4baed08..6234eec3 100644
--- a/test/e2e/0202-layers-overlays-simple-example.js
+++ b/test/e2e/0202-layers-overlays-simple-example.js
@@ -1,19 +1,19 @@
'use strict';
-describe('Loading 0202-layers-overlays-simple-example.html', function() {
+describe('Loading 0202-layers-overlays-simple-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0202-layers-overlays-simple-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should change the layer tiles if clicked on the leaflet control switch layer', function() {
+ it('should change the layer tiles if clicked on the leaflet control switch layer', function () {
expect(element(by.xpath('//img[contains(@src, "http://c.tile.openstreetmap.org/")]')).isPresent()).toBe(true);
browser.actions().mouseMove(element(by.xpath('//a[contains(@class, "leaflet-control-layers-toggle")][1]'))).perform();
- browser.wait(function() {
+ browser.wait(function () {
return element(by.xpath('//img[contains(@src, "http://suite.opengeo.org/geoserver/usa/wms")]')).isPresent();
}, 5000);
diff --git a/test/e2e/0203-layers-imageoverlay-example.js b/test/e2e/0203-layers-imageoverlay-example.js
index 9e452893..e2df0c30 100644
--- a/test/e2e/0203-layers-imageoverlay-example.js
+++ b/test/e2e/0203-layers-imageoverlay-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0203-layers-imageoverlay-example.html', function() {
+describe('Loading 0203-layers-imageoverlay-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0203-layers-imageoverlay-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.xpath('//img[contains(@src, "andes.jpg")]')).isPresent();
}, 5000);
});
- it('should load the static image of the andes on the map', function() {
+ it('should load the static image of the andes on the map', function () {
expect(element(by.xpath('//img[contains(@src, "andes.jpg")]')).isPresent()).toBe(true);
});
});
diff --git a/test/e2e/0205-layers-googlemaps-example.js b/test/e2e/0205-layers-googlemaps-example.js
index 9654335d..721b7bc9 100644
--- a/test/e2e/0205-layers-googlemaps-example.js
+++ b/test/e2e/0205-layers-googlemaps-example.js
@@ -1,22 +1,22 @@
'use strict';
-describe('Loading 0205-layers-googlemaps-example.html', function() {
+describe('Loading 0205-layers-googlemaps-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0205-layers-googlemaps-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.xpath('//img[contains(@src, "http://mt1.googleapis.com")]')).isPresent();
}, 5000);
});
- it('should change the Google Maps tiles if clicked on the leaflet control switch layer', function() {
+ it('should change the Google Maps tiles if clicked on the leaflet control switch layer', function () {
expect(element(by.xpath('//img[contains(@src, "http://mt1.googleapis.com")]')).isPresent()).toBe(true);
browser.actions().mouseMove(element(by.xpath('//a[contains(@class, "leaflet-control-layers-toggle")][1]'))).perform();
- browser.driver.findElements(by.css('input.leaflet-control-layers-selector')).then(function(inputs) {
+ browser.driver.findElements(by.css('input.leaflet-control-layers-selector')).then(function (inputs) {
var input = inputs[1];
input.click();
- browser.wait(function() {
+ browser.wait(function () {
return element(by.xpath('//img[contains(@src, "http://khm1.googleapis.com")]')).isPresent();
}, 5000);
diff --git a/test/e2e/0301-paths-types-example.js b/test/e2e/0301-paths-types-example.js
index 24b18aea..164383a9 100644
--- a/test/e2e/0301-paths-types-example.js
+++ b/test/e2e/0301-paths-types-example.js
@@ -1,20 +1,20 @@
'use strict';
-describe('Loading 0301-paths-types-example.html', function() {
+describe('Loading 0301-paths-types-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0301-paths-types-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should show a polyline on the map when clicked the polyline button', function() {
+ it('should show a polyline on the map when clicked the polyline button', function () {
element(by.xpath('//button[text()="polyline"]')).click();
expect(element(by.xpath('//*[name()="svg"]//*[name()="path"]')).getAttribute('d')).toEqual('M512 240L492 331L584 320');
});
- it('should show a multipolyline on the map when clicked the multipolyline button', function() {
+ it('should show a multipolyline on the map when clicked the multipolyline button', function () {
element(by.xpath('//button[text()="multiPolyline"]')).click();
expect(element(by.xpath('(//*[name()="svg"]//*[name()="path"])[1]')).getAttribute('d')).toEqual('M512 240L461 344');
@@ -22,28 +22,28 @@ describe('Loading 0301-paths-types-example.html', function() {
});
- it('should show a polygon on the map when clicked the polygon button', function() {
+ it('should show a polygon on the map when clicked the polygon button', function () {
element(by.xpath('//button[text()="polygon"]')).click();
expect(element(by.xpath('(//*[name()="svg"]//*[name()="path"])[1]')).getAttribute('d')).toEqual('M512 240L461 344L492 331L526 263z');
});
- it('should show a multipolygon on the map when clicked the multipolygon button', function() {
+ it('should show a multipolygon on the map when clicked the multipolygon button', function () {
element(by.xpath('//button[text()="multiPolygon"]')).click();
expect(element(by.xpath('(//*[name()="svg"]//*[name()="path"])[1]')).getAttribute('d')).toEqual('M512 240L461 344L492 331L526 263z');
expect(element(by.xpath('(//*[name()="svg"]//*[name()="path"])[2]')).getAttribute('d')).toEqual('M589 231L584 320L536 246z');
});
- it('should show a rectangle on the map when clicked the rectangle button', function() {
+ it('should show a rectangle on the map when clicked the rectangle button', function () {
element(by.xpath('//button[text()="rectangle"]')).click();
expect(element(by.xpath('(//*[name()="svg"]//*[name()="path"])[1]')).getAttribute('d')).toEqual('M461 344L461 231L589 231L589 344z');
});
- it('should show a circle on the map when clicked the circle button', function() {
+ it('should show a circle on the map when clicked the circle button', function () {
element(by.xpath('//button[text()="circle"]')).click();
expect(element(by.xpath('(//*[name()="svg"]//*[name()="path" and @stroke-linejoin="round"])[1]')).getAttribute('d')).toEqual('M536,205A41,41,0,1,1,535.9,205 z');
});
- it('should show a circleMarker on the map when clicked the circleMarker button', function() {
+ it('should show a circleMarker on the map when clicked the circleMarker button', function () {
element(by.xpath('//button[text()="circleMarker"]')).click();
expect(element(by.xpath('(//*[name()="svg"]//*[name()="path" and @stroke-linejoin="round"])[1]')).getAttribute('d')).toEqual('M584,270A50,50,0,1,1,583.9,270 z');
});
diff --git a/test/e2e/0501-markers-events-add-example.js b/test/e2e/0501-markers-events-add-example.js
index 5521180a..a66dd661 100644
--- a/test/e2e/0501-markers-events-add-example.js
+++ b/test/e2e/0501-markers-events-add-example.js
@@ -1,15 +1,15 @@
'use strict';
-describe('Loading 0501-markers-events-add-example.html', function() {
+describe('Loading 0501-markers-events-add-example.html', function () {
- beforeEach(function() {
+ beforeEach(function () {
browser.get('0501-markers-events-add-example.html');
- browser.wait(function() {
+ browser.wait(function () {
return element(by.css('img.leaflet-tile-loaded')).isPresent();
}, 5000);
});
- it('should load a marker when clicked on the map', function() {
+ it('should load a marker when clicked on the map', function () {
element(by.css('img.leaflet-tile-loaded')).click();
browser.driver.sleep(100);
expect(element(by.css('img.leaflet-marker-icon')).isPresent()).toBe(true);
diff --git a/test/karma-unit.conf.js b/test/karma-unit.conf.js
index f247fbd4..c10f7ba6 100644
--- a/test/karma-unit.conf.js
+++ b/test/karma-unit.conf.js
@@ -1,4 +1,4 @@
-module.exports = function(karma) {
+module.exports = function (karma) {
karma.set({
// base path, that will be used to resolve files and exclude
basePath: '../',
diff --git a/test/protractor.conf.js b/test/protractor.conf.js
index a91b8b32..f328924b 100644
--- a/test/protractor.conf.js
+++ b/test/protractor.conf.js
@@ -81,7 +81,7 @@ exports.config = {
// before the specs are executed
// You can specify a file containing code to run by setting onPrepare to
// the filename string.
- onPrepare: function() {
+ onPrepare: function () {
// At this point, global 'protractor' object will be set up, and jasmine
// will be available. For example, you can add a Jasmine reporter with:
// jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter(
diff --git a/test/unit/000-leafletDirectiveSpec.js b/test/unit/000-leafletDirectiveSpec.js
index 2a0da65b..d8a782bb 100755
--- a/test/unit/000-leafletDirectiveSpec.js
+++ b/test/unit/000-leafletDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet', function() {
+describe('Directive: leaflet', function () {
var $compile;
var $rootScope;
var $timeout;
@@ -13,7 +13,7 @@ describe('Directive: leaflet', function() {
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletMapDefaults_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletMapDefaults_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
$timeout = _$timeout_;
@@ -22,22 +22,22 @@ describe('Directive: leaflet', function() {
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should have loaded leaflet library inside the directive', function() {
+ it('should have loaded leaflet library inside the directive', function () {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
expect(element.text()).toEqual('+-Leaflet | © OpenStreetMap contributors');
});
- it('should set default center if not center is provided', function() {
+ it('should set default center if not center is provided', function () {
var element = angular.element('');
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
@@ -47,11 +47,11 @@ describe('Directive: leaflet', function() {
expect(leafletMap.getCenter().lng).toEqual(0);
});
- it('should set default tile if not tiles nor layers are provided', function() {
+ it('should set default tile if not tiles nor layers are provided', function () {
var element = angular.element('');
element = $compile(element)(scope);
var leafletTiles;
- leafletData.getTiles().then(function(tiles) {
+ leafletData.getTiles().then(function (tiles) {
leafletTiles = tiles;
});
@@ -60,12 +60,12 @@ describe('Directive: leaflet', function() {
expect(leafletTiles._url).toEqual(defaults.tileLayer);
});
- it('should set the max zoom if specified', function() {
+ it('should set the max zoom if specified', function () {
angular.extend(scope, { defaults: { maxZoom: 15 } });
var element = angular.element('');
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
@@ -73,12 +73,12 @@ describe('Directive: leaflet', function() {
expect(leafletMap.getMaxZoom()).toEqual(15);
});
- it('should set the min zoom if specified', function() {
+ it('should set the min zoom if specified', function () {
angular.extend(scope, { defaults: { minZoom: 4 } });
var element = angular.element('');
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
@@ -86,7 +86,7 @@ describe('Directive: leaflet', function() {
expect(leafletMap.getMinZoom()).toEqual(4);
});
- it('should set the CSS width and height if they are passed as string attributes', function() {
+ it('should set the CSS width and height if they are passed as string attributes', function () {
var element = angular.element('');
element = $compile(element)(scope);
@@ -94,7 +94,7 @@ describe('Directive: leaflet', function() {
expect(element.css('height')).toBe('480px');
});
- it('should set the CSS width and height if they are passed as number attributes', function() {
+ it('should set the CSS width and height if they are passed as number attributes', function () {
var element = angular.element('');
element = $compile(element)(scope);
@@ -102,7 +102,7 @@ describe('Directive: leaflet', function() {
expect(element.css('height')).toBe('480px');
});
- it('should set tileLayer and tileLayer options if specified', function() {
+ it('should set tileLayer and tileLayer options if specified', function () {
angular.extend(scope, {
defaults: {
tileLayer: 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
@@ -115,7 +115,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
var leafletTiles;
- leafletData.getTiles().then(function(tiles) {
+ leafletData.getTiles().then(function (tiles) {
leafletTiles = tiles;
});
@@ -127,7 +127,7 @@ describe('Directive: leaflet', function() {
expect(defaults.tileLayer).toEqual('http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png');
});
- it('should set zoom control button properly if zoomControlPosition option is set', function() {
+ it('should set zoom control button properly if zoomControlPosition option is set', function () {
angular.extend(scope, {
defaults: {
zoomControlPosition: 'topright',
@@ -136,7 +136,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
@@ -144,7 +144,7 @@ describe('Directive: leaflet', function() {
expect(leafletMap.zoomControl.getPosition()).toEqual('topright');
});
- it('should remove zoom control button if unset on defaults', function() {
+ it('should remove zoom control button if unset on defaults', function () {
angular.extend(scope, {
defaults: {
zoomControl: false,
@@ -153,7 +153,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
@@ -161,7 +161,7 @@ describe('Directive: leaflet', function() {
expect(leafletMap.zoomControl).toBe(undefined);
});
- it('should unset from leafletData after scope destroy', function() {
+ it('should unset from leafletData after scope destroy', function () {
var element = angular.element('');
var $scope = scope.$new();
@@ -171,7 +171,7 @@ describe('Directive: leaflet', function() {
scope.$digest();
var shouldNotBeMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
shouldNotBeMap = map;
});
@@ -179,7 +179,7 @@ describe('Directive: leaflet', function() {
expect(shouldNotBeMap).toBe(undefined);
});
- it('should remove zoom control button if unset on map defaults', function() {
+ it('should remove zoom control button if unset on map defaults', function () {
angular.extend(scope, {
defaults: {
map: {
@@ -190,7 +190,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
diff --git a/test/unit/010-centerDirectiveSpec.js b/test/unit/010-centerDirectiveSpec.js
index 7f61d11c..e4de8f7c 100644
--- a/test/unit/010-centerDirectiveSpec.js
+++ b/test/unit/010-centerDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet center', function() {
+describe('Directive: leaflet center', function () {
var $compile;
var $rootScope;
var $timeout;
@@ -14,7 +14,7 @@ describe('Directive: leaflet center', function() {
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_, _$location_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$timeout_, _$location_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
$timeout = _$timeout_;
@@ -31,40 +31,40 @@ describe('Directive: leaflet center', function() {
scope.center = center;
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should have default {[0, 0], 1} parameters on the map if not correctly defined', function() {
+ it('should have default {[0, 0], 1} parameters on the map if not correctly defined', function () {
scope.center = {};
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
expect(map.getZoom()).toEqual(1);
expect(map.getCenter().lat).toEqual(0);
expect(map.getCenter().lng).toEqual(0);
});
});
- it('should update the map center if the initial center scope properties are set', function() {
+ it('should update the map center if the initial center scope properties are set', function () {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
expect(map.getZoom()).toEqual(center.zoom);
expect(map.getCenter().lat).toBeCloseTo(0.96658, 4);
expect(map.getCenter().lng).toBeCloseTo(2.02, 4);
});
});
- it('should update the map center if the scope center properties changes', function() {
+ it('should update the map center if the scope center properties changes', function () {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
@@ -84,12 +84,12 @@ describe('Directive: leaflet center', function() {
expect(map.getZoom()).toEqual(8);
});
- describe('Using url-hash functionality', function() {
- it('should update the center of the map if changes the url', function() {
+ describe('Using url-hash functionality', function () {
+ it('should update the center of the map if changes the url', function () {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
@@ -105,12 +105,12 @@ describe('Directive: leaflet center', function() {
expect(map.getZoom()).toEqual(4);
});
- it('should update the url hash if changes the center', function() {
+ it('should update the url hash if changes the center', function () {
var element = angular.element('');
element = $compile(element)(scope);
scope.center = { lat: 9.52478, lng: -1.8, zoom: 8 };
var centerUrlHash;
- scope.$on('centerUrlHash', function(event, u) {
+ scope.$on('centerUrlHash', function (event, u) {
centerUrlHash = u;
});
diff --git a/test/unit/020-boundsDirectiveSpec.js b/test/unit/020-boundsDirectiveSpec.js
index bc95c49b..da4deb63 100755
--- a/test/unit/020-boundsDirectiveSpec.js
+++ b/test/unit/020-boundsDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: bounds', function() {
+describe('Directive: bounds', function () {
var $compile;
var $rootScope;
var leafletData;
@@ -12,13 +12,13 @@ describe('Directive: bounds', function() {
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
}));
- beforeEach(function() {
+ beforeEach(function () {
scope = $rootScope.$new();
bounds = {
southWest: {
@@ -32,11 +32,11 @@ describe('Directive: bounds', function() {
};
});
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('updates the map bounds if bounds are provided', function() {
+ it('updates the map bounds if bounds are provided', function () {
angular.extend(scope, {
bounds: bounds,
center: {},
@@ -45,7 +45,7 @@ describe('Directive: bounds', function() {
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
@@ -57,7 +57,7 @@ describe('Directive: bounds', function() {
expect(mapBounds.getNorthEast().lng).toBeCloseTo(-0.087890625);
});
- it('allows empty bounds initialization', function() {
+ it('allows empty bounds initialization', function () {
angular.extend(scope, {
bounds: {},
center: {},
@@ -66,7 +66,7 @@ describe('Directive: bounds', function() {
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
@@ -77,7 +77,7 @@ describe('Directive: bounds', function() {
expect(mapBounds.getNorthEast().lng).toBeCloseTo(0);
});
- it('should update map bounds when map initializes', function() {
+ it('should update map bounds when map initializes', function () {
angular.extend(scope, {
bounds: {},
center: { lat: 5, lng: -3, zoom: 4 },
@@ -86,7 +86,7 @@ describe('Directive: bounds', function() {
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
@@ -104,7 +104,7 @@ describe('Directive: bounds', function() {
expect(bounds.southWest.lng).toBe(mapBounds._southWest.lng);
});
- it('should initialize map with bounds only', function() {
+ it('should initialize map with bounds only', function () {
angular.extend(scope, {
bounds: bounds,
center: {},
@@ -113,7 +113,7 @@ describe('Directive: bounds', function() {
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
@@ -131,7 +131,7 @@ describe('Directive: bounds', function() {
expect(scopeBounds.southWest.lng).toBe(mapBounds._southWest.lng);
});
- it('updates the map bounds with options if bounds are provided', function() {
+ it('updates the map bounds with options if bounds are provided', function () {
bounds.options = {
padding: [50, 50],
};
@@ -143,7 +143,7 @@ describe('Directive: bounds', function() {
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
diff --git a/test/unit/030-tilesDirectiveSpec.js b/test/unit/030-tilesDirectiveSpec.js
index 0e5e27e6..ee4e006d 100755
--- a/test/unit/030-tilesDirectiveSpec.js
+++ b/test/unit/030-tilesDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet', function() {
+describe('Directive: leaflet', function () {
var $compile;
var $rootScope;
var leafletData;
@@ -12,7 +12,7 @@ describe('Directive: leaflet', function() {
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletMapDefaults_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletMapDefaults_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
@@ -20,21 +20,21 @@ describe('Directive: leaflet', function() {
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should set default tiles if bad tiles structure is provided', function() {
+ it('should set default tiles if bad tiles structure is provided', function () {
angular.extend(scope, { tiles: {} });
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getTiles().then(function(leafletTiles) {
+ leafletData.getTiles().then(function (leafletTiles) {
var defaults = leafletMapDefaults.getDefaults();
expect(leafletTiles._url).toEqual(defaults.tileLayer);
});
});
- it('should update the map tiles if the scope tiles properties changes', function() {
+ it('should update the map tiles if the scope tiles properties changes', function () {
var tiles = {
url: 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
};
@@ -42,7 +42,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
var leafletTiles;
- leafletData.getTiles().then(function(tiles) {
+ leafletData.getTiles().then(function (tiles) {
leafletTiles = tiles;
});
@@ -53,7 +53,7 @@ describe('Directive: leaflet', function() {
expect(leafletTiles._url).toEqual('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
});
- it('should remove the map tiles if the scope tiles are changed into an empty value', function() {
+ it('should remove the map tiles if the scope tiles are changed into an empty value', function () {
var tiles = {
url: 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
};
@@ -62,12 +62,12 @@ describe('Directive: leaflet', function() {
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
var leafletTiles;
- leafletData.getTiles().then(function(tiles) {
+ leafletData.getTiles().then(function (tiles) {
leafletTiles = tiles;
});
@@ -77,7 +77,7 @@ describe('Directive: leaflet', function() {
expect(leafletMap.hasLayer(leafletTiles)).toBe(true);
scope.tiles = {};
scope.$digest();
- leafletData.getTiles().then(function(tiles) {
+ leafletData.getTiles().then(function (tiles) {
leafletTiles = tiles;
});
@@ -85,7 +85,7 @@ describe('Directive: leaflet', function() {
expect(leafletMap.hasLayer(leafletTiles)).toBe(false);
});
- it('should remove the old tiles from the map and add a new one if the scope tiles options are changed', function() {
+ it('should remove the old tiles from the map and add a new one if the scope tiles options are changed', function () {
var tiles = {
url: 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
};
@@ -94,12 +94,12 @@ describe('Directive: leaflet', function() {
element = $compile(element)(scope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
var leafletTiles;
- leafletData.getTiles().then(function(tiles) {
+ leafletData.getTiles().then(function (tiles) {
leafletTiles = tiles;
});
@@ -110,7 +110,7 @@ describe('Directive: leaflet', function() {
scope.tiles.options = { maxZoom: 19 };
scope.$digest();
expect(leafletMap.hasLayer(leafletTiles)).toBe(false);
- leafletData.getTiles().then(function(tiles) {
+ leafletData.getTiles().then(function (tiles) {
leafletTiles = tiles;
});
diff --git a/test/unit/040-maxboundsDirectiveSpec.js b/test/unit/040-maxboundsDirectiveSpec.js
index 8601d04f..d296c679 100755
--- a/test/unit/040-maxboundsDirectiveSpec.js
+++ b/test/unit/040-maxboundsDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet', function() {
+describe('Directive: leaflet', function () {
var $compile = null;
var $rootScope = null;
var $timeout;
@@ -12,7 +12,7 @@ describe('Directive: leaflet', function() {
var leafletMapDefaults = null;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletMapDefaults_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletMapDefaults_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
$timeout = _$timeout_;
@@ -20,11 +20,11 @@ describe('Directive: leaflet', function() {
leafletMapDefaults = _leafletMapDefaults_;
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should change the center if maxbounds specified', function() {
+ it('should change the center if maxbounds specified', function () {
angular.extend($rootScope, {
maxbounds: {
southWest: {
@@ -43,7 +43,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)($rootScope);
var leafletMap;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
leafletMap = map;
});
diff --git a/test/unit/050-pathsDirectiveSpec.js b/test/unit/050-pathsDirectiveSpec.js
index 40442813..d56df247 100755
--- a/test/unit/050-pathsDirectiveSpec.js
+++ b/test/unit/050-pathsDirectiveSpec.js
@@ -4,15 +4,15 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet', function() {
+describe('Directive: leaflet', function () {
var $compile;
var $rootScope;
var leafletData;
var scope;
- beforeEach(function() {
+ beforeEach(function () {
module('leaflet-directive');
- inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
@@ -20,12 +20,12 @@ describe('Directive: leaflet', function() {
});
});
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
// Error management
- it('should not allow a bad name object', function() {
+ it('should not allow a bad name object', function () {
var latlngs1 = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
@@ -42,14 +42,14 @@ describe('Directive: leaflet', function() {
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
expect(paths).toEqual({});
});
});
// Polyline
- it('should create polyline on the map', function() {
+ it('should create polyline on the map', function () {
var latlngs1 = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
@@ -67,7 +67,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var polyline1 = paths.p1;
var polyline2 = paths.p2;
latlngs1 = polyline1.getLatLngs();
@@ -84,7 +84,7 @@ describe('Directive: leaflet', function() {
});
});
- it('should support polyline with coordinates as arrays', function() {
+ it('should support polyline with coordinates as arrays', function () {
var latlngs = [
[0.966, 2.02],
[2.02, 4.04],
@@ -97,7 +97,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var polyline = paths.p1;
latlngs = polyline.getLatLngs();
expect(latlngs[0].lat).toBeCloseTo(0.966);
@@ -108,7 +108,7 @@ describe('Directive: leaflet', function() {
});
// MultiPolyline
- it('should create multiPolyline on the map', function() {
+ it('should create multiPolyline on the map', function () {
angular.extend(scope, {
paths: {
p1: {
@@ -129,7 +129,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var polylines = paths.p1;
var latlngs = polylines.getLatLngs();
expect(latlngs[0][0].lat).toBeCloseTo(0.966);
@@ -144,19 +144,19 @@ describe('Directive: leaflet', function() {
});
// Polygon
- it('should create polygon on the map', function() {
+ it('should create polygon on the map', function () {
var latlngs = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
{ lat: 0.466, lng: 1.02 },
{ lat: 1.02, lng: 3.04 },
];
- angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon' }}});
+ angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon' } } });
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var polygon = paths.p1;
latlngs = polygon.getLatLngs();
expect(latlngs[0].lat).toBeCloseTo(0.966);
@@ -171,7 +171,7 @@ describe('Directive: leaflet', function() {
});
// MultiPolygon
- it('should create multiPolygon on the map', function() {
+ it('should create multiPolygon on the map', function () {
var latlngs1 = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
@@ -184,11 +184,11 @@ describe('Directive: leaflet', function() {
{ lat: 1.466, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
];
- angular.extend(scope, { paths: { p1: { latlngs: [latlngs1, latlngs2], type: 'multiPolygon' }}});
+ angular.extend(scope, { paths: { p1: { latlngs: [latlngs1, latlngs2], type: 'multiPolygon' } } });
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var multiPolygon = paths.p1;
latlngs1 = multiPolygon.getLatLngs();
@@ -212,7 +212,7 @@ describe('Directive: leaflet', function() {
});
// Rectangle
- it('should create rectangle on the map', function() {
+ it('should create rectangle on the map', function () {
var latlngs1 = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
@@ -221,11 +221,11 @@ describe('Directive: leaflet', function() {
{ lat: 0.466, lng: 1.02 },
{ lat: 1.02, lng: 3.04 },
];
- angular.extend(scope, { 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('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var rectangle1 = paths.p1;
var rectangle2 = paths.p2;
latlngs1 = rectangle1.getBounds();
@@ -247,7 +247,7 @@ describe('Directive: leaflet', function() {
});
// Circle
- it('should create circle on the map', function() {
+ it('should create circle on the map', function () {
var c1 = {
latlngs: { lat: 0.966, lng: 2.02 },
radius: 10,
@@ -258,12 +258,12 @@ describe('Directive: leaflet', function() {
radius: 20,
type: 'circle',
};
- angular.extend(scope, { paths: { p1: c1, p2: c2 }});
+ angular.extend(scope, { paths: { p1: c1, p2: c2 } });
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var circle1 = paths.p1;
var circle2 = paths.p2;
var latlngs1 = circle1.getLatLng();
@@ -281,7 +281,7 @@ describe('Directive: leaflet', function() {
});
// CircleMarker
- it('should create circleMarker on the map', function() {
+ it('should create circleMarker on the map', function () {
var c1 = {
latlngs: { lat: 0.966, lng: 2.02 },
radius: 10,
@@ -292,11 +292,11 @@ describe('Directive: leaflet', function() {
radius: 20,
type: 'circleMarker',
};
- angular.extend(scope, { paths: { p1: c1, p2: c2 }});
+ angular.extend(scope, { paths: { p1: c1, p2: c2 } });
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var circle1 = paths.p1;
var circle2 = paths.p2;
var latlngs1 = circle1.getLatLng();
@@ -314,47 +314,47 @@ describe('Directive: leaflet', function() {
});
// Polygon
- it('should update polygon colors on the map', function() {
+ it('should update polygon colors on the map', function () {
var latlngs = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
{ lat: 0.466, lng: 1.02 },
{ lat: 1.02, lng: 3.04 },
];
- angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon', color: 'white', fillColor: 'red' }}});
+ angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon', color: 'white', fillColor: 'red' } } });
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var polygon = paths.p1;
expect(polygon.options.color).toBe('white');
expect(polygon.options.fillColor).toBe('red');
});
- angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon', color: 'green', fillColor: 'blue' }}});
+ angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon', color: 'green', fillColor: 'blue' } } });
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var polygon = paths.p1;
expect(polygon.options.color).toBe('green');
expect(polygon.options.fillColor).toBe('blue');
});
});
- it('should update the path if the path object is changed', function() {
+ it('should update the path if the path object is changed', function () {
var latlngs = [
{ lat: 0.966, lng: 2.02 },
{ lat: 2.02, lng: 4.04 },
{ lat: 0.466, lng: 1.02 },
{ lat: 1.02, lng: 3.04 },
];
- angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon', color: 'white', fillColor: 'red' }}});
+ angular.extend(scope, { paths: { p1: { latlngs: latlngs, type: 'polygon', color: 'white', fillColor: 'red' } } });
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var polygon = paths.p1;
expect(polygon.options.color).toBe('white');
expect(polygon.options.fillColor).toBe('red');
@@ -366,7 +366,7 @@ describe('Directive: leaflet', function() {
};
scope.$digest();
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
var latlngs = paths.p1.getLatLngs();
expect(latlngs[0].lat).toBeCloseTo(0.97);
expect(latlngs[0].lng).toBeCloseTo(2.00);
diff --git a/test/unit/060-decorationsDirectiveSpec.js b/test/unit/060-decorationsDirectiveSpec.js
index 6bf0590d..4f4c9750 100644
--- a/test/unit/060-decorationsDirectiveSpec.js
+++ b/test/unit/060-decorationsDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: decorations', function() {
+describe('Directive: decorations', function () {
var $compile;
var $rootScope;
var leafletData;
@@ -13,14 +13,14 @@ describe('Directive: decorations', function() {
var mainDecorations;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
leafletHelpers = _leafletHelpers_;
}));
- beforeEach(function() {
+ beforeEach(function () {
mainCoordinates = [
[0.966, 2.02],
[2.02, 4.04],
@@ -28,20 +28,20 @@ describe('Directive: decorations', function() {
mainDecorations = {
arrow: {
coordinates: mainCoordinates,
- patterns: [{offset: '10%', repeat: 0, symbol: L.Symbol.arrowHead({pixelSize: 10, polygon: false, pathOptions: {stroke: true}})}],
+ patterns: [{ offset: '10%', repeat: 0, symbol: L.Symbol.arrowHead({ pixelSize: 10, polygon: false, pathOptions: { stroke: true } }) }],
},
markers: {
coordinates: mainCoordinates,
- patterns: { offset: '5%', repeat: '10%', symbol: L.Symbol.marker()},
+ patterns: { offset: '5%', repeat: '10%', symbol: L.Symbol.marker() },
},
};
});
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should create a decoration on the map', function() {
+ it('should create a decoration on the map', function () {
angular.extend($rootScope, {
decorations: {
arrow: mainDecorations.arrow,
@@ -51,13 +51,13 @@ describe('Directive: decorations', function() {
var element = angular.element('');
element = $compile(element)($rootScope);
$rootScope.$digest();
- leafletData.getDecorations().then(function(leafletDecorations) {
+ leafletData.getDecorations().then(function (leafletDecorations) {
var leafletArrow = leafletDecorations.arrow;
// Unfortunately, the L.PolylineDecorator class does not currently expose any value accessors.
expect(leafletArrow.options.patterns.offset).toBe('10%');
expect(leafletArrow.options.patterns.repeat).toBe(0);
- expect(leafletArrow.options.symbol).toEqual(L.Symbol.arrowHead({pixelSize: 10, polygon: false, pathOptions: {stroke: true}}));
+ expect(leafletArrow.options.symbol).toEqual(L.Symbol.arrowHead({ pixelSize: 10, polygon: false, pathOptions: { stroke: true } }));
});
});
});
diff --git a/test/unit/070-geojsonDirectiveSpec.js b/test/unit/070-geojsonDirectiveSpec.js
index e8ae05b1..bcb728f2 100644
--- a/test/unit/070-geojsonDirectiveSpec.js
+++ b/test/unit/070-geojsonDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: geojson', function() {
+describe('Directive: geojson', function () {
var $compile;
var $rootScope;
var leafletData;
@@ -12,7 +12,7 @@ describe('Directive: geojson', function() {
var scope;
leafletMapDefaults = leafletData = scope = $compile = $rootScope = null;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletMapDefaults_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletMapDefaults_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
@@ -20,23 +20,23 @@ describe('Directive: geojson', function() {
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should not create a geoJSON tilelayer if a bad structure is provided', function() {
+ it('should not create a geoJSON tilelayer if a bad structure is provided', function () {
var element;
angular.extend(scope, {
geojson: {},
});
element = angular.element('');
element = $compile(element)(scope);
- leafletData.getGeoJSON().then(function(geoJSON) {
+ leafletData.getGeoJSON().then(function (geoJSON) {
return expect(geoJSON).not.toBeDefined();
});
});
- it('should create a geoJSON tilelayer if a good structure is provided', function() {
+ it('should create a geoJSON tilelayer if a good structure is provided', function () {
var element;
angular.extend(scope, {
geojson: {
@@ -81,13 +81,13 @@ describe('Directive: geojson', function() {
});
element = angular.element('');
element = $compile(element)(scope);
- leafletData.getGeoJSON().then(function(geoJSON) {
+ leafletData.getGeoJSON().then(function (geoJSON) {
expect(geoJSON).toBeDefined();
expect(Object.keys(geoJSON._layers).length).toBe(3);
});
});
- it('should remove the geoJSON layer from the map if geojson object removed from scope', function() {
+ it('should remove the geoJSON layer from the map if geojson object removed from scope', function () {
var element;
var leafletGeoJSON;
var leafletMap;
@@ -136,12 +136,12 @@ describe('Directive: geojson', function() {
element = $compile(element)(scope);
leafletGeoJSON = void 0;
leafletMap = void 0;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
return leafletMap = map;
});
scope.$digest();
- leafletData.getGeoJSON().then(function(geoJSON) {
+ leafletData.getGeoJSON().then(function (geoJSON) {
return leafletGeoJSON = geoJSON;
});
@@ -153,8 +153,8 @@ describe('Directive: geojson', function() {
expect(leafletMap.hasLayer(leafletGeoJSON)).toBe(false);
});
- describe('nested', function() {
- it('should create a geoJSON tilelayer if a good structure is provided', function() {
+ describe('nested', function () {
+ it('should create a geoJSON tilelayer if a good structure is provided', function () {
var element;
angular.extend(scope, {
geojson: {
@@ -217,16 +217,16 @@ describe('Directive: geojson', function() {
});
element = angular.element('');
element = $compile(element)(scope);
- leafletData.getGeoJSON().then(function(geoJSON) {
+ leafletData.getGeoJSON().then(function (geoJSON) {
expect(geoJSON).toBeDefined();
expect(Object.keys(geoJSON).length).toBe(3);
- angular.forEach(function(lObject) {
+ angular.forEach(function (lObject) {
expect(Object.keys(lObject._layers).length).toBe(1);
});
});
});
- it('should remove the geoJSON layer from the map if geojson object removed from scope', function() {
+ it('should remove the geoJSON layer from the map if geojson object removed from scope', function () {
var element;
var leafletGeoJSON;
var leafletMap;
@@ -293,12 +293,12 @@ describe('Directive: geojson', function() {
element = $compile(element)(scope);
leafletGeoJSON = void 0;
leafletMap = void 0;
- leafletData.getMap().then(function(map) {
+ leafletData.getMap().then(function (map) {
return leafletMap = map;
});
scope.$digest();
- leafletData.getGeoJSON().then(function(geoJSON) {
+ leafletData.getGeoJSON().then(function (geoJSON) {
return leafletGeoJSON = geoJSON;
});
diff --git a/test/unit/080-markersDirectiveSpec.js b/test/unit/080-markersDirectiveSpec.js
index fdfd4608..dd5490ad 100644
--- a/test/unit/080-markersDirectiveSpec.js
+++ b/test/unit/080-markersDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet', function() {
+describe('Directive: leaflet', function () {
var $compile;
var $rootScope;
var leafletData;
@@ -14,7 +14,7 @@ describe('Directive: leaflet', function() {
mainLayers = mainMarkers = leafletHelpers = leafletData = $rootScope = $compile = void 0;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletHelpers_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletHelpers_) {
var $timeout;
$compile = _$compile_;
$rootScope = _$rootScope_;
@@ -23,7 +23,7 @@ describe('Directive: leaflet', function() {
$timeout = _$timeout_;
}));
- beforeEach(function() {
+ beforeEach(function () {
mainMarkers = {
paris: {
lat: 0.966,
@@ -62,11 +62,11 @@ describe('Directive: leaflet', function() {
};
});
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
return $rootScope.$apply();
}));
- it('should create main marker on the map', function() {
+ it('should create main marker on the map', function () {
var element;
var mainMarker = {
lat: 0.966,
@@ -81,7 +81,7 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
$rootScope.$digest();
- return leafletData.getMarkers().then(function(leafletMarkers) {
+ return leafletData.getMarkers().then(function (leafletMarkers) {
var leafletMainMarker;
leafletMainMarker = leafletMarkers.mainMarker;
expect(leafletMainMarker.getLatLng().lat).toBeCloseTo(0.966);
@@ -89,8 +89,8 @@ describe('Directive: leaflet', function() {
});
});
- describe('handles common markers correctly', function() {
- return xit('markers count should be correct post update with no dupes', function() {
+ describe('handles common markers correctly', function () {
+ return xit('markers count should be correct post update with no dupes', function () {
var element;
var markers1 = [
{
@@ -120,13 +120,13 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
$rootScope.$digest();
- return leafletData.getMarkers().then(function(leafletMarkers) {
+ return leafletData.getMarkers().then(function (leafletMarkers) {
return expect(Object.keys(leafletMarkers).length).toBe(markers1.length);
- }).then((function(_this) {
- return function() {
+ }).then((function (_this) {
+ return function () {
$rootScope.markers = markers2;
$rootScope.$digest();
- return leafletData.getMarkers().then(function(leafletMarkers) {
+ return leafletData.getMarkers().then(function (leafletMarkers) {
return expect(Object.keys(leafletMarkers).length).toBe(markers2.length);
});
};
@@ -134,14 +134,14 @@ describe('Directive: leaflet', function() {
});
});
- describe('isNested', function() {
- beforeEach(function() {
+ describe('isNested', function () {
+ beforeEach(function () {
var mainMarker;
mainMarker = {
lat: 0.966,
lng: 2.02,
};
- return this.testRunner = function(postRunnerCb, preRunnerCb) {
+ return this.testRunner = function (postRunnerCb, preRunnerCb) {
var element;
var preRunnerRet;
angular.extend($rootScope, {
@@ -159,7 +159,7 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
$rootScope.$digest();
- return leafletData.getMarkers().then(function(leafletMarkers) {
+ return leafletData.getMarkers().then(function (leafletMarkers) {
var leafletMainMarker;
leafletMainMarker = leafletMarkers.layer1.mainMarker;
if (postRunnerCb) {
@@ -169,25 +169,25 @@ describe('Directive: leaflet', function() {
};
});
- afterEach(function() {
+ afterEach(function () {
var self;
var _this = this;
- return ['testRunner'].forEach(function(key) {
+ return ['testRunner'].forEach(function (key) {
return delete _this[key];
});
});
- it('should create main marker on the map', function() {
- return this.testRunner(function(mainMarker, leafletMainMarker) {
+ it('should create main marker on the map', function () {
+ return this.testRunner(function (mainMarker, leafletMainMarker) {
expect(leafletMainMarker.getLatLng().lat).toBeCloseTo(mainMarker.lat);
return expect(leafletMainMarker.getLatLng().lng).toBeCloseTo(mainMarker.lng);
});
});
- return it('should bind popup to main marker if message is given', function() {
- return this.testRunner((function(mainMarker, leafletMainMarker) {
+ return it('should bind popup to main marker if message is given', function () {
+ return this.testRunner((function (mainMarker, leafletMainMarker) {
return expect(leafletMainMarker._popup._content).toEqual(mainMarker.message);
- }), function(mainMarker) {
+ }), function (mainMarker) {
return angular.extend(mainMarker, {
message: 'this is paris',
@@ -196,7 +196,7 @@ describe('Directive: leaflet', function() {
});
});
- it('should bind popup to main marker if message is given', function() {
+ it('should bind popup to main marker if message is given', function () {
var element;
var marker = {
lat: 0.966,
@@ -212,14 +212,14 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
$rootScope.$digest();
- return leafletData.getMarkers().then(function(leafletMarkers) {
+ return leafletData.getMarkers().then(function (leafletMarkers) {
var leafletMainMarker;
leafletMainMarker = leafletMarkers.marker;
return expect(leafletMainMarker._popup._content).toEqual('this is paris');
});
});
- it('message should be compiled if angular template is given', function() {
+ it('message should be compiled if angular template is given', function () {
var element;
var leafletMainMarker;
var marker = {
@@ -242,7 +242,7 @@ describe('Directive: leaflet', function() {
element = $compile(element)($rootScope);
$rootScope.$digest();
leafletMainMarker = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return leafletMainMarker = leafletMarkers.marker;
});
@@ -252,7 +252,7 @@ describe('Directive: leaflet', function() {
return expect(leafletMainMarker._popup._contentNode.innerHTML).toEqual('blue
');
});
- it('message should be compiled in specified scope', function() {
+ it('message should be compiled in specified scope', function () {
var arbitraryIsolateScope;
var element;
var leafletMainMarker;
@@ -266,7 +266,7 @@ describe('Directive: leaflet', function() {
marker = {
lat: 0.966,
lng: 2.02,
- getMessageScope: function() {
+ getMessageScope: function () {
return arbitraryIsolateScope;
},
@@ -282,7 +282,7 @@ describe('Directive: leaflet', function() {
element = $compile(element)($rootScope);
$rootScope.$digest();
leafletMainMarker = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return leafletMainMarker = leafletMarkers.marker;
});
@@ -292,7 +292,7 @@ describe('Directive: leaflet', function() {
return expect(leafletMainMarker._popup._contentNode.innerHTML).toEqual('angular
');
});
- it('should bind label to main marker if message is given', function() {
+ it('should bind label to main marker if message is given', function () {
var element;
var marker;
spyOn(leafletHelpers.LabelPlugin, 'isLoaded').and.returnValue(true);
@@ -300,13 +300,13 @@ describe('Directive: leaflet', function() {
includes: L.Mixin.Events,
});
L.BaseMarkerMethods = {
- bindLabel: function(content, options) {
+ bindLabel: function (content, options) {
this.label = new L.Label(options, this);
this.label._content = content;
return this;
},
- updateLabelContent: function(content) {
+ updateLabelContent: function (content) {
return this.label._content = content;
},
};
@@ -330,7 +330,7 @@ describe('Directive: leaflet', function() {
element = angular.element('');
$compile(element)($rootScope);
$rootScope.$digest();
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
var leafletMainMarker;
leafletMainMarker = leafletMarkers.marker;
return expect(leafletMainMarker.label._content).toEqual('original');
@@ -338,14 +338,14 @@ describe('Directive: leaflet', function() {
marker.label.message = 'new';
$rootScope.$digest();
- return leafletData.getMarkers().then(function(leafletMarkers) {
+ return leafletData.getMarkers().then(function (leafletMarkers) {
var leafletMainMarker;
leafletMainMarker = leafletMarkers.marker;
return expect(leafletMainMarker.label._content).toEqual('new');
});
});
- it('should create markers on the map', function() {
+ it('should create markers on the map', function () {
var element;
angular.extend($rootScope, {
markers: mainMarkers,
@@ -353,7 +353,7 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
$rootScope.$digest();
- return leafletData.getMarkers().then(function(leafletMarkers) {
+ return leafletData.getMarkers().then(function (leafletMarkers) {
expect(leafletMarkers.paris.getLatLng().lat).toBeCloseTo(0.966);
expect(leafletMarkers.paris.getLatLng().lng).toBeCloseTo(2.02);
expect(leafletMarkers.madrid.getLatLng().lat).toBeCloseTo(2.02);
@@ -361,9 +361,9 @@ describe('Directive: leaflet', function() {
});
});
- describe('when a marker is updated', function() {
- describe('detecting errors in lat-lng', function() {
- it('validates (undefined lat)', function() {
+ describe('when a marker is updated', function () {
+ describe('detecting errors in lat-lng', function () {
+ it('validates (undefined lat)', function () {
var element;
var map;
var markers;
@@ -373,12 +373,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- map = leafletData.getMap().then(function(leafletMap) {
+ map = leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -389,7 +389,7 @@ describe('Directive: leaflet', function() {
return expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validates (null lat)', function() {
+ it('validates (null lat)', function () {
var element;
var map;
var markers;
@@ -399,12 +399,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -415,7 +415,7 @@ describe('Directive: leaflet', function() {
return expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validate (lat is NaN)', function() {
+ it('validate (lat is NaN)', function () {
var element;
var map;
var markers;
@@ -425,12 +425,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -441,7 +441,7 @@ describe('Directive: leaflet', function() {
return expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validates (lat not a number)', function() {
+ it('validates (lat not a number)', function () {
var element;
var map;
var markers;
@@ -451,12 +451,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -467,7 +467,7 @@ describe('Directive: leaflet', function() {
return expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validates (undefined lng)', function() {
+ it('validates (undefined lng)', function () {
var element;
var map;
var markers;
@@ -477,12 +477,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -493,7 +493,7 @@ describe('Directive: leaflet', function() {
return expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validates (null lng)', function() {
+ it('validates (null lng)', function () {
var element;
var map;
var markers;
@@ -503,12 +503,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -519,7 +519,7 @@ describe('Directive: leaflet', function() {
return expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validates (lng is NaN)', function() {
+ it('validates (lng is NaN)', function () {
var element;
var map;
var markers;
@@ -529,12 +529,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -545,7 +545,7 @@ describe('Directive: leaflet', function() {
expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validates (lng not a number)', function() {
+ it('validates (lng not a number)', function () {
var element;
var map;
var markers;
@@ -555,12 +555,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
@@ -571,7 +571,7 @@ describe('Directive: leaflet', function() {
return expect(map.hasLayer(markers.madrid)).toBe(false);
});
- it('validates (lng not a number) for a marker in a layer group', function() {
+ it('validates (lng not a number) for a marker in a layer group', function () {
var element;
var layers;
var map;
@@ -586,18 +586,18 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
$rootScope.$digest();
layers = void 0;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
return layers = leafletLayers;
});
@@ -619,7 +619,7 @@ describe('Directive: leaflet', function() {
return expect(overlays.cars.hasLayer(markers.paris)).toBe(false);
});
- return it('validates (lng not a number) for a marker in a layer markercluster', function() {
+ return it('validates (lng not a number) for a marker in a layer markercluster', function () {
var element;
var layers;
var map;
@@ -636,18 +636,18 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
$rootScope.$digest();
layers = void 0;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
return layers = leafletLayers;
});
@@ -668,7 +668,7 @@ describe('Directive: leaflet', function() {
});
});
- it('updates lat-lng', function() {
+ it('updates lat-lng', function () {
var element;
var layers;
var map;
@@ -679,18 +679,18 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
$rootScope.$digest();
layers = void 0;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
return layers = leafletLayers;
});
@@ -710,7 +710,7 @@ describe('Directive: leaflet', function() {
return expect(markers.madrid.getLatLng().lng).toBeCloseTo(1.23);
});
- return it('updates lat-lng for marker in a layer markercluster', function() {
+ return it('updates lat-lng for marker in a layer markercluster', function () {
var element;
var layers;
var map;
@@ -727,17 +727,17 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
layers = void 0;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
return layers = leafletLayers;
});
@@ -767,7 +767,7 @@ describe('Directive: leaflet', function() {
});
});
- it('should bind popup to marker if message is given', function() {
+ it('should bind popup to marker if message is given', function () {
var element;
var map;
var markers;
@@ -778,12 +778,12 @@ describe('Directive: leaflet', function() {
element = angular.element('');
element = $compile(element)($rootScope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
@@ -791,7 +791,7 @@ describe('Directive: leaflet', function() {
expect(markers.paris._popup._content).toEqual('this is paris');
});
- return describe('setting markers watches', function() {
+ return describe('setting markers watches', function () {
var DEFAULT_URL;
var LEAF_URL;
var defaultIcon;
@@ -804,7 +804,7 @@ describe('Directive: leaflet', function() {
scope = void 0;
LEAF_URL = 'http://leafletjs.com/docs/images/leaf-green.png';
DEFAULT_URL = 'http://cdn.leafletjs.com/leaflet-0.5.1/images/marker-icon.png';
- beforeEach(function() {
+ beforeEach(function () {
leafIcon = {
iconUrl: LEAF_URL,
shadowUrl: 'http://leafletjs.com/docs/images/leaf-shadow.png',
@@ -834,14 +834,14 @@ describe('Directive: leaflet', function() {
return scope.markers = mainMarkers;
});
- it('watches marker icon bindings', function() {
+ it('watches marker icon bindings', function () {
var element;
var icon;
var markers;
element = angular.element('');
element = $compile(element)(scope);
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
@@ -853,13 +853,13 @@ describe('Directive: leaflet', function() {
return expect(markers.m1.options.icon.options.iconUrl).toEqual(DEFAULT_URL);
});
- return it('does not watch on markers when watch is disabled', function() {
+ return it('does not watch on markers when watch is disabled', function () {
var element;
var markers;
element = angular.element('');
element = $compile(element)(scope);
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
diff --git a/test/unit/090-eventsDirectiveSpec.js b/test/unit/090-eventsDirectiveSpec.js
index 74d9d29b..de9162b6 100755
--- a/test/unit/090-eventsDirectiveSpec.js
+++ b/test/unit/090-eventsDirectiveSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet', function() {
+describe('Directive: leaflet', function () {
var $compile = null;
var $rootScope = null;
var leafletData = null;
@@ -12,7 +12,7 @@ describe('Directive: leaflet', function() {
var $log = null;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_, _$log_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_, _$log_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
@@ -20,12 +20,12 @@ describe('Directive: leaflet', function() {
$log = _$log_;
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- ['', '1'].forEach(function(mapId) {
- it(mapId + ' should broadcast events from the rootscope when triggered leaflet events', function() {
+ ['', '1'].forEach(function (mapId) {
+ it(mapId + ' should broadcast events from the rootscope when triggered leaflet events', function () {
var element = mapId ? angular.element('') : angular.element('');
element = $compile(element)($rootScope);
var scope = element.scope();
@@ -78,10 +78,10 @@ describe('Directive: leaflet', function() {
if (mapId)
mapId = mapId + '.';
- leafletData.getMap().then(function(map) {
- mapEvents.forEach(function(origEventName) {
+ leafletData.getMap().then(function (map) {
+ mapEvents.forEach(function (origEventName) {
var eventName = 'leafletDirectiveMap.' + mapId + origEventName;
- scope.$on(eventName, function() {
+ scope.$on(eventName, function () {
setEventTrue(origEventName, eventName);
});
@@ -94,7 +94,7 @@ describe('Directive: leaflet', function() {
});
});
- it('invalid MAPID should NOT broadcast events from the rootscope when triggered leaflet events', function() {
+ it('invalid MAPID should NOT broadcast events from the rootscope when triggered leaflet events', function () {
var element = angular.element('');
element = $compile(element)($rootScope);
var scope = element.scope();
@@ -144,10 +144,10 @@ describe('Directive: leaflet', function() {
check[origEventName] = true;
}
- leafletData.getMap().then(function(map) {
- mapEvents.forEach(function(origEventName) {
+ leafletData.getMap().then(function (map) {
+ mapEvents.forEach(function (origEventName) {
var eventName = 'leafletDirectiveMap.2.' + origEventName;
- scope.$on(eventName, function() {
+ scope.$on(eventName, function () {
setEventTrue(origEventName, eventName);
});
@@ -158,7 +158,7 @@ describe('Directive: leaflet', function() {
});
- xit('should NOT broadcast map events from the rootscope if the event-broadcast option is not an object', function() {
+ xit('should NOT broadcast map events from the rootscope if the event-broadcast option 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();
@@ -176,7 +176,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast map events (backward compatibility) from the rootscope if the event-broadcast does not have a map attribute', function() {
+ xit('should broadcast map events (backward compatibility) from the rootscope if the event-broadcast does not have a map attribute', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -189,7 +189,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast map events from the rootscope if the event-broadcast map attribute is not an object', function() {
+ xit('should NOT broadcast map events from the rootscope if the event-broadcast map 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();
@@ -199,7 +199,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast map events from the rootscope if the event-broadcast map attribute does not have logic defined', function() {
+ xit('should broadcast map events from the rootscope if the event-broadcast map 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();
@@ -211,7 +211,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast map events from the rootscope if the event-broadcast map attribute has logic defined but is not "emit" or "broadcast"', function() {
+ xit('should NOT broadcast map events from the rootscope if the event-broadcast map 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();
@@ -224,7 +224,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit map events from the rootscope if the event-broadcast map attribute has logic defined "emit"', function() {
+ xit('should emit map events from the rootscope if the event-broadcast map 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();
@@ -237,7 +237,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast map events from the rootscope if the event-broadcast map attribute has logic defined as "broadcast"', function() {
+ xit('should broadcast map events from the rootscope if the event-broadcast map 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();
@@ -250,7 +250,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast map events from the rootscope if the event-broadcast map attribute has enabled and disabled defined', function() {
+ xit('should NOT broadcast map events from the rootscope if the event-broadcast map 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();
@@ -264,7 +264,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast map events from the rootscope if the event-broadcast map attribute does not have enabled and disabled defined', function() {
+ xit('should NOT broadcast map events from the rootscope if the event-broadcast map 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();
@@ -276,7 +276,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast some map events from the rootscope if the event-broadcast map attribute disables them', function() {
+ xit('should NOT broadcast some map events from the rootscope if the event-broadcast map attribute disables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -289,7 +289,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT emit some map events from the rootscope if the event-broadcast map attribute disables them', function() {
+ xit('should NOT emit some map events from the rootscope if the event-broadcast map attribute disables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -302,7 +302,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast some map events from the rootscope if the event-broadcast map attribute enables them', function() {
+ xit('should broadcast some map events from the rootscope if the event-broadcast map attribute enables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -315,7 +315,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit some map events from the rootscope if the event-broadcast map attribute enables them', function() {
+ xit('should emit some map events from the rootscope if the event-broadcast map attribute enables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -328,7 +328,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast some map events from the rootscope if the event-broadcast map attribute disables them although there is an invalid event name', function() {
+ xit('should NOT broadcast some map events from the rootscope if the event-broadcast map 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();
@@ -341,7 +341,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT emit some map events from the rootscope if the event-broadcast map attribute disables them although there is an invalid event name', function() {
+ xit('should NOT emit some map events from the rootscope if the event-broadcast map 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();
@@ -354,7 +354,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast some map events from the rootscope if the event-broadcast map attribute enables them although there is an invalid event name', function() {
+ xit('should broadcast some map events from the rootscope if the event-broadcast map 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();
@@ -367,7 +367,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit some map events from the rootscope if the event-broadcast map attribute enables them although there is an invalid event name', function() {
+ xit('should emit some map events from the rootscope if the event-broadcast map 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();
@@ -380,7 +380,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast marker events (backward compatibility) from the rootscope if the event-broadcast does not have a marker attribute', function() {
+ xit('should broadcast marker events (backward compatibility) from the rootscope if the event-broadcast does not have a marker attribute', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -393,7 +393,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker attribute is not an object', function() {
+ xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker 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();
@@ -403,7 +403,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast marker events from the rootscope if the event-broadcast marker attribute does not have logic defined', function() {
+ xit('should broadcast marker events from the rootscope if the event-broadcast marker 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();
@@ -415,7 +415,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker attribute has logic defined but is not "emit" or "broadcast"', function() {
+ xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker 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();
@@ -428,7 +428,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit marker events from the rootscope if the event-broadcast marker attribute has logic defined "emit"', function() {
+ xit('should emit marker events from the rootscope if the event-broadcast marker 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();
@@ -441,7 +441,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast marker events from the rootscope if the event-broadcast marker attribute has logic defined as "broadcast"', function() {
+ xit('should broadcast marker events from the rootscope if the event-broadcast marker 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();
@@ -454,7 +454,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker attribute has enabled and disabled defined', function() {
+ xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker 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();
@@ -468,7 +468,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker attribute does not have enabled and disabled defined', function() {
+ xit('should NOT broadcast marker events from the rootscope if the event-broadcast marker 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();
@@ -480,7 +480,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast some marker events from the rootscope if the event-broadcast marker attribute disables them', function() {
+ xit('should NOT broadcast some marker events from the rootscope if the event-broadcast marker attribute disables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -493,7 +493,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT emit some marker events from the rootscope if the event-broadcast marker attribute disables them', function() {
+ xit('should NOT emit some marker events from the rootscope if the event-broadcast marker attribute disables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -506,7 +506,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast some marker events from the rootscope if the event-broadcast marker attribute enables them', function() {
+ xit('should broadcast some marker events from the rootscope if the event-broadcast marker attribute enables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -519,7 +519,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit some marker events from the rootscope if the event-broadcast marker attribute enables them', function() {
+ xit('should emit some marker events from the rootscope if the event-broadcast marker attribute enables them', function () {
//TODO: pending until problems resolved, see issue #137 in
// https://github.com/tombatossals/angular-leaflet-directive
var $scope = $rootScope.$new();
@@ -532,7 +532,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast some marker events from the rootscope if the event-broadcast marker attribute disables them although there is an invalid event name', function() {
+ xit('should NOT broadcast some marker events from the rootscope if the event-broadcast marker 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();
@@ -545,7 +545,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT emit some marker events from the rootscope if the event-broadcast marker attribute disables them although there is an invalid event name', function() {
+ xit('should NOT emit some marker events from the rootscope if the event-broadcast marker 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();
@@ -558,7 +558,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast some marker events from the rootscope if the event-broadcast marker attribute enables them although there is an invalid event name', function() {
+ xit('should broadcast some marker events from the rootscope if the event-broadcast marker 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();
@@ -571,7 +571,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit some marker events from the rootscope if the event-broadcast marker attribute enables them although there is an invalid event name', function() {
+ xit('should emit some marker events from the rootscope if the event-broadcast marker 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();
@@ -588,7 +588,7 @@ describe('Directive: leaflet', function() {
// ***************************************************************************
//
- xit('should broadcast path events (backward compatibility) from the rootscope if the event-broadcast does not have a path attribute', function() {
+ xit('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();
@@ -601,7 +601,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast path events from the rootscope if the event-broadcast path attribute is not an object', function() {
+ xit('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();
@@ -611,7 +611,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast path events from the rootscope if the event-broadcast path attribute does not have logic defined', function() {
+ xit('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();
@@ -623,7 +623,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast path events from the rootscope if the event-broadcast path attribute has logic defined but is not "emit" or "broadcast"', function() {
+ xit('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();
@@ -636,7 +636,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit path events from the rootscope if the event-broadcast path attribute has logic defined "emit"', function() {
+ xit('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();
@@ -649,7 +649,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast path events from the rootscope if the event-broadcast path attribute has logic defined as "broadcast"', function() {
+ xit('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();
@@ -662,7 +662,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast path events from the rootscope if the event-broadcast path attribute has enabled and disabled defined', function() {
+ xit('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();
@@ -676,7 +676,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast path events from the rootscope if the event-broadcast path attribute does not have enabled and disabled defined', function() {
+ xit('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();
@@ -688,7 +688,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT broadcast some path events from the rootscope if the event-broadcast path attribute disables them', function() {
+ xit('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();
@@ -701,7 +701,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should NOT emit some path events from the rootscope if the event-broadcast path attribute disables them', function() {
+ xit('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();
@@ -714,7 +714,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast some path events from the rootscope if the event-broadcast path attribute enables them', function() {
+ xit('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();
@@ -727,7 +727,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit some path events from the rootscope if the event-broadcast path attribute enables them', function() {
+ xit('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();
@@ -740,7 +740,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('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() {
+ xit('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();
@@ -753,7 +753,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('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() {
+ xit('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();
@@ -766,7 +766,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should broadcast some path events from the rootscope if the event-broadcast path attribute enables them although there is an invalid event name', function() {
+ xit('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();
@@ -779,7 +779,7 @@ describe('Directive: leaflet', function() {
expect(true).toBe(true);
});
- xit('should emit some path events from the rootscope if the event-broadcast path attribute enables them although there is an invalid event name', function() {
+ xit('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();
@@ -796,7 +796,7 @@ describe('Directive: leaflet', function() {
// ***************************************************************************
//
- xit('should broadcast label events', function() {
+ xit('should broadcast label events', function () {
spyOn($rootScope, '$broadcast');
spyOn(leafletHelpers.LabelPlugin, 'isLoaded').and.returnValue(true);
L.Label = L.Class.extend({
@@ -804,7 +804,7 @@ describe('Directive: leaflet', function() {
});
L.BaseMarkerMethods = {
- bindLabel: function(content, options) {
+ bindLabel: function (content, options) {
this.label = new L.Label(options, this);
return this;
},
@@ -833,7 +833,7 @@ describe('Directive: leaflet', function() {
var element = angular.element('');
$compile(element)($rootScope);
$rootScope.$digest();
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
leafletMarkers.marker.label.fireEvent('mouseover');
});
diff --git a/test/unit/layersDirective/layersDirective.creationSpec.js b/test/unit/layersDirective/layersDirective.creationSpec.js
index 6a55e389..ca56a0f8 100755
--- a/test/unit/layersDirective/layersDirective.creationSpec.js
+++ b/test/unit/layersDirective/layersDirective.creationSpec.js
@@ -3,25 +3,25 @@
/*jshint -W117 */
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet: layers.creation', function() {
+describe('Directive: leaflet: layers.creation', function () {
var $compile;
var $rootScope;
var leafletData;
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should not create layers if not specified', function() {
+ it('should not create layers if not specified', function () {
angular.extend(scope, {
layers: {},
});
@@ -30,12 +30,12 @@ describe('Directive: leaflet: layers.creation', function() {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers).toBe({});
});
});
- it('miss-configured layers persist', function() {
+ it('miss-configured layers persist', function () {
var nolayers = {
baselayers: {},
overlays: {},
@@ -48,12 +48,12 @@ describe('Directive: leaflet: layers.creation', function() {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers).toEqual(nolayers);
});
});
- it('should create layers if baselayers is defined with data', function() {
+ it('should create layers if baselayers is defined with data', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -65,13 +65,13 @@ describe('Directive: leaflet: layers.creation', function() {
var element = angular.element('');
element = $compile(element)(scope);
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers).not.toBe(undefined);
expect(layers.baselayers).toEqual({});
});
});
- it('should create one layer if correctly configured', function() {
+ it('should create one layer if correctly configured', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -93,17 +93,17 @@ describe('Directive: leaflet: layers.creation', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(map.hasLayer(layers.baselayers.osm)).toBe(true);
});
});
- it('should create image overlay layer if correctly configured', function() {
+ it('should create image overlay layer if correctly configured', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -120,17 +120,17 @@ describe('Directive: leaflet: layers.creation', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(map.hasLayer(layers.baselayers.imageOverlay)).toBe(true);
});
});
- it('should create two layers if correctly configured', function() {
+ it('should create two layers if correctly configured', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -162,19 +162,19 @@ describe('Directive: leaflet: layers.creation', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(Object.keys(layers.baselayers).length).toEqual(2);
expect(map.hasLayer(layers.baselayers.cycle)).toBe(true);
expect(map.hasLayer(layers.baselayers.osm)).toBe(false);
});
});
- it('should create two different type layers if correctly configured', function() {
+ it('should create two different type layers if correctly configured', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -203,12 +203,12 @@ describe('Directive: leaflet: layers.creation', function() {
});
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(Object.keys(layers.baselayers).length).toEqual(2);
});
});
- it('should refuse to create malformed layers', function() {
+ it('should refuse to create malformed layers', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -298,7 +298,7 @@ describe('Directive: leaflet: layers.creation', function() {
});
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(Object.keys(layers.baselayers).length).toEqual(0);
});
});
diff --git a/test/unit/layersDirective/layersDirective.overlays.markersSpec.js b/test/unit/layersDirective/layersDirective.overlays.markersSpec.js
index dc7d1de2..d190f936 100644
--- a/test/unit/layersDirective/layersDirective.overlays.markersSpec.js
+++ b/test/unit/layersDirective/layersDirective.overlays.markersSpec.js
@@ -6,8 +6,8 @@ jshint globalstrict: true
jasmine specs for directives go here
*/
-(function() {
- describe('Directive: leaflet: layers.overlays.markers', function() {
+(function () {
+ describe('Directive: leaflet: layers.overlays.markers', function () {
var $compile;
var $q;
var $rootScope;
@@ -16,9 +16,9 @@ jasmine specs for directives go here
var leafletMarkersHelper;
var scope;
$timeout = $q = scope = leafletData = $rootScope = $compile = leafletMarkersHelper = void 0;
- beforeEach(function() {
+ beforeEach(function () {
module('leaflet-directive');
- return inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletMarkersHelpers_, _$q_, _$timeout_) {
+ return inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletMarkersHelpers_, _$q_, _$timeout_) {
$timeout = _$timeout_;
window.ngLeafLetTestGlobals.$timeout = $timeout;
$q = _$q_;
@@ -30,14 +30,14 @@ jasmine specs for directives go here
});
});
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
if (!scope.$$phase) {
return $rootScope.$apply();
}
}));
- describe('marker isNested', function() {
- it('should check for a marker in the layer group that is visible', function(done) {
+ describe('marker isNested', function () {
+ it('should check for a marker in the layer group that is visible', function (done) {
var element;
angular.extend(scope, {
layers: {
@@ -76,8 +76,8 @@ jasmine specs for directives go here
});
element = angular.element('');
element = $compile(element)(scope);
- return this.digest($rootScope, function() {
- return $q.all([leafletData.getMap(), leafletData.getMarkers(), leafletData.getLayers()]).then(function(promiseArray) {
+ return this.digest($rootScope, function () {
+ return $q.all([leafletData.getMap(), leafletData.getMarkers(), leafletData.getLayers()]).then(function (promiseArray) {
var layers;
var map;
var markerToCheck;
@@ -94,7 +94,7 @@ jasmine specs for directives go here
});
});
- return it('should check for a marker in a wrong layer group', function() {
+ return it('should check for a marker in a wrong layer group', function () {
var element;
angular.extend(scope, {
layers: {
@@ -129,14 +129,14 @@ jasmine specs for directives go here
});
element = angular.element('');
element = $compile(element)(scope);
- return leafletData.getMarkers().then(function(markers) {
+ return leafletData.getMarkers().then(function (markers) {
return expect(Object.keys(markers).length).toEqual(0);
});
});
});
- return describe('marker', function() {
- it('should check for a marker in the layer group that is visible', function() {
+ return describe('marker', function () {
+ it('should check for a marker in the layer group that is visible', function () {
var element;
var map;
var markers;
@@ -173,17 +173,17 @@ jasmine specs for directives go here
element = angular.element('');
element = $compile(element)(scope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
markers = void 0;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
return markers = leafletMarkers;
});
scope.$digest();
- return leafletData.getLayers().then(function(layers) {
+ return leafletData.getLayers().then(function (layers) {
expect(Object.keys(markers).length).toEqual(1);
expect(markers.m1 instanceof L.Marker).toBe(true);
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(true);
@@ -191,7 +191,7 @@ jasmine specs for directives go here
});
});
- it('should check for a marker in a wrong layer group', function() {
+ it('should check for a marker in a wrong layer group', function () {
var element;
angular.extend(scope, {
layers: {
@@ -225,12 +225,12 @@ jasmine specs for directives go here
});
element = angular.element('');
element = $compile(element)(scope);
- return leafletData.getMarkers().then(function(markers) {
+ return leafletData.getMarkers().then(function (markers) {
return expect(Object.keys(markers).length).toEqual(0);
});
});
- return it('should check for a marker the old way', function() {
+ return it('should check for a marker the old way', function () {
var element;
var map;
angular.extend(scope, {
@@ -265,12 +265,12 @@ jasmine specs for directives go here
element = angular.element('');
element = $compile(element)(scope);
map = void 0;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
return map = leafletMap;
});
scope.$digest();
- return leafletData.getMarkers().then(function(markers) {
+ return leafletData.getMarkers().then(function (markers) {
expect(Object.keys(markers).length).toEqual(1);
return expect(map.hasLayer(markers.m1)).toBe(true);
});
diff --git a/test/unit/layersDirective/layersDirective.overlays.pathsSpec.js b/test/unit/layersDirective/layersDirective.overlays.pathsSpec.js
index e9429e32..4d3280ba 100755
--- a/test/unit/layersDirective/layersDirective.overlays.pathsSpec.js
+++ b/test/unit/layersDirective/layersDirective.overlays.pathsSpec.js
@@ -3,25 +3,25 @@
/*jshint -W117 */
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet: layers.overlays', function() {
+describe('Directive: leaflet: layers.overlays', function () {
var $compile;
var $rootScope;
var leafletData;
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should check for a path in the layer group that is not visible', function() {
+ it('should check for a path in the layer group that is not visible', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -64,25 +64,25 @@ describe('Directive: leaflet: layers.overlays', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var paths;
- leafletData.getPaths().then(function(leafletPaths) {
+ leafletData.getPaths().then(function (leafletPaths) {
paths = leafletPaths;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(Object.keys(paths).length).toEqual(1);
expect(layers.overlays.lines.hasLayer(paths.p1)).toBe(true);
expect(map.hasLayer(paths.p1)).toBe(false);
});
});
- it('should check for a path in the layer group that is visible', function() {
+ it('should check for a path in the layer group that is visible', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -125,25 +125,25 @@ describe('Directive: leaflet: layers.overlays', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var paths;
- leafletData.getPaths().then(function(leafletPaths) {
+ leafletData.getPaths().then(function (leafletPaths) {
paths = leafletPaths;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(Object.keys(paths).length).toEqual(1);
expect(layers.overlays.lines.hasLayer(paths.p1)).toBe(true);
expect(map.hasLayer(paths.p1)).toBe(true);
});
});
- it('should check for a path in a wrong layer group', function() {
+ it('should check for a path in a wrong layer group', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -185,7 +185,7 @@ describe('Directive: leaflet: layers.overlays', function() {
});
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getPaths().then(function(paths) {
+ leafletData.getPaths().then(function (paths) {
expect(Object.keys(paths).length).toEqual(0);
});
});
diff --git a/test/unit/layersDirective/layersDirective.overlaysSpec.js b/test/unit/layersDirective/layersDirective.overlaysSpec.js
index 15fc5e9c..82904986 100755
--- a/test/unit/layersDirective/layersDirective.overlaysSpec.js
+++ b/test/unit/layersDirective/layersDirective.overlaysSpec.js
@@ -3,25 +3,25 @@
/*jshint -W117 */
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet: layers.overlays', function() {
+describe('Directive: leaflet: layers.overlays', function () {
var $compile;
var $rootScope;
var leafletData;
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should create overlays as specified', function() {
+ it('should create overlays as specified', function () {
// As overlays are optional, if we create a valid baselayer must create an empty overlay object
angular.extend(scope, {
layers: {
@@ -41,7 +41,7 @@ describe('Directive: leaflet: layers.overlays', function() {
});
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers.overlays).not.toBe(null);
expect(typeof layers.overlays).toBe('object');
expect(Object.keys(layers.overlays).length).toEqual(0);
@@ -49,7 +49,7 @@ describe('Directive: leaflet: layers.overlays', function() {
});
// Also when creating an empty overlay
- it('should create and empty overlay', function() {
+ it('should create and empty overlay', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -69,14 +69,14 @@ describe('Directive: leaflet: layers.overlays', function() {
});
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers.overlays).not.toBe(null);
expect(typeof layers.overlays).toBe('object');
expect(Object.keys(layers.overlays).length).toEqual(0);
});
});
- it('should create one correct and one incorrect overlay', function() {
+ it('should create one correct and one incorrect overlay', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -118,14 +118,14 @@ describe('Directive: leaflet: layers.overlays', function() {
},
});
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
scope.$digest();
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers.overlays).not.toBe(null);
expect(typeof layers.overlays).toBe('object');
expect(Object.keys(layers.overlays).length).toEqual(1);
@@ -135,7 +135,7 @@ describe('Directive: leaflet: layers.overlays', function() {
});
});
- it('should create correct overlays', function() {
+ it('should create correct overlays', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -177,7 +177,7 @@ describe('Directive: leaflet: layers.overlays', function() {
},
});
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
@@ -185,7 +185,7 @@ describe('Directive: leaflet: layers.overlays', function() {
var element = angular.element('');
element = $compile(element)(scope);
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers.overlays).not.toBe(null);
expect(typeof layers.overlays).toBe('object');
expect(Object.keys(layers.overlays).length).toEqual(2);
@@ -195,8 +195,8 @@ describe('Directive: leaflet: layers.overlays', function() {
});
});
- describe('groups', function() {
- it('should check for layer group', function() {
+ describe('groups', function () {
+ it('should check for layer group', function () {
// Check for layer group
angular.extend(scope, {
layers: {
@@ -224,13 +224,13 @@ describe('Directive: leaflet: layers.overlays', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers.overlays).not.toBe(null);
expect(typeof layers.overlays).toBe('object');
expect(Object.keys(layers.overlays).length).toEqual(1);
@@ -241,7 +241,7 @@ describe('Directive: leaflet: layers.overlays', function() {
});
});
- it('should check for feature group', function() {
+ it('should check for feature group', function () {
// Check for layer group
angular.extend(scope, {
layers: {
@@ -269,13 +269,13 @@ describe('Directive: leaflet: layers.overlays', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(layers.overlays).not.toBe(null);
expect(typeof layers.overlays).toBe('object');
expect(Object.keys(layers.overlays).length).toEqual(1);
@@ -286,7 +286,7 @@ describe('Directive: leaflet: layers.overlays', function() {
});
});
- it('should check for a marker in the layer group that is not visible', function() {
+ it('should check for a marker in the layer group that is not visible', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -320,18 +320,18 @@ describe('Directive: leaflet: layers.overlays', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
scope.$digest();
- leafletData.getLayers().then(function(layers) {
+ leafletData.getLayers().then(function (layers) {
expect(Object.keys(markers).length).toEqual(1);
expect(markers.m1 instanceof L.Marker).toBe(true);
expect(layers.overlays.cars.hasLayer(markers.m1)).toBe(true);
diff --git a/test/unit/layersDirective/layersDirective.twomapsSpec.js b/test/unit/layersDirective/layersDirective.twomapsSpec.js
index 0cc65e4c..5525c9f2 100755
--- a/test/unit/layersDirective/layersDirective.twomapsSpec.js
+++ b/test/unit/layersDirective/layersDirective.twomapsSpec.js
@@ -3,25 +3,25 @@
/*jshint -W117 */
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet', function() {
+describe('Directive: leaflet', function () {
var $compile;
var $rootScope;
var leafletData;
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should have two maps with distinct layers', function() {
+ it('should have two maps with distinct layers', function () {
var scope2 = $rootScope.$new();
angular.extend(scope, {
layers1: {
@@ -95,15 +95,15 @@ describe('Directive: leaflet', function() {
scope.$digest();
scope2.$digest();
- leafletData.getMap('map1').then(function(map) {
- leafletData.getLayers('map1').then(function(layers) {
+ leafletData.getMap('map1').then(function (map) {
+ leafletData.getLayers('map1').then(function (layers) {
expect(map.hasLayer(layers.overlays.shapes2)).toBe(false);
expect(map.hasLayer(layers.overlays.shapes1)).toBe(true);
});
});
- leafletData.getMap('map2').then(function(map) {
- leafletData.getLayers('map2').then(function(layers) {
+ leafletData.getMap('map2').then(function (map) {
+ leafletData.getLayers('map2').then(function (layers) {
expect(map.hasLayer(layers.overlays.shapes1)).toBe(false);
expect(map.hasLayer(layers.overlays.shapes2)).toBe(true);
});
@@ -111,7 +111,7 @@ describe('Directive: leaflet', function() {
});
- it('should have two maps with distinct markers', function() {
+ it('should have two maps with distinct markers', function () {
var scope2 = $rootScope.$new();
angular.extend(scope, {
layers1: {
@@ -185,13 +185,13 @@ describe('Directive: leaflet', function() {
scope.$digest();
scope2.$digest();
- leafletData.getMap('map1').then(function(map) {
+ leafletData.getMap('map1').then(function (map) {
var markers;
- leafletData.getMarkers('map1').then(function(leafletMarkers) {
+ leafletData.getMarkers('map1').then(function (leafletMarkers) {
markers = leafletMarkers;
});
- leafletData.getLayers('map1').then(function(layers) {
+ leafletData.getLayers('map1').then(function (layers) {
expect(Object.keys(markers).length).toEqual(1);
expect(markers.m1 instanceof L.Marker).toBe(true);
expect(markers.m2 instanceof L.Marker).toBe(false);
@@ -202,13 +202,13 @@ describe('Directive: leaflet', function() {
});
});
- leafletData.getMap('map2').then(function(map) {
+ leafletData.getMap('map2').then(function (map) {
var markers;
- leafletData.getMarkers('map2').then(function(leafletMarkers) {
+ leafletData.getMarkers('map2').then(function (leafletMarkers) {
markers = leafletMarkers;
});
- leafletData.getLayers('map2').then(function(layers) {
+ leafletData.getLayers('map2').then(function (layers) {
expect(Object.keys(markers).length).toEqual(1);
expect(markers.m1 instanceof L.Marker).toBe(false);
expect(markers.m2 instanceof L.Marker).toBe(true);
diff --git a/test/unit/layersDirective/layersDirective.watch.markersSpec.js b/test/unit/layersDirective/layersDirective.watch.markersSpec.js
index 16a02fd2..b711440d 100755
--- a/test/unit/layersDirective/layersDirective.watch.markersSpec.js
+++ b/test/unit/layersDirective/layersDirective.watch.markersSpec.js
@@ -3,25 +3,25 @@
/*jshint -W117 */
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet: layers.watch.markers', function() {
+describe('Directive: leaflet: layers.watch.markers', function () {
var $compile;
var $rootScope;
var leafletData;
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should add and remove layers in watch', function() {
+ it('should add and remove layers in watch', function () {
// If we not provide layers the system will use the default
angular.extend(scope, {
layers: {
@@ -53,7 +53,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -88,7 +88,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
expect(Object.keys(layers.baselayers).length).toEqual(0);
});
- it('should add and remove overlays in watch', function() {
+ it('should add and remove overlays in watch', function () {
// Create correct overlays
angular.extend(scope, {
layers: {
@@ -134,7 +134,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
element = $compile(element)(scope);
scope.$digest();
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -178,7 +178,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
expect(typeof layers.overlays.fire).toBe('object');
});
- it('should add and remove markers in overlays in watch 1', function() {
+ it('should add and remove markers in overlays in watch 1', function () {
// Check for a marker remove in a layer group
angular.extend(scope, {
layers: {
@@ -218,17 +218,17 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -291,7 +291,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
expect(layers.overlays.trucks.hasLayer(markers.m1)).toBe(true);
});
- it('should add and remove markers in overlays in watch 2', function() {
+ it('should add and remove markers in overlays in watch 2', function () {
// Check for a marker remove in a layer group
angular.extend(scope, {
layers: {
@@ -331,17 +331,17 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -363,7 +363,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
});
// MarkerCluster Layer Plugin
- it('should create a markercluster overlay as specified', function() {
+ it('should create a markercluster overlay as specified', function () {
// Provide a markercluster layer
angular.extend(scope, {
layers: {
@@ -389,17 +389,17 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -413,7 +413,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
});
// MarkerCluster Layer Plugin
- it('should create a visible markercluster overlay as specified', function() {
+ it('should create a visible markercluster overlay as specified', function () {
// Provide a visible markercluster layer
angular.extend(scope, {
layers: {
@@ -440,17 +440,17 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -463,7 +463,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
expect(map.hasLayer(layers.overlays.cars)).toBe(true);
});
- it('should create a visible markercluster layer with options empty', function() {
+ it('should create a visible markercluster layer with options empty', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -490,17 +490,17 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -520,7 +520,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
//expect(layers.overlays.cars.options.removeOutsideVisibleBounds).toBe(true);
});
- it('should create a visible markercluster layer with options', function() {
+ it('should create a visible markercluster layer with options', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -550,17 +550,17 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -582,7 +582,7 @@ describe('Directive: leaflet: layers.watch.markers', function() {
expect(layers.overlays.cars.options.disableClusteringAtZoom).toEqual(18);
});
- it('should create a visible markercluster layer with options and layers', function() {
+ it('should create a visible markercluster layer with options and layers', function () {
angular.extend(scope, {
layers: {
baselayers: {
@@ -624,17 +624,17 @@ describe('Directive: leaflet: layers.watch.markers', function() {
var element = angular.element('');
element = $compile(element)(scope);
var map;
- leafletData.getMap().then(function(leafletMap) {
+ leafletData.getMap().then(function (leafletMap) {
map = leafletMap;
});
var markers;
- leafletData.getMarkers().then(function(leafletMarkers) {
+ leafletData.getMarkers().then(function (leafletMarkers) {
markers = leafletMarkers;
});
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
diff --git a/test/unit/layersDirective/layersDirective.watchSpec.js b/test/unit/layersDirective/layersDirective.watchSpec.js
index edad0d8a..1a642af0 100755
--- a/test/unit/layersDirective/layersDirective.watchSpec.js
+++ b/test/unit/layersDirective/layersDirective.watchSpec.js
@@ -3,25 +3,25 @@
/*jshint -W117 */
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Directive: leaflet: layers.watch', function() {
+describe('Directive: leaflet: layers.watch', function () {
var $compile;
var $rootScope;
var leafletData;
var scope;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
leafletData = _leafletData_;
scope = $rootScope.$new();
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should add and remove layers in watch', function() {
+ it('should add and remove layers in watch', function () {
// If we not provide layers the system will use the default
angular.extend(scope, {
layers: {
@@ -53,7 +53,7 @@ describe('Directive: leaflet: layers.watch', function() {
var element = angular.element('');
element = $compile(element)(scope);
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -88,7 +88,7 @@ describe('Directive: leaflet: layers.watch', function() {
expect(Object.keys(layers.baselayers).length).toEqual(0);
});
- it('should add and remove overlays in watch', function() {
+ it('should add and remove overlays in watch', function () {
// Create correct overlays
angular.extend(scope, {
layers: {
@@ -134,7 +134,7 @@ describe('Directive: leaflet: layers.watch', function() {
element = $compile(element)(scope);
scope.$digest();
var layers;
- leafletData.getLayers().then(function(leafletLayers) {
+ leafletData.getLayers().then(function (leafletLayers) {
layers = leafletLayers;
});
@@ -183,7 +183,7 @@ describe('Directive: leaflet: layers.watch', function() {
scope.layers.overlays.countries = {
name: 'Countries',
type: 'geoJSONShape',
- data: {type: 'FeatureCollection',
+ data: { type: 'FeatureCollection',
features: [{
type:'Feature',
geometry: {
diff --git a/test/unit/leafletData/leafletDataService.DirectiveControlsSpec.js b/test/unit/leafletData/leafletDataService.DirectiveControlsSpec.js
index f08e29a2..6f5ca918 100644
--- a/test/unit/leafletData/leafletDataService.DirectiveControlsSpec.js
+++ b/test/unit/leafletData/leafletDataService.DirectiveControlsSpec.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.10.0
-(function() {
- describe('leafletData directiveControls', function() {
+(function () {
+ describe('leafletData directiveControls', function () {
var $compile;
var $rootScope;
var geojsonData;
@@ -8,10 +8,10 @@
var leafletHelpers;
var mainLayers;
geojsonData = mainLayers = leafletHelpers = leafletData = $rootScope = $compile = void 0;
- beforeEach(function() {
+ beforeEach(function () {
var mainMarkers;
module('leaflet-directive');
- inject(function(_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletHelpers_) {
+ inject(function (_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletHelpers_) {
var $timeout;
$compile = _$compile_;
$rootScope = _$rootScope_;
@@ -45,7 +45,7 @@
},
],
};
- return this.testRunner = function(postRunnerCb, preRunnerCb) {
+ return this.testRunner = function (postRunnerCb, preRunnerCb) {
var element;
var preRunnerRet;
angular.extend($rootScope, {
@@ -65,7 +65,7 @@
element = angular.element('');
element = $compile(element)($rootScope);
$rootScope.$digest();
- return leafletData.getDirectiveControls().then(function(controls) {
+ return leafletData.getDirectiveControls().then(function (controls) {
if (postRunnerCb) {
return postRunnerCb(controls);
}
@@ -73,31 +73,31 @@
};
});
- describe('markers controls', function() {
- beforeEach(function() {
+ describe('markers controls', function () {
+ beforeEach(function () {
return this.rootName = 'markers';
});
- return describe('exists', function() {
- it('root', function() {
- return this.testRunner((function(_this) {
- return function(controls) {
+ return describe('exists', function () {
+ it('root', function () {
+ return this.testRunner((function (_this) {
+ return function (controls) {
return expect(controls[_this.rootName]).toBeDefined();
};
})(this));
});
- it('create', function() {
- return this.testRunner((function(_this) {
- return function(controls) {
+ it('create', function () {
+ return this.testRunner((function (_this) {
+ return function (controls) {
return expect(controls[_this.rootName].create).toBeDefined();
};
})(this));
});
- return it('clean', function() {
- return this.testRunner((function(_this) {
- return function(controls) {
+ return it('clean', function () {
+ return this.testRunner((function (_this) {
+ return function (controls) {
return expect(controls[_this.rootName].clean).toBeDefined();
};
})(this));
@@ -105,31 +105,31 @@
});
});
- return describe('geojson controls', function() {
- beforeEach(function() {
+ return describe('geojson controls', function () {
+ beforeEach(function () {
return this.rootName = 'geojson';
});
- return describe('exists', function() {
- it('root', function() {
- return this.testRunner((function(_this) {
- return function(controls) {
+ return describe('exists', function () {
+ it('root', function () {
+ return this.testRunner((function (_this) {
+ return function (controls) {
return expect(controls[_this.rootName]).toBeDefined();
};
})(this));
});
- it('create', function() {
- return this.testRunner((function(_this) {
- return function(controls) {
+ it('create', function () {
+ return this.testRunner((function (_this) {
+ return function (controls) {
return expect(controls[_this.rootName].create).toBeDefined();
};
})(this));
});
- return it('clean', function() {
- return this.testRunner((function(_this) {
- return function(controls) {
+ return it('clean', function () {
+ return this.testRunner((function (_this) {
+ return function (controls) {
return expect(controls[_this.rootName].clean).toBeDefined();
};
})(this));
diff --git a/test/unit/leafletData/leafletDataSpec.js b/test/unit/leafletData/leafletDataSpec.js
index 388f4ec7..c8127d93 100644
--- a/test/unit/leafletData/leafletDataSpec.js
+++ b/test/unit/leafletData/leafletDataSpec.js
@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.10.0
-(function() {
- describe('leafletData', function() {
+(function () {
+ describe('leafletData', function () {
var $compile;
var $q;
var $rootScope;
@@ -9,9 +9,9 @@
var leafletHelpers;
var mainLayers;
$q = geojsonData = mainLayers = leafletHelpers = leafletData = $rootScope = $compile = void 0;
- beforeEach(function() {
+ beforeEach(function () {
module('leaflet-directive');
- return inject(function(_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletHelpers_, _$q_) {
+ return inject(function (_$compile_, _$rootScope_, _$timeout_, _leafletData_, _leafletHelpers_, _$q_) {
var $timeout;
$q = _$q_;
$compile = _$compile_;
@@ -22,27 +22,27 @@
});
});
- return describe('no mapId', function() {
- beforeEach(function() {
+ return describe('no mapId', function () {
+ beforeEach(function () {
this.knownMarkers = [1, 2, 3];
this.knownGeoJSON = ['1', '2', '3'];
return this.setPromise = $q.all([leafletData.setMarkers(this.knownMarkers), leafletData.setGeoJSON(this.knownGeoJSON)]);
});
- it('has unique data', function(done) {
+ it('has unique data', function (done) {
var _allGet;
var _geoJSON;
var _markers;
_geoJSON = null;
_markers = null;
_allGet = null;
- this.digest($rootScope, (function(_this) {
- return function() {
- return _this.setPromise.then(function() {
+ this.digest($rootScope, (function (_this) {
+ return function () {
+ return _this.setPromise.then(function () {
return _allGet = $q.all([
- leafletData.getMarkers().then(function(lObjs) {
+ leafletData.getMarkers().then(function (lObjs) {
return _markers = lObjs;
- }, leafletData.getGeoJSON().then(function(lObjs) {
+ }, leafletData.getGeoJSON().then(function (lObjs) {
return _geoJSON = lObjs;
})),
]);
@@ -50,9 +50,9 @@
};
})(this));
- return this.digest($rootScope, (function(_this) {
- return function() {
- return _allGet.then(function() {
+ return this.digest($rootScope, (function (_this) {
+ return function () {
+ return _allGet.then(function () {
expect(_this.knownMarkers).toBe(_markers);
expect(_this.knownGeoJSON).toBe(_geoJSON);
expect(_geoJSON !== _markers).toBeTruthy();
@@ -62,7 +62,7 @@
})(this));
});
- return it('modifying localScope modifies leafletData\'s version', function(done) {
+ return it('modifying localScope modifies leafletData\'s version', function (done) {
var _allGet;
var _geoJSON;
var _markers;
@@ -72,13 +72,13 @@
this.knownMarkers.push(4);
this.knownGeoJSON.push('4');
console.log($q);
- this.digest($rootScope, (function(_this) {
- return function() {
- return _this.setPromise.then(function() {
+ this.digest($rootScope, (function (_this) {
+ return function () {
+ return _this.setPromise.then(function () {
return _allGet = $q.all([
- leafletData.getMarkers().then(function(lObjs) {
+ leafletData.getMarkers().then(function (lObjs) {
return _markers = lObjs;
- }, leafletData.getGeoJSON().then(function(lObjs) {
+ }, leafletData.getGeoJSON().then(function (lObjs) {
return _geoJSON = lObjs;
})),
]);
@@ -86,9 +86,9 @@
};
})(this));
- return this.digest($rootScope, (function(_this) {
- return function() {
- return _allGet.then(function() {
+ return this.digest($rootScope, (function (_this) {
+ return function () {
+ return _allGet.then(function () {
expect(_this.knownMarkers).toBe(_markers);
expect(_this.knownGeoJSON).toBe(_geoJSON);
expect(_geoJSON !== _markers).toBeTruthy();
diff --git a/test/unit/plugin/markerPluginVectorMarkersSpec.js b/test/unit/plugin/markerPluginVectorMarkersSpec.js
index 80951566..8b01ada4 100644
--- a/test/unit/plugin/markerPluginVectorMarkersSpec.js
+++ b/test/unit/plugin/markerPluginVectorMarkersSpec.js
@@ -4,7 +4,7 @@
/*jshint globalstrict: true*/
/* jasmine specs for directives go here */
-describe('Plugin: VectorMarkers', function() {
+describe('Plugin: VectorMarkers', function () {
var $compile;
var $rootScope;
var scope;
@@ -12,7 +12,7 @@ describe('Plugin: VectorMarkers', function() {
var leafletHelpers;
beforeEach(module('leaflet-directive'));
- beforeEach(inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_) {
+ beforeEach(inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
scope = $rootScope.$new();
@@ -20,18 +20,18 @@ describe('Plugin: VectorMarkers', function() {
leafletHelpers = _leafletHelpers_;
}));
- afterEach(inject(function($rootScope) {
+ afterEach(inject(function ($rootScope) {
$rootScope.$apply();
}));
- it('should load plugin for the vector markers', function() {
+ it('should load plugin for the vector markers', function () {
var plugin = leafletHelpers.VectorMarkersPlugin;
expect(plugin).toBeDefined();
expect(plugin.isLoaded()).toBeTruthy();
});
- it('should create a new vector marker', function() {
+ it('should create a new vector marker', function () {
var myMarker = {
lat: 51,
lng: 0,
@@ -54,14 +54,14 @@ describe('Plugin: VectorMarkers', function() {
var plugin = leafletHelpers.VectorMarkersPlugin;
- leafletData.getMarkers().then(function(markers) {
+ leafletData.getMarkers().then(function (markers) {
expect(markers).toBeDefined();
expect(markers.myMarker).toBeDefined();
expect(plugin.is(markers.myMarker.options.icon)).toBeTruthy();
});
});
- it('icon should differ from a common marker\'s icon', function() {
+ it('icon should differ from a common marker\'s icon', function () {
var commonMarker = {
lat: 51,
lng: 0,
@@ -90,7 +90,7 @@ describe('Plugin: VectorMarkers', function() {
var plugin = leafletHelpers.VectorMarkersPlugin;
- leafletData.getMarkers().then(function(markers) {
+ leafletData.getMarkers().then(function (markers) {
expect(markers).toBeDefined();
expect(markers.commonMarker).toBeDefined();
expect(markers.vectorMarker).toBeDefined();
diff --git a/test/unit/services/leafletGeoHelpersSpec.js b/test/unit/services/leafletGeoHelpersSpec.js
index de486f53..a3ef10f2 100644
--- a/test/unit/services/leafletGeoHelpersSpec.js
+++ b/test/unit/services/leafletGeoHelpersSpec.js
@@ -1,24 +1,24 @@
// Generated by CoffeeScript 1.10.0
-(function() {
- describe('leafletGeoJsonHelpers', function() {
- beforeEach(function() {
+(function () {
+ describe('leafletGeoJsonHelpers', function () {
+ beforeEach(function () {
module('leaflet-directive');
- return inject(function(_$compile_, _$rootScope_, _leafletGeoJsonHelpers_) {
+ return inject(function (_$compile_, _$rootScope_, _leafletGeoJsonHelpers_) {
this.$compile = _$compile_;
this.$rootScope = _$rootScope_;
return this.subject = _leafletGeoJsonHelpers_;
});
});
- return describe('should validate coordinates correctly', function() {
- it('basic', function() {
+ return describe('should validate coordinates correctly', function () {
+ it('basic', function () {
expect(this.subject.validateCoords()).toEqual(false);
expect(this.subject.validateCoords([1, 2])).toEqual(true);
return expect(this.subject.validateCoords([])).toEqual(false);
});
- describe('Point', function() {
- return it('type:Point', function() {
+ describe('Point', function () {
+ return it('type:Point', function () {
expect(this.subject.validateCoords({
type: 'Point',
coordinates: [1, 2],
@@ -30,15 +30,15 @@
});
});
- describe('{lat: _ lng: _}', function() {
- it('type:foo, no lat lng', function() {
+ describe('{lat: _ lng: _}', function () {
+ it('type:foo, no lat lng', function () {
return expect(this.subject.validateCoords({
type: 'foo',
coordinates: [],
})).toEqual(false);
});
- it('type:foo, w lat lng', function() {
+ it('type:foo, w lat lng', function () {
return expect(this.subject.validateCoords({
type: 'foo',
lat: 45,
@@ -46,14 +46,14 @@
})).toEqual(true);
});
- it('type:foo, w lat', function() {
+ it('type:foo, w lat', function () {
return expect(this.subject.validateCoords({
type: 'foo',
lat: 45,
})).toEqual(false);
});
- return it('type:foo, w lng', function() {
+ return it('type:foo, w lng', function () {
return expect(this.subject.validateCoords({
type: 'foo',
lng: 150,
@@ -61,26 +61,26 @@
});
});
- describe('isArray', function() {
- it('type:foo, no lat lng', function() {
+ describe('isArray', function () {
+ it('type:foo, no lat lng', function () {
return expect(this.subject.validateCoords([])).toEqual(false);
});
- it('type:foo, w lat lng', function() {
+ it('type:foo, w lat lng', function () {
return expect(this.subject.validateCoords([150, 45])).toEqual(true);
});
- it('type:foo, w lat', function() {
+ it('type:foo, w lat', function () {
return expect(this.subject.validateCoords([null, 45])).toEqual(false);
});
- return it('type:foo, w lng', function() {
+ return it('type:foo, w lng', function () {
return expect(this.subject.validateCoords([150, null])).toEqual(false);
});
});
- return describe('Numeric Checks', function() {
- it('type:Point', function() {
+ return describe('Numeric Checks', function () {
+ it('type:Point', function () {
expect(this.subject.validateCoords({
type: 'Point',
coordinates: ['1', 2],
@@ -91,7 +91,7 @@
})).toEqual(false);
});
- it('type:foo, w lat lng', function() {
+ it('type:foo, w lat lng', function () {
return expect(this.subject.validateCoords({
type: 'foo',
lat: 45,
@@ -99,7 +99,7 @@
})).toEqual(false);
});
- it('type:foo, w lat', function() {
+ it('type:foo, w lat', function () {
return expect(this.subject.validateCoords({
type: 'foo',
lat: '45',
@@ -107,23 +107,23 @@
})).toEqual(false);
});
- it('type:foo, w lng', function() {
+ it('type:foo, w lng', function () {
return expect(this.subject.validateCoords({
type: 'foo',
lng: '150',
})).toEqual(false);
});
- return describe('isArray', function() {
- it('type:foo, w lat lng', function() {
+ return describe('isArray', function () {
+ it('type:foo, w lat lng', function () {
return expect(this.subject.validateCoords(['150', 45])).toEqual(false);
});
- it('type:foo, w lat', function() {
+ it('type:foo, w lat', function () {
return expect(this.subject.validateCoords([150, '45'])).toEqual(false);
});
- return it('type:foo, w lng', function() {
+ return it('type:foo, w lng', function () {
return expect(this.subject.validateCoords(['150', null])).toEqual(false);
});
});
diff --git a/test/unit/services/leafletHelpersSpec.js b/test/unit/services/leafletHelpersSpec.js
index a46320bc..2b37475a 100644
--- a/test/unit/services/leafletHelpersSpec.js
+++ b/test/unit/services/leafletHelpersSpec.js
@@ -1,9 +1,9 @@
// Generated by CoffeeScript 1.10.0
-(function() {
- describe('leafletHelpers', function() {
- beforeEach(function() {
+(function () {
+ describe('leafletHelpers', function () {
+ beforeEach(function () {
module('leaflet-directive');
- return inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_) {
+ return inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletHelpers_) {
this.$compile = _$compile_;
this.$rootScope = _$rootScope_;
this.leafletData = _leafletData_;
@@ -11,68 +11,68 @@
});
});
- describe('isTruthy', function() {
- beforeEach(function() {
+ describe('isTruthy', function () {
+ beforeEach(function () {
return this.subject = this.subject.isTruthy;
});
- describe('is true', function() {
- it('\'true\'', function() {
+ describe('is true', function () {
+ it('\'true\'', function () {
return expect(this.subject('true')).toBeTruthy();
});
- return it('true', function() {
+ return it('true', function () {
return expect(this.subject(true)).toBeTruthy();
});
});
- return describe('is false', function() {
- it('\'false\'', function() {
+ return describe('is false', function () {
+ it('\'false\'', function () {
return expect(this.subject('false')).toBeFalsy();
});
- it('false', function() {
+ it('false', function () {
return expect(this.subject(false)).toBeFalsy();
});
- return it('undefined', function() {
+ return it('undefined', function () {
return expect(this.subject(void 0)).toBeFalsy();
});
});
});
- describe('defaultTo', function() {
- beforeEach(function() {
+ describe('defaultTo', function () {
+ beforeEach(function () {
return this.subject = this.subject.defaultTo;
});
- it('keeps value', function() {
- it('false', function() {
+ it('keeps value', function () {
+ it('false', function () {
return expect(this.subject(false, true)).toBeTruthy();
});
- it('string', function() {
+ it('string', function () {
return expect(this.subject('hi', 'nope')).toBe('hi');
});
- return it('{}', function() {
+ return it('{}', function () {
return expect(this.subject({}, null)).toBe({});
});
});
- return describe('gets default', function() {
- it('undefined', function() {
+ return describe('gets default', function () {
+ it('undefined', function () {
return expect(this.subject(void 0, '')).toBe('');
});
- return it('null', function() {
+ return it('null', function () {
return expect(this.subject(null, '')).toBe('');
});
});
});
- return describe('Object Helpers', function() {
- return it('should correctly fetch object values using dot-notation', function() {
+ return describe('Object Helpers', function () {
+ return it('should correctly fetch object values using dot-notation', function () {
var object;
object = {
foo: {
diff --git a/test/unit/services/leafletIteratorsSpec.js b/test/unit/services/leafletIteratorsSpec.js
index b7b1f084..e2718d6c 100644
--- a/test/unit/services/leafletIteratorsSpec.js
+++ b/test/unit/services/leafletIteratorsSpec.js
@@ -1,9 +1,9 @@
// Generated by CoffeeScript 1.10.0
-(function() {
- describe('leafletIterators', function() {
- beforeEach(function() {
+(function () {
+ describe('leafletIterators', function () {
+ beforeEach(function () {
module('leaflet-directive');
- return inject(function(_$compile_, _$rootScope_, _leafletData_, _leafletIterators_) {
+ return inject(function (_$compile_, _$rootScope_, _leafletData_, _leafletIterators_) {
this.$compile = _$compile_;
this.$rootScope = _$rootScope_;
this.leafletData = _leafletData_;
@@ -11,15 +11,15 @@
});
});
- it('exists', function() {
+ it('exists', function () {
return expect(this.subject).toBeDefined();
});
- return describe('forEach/each', function() {
- return it('prototypes should not be called', function() {
+ return describe('forEach/each', function () {
+ return it('prototypes should not be called', function () {
var d;
var vals;
- var Dummy = (function() {
+ var Dummy = (function () {
function Dummy() {}
Dummy.prototype.prop1 = 'prop1';
@@ -33,7 +33,7 @@
d = new Dummy();
d.prop3 = 'prop3';
vals = [];
- this.subject.each(d, function(val) {
+ this.subject.each(d, function (val) {
return vals.push(val);
});