CzmlDataSource

new Cesium.CzmlDataSource(name)

A DataSource which processes CZML.
Name Type Description
name String optional An optional name for the data source. This value will be overwritten if a loaded document contains a name.
Demo:

Members

static Cesium.CzmlDataSource.updaters : Array.<CzmlDataSource.UpdaterFunction>

Gets the array of CZML processing functions.

avoidSelfOverlap : Boolean

Billboard或者Label对象重叠检测,开启此项会动态计算、优先显示更靠近视角的billboard或者label,被遮挡的对象不予显示。
Gets an event that will be raised when the underlying data changes.
Gets the clock settings defined by the loaded CZML. If no clock is explicitly defined in the CZML, the combined availability of all objects is returned. If only static data exists, this value is undefined.
Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.
Gets the credit that will be displayed for the data source
Gets the collection of Entity instances.
Gets an event that will be raised if an error is encountered during processing.
重叠检测参数,Billboard或者Label类型对象包围盒的外延像素大小
Gets a value indicating if the data source is currently loading data.
Gets an event that will be raised when the data source either starts or stops loading.
Gets a human-readable name for this instance.
Gets whether or not this data source should be displayed.

Methods

static Cesium.CzmlDataSource.load(czml, options)Promise.<CzmlDataSource>

Creates a Promise to a new instance loaded with the provided CZML data.
Name Type Description
czml Resource | String | Object A url or CZML object to be processed.
options CzmlDataSource.LoadOptions optional An object specifying configuration options
Returns:
A promise that resolves to the new instance once the data is processed.

static Cesium.CzmlDataSource.processMaterialPacketData(object, propertyName, packetData, interval, sourceUri, entityCollection)

A helper function used by custom CZML updater functions which creates or updates a MaterialProperty from a CZML packet.
Name Type Description
object Object The object on which the property will be added or updated.
propertyName String The name of the property on the object.
packetData Object The CZML packet being processed.
interval TimeInterval A constraining interval for which the data is valid.
sourceUri String The originating uri of the data being processed.
entityCollection EntityCollection The collection being processsed.

static Cesium.CzmlDataSource.processPacketData(type, object, propertyName, packetData, interval, sourceUri, entityCollection)

A helper function used by custom CZML updater functions which creates or updates a Property from a CZML packet.
Name Type Description
type function The constructor function for the property being processed.
object Object The object on which the property will be added or updated.
propertyName String The name of the property on the object.
packetData Object The CZML packet being processed.
interval TimeInterval A constraining interval for which the data is valid.
sourceUri String The originating uri of the data being processed.
entityCollection EntityCollection The collection being processsed.

static Cesium.CzmlDataSource.processPositionPacketData(object, propertyName, packetData, interval, sourceUri, entityCollection)

A helper function used by custom CZML updater functions which creates or updates a PositionProperty from a CZML packet.
Name Type Description
object Object The object on which the property will be added or updated.
propertyName String The name of the property on the object.
packetData Object The CZML packet being processed.
interval TimeInterval A constraining interval for which the data is valid.
sourceUri String The originating uri of the data being processed.
entityCollection EntityCollection The collection being processsed.

getVisibleAtViewport(index)

查询视口是否显示
Name Type Description
index Number 视口索引号,最大值为8,索引号从下到上,左右往返排序

load(czml, options)Promise.<CzmlDataSource>

Loads the provided url or CZML object, replacing any existing data.
Name Type Description
czml Resource | String | Object A url or CZML object to be processed.
options CzmlDataSource.LoadOptions optional An object specifying configuration options
Returns:
A promise that resolves to this instances once the data is processed.

process(czml, options)Promise.<CzmlDataSource>

Processes the provided url or CZML object without clearing any existing data.
Name Type Description
czml Resource | String | Object A url or CZML object to be processed.
options CzmlDataSource.LoadOptions optional An object specifying configuration options
Returns:
A promise that resolves to this instances once the data is processed.

setVisibleAtViewport(index, visible)

数据显示视口设置
Name Type Description
index Number 视口索引号,最大值为8,索引号从下到上,左右往返排序
visible Boolean 是否显示,默认值为true

setVisibleAtViewportOnly(index, visible)

多视口显示设置,可设置该数据仅在指定的视口索引显示或隐藏,index可以为具体值也可为数组,当index为undefined时,该数据在所有窗口显示或隐藏
Name Type Description
index Number | Array 视口的索引值
visible Boolean 显示/隐藏,默认为ture
Example:
obj.setVisibleAtViewportOnly([0,2,4], false);//设置对象仅在0,2,4视口隐藏,其他窗口显示
obj.setVisibleAtViewportOnly([0,1,2,6], true);//设置对象仅在0,1,2,6视口显示,其他窗口隐藏
obj.setVisibleAtViewportOnly(undefined, true);//设置对象仅在所有视口都显示

update(time)Boolean

Updates the data source to the provided time. This function is optional and is not required to be implemented. It is provided for data sources which retrieve data based on the current animation time or scene state. If implemented, update will be called by DataSourceDisplay once a frame.
Name Type Description
time JulianDate The simulation time.
Returns:
True if this data source is ready to be displayed at the provided time, false otherwise.

Type Definitions

Cesium.CzmlDataSource.LoadOptions

Initialization options for the load method.
Properties:
Name Type Attributes Description
sourceUri Resource | string <optional>
Overrides the url to use for resolving relative links.
credit Credit | string <optional>
A credit for the data source, which is displayed on the canvas.

Cesium.CzmlDataSource.UpdaterFunction(entity, packet, entityCollection, sourceUri)

Name Type Description
entity Entity
packet Object
entityCollection EntityCollection
sourceUri string
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.