MCPcopy Create free account
hub / github.com/facebook/Rapid / updateData

Method updateData

modules/core/Map3dSystem.js:395–429  ·  view source on GitHub ↗

* updateData * Collect features in view, filter them according to what we want to show, * then update the data in the 3d map.

()

Source from the content-addressed store, hash-verified

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 /**

Callers 1

redrawMethod · 0.95

Calls 6

_updateRoadDataMethod · 0.95
_updateBuildingDataMethod · 0.95
_updateAreaDataMethod · 0.95
filterMethod · 0.80
intersectsMethod · 0.45
keysMethod · 0.45

Tested by

no test coverage detected