Cesium

Cesium

new Cesium(terria, viewer)

Source:

The Cesium viewer component

Parameters:
Name Type Description
terria Terria

The Terria instance.

viewer Viewer

The Cesium viewer instance.

Extends

Members

canShowSplitter :Boolean

Source:
Overrides:

Gets or sets whether this viewer can show a splitter.

Type:
  • Boolean

dataSourceDisplay :DataSourceDisplay

Source:

Gets the DataSourceDisplay used to render a DataSource.

Type:
  • DataSourceDisplay

scene :Scene

Source:

Gets or sets the Cesium Scene instance.

Type:
  • Scene

stoppedRendering :Boolean

Source:

Gets or sets whether the viewer has stopped rendering since startup or last set to false.

Type:
  • Boolean

terria :Terria

Source:
Inherited From:

Gets or sets the Terria instance.

Type:

verboseRendering :Boolean

Source:

Gets or sets whether to output info to the console when starting and stopping rendering loop.

Type:
  • Boolean

viewer :Viewer

Source:

Gets or sets the Cesium Viewer instance.

Type:
  • Viewer

Methods

(protected) _createFeatureFromImageryLayerFeature(imageryFeature) → {Feature}

Source:
Inherited From:

Creates a {@see Feature} (based on an {@see Entity}) from a {@see ImageryLayerFeatureInfo}.

Parameters:
Name Type Description
imageryFeature ImageryLayerFeatureInfo

The imagery layer feature for which to create an entity-based feature.

Returns:

The created feature.

Type
Feature

addAttribution(attribution)

Source:
Overrides:

Adds an attribution to the globe.

Parameters:
Name Type Description
attribution Credit

The attribution to add.

addImageryProvider(options, layerIndexopt) → {ImageryLayer}

Source:

Returns a new layer using a provided ImageryProvider, and adds it to the scene. Note the optional parameters are a superset of the Leaflet version of this function, with one deletion (onProjectionError).

Parameters:
Name Type Attributes Default Description
options Object

Options

Properties
Name Type Description
imageryProvider ImageryProvider

The imagery provider to create a new layer for.

layerIndex Number <optional>

The index to add the layer at. If omitted, the layer will added on top of all existing layers.

options.rectangle Rectangle <optional>
imageryProvider.rectangle

The rectangle of the layer. This rectangle can limit the visible portion of the imagery provider.

options.opacity Number | function <optional>
1.0

The alpha blending value of this layer, from 0.0 to 1.0. This can either be a simple number or a function with the signature function(frameState, layer, x, y, level). The function is passed the current frame state, this layer, and the x, y, and level coordinates of the imagery tile for which the alpha is required, and it is expected to return the alpha value to use for the tile.

options.clipToRectangle Boolean <optional>
options.treat403AsError Boolean <optional>
options.treat403AsError Boolean <optional>
options.ignoreUnknownTileErrors Boolean <optional>
options.onLoadError function <optional>
Returns:

The newly created layer.

Type
ImageryLayer

captureScreenshot() → {Promise}

Source:
Overrides:

Captures a screenshot of the map.

Returns:

A promise that resolves to a data URL when the screenshot is ready.

Type
Promise

computePositionOnScreen(position, resultopt) → {Cartesian2}

Source:
Overrides:

Computes the screen position of a given world position.

Parameters:
Name Type Attributes Description
position Cartesian3

The world position in Earth-centered Fixed coordinates.

result Cartesian2 <optional>

The instance to which to copy the result.

Returns:

The screen position, or undefined if the position is not on the screen.

Type
Cartesian2

getAllAttribution() → {Array.<String>}

Source:
Overrides:

Gets all attribution currently active on the globe or map.

Returns:

The list of current attributions, as HTML strings.

Type
Array.<String>

getContainer() → {Element}

Source:
Overrides:

Gets the current container element.

Returns:

The current container element.

Type
Element

getCurrentExtent() → {Rectangle}

Source:
Overrides:

Gets the current extent of the camera. This may be approximate if the viewer does not have a strictly rectangular view.

Returns:

The current visible extent.

Type
Rectangle

lower(index)

Source:
Overrides:

Lower an item's level in the viewer This does not check that index is valid

Parameters:
Name Type Description
index Number

The index of the item to lower

lowerToBottom(item)

Source:
Overrides:

Lowers this imagery layer to the bottom, underneath all other layers. If this item is not enabled or not shown, this method does nothing.

Parameters:
Name Type Description
item CatalogItem

The item to lower to the bottom (usually a basemap)

notifyRepaintRequired()

Source:
Overrides:

Notifies the viewer that a repaint is required.

pickFromLocation(latlng, imageryLayerCoords, existingFeatures, ignoreSplitter)

Source:
Overrides:

Picks features based off a latitude, longitude and (optionally) height.

Parameters:
Name Type Description
latlng Object

The position on the earth to pick.

imageryLayerCoords Object

A map of imagery provider urls to the coords used to get features for those imagery providers - i.e. x, y, level

existingFeatures

An optional list of existing features to concatenate the ones found from asynchronous picking to.

ignoreSplitter Boolean

An optional arg to ignore the splitter and return all feature picking results. Defaults to false.

pickFromScreenPosition(screenPosition, ignoreSplitter)

Source:

Picks features based on coordinates relative to the Cesium window. Will draw a ray from the camera through the point specified and set terria.pickedFeatures based on this.

Parameters:
Name Type Description
screenPosition Cartesian3

The position on the screen.

ignoreSplitter Boolean

An optional arg to ignore the splitter and return all feature picking results. Defaults to false.

pickVectorFeatures(screenPosition) → {Array.<Feature>}

Source:

Picks all vector features (e.g. GeoJSON) shown at a certain position on the screen, ignoring raster features (e.g. WFS). Because all vector features are already in memory, this is synchronous.

Parameters:
Name Type Description
screenPosition Cartesian2

position on the screen to look for features

Returns:

The features found.

Type
Array.<Feature>

raise(index)

Source:
Overrides:

Raise an item's level in the viewer This does not check that index is valid

Parameters:
Name Type Description
index Number

The index of the item to raise

removeAttribution(attribution)

Source:
Overrides:

Removes an attribution from the globe.

Parameters:
Name Type Description
attribution Credit

The attribution to remove.

updateLayerOrderAfterReorder()

Source:
Overrides:

Perform any updates to the order of layers required by raise and lower, but after the items have been reordered. This allows for the possibility that raise and lower do nothing, and instead we call updateLayerOrder

updateLayerOrderToKeepOnTop()

Source:

Updates the order of layers, moving layers where CatalogItem#keepOnTop is true to the top.

zoomTo(target, flightDurationSecondsopt)

Source:
Overrides:

Zooms to a specified camera view or extent with a smooth flight animation.

Parameters:
Name Type Attributes Default Description
target CameraView | Rectangle | DataSource | Cesium3DTileset

The view, extent, DataSource, or Cesium3DTileset to which to zoom.

flightDurationSeconds Number <optional>
3.0

The length of the flight animation in seconds.