Options
All
  • Public
  • Public/Protected
  • All
Menu

Package harp-mapview

@here/harp-mapview

Overview

This module provides all the functionality needed to display a map, using most of the different modules included in this repo. The list of features include, but is not limited to:

Index

References

Namespaces

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

References

AnimatedExtrusionHandler

Re-exports AnimatedExtrusionHandler

AnimatedExtrusionState

Re-exports AnimatedExtrusionState

AreaCopyrightInfo

Re-exports AreaCopyrightInfo

AtmosphereLightMode

Re-exports AtmosphereLightMode

BASE_TECHNIQUE_NON_MATERIAL_PROPS

Re-exports BASE_TECHNIQUE_NON_MATERIAL_PROPS

BaseTileLoader

Re-exports BaseTileLoader

BoundsGenerator

Re-exports BoundsGenerator

BufferedGeometryAccessor

Re-exports BufferedGeometryAccessor

BufferedGeometryAccessorBase

Re-exports BufferedGeometryAccessorBase

BufferedGeometryLineAccessor

Re-exports BufferedGeometryLineAccessor

BufferedGeometryObject3dAccessor

Re-exports BufferedGeometryObject3dAccessor

CalculationStatus

Re-exports CalculationStatus

CameraMovementDetector

Re-exports CameraMovementDetector

CameraUtils

Re-exports CameraUtils

Circles

Re-exports Circles

ClipPlanesEvaluator

Re-exports ClipPlanesEvaluator

ColorCache

Re-exports ColorCache

ConcurrentDecoderFacade

Re-exports ConcurrentDecoderFacade

ConcurrentTilerFacade

Re-exports ConcurrentTilerFacade

CopyrightCoverageProvider

Re-exports CopyrightCoverageProvider

CopyrightCoverageResponse

Re-exports CopyrightCoverageResponse

CopyrightElementHandler

Re-exports CopyrightElementHandler

CopyrightInfo

Re-exports CopyrightInfo

CopyrightProvider

Re-exports CopyrightProvider

DEFAULT_FONT_CATALOG_NAME

Re-exports DEFAULT_FONT_CATALOG_NAME

DEFAULT_FOV_CALCULATION

Re-exports DEFAULT_FOV_CALCULATION

DEFAULT_MAX_THEME_INTHERITANCE_DEPTH

Re-exports DEFAULT_MAX_THEME_INTHERITANCE_DEPTH

DEFAULT_TEXT_DISTANCE_SCALE

Re-exports DEFAULT_TEXT_DISTANCE_SCALE

DEPTH_PRE_PASS_STENCIL_MASK

Re-exports DEPTH_PRE_PASS_STENCIL_MASK

DataSource

Re-exports DataSource

DataSourceOptions

Re-exports DataSourceOptions

DataSourceTileList

Re-exports DataSourceTileList

DepthPrePassProperties

Re-exports DepthPrePassProperties

DisplacementMap

Re-exports DisplacementMap

ElevationBasedClipPlanesEvaluator

Re-exports ElevationBasedClipPlanesEvaluator

ElevationProvider

Re-exports ElevationProvider

ElevationRange

Re-exports ElevationRange

ElevationRangeSource

Re-exports ElevationRangeSource

EventDispatcher

Re-exports EventDispatcher

FixedClipPlanesEvaluator

Re-exports FixedClipPlanesEvaluator

FovCalculation

Re-exports FovCalculation

FrameStats

Re-exports FrameStats

IGeometryAccessor

Re-exports IGeometryAccessor

ILineAccessor

Re-exports ILineAccessor

IMapAntialiasSettings

Re-exports IMapAntialiasSettings

IMapAntialiasSettings

Re-exports IMapAntialiasSettings

IMapRenderingManager

Re-exports IMapRenderingManager

IMapRenderingManager

Re-exports IMapRenderingManager

IObject3dAccessor

Re-exports IObject3dAccessor

IPass

Re-exports IPass

IPass

Re-exports IPass

IPassManager

Re-exports IPassManager

IPassManager

Re-exports IPassManager

ITileDataVisitor

Re-exports ITileDataVisitor

ITileLoader

Re-exports ITileLoader

ImageCache

Re-exports ImageCache

ImageItem

Re-exports ImageItem

