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

Commit

Permalink
HARP-12677: Extract PoiRenderer from TextCanvas (#1994)
Browse files Browse the repository at this point in the history
* HARP-12677: Extract PoiRenderer from TextCanvas

* Makes PoiRenderer independent from TextCanvas
* PoiRenderer renders on its own
* Icons can be rendered even if no FontCatalog is availble

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Supports interleaved renderOrders between Icons and Text

* PoiRenderer supports callback between layers
* TextCanvas supports rendering of layers inside a scope

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Removes obsolete PoiRendererFactory

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Adress Review Comments

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Removes Obsolete ScreenSpaceRenderer

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Removes conditionals from always available PoiRenderer and TextCanvas

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Removes obsolete reference to PoiRenderer from TextStyleCache

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Cleans up PoiRenderer dependencies

 * PoiRenderer passes PoiLayer to PoiBuffer instead of the whole instance
 * Removes MapView Dependency, and passes only needed information instead

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Moves Poi renderloop to TextElementsRenderer

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Fixes findImageItem, broked due to previoues refactor

Change-Id: I16eea8ce448f8f172351afd4f1fbd3efb3162b9b
Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677, HARP-12687: Fixes Icons getting lost after theme update, furter cleanup in PoiRenderer

 * PoiRenderer only creates new layer on actual Buffer generation
 * PoiInfos with already created buffers from a former PoiRenderer are handled
 * MapView contains one PoiRenderer which is reset instead of recreated on theme change
 * Fixes issue introduced to TextStyleCache not being able to access config name of FontCatalog

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677: Adresses latest review comments

Signed-off-by: Frauke Fritz <frauke.fritz@here.com>

* HARP-12677, HARP-12687: Fixes Icons getting lost after theme update, furter cleanup in PoiRenderer

 * PoiRenderer only creates new layer on actual Buffer generation
 * PoiInfos with already created buffers from a former PoiRenderer are handled
 * MapView contains one PoiRenderer which is reset instead of recreated on theme change
 * Fixes issue introduced to TextStyleCache not being able to access config name of FontCatalog

Change-Id: Ie4b961b37904d10940d76ec2ae62e3eb282bcb58
Signed-off-by: Frauke Fritz <frauke.fritz@here.com>
  • Loading branch information
FraukeF committed Dec 3, 2020
1 parent 1ee9ff7 commit 7624c25
Show file tree
Hide file tree
Showing 14 changed files with 484 additions and 338 deletions.
15 changes: 13 additions & 2 deletions @here/harp-mapview/lib/MapView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { MapViewThemeManager } from "./MapViewThemeManager";
import { PickHandler, PickResult } from "./PickHandler";
import { PickingRaycaster } from "./PickingRaycaster";
import { PoiManager } from "./poi/PoiManager";
import { PoiRendererFactory } from "./poi/PoiRendererFactory";
import { PoiRenderer } from "./poi/PoiRenderer";
import { PoiTableManager } from "./poi/PoiTableManager";
import { PolarTileDataSource } from "./PolarTileDataSource";
import { ScreenCollisions, ScreenCollisionsDebug } from "./ScreenCollisions";
Expand Down Expand Up @@ -906,6 +906,7 @@ export class MapView extends EventDispatcher {

private readonly m_poiManager: PoiManager = new PoiManager(this);

private m_poiRenderer: PoiRenderer;
private readonly m_poiTableManager: PoiTableManager = new PoiTableManager(this);

private readonly m_collisionDebugCanvas: HTMLCanvasElement | undefined;
Expand Down Expand Up @@ -1151,6 +1152,11 @@ export class MapView extends EventDispatcher {

this.m_themeManager = new MapViewThemeManager(this, this.m_uriResolver);

this.m_poiRenderer = new PoiRenderer(this.m_renderer, this.m_poiManager, [
this.imageCache,
this.userImageCache
]);

// will initialize with an empty theme and updated when theme is loaded and set
this.m_textElementsRenderer = this.createTextRenderer();

Expand Down Expand Up @@ -3894,7 +3900,7 @@ export class MapView extends EventDispatcher {
this.m_screenProjector,
new TextCanvasFactory(this.m_renderer),
this.m_poiManager,
new PoiRendererFactory(this),
this.m_poiRenderer,
new FontCatalogLoader(fontCatalogs),
new TextStyleCache(textStyles, defaultTextStyle),
this.m_options
Expand All @@ -3913,6 +3919,7 @@ export class MapView extends EventDispatcher {
defaultTextStyle?: TextStyleDefinition
): Promise<void> {
const overlayText = this.m_textElementsRenderer.overlayText;
this.m_poiRenderer.reset();
this.m_textElementsRenderer = this.createTextRenderer(
fontCatalogs,
textStyles,
Expand Down Expand Up @@ -3943,6 +3950,10 @@ export class MapView extends EventDispatcher {
private readonly onWebGLContextRestored = (event: Event) => {
this.dispatchEvent(this.CONTEXT_RESTORED_EVENT);
if (this.m_renderer !== undefined) {
this.m_poiRenderer = new PoiRenderer(this.m_renderer, this.m_poiManager, [
this.imageCache,
this.userImageCache
]);
this.getTheme().then(theme => {
this.m_sceneEnvironment.updateClearColor(theme.clearColor, theme.clearAlpha);
this.update();
Expand Down
Loading

0 comments on commit 7624c25

Please sign in to comment.