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))
}
if (feat.geometry.type === "LineString") {
if (feat.geometry.type === "LineString" || feat.geometry.type==="Polygon" || feat.geometry.type === "MultiPolygon") {
const coordinates = feat.geometry.coordinates
for (const rendering of startRenderings) {
addAsPoint(feat, rendering, coordinates[0])

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -2298,6 +2298,13 @@
"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": {
"name": "Information boards",
"presets": {