diff --git a/lib/www/client/source/src/views/Map.vue b/lib/www/client/source/src/views/Map.vue index c423659..ea251d6 100644 --- a/lib/www/client/source/src/views/Map.vue +++ b/lib/www/client/source/src/views/Map.vue @@ -267,6 +267,59 @@ const layers = { opacity: 0.5 } } + }), + + "Background": L.geoJSON(null,{ + style (feature) { + const style = { + stroke: undefined, + color: "grey", + weight: 2, + opacity: 0.5, + lineCap: undefined, + lineJoin: undefined, + dashArray: undefined, + dashOffset: undefined, + fill: undefined, + fillColor: "lightgrey", + fillOpacity: 0.5, + fillRule: undefined + }; + + for (let key in style) { + switch (key) { + case "color": + style[key] = feature.properties?.colour ?? feature.properties?.color ?? style[key]; + break; + case "fillColor": + style[key] = feature.properties?.fillColour ?? feature.properties?.fillColor ?? style[key]; + break; + default: + style[key] = feature.properties?.[key] ?? style[key]; + } + + if (typeof style[key] === "undefined") { + delete style[key]; + } + } + + return style; + + return Object.fromEntries(Object.entries(style).map( ([key, defaultValue]) => { + function value () { + switch (key) { + case "color": + return feature.properties?.colour ?? feature.properties?.color ?? defaultValue; + case "fillColor": + return feature.properties?.fillColour ?? feature.properties?.fillColor ?? defaultValue; + default: + return feature.properties?.[key] ?? defaultValue; + } + } + + return [key, value()]; + })); + } }) }; @@ -372,6 +425,12 @@ export default { ? `/project/${this.$route.params.project}/gis/final/line` : `/project/${this.$route.params.project}/gis/final/point?${query.toString()}`; } + }, + { + layer: layers["Background"], + url: (query = "") => { + return `/project/${this.$route.params.project}/gis/layer/Background`; + } } ], labels: {},