跳到主要内容

flywave-mapview.mapview

Home > @flywave/flywave-mapview > MapView

MapView class

The core class of the library to call in order to create a map visualization. It needs to be linked to datasources.

Signature:

export declare class MapView extends EventDispatcher 

Extends: EventDispatcher

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Constructs a new MapView with the given options or canvas element.

Properties

Property

Modifiers

Type

Description

animatedExtrusionHandler

readonly

AnimatedExtrusionHandler

The AnimatedExtrusionHandler controls animated extrusion effect of the extruded objects in the Tile

animating

readonly

boolean

Returns true if this MapView is constantly redrawing the scene.

camera

readonly

THREE.PerspectiveCamera

The THREE.js camera used by this MapView to render the main scene.

cameraIsMoving

readonly

boolean

Returns true if the camera moved in the last frame.

cameraMovementDetector

readonly

CameraMovementDetector

The CameraMovementDetector detects camera movements. Made available for performance measurements.

canvas

readonly

HTMLCanvasElement

The HTML canvas element used by this MapView.

clearAlpha

number

The alpha used to clear the view.

clearColor

number

The color used to clear the view.

clipPlanesEvaluator

ClipPlanesEvaluator

Get camera clipping planes evaluator used.

collisionDebugCanvas

readonly

HTMLCanvasElement | undefined

The HTML canvas element used by this MapView.

copyrightInfo

readonly

CopyrightInfo[]

dataSources

readonly

DataSource[]

Returns DataSources displayed by this MapView.

delayLabelsUntilMovementFinished

boolean

disableFading

boolean

disposed

readonly

boolean

Is true if dispose() as been called on MapView.

dynamicPixelRatio

number | undefined

elevationProvider

readonly

ElevationProvider | undefined

Returns the elevation provider.

enableMixedLod

boolean | undefined

env

readonly

Env

Environment used to evaluate dynamic scene expressions.

extendedFrustumCulling

boolean

Specifies whether extended frustum culling is enabled or disabled.

focalLength

readonly

number

The distance (in pixels) between the screen and the camera.

fog

readonly

MapViewFog

Public access to MapViewFog allowing to toggle it by setting its enabled property.

forceCameraAspect

number | undefined

Gets the value of the forced custom camera aspect. Every time a frame is rendered, MapView resets the camera aspect.

You can disable this behavior by setting the value to undefined.

frameNumber

readonly

number

Return current frame number.

geoMaxBounds

GeoBox | undefined

The view's maximum bounds in geo coordinates if any.

heading

number

Returns heading angle in degrees.

isDynamicFrame

readonly

boolean

Returns true if the current frame will immediately be followed by another frame.

languages

string[] | undefined

Lists the ISO 639-1 language codes for DataSources to use.

lights

readonly

THREE.Light[]

lockVisibleTileSet

boolean

Returns the status of frustum culling after each update.

mapAnchors

readonly

MapAnchors

The node in this MapView's scene containing the user MapAnchors.

mapRenderingManager

readonly

IMapRenderingManager

The instance of MapRenderingManager managing the rendering of the map. It is a public property to allow access and modification of some parameters of the rendering process at runtime.

maxFps

number

maxZoomLevel

number

The maximum zoom level. Default is 14.

minCameraHeight

readonly

number

The minimum camera height in meters.

minZoomLevel

number

The minimum zoom level.

nativeWebglAntialiasEnabled

readonly

boolean

Returns true if the native WebGL antialiasing is enabled.

true for pixelRatio < 2.0, false otherwise.

overlayScene

readonly

THREE.Scene

The THREE.js overlay scene

pickHandler

readonly

PickHandler

Get the [[PickHandler]] for this mapView.

pixelRatio

number

pixelToWorld

readonly

number

Returns the ratio between a pixel and a world unit for the current camera (in the center of the camera projection).

pointOfView

THREE.PerspectiveCamera | undefined

Gets the optional camera used to render the scene.

poiTableManager

readonly

PoiTableManager

Get the array of PoiTableManager that belongs to this MapView.

politicalView

string | undefined

Get currently presented political point of view - the country code.

Country code is stored in lower-case ISO 3166-1 alpha-2 standard. Country code or undefined if default (majorly accepted) point of view is used.

postEffects

PostEffects | undefined

The abstraction of the MapRenderingManager API for post effects.

projection

Projection

The projection used to project geo coordinates to world coordinates.

renderer

readonly

THREE.WebGLRenderer

The THREE.js WebGLRenderer used by this scene.

renderLabels

boolean

resourceComputationType

ResourceComputationType

The way the cache usage is computed, either based on size in MB (mega bytes) or in number of tiles.

scene

readonly

THREE.Scene

The THREE.js scene used by this MapView.

shadowsEnabled

boolean

storageLevel

readonly

number

Returns the storage level for the given camera setup.

target

readonly

GeoCoordinates

Get geo coordinates of camera focus (target) point.

taskQueue

readonly

TaskQueue

textElementsRenderer

readonly

