Appearance
KBE3D / KBCore / Cesium / KmlDataSource
类: KmlDataSource
A DataSource which processes Keyhole Markup Language 2.2 (KML). <p> KML support in Cesium is incomplete, but a large amount of the standard, as well as Google's <code>gx</code> extension namespace, is supported. See Github issue #873 for a detailed list of what is and isn't supported. Cesium will also write information to the console when it encounters most unsupported features. </p> <p> Non visual feature data, such as <code>atom:author</code> and <code>ExtendedData</code> is exposed via an instance of KmlFeatureData, which is added to each Entity under the <code>kml</code> property. </p>
示例
ts
const viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/facilities.kmz',
{
camera: viewer.scene.camera,
canvas: viewer.scene.canvas
})
);参数
Object describing initialization options
属性
canvas
canvas:
HTMLCanvasElement|undefined
The current size of this Canvas will be used to populate the Link parameters for client height and width.
camera
camera:
Camera|undefined
The position and orientation of this Camera will be used to populate various camera parameters when making network requests. Camera movement will determine when to trigger NetworkLink refresh if <code>viewRefreshMode</code> is <code>onStop</code>.
name
name:
string
Gets or sets a human-readable name for this instance. This will be automatically be set to the KML document name on load.
clock
clock:
DataSourceClock
Gets the clock settings defined by the loaded KML. This represents the total availability interval for all time-dynamic data. If the KML does not contain time-dynamic data, this value is undefined.
entities
entities:
EntityCollection
Gets the collection of Entity instances.
isLoading
isLoading:
boolean
Gets a value indicating if the data source is currently loading data.
changedEvent
changedEvent:
Event
Gets an event that will be raised when the underlying data changes.
errorEvent
errorEvent:
Event
Gets an event that will be raised if an error is encountered during processing.
loadingEvent
loadingEvent:
Event
Gets an event that will be raised when the data source either starts or stops loading.
refreshEvent
refreshEvent:
Event
Gets an event that will be raised when the data source refreshes a network link.
unsupportedNodeEvent
unsupportedNodeEvent:
Event
Gets an event that will be raised when the data source finds an unsupported node type.
show
show:
boolean
Gets whether or not this data source should be displayed.
clustering
clustering:
EntityCluster
Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.
credit
credit:
Credit
Gets the credit that will be displayed for the data source
kmlTours
kmlTours:
KmlTour[]
Gets the KML Tours that are used to guide the camera to specified destinations on given time intervals.
方法
load()
staticload(data:string|Document|Resource|Blob,options?:ConstructorOptions):Promise<KmlDataSource>
Creates a Promise to a new instance loaded with the provided KML data.
参数
data
A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
string | Document | Resource | Blob
options?
An object specifying configuration options
返回
Promise<KmlDataSource>
A promise that will resolve to a new KmlDataSource instance once the KML is loaded.
load()
load(
data:string|Document|Resource|Blob,options?:LoadOptions):Promise<KmlDataSource>
Asynchronously loads the provided KML data, replacing any existing data.
参数
data
A url, parsed KML document, or Blob containing binary KMZ data or a parsed KML document.
string | Document | Resource | Blob
options?
An object specifying configuration options
返回
Promise<KmlDataSource>
A promise that will resolve to this instances once the KML is loaded.
destroy()
destroy():
void
Cleans up any non-entity elements created by the data source. Currently this only affects ScreenOverlay elements.
返回
void
update()
update(
time:JulianDate):boolean
Updates any NetworkLink that require updating.
参数
time
The simulation time.
返回
boolean
True if this data source is ready to be displayed at the provided time, false otherwise.
构造函数
构造函数
new KmlDataSource(
options?:ConstructorOptions):KmlDataSource
参数
options?
返回
KmlDataSource
