Class: Cesium3DTileset

Cesium3DTileset()

A Cesium3DTileset Model is a special type of vector layer that can be used in Cesium maps, and that follows the 3d-tiles specification. See https://github.com/CesiumGS/3d-tiles

Constructor

new Cesium3DTileset()

Since:
  • 2.18.0
Source:

Extends

Members

defaults :Object

Default attributes for Cesium3DTileset models
Type:
  • Object
Properties:
Name Type Attributes Default Description
type 'Cesium3DTileset' The format of the data. Must be 'Cesium3DTileset'.
filters VectorFilters <optional>
new VectorFilters() A set of conditions used to show or hide specific features of this tileset.
colorPalette AssetColorPalette <optional>
new AssetColorPalette() The color or colors mapped to attributes of this asset. Used to style the features and to make a legend.
cesiumModel Cesium.Cesium3DTileset A model created and used by Cesium that organizes the data to display in the Cesium Widget. See https://cesium.com/learn/cesiumjs/ref-doc/Cesium3DTileset.html
cesiumOptions Cesium3DTileset#cesiumOptions options are passed to the function that creates the Cesium model. The properties of options are specific to each type of asset.
Overrides:
Source:

type :string

The name of this type of model
Type:
  • string
Overrides:
Source:

Methods

addCustomProperties(properties) → {Object}

Given a set of properties from a Feature from this Map Asset model, add any custom properties to the properties object and return it.
Parameters:
Name Type Description
properties Object A set of key-value pairs representing the existing properties of a feature from this asset.
Since:
  • 2.19.0
Inherited From:
Source:
Returns:
The properties object with any custom properties added.
Type
Object

createCesiumModel(recreate)

Creates a Cesium.Cesium3DTileset model and sets it to this model's 'cesiumModel' attribute. This cesiumModel contains all the information required for Cesium to render tiles. See https://cesium.com/learn/cesiumjs/ref-doc/Cesium3DTileset.html?classFilter=3Dtiles
Parameters:
Name Type Description
recreate Boolean Set recreate to true to force the function create the Cesium Model again. Otherwise, if a cesium model already exists, that is returned instead.
Source:

featureIsSelected(feature) → {boolean}

Given a feature object from a Feature model, checks if it is part of the selectedFeatures collection. See featureObject property from Feature#defaults.
Parameters:
Name Type Description
feature * An object that a Map widget uses to represent this feature in the map, e.g. a Cesium.Entity or a Cesium.Cesium3DTileFeature
Inherited From:
Source:
Returns:
Returns true if the given feature is part of the selectedFeatures collection in this asset
Type
boolean

featureIsVisible(properties) → {boolean}