TextElementsRenderer

The TextElementsRenderer select the visible s and renders them.

theme

Theme

Gets the current Theme used by this MapView to style map elements.

throttlingEnabled

boolean

(BETA)

tileGeometryManager

readonly

TileGeometryManager | undefined

The [[TileGeometryManager]] manages geometry during loading and handles hiding geometry of specified [[GeometryKind]]s.

tileWrappingEnabled

boolean

tilt

number

Returns tilt angle in degrees.

updatePending

readonly

boolean

Returns true if an update has already been requested, such that after a currently rendering frame, the next frame will be rendered immediately.

uriResolver

readonly

UriResolver | undefined

used to resolve application/deployment specific URIs into actual URLs that can be loaded with fetch.

userImageCache

readonly

MapViewImageCache

Get the for user images that belongs to this MapView.

Images added to this cache can be removed if no longer required.

viewportHeight

readonly

number

Returns height of the viewport in pixels.

visibleTileSet

readonly

VisibleTileSet

Access the VisibleTileSet to get access to all current datasources and their visible tiles.

worldCenter

readonly

THREE.Vector3

The position in world coordinates of the center of the scene.

worldToPixel

readonly

number

Returns the ratio between a world and a pixel unit for the current camera (in the center of the camera projection).

zoomLevel

number

Returns the zoom level for the given camera setup.

Methods

Method

Modifiers

Description

addDataSource(dataSource)

Adds a new DataSource to this MapView.

addEventListener(type, listener)

Adds an event listener. There are various events that are sent before or after a new frame is rendered.

addOverlayText(textElements)

Adds new overlay text elements to this MapView.

beginAnimation()

Begin animating the scene.

clearElevationSource(elevationSource)

Clears any elevation sources and provider previously set.

clearOverlayText()

Adds new overlay text elements to this MapView.

clearTileCache(dataSourceName, filter)

Clear the tile cache.

dispose(freeContext)

Disposes this MapView.

endAnimation()

Stop animating the scene.

forEachCachedTile(visitor)

Apply a visitor function to all tiles in the cache.

forEachVisibleTile(fun)

Apply visitor to all visible tiles.

getCacheSize()

Returns the cache size.

getCanvasClientSize()

Get canvas client size in css/client pixels.

Supports canvases not attached to DOM, which have 0 as clientWidth and clientHeight by calculating it from actual canvas size and current pixel ratio.

getDataSourceByName(dataSourceName)

Returns the unique DataSource matching the given name.

getDataSourcesByStyleSetName(styleSetName)

Returns the array of DataSources referring to the same [[StyleSet]].

getGeoCoordinatesAt(x, y, fallback)

Same as but always returning a geo coordinate.

getGeoCoordinatesAt(x, y, fallback)

Returns the from the given screen position.

getNormalizedScreenCoordinates(x, y)

Returns the normalized screen coordinates from the given pixel position.

getRteCamera()

getScreenPosition(pos)

Returns the screen position of the given geo or world position.

getTheme()

Returns the currently set Theme as a Promise as it might be still loading/updating.

getWorldPositionAt(x, y, fallback)

getWorldPositionAt(x, y, fallback)

intersectMapObjects(x, y, parameters)

Do a raycast on all objects in the scene. Useful for picking.

isDataSourceEnabled(dataSource)

Returns true if the specified DataSource is enabled.

loadPostEffects(postEffectsFile)

Loads a post effects definition file.

lookAt(params)

Adjusts the camera to look at a given geo coordinate with tilt and heading angles.

lookAt(target, distance, tiltDeg, headingDeg)

The method that sets the camera to the desired angle (tiltDeg) and distance (in meters) to the target location, from a certain heading (headingAngle).

markTilesDirty(dataSource, filter)

Visit each tile in visible, rendered, and cached sets.

ndcToView(vector, result)

Transfer the NDC point to view space.

removeDataSource(dataSource)

Removes DataSource from this MapView.

removeDynamicProperty(name)

Removes the given dynamic property from this MapView.

removeEventListener(type, listener)

Removes an event listener. There are various events that are sent before or after a new frame is rendered.

renderSync(frameStartTime)

Redraws scene immediately

requestUpdateIfNeeded()

Requests a redraw of the scene.

resetFrameNumber()

Reset the frame number to 0.

resize(width, height)

Resize the HTML canvas element and the THREE.js WebGLRenderer.

setCacheSize(size, numVisibleTiles)

Sets the cache size in number of tiles.

setDynamicProperty(name, value)

Updates the value of a dynamic property.

setElevationSource(elevationSource, elevationRangeSource, elevationProvider)

Sets the DataSource which contains the elevations, the elevation range source, and the elevation provider.

setFovCalculation(fovCalculation)

Set's the way in which the fov is calculated on the map view.

setTheme(theme)

Changes the Themeused by this MapViewto style map elements.

update()

Requests a redraw of the scene.

updateLookAtSettings()

protected

Derive the look at settings (i.e. target, zoom, ...) from the current camera.