* _updateAreaData
(entities)
| 495 | * _updateAreaData |
| 496 | */ |
| 497 | _updateAreaData(entities) { |
| 498 | const context = this.context; |
| 499 | const editor = context.systems.editor; |
| 500 | const graph = editor.staging.graph; |
| 501 | const styles = context.systems.styles; |
| 502 | const selectedIDs = context.selectedIDs(); |
| 503 | |
| 504 | let areaFeatures = []; |
| 505 | for (const entity of entities) { |
| 506 | let gj = entity.asGeoJSON(graph); |
| 507 | if (gj.type !== 'Polygon' && gj.type !== 'MultiPolygon') continue; |
| 508 | |
| 509 | const style = styles.styleMatch(entity.tags); |
| 510 | const fillColor = new Color(style.fill.color).toHex(); |
| 511 | const strokeColor = new Color(style.stroke.color).toHex(); |
| 512 | |
| 513 | const newFeature = { |
| 514 | type: 'Feature', |
| 515 | properties: { |
| 516 | selected: selectedIDs.includes(entity.id).toString(), |
| 517 | fillcolor: fillColor, |
| 518 | strokecolor: strokeColor |
| 519 | }, |
| 520 | geometry: gj |
| 521 | }; |
| 522 | |
| 523 | areaFeatures.push(newFeature); |
| 524 | } |
| 525 | |
| 526 | const areaSource = this.maplibre.getSource('osmareas'); |
| 527 | if (areaSource) { |
| 528 | areaSource.setData({ |
| 529 | type: 'FeatureCollection', |
| 530 | features: areaFeatures |
| 531 | }); |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | |
| 536 | /** |
no test coverage detected