Appearance
Class: DrawEditableCube
绘制可编辑立方体
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new DrawEditableCube(viewer, mode, options?): DrawEditableCube
绘制可编辑立方体
Parameters
| Name | Type | Description |
|---|---|---|
viewer | Viewer | 视图 |
mode | CubeMode | 立方体模式 |
options? | Object | 初始化参数 |
options.showOutline? | boolean | 是否显示外边框 Memberof DrawEditableCubeOptions |
Returns
Example
js
const sphereHandler = new joDVF.DrawEditableCube(viewer, joDVF.CubeMode.Sphere);
sphereHandler.draw();Defined in
src/interaction/DrawEditableCube/index.ts:261
Properties
viewer
• viewer: Viewer
视图
Defined in
src/interaction/DrawEditableCube/index.ts:109
mode
• mode: CubeMode
立方体模式
Defined in
src/interaction/DrawEditableCube/index.ts:111
showOutline
• showOutline: boolean
是否显示外边框,改变后需重新绘制才能够应用
Defined in
src/interaction/DrawEditableCube/index.ts:114
sphereStyle
• sphereStyle: null
绘制球体样式,包含 attributes 属性是GeometryInstance#attributes outlineAttributes 外边框属性,仅在DrawEditableCube#showOutline开启时有效 appearance 外观 depthFailAppearance 深度测试失败时对该基本体进行着色的外观 Default Value :
js
{
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.fromAlpha(Cesium.Color.CYAN, 0.5)
)
},
outlineAttributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.CYAN
)
},
appearance: new Cesium.PerInstanceColorAppearance({
flat: true
}),
depthFailAppearance: undefined
}Memberof
DrawEditableCube
Defined in
src/interaction/DrawEditableCube/index.ts:149
polyhedronStyle
• polyhedronStyle: PolyhedronStyle
多面体样式,包含 extrudedHeight 多面体拉伸高度 attributes 属性是 GeometryInstance#attributes outlineAttributes 外边框属性,仅在 DrawEditableCube#showOutline 开启时有效 appearance 外观 depthFailAppearance 深度测试失败时对该基本体进行着色的外观 Default Value :
js
{
extrudedHeight: 100,
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.fromAlpha(Color.CYAN, 0.5)
)
},
outlineAttributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
Cesium.Color.CYAN
)
},
appearance: new Cesium.PerInstanceColorAppearance({
flat: true
}),
depthFailAppearance: undefined
}Memberof
DrawEditableCube
Defined in
src/interaction/DrawEditableCube/index.ts:181
pointStyle
• pointStyle: PointStyle
编辑点外观,包含 outlineColor: 点外边缘颜色 outlineWidth: 点外边缘宽度 pixelSize: 点大小 Default Value :
js
{
outlineWidth: 1,
outlineColor: Cesium.Color.WHITE,
pixelSize: 15,
};Memberof
DrawEditableCube
Defined in
src/interaction/DrawEditableCube/index.ts:200
editMovingEvent
• editMovingEvent: Event<(...args: any[]) => void>
编辑监听事件 请在激活 DrawEditableCube 后使用,否则返回 null 返回的是编辑中的 primitive
Memberof
DrawEditableCube
Example
js
cubeHandler.editMovingEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditableCube/index.ts:215
drawEndEvent
• drawEndEvent: Event<(...args: any[]) => void>
绘制结束事件 请在激活 DrawEditableCube 后使用,否则返回 null 返回的是绘制结束后的 primitive 或者取消绘制 undefined
Memberof
DrawEditableCube
Defined in
src/interaction/DrawEditableCube/index.ts:224
editEndEvent
• editEndEvent: Event<(...args: any[]) => void>
保存编辑结果事件 请在激活 DrawEditableCube 后且进入编辑状态后使用,否则返回 null 当调用取消编辑并保存的方法时,返回的是编辑结束后的 primitive
Memberof
DrawEditableCube
Example
js
cubeHandler.exitEdit(true);
cubeHandler.editEndEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditableCube/index.ts:241
Methods
draw
▸ draw(): void
绘制立方体
Returns
void
Defined in
src/interaction/DrawEditableCube/index.ts:310
edit
▸ edit(): void
编辑立方体, 右键可随时退出并保存编辑
Returns
void
Defined in
src/interaction/DrawEditableCube/index.ts:345
exitEdit
▸ exitEdit(isSave?): void
取消编辑 当调用取消编辑并保存的方法时,返回的是编辑结束后的 primitive
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
isSave | boolean | false | 是否保存当前编辑结果, true 返回编辑后 primitive, false 返回初始状态 |
Returns
void
Defined in
src/interaction/DrawEditableCube/index.ts:354
clear
▸ clear(): void
清除所绘制的立方体
Returns
void
Defined in
src/interaction/DrawEditableCube/index.ts:361
destroy
▸ destroy(): void
销毁所有图层
Returns
void
Defined in
src/interaction/DrawEditableCube/index.ts:368
drawByPositions
▸ drawByPositions(viewer, options): any
通过传入点集合创建可编辑立方体 若为球体时,传入第一个坐标为球心,第二个坐标为球面上任意一点 请在确保开启深度拾取的状态下使用,否则会出现编辑点位不准确等的问题
Parameters
| Name | Type |
|---|---|
viewer | Viewer |
options | DrawByPositionsOptions |
Returns
any
Remarks
options Object:
| Name | Type | Description |
|---|---|---|
mode | CubeMode | 平面模式 |
positions | Array.<Cartesian3> | 点集合 |
sphereStyle | Object | optional 和 sphereStyle 一样的设置 |
polyhedronStyle | Object | optional 和 polyhedronStyle 一样的设置 |
cylinderStyle | Object | optional 和 pointStyle 一样的设置 |
Example
js
joDVF.DrawEditableCube.drawByPositions(viewer, {
positions: positions,
mode: joDVF.CubeMode.Cuboid
});Defined in
src/interaction/DrawEditableCube/index.ts:403