IndexedBufferedGeometryAccessor

Re-exports IndexedBufferedGeometryAccessor

IndexedBufferedGeometryLineAccessor

Re-exports IndexedBufferedGeometryLineAccessor

LoadingState

Re-exports LoadingState

LookAtParams

Re-exports LookAtParams

MAX_FOV_DEG

Re-exports MAX_FOV_DEG

MAX_FOV_RAD

Re-exports MAX_FOV_RAD

MIN_FOV_DEG

Re-exports MIN_FOV_DEG

MIN_FOV_RAD

Re-exports MIN_FOV_RAD

MSAARenderPass

Re-exports MSAARenderPass

MSAARenderPass

Re-exports MSAARenderPass

MSAASampling

Re-exports MSAASampling

MSAASampling

Re-exports MSAASampling

MapAnchor

Re-exports MapAnchor

MapAnchors

Re-exports MapAnchors

MapRenderingManager

Re-exports MapRenderingManager

MapRenderingManager

Re-exports MapRenderingManager

MapView

Re-exports MapView

MapViewAtmosphere

Re-exports MapViewAtmosphere

MapViewEventNames

Re-exports MapViewEventNames

MapViewFog

Re-exports MapViewFog

MapViewImageCache

Re-exports MapViewImageCache

MapViewOptions

Re-exports MapViewOptions

MapViewPoints

Re-exports MapViewPoints

MapViewPowerPreference

Re-exports MapViewPowerPreference

MapViewUtils

Re-exports MapViewUtils

MaterialConstructor

Re-exports MaterialConstructor

MaterialOptions

Re-exports MaterialOptions

MultiStageTimer

Re-exports MultiStageTimer

Pass

Re-exports Pass

Pass

Re-exports Pass

PerformanceStatistics

Re-exports PerformanceStatistics

PickHandler

Re-exports PickHandler

PickObjectType

Re-exports PickObjectType

PickResult

Re-exports PickResult

PoiInfo

Re-exports PoiInfo

PoiManager

Re-exports PoiManager

PoiTable

Re-exports PoiTable

PoiTableManager

Re-exports PoiTableManager

PolarTileDataSource

Re-exports PolarTileDataSource

PolarTileDataSourceOptions

Re-exports PolarTileDataSourceOptions

RenderEvent

Re-exports RenderEvent

RequestHeaders

Re-exports RequestHeaders

ResourceComputationType

Re-exports ResourceComputationType

RingBuffer

Re-exports RingBuffer

SampledTimer

Re-exports SampledTimer

SimpleFrameStatistics

Re-exports SimpleFrameStatistics

SimpleTimer

Re-exports SimpleTimer

Squares

Re-exports Squares

Statistics

Re-exports Statistics

Stats

Re-exports Stats

TextCanvases

Re-exports TextCanvases

TextElement

Re-exports TextElement

TextElementIndex

Re-exports TextElementIndex

TextElementStyle

Re-exports TextElementStyle

TextElementsRenderer

Re-exports TextElementsRenderer

TextPickResult

Re-exports TextPickResult

TextStyleCache

Re-exports TextStyleCache

TextureLoader

Re-exports TextureLoader

TexturizableImage

Re-exports TexturizableImage

ThemeLoadOptions

Re-exports ThemeLoadOptions

ThemeLoader

Re-exports ThemeLoader

Tile

Re-exports Tile

TileDataAccessor

Re-exports TileDataAccessor

TileDataAccessorOptions

Re-exports TileDataAccessorOptions

TileDisplacementMap

Re-exports TileDisplacementMap

TileFeatureData

Re-exports TileFeatureData

TileLoaderState

Re-exports TileLoaderState

TileObject

Re-exports TileObject

TileOffsetUtils

Re-exports TileOffsetUtils

TileResourceInfo

Re-exports TileResourceInfo

TileResourceUsage

Re-exports TileResourceUsage

TileTaskGroups

Re-exports TileTaskGroups

TiltViewClipPlanesEvaluator

Re-exports TiltViewClipPlanesEvaluator

Timer

Re-exports Timer

TopViewClipPlanesEvaluator

Re-exports TopViewClipPlanesEvaluator

UrlCopyrightProvider

Re-exports UrlCopyrightProvider

VisibleTileSet

Re-exports VisibleTileSet

