Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'Leaflet.weather-markers' #1132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"leaflet-tilelayer-geojson": "*",
"Leaflet.utfgrid": "danzel/Leaflet.utfgrid",
"Leaflet.awesome-markers": "*",
"Leaflet.weather-markers": "*",
"leaflet-providers": "*",
"leaflet.vector-markers": "*",
"webgl-heatmap-leaflet": "*",
Expand Down
54 changes: 49 additions & 5 deletions dist/angular-leaflet-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/

/*!
* angular-leaflet-directive 2015-11-06
* angular-leaflet-directive 0.10.1 2016-07-21
* angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps
* git: https://github.com/tombatossals/angular-leaflet-directive
*/
Expand Down Expand Up @@ -492,7 +492,7 @@ 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) {
Expand Down Expand Up @@ -929,6 +929,32 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},

WeatherMarkersPlugin: {
isLoaded: function() {
return angular.isDefined(L.WeatherMarkers) && angular.isDefined(L.WeatherMarkers.Icon);
},

is: function(icon) {
if (this.isLoaded()) {
return icon instanceof L.WeatherMarkers.Icon;
} else {
return false;
}
},

equal: function(iconA, iconB) {
if (!this.isLoaded()) {
return false;
}

if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
return false;
}
},
},

VectorMarkersPlugin: {
isLoaded: function() {
return angular.isDefined(L.VectorMarkers) && angular.isDefined(L.VectorMarkers.Icon);
Expand Down Expand Up @@ -1642,6 +1668,16 @@ angular.module('leaflet-directive')
});
},
},
geoJSONWeatherMarker: {
mustHaveUrl: false,
createLayer: function(params) {
return new L.geoJson(params.data, {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: L.WeatherMarkers.icon(params.icon)});
},
});
},
},
geoJSONVectorMarker: {
mustHaveUrl: false,
createLayer: function(params) {
Expand Down Expand Up @@ -2383,6 +2419,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
var defaultTo = leafletHelpers.defaultTo;
var MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin;
var AwesomeMarkersPlugin = leafletHelpers.AwesomeMarkersPlugin;
var WeatherMarkersPlugin = leafletHelpers.WeatherMarkersPlugin;
var VectorMarkersPlugin = leafletHelpers.VectorMarkersPlugin;
var MakiMarkersPlugin = leafletHelpers.MakiMarkersPlugin;
var ExtraMarkersPlugin = leafletHelpers.ExtraMarkersPlugin;
Expand Down Expand Up @@ -2420,6 +2457,14 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return new L.AwesomeMarkers.icon(iconData);
}

if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'weatherMarker') {
if (!WeatherMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The WeatherMarkers Plugin is not loaded.');
}

return new L.WeatherMarkers.icon(iconData);
}

if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'vectorMarker') {
if (!VectorMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The VectorMarkers Plugin is not loaded.');
Expand Down Expand Up @@ -3855,8 +3900,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;
}
Expand Down Expand Up @@ -5147,7 +5191,7 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
});
},
};
},]);
}, ]);
});

angular.module('leaflet-directive')
Expand Down
8 changes: 4 additions & 4 deletions dist/angular-leaflet-directive.min.js

Large diffs are not rendered by default.

54 changes: 49 additions & 5 deletions dist/angular-leaflet-directive.no-header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-leaflet-directive 2015-11-06
* angular-leaflet-directive 0.10.1 2016-07-21
* angular-leaflet-directive - An AngularJS directive to easily interact with Leaflet maps
* git: https://github.com/tombatossals/angular-leaflet-directive
*/
Expand Down Expand Up @@ -463,7 +463,7 @@ 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) {
Expand Down Expand Up @@ -900,6 +900,32 @@ angular.module('leaflet-directive').service('leafletHelpers', ["$q", "$log", fun
},
},

WeatherMarkersPlugin: {
isLoaded: function() {
return angular.isDefined(L.WeatherMarkers) && angular.isDefined(L.WeatherMarkers.Icon);
},

is: function(icon) {
if (this.isLoaded()) {
return icon instanceof L.WeatherMarkers.Icon;
} else {
return false;
}
},

equal: function(iconA, iconB) {
if (!this.isLoaded()) {
return false;
}

if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
return false;
}
},
},