This function checks whether a feature from the MapAsset is visible on the map based on the properties of the feature and the MapAsset's filter settings.
Parameters:
Name Type Description
properties Object The properties of the feature to be filtered. (See the 'properties' attribute of Feature#defaults.)
Inherited From:
Source:
Returns:
Returns true if the feature passes all the filters, or if there are no filters set for this MapAsset. Returns false if the feature fails any of the filters.
Type
boolean

fetchIcon(pid)

Fetches an SVG given a pid, sanitizes it, then updates the model's icon attribute with the new and SVG string (after sanitizing it)
Parameters:
Name Type Description
pid string
Inherited From:
Source:

formatDateProperty(config, properties) → {string}

Given a definition for a new date property, and the properties that already exist on a specific feature, returns a new string with the formatted date.
Parameters:
Name Type Description
config MapConfig#CustomDateProperty An object that defines the new date property to create
properties Object key-value pairs representing existing properties in a Feature
Since:
  • 2.19.0
Inherited From:
Source:
Returns:
The value for the new date property, formatted as defined by config, for the given feature
Type
string

formatStringProperty(config, properties) → {string}

For a given set of Feature properties and a definition for a new sting property, returns the value of the custom property. Note that since only static strings are supported so far, this function essentially just returns the value of config.value. This function exists to allow support of dynamic strings in the future (e.g. combining strings from existing properties)
Parameters:
Name Type Description
config MapConfig#CustomStringProperty The object the defines the new custom property
properties Object key-value pairs representing existing properties in a Feature
Since:
  • 2.19.0
Inherited From:
Source:
Returns:
The new string for the given Feature property
Type
string

getBoundingSphere() → {Promise}

Gets a Cesium Bounding Sphere that can be used to navigate to view the full extent of the tileset. See https://cesium.com/learn/cesiumjs/ref-doc/BoundingSphere.html.
Source:
Returns:
Returns a promise that resolves to a Cesium Bounding Sphere when ready
Type
Promise

getColor(properties) → {AssetColor#Color}

Given properties of a Feature model from this MapAsset, returns the color associated with that feature.
Parameters:
Name Type Description
properties Object The properties of the feature to get the color for; An object containing key-value mapping of property names to properties. (See the 'properties' attribute of Feature#defaults.)
Inherited From:
Source:
Returns:
The color associated with the given set of properties.
Type
AssetColor#Color

getColorFunction() → {function}

Creates a function that takes a Cesium3DTileFeature (see https://cesium.com/learn/cesiumjs/ref-doc/Cesium3DTileFeature.html) and returns a Cesium color based on the colorPalette property set on this model. The returned function is designed to be used as the evaluateColor function that is set in the color property of a Cesium3DTileStyle StyleExpression. See https://cesium.com/learn/cesiumjs/ref-doc/Cesium3DTileStyle.html#color
Source:
Returns:
A Cesium 3dTile evaluate color function
Type
function

getPropertiesFromFeature(feature) → {Object}

Given a feature from a Cesium 3D tileset, returns any properties that are set on the feature, similar to an attributes table.
Parameters:
Name Type Description
feature Cesium.Cesium3DTileFeature A Cesium 3D Tile feature
Source:
Returns:
An object containing key-value mapping of property names to properties.
Type
Object

initialize(assetConfigopt)

Executed when a new Cesium3DTileset model is created.
Parameters:
Name Type Attributes Description
assetConfig MapConfig#MapAssetConfig <optional>
The initial values of the attributes, which will be set on the model.
Source:

isSVG(str) → {Boolean}

Simple test to see if a string is an SVG
Parameters:
Name Type Description
str string The string to check
Inherited From:
Source:
Returns:
Returns true if the string starts with ``, regardless of case
Type
Boolean

isVisible() → {boolean}

Checks that the visible attribute is set to true and that the opacity attribute is greater than zero. If both conditions are met, returns true.
Inherited From:
Source:
Returns:
Returns true if the MapAsset has opacity > 0 and is visible.
Type
boolean

resetStatus()

Resets the Map Asset's status and statusDetails attributes to their default values.
Since:
  • X.X.X
Inherited From:
Source:

sanitizeIcon(icon, callback)

Takes an SVG string and returns it with only the allowed tags and attributes
Parameters:
Name Type Description
icon string The SVG icon string to sanitize
callback function Function to call once the icon has been sanitized. Will pass the sanitized icon string.
Inherited From:
Source:

setCesiumURL()

Checks whether there is an asset ID for a Cesium Ion resource set in the cesium asset options. If there is, then adds or replaces the URL property the cesium asset options with a URL created by Cesium.
Source:

setListeners()

Set listeners that update the cesium model when the backbone model is updated.
Source:

updateAppearance()

Sets a new Cesium3DTileStyle on the Cesium 3D tileset model's style property, based on the attributes set on this model.
Source:

updateFeatureVisibility()

Updates the Cesium style set on this tileset. Adds a new expression to the show property that will filter the features based on the filters set on this model.
Source:

updateIcon(icon)

Sanitizes an SVG string and updates the model's 'icon' attribute the sanitized string. Also sets the 'iconStatus' attribute to 'success'.
Parameters:
Name Type Description
icon string An SVG string to use for the MapAsset icon
Inherited From:
Source:

whenReady() → {Promise}

Checks if the asset information has been fetched and is ready to use.
Inherited From:
Source:
Returns:
Returns a promise that resolves to this model when ready.
Type
Promise

Type Definitions

cesiumOptions

Options that are supported for creating 3D tilesets. The object will be passed to `Cesium.Cesium3DTileset(options)` as options, so the properties listed in the Cesium3DTileset documentation are also supported, see https://cesium.com/learn/cesiumjs/ref-doc/Cesium3DTileset.html
Type:
  • Object
Properties:
Name Type Description
ionAssetId string | number If this tileset is hosted by Cesium Ion, then Ion asset ID.
cesiumToken string If this tileset is hosted by Cesium Ion, then the token needed to access this resource. If one is not set, then the default set in the repository's AppConfig#cesiumToken will be used.
Source: