处理KML标记语言(Keyhole Markup Language)的数据源。KML支持加载S3M、glTF格式的三维模型。
Example:
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/facilities.kmz'),
{
camera: viewer.scene.camera,
canvas: viewer.scene.canvas
});
See:
Members
-
changedEvent : Event
-
Get the event that will be raised when the underlying data changes.
-
clock : DataSourceClock
-
Get the clock settings defined by the loaded KML. Represents the availability interval for all time dynamic data. If KML does not contain time dynamic data, the value is undefined.
-
clustering : EntityCluster
-
Gets or sets the class options for the data source. Can be shared between multiple data sources.
-
entities : EntityCollection
-
Get a collection of
Entity
instances. -
errorEvent : Event
-
Gets the event that will be raised when an error is encountered during processing.
-
Gets a value indicating whether the current data source is loading data.
-
loadingEvent : Event
-
Gets the event that will be raised when the data source starts or stops loading.
-
Get the readable name of the instance. Will automatically be set to the name of the loaded KML file.
-
refreshEvent : Event
-
Gets the event raised when the data source refreshes the network link.
-
Gets whether the data source should be displayed.
-
unsupportedNodeEvent : Event
-
Gets the event raised when the data source finds a node type that is not supported.
Methods
-
staticCesium.KmlDataSource.importFile(data, options) → Promise.<KmlDataSource>
-
Import local KML files.
Name Type Description data
String KML file storage path. options
Object optional The object has the following properties: Name Type Description camera
Camera Camera object. canvas
Canvas Canvas object. Returns:
The import complete returns a KmlDataSource instance. -
Get the visibility of the layer corresponding to the viewport.
Name Type Description index
Number index. Returns:
Visible Visibility.Throws:
-
DeveloperError : The index value ranges from 0 to 3.
-
-
load(data, options) → Promise.<KmlDataSource>
-
Load the KML layer as a URL.
Name Type Description data
String | Document | Blob The layer URL or BLOB containing the KML parsing document. options
Object optional The object has the following properties: Name Type Description camera
Camera Camera object. canvas
Canvas Canvas object. Returns:
When the KML is loaded, it returns a KmlDataSource instance. -
Set the visibility of the layer corresponding to the viewport.
Name Type Description index
Number index. visible
Boolean Visibility. Throws:
-
DeveloperError : The index value ranges from 0 to 3.
-
-
Update all network links that need to be updated.
Name Type Description time
JulianDate Simulation time. True if the data source is displayed within the specified time, otherwise false.