* updateData * Collect features in view, filter them according to what we want to show, * then update the data in the 3d map.
()
| 393 | * then update the data in the 3d map. |
| 394 | */ |
| 395 | updateData() { |
| 396 | if (!this.visible) return; |
| 397 | if (!this.maplibre) return; // called too soon? |
| 398 | |
| 399 | const context = this.context; |
| 400 | const editor = context.systems.editor; |
| 401 | const viewport = context.viewport; |
| 402 | |
| 403 | const entities = editor.intersects(viewport.visibleExtent()); |
| 404 | const noRelationEnts = entities.filter(entity => !entity.id.startsWith('r')); |
| 405 | |
| 406 | const highways = noRelationEnts.filter(entity => { |
| 407 | const tags = Object.keys(entity.tags).filter(tagname => tagname.startsWith('highway')); |
| 408 | return tags.length > 0; |
| 409 | }); |
| 410 | |
| 411 | const buildings = noRelationEnts.filter(entity => { |
| 412 | const tags = Object.keys(entity.tags).filter(tagname => tagname.startsWith('building')); |
| 413 | return tags.length > 0; |
| 414 | }); |
| 415 | |
| 416 | const areas = noRelationEnts.filter(entity => { |
| 417 | const tags = Object.keys(entity.tags).filter(tagname => |
| 418 | tagname.startsWith('landuse') || |
| 419 | tagname.startsWith('leisure') || |
| 420 | tagname.startsWith('natural') || |
| 421 | tagname.startsWith('area') |
| 422 | ); |
| 423 | return tags.length > 0; |
| 424 | }); |
| 425 | |
| 426 | this._updateRoadData(highways); |
| 427 | this._updateBuildingData(buildings); |
| 428 | this._updateAreaData(areas); |
| 429 | } |
| 430 | |
| 431 | |
| 432 | /** |
no test coverage detected