Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
HARP-12700: Disposal of POI resources by reference counting. (#1946)
Browse files Browse the repository at this point in the history
* HARP-12700: Disposal of POI resources by reference counting.

- Share material and texture across pois with same image even if they have different render order.
- Do reference counting on resources to dispose of them when they're not used any longer.

* HARP-12700: Address review comment and fix unit tests.
  • Loading branch information
atomicsulfate committed Nov 6, 2020
1 parent ceff1c1 commit e9e44a6
Show file tree
Hide file tree
Showing 11 changed files with 661 additions and 407 deletions.
6 changes: 4 additions & 2 deletions @here/harp-datasource-protocol/lib/TechniqueParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,11 +707,13 @@ export interface MarkerTechniqueParams extends BaseTechniqueParams {
*/
poiNameField?: string;
/**
* Name of [[ImageTexture]] definition to use.
* The name of either the {@link ImageTexture} in {@link Theme.imageTextures} or the user image
* cached in {@link @here/harp-mapview#userImageCache} to be rendered as marker.
*/
imageTexture?: DynamicProperty<string>;
/**
* Field name to extract imageTexture content from.
* Field name to extract imageTexture content from, if imageTexture refers to an
* [[ImageTexture]] definition.
*/
imageTextureField?: string;
/**
Expand Down
5 changes: 3 additions & 2 deletions @here/harp-mapview/lib/MapView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,7 @@ export class MapView extends EventDispatcher {
}

/**
* @internal
* Get the {@link ImageCache} that belongs to this `MapView`.
*
* Images stored in this cache are primarily used for POIs (icons) and they are used with the
Expand All @@ -1900,15 +1901,15 @@ export class MapView extends EventDispatcher {
/**
* Get the {@link ImageCache} for user images that belongs to this `MapView`.
*
* Images added to this cache can be removed if no longer required. If images with identical
* names are stored in imageCache and userImageCache, the userImageCache will take precedence.
* Images added to this cache can be removed if no longer required.
*/
get userImageCache(): MapViewImageCache {
return this.m_userImageCache;
}

/**
* @hidden
* @internal
* Get the {@link PoiManager} that belongs to this `MapView`.
*/
get poiManager(): PoiManager {
Expand Down
3 changes: 3 additions & 0 deletions @here/harp-mapview/lib/Tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,9 @@ export class Tile implements CachedResource {
}
this.textElementsChanged = true;
this.m_pathBlockingElements.splice(0);
this.textElementGroups.forEach((element: TextElement) => {
element.dispose();
});
this.textElementGroups.clear();
}

Expand Down
Loading

0 comments on commit e9e44a6

Please sign in to comment.