new Cesium.KmlDataSource(options)

用于处理 Keyhole Markup Language 2.2 ( KML ) 的 DataSource .

KML 在 Cesium 中的支持不完整,但大量的标准, 以及Google的 NT 0 gx NT 1 扩展命名空间,均被支持. 见Github问题 #873 for a 详细列出什么是和不支持。 #NT###0 也会将信息写给 当遇到大多数不支持的特性时控制台.

非视觉特征数据,如 NT 0 atom:author NT 1 和 NT 2 ExtendData NT 3 is exposed via an instance of KmlFeatureData, which is added to each Entity 在 NT 0 kml NT 1 财产下.

Name Type Description
options KmlDataSource.ConstructorOptions optional 描述初始化选项的对象
Example:
const viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/facilities.kmz',
     {
          camera: viewer.scene.camera,
          canvas: viewer.scene.canvas
     })
);
Demo:
See:

Members

camera : Camera|undefined

The position and orientation of this Camera will be used to 生成网络请求时填充各种相机参数 . NT 0 移动将决定何时触发网络链接刷新, 如果 viewRefreshMode is onStop.

canvas : HTMLCanvasElement|undefined

此 Canva 的当前大小将用来填充 Link 参数 用于客户端高度和宽度.

changedEvent : Event

获得一个在基础数据变化时会提升的事件.

clock : DataSourceClock

获得已装入的 NT % 0 定义的时钟设置 。 总计 availability interval for all time-dynamic data. If the KML does not contain 时间动态数据,此值未定义 .

clustering : EntityCluster

获取或设置此数据源的分组选项。 此对象可以在多个数据源之间共享.

credit : Credit

获取数据源将显示的信用

entities : EntityCollection

Gets the collection of Entity instances.

errorEvent : Event

获得一个在处理过程中遇到错误时会提起的事件.

isLoading : boolean

获得一个表示数据源是否正在装入数据的值.

kmlTours : Array.<KmlTour>

获得 NT 0 用于引导相机在特定时间间隔内前往指定目的地的旅游.

loadingEvent : Event

获得数据源开始或停止加载时将提出的事件.

name : string

为这个例子获得或设置一个人可读的名字. This will be automatically be set to the KML document name on load.

refreshEvent : Event

获得当数据源刷新网络链接时将提起的事件.

show : boolean

获取是否显示此数据源 .

unsupportedNodeEvent : Event

获取当数据源找到一个不支持的节点类型时将提起的事件.

Methods

static Cesium.KmlDataSource.load(data, options)Promise.<KmlDataSource>

Creates a Promise to a new instance loaded with the provided KML data.
Name Type Description
data Resource | string | Document | Blob URL, 解析的 KML 文档, 或 Blob 包含二进制 KMZ 数据或解析的 KML 文档.
options KmlDataSource.ConstructorOptions optional 指定配置选项的对象
Returns:
A promise that will resolve to a new KmlDataSource instance once the KML is loaded.

destroy()

清除数据源创建的任何非实体元素。 目前仅影响屏幕覆盖元素 .

load(data, options)Promise.<KmlDataSource>

Asynchronously loads the provided KML data, replacing any existing data.
Name Type Description
data Resource | string | Document | Blob URL, 解析的 KML 文档, 或 Blob 包含二进制 KMZ 数据或解析的 KML 文档.
options KmlDataSource.LoadOptions optional 指定配置选项的对象
Returns:
A promise that will resolve to this instances once the KML is loaded.

update(time)boolean

更新任何需要更新的网络链接.
Name Type Description
time JulianDate 模拟时间.
Returns:
如果此数据源准备在指定时间显示, 则不正确 .

Type Definitions

Cesium.KmlDataSource.ConstructorOptions

Options for constructing a new KmlDataSource, or calling the static `load` method.
Properties:
Name Type Attributes Default Description
camera Camera <optional>
用于查看RefreshModes并发送相机属性到网络链接的相机.
canvas HTMLCanvasElement <optional>
用于向网络链接发送查看器属性的画布 .
credit Credit | string <optional>
数据源的信用,在画布上显示.
sourceUri string <optional>
覆盖url用于解析相对链接和其他 NT 0 网络特性.
clampToGround boolean <optional>
false 如果我们想要将几何特征(Polygons, LineStrings 和 LinearRings)夹在地上,那就是真的了.
ellipsoid Ellipsoid <optional>
Ellipsoid.default The global ellipsoid used for geographical calculations.
screenOverlayContainer Element | string <optional>
屏幕覆盖图像的容器 .

Cesium.KmlDataSource.LoadOptions

`load` 方法的初始化选项.
Properties:
Name Type Attributes Default Description
sourceUri string <optional>
覆盖url用于解析相对链接和其他 NT 0 网络特性.
clampToGround boolean <optional>
false 如果我们想要将几何特征(Polygons, LineStrings 和 LinearRings)夹在地上,那就是真的了.
ellipsoid Ellipsoid <optional>
Ellipsoid.default The global ellipsoid used for geographical calculations.
screenOverlayContainer Element | string <optional>
屏幕覆盖图像的容器 .
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.