Skip to content

Commit

Permalink
Merge pull request #139 from ndsev/pins-clustering
Browse files Browse the repository at this point in the history
Improve displaying markers and tiles feature search priority
  • Loading branch information
josephbirkner authored Jun 28, 2024
2 parents 59a6c1b + 1e38343 commit 7b04fb7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 85 deletions.
5 changes: 2 additions & 3 deletions erdblick_app/app/feature.search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ export class FeatureSearchService {
this.startTime = Date.now();

// Fill up work queue and start processing.
for (const [_, tile] of this.mapService.loadedTileLayers) {
this.workQueue.push(tile);
}
// TODO: What if we move / change the viewport during the search?
this.workQueue = this.mapService.getPrioritisedTiles();
this.totalTiles = this.workQueue.length;
this.isFeatureSearchActive.next(true);

Expand Down
9 changes: 9 additions & 0 deletions erdblick_app/app/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,15 @@ export class MapService {
this.update();
}

getPrioritisedTiles() {
let tiles = new Array<[number, FeatureTile]>();
for (const [_, tile] of this.loadedTileLayers) {
tiles.push([coreLib.getTilePriorityById(this.currentViewport, tile.tileId), tile]);
}
tiles.sort((a, b) => b[0] - a[0]);
return tiles.map(val => val[1]);
}

getFeatureTile(tileKey: string): FeatureTile|null {
return this.loadedTileLayers.get(tileKey) || null;
}
Expand Down
5 changes: 5 additions & 0 deletions libs/core/src/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ em::val getTileIds(Viewport const& vp, int level, int limit)
return resultArray;
}

double getTilePriorityById(Viewport const& vp, uint64_t tileId) {
return Wgs84AABB::radialDistancePrioFn({vp.camPosLon, vp.camPosLat}, vp.orientation)(tileId);
}

/** Get the center position for a mapget tile id in WGS84. */
mapget::Point getTilePosition(uint64_t tileIdValue) {
mapget::TileId tid(tileIdValue);
Expand Down Expand Up @@ -321,6 +325,7 @@ EMSCRIPTEN_BINDINGS(erdblick)

////////// Viewport TileID calculation
em::function("getTileIds", &getTileIds);
em::function("getTilePriorityById", &getTilePriorityById);
em::function("getTilePosition", &getTilePosition);
em::function("getTileIdFromPosition", &getTileIdFromPosition);

Expand Down
106 changes: 24 additions & 82 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7b04fb7

Please sign in to comment.