Appearance
Class: DrawEditHandler
绘制可编辑平面
Table of contents
Constructors
Properties
- viewer
- mode
- polygonStyle
- lineStyle
- pointStyle
- editMovingEvent
- editEndEvent
- editDeleteEvent
- editAddEvent
- drawMovingEvent
- drawEndEvent
- editStyle
- _planeHandler
- htmlStr
Accessors
Methods
Constructors
constructor
• new DrawEditHandler(viewer, mode, options?): DrawEditHandler
绘制可编辑平面
Parameters
| Name | Type | Description |
|---|---|---|
viewer | Viewer | 视图 |
mode | PlaneMode | 平面模式 |
options? | DrawEditablePlaneOptions | Object |
Returns
Example
js
const lineHandler = new joDVF.DrawEditHandler(viewer, joDVF.PlaneMode.Line, {
classificationType: Cesium.ClassificationType.TERRAIN
});Defined in
src/interaction/DrawEditHandler/index.ts:368
Properties
viewer
• viewer: Viewer
viewer 对象
Defined in
src/interaction/DrawEditHandler/index.ts:122
mode
• mode: PlaneMode
绘制模式
Defined in
src/interaction/DrawEditHandler/index.ts:124
polygonStyle
• polygonStyle: PolygonStyle
绘制面样式,包含多边形、圆、矩形外观:
- attributes 属性是 GeometryInstance#attributes
- appearance 外观
- depthFailAppearance 深度测试失败时对该基本体进行着色的外观
Memberof
DrawEditHandler
Example
Default Value :
js
{
id: "draw-polygon",
geometry: undefined,
attributes: {
color: ColorGeometryInstanceAttribute.fromColor(
Color.fromAlpha(Color.CYAN, 0.5),
),
},
appearance: new PerInstanceColorAppearance({
flat: true,
}),
depthFailAppearance: undefined,
}Defined in
src/interaction/DrawEditHandler/index.ts:155
lineStyle
• lineStyle: Object
绘制线样式,包含:
- id 会写入进 primitive 被 pick 到的 ID 中,可以是字符串或对象
- section 使用在绘制线时,是否需要分段绘制,默认为 undefined.
- geometry 几何图形,是除去 positions 的 GroundPolylineGeometry 或者 PolylineGeometry
- attributes 属性是 GeometryInstance#attributes,
- appearance 外观
- depthFailAppearance 深度测试失败时对该基本体进行着色的外观
Example
Default Value :
js
{
id: "draw-editable-line",
geometry: {
width: 2,
vertexFormat: PolylineColorAppearance.VERTEX_FORMAT,
},
attributes: {
color: ColorGeometryInstanceAttribute.fromColor(Color.CYAN),
},
appearance: new PolylineColorAppearance({
translucent: false,
}),
depthFailAppearance: void 0,
}Type declaration
| Name | Type |
|---|---|
id | string |
geometry | { width: number ; vertexFormat: VertexFormat } |
geometry.width | number |
geometry.vertexFormat | VertexFormat |
attributes | { color: ColorGeometryInstanceAttribute } |
attributes.color | ColorGeometryInstanceAttribute |
appearance | PolylineColorAppearance |
depthFailAppearance | undefined |
Defined in
src/interaction/DrawEditHandler/index.ts:192
pointStyle
• pointStyle: PointPrimitive
绘制点的样式
Default
ts
new Cesium.PointPrimitive({ color: Cesium.Color.AQUA });Defined in
src/interaction/DrawEditHandler/index.ts:206
editMovingEvent
• editMovingEvent: Event<(...args: any[]) => void>
编辑监听事件 请在激活 DrawEditHandler 后使用,否则返回 null 返回的是编辑中的图元和坐标值
Example
js
planeHandler.editMovingEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditHandler/index.ts:221
editEndEvent
• editEndEvent: Event<(...args: any[]) => void>
编辑结束监听 请在激活 DrawEditHandler 后使用,否则返回 null 返回的是编辑中的图元和坐标值
Example
js
planeHandler.editEndEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditHandler/index.ts:236
editDeleteEvent
• editDeleteEvent: Event<(...args: any[]) => void>
删除编辑点监听,仅在点、面编辑中使用 请在激活 DrawEditHandler 后使用,否则返回 null 返回的是编辑中的图元和坐标值
Example
js
planeHandler.editDeleteEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditHandler/index.ts:251
editAddEvent
• editAddEvent: Event<(...args: any[]) => void>
增加编辑点监听,仅在点、面编辑中使用 请在激活 DrawEditHandler 后使用,否则返回 null 返回的是编辑中的图元和坐标值
Example
js
planeHandler.editAddEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditHandler/index.ts:266
drawMovingEvent
• drawMovingEvent: Event<(...args: any[]) => void>
绘制移动的监听 请在激活 DrawEditHandler 后使用,否则返回 null 返回的是绘制中的屏幕坐标
Example
js
planeHandler.drawMovingEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditHandler/index.ts:280
drawEndEvent
• drawEndEvent: Event<(...args: any[]) => void>
绘制结束的监听 请在激活 DrawEditHandler 后使用,否则返回 null 返回的是编辑中的图元和坐标值
Example
js
planeHandler.drawEndEvent.addEventListener(function (result) {});Defined in
src/interaction/DrawEditHandler/index.ts:294
editStyle
• editStyle: Object
编辑时点和线样式,包含:
- point: 点的样式,和 pointStyle 一样的设置,不过是默认下 color: Cesium.Color.ORANGE
- centerPoint: 中心点的样式,主要用于面编辑。和 pointStyle 一样的设置,不过是默认下 color: Cesium.Color.RED
- line: 线的样式,和 lineStyle 一样的设置,不过是默认 color: Cesium.Color.YELLOW
- polygon: 面的样式,和 polygonStyle 一样的设置,不过是默认 color: Cesium.Color.fromAlpha(Cesium.Color.YELLOW, 0.5)
Example
Default Value :
js
{
point: new Cesium.PointPrimitive(...),
centerPoint: new Cesium.PointPrimitive(...),
line: { ...this._lineStyle }
polygon: { ...this._polygonStyle }
}Type declaration
| Name | Type |
|---|---|
point | PointPrimitive |
centerPoint | PointPrimitive |
line | { id: string ; geometry: { width: number ; vertexFormat: VertexFormat } ; attributes: { color: ColorGeometryInstanceAttribute } ; appearance: PolylineColorAppearance ; depthFailAppearance: undefined } & { attributes: { color: ColorGeometryInstanceAttribute } } |
polygon | PolygonStyle & { attributes: { color: ColorGeometryInstanceAttribute } } |
Defined in
src/interaction/DrawEditHandler/index.ts:331
_planeHandler
▪ Static _planeHandler: DrawEditableLine | DrawEditablePolygon
Defined in
src/interaction/DrawEditHandler/index.ts:345
htmlStr
• htmlStr: "<div class=\"container\" style=\"width:100px;height:70px;color:#fff;padding:10px;border-radios:10px;background-color:rgba(0,0,0,0.7)\">\n <div id=\"delete\" style=\"cursor:pointer;padding:5px 10px;\">删除顶点</div>\n <div id=\"add\" style=\"cursor:pointer;padding:5px 10px;\">添加顶点</div>\n</div>"
Defined in
src/interaction/DrawEditHandler/index.ts:347
Accessors
pointPrimitives
• get pointPrimitives(): PointPrimitiveCollection
点图元集合
Returns
PointPrimitiveCollection
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:626
primitive
• get primitive(): any
第一次退出编辑后才能获取的到图元 当 classificationType 为 undefined 时,返回 Primitive,否则,返回 GroundPrimitive
Returns
any
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:637
editStatus
• get editStatus(): boolean
编辑状态
Returns
boolean
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:647
drawHandler
• get drawHandler(): DrawHandler
绘制事件
Returns
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:657
Methods
drawByPositions
▸ drawByPositions(viewer, mode, positions, options?): DrawEditableLine | DrawEditablePolygon
Parameters
| Name | Type |
|---|---|
viewer | Viewer |
mode | PlaneMode |
positions | Cartesian3[] |
options? | DrawByPositionsOptions |
Returns
DrawEditableLine | DrawEditablePolygon
新的实例对象
Example
js
joDVF.DrawEditHandler.drawByPositions(
viewer,
joDVF.PlaneMode.Polygon,
positions
);Defined in
src/interaction/DrawEditHandler/index.ts:480
clear
▸ clear(): void
清除结果
Returns
void
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:520
destroy
▸ destroy(): void
销毁
Returns
void
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:530
draw
▸ draw(): void
开始/重新 绘制,绘制后直接进入编辑
Returns
void
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:541
isDestroyed
▸ isDestroyed(): boolean
是否已销毁
Returns
boolean
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:589
quitEdit
▸ quitEdit(): any[]
手动退出编辑状态
Returns
any[]
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:598
reEdit
▸ reEdit(): void
重新进入编辑状态
Returns
void
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:607
update
▸ update(): void
更新
Returns
void
Memberof
DrawEditHandler
Defined in
src/interaction/DrawEditHandler/index.ts:616

