From 136e14252f1f39b80268f42308a7417bf93da20e Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Fri, 24 Jun 2016 11:20:15 +0200 Subject: [PATCH] update geojson editmap --- js/editModel.js | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/js/editModel.js b/js/editModel.js index 9f91540..bd37802 100644 --- a/js/editModel.js +++ b/js/editModel.js @@ -15,30 +15,33 @@ function createModel(){ //MAP Part dialogEditNodeMap.setView(internal.config.editmap.view,internal.config.editmap.zoom) L.tileLayer(internal.config.editmap.tiles.url,internal.config.editmap.tiles.option).addTo(dialogEditNodeMap) - send('GET',internal.config.editmap.geojson).then(function(data){ + send("GET",internal.config.editmap.geojson).then(function(data){ L.geoJson(data,{ pointToLayer: function (feature, latlng){ - feature.properties.radius = 10 - return L.circleMarker(latlng,feature.properties) - }, - onEachFeature:function(feature, layer) { - layer.bindLabel(feature.properties.name) - }, - style:function(feature){ - if(feature.geometry.type=='LineString') - return {color:feature.properties["stroke"], - stroke:true, - weight: 5, - lineCap:'round', - lineJoin:'round'} - return { - color:feature.properties["marker-color"], - fillColor:feature.properties["marker-color"], - fillOpacity: 0.2, - weight: 2, - stroke: true - } + feature.properties.radius = 10 + return L.circleMarker(latlng, feature.properties) + }, + onEachFeature: function(feature, layer) { + layer.bindLabel(feature.properties.name) + }, + style: function(feature){ + if(feature.geometry.type === "LineString" || feature.geometry.type === "Polygon") + return {color: feature.properties.stroke, + opacity:feature.properties["stroke-opacity"], + fillColor: feature.properties.fill, + fillOpacity:feature.properties["fill-opacity"], + stroke: true, + weight: feature.properties["stroke-width"], + lineCap: "round", + lineJoin: "round"} + return { + color: feature.properties["marker-color"], + fillColor: feature.properties["marker-color"], + fillOpacity: 0.2, + weight: 2, + stroke: true } + } }).addTo(dialogEditNodeMap) }) dialogEditNodeMapCurrent = L.marker(internal.config.editmap.view,{