跳到主要内容

flywave-mapview.datasource

Home > @flywave/flywave-mapview > DataSource

DataSource class

Derive a class from DataSource to contribute data and geometries to the MapView.

Signature:

export declare abstract class DataSource extends THREE.EventDispatcher<&#123;
update: &#123;&#125;;
&#125;>

Extends: THREE.EventDispatcher<{ update: {}; }>

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Constructs a new DataSource.

Properties

Property

Modifiers

Type

Description

addGroundPlane

boolean

Whether the datasource should have a ground plane (this plane covers the tile entirely and has the minimum possible renderOrder), this can be required in some cases when fallback parent tiles need to be covered by the children, otherwise the content will overlap. Default is false

allowOverlappingTiles

boolean

cacheable

boolean

Set to true if the MapView can cache tiles produced by this DataSource.

dataSourceOrder

number

Overrides the default rendering order of this DataSource.

enabled

boolean

Set to true if this DataSource is enabled; false otherwise.

enablePicking

boolean

languages?

protected

string[]

(Optional) An array of ISO 639-1 language codes.

mapView

readonly

MapView

The MapView that is holding this DataSource.

maxDataLevel

number

The maximum zoom level at which data is available.

maxDisplayLevel

number

The maximum zoom level at which DataSource is displayed.

maxGeometryHeight

number

Maximum geometry height above ground level this DataSource can produce.

Used in first stage of frustum culling before data is available.

minDataLevel

number

The minimum zoom level at which data is available.

minDisplayLevel

number

The minimum zoom level at which DataSource is displayed.

minGeometryHeight

number

Minimum geometry height below ground level this DataSource can produce. A negative number specifies a value below ground level.

Used in first stage of frustum culling before data is available.

name

string

The unique name of a DataSource instance.

projection

readonly

Projection

The used by the MapView that is holding this DataSource.

An Error is thrown if you call this method before this DataSource has been added to a MapView.

storageLevelOffset

number

The difference between storage level and display level of tile.

Storage level offset is a value applied (added) to current zoom level giving a final tile level being displayed. This way we may differentiate current zoom level from the storage level that is displayed, giving fine grained control over the tiles being decoded an displayed.

styleSetName

string | undefined

Returns the name of the [[StyleSet]] to use for the decoding.

useGeometryLoader

boolean

Set to true if the loader should be used to get the tile contents.

Methods

Method

Modifiers

Description

attach(mapView)

This method is called when this DataSource is added to a MapView.

Overrides of this method must invoke the definition of the super class.

canGetSubdivideChildren(tileKey)

Returns true if MapView should render the children of the given .

canGetTile(zoomLevel, tileKey)

Returns true if DataSource can load tile with given and zoom level.

clearCache()

Purges all the caching done by this DataSource

clearFeatureState()

Clears the state of all the features of this DataSource.

connect()

This method is called when the DataSource is added to a MapView. Override this method to provide any custom initialization, such as, to establish a network connection, or to initialize complex data structures.

detach(mapView)

This method is called when this DataSource is removed from a MapView.

Overrides of this method must invoke the definition of the super class.

dispose()

Destroys this DataSource.

getDataZoomLevel(zoomLevel)

Computes the data zoom level to use.

getFeatureState(featureId)

Gets the state of the given feature id.

getTile(tileKey, delayLoad)

abstract

This method is called when MapView needs to visualize or preload the content of a .

getTilingScheme()

abstract

Returns the used by this DataSource.

isDetached()

Whether this DataSource is detached from the MapView

isFullyCovering()

Boolean which says whether a DataSource produces tiles that fully cover the tile, i.e. tiles underneath are completely hidden. Must be overridden for DataSource's that don't have a ground plane, but which still fully cover the tile, e.g. web tiles.

isVisible(zoomLevel)

Returns true if DataSource should be displayed for the zoom level.

onTouchTiledComplete()

this method is called by the MapView to determine if the content of the surrounding tiles must be preloaded.

onWillTouchTiled()

ready()

Returns true if this DataSource is ready and the MapView can invoke getTile() to start requesting data.

removeFeatureState(featureId)

Removes the state associated to the given feature.

requestUpdate()

Sends a request to the MapView to redraw the scene.

setEnableElevationOverlay(enable)

Enables or disables overlay of geometry on elevation. It must be overloaded by data sources supporting this feature.

setFeatureState(featureId, state)

Sets the state of the given feature id.

dataSource.setFeatureState(featureId, &#123; enabled: true &#125;);

setLanguages(languages)

Used to configure the languages used by the DataSource according to priority; the first language in the array has the highest priority.

setPoliticalView(pov)

Used to express different country point of view (political view).

Set to undefined (or empty string) if you want to reset to default point of view.

setTheme(theme)

Apply the to this data source.

If DataSource depends on a styleSet defined by this theme or languages, it must update its tiles' geometry.

setThemeFromBase(theme, languages)

shouldPreloadTiles()

This method is called by the MapView to determine if the content of the surrounding tiles must be preloaded.

shouldRenderText(zoomLevel, tileKey)

Returns true if MapView should render the text elements with the given and zoom level.

shouldSubdivide(zoomLevel, tileKey)

Returns true if MapView should traverse tiles further with given and zoom level.

updateTile(tile)

This method is called by MapView before the tile needs to be updated, for example after a theme change.