Class: CesiumView

CesiumView(propertiesopt)

This class is in charge of displaying GPS/orientation data by adding a marker to the Cesium object.

Constructor

new CesiumView(propertiesopt)

Create a View.
Parameters:
Name Type Attributes Default Description
properties Object <optional>
{} the properties of the view
Properties
Name Type Attributes Default Description
container String The div element to attach to
layers Array.<Object> <optional>
[] The initial layers to add
autoZoomOnFirstMarker Boolean <optional>
false auto zoom on the first added marker
cesiumProps Object <optional>
{} Properties which can override the default framework ones
Properties
Name Type Attributes Default Description
viewerProps Object <optional>
{} the properties of the Cesium Viewer object
Source:
Example
import CesiumView from 'core/ui/view/map/CesiumView.js';

 // style it with a moving point marker
 let pointMarker = new PointMarkerLayer({
	dataSourceId: gpsDataSource.id,
	getLocation: (rec) => ({
		x: rec.location.lon,
		y: rec.location.lat
	}),
	orientation: {
		heading: 0
	},
	icon: 'images/car-location.png',
	iconAnchor: [16, 40]
});

 // #region snippet_cesium_location_view
 // create Cesium view
 let cesiumView = new CesiumView({
	container: 'cesium-container',
	layers: [pointMarker]
});

Extends

Methods

addEllipse(properties) → {Entity}

Add an Ellipse to the view
Parameters:
Name Type Description
properties
Properties
Name Type Description
id The id of the ellipse
name The assigned name of the ellipse
position [] The ellipse's center point in the fixed frame.
semiMajorAxis Number The length of the ellipse's semi-major axis in meters.
semiMinorAxis Number The length of the ellipse's semi-minor axis in meters.
height Number 0.0 optionalThe distance in meters between the ellipse and the ellipsoid surface.
extrudedHeight Number optionalThe distance in meters between the ellipse's extruded face and the ellipsoid surface.
rotation Number 0.0 optionalThe angle of rotation counter-clockwise from north.
stRotation Number 0.0 optionalThe rotation of the texture coordinates counter-clockwise from north.
granularity Number CesiumMath.RADIANS_PER_DEGREE optionalThe angular distance between points on the ellipse in radians.
clampToGround boolean Flag to indicate if ellipse needs to be clamped to ground
color The color of the ellipse
transparency The level of transparency or alpha value
Source:
Returns:
Type
Entity

(protected) addEllipseToLayer(layer, ellipseObject)

Associate a ellipseId to a Layer for a fast lookup
Parameters:
Name Type Description
layer Ellipse.props the Layer object
ellipseObject Object the Map ellipse object
Overrides:
Source:

addImageryProvider(type, url, layers, imageFormat, options) → {*}

Parameters:
Name Type Description
type
url
layers
imageFormat
options
Source:
Returns:
Type
*

addLayer(layer)

Adds a layer to the view. A broadcastChannel is going to listen the new dataSources
Parameters:
Name Type Description
layer Layer The layer object
Overrides:
Source:

addMarker(properties) → {Entity}

Add a marker to the map.
Parameters:
Name Type Description
properties Object
Properties
Name Type Description
lon Number
lat Number
icon String the icon path
label String label of the tooltip
description String description of the marker to display into the tooltip
orientation.heading Object orientation of the icon in degree
Source:
Returns:
the new created entity
Type
Entity

(protected) addMarkerToLayer(layer, markerObject)

Associate a markerId to a Layer for a fast lookup
Parameters:
Name Type Description
layer PointMarkerLayer.props the Layer object
markerObject Object the Map marker object
Overrides:
Source:

addPolyline(properties) → {Object}

Add a polyline to the map.
Parameters:
Name Type Description
properties Object
Properties
Name Type Description
id String
locations Array.<Number>
color String
weight Number
Source:
Returns:
the new created polyline
Type
Object

(protected) addPolylineToLayer(layer, polylineObject)

Associate a polylineId to a Layer for a fast lookup
Parameters:
Name Type Description
layer Polyline.props the Layer object
polylineObject Object the Map polyline object
Overrides:
Source:

attachTo(divId)