VisibleTileSetOptions

Re-exports VisibleTileSetOptions

WorkerBasedDecoder

Re-exports WorkerBasedDecoder

WorkerBasedTiler

Re-exports WorkerBasedTiler

WorkerLoader

Re-exports WorkerLoader

applyBaseColorToMaterial

Re-exports applyBaseColorToMaterial

applySecondaryColorToMaterial

Re-exports applySecondaryColorToMaterial

buildMetricValueEvaluator

Re-exports buildMetricValueEvaluator

buildObject

Re-exports buildObject

createDefaultClipPlanesEvaluator

Re-exports createDefaultClipPlanesEvaluator

createDepthPrePassMaterial

Re-exports createDepthPrePassMaterial

createDepthPrePassMesh

Re-exports createDepthPrePassMesh

createMaterial

Re-exports createMaterial

evaluateBaseColorProperty

Re-exports evaluateBaseColorProperty

evaluateColorProperty

Re-exports evaluateColorProperty

getBufferAttribute

Re-exports getBufferAttribute

getFeatureDataSize

Re-exports getFeatureDataSize

getMaterialConstructor

Re-exports getMaterialConstructor

isDepthPrePassMesh

Re-exports isDepthPrePassMesh

isLineAccessor

Re-exports isLineAccessor

isObject3dAccessor

Re-exports isObject3dAccessor

isRenderDepthPrePassEnabled

Re-exports isRenderDepthPrePassEnabled

poiIsRenderable

Re-exports poiIsRenderable

setDepthPrePassStencil

Re-exports setDepthPrePassStencil

usesObject3D

Re-exports usesObject3D

Type aliases

MapAnchor

MapAnchor<T>: T & { anchor?: GeoCoordLike | Vector3Like; category?: undefined | string; geoPosition?: GeoCoordinates; overlay?: undefined | false | true; pickable?: undefined | false | true; styleSet?: undefined | string }

An interface describing [[THREE.Object3D]]s anchored on given {@link @here/harp-geoutils#GeoCoordinates}.

remarkks
example

Example:

const mesh: MapAnchor<THREE.Mesh> = new THREE.Mesh(geometry, material);
mesh.anchor = new GeoCoordinates(latitude, longitude, altitude);
mapView.mapAnchors.add(mesh);

Type parameters

  • T: Object3D

MapViewEnvironmentOptions

MapViewEnvironmentOptions: Pick<MapViewOptions, "addBackgroundDatasource" | "backgroundTilingScheme">

MaterialConstructor

MaterialConstructor: {}

Generic material type constructor.

internal

Type declaration

TextCanvases

TextCanvases: Map<string, TextCanvas | undefined>

TextElementFilter

TextElementFilter: (textElementState: TextElementState) => number | undefined

Type of functions used to do early rejection of elements during group state creation or update.

param

The state of the text element to check.

returns

undefined if element was rejected, otherwise its current view distance.

Type declaration

TexturizableImage

TexturizableImage: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageData | ImageBitmap

Any type supported by WebGLRenderingContext.texImage2D() for texture creation

TileObject

TileObject: Object3D & { displacement?: THREE.Vector3 }

Variables

Const BASE_TECHNIQUE_NON_MATERIAL_PROPS

BASE_TECHNIQUE_NON_MATERIAL_PROPS: string[] = ["name", "id", "renderOrder", "transient"]

Non material properties of BaseTechnique.

internal

Const DEFAULT_CLEAR_COLOR

DEFAULT_CLEAR_COLOR: 16777215 = 16777215

Const DEFAULT_FADE_TIME

DEFAULT_FADE_TIME: 800 = 800

Time to fade in/fade out the labels in milliseconds.

Const DEFAULT_FONT_CATALOG_NAME

DEFAULT_FONT_CATALOG_NAME: "default" = "default"

Const DEFAULT_MAX_THEME_INTHERITANCE_DEPTH

DEFAULT_MAX_THEME_INTHERITANCE_DEPTH: 4 = 4
internal

Const DEFAULT_MONOMIAL_POWER

DEFAULT_MONOMIAL_POWER: 1 = 1

Const DEFAULT_TEXTURE_SIZE

DEFAULT_TEXTURE_SIZE: 512 = 512

Const DEFAULT_TEXT_DISTANCE_SCALE

DEFAULT_TEXT_DISTANCE_SCALE: 0.5 = 0.5

Default distance scale. Will be applied if distanceScale is not defined in the technique. Defines the scale that will be applied to labeled icons (icon and text) in the distance.

internal

Const DEFAULT_WORKER_INITIALIZATION_TIMEOUT

DEFAULT_WORKER_INITIALIZATION_TIMEOUT: 10000 = 10000

The default timeout for first message from worker.

see

WorkerLoader.startWorker

Const DEPTH_PRE_PASS_STENCIL_MASK

DEPTH_PRE_PASS_STENCIL_MASK: 1 = 1

Bitmask used for the depth pre-pass to prevent multiple fragments in the same screen position from rendering color.

internal

Const MAX_FOV_DEG

MAX_FOV_DEG: 140 = 140

Const MAX_FOV_RAD

MAX_FOV_RAD: number = THREE.MathUtils.degToRad(MAX_FOV_DEG)

Const MIN_FOV_DEG

MIN_FOV_DEG: 10 = 10

Const MIN_FOV_RAD

MIN_FOV_RAD: number = THREE.MathUtils.degToRad(MIN_FOV_DEG)

Const SKY_CUBEMAP_FACE_COUNT

SKY_CUBEMAP_FACE_COUNT: 6 = 6

Number of faces that form a SkyCubemapTexture.

Const debugContext

debugContext: DebugContext = new DebugContext()

Const newPointLabelTextMarginPercent

newPointLabelTextMarginPercent: 0.1 = 0.1

Additional bounds scaling (described as percentage of full size) applied to the new labels.

This additional scaling (margin) allows to account for slight camera position and orientation changes, so new labels are placed only if there is enough space around them. Such margin limits collisions with neighboring labels while doing small camera movements and thus reduces labels flickering.

Const persistentPointLabelTextMargin

persistentPointLabelTextMargin: Vector2 = new THREE.Vector2(2, 2)

The margin applied to the text bounds of every point label.

Functions

addGroundPlane

  • addGroundPlane(tile: Tile, renderOrder: number, materialOrColor?: Material | Material[] | number, opacity?: number, createTexCoords?: boolean, receiveShadow?: boolean, createMultiLod?: boolean): Mesh
  • Creates and adds a background plane mesh for the tile.

    internal

    Parameters

    • tile: Tile

      The tile to which the ground plane belongs.

    • renderOrder: number

      The plane render order.

    • Default value materialOrColor: Material | Material[] | number = tile.mapView.clearColor

      The plane material or a color for a default material.

    • Default value opacity: number = 1

      The plane opacity.

    • Default value createTexCoords: boolean = false

      Whether to create texture coordinates.

    • Default value receiveShadow: boolean = tile.mapView.shadowsEnabled

      Whether the plane should receive shadows.

    • Default value createMultiLod: boolean = tile.mapView.enableMixedLod !== false

      Whether to generate multiple LODs for sphere projection.

    Returns Mesh

applyBaseColorToMaterial

  • applyBaseColorToMaterial(material: Material, materialColor: Color, technique: Technique, techniqueColor: Value, env?: Env): void
  • Apply technique base color (transparency support) to material with modifying material opacity.

    remarks

    This method applies main (or base) technique color with transparency support to the corresponding material color, with an effect on entire [[THREE.Material]] opacity and transparent attributes.

    note

    Transparent colors should be processed as the very last technique attributes, since their effect on material properties like [[THREE.Material.opacity]] and [[THREE.Material.transparent]] could be overridden by corresponding technique params.

    internal

    Parameters

    • material: Material

      the material to which color is applied

    • materialColor: Color
    • technique: Technique

      an technique the applied color comes from

    • techniqueColor: Value
    • Optional env: Env

      {@link @here/harp-datasource-protocol#Env} instance used to evaluate {@link @here/harp-datasource-protocol#Expr} based properties of [[Technique]]

    Returns void

applySecondaryColorToMaterial

  • applySecondaryColorToMaterial(materialColor: Color, techniqueColor: Value | Expr, env?: Env): void
  • Apply technique color to material taking special care with transparent (RGBA) colors.

    remarks
    note

    This function is intended to be used with secondary, triary etc. technique colors, not the base ones that may contain transparency information. Such colors should be processed with [[applyTechniqueBaseColorToMaterial]] function.

    internal

    Parameters

    • materialColor: Color
    • techniqueColor: Value | Expr
    • Optional env: Env

      {@link @here/harp-datasource-protocol#Env} instance used to evaluate {@link @here/harp-datasource-protocol#Expr} based properties of Technique.

    Returns void

buildMetricValueEvaluator

  • buildMetricValueEvaluator(value: Expr | Value | undefined, metricUnit: string | undefined): undefined | null | string | number | false | true | object

buildObject

  • buildObject(technique: Technique, geometry: BufferGeometry, material: Material | Material[], tile: Tile, elevationEnabled: boolean): Object3D
  • Builds the object associated with the given technique.

    internal

    Parameters

    • technique: Technique

      The technique.

    • geometry: BufferGeometry

      The object's geometry.

    • material: Material | Material[]

      The object's material.

    • tile: Tile

      The tile where the object is located.

    • elevationEnabled: boolean

      True if elevation is enabled, false otherwise.

    Returns Object3D

checkReadyForPlacement

  • Applies early rejection tests for a given text element meant to avoid trying to place labels that are not visible, not ready, duplicates etc...

    Parameters

    • textElement: TextElement

      The Text element to check.

    • poiIndex: number | undefined

      If TextElement is a line marker, the index into the line marker positions

    • viewState: ViewState

      The view for which the text element will be placed.

    • poiManager: PoiManager
    • Optional maxViewDistance: undefined | number

      If specified, text elements farther than this max distance will be rejected.

    Returns { result: PrePlacementResult; viewDistance: number | undefined }

    An object with the result code and the text element view distance ( or undefined of the checks failed) as second.

computeEdgeDivisions

computeViewDistance

  • computeViewDistance(textElement: TextElement, poiIndex: number | undefined, eyePosition: Vector3, eyeLookAt: Vector3): number
  • Computes distance of the specified text element to camera plane given with position and normal.

    The distance is measured as projection of the vector between eyePosition and text onto the eyeLookAt vector, so it actually computes the distance to plane that contains eyePosition and is described with eyeLookAt as normal.

    note

    Used for measuring the distances to camera, results in the metric that describes distance to camera near plane (assuming near = 0). Such metric is better as input for labels scaling or fading factors then simple euclidean distance because it does not fluctuate during simple camera panning.

    Parameters

    • textElement: TextElement

      The textElement of which the view distance will be checked. It must have coordinates in world space.

    • poiIndex: number | undefined

      If TextElement is a line marker, the index into the line marker positions.

    • eyePosition: Vector3

      The world eye coordinates used a reference position to calculate the distance.

    • eyeLookAt: Vector3

      The eye looking direction or simply said projection plane normal.

    Returns number

    The text element view distance.

Const createDefaultClipPlanesEvaluator

createDepthPrePassMaterial

  • createDepthPrePassMaterial(baseMaterial: Material): Material
  • Creates material for depth prepass.

    remarks

    Creates material that writes only to the z-buffer. Updates the original material instance, to support depth prepass.

    internal

    Parameters

    • baseMaterial: Material

      The base material of mesh that is updated to work with depth prepass and then used. This parameter is a template for depth prepass material that is returned.

    Returns Material

    depth prepass material, which is a clone of baseMaterial with the adapted settings.

createDepthPrePassMesh

  • createDepthPrePassMesh(mesh: Mesh): Mesh
  • Clones a given mesh to render it in the depth prepass with another material.

    remarks

    Both the original and depth prepass meshes, when rendered in the correct order, create the proper depth prepass effect. The original mesh material is slightly modified by createDepthPrePassMaterial to support the depth prepass. This method is usable only if the material of this mesh has an opacity value in the range (0,1).

    The DepthPrePass object is created wis a slightly smaller renderOrder as the original mesh to ensure that it's rendered first.

    internal

    Parameters

    • mesh: Mesh

      original mesh

    Returns Mesh

    Mesh depth pre pass

createLight

  • createLight(lightDescription: Light): Light

createMaterial

  • createMaterial(rendererCapabilities: WebGLCapabilities, options: MaterialOptions, onTextureCreated?: undefined | ((texture: Promise<Texture>) => void)): Material | undefined
  • Create a material, depending on the rendering technique provided in the options.

    internal

    Parameters

    • rendererCapabilities: WebGLCapabilities

      The capabilities of the renderer that will use the material.

    • options: MaterialOptions

      The material options the subsequent functions need.

    • Optional onTextureCreated: undefined | ((texture: Promise<Texture>) => void)

      Optional callback for each texture created for the material, getting a promise that will be resolved once the texture is loaded. Texture is not uploaded to GPU.

    Returns Material | undefined

    new material instance that matches technique.name.

displaceBox

  • displaceBox(box: Box3, displacementRange: DisplacementRange, displacementDir: Vector3): Box3
  • internal

    Displace a box in a given direction by a specified range. The original box min and max vertices are translated as a result by displacementRange.min and displacementRange.max respectively.

    Parameters

    • box: Box3

      The original box to displace.

    • displacementRange: DisplacementRange

      The minimum and maximum displacement values.

    • displacementDir: Vector3

      Direction in which the displacement will be applied.

    Returns Box3

    The displaced box.

evaluateBaseColorProperty

  • evaluateBaseColorProperty(technique: Technique, env: Env): number | undefined
  • Allows to easy parse/encode technique's base color property value as number coded color.

    remarks

    Function takes care about property parsing, interpolation and encoding if neccessary.

    see

    ColorUtils

    internal

    Parameters

    • technique: Technique

      the technique where we search for base (transparency) color value

    • env: Env

      {@link @here/harp-datasource-protocol#Env} instance used to evaluate {@link @here/harp-datasource-protocol#Expr} based properties of Technique

    Returns number | undefined

    number encoded color value (in custom #TTRRGGBB) format or undefined if base color property is not defined in the technique passed.

evaluateColorProperty

  • evaluateColorProperty(value: Value, env?: Env): number | undefined
  • Calculates the numerical value of the technique defined color property.

    remarks

    Function takes care about color interpolation (when @param `env is set) as also parsing string encoded colors.

    note

    Use with care, because function does not recognize property type.

    internal

    Parameters

    • value: Value

      the value of color property defined in technique

    • Optional env: Env

      {@link @here/harp-datasource-protocol#Env} instance used to evaluate {@link @here/harp-datasource-protocol#Expr} based properties of [[Technique]]

    Returns number | undefined

getBufferAttribute

getFeatureDataSize

getMaterialConstructor

  • Returns a MaterialConstructor basing on provided technique object.

    internal

    Parameters

    • technique: Technique

      Technique object which the material will be based on.

    • shadowsEnabled: boolean

      Whether the material can accept shadows, this is required for some techniques to decide which material to create.

    Returns MaterialConstructor | undefined

getMaxViewDistance

  • getMaxViewDistance(viewState: ViewState, farDistanceLimitRatio: number): number
  • Computes the maximum view distance for text elements as a ratio of the given view's maximum far plane distance.

    Parameters

    • viewState: ViewState

      The view for which the maximum view distance will be calculated.

    • farDistanceLimitRatio: number

      The ratio to apply to the maximum far plane distance.

    Returns number

    Maximum view distance.

getPixelFromCanvasImageSource

  • getPixelFromCanvasImageSource(image: CanvasImageSource, xPos: number, yPos: number, canvas: HTMLCanvasElement): Uint8ClampedArray | undefined
  • It returns an Uint8ClampedArray containing the color channel values for the given pixel coordinates. It returns undefined if the given coordinates are out of range.

    Parameters

    • image: CanvasImageSource

      Image source.

    • xPos: number

      X value of the pixel.

    • yPos: number

      Y value of the pixel.

    • canvas: HTMLCanvasElement

      HTML Canvas element on which the image is drawn.

    Returns Uint8ClampedArray | undefined

getPixelFromImage

  • getPixelFromImage(xPos: number, yPos: number, image: CanvasImageSource | ImageData, canvas?: HTMLCanvasElement): Uint8ClampedArray | undefined
  • It returns an array containing the channel colors for the pixel at the given coordinates.

    Parameters

    • xPos: number

      X value of the pixel.

    • yPos: number

      Y value of the pixel.

    • image: CanvasImageSource | ImageData

      The image source.

    • Optional canvas: HTMLCanvasElement

      Canvas element that will be used to draw the image, in case the imageData is an ImageBitmap

    Returns Uint8ClampedArray | undefined

getPixelFromImageData

  • getPixelFromImageData(imgData: ImageData, xPos: number, yPos: number, stride: number): Uint8ClampedArray | undefined
  • It returns an Uint8ClampedArray containing the color channel values for the given pixel coordinates. It returns undefined if the given coordinates are out of range.

    Parameters

    • imgData: ImageData
    • xPos: number

      X value of the pixel.

    • yPos: number

      Y value of the pixel.

    • stride: number

      The stride value of the image data.

    Returns Uint8ClampedArray | undefined

getWorldPosition

  • Calculates the world position of the supplied label. The label will be shifted if there is a specified offsetDirection and value to shift it in.

    Parameters

    • poiLabel: TextElement

      The label to shift

    • projection: Projection

      The projection, required to compute the correct direction offset for spherical projections.

    • env: Env

      The environment to extract the worldOffset needed to shift the icon in world space, if configured in the style.

    • outWorldPosition: Vector3

      Preallocated vector to store the result in

    Returns Vector3

    the [[outWorldPosition]] vector.

initializeDefaultOptions

isDepthPrePassMesh

  • isDepthPrePassMesh(object: Object3D): boolean
  • Checks if a given object is a depth prepass mesh.

    internal

    Parameters

    • object: Object3D

      The object to check whether it's a depth prepass mesh.

    Returns boolean

    true if the object is a depth prepass mesh, false otherwise.

isLineAccessor

  • isLineAccessor(arg: any): arg is ILineAccessor

isLineMarkerElementState

isLineWithBound

  • isLineWithBound(box: IBox): box is LineWithBound

isLoggingMessage

isObject3dAccessor

  • isObject3dAccessor(arg: any): arg is IObject3dAccessor

isPathLabelTooSmall

  • isPathLabelTooSmall(textElement: TextElement, screenProjector: ScreenProjector, outScreenPoints: Vector2[]): boolean
  • Check if a given path label is too small to be rendered.

    Parameters

    • textElement: TextElement

      The text element to check.

    • screenProjector: ScreenProjector

      Used to project coordinates from world to screen space.

    • outScreenPoints: Vector2[]

      Label path projected to screen space.

    Returns boolean

    true if label is too small, false otherwise.

isRenderDepthPrePassEnabled

  • Check if technique requires (and not disables) use of depth prepass.

    remarks

    Depth prepass is enabled if correct opacity is specified (in range (0,1)) and not explicitly disabled by enableDepthPrePass option.

    internal

    Parameters

    • technique: ExtrudedPolygonTechnique

      BaseStandardTechnique instance to be checked

    • env: Env

      {@link @here/harp-datasource-protocol#Env} instance used to evaluate {@link @here/harp-datasource-protocol#Expr} based properties of Technique

    Returns boolean

isWorkerBootstrapRequest

  • isWorkerBootstrapRequest(message: any): message is WorkerBootstrapRequest

isWorkerBootstrapResponse

  • isWorkerBootstrapResponse(message: any): message is WorkerBootstrapResponse

loadFontCatalog

  • loadFontCatalog(fontCatalogConfig: FontCatalogConfig, onSuccess: FontCatalogCallback, onError?: undefined | ((error: Error) => void)): Promise<void>

nextCanvasSide

overlayOnElevation

  • overlayOnElevation(tile: Tile): void

overlayTextElement

placeIcon

  • Places an icon on screen.

    Parameters

    • iconRenderState: RenderState

      The icon state.

    • poiInfo: PoiInfo

      Icon information necessary to compute its dimensions.

    • screenPosition: Vector2

      Screen position of the icon.

    • scaleFactor: number

      Scaling factor to apply to the icon dimensions.

    • env: Env

      Current map env.

    • screenCollisions: ScreenCollisions

      Used to check the icon visibility and collisions.

    Returns PlacementResult

    PlacementResult.Ok if icon can be placed, PlacementResult.Rejected if there's a collision, PlacementResult.Invisible if it's not visible.

placePathLabel

  • Places a path label along a given path on a specified text canvas.

    Parameters

    • labelState: TextElementState

      The state of the path label to place.

    • textPath: Path

      The text path along which the label will be placed.

    • screenPosition: Vector2

      Position of the label in screen coordinates.

    • textCanvas: TextCanvas

      The text canvas where the label will be placed.

    • screenCollisions: ScreenCollisions

      Used to check collisions with other labels.

    Returns PlacementResult

    PlacementResult.Ok if path label can be placed, PlacementResult.Rejected if there's a collision or text doesn't fit into path, PlacementResult.Invisible if it's not visible.

placePointLabel

  • Place a point label text using single or multiple alternative placement anchors.

    Parameters

    • labelState: TextElementState

      State of the point label to place.

    • screenPosition: Vector2

      Position of the label in screen coordinates.

    • scale: number

      Scale factor to be applied to label dimensions.

    • textCanvas: TextCanvas

      The text canvas where the label will be placed.

    • env: Env

      The {@link @here/harp-datasource-protocol#Env} used to evaluate technique attributes.

    • screenCollisions: ScreenCollisions

      Used to check collisions with other labels.

    • outScreenPosition: Vector3

      The final label screen position after applying any offsets.

    • Default value multiAnchor: boolean = false

      The parameter decides if multi-anchor placement algorithm should be used, be default [[false]] meaning try to place label using current alignment settings only.

    Returns PlacementResult

    PlacementResult.Ok if point label can be placed at the base or any optional anchor point. PlacementResult.Rejected if there's a collision for all placements. Finally PlacementResult.Invisible if it's text is not visible at any placement position.

poiIsRenderable

  • poiIsRenderable(poiInfo: PoiInfo): boolean

pointToPlaneDistance

  • pointToPlaneDistance(pointPos: Vector3, planePos: Vector3, planeNorm: Vector3): number
  • Computes distance between the given point and a plane.

    May be used to measure distance of point labels to the camera projection (near) plane.

    Parameters

    • pointPos: Vector3

      The position to measure distance to.

    • planePos: Vector3

      The position of any point on the plane.

    • planeNorm: Vector3

      The plane normal vector (have to be normalized already).

    Returns number

previousCanvasSide

registerTileObject

  • registerTileObject(tile: Tile, object: Object3D, geometryKind: GeometryKind | GeometryKindSet | undefined, mapAdapterParams?: MapObjectAdapterParams): void
  • Adds a THREE object to the root of the tile and register [[MapObjectAdapter]].

    Sets the owning tiles datasource.name and the tileKey in the userData property of the object, such that the tile it belongs to can be identified during picking.

    Parameters

    • tile: Tile

      The Tile to add the object to.

    • object: Object3D

      The object to add to the root of the tile.

    • geometryKind: GeometryKind | GeometryKindSet | undefined

      The kind of object. Can be used for filtering.

    • Optional mapAdapterParams: MapObjectAdapterParams

      additional parameters for [[MapObjectAdapter]]

    Returns void

screenToUvCoordinates

  • screenToUvCoordinates(screenX: number, screenY: number, box: Box, uvBox: UvBox): { u: number; v: number }
  • Given the x and y position in screen coordinates inside the target box, it map them to the UV coordinates.

    Parameters

    • screenX: number

      X value in screen coordinates.

    • screenY: number

      Y value in screen coordinates.

    • box: Box

      Bounding box in screen coordinates.

    • uvBox: UvBox

      Uv box referred to the given bounding box.

    Returns { u: number; v: number }

    • u: number
    • v: number

setDepthPrePassStencil

  • setDepthPrePassStencil(depthMesh: Mesh, colorMesh: Mesh): void
  • Sets up all the needed stencil logic needed for the depth pre-pass.

    remarks

    This logic is in place to avoid z-fighting artifacts that can appear in geometries that have coplanar triangles inside the same mesh.

    internal

    Parameters

    • depthMesh: Mesh

      Mesh created by createDepthPrePassMesh.

    • colorMesh: Mesh

      Original mesh.

    Returns void

toPixelFormat

toTextureDataType

toTextureFilter

toWrappingMode

usesObject3D

  • usesObject3D(technique: Technique): boolean

Object literals

Const DEFAULT_FOV_CALCULATION

DEFAULT_FOV_CALCULATION: object

fov

fov: number = 40

type

type: "dynamic" = "dynamic"

Generated using TypeDoc