Skip to content

Class: DrawEditablePlane

绘制可编辑平面

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new DrawEditablePlane(viewer, mode, options?): DrawEditablePlane

绘制可编辑平面

Parameters

NameTypeDescription
viewerViewer视图
modePlaneMode平面模式
options?DrawEditablePlaneOptionsObject

Returns

DrawEditablePlane

Example

js
const lineHandler = new joDVF.DrawEditablePlane(viewer, joDVF.PlaneMode.Line, {
  classificationType: Cesium.ClassificationType.TERRAIN
});

Defined in

src/interaction/DrawEditablePlane/index.ts:359

Properties

viewer

viewer: Viewer

viewer 对象

Defined in

src/interaction/DrawEditablePlane/index.ts:118


mode

mode: PlaneMode

绘制模式

Defined in

src/interaction/DrawEditablePlane/index.ts:120


polygonStyle

polygonStyle: PolygonStyle

绘制面样式,包含多边形、圆、矩形外观:

  • attributes 属性是 GeometryInstance#attributes
  • appearance 外观
  • depthFailAppearance 深度测试失败时对该基本体进行着色的外观

Memberof

DrawEditablePlane

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/DrawEditablePlane/index.ts:151


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

NameType
idstring
geometry{ width: number ; vertexFormat: VertexFormat }
geometry.widthnumber
geometry.vertexFormatVertexFormat
attributes{ color: ColorGeometryInstanceAttribute }
attributes.colorColorGeometryInstanceAttribute
appearancePolylineColorAppearance
depthFailAppearanceundefined

Defined in

src/interaction/DrawEditablePlane/index.ts:188


pointStyle

pointStyle: PointPrimitive

绘制点的样式

Default

ts
new Cesium.PointPrimitive({ color: Cesium.Color.AQUA });

Defined in

src/interaction/DrawEditablePlane/index.ts:202


editMovingEvent

editMovingEvent: Event<(...args: any[]) => void>

编辑监听事件 请在激活 DrawEditablePlane 后使用,否则返回 null 返回的是编辑中的图元和坐标值

Example

js
planeHandler.editMovingEvent.addEventListener(function (result) {});

Defined in

src/interaction/DrawEditablePlane/index.ts:217


editEndEvent

editEndEvent: Event<(...args: any[]) => void>

编辑结束监听 请在激活 DrawEditablePlane 后使用,否则返回 null 返回的是编辑中的图元和坐标值

Example

js
planeHandler.editEndEvent.addEventListener(function (result) {});

Defined in

src/interaction/DrawEditablePlane/index.ts:232


editDeleteEvent

editDeleteEvent: Event<(...args: any[]) => void>

删除编辑点监听,仅在点、面编辑中使用 请在激活 DrawEditablePlane 后使用,否则返回 null 返回的是编辑中的图元和坐标值

Example

js
planeHandler.editDeleteEvent.addEventListener(function (result) {});

Defined in

src/interaction/DrawEditablePlane/index.ts:247


editAddEvent

editAddEvent: Event<(...args: any[]) => void>

增加编辑点监听,仅在点、面编辑中使用 请在激活 DrawEditablePlane 后使用,否则返回 null 返回的是编辑中的图元和坐标值

Example

js
planeHandler.editAddEvent.addEventListener(function (result) {});

Defined in

src/interaction/DrawEditablePlane/index.ts:262


drawMovingEvent

drawMovingEvent: Event<(...args: any[]) => void>

绘制移动的监听 请在激活 DrawEditablePlane 后使用,否则返回 null 返回的是绘制中的屏幕坐标

Example

js
planeHandler.drawMovingEvent.addEventListener(function (result) {});

Defined in

src/interaction/DrawEditablePlane/index.ts:276


drawEndEvent

drawEndEvent: Event<(...args: any[]) => void>

绘制结束的监听 请在激活 DrawEditablePlane 后使用,否则返回 null 返回的是编辑中的图元和坐标值

Example

js
planeHandler.drawEndEvent.addEventListener(function (result) {});

Defined in

src/interaction/DrawEditablePlane/index.ts:290


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

NameType
pointPointPrimitive
centerPointPointPrimitive
line{ id: string ; geometry: { width: number ; vertexFormat: VertexFormat } ; attributes: { color: ColorGeometryInstanceAttribute } ; appearance: PolylineColorAppearance ; depthFailAppearance: undefined } & { attributes: { color: ColorGeometryInstanceAttribute } }
polygonPolygonStyle & { attributes: { color: ColorGeometryInstanceAttribute } }

Defined in

src/interaction/DrawEditablePlane/index.ts:326


_planeHandler

Static _planeHandler: DrawEditableLine | DrawEditablePolygon

Defined in

src/interaction/DrawEditablePlane/index.ts:340

Accessors

pointPrimitives

get pointPrimitives(): PointPrimitiveCollection

点图元集合

Returns

PointPrimitiveCollection

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:612


primitive

get primitive(): any

第一次退出编辑后才能获取的到图元 当 classificationType 为 undefined 时,返回 Primitive,否则,返回 GroundPrimitive

Returns

any

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:623


editStatus

get editStatus(): boolean

编辑状态

Returns

boolean

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:633


drawHandler

get drawHandler(): DrawHandler

绘制事件

Returns

DrawHandler

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:643

Methods

drawByPositions

drawByPositions(viewer, mode, positions, options?): void

通过传入点集合创建可编辑线或面

Parameters

NameTypeDescription
viewerViewer视图
modePlaneMode平面模式
positionsCartesian3[]点集合
options?DrawByPositionsOptions其他参数

Returns

void

新的实例对象

Example

js
joDVF.DrawEditablePlane.drawByPositions(
  viewer,
  joDVF.PlaneMode.Polygon,
  positions
);

Defined in

src/interaction/DrawEditablePlane/index.ts:471


clear

clear(): void

清除结果

Returns

void

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:508


destroy

destroy(): void

销毁

Returns

void

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:517


draw

draw(): void

开始/重新 绘制,绘制后直接进入编辑

Returns

void

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:528


isDestroyed

isDestroyed(): boolean

是否已销毁

Returns

boolean

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:575


quitEdit

quitEdit(): void

手动退出编辑状态

Returns

void

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:584


reEdit

reEdit(): void

重新进入编辑状态

Returns

void

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:593


update

update(): void

更新

Returns

void

Memberof

DrawEditablePlane

Defined in

src/interaction/DrawEditablePlane/index.ts:602