Attach the view to a specific div. If the view has already been attached to a div, it will be removed from its current parent and will be attached to new one. Note: the onResize() is called at the end of the process.
Parameters:
Name Type Description
divId String The div element to attach to
Overrides:
Source:

getDataSourcesId() → {Array.<String>}

Gets the list of the dataSource ids contained into the view.
Overrides:
Source:
Returns:
The list of dataSource ids
Type
Array.<String>

getDivId() → {String}

Gets the div id of the DOM element.
Overrides:
Source:
Returns:
The div id of the view
Type
String

(protected) getEllipse(layer)

Get the ellipse associate to the Layer
Parameters:
Name Type Description
layer Ellipse.props the Layer Object
Overrides:
Source:

(protected) getEllipsoids()

Get all ellpsoids contained in this view
Overrides:
Source:

getId() → {String}

Gets the inner id of the view object.
Overrides:
Source:
Returns:
The id of the view
Type
String

getLayer(layerId) → {Layer}

Get the Layer associated to its id
Parameters:
Name Type Description
layerId String the id of the Layer
Overrides:
Source:
Returns:
- the corresponding layer, null otherwise
Type
Layer

getLayerId(id) → {null|String}

Gets the the Layer id from a concatenated id
Parameters:
Name Type Description
id String the concatenated such as layerId$markerId
Overrides:
Source:
Returns:
the Layer id
Type
null | String

(protected) getMarker(props)

Get the markerId associate to the Layer
Parameters:
Name Type Description
props PointMarkerLayer.props the Layer Object
Overrides:
Source:

getMarkerId(id) → {null|String}

Gets the the Marker id from a concatenated id
Parameters:
Name Type Description
id String the concatenated such as layerId$markerId
Overrides:
Source:
Returns:
the marker id
Type
null | String

(protected) getMarkers()

Get all markers contained in this view
Overrides:
Source:

(protected) getPolyline(layer)

Get the ellipse associate to the Layer
Parameters:
Name Type Description
layer Ellipse.props the Layer Object
Overrides:
Source:

(protected) getPolylines()

Get all polylines contained in this view
Overrides:
Source:

hide()

Hide the view
Overrides:
Source:

onMarkerHover(markerId, markerObject, layer, event)

Method to call onHover Layer method if exists
Parameters:
Name Type Description
markerId String the Layer markerId
markerObject Object the View marker object
layer PointMarkerLayer the Layer object
event Object the original Map View event
Overrides:
Source:

onMarkerLeftClick(markerId, markerObject, layer, event)

Method to call onLeftClick Layer method if exists
Parameters:
Name Type Description
markerId String the Layer markerId
markerObject Object the View marker object
layer PointMarkerLayer the Layer object
event Object the original Map View event
Overrides:
Source:

onMarkerMove(markerId, markerObject, layer, event)

Method to call onMove Layer method if exists
Parameters:
Name Type Description
markerId String the Layer markerId
markerObject Object the View marker object
layer PointMarkerLayer the Layer object
event Object the original Map View event
Overrides:
Source:

onMarkerRightClick(markerId, markerObject, layer, event)

Method to call onRightClick Layer method if exists
Parameters:
Name Type Description
markerId String the Layer markerId
markerObject Object the View marker object
layer PointMarkerLayer the Layer object
event Object the original Map View event
Overrides:
Source:

removeAllFromLayer(layer)

Remove Corresponding Layer
Parameters:
Name Type Description
layer Layer The layer object
Overrides:
Source:

removeAllFromLayers()

Removes all view item from the view.
Overrides:
Source:

removeEllipseFromLayer(ellipse)

Removes an ellipse
Parameters:
Name Type Description
ellipse The ellipse to remove
Source:

removeEllipsoids(ellipse)

Remove the ellipsoids corresponding to a EllipseLayer Layer
Parameters:
Name Type Description
ellipse Ellipse the layer to remove the ellipsoids from
Overrides:
Source:

removeMarkerFromLayer(marker)

Abstract method to remove a marker from its corresponding layer. This is library dependent.
Parameters:
Name Type Description
marker Object The Map marker object
Overrides:
Source:

removeMarkers(layer)

Remove the markers corresponding to a PointMarker Layer
Parameters:
Name Type Description
layer PointMarkerLayer the layer to remove the markers from
Overrides:
Source:

removePolylineFromLayer(polyline)

Abstract method to remove a polyline from its corresponding layer. This is library dependent.
Parameters:
Name Type Description
polyline Object The Map marker object
Overrides:
Source:

removePolylines(polyline)

Remove the polylines corresponding to a PolylineLayer Layer
Parameters:
Name Type Description
polyline Polyline the layer to remove the polylines from
Overrides:
Source:

reset()

Calls for resetting the view.
Overrides:
Source:

setData(dataSourceId, data)

Set the data to the view. Each view has to handle the kind of the data separately.
Parameters:
Name Type Description
dataSourceId String The dataSource id of the source providing the data
data Array.<any> The data array to set
Overrides:
Source:

show(properties)

Show the view.
Parameters:
Name Type Description
properties Object A generic object
Overrides:
Source:

updateDrapedImage(props)

Updates the image draping associated to the layer.
Parameters:
Name Type Description
props ImageDrapingLayer.props The layer properties allowing the update of the image draping
Source:

updateEllipse(props)

Updates an Ellipse if it exists or adds a new one to the view
Parameters:
Name Type Description
props
Properties
Name Type Description
ellipseId
id The id of the ellipse
position [] The ellipse's center point in the fixed frame.
semiMajorAxis Number The length of the ellipse's semi-major axis in meters.
semiMinorAxis Number The length of the ellipse's semi-minor axis in meters.
height Number 0.0 optionalThe distance in meters between the ellipse and the ellipsoid surface.
extrudedHeight Number optionalThe distance in meters between the ellipse's extruded face and the ellipsoid surface.
rotation Number 0.0 optionalThe angle of rotation counter-clockwise from north.
stRotation Number 0.0 optionalThe rotation of the texture coordinates counter-clockwise from north.
granularity Number CesiumMath.RADIANS_PER_DEGREE optionalThe angular distance between points on the ellipse in radians.
clampToGround boolean Flag to indicate if ellipse needs to be clamped to ground
transparency The level of transparency or alpha value
color The color of the ellipse
Source:

updateEllipseObj(layer, properties)

Updates an Ellipse properties
Parameters:
Name Type Description
layer The layer containing the ellipse
properties
Properties
Name Type Description
position [] The ellipse's center point in the fixed frame.
semiMajorAxis Number The length of the ellipse's semi-major axis in meters.
semiMinorAxis Number The length of the ellipse's semi-minor axis in meters.
height Number 0.0 optional The distance in meters between the ellipse and the ellipsoid surface.
extrudedHeight Number optional The distance in meters between the ellipse's extruded face and the ellipsoid surface.
rotation Number 0.0 optional The angle of rotation counter-clockwise from north.
stRotation Number 0.0 optional The rotation of the texture coordinates counter-clockwise from north.
granularity Number CesiumMath.RADIANS_PER_DEGREE optional The angular distance between points on the ellipse in radians.
clampToGround boolean Flag to indicate if ellipse needs to be clamped to ground
transparency The level of transparency or alpha value
color The color of the ellipse
Source:

updateMapMarker(layer, properties)

Updates the marker associated to the layer.
Parameters:
Name Type Description
layer Layer The layer allowing the update of the marker
properties Object -
Properties
Name Type Description
lon Object -
lat Object -
alt Object -
orientation Object -
icon Object -
defaultToTerrainElevation Object -
selected Object -
Source:

updateMarker(props)

Updates the marker associated to the layer.
Parameters:
Name Type Description
props PointMarkerLayer.props The layer properties allowing the update of the marker
Source:

updatePolyline(props)

Updates a given polyline, or adds it if it does not currently exist
Parameters:
Name Type Description
props The properties containing the updated data
Source:

updatePolylineObj(layer, properties)

Updates the actual polyline properties for the polyline from the given layer
Parameters:
Name Type Description
layer The polyline layer
properties The properties to update the polyline on the given layer
Source:

Events

beforeAddingItems

This method is called before attaching any view items passed as arguments in the constructor of the view.
Parameters:
Name Type Description
options Object A generic object to use
Overrides:
Source:

onResize

Callback called when the view is resized
Overrides:
Source: