POlygon rendering fixes

This commit is contained in:
pietervdvn 2021-11-09 19:45:26 +01:00
parent 1a73bcfd54
commit 1dbe167e4e
25 changed files with 66 additions and 27 deletions

View file

@ -59,7 +59,7 @@ export default class RenderingMultiPlexerFeatureSource {
addAsPoint(feat, rendering, GeoOperations.centerpointCoordinates(feat)) addAsPoint(feat, rendering, GeoOperations.centerpointCoordinates(feat))
} }
if (feat.geometry.type === "LineString") { if (feat.geometry.type === "LineString" || feat.geometry.type==="Polygon" || feat.geometry.type === "MultiPolygon") {
const coordinates = feat.geometry.coordinates const coordinates = feat.geometry.coordinates
for (const rendering of startRenderings) { for (const rendering of startRenderings) {
addAsPoint(feat, rendering, coordinates[0]) addAsPoint(feat, rendering, coordinates[0])

View file

@ -200,12 +200,11 @@ export default class LayerConfig extends WithContextLoader {
this.mapRendering = [] this.mapRendering = []
this.lineRendering = [] this.lineRendering = []
} else { } else {
this.mapRendering = Utils.NoNull(json.mapRendering)
this.mapRendering = json.mapRendering
.filter(r => r["location"] !== undefined) .filter(r => r["location"] !== undefined)
.map((r, i) => new PointRenderingConfig(<PointRenderingConfigJson>r, context + ".mapRendering[" + i + "]")) .map((r, i) => new PointRenderingConfig(<PointRenderingConfigJson>r, context + ".mapRendering[" + i + "]"))
this.lineRendering = json.mapRendering this.lineRendering = Utils.NoNull(json.mapRendering)
.filter(r => r["location"] === undefined) .filter(r => r["location"] === undefined)
.map((r, i) => new LineRenderingConfig(<LineRenderingConfigJson>r, context + ".mapRendering[" + i + "]")) .map((r, i) => new LineRenderingConfig(<LineRenderingConfigJson>r, context + ".mapRendering[" + i + "]"))
@ -304,6 +303,9 @@ export default class LayerConfig extends WithContextLoader {
} }
public defaultIcon(): BaseUIElement | undefined { public defaultIcon(): BaseUIElement | undefined {
if(this.mapRendering === undefined || this.mapRendering === null){
return undefined;
}
const mapRendering = this.mapRendering.filter(r => r.location.has("point"))[0] const mapRendering = this.mapRendering.filter(r => r.location.has("point"))[0]
if (mapRendering === undefined) { if (mapRendering === undefined) {
return undefined return undefined

View file

@ -157,6 +157,7 @@ export default class ShowDataLayer {
const coords = L.GeoJSON.coordsToLatLngs(feat.geometry.coordinates) const coords = L.GeoJSON.coordsToLatLngs(feat.geometry.coordinates)
const tagsSource = this.allElements?.addOrGetElement(feat) ?? new UIEventSource<any>(feat.properties); const tagsSource = this.allElements?.addOrGetElement(feat) ?? new UIEventSource<any>(feat.properties);
let offsettedLine; let offsettedLine;
console.log("Rendering ", feat)
tagsSource tagsSource
.map(tags => this._layerToShow.lineRendering[feat.lineRenderingIndex].GenerateLeafletStyle(tags)) .map(tags => this._layerToShow.lineRendering[feat.lineRenderingIndex].GenerateLeafletStyle(tags))
.withEqualityStabilized((a, b) => { .withEqualityStabilized((a, b) => {
@ -169,6 +170,7 @@ export default class ShowDataLayer {
return a.offset === b.offset && a.color === b.color && a.weight === b.weight && a.dashArray === b.dashArray return a.offset === b.offset && a.color === b.color && a.weight === b.weight && a.dashArray === b.dashArray
}) })
.addCallbackAndRunD(lineStyle => { .addCallbackAndRunD(lineStyle => {
console.log("Linestyle is ", lineStyle)
if (offsettedLine !== undefined) { if (offsettedLine !== undefined) {
self.geoLayer.removeLayer(offsettedLine) self.geoLayer.removeLayer(offsettedLine)
} }

View file

@ -660,7 +660,8 @@
"render": "35,35,center" "render": "35,35,center"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -160,7 +160,8 @@
], ],
"iconSize": "50,50,bottom", "iconSize": "50,50,bottom",
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -307,7 +307,8 @@
] ]
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -206,7 +206,8 @@
] ]
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -183,7 +183,8 @@
], ],
"iconSize": "40,40,bottom", "iconSize": "40,40,bottom",
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -205,7 +205,8 @@
"icon": "./assets/layers/ghost_bike/ghost_bike.svg", "icon": "./assets/layers/ghost_bike/ghost_bike.svg",
"iconSize": "40,40,bottom", "iconSize": "40,40,bottom",
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -10,7 +10,10 @@
{ {
"icon": "crosshair:#00f", "icon": "crosshair:#00f",
"iconSize": "40,40,center", "iconSize": "40,40,center",
"location": ["point","centroid"] "location": [
"point",
"centroid"
]
} }
] ]
} }

View file

@ -14,7 +14,10 @@
"iconSize": { "iconSize": {
"render": "20,20,center" "render": "20,20,center"
}, },
"location": ["point","centroid"] "location": [
"point",
"centroid"
]
} }
] ]
} }

