node-red-contrib-geofence
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "node-red-contrib-geofence", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "A simple node to filter based on location", | ||
@@ -5,0 +5,0 @@ "dependencies" :{ |
@@ -48,2 +48,30 @@ var configButton; | ||
var googleUrl = 'http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}'; | ||
var googleAttrib = 'Google'; | ||
var google = L.tileLayer(googleUrl, { maxZoom: 25, attribution: googleAttrib }); | ||
var customUrl = 'https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFnbnVzc3AiLCJhIjoiY2lnM3AyeTlrMDJrcXYza2hwYXF1cWtidCJ9.wuim_DRupGAUe6gbLSY-jA' | ||
var customAttrib = 'MagnusMaps (c)'; | ||
var custom = L.tileLayer(googleUrl, { maxZoom: 25, attribution: customAttrib }); | ||
var mapLayers = { | ||
'osm': osm, | ||
'google': google, | ||
'custom': custom | ||
}; | ||
window.node_geofence_map = map; | ||
var cookieMap = Cookies.get('map') || 'osm'; | ||
Object.keys(mapLayers).forEach(function (key){ | ||
mapLayers[key].on('add', function(){ | ||
Cookies.set('map', key); | ||
}); | ||
}); | ||
var currentMapLayer = mapLayers[cookieMap]; | ||
currentMapLayer.addTo(map); | ||
fenceEditOptions = { | ||
@@ -61,9 +89,2 @@ showLength: true, | ||
window.node_geofence_map = map; | ||
L.tileLayer(osmUrl, { | ||
maxZoom: 25, | ||
attribution: osmAttrib | ||
}).addTo(map); | ||
new L.Control.GeoSearch({ | ||
@@ -79,3 +100,2 @@ provider: new L.GeoSearch.Provider.OpenStreetMap(), | ||
drawControl = new L.Control.Draw({ | ||
@@ -103,16 +123,4 @@ draw: { | ||
L.control.layers(mapLayers, { 'drawlayer': drawnItems }, { collapsed: true }).addTo(map); | ||
L.control.layers( | ||
{ | ||
'osm': osm.addTo(map), | ||
"google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}', { | ||
attribution: 'google', | ||
maxZoom: 25 | ||
}), | ||
'custom': L.tileLayer('https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFnbnVzc3AiLCJhIjoiY2lnM3AyeTlrMDJrcXYza2hwYXF1cWtidCJ9.wuim_DRupGAUe6gbLSY-jA', { | ||
attribution: 'MagnusMaps (c)', | ||
maxZoom: 25 | ||
}) | ||
}, { 'drawlayer': drawnItems }, { collapsed: true }).addTo(map); | ||
var editControl = new L.Control.Draw({ | ||
@@ -161,5 +169,3 @@ draw: false, | ||
nodeManager = RED.nodes.node(nodeManagerId); | ||
if(nodeManagerId != "_ADD_"){ | ||
changeNodeManager(nodeManager); | ||
} | ||
changeNodeManager(nodeManager); | ||
}); | ||
@@ -169,5 +175,3 @@ | ||
var nodeManager = RED.nodes.node(initialNodeManagerID); | ||
if(nodeManager != null){ | ||
changeNodeManager(nodeManager); | ||
} | ||
changeNodeManager(nodeManager); | ||
} | ||
@@ -180,2 +184,8 @@ | ||
if(nodeManager == null){ | ||
console.log("No node manager selected"); | ||
drawControl.remove(); | ||
return; | ||
} | ||
var shapeList = []; | ||
@@ -233,37 +243,4 @@ | ||
$.getScript('geofence/js/leaflet/leaflet-src.js') | ||
.done(function (data, textStatus, jqxhr) { | ||
$.getScript('geofence/js/Leaflet.draw/dist/leaflet.draw.js') | ||
.done(function (data, textStatus, jqxhr) { | ||
$.getScript('geofence/js/L.GeoSearch/src/js/l.control.geosearch.js') | ||
.done(function (data, textStatus, jqxhr) { | ||
$.getScript('geofence/js/L.GeoSearch/src/js/l.geosearch.provider.openstreetmap.js') | ||
.done(function (data, textStatus, jqxhr) { | ||
initializeMap(node); | ||
initializeMap(node); | ||
}) | ||
.fail(function (jqxhr, settings, exception) { | ||
console.log("failed4"); | ||
console.log(exception); | ||
console.log(exception.stack); | ||
}); | ||
}) | ||
.fail(function (jqxhr, settings, exception) { | ||
console.log("failed3"); | ||
console.log(exception); | ||
console.log(exception.stack); | ||
}); | ||
}) | ||
.fail(function (jqxhr, settings, exception) { | ||
console.log("failed2"); | ||
console.log(exception); | ||
console.log(exception.stack); | ||
}); | ||
}) | ||
.fail(function (jqxhr, settings, exception) { | ||
console.log("failed"); | ||
console.log(exception); | ||
console.log(exception.stack); | ||
}); | ||
}, | ||
@@ -270,0 +247,0 @@ oneditsave: function () { |
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
4759089
122
44879