Skip to content

Commit

Permalink
feat(build): Added a new GeoJSON layer. Thanks to @cktong:
Browse files Browse the repository at this point in the history
  • Loading branch information
tombatossals committed Feb 9, 2014
1 parent e116560 commit e9c391d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
23 changes: 22 additions & 1 deletion dist/angular-leaflet-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ angular.module("leaflet-directive").factory('leafletEvents', function ($rootScop
if (!isDefined(leafletScope.eventBroadcast.marker)) {
// We do not have events enable/disable do we do nothing (all enabled by default)
markerEvents = _getAvailableMarkerEvents();
} else if (isObject(leafletScope.eventBroadcast.marker)) {
} else if (!isObject(leafletScope.eventBroadcast.marker)) {
// Not a valid object
$log.warn("[AngularJS - Leaflet] event-broadcast.marker must be an object check your model.");
} else {
Expand Down Expand Up @@ -1609,6 +1609,15 @@ angular.module("leaflet-directive").factory('leafletLayerHelpers', function ($ro
return L.tileLayer(params.url, params.options);
}
},
geoJSON:{
mustHaveUrl: true,
createLayer: function(params) {
if (!Helpers.GeoJSONPlugin.isLoaded()) {
return;
}
return new L.TileLayer.GeoJSON(params.url, params.pluginOptions, params.options);
}
},
wms: {
mustHaveUrl: true,
createLayer: function(params) {
Expand Down Expand Up @@ -2636,6 +2645,18 @@ angular.module("leaflet-directive").factory('leafletHelpers', function ($q, $log
}
},
},
GeoJSONPlugin: {
isLoaded: function(){
return angular.isDefined(L.TileLayer.GeoJSON);
},
is: function(layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.GeoJSON;
} else {
return false;
}
}
},
Leaflet: {
DivIcon: {
is: function(icon) {
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-leaflet-directive.min.js

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions src/services/leafletHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,18 @@ angular.module("leaflet-directive").factory('leafletHelpers', function ($q, $log
}
},
},
GeoJSONPlugin: {
isLoaded: function(){
return angular.isDefined(L.TileLayer.GeoJSON);
},
is: function(layer) {
if (this.isLoaded()) {
return layer instanceof L.TileLayer.GeoJSON;
} else {
return false;
}
}
},
Leaflet: {
DivIcon: {
is: function(icon) {
Expand Down
9 changes: 9 additions & 0 deletions src/services/leafletLayerHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ angular.module("leaflet-directive").factory('leafletLayerHelpers', function ($ro
return L.tileLayer(params.url, params.options);
}
},
geoJSON:{
mustHaveUrl: true,
createLayer: function(params) {
if (!Helpers.GeoJSONPlugin.isLoaded()) {
return;
}
return new L.TileLayer.GeoJSON(params.url, params.pluginOptions, params.options);
}
},
wms: {
mustHaveUrl: true,
createLayer: function(params) {
Expand Down

0 comments on commit e9c391d

Please sign in to comment.