Class: IGSScene

IGSScene

new IGSScene(options)

document/layer/igserver/IGSScene.js, line 4

IGS 场景对象。

该类用于描述 IGSSceneLayer 中的单个场景(scene),包含场景索引、场景名称、场景范围以及场景内子图层集合。 通常由 IGSSceneLayer 在加载服务元信息后构造,也可用于从 toJSON() 的结果中恢复场景结构。

Name Type Default Description
options Object {} 可选

构造参数。

Name Type Default Description
sceneIndex Number 0 可选

场景在场景文档中的索引。

sceneName String '' 可选

场景名称。

sceneMode String '' 可选

场景模式/类型标识。

sceneRange Extent | Object | null null 可选

场景范围(包围盒)。

sublayers Collection | Array.<Object> | null null 可选

场景内直接子图层集合。

layer IGSSceneLayer | null null 可选

当前场景所属的场景服务图层引用(运行时关联)。

extendedProps Object {} 可选

扩展属性。

Example

Create IGSScene instance

// ES5 import style
const { IGSScene } = zondy

// ES6 import style
import { IGSScene } from '@mapgis/webclient-common'

Extends

Members

allSublayersCollection

当前场景下扁平化后的全部子图层集合。

该属性基于 sublayers 动态展开多层嵌套子图层,返回顺序与层级遍历顺序一致。

extendedPropsObject

当前场景的扩展属性。

该属性通常用于保留服务端附加字段或业务自定义配置。

layerSceneLayer null

当前场景所属的场景服务图层。

该属性仅在运行时用于建立场景与其父级图层之间的关联关系,toJSON 不会导出该属性。

sceneIndexNumber

当前场景在场景文档中的顺序索引。

该值来源于初始化配置或服务元信息,创建后通常作为只读标识使用。

sceneModeString

当前场景模式或场景类型标识。

该属性来源于初始化配置,用于区分不同场景模式。

sceneNameString

场景名称。

当服务元信息未提供时,默认值为 'IGS场景'

sceneRangeExtent null

当前场景的范围。

该属性来自初始化配置或 JSON 恢复结果,通常用于描述场景包围盒;未提供时为 null

sublayersCollection null

当前场景的直接子图层集合。

该属性来源于初始化配置;当传入数组时会自动转换为 SubLayer 集合,并为每个子图层补充父级图层关联。

Methods

clone(){IGSScene}

document/layer/igserver/IGSScene.js, line 68

克隆当前场景对象。

Returns:
Type Description
IGSScene 克隆后的 IGSScene 实例。

inherited findSublayerById(id){SceneSubLayer|null}

document/layer/BaseScene.js, line 136

根据子图层 id 查找场景中的子图层。

该方法会在 allSublayers 扁平集合中检索,适用于从多层嵌套子图层结构中快速定位目标子图层。

Name Type Description
id String | Number

子图层 id。

Returns:
Type Description
SceneSubLayer | null 匹配到的子图层;未找到时返回 null

toJSON(){Object}

document/layer/igserver/IGSScene.js, line 43

导出为 JSON 配置。

Returns:
Type Description
Object 场景配置对象。

IGSScene.fromJSON(json){IGSScene}

document/layer/igserver/IGSScene.js, line 54

通过 JSON 配置创建一个新的 IGSScene 实例。

适用于从持久化配置恢复场景结构,通常与 toJSON() 配套使用。

Name Type Default Description
json Object {} 可选

场景配置对象。

Returns:
Type Description
IGSScene 新的 IGSScene 实例。