VectorMarkersPlugin: {
isLoaded: function() {
return angular.isDefined(L.VectorMarkers) && angular.isDefined(L.VectorMarkers.Icon);
Expand Down Expand Up @@ -1613,6 +1639,16 @@ angular.module('leaflet-directive')
});
},
},
geoJSONWeatherMarker: {
mustHaveUrl: false,
createLayer: function(params) {
return new L.geoJson(params.data, {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: L.WeatherMarkers.icon(params.icon)});
},
});
},
},
geoJSONVectorMarker: {
mustHaveUrl: false,
createLayer: function(params) {
Expand Down Expand Up @@ -2354,6 +2390,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
var defaultTo = leafletHelpers.defaultTo;
var MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin;
var AwesomeMarkersPlugin = leafletHelpers.AwesomeMarkersPlugin;
var WeatherMarkersPlugin = leafletHelpers.WeatherMarkersPlugin;
var VectorMarkersPlugin = leafletHelpers.VectorMarkersPlugin;
var MakiMarkersPlugin = leafletHelpers.MakiMarkersPlugin;
var ExtraMarkersPlugin = leafletHelpers.ExtraMarkersPlugin;
Expand Down Expand Up @@ -2391,6 +2428,14 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', ["$rootScop
return new L.AwesomeMarkers.icon(iconData);
}

if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'weatherMarker') {
if (!WeatherMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The WeatherMarkers Plugin is not loaded.');
}

return new L.WeatherMarkers.icon(iconData);
}

if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'vectorMarker') {
if (!VectorMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The VectorMarkers Plugin is not loaded.');
Expand Down Expand Up @@ -3826,8 +3871,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;
}
Expand Down Expand Up @@ -5118,7 +5162,7 @@ angular.module('leaflet-directive').directive('tiles', ["$log", "leafletData", "
});
},
};
},]);
}, ]);
});

angular.module('leaflet-directive')
Expand Down
26 changes: 26 additions & 0 deletions src/services/leafletHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,32 @@ angular.module('leaflet-directive').service('leafletHelpers', function($q, $log)
},
},

WeatherMarkersPlugin: {
isLoaded: function() {
return angular.isDefined(L.WeatherMarkers) && angular.isDefined(L.WeatherMarkers.Icon);
},

is: function(icon) {
if (this.isLoaded()) {
return icon instanceof L.WeatherMarkers.Icon;
} else {
return false;
}
},

equal: function(iconA, iconB) {
if (!this.isLoaded()) {
return false;
}

if (this.is(iconA)) {
return angular.equals(iconA, iconB);
} else {
return false;
}
},
},

VectorMarkersPlugin: {
isLoaded: function() {
return angular.isDefined(L.VectorMarkers) && angular.isDefined(L.VectorMarkers.Icon);
Expand Down
10 changes: 10 additions & 0 deletions src/services/leafletLayerHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ angular.module('leaflet-directive')
});
},
},
geoJSONWeatherMarker: {
mustHaveUrl: false,
createLayer: function(params) {
return new L.geoJson(params.data, {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: L.WeatherMarkers.icon(params.icon)});
},
});
},
},
geoJSONVectorMarker: {
mustHaveUrl: false,
createLayer: function(params) {
Expand Down
9 changes: 9 additions & 0 deletions src/services/leafletMarkersHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
var defaultTo = leafletHelpers.defaultTo;
var MarkerClusterPlugin = leafletHelpers.MarkerClusterPlugin;
var AwesomeMarkersPlugin = leafletHelpers.AwesomeMarkersPlugin;
var WeatherMarkersPlugin = leafletHelpers.WeatherMarkersPlugin;
var VectorMarkersPlugin = leafletHelpers.VectorMarkersPlugin;
var MakiMarkersPlugin = leafletHelpers.MakiMarkersPlugin;
var ExtraMarkersPlugin = leafletHelpers.ExtraMarkersPlugin;
Expand Down Expand Up @@ -40,6 +41,14 @@ angular.module('leaflet-directive').service('leafletMarkersHelpers', function($r
return new L.AwesomeMarkers.icon(iconData);
}

if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'weatherMarker') {
if (!WeatherMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The WeatherMarkers Plugin is not loaded.');
}

return new L.WeatherMarkers.icon(iconData);
}

if (isDefined(iconData) && isDefined(iconData.type) && iconData.type === 'vectorMarker') {
if (!VectorMarkersPlugin.isLoaded()) {
$log.error(errorHeader + ' The VectorMarkers Plugin is not loaded.');
Expand Down
Loading