View file

@ -115,7 +115,8 @@
"render": "35,35,center" "render": "35,35,center"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -25,7 +25,10 @@
}, },
"mapRendering": [ "mapRendering": [
{ {
"location": ["point","centroid"], "location": [
"point",
"centroid"
],
"icon": "./assets/layers/street_lamps/street_lamp.svg", "icon": "./assets/layers/street_lamps/street_lamp.svg",
"iconBadges": [ "iconBadges": [
{ {

View file

@ -575,7 +575,8 @@
} }
], ],
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -616,7 +616,8 @@
"render": "40,40,bottom" "render": "40,40,bottom"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -69,7 +69,8 @@
"render": "40,40,center" "render": "40,40,center"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -172,7 +172,8 @@
"render": "50,50,center" "render": "50,50,center"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -2,9 +2,9 @@
"images": { "images": {
"render": "{image_carousel()}{image_upload()}" "render": "{image_carousel()}{image_upload()}"
}, },
"export_as_gpx":{ "export_as_gpx": {
"render": "{export_as_gpx()}" "render": "{export_as_gpx()}"
}, },
"wikipedia": { "wikipedia": {
"render": "{wikipedia():max-height:25rem}", "render": "{wikipedia():max-height:25rem}",
"question": { "question": {

View file

@ -455,7 +455,8 @@
"render": "50,50,center" "render": "50,50,center"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -506,7 +506,8 @@
"render": "20,20,center" "render": "20,20,center"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -258,7 +258,8 @@
"badge": true "badge": true
} }
] ]
} },
null
] ]
} }
}, },

View file

@ -272,7 +272,8 @@
}, },
"iconSize": "40, 40, bottom", "iconSize": "40, 40, bottom",
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
] ]

View file

@ -36,7 +36,10 @@
"title": "Straatlantaarn in dataset", "title": "Straatlantaarn in dataset",
"mapRendering": [ "mapRendering": [
{ {
"location": ["point","centroid"], "location": [
"point",
"centroid"
],
"icon": { "icon": {
"render": "circle:red", "render": "circle:red",
"mappings": [ "mappings": [

View file

@ -180,7 +180,8 @@
"render": "40,40,center" "render": "40,40,center"
}, },
"location": [ "location": [
"point","centroid" "point",
"centroid"
] ]
} }
], ],

View file

@ -2298,6 +2298,13 @@
"render": "Ghost bike" "render": "Ghost bike"
} }
}, },
"gps_track": {
"tagRenderings": {
"Privacy notice": {
"render": "This is the path you've travelled since this website is opened. Don't worry - this is only visible to you and no one else. Your location data is never sent off-device."
}
}
},
"information_board": { "information_board": {
"name": "Information boards", "name": "Information boards",
"presets": { "presets": {