控件模块
Parameters:
Name | Type | Description |
---|---|---|
params |
object
|
|
viewer |
object
|
cesium 实例 |
cesiumGlobal |
object
|
cesium 全局对象 |
defaultStatic |
Array
|
静态资源 |
Extends
Methods
# definedMouseEvent(targetEntity, ctrlFlag)
定义事件
Parameters:
Name | Type | Description |
---|---|---|
targetEntity |
Entity
|
操作的目标实体 |
ctrlFlag |
ctrlManualFlag
|
操作常量定义 |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
let ctrlManualFlag = {
selected: false,
leftDown: false
}
// 调用base 的createGraphics创建一个实体
const entity = control.createGraphics()
control.definedMouseEvent({ targetEntity: entity, ctrlFlag: ctrlManualFlag })
# manualMoveModel(modifyMode)
平移模型
Parameters:
Name | Type | Description |
---|---|---|
modifyMode |
string
|
移动标识,可选['move','rotate','scale'] |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
control.manualMoveModel('move')
# manualRotateModel(modifyMode)
旋转模型
Parameters:
Name | Type | Description |
---|---|---|
modifyMode |
string
|
移动标识,可选['move','rotate','scale'] |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
control.manualRotateModel('rotate')
# manualScaleModel(modifyMode)
缩放模型
Parameters:
Name | Type | Description |
---|---|---|
modifyMode |
string
|
移动标识,可选['move','rotate','scale'] |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
control.manualScaleModel('scale')
# showEntityOrientationEditPanel(param)
实体位置、角度编辑面板
Parameters:
Name | Type | Description |
---|---|---|
param |
object
|
|
entity |
Entity
|
控制的目标实体 |
elementId |
string
|
gui 绑定的dom id |
cb |
function
|
回调函数 |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
// 调用base 的createGraphics创建一个实体
const crEnt = control.createGraphics()
control.showEntityOrientationEditPanel({
elementId: 'cust-gui-box',
entity:crEnt,
cb: orientationRes => {
console.log(orientationRes)
}
});
# showLayerParamPanel(layer)
图层参数调整
Parameters:
Name | Type | Description |
---|---|---|
layer |
ImageryLayer
|
ImageryLayer对象 |
param.elementId |
string
|
gui对象绑定的dom id |
Example
import { Control } from 'cesium_dev_kit'
const {viewer,control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
let layer = viewer.imageryLayers.addImageryProvider(new Cesium.Scene.GoogleImageryProvider({}));
control.showLayerParamPanel(layer, { elementId: 'cust-gui-box' });
# showLayerSwitchPanel(layers, param, cb)
图层切换
Parameters:
Name | Type | Description |
---|---|---|
layers |
object
|
|
param |
object
|
|
cb |
function
|
# showPostProcessStagesPanel(param)
后处理面板
Parameters:
Name | Type | Description |
---|---|---|
param |
object
|
|
elementId |
string
|
gui 组件绑定的dom |
silhouetteColor |
object
|
轮廓颜色 |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
control.showPostProcessStagesPanel({ elementId: 'cust-gui-box' });
# showPrimitiveMatrixPanel(param)
模型,3ditiles等实体位置调整面板, 获取调整后的模型矩阵与平移矩阵
Parameters:
Name | Type | Description |
---|---|---|
param |
object
|
|
primitives |
Primitive
|
操作的目标图元 |
elementId |
string
|
gui对象绑定的dom id |
cb |
function
|
回调函数,返回{modelTransformMatrix: [1,0,0,0,1],modelMatrix:[ -1.1639525282088383,-0.2919152481050832,0]} |
Example
import { Control } from 'cesium_dev_kit'
const {control,viewer} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
let tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({url: 'static/data/3DTiles/building/tileset.json'}));
control.showPrimitiveMatrixPanel({
elementId: 'cust-gui-box',
primitives: tileset,
cb: resModelMatrix => {
console.log(resModelMatrix);
}
});
# showSceneBloomPanel(param)
环境控制
Parameters:
Name | Type | Description |
---|---|---|
param |
object
|
|
elementId |
string
|
gui 组件绑定的dom |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
control.showSceneBloomPanel({ elementId: 'cust-gui-box' });
# showSceneEffectEditPanel(options)
场景效果调整面板
Parameters:
Name | Type | Description |
---|---|---|
options |
object
|
|
colorCorrection |
boolean
|
开启颜色校正 |
bloomEffect |
boolean
|
泛光开关 |
threshold |
number
|
泛光阈值 |
bloomIntensity |
number
|
泛光强度 |
ambientLightColor |
number
|
环境光 |
hdrEnabled |
boolean
|
HDR开关 |
saturation |
number
|
饱和度 |
brightness |
number
|
亮度 |
contrast |
number
|
对比度 |
hue |
number
|
色调 |
Example
import { Control } from 'cesium_dev_kit'
const {control} = new Control({
cesiumGlobal: Cesium,
containerId: 'cesiumContainer'
})
control.showSceneEffectEditPanel({
colorCorrection:false,
saturation :3.1,
brightness : 1.8,
contrast :1.2,
hue :0,
bloomEffect: false,
hdrEnabled : true,
threshold :1,
bloomIntensity : 2,
ambientLightColor: new Cesium.Color(0.3, 0.3, 0.3, 1)
});