angular-leaflet-directive
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -9,3 +9,3 @@ { | ||
"leaflet-dist": "0.7.x", | ||
"leaflet.markerclusterer": "0.2" | ||
"leaflet.markerclusterer": "0.4" | ||
}, | ||
@@ -12,0 +12,0 @@ "resolutions": { |
@@ -0,1 +1,24 @@ | ||
<a name="v0.7.1"></a> | ||
## v0.7.1 (2013-12-22) | ||
#### Bug Fixes | ||
* **build:** | ||
* Solved a problem with the render of the Google Maps Layer, reported by @pwoloszu ([73f17c0b](https://github.com/tombatossals/angular-leaflet-directive/commit/73f17c0bab25988151e43fc539630a648cc15835)) | ||
* Removed the center undefined log message as noted by @ngoldman here: https://git ([a41e4efb](https://github.com/tombatossals/angular-leaflet-directive/commit/a41e4efbccb27c83975b135b9c237db1bd80d3d8)) | ||
* **grunt:** Added the e2e protractor tests to the Grunt watch cycle. ([95ac1831](https://github.com/tombatossals/angular-leaflet-directive/commit/95ac183163446f6d9e977bea1db6346ebf3d2152)) | ||
* **libraries:** Updated Leaflet.markercluster to version 0.4 on bower.json. Thanks to @Hyzhak fo ([a7adada0](https://github.com/tombatossals/angular-leaflet-directive/commit/a7adada0679ccea50b7c4b51e87e94e504b7cd96)) | ||
* **test:** Updated e2e tests to pass the jshint validations ([acee2b02](https://github.com/tombatossals/angular-leaflet-directive/commit/acee2b02f1499f7a2beee8d6ebcdc8be0a816dd9)) | ||
* **tests:** Some code updates to the e2e tests ([5e47141b](https://github.com/tombatossals/angular-leaflet-directive/commit/5e47141b04662283e2c1cca4379a093ba40a8d4e)) | ||
#### Features | ||
* **examples:** Make the buttons toggable on the marker-groups-example.html made by @yagoferrer ([0699cf7b](https://github.com/tombatossals/angular-leaflet-directive/commit/0699cf7ba63261c4c8ec39b2cec3af032dce3067)) | ||
* **test:** | ||
* Added a test for the googlemaps-example.html ([98f68c0a](https://github.com/tombatossals/angular-leaflet-directive/commit/98f68c0a0ff82d4317f066679d2707b46f57ec81)) | ||
* Added an e2e test to the custom-parameters-example.html ([3ce6a721](https://github.com/tombatossals/angular-leaflet-directive/commit/3ce6a721a6bfd24158574935dc214871a8c84ef2)) | ||
* Completed e2e tests for the bounds example. ([1c40d605](https://github.com/tombatossals/angular-leaflet-directive/commit/1c40d605553506c2073d6afd70ec6da1b506ec3c)) | ||
<a name="v0.7.0"></a> | ||
@@ -2,0 +25,0 @@ ### v0.7.0 (2013-12-15) |
@@ -30,4 +30,4 @@ /**! | ||
/*! angular-leaflet-directive 15-12-2013 */ | ||
!function(){"use strict";angular.module("leaflet-directive",[]).directive("leaflet",["$q","leafletData","leafletMapDefaults","leafletHelpers","leafletEvents",function(a,b,c,d,e){var f;return{restrict:"EA",replace:!0,scope:{center:"=center",defaults:"=defaults",maxBounds:"=maxbounds",bounds:"=bounds",marker:"=marker",markers:"=markers",legend:"=legend",geojson:"=geojson",paths:"=paths",tiles:"=tiles",layers:"=layers",controls:"=controls",eventBroadcast:"=eventBroadcast"},template:'<div class="angular-leaflet-map"></div>',controller:["$scope",function(b){f=a.defer(),this.getMap=function(){return f.promise},this.getLeafletScope=function(){return b}}],link:function(a,g,h){var i=d.isDefined,j=c.setDefaults(a.defaults,h.id),k=e.genDispatchMapEvent,l=e.getAvailableMapEvents();i(a.maxBounds)&&(j.minZoom=void 0),i(h.width)&&(isNaN(h.width)?g.css("width",h.width):g.css("width",h.width+"px")),i(h.height)&&(isNaN(h.height)?g.css("height",h.height):g.css("height",h.height+"px"));var m=new L.Map(g[0],c.getMapCreationDefaults(h.id));if(f.resolve(m),i(h.center)||m.setView([j.center.lat,j.center.lng],j.center.zoom),!i(h.tiles)&&!i(h.layers)){var n=L.tileLayer(j.tileLayer,j.tileLayerOptions);n.addTo(m),b.setTiles(n)}if(i(m.zoomControl)&&i(j.zoomControlPosition)&&m.zoomControl.setPosition(j.zoomControlPosition),i(m.zoomControl)&&j.zoomControl===!1&&m.zoomControl.removeFrom(m),i(m.zoomsliderControl)&&i(j.zoomsliderControl)&&j.zoomsliderControl===!1&&m.zoomsliderControl.removeFrom(m),!i(h.eventBroadcast))for(var o="broadcast",p=0;p<l.length;p++){var q=l[p];m.on(q,k(a,q,o),{eventName:q})}m.whenReady(function(){b.setMap(m,h.id)})}}}]),angular.module("leaflet-directive").directive("center",["$log","$parse","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i=d.isDefined,j=d.safeApply,k=d.isValidCenter,l=h.getLeafletScope(),m=l.center;h.getMap().then(function(d){var e=c.getDefaults(g.id);if(i(m)){m.autoDiscover===!0&&d.locate({setView:!0,maxZoom:e.maxZoom});var f={lat:b("center.lat"),lng:b("center.lng"),zoom:b("center.zoom")}}else a.warn("[AngularJS - Leaflet] 'center' is undefined in the current scope, did you forget to initialize it?"),d.setView([e.center.lat,e.center.lng],e.center.zoom);var h=!1;l.$watch("center",function(b){return k(b)?(h||d.setView([b.lat,b.lng],b.zoom),void 0):(a.warn("[AngularJS - Leaflet] invalid 'center'"),d.setView([e.center.lat,e.center.lng],e.center.zoom),void 0)},!0),d.on("movestart",function(){h=!0}),d.on("moveend",function(){h=!1,j(l,function(a){f&&(f.lat.assign(a,d.getCenter().lat),f.lng.assign(a,d.getCenter().lng),f.zoom.assign(a,d.getZoom()))})})})}}}]),angular.module("leaflet-directive").directive("tiles",["$log","leafletData","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i=d.isDefined,j=h.getLeafletScope(),k=j.tiles;return i(k)||i(k.url)?(h.getMap().then(function(a){var d,e=c.getDefaults(g.id);j.$watch("tiles",function(c){var f=e.tileLayerOptions,h=e.tileLayer;return!i(c.url)&&i(d)?(a.removeLayer(d),void 0):i(d)?i(c.url)&&i(c.options)&&!angular.equals(c.options,f)?(a.removeLayer(d),f=e.tileLayerOptions,angular.copy(c.options,f),h=c.url,d=L.tileLayer(h,f),d.addTo(a),b.setTiles(d,g.id),void 0):(i(c.url)&&d.setUrl(c.url),void 0):(i(c.options)&&angular.copy(c.options,f),i(c.url)&&(h=c.url),d=L.tileLayer(h,f),d.addTo(a),b.setTiles(d,g.id),void 0)},!0)}),void 0):(a.warn("[AngularJS - Leaflet] The 'tiles' definition doesn't have the 'url' property."),void 0)}}}]),angular.module("leaflet-directive").directive("legend",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(c,d,e,f){var g=b.isArray,h=f.getLeafletScope(),i=h.legend;f.getMap().then(function(b){if(g(i.colors)&&g(i.labels)&&i.colors.length===i.labels.length){var c=i.legendClass?i.legendClass:"legend",d=i.position||"bottomright",e=L.control({position:d});e.onAdd=function(){for(var a=L.DomUtil.create("div",c),b=0;b<i.colors.length;b++)a.innerHTML+='<div><i style="background:'+i.colors[b]+'"></i>'+i.labels[b]+"</div>";return a},e.addTo(b)}else a.warn("[AngularJS - Leaflet] legend.colors and legend.labels must be set.")})}}}]),angular.module("leaflet-directive").directive("geojson",["$log","$rootScope","leafletData","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,e,f,g){var h=d.safeApply,i=d.isDefined,j=g.getLeafletScope(),k={};g.getMap().then(function(a){j.$watch("geojson",function(e){if(i(k)&&a.hasLayer(k)&&a.removeLayer(k),i(e)&&i(e.data)){var f=e.resetStyleOnMouseout,g=e.onEachFeature;g||(g=function(a,c){d.LabelPlugin.isLoaded()&&i(e.label)&&c.bindLabel(a.properties.description),c.on({mouseover:function(c){h(j,function(){e.selected=a,b.$broadcast("leafletDirectiveMap.geojsonMouseover",c)})},mouseout:function(a){f&&k.resetStyle(a.target),h(j,function(){e.selected=void 0,b.$broadcast("leafletDirectiveMap.geojsonMouseout",a)})},click:function(a){h(j,function(){b.$broadcast("leafletDirectiveMap.geojsonClick",e.selected,a)})}})}),e.options={style:e.style,onEachFeature:g},k=L.geoJson(e.data,e.options),c.setGeoJSON(k),k.addTo(a)}})})}}}]),angular.module("leaflet-directive").directive("layers",["$log","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletLayerHelpers",function(a,b,c,d,e,f){var g;return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){g=b.defer(),this.getLayers=function(){return g.promise}},link:function(b,h,i,j){var k=d.isDefined,l={},m=j.getLeafletScope(),n=m.layers,o=f.createLayer;j.getMap().then(function(b){var d=e.getDefaults(i.id);if(!k(n)||!k(n.baselayers)||0===Object.keys(n.baselayers).length)return a.error("[AngularJS - Leaflet] At least one baselayer has to be defined"),void 0;g.resolve(l),c.setLayers(l,i.id),l.baselayers={},l.controls={},l.controls.layers=new L.control.layers,l.controls.layers.setPosition(d.controlLayersPosition);var f=!1;for(var h in n.baselayers){var j=o(n.baselayers[h]);k(j)?(l.baselayers[h]=j,n.baselayers[h].top===!0&&(b.addLayer(l.baselayers[h]),f=!0),l.controls.layers.addBaseLayer(l.baselayers[h],n.baselayers[h].name)):delete n.baselayers[h]}Object.keys(n.baselayers).length>1&&l.controls.layers.addTo(b),!f&&Object.keys(l.baselayers).length>0&&b.addLayer(l.baselayers[Object.keys(n.baselayers)[0]]),l.overlays={};for(h in n.overlays){var p=o(n.overlays[h]);k(p)&&(l.overlays[h]=p,n.overlays[h].visible===!0&&b.addLayer(l.overlays[h]),l.controls.layers.addOverlay(l.overlays[h],n.overlays[h].name))}m.$watch("layers.baselayers",function(c){for(var d in l.baselayers)k(c[d])||(l.controls.layers.removeLayer(l.baselayers[d]),b.hasLayer(l.baselayers[d])&&b.removeLayer(l.baselayers[d]),delete l.baselayers[d]);for(var e in c)if(!k(l.baselayers[e])){var f=o(c[e]);k(f)&&(l.baselayers[e]=f,c[e].top===!0&&b.addLayer(l.baselayers[e]),l.controls.layers.addBaseLayer(l.baselayers[e],c[e].name))}if(0===Object.keys(l.baselayers).length)return a.error("[AngularJS - Leaflet] At least one baselayer has to be defined"),void 0;var g=!1;for(var h in l.baselayers)if(b.hasLayer(l.baselayers[h])){g=!0;break}g||b.addLayer(l.baselayers[Object.keys(n.baselayers)[0]])},!0),m.$watch("layers.overlays",function(a){for(var c in l.overlays)k(a[c])||(l.controls.layers.removeLayer(l.overlays[c]),b.hasLayer(l.overlays[c])&&b.removeLayer(l.overlays[c]),delete l.overlays[c]);for(var d in a)if(!k(l.overlays[d])){var e=o(a[d]);k(e)&&(l.overlays[d]=e,l.controls.layers.addOverlay(l.overlays[d],a[d].name),a[d].visible===!0&&b.addLayer(l.overlays[d]))}},!0)})}}}]),angular.module("leaflet-directive").directive("bounds",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(c,d,e,f){var g=b.isDefined,h=b.createLeafletBounds,i=f.getLeafletScope();f.getMap().then(function(b){function c(){if(i.bounds){var a=b.getBounds(),c={northEast:{lat:a.getNorthEast().lat,lng:a.getNorthEast().lng},southWest:{lat:a.getSouthWest().lat,lng:a.getSouthWest().lng}};angular.equals(i.bounds,c)||(i.bounds=c)}}function d(c){if(!g(c))return a.error("[AngularJS - Leaflet] Invalid bounds"),void 0;var d=h(c);d&&!b.getBounds().equals(d)&&b.fitBounds(d)}b.on("moveend",c),b.on("dragend",c),b.on("zoomend",c),b.whenReady(function(){i.$watch("bounds",d,!0)})})}}}]),angular.module("leaflet-directive").directive("markers",["$log","$rootScope","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletMarkerHelpers",function(a,b,c,d,e,f,g){return{restrict:"A",scope:!1,replace:!1,require:["leaflet","?layers"],link:function(b,f,h,i){var j=i[0],k=e.isDefined,l=j.getLeafletScope(),m=l.markers,n=g.deleteMarker,o=g.createMarker;j.getMap().then(function(b){var e,f={},g={};if(e=k(i[1])?i[1].getLayers:function(){var a=c.defer();return a.resolve(),a.promise},!k(m))return a.error('[AngularJS - Leaflet] Received an empty "markers" variable.'),void 0;var j=!k(h.watchMarkers)||"true"===h.watchMarkers;e().then(function(a){d.setMarkers(f,h.id),l.$watch("markers",function(c){for(var d in f)k(c)&&k(c[d])||n(b,f,a,g,d);for(var e in c)if(!k(f[e])){var h=o("markers."+e,c[e],l,b,a,g,j);k(h)&&(f[e]=h)}},j)})})}}}]),angular.module("leaflet-directive").directive("paths",["$log","leafletData","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,e,f,g){var h=d.isDefined,i=g.getLeafletScope(),j=i.paths,k=d.convertToLeafletLatLng,l=d.convertToLeafletLatLngs,m=d.convertToLeafletMultiLatLngs;g.getMap().then(function(d){function e(b,c,d,e){function f(a){if(h(a.latlngs))switch(a.type){default:case"polyline":case"polygon":g.setLatLngs(l(a.latlngs));break;case"multiPolyline":case"multiPolygon":g.setLatLngs(m(a.latlngs));break;case"rectangle":g.setBounds(new L.LatLngBounds(l(a.latlngs)));break;case"circle":case"circleMarker":g.setLatLng(k(a.latlngs)),h(a.radius)&&g.setRadius(a.radius)}h(a.weight)&&g.setStyle({weight:a.weight}),h(a.color)&&g.setStyle({color:a.color}),h(a.opacity)&&g.setStyle({opacity:a.opacity})}var g,i={weight:e.path.weight,color:e.path.color,opacity:e.path.opacity};switch(h(c.stroke)&&(i.stroke=c.stroke),h(c.fill)&&(i.fill=c.fill),h(c.fillColor)&&(i.fillColor=c.fillColor),h(c.fillOpacity)&&(i.fillOpacity=c.fillOpacity),h(c.smoothFactor)&&(i.smoothFactor=c.smoothFactor),h(c.noClip)&&(i.noClip=c.noClip),h(c.type)||(c.type="polyline"),c.type){default:case"polyline":g=new L.Polyline([],i);break;case"multiPolyline":g=new L.multiPolyline([[[0,0],[1,1]]],i);break;case"polygon":g=new L.Polygon([],i);break;case"multiPolygon":g=new L.MultiPolygon([[[0,0],[1,1],[0,1]]],i);break;case"rectangle":g=new L.Rectangle([[0,0],[1,1]],i);break;case"circle":g=new L.Circle([0,0],1,i);break;case"circleMarker":g=new L.CircleMarker([0,0],i)}d.addLayer(g);var j=a.$watch("paths."+b,function(a){return h(a)?(f(a),void 0):(d.removeLayer(g),j(),void 0)},!0);return g}var g=c.getDefaults(f.id);if(h(j)){var i={};b.setPaths(i,f.id),a.$watch("paths",function(a){for(var b in a)h(i[b])||(i[b]=e(b,a[b],d,g));for(var c in i)h(a[c])||delete i[c]},!0)}})}}}]),angular.module("leaflet-directive").directive("controls",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"?^leaflet",link:function(a,c,d,e){if(e){var f=b.isDefined,g=e.getLeafletScope(),h=g.controls;e.getMap().then(function(a){if(f(L.Control.Draw)&&f(h.draw)){var b=new L.Control.Draw(h.draw.options);a.addControl(b)}if(f(h.custom))for(var c=0;c<h.custom.length;c++)a.addControl(h.custom[c])})}}}}]),angular.module("leaflet-directive").directive("eventBroadcast",["$log","$rootScope","leafletHelpers","leafletEvents",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(b,e,f,g){var h=c.isObject,i=g.getLeafletScope(),j=i.eventBroadcast,k=d.getAvailableMapEvents(),l=d.genDispatchMapEvent;g.getMap().then(function(b){var c,d,e=[],f="broadcast";if(h(j)){if(void 0===j.map||null===j.map)e=k;else if("object"!=typeof j.map)a.warn("[AngularJS - Leaflet] event-broadcast.map must be an object check your model.");else{void 0!==j.map.logic&&null!==j.map.logic&&("emit"!==j.map.logic&&"broadcast"!==j.map.logic?a.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===j.map.logic&&(f="emit"));var g=!1,m=!1;if(void 0!==j.map.enable&&null!==j.map.enable&&"object"==typeof j.map.enable&&(g=!0),void 0!==j.map.disable&&null!==j.map.disable&&"object"==typeof j.map.disable&&(m=!0),g&&m)a.warn("[AngularJS - Leaflet] can not enable and disable events at the time");else if(g||m)if(g)for(c=0;c<j.map.enable.length;c++)d=j.map.enable[c],-1!==e.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" is already enabled"):-1===k.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist"):e.push(d);else for(e=k,c=0;c<j.map.disable.length;c++){d=j.map.disable[c];var n=e.indexOf(d);-1===n?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist or has been already disabled"):e.splice(n,1)}else a.warn("[AngularJS - Leaflet] must enable or disable events")}for(c=0;c<e.length;c++)d=e[c],b.on(d,l(i,d,f),{eventName:d})}else a.warn("[AngularJS - Leaflet] event-broadcast must be an object, check your model.")})}}}]),angular.module("leaflet-directive").directive("maxbounds",["$log","leafletMapDefaults","leafletHelpers",function(a,b,c){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,b,d,e){var f=e.getLeafletScope(),g=c.isValidBounds;e.getMap().then(function(a){f.$watch("maxBounds",function(b){return g(b)?(a.setMaxBounds(new L.LatLngBounds(new L.LatLng(b.southWest.lat,b.southWest.lng),new L.LatLng(b.northEast.lat,b.northEast.lng)),b.options),void 0):(a.setMaxBounds(),void 0)})})}}}]),angular.module("leaflet-directive").service("leafletData",["$log","$q","leafletHelpers",function(a,b,c){var d=c.getDefer,e=c.getUnresolvedDefer,f=c.setResolvedDefer,g={},h={},i={},j={},k={},l={};this.setMap=function(a,b){var c=e(g,b);c.resolve(a),f(g,b)},this.getMap=function(a){var b=d(g,a);return b.promise},this.getPaths=function(a){var b=d(j,a);return b.promise},this.setPaths=function(a,b){var c=e(j,b);c.resolve(a),f(j,b)},this.getMarkers=function(a){var b=d(k,a);return b.promise},this.setMarkers=function(a,b){var c=e(k,b);c.resolve(a),f(k,b)},this.getLayers=function(a){var b=d(i,a);return b.promise},this.setLayers=function(a,b){var c=e(i,b);c.resolve(a),f(i,b)},this.setTiles=function(a,b){var c=e(h,b);c.resolve(a),f(h,b)},this.getTiles=function(a){var b=d(h,a);return b.promise},this.setGeoJSON=function(a,b){var c=e(l,b);c.resolve(a),f(l,b)},this.getGeoJSON=function(a){var b=d(l,a);return b.promise}}]),angular.module("leaflet-directive").factory("leafletMapDefaults",["$q","leafletHelpers",function(a,b){function c(){return{keyboard:!0,dragging:!0,worldCopyJump:!1,doubleClickZoom:!0,scrollWheelZoom:!0,zoomControl:!0,zoomsliderControl:!1,zoomControlPosition:"topleft",attributionControl:!0,layercontrol:{position:"topright",control:L.control.layers,collapsed:!0},controlLayersPosition:"topright",crs:L.CRS.EPSG3857,tileLayer:"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",tileLayerOptions:{attribution:'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'},path:{weight:10,opacity:1,color:"#0000ff"},center:{lat:0,lng:0,zoom:1}}}var d=b.isDefined,e=b.obtainEffectiveMapId,f={};return{getDefaults:function(a){var b=e(f,a);return f[b]},getMapCreationDefaults:function(a){var b=e(f,a),c=f[b],g={maxZoom:c.maxZoom,minZoom:c.minZoom,keyboard:c.keyboard,dragging:c.dragging,zoomControl:c.zoomControl,doubleClickZoom:c.doubleClickZoom,scrollWheelZoom:c.scrollWheelZoom,attributionControl:c.attributionControl,worldCopyJump:c.worldCopyJump,crs:c.crs};return d(c.zoomAnimation)&&(g.zoomAnimation=c.zoomAnimation),d(c.fadeAnimation)&&(g.fadeAnimation=c.fadeAnimation),d(c.markerZoomAnimation)&&(g.markerZoomAnimation=c.markerZoomAnimation),g},setDefaults:function(a,b){var g=c();d(a)&&(g.doubleClickZoom=d(a.doubleClickZoom)?a.doubleClickZoom:g.doubleClickZoom,g.scrollWheelZoom=d(a.scrollWheelZoom)?a.scrollWheelZoom:g.doubleClickZoom,g.zoomControl=d(a.zoomControl)?a.zoomControl:g.zoomControl,g.zoomsliderControl=d(a.zoomsliderControl)?a.zoomsliderControl:g.zoomsliderControl,g.attributionControl=d(a.attributionControl)?a.attributionControl:g.attributionControl,g.tileLayer=d(a.tileLayer)?a.tileLayer:g.tileLayer,g.zoomControlPosition=d(a.zoomControlPosition)?a.zoomControlPosition:g.zoomControlPosition,g.keyboard=d(a.keyboard)?a.keyboard:g.keyboard,g.dragging=d(a.dragging)?a.dragging:g.dragging,g.controlLayersPosition=d(a.controlLayersPosition)?a.controlLayersPosition:g.controlLayersPosition,d(a.crs)&&d(L.CRS[a.crs])&&(g.crs=L.CRS[a.crs]),d(a.tileLayerOptions)&&angular.copy(a.tileLayerOptions,g.tileLayerOptions),d(a.maxZoom)&&(g.maxZoom=a.maxZoom),d(a.minZoom)&&(g.minZoom=a.minZoom),d(a.zoomAnimation)&&(g.zoomAnimation=a.zoomAnimation),d(a.fadeAnimation)&&(g.fadeAnimation=a.fadeAnimation),d(a.markerZoomAnimation)&&(g.markerZoomAnimation=a.markerZoomAnimation),d(a.worldCopyJump)&&(g.worldCopyJump=a.worldCopyJump));var h=e(f,b);return f[h]=g,g}}}]),angular.module("leaflet-directive").factory("leafletEvents",["$rootScope","$q","leafletHelpers",function(a,b,c){var d=c.safeApply;return{getAvailableMapEvents:function(){return["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focus","blur","preclick","load","unload","viewreset","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoomend","zoomlevelschange","resize","autopanstart","layeradd","layerremove","baselayerchange","overlayadd","overlayremove","locationfound","locationerror","popupopen","popupclose"]},genDispatchMapEvent:function(b,c,e){return function(f){var g="leafletDirectiveMap."+c;d(b,function(b){"emit"===e?b.$emit(g,{leafletEvent:f}):"broadcast"===e&&a.$broadcast(g,{leafletEvent:f})})}},getAvailableMarkerEvents:function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu","dragstart","drag","dragend","move","remove","popupopen","popupclose"]},genDispatchMarkerEvent:function(b,c,e,f){return function(g){var h="leafletDirectiveMarker."+c;d(b,function(b){"emit"===e?b.$emit(h,{leafletEvent:g,markerName:f}):"broadcast"===e&&a.$broadcast(h,{leafletEvent:g,markerName:f})})}}}}]),angular.module("leaflet-directive").factory("leafletLayerHelpers",["$rootScope","$log","leafletHelpers",function($rootScope,$log,leafletHelpers){function isValidLayerType(a){return isString(a.type)?-1===Object.keys(layerTypes).indexOf(a.type)?($log.error("[AngularJS - Leaflet] A layer must have a valid type: "+Object.keys(layerTypes)),!1):layerTypes[a.type].mustHaveUrl&&!isString(a.url)?($log.error("[AngularJS - Leaflet] A base layer must have an url"),!1):layerTypes[a.type].mustHaveLayer&&!isDefined(a.layer)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have an layer defined"),!1):layerTypes[a.type].mustHaveBounds&&!isDefined(a.bounds)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have bounds defined"),!1):!0:!1}var Helpers=leafletHelpers,isString=leafletHelpers.isString,isObject=leafletHelpers.isObject,isDefined=leafletHelpers.isDefined,layerTypes={xyz:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer(a.url,a.options)}},wms:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer.wms(a.url,a.options)}},wfs:{mustHaveUrl:!0,mustHaveLayer:!0,createLayer:function(params){if(Helpers.WFSLayerPlugin.isLoaded()){var options=angular.copy(params.options);return options.crs&&"string"==typeof options.crs&&(options.crs=eval(options.crs)),new L.GeoJSON.WFS(params.url,params.layer,options)}}},group:{mustHaveUrl:!1,createLayer:function(){return L.layerGroup()}},google:{mustHaveUrl:!1,createLayer:function(a){var b=a.type||"SATELLITE";if(Helpers.GoogleLayerPlugin.isLoaded())return new L.Google(b,a.options)}},ags:{mustHaveUrl:!0,createLayer:function(a){if(Helpers.AGSLayerPlugin.isLoaded()){var b=angular.copy(a.options);angular.extend(b,{url:a.url});var c=new lvector.AGS(b);return c.onAdd=function(a){this.setMap(a)},c.onRemove=function(){this.setMap(null)},c}}},dynamic:{mustHaveUrl:!0,createLayer:function(a){return Helpers.DynamicMapLayerPlugin.isLoaded()?L.esri.dynamicMapLayer(a.url,a.options):void 0}},markercluster:{mustHaveUrl:!1,createLayer:function(a){return Helpers.MarkerClusterPlugin.isLoaded()?new L.MarkerClusterGroup(a.options):void 0}},bing:{mustHaveUrl:!0,createLayer:function(a){return Helpers.BingLayerPlugin.isLoaded()?new L.BingLayer(a.key,a.options):void 0}},imageOverlay:{mustHaveUrl:!0,mustHaveBounds:!0,createLayer:function(a){return L.imageOverlay(a.url,a.bounds,a.options)}}};return{createLayer:function(a){if(isValidLayerType(a)){if(!isString(a.name))return $log.error("[AngularJS - Leaflet] A base layer must have a name"),void 0;isObject(a.layerParams)||(a.layerParams={}),isObject(a.layerOptions)||(a.layerOptions={});for(var b in a.layerParams)a.layerOptions[b]=a.layerParams[b];var c={url:a.url,options:a.layerOptions,layer:a.layer,bounds:a.bounds,key:a.key};return layerTypes[a.type].createLayer(c)}}}}]),angular.module("leaflet-directive").factory("leafletMarkerHelpers",["$rootScope","leafletHelpers","$log","leafletEvents",function(a,b,c,d){var e=b.isDefined,f=b,g=b.MarkerClusterPlugin,h=b.isString,i=b.isNumber,j=b.isObject,k=b.safeApply,l=d.getAvailableMarkerEvents(),m=L.Icon.extend({options:{iconUrl:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-icon.png",iconRetinaUrl:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-icon-2x.png",iconSize:[25,41],iconAnchor:[12,40],labelAnchor:[10,-20],popupAnchor:[0,-40],shadow:{url:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-shadow.png",retinaUrl:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-shadow.png",size:[41,41],anchor:[12,40]}}}),n=function(a){return new m(a)},o=function(a){if(e(a)){var b=null;b=a.icon?a.icon:n();var c={icon:b,draggable:a.draggable?!0:!1,clickable:e(a.clickable)?a.clickable:!0,riseOnHover:e(a.riseOnHover)?a.riseOnHover:!1};a.title&&(c.title=a.title);var d=new L.marker(a,c);return a.message&&d.bindPopup(a.message),f.LabelPlugin.isLoaded()&&e(a.label)&&e(a.label.message)&&d.bindLabel(a.label.message,a.label.options),d}},p=function(b,c,d,e,f,g){return function(h){var i="leafletDirectiveMarker."+b,j=d.replace("markers.","");"click"===b?k(e,function(){a.$broadcast("leafletDirectiveMarkersClick",j)}):"dragend"===b&&(k(e,function(){g.lat=f.getLatLng().lat,g.lng=f.getLatLng().lng}),g.message&&g.focus===!0&&f.openPopup()),k(e,function(b){"emit"===c?b.$emit(i,{markerName:j,leafletEvent:h}):a.$broadcast(i,{markerName:j,leafletEvent:h})})}};return{getLeafletIcon:n,deleteMarker:function(a,b,c,d,f){var g=b[f];if(e(c)&&e(c.overlays))for(var h in c.overlays)c.overlays[h]instanceof L.LayerGroup&&c.overlays[h].hasLayer(g)&&c.overlays[h].removeLayer(g);if(e(d))for(var i in d)d[i].hasLayer(g)&&d[i].removeLayer(g);a.removeLayer(g),delete b[f]},createMarker:function(a,b,d,k,m,q,r){var s=o(b);if(e(s)){if(e(b.layer)&&!h(b.layer))return c.error("[AngularJS - Leaflet] A layername must be a string"),void 0;if(e(b.layer)){if(!e(m))return c.error("[AngularJS - Leaflet] You must add layers to the directive if used in a marker"),void 0;if(!e(m.overlays))return c.error("[AngularJS - Leaflet] You must add layers overlays to the directive if used in a marker"),void 0;if(!e(m.overlays[b.layer]))return c.error("[AngularJS - Leaflet] You must use a name of an existing layer"),void 0;var t=m.overlays[b.layer];if(!(t instanceof L.LayerGroup))return c.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"'),void 0;t.addLayer(s),k.hasLayer(s)&&b.focus===!0&&s.openPopup()}else{if(e(b.group)){if(!g.isLoaded())return c.error("[AngularJS - Leaflet] The MarkerCluster plugin is not loaded."),void 0;e(q[b.group])||(q[b.group]=new L.MarkerClusterGroup,k.addLayer(q[b.group])),q[b.group].addLayer(s)}else k.addLayer(s);f.LabelPlugin.isLoaded()&&e(b.label)&&e(b.label.options)&&b.label.options.noHide===!0&&s.showLabel(),b.focus===!0&&s.openPopup()}var u,v,w=[],x="broadcast";if(e(d.eventBroadcast))if("object"!=typeof d.eventBroadcast)c.warn("[AngularJS - Leaflet] event-broadcast must be an object check your model.");else if(e(d.eventBroadcast.marker))if(j(d.eventBroadcast.marker))c.warn("[AngularJS - Leaflet] event-broadcast.marker must be an object check your model.");else{void 0!==d.eventBroadcast.marker.logic&&null!==d.eventBroadcast.marker.logic&&("emit"!==d.eventBroadcast.marker.logic&&"broadcast"!==d.eventBroadcast.marker.logic?c.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===d.eventBroadcast.marker.logic&&(x="emit"));var y=!1,z=!1;if(void 0!==d.eventBroadcast.marker.enable&&null!==d.eventBroadcast.marker.enable&&"object"==typeof d.eventBroadcast.marker.enable&&(y=!0),void 0!==d.eventBroadcast.marker.disable&&null!==d.eventBroadcast.marker.disable&&"object"==typeof d.eventBroadcast.marker.disable&&(z=!0),y&&z)c.warn("[AngularJS - Leaflet] can not enable and disable events at the same time");else if(y||z)if(y)for(u=0;u<d.eventBroadcast.marker.enable.length;u++)v=d.eventBroadcast.marker.enable[u],-1!==w.indexOf(v)?c.warn("[AngularJS - Leaflet] This event "+v+" is already enabled"):-1===l.indexOf(v)?c.warn("[AngularJS - Leaflet] This event "+v+" does not exist"):w.push(v);else for(w=l,u=0;u<d.eventBroadcast.marker.disable.length;u++){v=d.eventBroadcast.marker.disable[u];var A=w.indexOf(v);-1===A?c.warn("[AngularJS - Leaflet] This event "+v+" does not exist or has been already disabled"):w.splice(A,1)}else c.warn("[AngularJS - Leaflet] must enable or disable events")}else w=l;else w=l;for(u=0;u<w.length;u++)v=w[u],s.on(v,p(v,x,a,d,s,b),{eventName:v,scope_watch_name:a});if(r)var B=d.$watch(a,function(a,b){if(!e(a)){if(s.closePopup(),e(m)&&e(m.overlays))for(var d in m.overlays)m.overlays[d]instanceof L.LayerGroup&&m.overlays[d].hasLayer(s)&&m.overlays[d].removeLayer(s);return k.removeLayer(s),B(),void 0}if(e(b)){if(h(a.layer)){if(e(b.layer)||b.layer!==a.layer)if("string"==typeof b.layer&&void 0!==m.overlays[b.layer]&&m.overlays[b.layer].hasLayer(s)&&m.overlays[b.layer].removeLayer(s),s.closePopup(),k.hasLayer(s)&&k.removeLayer(s),void 0!==m.overlays[a.layer]){var g=m.overlays[a.layer];g instanceof L.LayerGroup?(g.addLayer(s),k.hasLayer(s)&&a.focus===!0&&s.openPopup()):c.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"')}else c.error("[AngularJS - Leaflet] You must use a name of an existing layer")}else h(b.layer)&&(e(m.overlays[b.layer])&&m.overlays[b.layer].hasLayer(s)&&(m.overlays[b.layer].removeLayer(s),s.closePopup()),k.hasLayer(s)||k.addLayer(s));if(void 0===a.draggable||null===a.draggable||a.draggable!==!0?void 0!==b.draggable&&null!==b.draggable&&b.draggable===!0&&s.dragging&&s.dragging.disable():(void 0===b.draggable||null===b.draggable||b.draggable!==!0)&&(s.dragging?s.dragging.enable():L.Handler.MarkerDrag&&(s.dragging=new L.Handler.MarkerDrag(s),s.options.draggable=!0,s.dragging.enable())),void 0===a.icon||null===a.icon||"object"!=typeof a.icon)void 0!==b.icon&&null!==b.icon&&"object"==typeof b.icon&&(s.setIcon(n()),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message));else if(void 0===b.icon||null===b.icon||"object"!=typeof b.icon){var j=!1;s.dragging&&(j=s.dragging.enabled()),f.AwesomeMarkersPlugin.is(a.icon)?s.setIcon(a.icon):f.Leaflet.DivIcon.is(a.icon)||f.Leaflet.Icon.is(a.icon)?s.setIcon(a.icon):s.setIcon(n(a.icon)),j&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}else if(f.AwesomeMarkersPlugin.is(a.icon)){if(!f.AwesomeMarkersPlugin.equal(a.icon,b.icon)){var l=!1;s.dragging&&(l=s.dragging.enabled()),s.setIcon(a.icon),l&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}}else if(f.Leaflet.DivIcon.is(a.icon)){if(!f.Leaflet.DivIcon.equal(a.icon,b.icon)){var o=!1;s.dragging&&(o=s.dragging.enabled()),s.setIcon(a.icon),o&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}}else if(f.Leaflet.Icon.is(a.icon)){if(!f.Leaflet.Icon.equal(a.icon,b.icon)){var p=!1;s.dragging&&(p=s.dragging.enabled()),s.setIcon(a.icon),p&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}}else if(JSON.stringify(a.icon)!==JSON.stringify(b.icon)){var q=!1;s.dragging&&(q=s.dragging.enabled()),s.setIcon(n(a.icon)),q&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}if(void 0===a.message||null===a.message||"string"!=typeof a.message||""===a.message?void 0!==b.message&&null!==b.message&&"string"==typeof b.message&&""!==b.message&&(s.closePopup(),s.unbindPopup()):void 0===b.message||null===b.message||"string"!=typeof b.message||""===b.message?(s.bindPopup(a.message),a.focus===!0&&s.openPopup()):a.message!==b.message&&s.setPopupContent(a.message),void 0===a.focus||null===a.focus||a.focus!==!0?void 0!==b.focus&&null!==b.focus&&b.focus===!0&&s.closePopup():void 0===b.focus||null===b.focus||b.focus!==!0?s.openPopup():b.focus===!0&&a.focus===!0&&s.openPopup(),i(a.lat)&&i(a.lng)){var r=s.getLatLng();if(r.lat!==a.lat||r.lng!==a.lng){var t=!1;h(a.layer)&&f.MarkerClusterPlugin.is(m.overlays[a.layer])&&(m.overlays[a.layer].removeLayer(s),t=!0),s.setLatLng([a.lat,a.lng]),t&&m.overlays[a.layer].addLayer(s)}}else{if(c.warn("There are problems with lat-lng data, please verify your marker model"),e(m)&&e(m.overlays))for(var u in m.overlays)(m.overlays[u]instanceof L.LayerGroup||f.MarkerClusterPlugin.is(m.overlays[u]))&&m.overlays[u].hasLayer(s)&&m.overlays[u].removeLayer(s);k.removeLayer(s)}}},!0);return s}}}}]),angular.module("leaflet-directive").factory("leafletHelpers",["$q","$log",function(a,b){function c(a,c){var d,e;if(angular.isDefined(c))d=c;else if(1===Object.keys(a).length)for(e in a)a.hasOwnProperty(e)&&(d=e);else 0===Object.keys(a).length?d="main":b.error("[AngularJS - Leaflet] - You have more than 1 map on the DOM, you must provide the map ID to the leafletData.getXXX call");return d}function d(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)}function e(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}function f(a){return a.filter(function(a){return!!a.lat&&!!a.lng}).map(function(a){return new L.LatLng(a.lat,a.lng)})}return{isDefined:function(a){return angular.isDefined(a)&&null!==a},isNumber:function(a){return angular.isNumber(a)},isString:function(a){return angular.isString(a)},isArray:function(a){return angular.isArray(a)},isObject:function(a){return angular.isObject(a)},equals:function(a,b){return angular.equals(a,b)},isValidCenter:function(a){return angular.isDefined(a)&&angular.isNumber(a.lat)&&angular.isNumber(a.lng)&&angular.isNumber(a.zoom)},isValidBounds:d,createLeafletBounds:function(a){return d(a)?L.latLngBounds([a.southWest.lat,a.southWest.lng],[a.northEast.lat,a.northEast.lng]):!1},convertToLeafletLatLngs:f,convertToLeafletLatLng:function(a){return new L.LatLng(a.lat,a.lng)},convertToLeafletMultiLatLngs:function(a){return a.map(function(a){return f(a)})},safeApply:function(a,b){var c=a.$root.$$phase;"$apply"===c||"$digest"===c?a.$eval(b):a.$apply(b) | ||
},obtainEffectiveMapId:c,getDefer:function(a,b){var d,f=c(a,b);return d=angular.isDefined(a[f])&&a[f].resolvedDefer!==!1?a[f].defer:e(a,b)},getUnresolvedDefer:e,setResolvedDefer:function(a,b){var d=c(a,b);a[d].resolvedDefer=!0},AwesomeMarkersPlugin:{isLoaded:function(){return void 0!==L.AwesomeMarkers?void 0!==L.AwesomeMarkers.Icon:!1},is:function(a){return this.isLoaded()?a instanceof L.AwesomeMarkers.Icon:!1},equal:function(a,b){return this.isLoaded()?this.is(a)?angular.equals(a,b):!1:!1}},LabelPlugin:{isLoaded:function(){return angular.isDefined(L.Label)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},MarkerClusterPlugin:{isLoaded:function(){return angular.isDefined(L.MarkerClusterGroup)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},GoogleLayerPlugin:{isLoaded:function(){return angular.isDefined(L.Google)},is:function(a){return this.isLoaded()?a instanceof L.Google:!1}},BingLayerPlugin:{isLoaded:function(){return angular.isDefined(L.BingLayer)},is:function(a){return this.isLoaded()?a instanceof L.BingLayer:!1}},WFSLayerPlugin:{isLoaded:function(){return void 0!==L.GeoJSON.WFS},is:function(a){return this.isLoaded()?a instanceof L.GeoJSON.WFS:!1}},AGSLayerPlugin:{isLoaded:function(){return void 0!==lvector&&void 0!==lvector.AGS},is:function(a){return this.isLoaded()?a instanceof lvector.AGS:!1}},DynamicMapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.dynamicMapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.dynamicMapLayer:!1}},Leaflet:{DivIcon:{is:function(a){return a instanceof L.DivIcon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}},Icon:{is:function(a){return a instanceof L.Icon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}}}}}])}(); | ||
/*! angular-leaflet-directive 22-12-2013 */ | ||
!function(){"use strict";angular.module("leaflet-directive",[]).directive("leaflet",["$q","leafletData","leafletMapDefaults","leafletHelpers","leafletEvents",function(a,b,c,d,e){var f;return{restrict:"EA",replace:!0,scope:{center:"=center",defaults:"=defaults",maxBounds:"=maxbounds",bounds:"=bounds",markers:"=markers",legend:"=legend",geojson:"=geojson",paths:"=paths",tiles:"=tiles",layers:"=layers",controls:"=controls",eventBroadcast:"=eventBroadcast"},template:'<div class="angular-leaflet-map"></div>',controller:["$scope",function(b){f=a.defer(),this.getMap=function(){return f.promise},this.getLeafletScope=function(){return b}}],link:function(a,g,h){var i=d.isDefined,j=c.setDefaults(a.defaults,h.id),k=e.genDispatchMapEvent,l=e.getAvailableMapEvents();i(a.maxBounds)&&(j.minZoom=void 0),i(h.width)&&(isNaN(h.width)?g.css("width",h.width):g.css("width",h.width+"px")),i(h.height)&&(isNaN(h.height)?g.css("height",h.height):g.css("height",h.height+"px"));var m=new L.Map(g[0],c.getMapCreationDefaults(h.id));if(f.resolve(m),i(h.center)||m.setView([j.center.lat,j.center.lng],j.center.zoom),!i(h.tiles)&&!i(h.layers)){var n=L.tileLayer(j.tileLayer,j.tileLayerOptions);n.addTo(m),b.setTiles(n)}if(i(m.zoomControl)&&i(j.zoomControlPosition)&&m.zoomControl.setPosition(j.zoomControlPosition),i(m.zoomControl)&&j.zoomControl===!1&&m.zoomControl.removeFrom(m),i(m.zoomsliderControl)&&i(j.zoomsliderControl)&&j.zoomsliderControl===!1&&m.zoomsliderControl.removeFrom(m),!i(h.eventBroadcast))for(var o="broadcast",p=0;p<l.length;p++){var q=l[p];m.on(q,k(a,q,o),{eventName:q})}m.whenReady(function(){b.setMap(m,h.id)})}}}]),angular.module("leaflet-directive").directive("center",["$log","$parse","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i=d.isDefined,j=d.safeApply,k=d.isValidCenter,l=h.getLeafletScope(),m=l.center;h.getMap().then(function(d){var e=c.getDefaults(g.id);if(!i(m))return d.setView([e.center.lat,e.center.lng],e.center.zoom),void 0;var f={lat:b("center.lat"),lng:b("center.lng"),zoom:b("center.zoom"),autoDiscover:b("center.autoDiscover")},h=!1;l.$watch("center",function(b){if(!k(b)&&b.autoDiscover!==!0)return a.warn("[AngularJS - Leaflet] invalid 'center'"),d.setView([e.center.lat,e.center.lng],e.center.zoom),void 0;if(!h)return b.autoDiscover===!0?(d.setView([e.center.lat,e.center.lng],e.center.zoom),i(e.maxZoom)?d.locate({setView:!0,maxZoom:e.maxZoom}):d.locate({setView:!0}),void 0):(d.setView([b.lat,b.lng],b.zoom),void 0)},!0),d.on("movestart",function(){h=!0}),d.on("moveend",function(){h=!1,j(l,function(a){f&&(f.lat.assign(a,d.getCenter().lat),f.lng.assign(a,d.getCenter().lng),f.zoom.assign(a,d.getZoom()),f.autoDiscover.assign(a,!1))})}),m.autoDiscover===!0&&d.on("locationerror",function(){a.warn("[AngularJS - Leaflet] The Geolocation API is unauthorized on this page."),k(m)?d.setView([m.lat,m.lng],m.zoom):d.setView([e.center.lat,e.center.lng],e.center.zoom)})})}}}]),angular.module("leaflet-directive").directive("tiles",["$log","leafletData","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(e,f,g,h){var i=d.isDefined,j=h.getLeafletScope(),k=j.tiles;return i(k)||i(k.url)?(h.getMap().then(function(a){var d,e=c.getDefaults(g.id);j.$watch("tiles",function(c){var f=e.tileLayerOptions,h=e.tileLayer;return!i(c.url)&&i(d)?(a.removeLayer(d),void 0):i(d)?i(c.url)&&i(c.options)&&!angular.equals(c.options,f)?(a.removeLayer(d),f=e.tileLayerOptions,angular.copy(c.options,f),h=c.url,d=L.tileLayer(h,f),d.addTo(a),b.setTiles(d,g.id),void 0):(i(c.url)&&d.setUrl(c.url),void 0):(i(c.options)&&angular.copy(c.options,f),i(c.url)&&(h=c.url),d=L.tileLayer(h,f),d.addTo(a),b.setTiles(d,g.id),void 0)},!0)}),void 0):(a.warn("[AngularJS - Leaflet] The 'tiles' definition doesn't have the 'url' property."),void 0)}}}]),angular.module("leaflet-directive").directive("legend",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(c,d,e,f){var g=b.isArray,h=f.getLeafletScope(),i=h.legend;f.getMap().then(function(b){if(g(i.colors)&&g(i.labels)&&i.colors.length===i.labels.length){var c=i.legendClass?i.legendClass:"legend",d=i.position||"bottomright",e=L.control({position:d});e.onAdd=function(){for(var a=L.DomUtil.create("div",c),b=0;b<i.colors.length;b++)a.innerHTML+='<div><i style="background:'+i.colors[b]+'"></i>'+i.labels[b]+"</div>";return a},e.addTo(b)}else a.warn("[AngularJS - Leaflet] legend.colors and legend.labels must be set.")})}}}]),angular.module("leaflet-directive").directive("geojson",["$log","$rootScope","leafletData","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,e,f,g){var h=d.safeApply,i=d.isDefined,j=g.getLeafletScope(),k={};g.getMap().then(function(a){j.$watch("geojson",function(e){if(i(k)&&a.hasLayer(k)&&a.removeLayer(k),i(e)&&i(e.data)){var f=e.resetStyleOnMouseout,g=e.onEachFeature;g||(g=function(a,c){d.LabelPlugin.isLoaded()&&i(e.label)&&c.bindLabel(a.properties.description),c.on({mouseover:function(c){h(j,function(){e.selected=a,b.$broadcast("leafletDirectiveMap.geojsonMouseover",c)})},mouseout:function(a){f&&k.resetStyle(a.target),h(j,function(){e.selected=void 0,b.$broadcast("leafletDirectiveMap.geojsonMouseout",a)})},click:function(a){h(j,function(){b.$broadcast("leafletDirectiveMap.geojsonClick",e.selected,a)})}})}),e.options={style:e.style,onEachFeature:g},k=L.geoJson(e.data,e.options),c.setGeoJSON(k),k.addTo(a)}})})}}}]),angular.module("leaflet-directive").directive("layers",["$log","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletLayerHelpers",function(a,b,c,d,e,f){var g;return{restrict:"A",scope:!1,replace:!1,require:"leaflet",controller:function(){g=b.defer(),this.getLayers=function(){return g.promise}},link:function(b,h,i,j){var k=d.isDefined,l={},m=j.getLeafletScope(),n=m.layers,o=f.createLayer;j.getMap().then(function(b){var d=e.getDefaults(i.id);if(!k(n)||!k(n.baselayers)||0===Object.keys(n.baselayers).length)return a.error("[AngularJS - Leaflet] At least one baselayer has to be defined"),void 0;g.resolve(l),c.setLayers(l,i.id),l.baselayers={},l.controls={},l.controls.layers=new L.control.layers,l.controls.layers.setPosition(d.controlLayersPosition);var f=!1;for(var h in n.baselayers){var j=o(n.baselayers[h]);k(j)?(l.baselayers[h]=j,n.baselayers[h].top===!0&&(b.addLayer(l.baselayers[h]),f=!0),l.controls.layers.addBaseLayer(l.baselayers[h],n.baselayers[h].name)):delete n.baselayers[h]}Object.keys(n.baselayers).length>1&&l.controls.layers.addTo(b),!f&&Object.keys(l.baselayers).length>0&&b.addLayer(l.baselayers[Object.keys(n.baselayers)[0]]),l.overlays={};for(h in n.overlays){var p=o(n.overlays[h]);k(p)&&(l.overlays[h]=p,n.overlays[h].visible===!0&&b.addLayer(l.overlays[h]),l.controls.layers.addOverlay(l.overlays[h],n.overlays[h].name))}m.$watch("layers.baselayers",function(c){for(var d in l.baselayers)k(c[d])||(l.controls.layers.removeLayer(l.baselayers[d]),b.hasLayer(l.baselayers[d])&&b.removeLayer(l.baselayers[d]),delete l.baselayers[d]);for(var e in c)if(!k(l.baselayers[e])){var f=o(c[e]);k(f)&&(l.baselayers[e]=f,c[e].top===!0&&b.addLayer(l.baselayers[e]),l.controls.layers.addBaseLayer(l.baselayers[e],c[e].name))}if(0===Object.keys(l.baselayers).length)return a.error("[AngularJS - Leaflet] At least one baselayer has to be defined"),void 0;var g=!1;for(var h in l.baselayers)if(b.hasLayer(l.baselayers[h])){g=!0;break}g||b.addLayer(l.baselayers[Object.keys(n.baselayers)[0]])},!0);var q={};m.$watch("layers.overlays",function(a){for(var c in l.overlays)k(a[c])||(l.controls.layers.removeLayer(l.overlays[c]),b.hasLayer(l.overlays[c])&&b.removeLayer(l.overlays[c]),delete l.overlays[c]);for(var d in a){if(!k(l.overlays[d])){var e=o(a[d]);k(e)&&(l.overlays[d]=e,l.controls.layers.addOverlay(l.overlays[d],a[d].name),a[d].visible===!0&&b.addLayer(l.overlays[d]))}a[d].visible&&!b.hasLayer(l.overlays[d])?q[d]?b.addLayer(q[d]):(l.controls.layers.addOverlay(l.overlays[d],a[d].name),b.addLayer(l.overlays[d])):a[d].visible===!1&&b.hasLayer(l.overlays[d])&&(q[d]=l.overlays[d],b.removeLayer(l.overlays[d]))}},!0)})}}}]),angular.module("leaflet-directive").directive("bounds",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(c,d,e,f){var g=b.isDefined,h=b.createLeafletBounds,i=f.getLeafletScope();f.getMap().then(function(b){function c(){if(i.bounds){var a=b.getBounds(),c={northEast:{lat:a.getNorthEast().lat,lng:a.getNorthEast().lng},southWest:{lat:a.getSouthWest().lat,lng:a.getSouthWest().lng}};angular.equals(i.bounds,c)||(i.bounds=c)}}function d(c){if(!g(c))return a.error("[AngularJS - Leaflet] Invalid bounds"),void 0;var d=h(c);d&&!b.getBounds().equals(d)&&b.fitBounds(d)}b.on("moveend",c),b.on("dragend",c),b.on("zoomend",c),b.whenReady(function(){i.$watch("bounds",d,!0)})})}}}]),angular.module("leaflet-directive").directive("markers",["$log","$rootScope","$q","leafletData","leafletHelpers","leafletMapDefaults","leafletMarkerHelpers",function(a,b,c,d,e,f,g){return{restrict:"A",scope:!1,replace:!1,require:["leaflet","?layers"],link:function(b,f,h,i){var j=i[0],k=e.isDefined,l=j.getLeafletScope(),m=l.markers,n=g.deleteMarker,o=g.createMarker;j.getMap().then(function(b){var e,f={},g={};if(e=k(i[1])?i[1].getLayers:function(){var a=c.defer();return a.resolve(),a.promise},!k(m))return a.error('[AngularJS - Leaflet] Received an empty "markers" variable.'),void 0;var j=!k(h.watchMarkers)||"true"===h.watchMarkers;e().then(function(a){d.setMarkers(f,h.id),l.$watch("markers",function(c){for(var d in f)k(c)&&k(c[d])||n(b,f,a,g,d);for(var e in c)if(!k(f[e])){var h=o("markers."+e,c[e],l,b,a,g,j);k(h)&&(f[e]=h)}},j)})})}}}]),angular.module("leaflet-directive").directive("paths",["$log","leafletData","leafletMapDefaults","leafletHelpers",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,e,f,g){var h=d.isDefined,i=g.getLeafletScope(),j=i.paths,k=d.convertToLeafletLatLng,l=d.convertToLeafletLatLngs,m=d.convertToLeafletMultiLatLngs;g.getMap().then(function(d){function e(b,c,d,e){function f(a){if(h(a.latlngs))switch(a.type){default:case"polyline":case"polygon":g.setLatLngs(l(a.latlngs));break;case"multiPolyline":case"multiPolygon":g.setLatLngs(m(a.latlngs));break;case"rectangle":g.setBounds(new L.LatLngBounds(l(a.latlngs)));break;case"circle":case"circleMarker":g.setLatLng(k(a.latlngs)),h(a.radius)&&g.setRadius(a.radius)}h(a.weight)&&g.setStyle({weight:a.weight}),h(a.color)&&g.setStyle({color:a.color}),h(a.opacity)&&g.setStyle({opacity:a.opacity})}var g,i={weight:e.path.weight,color:e.path.color,opacity:e.path.opacity};switch(h(c.stroke)&&(i.stroke=c.stroke),h(c.fill)&&(i.fill=c.fill),h(c.fillColor)&&(i.fillColor=c.fillColor),h(c.fillOpacity)&&(i.fillOpacity=c.fillOpacity),h(c.smoothFactor)&&(i.smoothFactor=c.smoothFactor),h(c.noClip)&&(i.noClip=c.noClip),h(c.type)||(c.type="polyline"),c.type){default:case"polyline":g=new L.Polyline([],i);break;case"multiPolyline":g=new L.multiPolyline([[[0,0],[1,1]]],i);break;case"polygon":g=new L.Polygon([],i);break;case"multiPolygon":g=new L.MultiPolygon([[[0,0],[1,1],[0,1]]],i);break;case"rectangle":g=new L.Rectangle([[0,0],[1,1]],i);break;case"circle":g=new L.Circle([0,0],1,i);break;case"circleMarker":g=new L.CircleMarker([0,0],i)}d.addLayer(g);var j=a.$watch("paths."+b,function(a){return h(a)?(f(a),void 0):(d.removeLayer(g),j(),void 0)},!0);return g}var g=c.getDefaults(f.id);if(h(j)){var i={};b.setPaths(i,f.id),a.$watch("paths",function(a){for(var b in a)h(i[b])||(i[b]=e(b,a[b],d,g));for(var c in i)h(a[c])||delete i[c]},!0)}})}}}]),angular.module("leaflet-directive").directive("controls",["$log","leafletHelpers",function(a,b){return{restrict:"A",scope:!1,replace:!1,require:"?^leaflet",link:function(a,c,d,e){if(e){var f=b.isDefined,g=e.getLeafletScope(),h=g.controls;e.getMap().then(function(a){if(f(L.Control.Draw)&&f(h.draw)){var b=new L.Control.Draw(h.draw.options);a.addControl(b)}if(f(h.custom))for(var c=0;c<h.custom.length;c++)a.addControl(h.custom[c])})}}}}]),angular.module("leaflet-directive").directive("eventBroadcast",["$log","$rootScope","leafletHelpers","leafletEvents",function(a,b,c,d){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(b,e,f,g){var h=c.isObject,i=g.getLeafletScope(),j=i.eventBroadcast,k=d.getAvailableMapEvents(),l=d.genDispatchMapEvent;g.getMap().then(function(b){var c,d,e=[],f="broadcast";if(h(j)){if(void 0===j.map||null===j.map)e=k;else if("object"!=typeof j.map)a.warn("[AngularJS - Leaflet] event-broadcast.map must be an object check your model.");else{void 0!==j.map.logic&&null!==j.map.logic&&("emit"!==j.map.logic&&"broadcast"!==j.map.logic?a.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===j.map.logic&&(f="emit"));var g=!1,m=!1;if(void 0!==j.map.enable&&null!==j.map.enable&&"object"==typeof j.map.enable&&(g=!0),void 0!==j.map.disable&&null!==j.map.disable&&"object"==typeof j.map.disable&&(m=!0),g&&m)a.warn("[AngularJS - Leaflet] can not enable and disable events at the time");else if(g||m)if(g)for(c=0;c<j.map.enable.length;c++)d=j.map.enable[c],-1!==e.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" is already enabled"):-1===k.indexOf(d)?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist"):e.push(d);else for(e=k,c=0;c<j.map.disable.length;c++){d=j.map.disable[c];var n=e.indexOf(d);-1===n?a.warn("[AngularJS - Leaflet] This event "+d+" does not exist or has been already disabled"):e.splice(n,1)}else a.warn("[AngularJS - Leaflet] must enable or disable events")}for(c=0;c<e.length;c++)d=e[c],b.on(d,l(i,d,f),{eventName:d})}else a.warn("[AngularJS - Leaflet] event-broadcast must be an object, check your model.")})}}}]),angular.module("leaflet-directive").directive("maxbounds",["$log","leafletMapDefaults","leafletHelpers",function(a,b,c){return{restrict:"A",scope:!1,replace:!1,require:"leaflet",link:function(a,b,d,e){var f=e.getLeafletScope(),g=c.isValidBounds;e.getMap().then(function(a){f.$watch("maxBounds",function(b){return g(b)?(a.setMaxBounds(new L.LatLngBounds(new L.LatLng(b.southWest.lat,b.southWest.lng),new L.LatLng(b.northEast.lat,b.northEast.lng)),b.options),void 0):(a.setMaxBounds(),void 0)})})}}}]),angular.module("leaflet-directive").service("leafletData",["$log","$q","leafletHelpers",function(a,b,c){var d=c.getDefer,e=c.getUnresolvedDefer,f=c.setResolvedDefer,g={},h={},i={},j={},k={},l={};this.setMap=function(a,b){var c=e(g,b);c.resolve(a),f(g,b)},this.getMap=function(a){var b=d(g,a);return b.promise},this.getPaths=function(a){var b=d(j,a);return b.promise},this.setPaths=function(a,b){var c=e(j,b);c.resolve(a),f(j,b)},this.getMarkers=function(a){var b=d(k,a);return b.promise},this.setMarkers=function(a,b){var c=e(k,b);c.resolve(a),f(k,b)},this.getLayers=function(a){var b=d(i,a);return b.promise},this.setLayers=function(a,b){var c=e(i,b);c.resolve(a),f(i,b)},this.setTiles=function(a,b){var c=e(h,b);c.resolve(a),f(h,b)},this.getTiles=function(a){var b=d(h,a);return b.promise},this.setGeoJSON=function(a,b){var c=e(l,b);c.resolve(a),f(l,b)},this.getGeoJSON=function(a){var b=d(l,a);return b.promise}}]),angular.module("leaflet-directive").factory("leafletMapDefaults",["leafletHelpers",function(a){function b(){return{keyboard:!0,dragging:!0,worldCopyJump:!1,doubleClickZoom:!0,scrollWheelZoom:!0,zoomControl:!0,zoomsliderControl:!1,zoomControlPosition:"topleft",attributionControl:!0,layercontrol:{position:"topright",control:L.control.layers,collapsed:!0},controlLayersPosition:"topright",crs:L.CRS.EPSG3857,tileLayer:"http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",tileLayerOptions:{attribution:'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'},path:{weight:10,opacity:1,color:"#0000ff"},center:{lat:0,lng:0,zoom:1}}}var c=a.isDefined,d=a.obtainEffectiveMapId,e={};return{getDefaults:function(a){var b=d(e,a);return e[b]},getMapCreationDefaults:function(a){var b=d(e,a),f=e[b],g={maxZoom:f.maxZoom,minZoom:f.minZoom,keyboard:f.keyboard,dragging:f.dragging,zoomControl:f.zoomControl,doubleClickZoom:f.doubleClickZoom,scrollWheelZoom:f.scrollWheelZoom,attributionControl:f.attributionControl,worldCopyJump:f.worldCopyJump,crs:f.crs};return c(f.zoomAnimation)&&(g.zoomAnimation=f.zoomAnimation),c(f.fadeAnimation)&&(g.fadeAnimation=f.fadeAnimation),c(f.markerZoomAnimation)&&(g.markerZoomAnimation=f.markerZoomAnimation),g},setDefaults:function(a,f){var g=b();c(a)&&(g.doubleClickZoom=c(a.doubleClickZoom)?a.doubleClickZoom:g.doubleClickZoom,g.scrollWheelZoom=c(a.scrollWheelZoom)?a.scrollWheelZoom:g.doubleClickZoom,g.zoomControl=c(a.zoomControl)?a.zoomControl:g.zoomControl,g.zoomsliderControl=c(a.zoomsliderControl)?a.zoomsliderControl:g.zoomsliderControl,g.attributionControl=c(a.attributionControl)?a.attributionControl:g.attributionControl,g.tileLayer=c(a.tileLayer)?a.tileLayer:g.tileLayer,g.zoomControlPosition=c(a.zoomControlPosition)?a.zoomControlPosition:g.zoomControlPosition,g.keyboard=c(a.keyboard)?a.keyboard:g.keyboard,g.dragging=c(a.dragging)?a.dragging:g.dragging,g.controlLayersPosition=c(a.controlLayersPosition)?a.controlLayersPosition:g.controlLayersPosition,c(a.crs)&&c(L.CRS[a.crs])&&(g.crs=L.CRS[a.crs]),c(a.tileLayerOptions)&&angular.copy(a.tileLayerOptions,g.tileLayerOptions),c(a.maxZoom)&&(g.maxZoom=a.maxZoom),c(a.minZoom)&&(g.minZoom=a.minZoom),c(a.zoomAnimation)&&(g.zoomAnimation=a.zoomAnimation),c(a.fadeAnimation)&&(g.fadeAnimation=a.fadeAnimation),c(a.markerZoomAnimation)&&(g.markerZoomAnimation=a.markerZoomAnimation),c(a.worldCopyJump)&&(g.worldCopyJump=a.worldCopyJump));var h=d(e,f);return e[h]=g,g}}}]),angular.module("leaflet-directive").factory("leafletEvents",["$rootScope","$q","leafletHelpers",function(a,b,c){var d=c.safeApply;return{getAvailableMapEvents:function(){return["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","contextmenu","focus","blur","preclick","load","unload","viewreset","movestart","move","moveend","dragstart","drag","dragend","zoomstart","zoomend","zoomlevelschange","resize","autopanstart","layeradd","layerremove","baselayerchange","overlayadd","overlayremove","locationfound","locationerror","popupopen","popupclose"]},genDispatchMapEvent:function(b,c,e){return function(f){var g="leafletDirectiveMap."+c;d(b,function(b){"emit"===e?b.$emit(g,{leafletEvent:f}):"broadcast"===e&&a.$broadcast(g,{leafletEvent:f})})}},getAvailableMarkerEvents:function(){return["click","dblclick","mousedown","mouseover","mouseout","contextmenu","dragstart","drag","dragend","move","remove","popupopen","popupclose"]},genDispatchMarkerEvent:function(b,c,e,f){return function(g){var h="leafletDirectiveMarker."+c;d(b,function(b){"emit"===e?b.$emit(h,{leafletEvent:g,markerName:f}):"broadcast"===e&&a.$broadcast(h,{leafletEvent:g,markerName:f})})}}}}]),angular.module("leaflet-directive").factory("leafletLayerHelpers",["$rootScope","$log","leafletHelpers",function($rootScope,$log,leafletHelpers){function isValidLayerType(a){return isString(a.type)?-1===Object.keys(layerTypes).indexOf(a.type)?($log.error("[AngularJS - Leaflet] A layer must have a valid type: "+Object.keys(layerTypes)),!1):layerTypes[a.type].mustHaveUrl&&!isString(a.url)?($log.error("[AngularJS - Leaflet] A base layer must have an url"),!1):layerTypes[a.type].mustHaveLayer&&!isDefined(a.layer)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have an layer defined"),!1):layerTypes[a.type].mustHaveBounds&&!isDefined(a.bounds)?($log.error("[AngularJS - Leaflet] The type of layer "+a.type+" must have bounds defined"),!1):!0:!1}var Helpers=leafletHelpers,isString=leafletHelpers.isString,isObject=leafletHelpers.isObject,isDefined=leafletHelpers.isDefined,layerTypes={xyz:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer(a.url,a.options)}},wms:{mustHaveUrl:!0,createLayer:function(a){return L.tileLayer.wms(a.url,a.options)}},wfs:{mustHaveUrl:!0,mustHaveLayer:!0,createLayer:function(params){if(Helpers.WFSLayerPlugin.isLoaded()){var options=angular.copy(params.options);return options.crs&&"string"==typeof options.crs&&(options.crs=eval(options.crs)),new L.GeoJSON.WFS(params.url,params.layer,options)}}},group:{mustHaveUrl:!1,createLayer:function(){return L.layerGroup()}},google:{mustHaveUrl:!1,createLayer:function(a){var b=a.type||"SATELLITE";if(Helpers.GoogleLayerPlugin.isLoaded())return new L.Google(b,a.options)}},ags:{mustHaveUrl:!0,createLayer:function(a){if(Helpers.AGSLayerPlugin.isLoaded()){var b=angular.copy(a.options);angular.extend(b,{url:a.url});var c=new lvector.AGS(b);return c.onAdd=function(a){this.setMap(a)},c.onRemove=function(){this.setMap(null)},c}}},dynamic:{mustHaveUrl:!0,createLayer:function(a){return Helpers.DynamicMapLayerPlugin.isLoaded()?L.esri.dynamicMapLayer(a.url,a.options):void 0}},markercluster:{mustHaveUrl:!1,createLayer:function(a){return Helpers.MarkerClusterPlugin.isLoaded()?new L.MarkerClusterGroup(a.options):void 0}},bing:{mustHaveUrl:!0,createLayer:function(a){return Helpers.BingLayerPlugin.isLoaded()?new L.BingLayer(a.key,a.options):void 0}},imageOverlay:{mustHaveUrl:!0,mustHaveBounds:!0,createLayer:function(a){return L.imageOverlay(a.url,a.bounds,a.options)}}};return{createLayer:function(a){if(isValidLayerType(a)){if(!isString(a.name))return $log.error("[AngularJS - Leaflet] A base layer must have a name"),void 0;isObject(a.layerParams)||(a.layerParams={}),isObject(a.layerOptions)||(a.layerOptions={});for(var b in a.layerParams)a.layerOptions[b]=a.layerParams[b];var c={url:a.url,options:a.layerOptions,layer:a.layer,type:a.layerType,bounds:a.bounds,key:a.key};return layerTypes[a.type].createLayer(c)}}}}]),angular.module("leaflet-directive").factory("leafletMarkerHelpers",["$rootScope","leafletHelpers","$log","leafletEvents",function(a,b,c,d){var e=b.isDefined,f=b,g=b.MarkerClusterPlugin,h=b.isString,i=b.isNumber,j=b.isObject,k=b.safeApply,l=d.getAvailableMarkerEvents(),m=L.Icon.extend({options:{iconUrl:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-icon.png",iconRetinaUrl:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-icon-2x.png",iconSize:[25,41],iconAnchor:[12,40],labelAnchor:[10,-20],popupAnchor:[0,-40],shadow:{url:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-shadow.png",retinaUrl:"http://cdn.leafletjs.com/leaflet-0.7/images/marker-shadow.png",size:[41,41],anchor:[12,40]}}}),n=function(a){return new m(a)},o=function(a){if(e(a)){var b=null;b=a.icon?a.icon:n();var c={icon:b,draggable:a.draggable?!0:!1,clickable:e(a.clickable)?a.clickable:!0,riseOnHover:e(a.riseOnHover)?a.riseOnHover:!1};a.title&&(c.title=a.title);var d=new L.marker(a,c);return a.message&&d.bindPopup(a.message),f.LabelPlugin.isLoaded()&&e(a.label)&&e(a.label.message)&&d.bindLabel(a.label.message,a.label.options),d}},p=function(b,c,d,e,f,g){return function(h){var i="leafletDirectiveMarker."+b,j=d.replace("markers.","");"click"===b?k(e,function(){a.$broadcast("leafletDirectiveMarkersClick",j)}):"dragend"===b&&(k(e,function(){g.lat=f.getLatLng().lat,g.lng=f.getLatLng().lng}),g.message&&g.focus===!0&&f.openPopup()),k(e,function(b){"emit"===c?b.$emit(i,{markerName:j,leafletEvent:h}):a.$broadcast(i,{markerName:j,leafletEvent:h})})}};return{getLeafletIcon:n,deleteMarker:function(a,b,c,d,f){var g=b[f];if(e(c)&&e(c.overlays))for(var h in c.overlays)c.overlays[h]instanceof L.LayerGroup&&c.overlays[h].hasLayer(g)&&c.overlays[h].removeLayer(g);if(e(d))for(var i in d)d[i].hasLayer(g)&&d[i].removeLayer(g);a.removeLayer(g),delete b[f]},createMarker:function(a,b,d,k,m,q,r){var s=o(b);if(e(s)){if(e(b.layer)&&!h(b.layer))return c.error("[AngularJS - Leaflet] A layername must be a string"),void 0;if(e(b.layer)){if(!e(m))return c.error("[AngularJS - Leaflet] You must add layers to the directive if used in a marker"),void 0;if(!e(m.overlays))return c.error("[AngularJS - Leaflet] You must add layers overlays to the directive if used in a marker"),void 0;if(!e(m.overlays[b.layer]))return c.error("[AngularJS - Leaflet] You must use a name of an existing layer"),void 0;var t=m.overlays[b.layer];if(!(t instanceof L.LayerGroup))return c.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"'),void 0;t.addLayer(s),k.hasLayer(s)&&b.focus===!0&&s.openPopup()}else{if(e(b.group)){if(!g.isLoaded())return c.error("[AngularJS - Leaflet] The MarkerCluster plugin is not loaded."),void 0;e(q[b.group])||(q[b.group]=new L.MarkerClusterGroup,k.addLayer(q[b.group])),q[b.group].addLayer(s)}else k.addLayer(s);f.LabelPlugin.isLoaded()&&e(b.label)&&e(b.label.options)&&b.label.options.noHide===!0&&s.showLabel(),b.focus===!0&&s.openPopup()}var u,v,w=[],x="broadcast";if(e(d.eventBroadcast))if("object"!=typeof d.eventBroadcast)c.warn("[AngularJS - Leaflet] event-broadcast must be an object check your model.");else if(e(d.eventBroadcast.marker))if(j(d.eventBroadcast.marker))c.warn("[AngularJS - Leaflet] event-broadcast.marker must be an object check your model.");else{void 0!==d.eventBroadcast.marker.logic&&null!==d.eventBroadcast.marker.logic&&("emit"!==d.eventBroadcast.marker.logic&&"broadcast"!==d.eventBroadcast.marker.logic?c.warn("[AngularJS - Leaflet] Available event propagation logic are: 'emit' or 'broadcast'."):"emit"===d.eventBroadcast.marker.logic&&(x="emit"));var y=!1,z=!1;if(void 0!==d.eventBroadcast.marker.enable&&null!==d.eventBroadcast.marker.enable&&"object"==typeof d.eventBroadcast.marker.enable&&(y=!0),void 0!==d.eventBroadcast.marker.disable&&null!==d.eventBroadcast.marker.disable&&"object"==typeof d.eventBroadcast.marker.disable&&(z=!0),y&&z)c.warn("[AngularJS - Leaflet] can not enable and disable events at the same time");else if(y||z)if(y)for(u=0;u<d.eventBroadcast.marker.enable.length;u++)v=d.eventBroadcast.marker.enable[u],-1!==w.indexOf(v)?c.warn("[AngularJS - Leaflet] This event "+v+" is already enabled"):-1===l.indexOf(v)?c.warn("[AngularJS - Leaflet] This event "+v+" does not exist"):w.push(v);else for(w=l,u=0;u<d.eventBroadcast.marker.disable.length;u++){v=d.eventBroadcast.marker.disable[u];var A=w.indexOf(v);-1===A?c.warn("[AngularJS - Leaflet] This event "+v+" does not exist or has been already disabled"):w.splice(A,1)}else c.warn("[AngularJS - Leaflet] must enable or disable events")}else w=l;else w=l;for(u=0;u<w.length;u++)v=w[u],s.on(v,p(v,x,a,d,s,b),{eventName:v,scope_watch_name:a});if(r)var B=d.$watch(a,function(a,b){if(!e(a)){if(s.closePopup(),e(m)&&e(m.overlays))for(var d in m.overlays)m.overlays[d]instanceof L.LayerGroup&&m.overlays[d].hasLayer(s)&&m.overlays[d].removeLayer(s);return k.removeLayer(s),B(),void 0}if(e(b)){if(h(a.layer)){if(e(b.layer)||b.layer!==a.layer)if("string"==typeof b.layer&&void 0!==m.overlays[b.layer]&&m.overlays[b.layer].hasLayer(s)&&m.overlays[b.layer].removeLayer(s),s.closePopup(),k.hasLayer(s)&&k.removeLayer(s),void 0!==m.overlays[a.layer]){var g=m.overlays[a.layer];g instanceof L.LayerGroup?(g.addLayer(s),k.hasLayer(s)&&a.focus===!0&&s.openPopup()):c.error('[AngularJS - Leaflet] A marker can only be added to a layer of type "group"')}else c.error("[AngularJS - Leaflet] You must use a name of an existing layer")}else h(b.layer)&&(e(m.overlays[b.layer])&&m.overlays[b.layer].hasLayer(s)&&(m.overlays[b.layer].removeLayer(s),s.closePopup()),k.hasLayer(s)||k.addLayer(s));if(void 0===a.draggable||null===a.draggable||a.draggable!==!0?void 0!==b.draggable&&null!==b.draggable&&b.draggable===!0&&s.dragging&&s.dragging.disable():(void 0===b.draggable||null===b.draggable||b.draggable!==!0)&&(s.dragging?s.dragging.enable():L.Handler.MarkerDrag&&(s.dragging=new L.Handler.MarkerDrag(s),s.options.draggable=!0,s.dragging.enable())),void 0===a.icon||null===a.icon||"object"!=typeof a.icon)void 0!==b.icon&&null!==b.icon&&"object"==typeof b.icon&&(s.setIcon(n()),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message));else if(void 0===b.icon||null===b.icon||"object"!=typeof b.icon){var j=!1;s.dragging&&(j=s.dragging.enabled()),f.AwesomeMarkersPlugin.is(a.icon)?s.setIcon(a.icon):f.Leaflet.DivIcon.is(a.icon)||f.Leaflet.Icon.is(a.icon)?s.setIcon(a.icon):s.setIcon(n(a.icon)),j&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}else if(f.AwesomeMarkersPlugin.is(a.icon)){if(!f.AwesomeMarkersPlugin.equal(a.icon,b.icon)){var l=!1;s.dragging&&(l=s.dragging.enabled()),s.setIcon(a.icon),l&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}}else if(f.Leaflet.DivIcon.is(a.icon)){if(!f.Leaflet.DivIcon.equal(a.icon,b.icon)){var o=!1;s.dragging&&(o=s.dragging.enabled()),s.setIcon(a.icon),o&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}}else if(f.Leaflet.Icon.is(a.icon)){if(!f.Leaflet.Icon.equal(a.icon,b.icon)){var p=!1;s.dragging&&(p=s.dragging.enabled()),s.setIcon(a.icon),p&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}}else if(JSON.stringify(a.icon)!==JSON.stringify(b.icon)){var q=!1;s.dragging&&(q=s.dragging.enabled()),s.setIcon(n(a.icon)),q&&s.dragging.enable(),s.closePopup(),s.unbindPopup(),void 0!==a.message&&null!==a.message&&"string"==typeof a.message&&""!==a.message&&s.bindPopup(a.message)}if(void 0===a.message||null===a.message||"string"!=typeof a.message||""===a.message?void 0!==b.message&&null!==b.message&&"string"==typeof b.message&&""!==b.message&&(s.closePopup(),s.unbindPopup()):void 0===b.message||null===b.message||"string"!=typeof b.message||""===b.message?(s.bindPopup(a.message),a.focus===!0&&s.openPopup()):a.message!==b.message&&s.setPopupContent(a.message),void 0===a.focus||null===a.focus||a.focus!==!0?void 0!==b.focus&&null!==b.focus&&b.focus===!0&&s.closePopup():void 0===b.focus||null===b.focus||b.focus!==!0?s.openPopup():b.focus===!0&&a.focus===!0&&s.openPopup(),i(a.lat)&&i(a.lng)){var r=s.getLatLng();if(r.lat!==a.lat||r.lng!==a.lng){var t=!1;h(a.layer)&&f.MarkerClusterPlugin.is(m.overlays[a.layer])&&(m.overlays[a.layer].removeLayer(s),t=!0),s.setLatLng([a.lat,a.lng]),t&&m.overlays[a.layer].addLayer(s)}}else{if(c.warn("There are problems with lat-lng data, please verify your marker model"),e(m)&&e(m.overlays))for(var u in m.overlays)(m.overlays[u]instanceof L.LayerGroup||f.MarkerClusterPlugin.is(m.overlays[u]))&&m.overlays[u].hasLayer(s)&&m.overlays[u].removeLayer(s);k.removeLayer(s)}}},!0);return s}}}}]),angular.module("leaflet-directive").factory("leafletHelpers",["$q","$log",function(a,b){function c(a,c){var d,e;if(angular.isDefined(c))d=c;else if(1===Object.keys(a).length)for(e in a)a.hasOwnProperty(e)&&(d=e);else 0===Object.keys(a).length?d="main":b.error("[AngularJS - Leaflet] - You have more than 1 map on the DOM, you must provide the map ID to the leafletData.getXXX call");return d}function d(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)}function e(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}function f(a){return a.filter(function(a){return!!a.lat&&!!a.lng}).map(function(a){return new L.LatLng(a.lat,a.lng)})}return{isDefined:function(a){return angular.isDefined(a)&&null!==a},isNumber:function(a){return angular.isNumber(a)},isString:function(a){return angular.isString(a)},isArray:function(a){return angular.isArray(a)},isObject:function(a){return angular.isObject(a)},equals:function(a,b){return angular.equals(a,b) | ||
},isValidCenter:function(a){return angular.isDefined(a)&&angular.isNumber(a.lat)&&angular.isNumber(a.lng)&&angular.isNumber(a.zoom)},isValidBounds:d,createLeafletBounds:function(a){return d(a)?L.latLngBounds([a.southWest.lat,a.southWest.lng],[a.northEast.lat,a.northEast.lng]):!1},convertToLeafletLatLngs:f,convertToLeafletLatLng:function(a){return new L.LatLng(a.lat,a.lng)},convertToLeafletMultiLatLngs:function(a){return a.map(function(a){return f(a)})},safeApply:function(a,b){var c=a.$root.$$phase;"$apply"===c||"$digest"===c?a.$eval(b):a.$apply(b)},obtainEffectiveMapId:c,getDefer:function(a,b){var d,f=c(a,b);return d=angular.isDefined(a[f])&&a[f].resolvedDefer!==!1?a[f].defer:e(a,b)},getUnresolvedDefer:e,setResolvedDefer:function(a,b){var d=c(a,b);a[d].resolvedDefer=!0},AwesomeMarkersPlugin:{isLoaded:function(){return void 0!==L.AwesomeMarkers?void 0!==L.AwesomeMarkers.Icon:!1},is:function(a){return this.isLoaded()?a instanceof L.AwesomeMarkers.Icon:!1},equal:function(a,b){return this.isLoaded()?this.is(a)?angular.equals(a,b):!1:!1}},LabelPlugin:{isLoaded:function(){return angular.isDefined(L.Label)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},MarkerClusterPlugin:{isLoaded:function(){return angular.isDefined(L.MarkerClusterGroup)},is:function(a){return this.isLoaded()?a instanceof L.MarkerClusterGroup:!1}},GoogleLayerPlugin:{isLoaded:function(){return angular.isDefined(L.Google)},is:function(a){return this.isLoaded()?a instanceof L.Google:!1}},BingLayerPlugin:{isLoaded:function(){return angular.isDefined(L.BingLayer)},is:function(a){return this.isLoaded()?a instanceof L.BingLayer:!1}},WFSLayerPlugin:{isLoaded:function(){return void 0!==L.GeoJSON.WFS},is:function(a){return this.isLoaded()?a instanceof L.GeoJSON.WFS:!1}},AGSLayerPlugin:{isLoaded:function(){return void 0!==lvector&&void 0!==lvector.AGS},is:function(a){return this.isLoaded()?a instanceof lvector.AGS:!1}},DynamicMapLayerPlugin:{isLoaded:function(){return void 0!==L.esri&&void 0!==L.esri.dynamicMapLayer},is:function(a){return this.isLoaded()?a instanceof L.esri.dynamicMapLayer:!1}},Leaflet:{DivIcon:{is:function(a){return a instanceof L.DivIcon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}},Icon:{is:function(a){return a instanceof L.Icon},equal:function(a,b){return this.is(a)?angular.equals(a,b):!1}}}}}])}(); |
@@ -208,3 +208,3 @@ module.exports = function(grunt) { | ||
source: { | ||
files: ['src/**/*.js', 'test/unit/**'], | ||
files: ['src/**/*.js', 'test/unit/**.js', 'test/e2e/**.js'], | ||
tasks: [ | ||
@@ -211,0 +211,0 @@ 'jshint', |
@@ -5,3 +5,3 @@ { | ||
"description": "angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"homepage": "http://tombatossals.github.io/angular-leaflet-directive/", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -11,2 +11,4 @@ # angular-leaflet-directive [![Build Status](https://travis-ci.org/tombatossals/angular-leaflet-directive.png)](https://travis-ci.org/tombatossals/angular-leaflet-directive) [![Dependency Status](https://gemnasium.com/tombatossals/angular-leaflet-directive.png)](https://gemnasium.com/tombatossals/angular-leaflet-directive) | ||
* [Basic example](http://tombatossals.github.io/angular-leaflet-directive/examples/simple-example.html) | ||
* [Center example](http://tombatossals.github.io/angular-leaflet-directive/examples/center-example.html) | ||
* [Center autodiscover example](http://tombatossals.github.io/angular-leaflet-directive/examples/center-autodiscover-example.html) | ||
* [Custom parameters example](http://tombatossals.github.io/angular-leaflet-directive/examples/custom-parameters-example.html) | ||
@@ -17,2 +19,3 @@ * [Single marker example](http://tombatossals.github.io/angular-leaflet-directive/examples/marker-example.html) | ||
* [Markers example](http://tombatossals.github.io/angular-leaflet-directive/examples/markers-example.html) | ||
* [Marker groups example](http://tombatossals.github.io/angular-leaflet-directive/examples/marker-groups-example.html) | ||
* [Polyline example](http://tombatossals.github.io/angular-leaflet-directive/examples/path-example.html) | ||
@@ -19,0 +22,0 @@ * [Tile changer example](http://tombatossals.github.io/angular-leaflet-directive/examples/tiles-example.html) |
@@ -17,21 +17,19 @@ angular.module("leaflet-directive").directive('center', function ($log, $parse, leafletMapDefaults, leafletHelpers) { | ||
var defaults = leafletMapDefaults.getDefaults(attrs.id); | ||
if (isDefined(center)) { | ||
if (center.autoDiscover === true) { | ||
map.locate({ setView: true, maxZoom: defaults.maxZoom }); | ||
} | ||
var centerModel = { | ||
lat: $parse("center.lat"), | ||
lng: $parse("center.lng"), | ||
zoom: $parse("center.zoom") | ||
}; | ||
} else { | ||
$log.warn("[AngularJS - Leaflet] 'center' is undefined in the current scope, did you forget to initialize it?"); | ||
if (!isDefined(center)) { | ||
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom); | ||
return; | ||
} | ||
var centerModel = { | ||
lat: $parse("center.lat"), | ||
lng: $parse("center.lng"), | ||
zoom: $parse("center.zoom"), | ||
autoDiscover: $parse("center.autoDiscover") | ||
}; | ||
var movingMap = false; | ||
leafletScope.$watch("center", function(center) { | ||
if (!isValidCenter(center)) { | ||
if (!isValidCenter(center) && center.autoDiscover !== true) { | ||
$log.warn("[AngularJS - Leaflet] invalid 'center'"); | ||
@@ -45,2 +43,13 @@ map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom); | ||
} | ||
if (center.autoDiscover === true) { | ||
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom); | ||
if (isDefined(defaults.maxZoom)) { | ||
map.locate({ setView: true, maxZoom: defaults.maxZoom }); | ||
} else { | ||
map.locate({ setView: true }); | ||
} | ||
return; | ||
} | ||
map.setView([center.lat, center.lng], center.zoom); | ||
@@ -60,5 +69,17 @@ }, true); | ||
centerModel.zoom.assign(scope, map.getZoom()); | ||
centerModel.autoDiscover.assign(scope, false); | ||
} | ||
}); | ||
}); | ||
if (center.autoDiscover === true) { | ||
map.on("locationerror", function() { | ||
$log.warn("[AngularJS - Leaflet] The Geolocation API is unauthorized on this page."); | ||
if (isValidCenter(center)) { | ||
map.setView([center.lat, center.lng], center.zoom); | ||
} else { | ||
map.setView([defaults.center.lat, defaults.center.lng], defaults.center.zoom); | ||
} | ||
}); | ||
} | ||
}); | ||
@@ -65,0 +86,0 @@ } |
@@ -135,2 +135,4 @@ angular.module("leaflet-directive").directive('layers', function ($log, $q, leafletData, leafletHelpers, leafletMapDefaults, leafletLayerHelpers) { | ||
var overLayersNotVisible = {}; | ||
// Watch for the overlay layers | ||
@@ -164,2 +166,15 @@ leafletScope.$watch('layers.overlays', function(newOverlayLayers) { | ||
} | ||
// watch for the .visible property to hide/show overLayers | ||
if (newOverlayLayers[new_name].visible && !map.hasLayer(leafletLayers.overlays[new_name])) { | ||
if (overLayersNotVisible[new_name]) { | ||
map.addLayer(overLayersNotVisible[new_name]); | ||
} else { | ||
leafletLayers.controls.layers.addOverlay(leafletLayers.overlays[new_name], newOverlayLayers[new_name].name); | ||
map.addLayer(leafletLayers.overlays[new_name]); | ||
} | ||
} else if (newOverlayLayers[new_name].visible === false && map.hasLayer(leafletLayers.overlays[new_name])) { | ||
overLayersNotVisible[new_name] = leafletLayers.overlays[new_name]; | ||
map.removeLayer(leafletLayers.overlays[new_name]); | ||
} | ||
} | ||
@@ -166,0 +181,0 @@ }, true); |
@@ -11,3 +11,2 @@ angular.module("leaflet-directive", []).directive('leaflet', function ($q, leafletData, leafletMapDefaults, leafletHelpers, leafletEvents) { | ||
bounds: '=bounds', | ||
marker: '=marker', | ||
markers: '=markers', | ||
@@ -14,0 +13,0 @@ legend: '=legend', |
@@ -164,2 +164,3 @@ angular.module("leaflet-directive").factory('leafletLayerHelpers', function ($rootScope, $log, leafletHelpers) { | ||
layer: layerDefinition.layer, | ||
type: layerDefinition.layerType, | ||
bounds: layerDefinition.bounds, | ||
@@ -166,0 +167,0 @@ key: layerDefinition.key |
@@ -1,2 +0,2 @@ | ||
angular.module("leaflet-directive").factory('leafletMapDefaults', function ($q, leafletHelpers) { | ||
angular.module("leaflet-directive").factory('leafletMapDefaults', function (leafletHelpers) { | ||
function _getDefaults() { | ||
@@ -3,0 +3,0 @@ return { |
@@ -16,12 +16,15 @@ 'use strict'; | ||
ptor.sleep(300); | ||
element(by.xpath('/html/body/form/input[3]')).getAttribute("value").then(function(zoom) { | ||
expect(zoom).toBe('5'); | ||
}); | ||
expect(element(by.model("london.zoom")).getAttribute("value")).toBe('5'); | ||
}); | ||
xit('should update the zoom value if the map is dragged', function() { | ||
element(by.xpath('/html/body/form/input[3]')).sendKeys("2"); | ||
ptor.sleep(3000); | ||
it('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]')); | ||
browser.actions().dragAndDrop(el.find(), { x: 40, y: 40 }).perform(); | ||
ptor.sleep(300); | ||
expect(element(by.model("london.lat")).getAttribute("value")).toBe('51.505'); | ||
expect(element(by.model("london.lng")).getAttribute("value")).toBe('-0.09'); | ||
}); | ||
}); |
@@ -12,3 +12,3 @@ 'use strict'; | ||
it('should update the zoom value in the input if clicked the zoom control', function() { | ||
it('should load a marker when clicked on the map', function() { | ||
ptor.wait(function() { | ||
@@ -19,2 +19,3 @@ return ptor.isElementPresent(by.css('img.leaflet-tile-loaded')); | ||
element(by.css('img.leaflet-tile-loaded')).click().then(function() { | ||
ptor.sleep(100); | ||
expect(ptor.isElementPresent(by.css("img.leaflet-marker-icon"))).toBe(true); | ||
@@ -21,0 +22,0 @@ }); |
@@ -17,9 +17,16 @@ 'use strict'; | ||
element(by.css('img.leaflet-tile-loaded')).click().then(function() { | ||
expect(element(by.model("bounds.southWest.lat")).getAttribute("value")).toBe("39.232253141714885"); | ||
expect(element(by.model("bounds.southWest.lng")).getAttribute("value")).toBe("-28.212890625"); | ||
expect(element(by.model("bounds.northEast.lat")).getAttribute("value")).toBe("61.18562468142283"); | ||
expect(element(by.model("bounds.northEast.lng")).getAttribute("value")).toBe("28.037109375"); | ||
expect(element(by.model("bounds.southWest.lat")).getAttribute("value")).toBe("39.232253141714885"); | ||
expect(element(by.model("bounds.southWest.lng")).getAttribute("value")).toBe("-28.212890625"); | ||
expect(element(by.model("bounds.northEast.lat")).getAttribute("value")).toBe("61.18562468142283"); | ||
expect(element(by.model("bounds.northEast.lng")).getAttribute("value")).toBe("28.037109375"); | ||
element(by.xpath('.//*[@title="Zoom in"]')).click().then(function() { | ||
ptor.sleep(400); | ||
expect(element(by.model("bounds.southWest.lat")).getAttribute("value")).toBe("45.706179285330855"); | ||
expect(element(by.model("bounds.southWest.lng")).getAttribute("value")).toBe("-14.150390625"); | ||
expect(element(by.model("bounds.northEast.lat")).getAttribute("value")).toBe("56.65622649350222"); | ||
expect(element(by.model("bounds.northEast.lng")).getAttribute("value")).toBe("13.974609375"); | ||
}); | ||
}); | ||
}); |
@@ -8,7 +8,7 @@ 'use strict'; | ||
ptor = protractor.getInstance(); | ||
browser.get('/examples/bounds-example.html'); | ||
browser.get('/examples/custom-parameters-example.html'); | ||
driver = ptor.driver; | ||
}); | ||
it('should update the bounds values in the input if clicked the zoom control', function() { | ||
it('should have loaded the opencyclemaps tiles', function() { | ||
ptor.wait(function() { | ||
@@ -18,9 +18,6 @@ return ptor.isElementPresent(by.css('img.leaflet-tile-loaded')); | ||
element(by.css('img.leaflet-tile-loaded')).click().then(function() { | ||
expect(element(by.model("bounds.southWest.lat")).getAttribute("value")).toBe("39.232253141714885"); | ||
expect(element(by.model("bounds.southWest.lng")).getAttribute("value")).toBe("-28.212890625"); | ||
expect(element(by.model("bounds.northEast.lat")).getAttribute("value")).toBe("61.18562468142283"); | ||
expect(element(by.model("bounds.northEast.lng")).getAttribute("value")).toBe("28.037109375"); | ||
element(by.xpath('//img[contains(@class, "leaflet-tile-loaded")][1]')).getAttribute("src").then(function(src) { | ||
expect(src).toContain("tile.opencyclemap.org"); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2003593
149
23903
80