Members
Animation :Animation
- Description:
动画实例对象
动画实例对象
Type:
- Animation
Effect :Effect
- Description:
特效实例对象
特效实例对象
Type:
- Effect
Methods
(async) add3DTiles(options)
- Description:
添加新的Cesium 3DTiles模型到场景中
Parameters:
Name | Type | Description |
---|---|---|
options |
Cesium3DTiles.ConstructorOptions | 一个Tileset类构造函数的参数对象 |
addAmbientLight(options) → {string}
- Description:
向场景中添加一个环境光
Parameters:
Name | Type | Description |
---|---|---|
options |
AmbientLight.ConstructorOptions |
- Returns:
-
string
-
返回所添加的环境光实例对象的ID
addDirectionalLight(options) → {string}
- Description:
向场景中添加一个平行光
Parameters:
Name | Type | Description |
---|---|---|
options |
DirectionalLight.ConstructorOptions |
- Returns:
-
string
-
返回所添加的平行光实例对象的ID
addEventListener(e, callback)
- Description:
事件监听接口
Parameters:
Name | Type | Description |
---|---|---|
e |
EventType | 事件类型 |
callback |
EventListenerCallback | 事件监听回调函数 |
addFeatureCollection(options)
- Description:
添加新的矢量数据到场景中(目前仅支持GeoJSON和TopoJSON两种格式)
Parameters:
Name | Type | Description |
---|---|---|
options |
FeatureCollection.ConstructorOptions | 一个FeatureCollection类构造函数的参数对象 |
addGeoJson(url, strokeColor, fillColor, callback) → {string}
- Description:
添加新的geojson数据到场景中
Parameters:
Name | Type | Description |
---|---|---|
url |
string | geojson文件路径 |
strokeColor |
array | 边缘颜色 |
fillColor |
array | 填充颜色 |
callback |
callback | 成功回调函数 |
- Returns:
-
string
-
返回数据的ID
(async) addGltf(options) → {string}
- Description:
添加新的glTF、glb模型到场景中
Parameters:
Name | Type | Description |
---|---|---|
options |
Gltf.ConstructorOptions | 一个Gltf类构造函数的参数对象 |
- Returns:
-
string
-
glTF模型添加成功后,返回改模型的ID
addGridLineHelper()
- Description:
添加一个XZ平面的辅助格网线
addGroup(models) → {Group}
- Description:
向当前活动的场景中,添加一模型组对象实例
Parameters:
Name | Type | Description |
---|---|---|
models |
Array.<Object3D> | 要添加到群组的模型对象实例 |
- Returns:
-
Group
-
模型组添加成功后,返回该模型组的ID;添加失败时,返回空字符串
addHemisphereLight(options) → {string}
- Description:
向场景中添加一个半球光源
Parameters:
Name | Type | Description |
---|---|---|
options |
HemisphereLight.ConstructorOptions |
- Returns:
-
string
-
返回所添加的半球光实例对象的ID
addImageCollection(options)
- Description:
添加新的影像瓦片数据到场景中
Parameters:
Name | Type | Description |
---|---|---|
options |
ImageCollection.ConstructorOptions | 一个ImageCollection类构造函数的参数对象 } |
addOrthographicCamera(options) → {string}
- Description:
向场景中添加一个正交投影相机
Parameters:
Name | Type | Description |
---|---|---|
options |
OrthographicCamera.ConstructorOptions |
- Returns:
-
string
-
返回所添加的透视投影相机的ID
addPerspectiveCamera(options) → {string}
- Description:
向场景中添加一个透视投影相机
Parameters:
Name | Type | Description |
---|---|---|
options |
PerspectiveCamera.ConstructorOptions |
- Returns:
-
string
-
返回所添加的透视投影相机的ID
addShadowPlane(options) → {string}
- Description:
添加一个平面,用于辅助获取模型阴影
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 描述数据源信息的对象,包括以下字段 Properties
|
- Returns:
-
string
-
返回阴影平面的ID
addSource(options)
Experimental
目前,还不建议使用该API!因为这是一个实验性的API,尚不稳定,且未经测试。在未来的版本更新中,可能会改变,甚至被移除。
- Description:
添加新的数据、模型到场景中(目前暂不支持地形数据的添加)
Parameters:
Name | Type | Description |
---|---|---|
options |
ImageCollection.ConstructorOptions | FeatureCollection.ConstructorOptions | Gltf.ConstructorOptions | Tileset.ConstructorOptions | options - 数据、模型的初始化、实例化参数 |
addTween()
- Description:
向场景中添加补间动画
appendChild(options)
- Description:
将一个模型、数据添作为子模型或数据,追加到一个已存在的群组对象上。 如果不是添加目标不是一个有效的群组组,则会尝试升级为组对象 (当前版本暂不支持)。
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 向模型组中追加子模型的参数选项 Properties
|
configureScene(options)
- Description:
设置场景的属性
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 场景属性 Properties
|
createScene(options) → {string}
- Description:
创建一个场景实例对象
Parameters:
Name | Type | Description |
---|---|---|
options |
SceneU3D.ConstructorOptions | SceneM3D.ConstructorOptions | 创建场景所需的初始参数选项 |
- Returns:
-
string
-
场景创建成功后,返回所创建场景的ID
destroyTween()
- Description:
销毁场景中的补间动画
flyTo(options)
- Description:
以动画的方式,将相机飞行至特定的位置
Parameters:
Name | Type | Description |
---|---|---|
options |
Array.<Scene.FlyToOptions> | 一个数组,可包多个飞行目标位置及动画控制参数对象 |
flyToAnimation(options)
- Description:
相机飞入动画
Parameters:
Name | Type | Description |
---|---|---|
options |
array | 相机参数 |
getCameraParams() → {Object}
- Description:
获取相机参数
- Returns:
-
Object
-
相机参数
getChildFromGroup(options) → {Object3D}
- Description:
从指定的群组中获取所有的子模型,或者指定ID的模型
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 从群组中获取子模型的参数选项 Properties
|
- Returns:
-
Object3D
-
返回一个或多个模型对象实例
getGroupChildren(groupId) → {Object3D}
- Description:
从群组中获取指定ID的子模型
Parameters:
Name | Type | Description |
---|---|---|
groupId |
string | 要获取的子模型的ID |
- Returns:
-
Object3D
-
返回获取到的子模型
getPosition(要设置的模型的位置,一个) → {Array.<number>}
- Description:
获取模型的位置
Parameters:
Name | Type | Description |
---|---|---|
要设置的模型的位置,一个 |
Array.<number> | (lng, lat, height) 格式的数组 |
- Returns:
-
Array.<number>
-
要设置的模型的位置,一个 (lng, lat, height) 格式的数组
getScene(sceneId) → {Scene}
- Description:
获取当前活动的,即持有焦点(focus on),或者指定ID的场景实例对象
Parameters:
Name | Type | Description |
---|---|---|
sceneId |
string | 要获取的场景的ID |
- Returns:
-
Scene
-
返回匹配的场景实例
getSource(options) → {Object3D}
- Description:
从场景中获取模型、数据、文字、标签等数据源
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object | ||
object.id |
string | 资源ID |
|
object.groupId |
string |
<optional> |
群组ID,当指定群组ID时,该API将会在群组对象中,查找指定ID的对象 |
- Returns:
-
Object3D
-
返回一个数据源对象
hideGlobe()
- Description:
隐藏地球
hideScene(sceneIdopt)
- Description:
隐藏引擎中的当前活动场景
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sceneId |
string |
<optional> |
要隐藏的场景的ID,未指定场景ID时,将默认隐藏当前活动的场景 |
hideSource(id)
- Description:
隐藏活动场景中的数据、模型
Parameters:
Name | Type | Description |
---|---|---|
id |
string | 要隐藏的数据、模型的ID |
hideSurroundings()
- Description:
关闭周围所有环境(隐藏倾斜摄影、隐藏特效、隐藏流光)
highlight(options)
- Description:
高亮指定ID的模型或指定ID的模型构件
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 高亮模型的参数,包含以下字段 Properties
|
openSurroundings()
- Description:
打开周围所有环境(显示倾斜摄影、显示特效、显示流光)
playAllAnimations(options)
- Description:
以指定的循环渲染模式,播放场景中的动画。须注意的是, 该API会改变场景实例的渲染模式。场景实例的渲染模式, 通常在创建场景实例对象时,通过“LoopMode”参数指定
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 动画播放参数,包括以下字段: Properties
|
removeAllSources(optionsopt)
- Description:
从活动的场景中,移除所有的数据、模型
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<optional> |
removeGeoJson(content)
- Description:
移除场景中的geojson数据
Parameters:
Name | Type | Description |
---|---|---|
content |
object | string | geojson文件的对象或路径 |
removeScene(sceneId)
- Description:
移除并销毁指定ID的场景
Parameters:
Name | Type | Description |
---|---|---|
sceneId |
string | 场景id |
removeSource(id)
- Description:
从活动的场景中,移除指定ID的数据、模型
Parameters:
Name | Type | Description |
---|---|---|
id |
string | 要移除的数据、模型的ID |
removeTranslationController()
- Description:
移除平移模型的操作句柄,即退出平移操作状态,并释放相应的资源
resizeScene(width, height)
- Description:
重新调整场景的大小
Parameters:
Name | Type | Description |
---|---|---|
width |
number | 场景的宽 |
height |
number | 场景的高 |
setBackground(options)
- Description:
设置场景的背景色或图片,其中背景色,目前只能设置垂直渐变色
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 场景背景色设置参数,包含以下字段 Properties
|
setCameraController(options)
- Description:
设置相机的控制(或者说是交互)方式。值得注意的是,Controllers是一个数组,这意味着,同一个交互方式, 可以绑定多个输入事件(包括鼠标、键盘、触屏操作)
Example
// 设置相机交互控制:左键平移、右键旋转,滚轮缩放
api.setCameraController({
// 旋转控制(对于地表物体来说,就是倾斜相机的角度)
tilt: {
// disabled: false, // 禁止旋转地表模型(为True时,下面的“controllers”参数设置无效)
controllers: [
Qk3d.CameraEventType.RIGHT_DRAG,
]
},
// 平移控制(并不是直接旋转地表的模型,而是通过旋转地球,以达到平移地表模型的效果。)
rotate: {
// disabled: false, // 禁止旋平移表模型(为True时,下面的“controllers”参数设置无效)
controllers: [
Qk3d.CameraEventType.LEFT_DRAG
]
},
// 缩放控制
zoom: {
// disabled: false, // 禁止缩放地表模型(为True时,下面的“controllers”参数设置无效)
controllers: [
Qk3d.CameraEventType.WHEEL, // 鼠标中键滚轮
Qk3d.CameraEventType.PINCH, // 双指触控屏幕
]
}
});
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 一个对象,包括以下属性字段: Properties
|
setCameraDistance(options)
- Description:
设置相机距离观测模板的距离
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 一个对象,包括以下属性字段: Properties
|
setColor(options)
- Description:
设置模型的颜色
Parameters:
Name | Type | Description |
---|---|---|
options |
Array.<number> | 要设置的RGBA格式的颜色 |
setMaterial(options)
- Description:
设置指定模型的材质
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 一个对象,用于描述要添加的模型数组,包括以下属性字段: Properties
|
setPosition(position)
- Description:
设置模型的位置
Parameters:
Name | Type | Description |
---|---|---|
position |
Array.<number> | 要设置的模型的位置,一个 (lng, lat, height) 格式的数组 |
setScene(sceneId)
- Description:
场景切换,即设置当前活动的场景为指定ID的场景 这将使得将指定ID的场景获取焦点
Parameters:
Name | Type | Description |
---|---|---|
sceneId |
string |
setTerrain(options)
- Description:
设置地形数据
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
showGlobe()
- Description:
显示地球
showMonomerBuilding(options)
- Description:
显示需要展示的单体化建筑
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 单体化建筑配置信息 Properties
|
showScene(sceneId)
- Description:
显示引擎中的当前活动场景
Parameters:
Name | Type | Description |
---|---|---|
sceneId |
string | 要显示的场景的ID |
showSource(id)
- Description:
显示活动场景中的数据、模型
Parameters:
Name | Type | Description |
---|---|---|
id |
string | 要显示的数据、模型的ID |
stopAllAnimations()
- Description:
停止场景中所有的动画播放
syncViews(sceneId1, sceneId2)
- Description:
同步两个场景的视图,即视角同步
Parameters:
Name | Type | Description |
---|---|---|
sceneId1 |
string | 第一个场景的ID |
sceneId2 |
string | 第二个场景的ID |
translate(options, callback)
- Description:
平移模型
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 平移模型的辅助坐标轴、平移参数设置 Properties
|
|||||||||||||||||||||||||
callback |
TranslationCallback | 回调函数 |
translateMulti(options, callback)
- Description:
批量平移模型,可以一次性进行多个模型的平移操作
Parameters:
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 平移模型的辅助坐标轴、平移参数设置 Properties
|
|||||||||||||||||||||||||
callback |
TranslationCallback | 回调函数 |
unhighlight(options)
- Description:
取消高亮指定ID的模型或指定ID的模型构件
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 取消高亮模型的参数,包含以下字段 Properties
|
unsyncViews(sceneId1, sceneId2)
- Description:
取消两个场景的视图同步操作
Parameters:
Name | Type | Description |
---|---|---|
sceneId1 |
string | 第一个场景的ID |
sceneId2 |
string | 第二个场景的ID |
zoomTo(options)
- Description:
将当前场景的视角,缩放至指定模型的视野范围
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 一个对象,包括以下属性字段: Properties
|