12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{HandleOwnerMixin as o}from"../../core/HandleOwner.js";import{destroyMaybe as r}from"../../core/maybe.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveElevationInfo as a}from"../../support/elevationInfoUtils.js";import{DrawOperation as s}from"./DrawOperation.js";import{SceneDrawSurface as p,ElevationDrawSurface as d}from"./drawSurfaces.js";import{InteractiveToolBase as l}from"../interactive/InteractiveToolBase.js";let h=class extends(o(t.EventedMixin(l))){constructor(e){super(e),this.defaultZ=0,this.elevationInfo=null,this.hasZ=!0,this.mode=null,this.snapToScene=null,this.type="draw-3d"}initialize(){const e=this.view,t=a(this.hasZ,this.elevationInfo);this.drawOperation=new s({view:e,manipulators:this.manipulators,geometryType:this.geometryType,drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:"3d"===e.type?new p(e,t):null,elevationDrawSurface:"3d"===e.type?new d(t,this.defaultZ,e):null,hasM:!1,elevationInfo:t}),this.handles.add([this.drawOperation.on("vertex-add",(e=>this.onVertexAdd(e))),this.drawOperation.on("vertex-remove",(e=>this.onVertexRemove(e))),this.drawOperation.on("vertex-update",(e=>this.onVertexUpdate(e))),this.drawOperation.on("cursor-update",(e=>this.onCursorUpdate(e))),this.drawOperation.on("complete",(e=>this.onComplete(e)))]),this.finishToolCreation()}destroy(){this.drawOperation=r(this.drawOperation),this._set("view",null)}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}get updating(){return this.drawOperation?.updating??!1}completeCreateOperation(){this.drawOperation.complete()}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}getVertexCoords(){return this.drawOperation.vertices}onInputEvent(e){this.drawOperation.onInputEvent(e)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}onComplete(e){this.emit("complete",e)}onCursorUpdate(e){this.emit("cursor-update",e)}onVertexAdd(e){this.emit("vertex-add",e)}onVertexRemove(e){this.emit("vertex-remove",e)}onVertexUpdate(e){this.emit("vertex-update",e)}};e([i({constructOnly:!0,nonNullable:!0})],h.prototype,"defaultZ",void 0),e([i()],h.prototype,"drawOperation",void 0),e([i({constructOnly:!0})],h.prototype,"elevationInfo",void 0),e([i({value:!0})],h.prototype,"enabled",null),e([i({constructOnly:!0})],h.prototype,"geometryType",void 0),e([i({constructOnly:!0})],h.prototype,"hasZ",void 0),e([i({constructOnly:!0})],h.prototype,"mode",void 0),e([i()],h.prototype,"snapToScene",void 0),e([i({readOnly:!0})],h.prototype,"type",void 0),e([i({readOnly:!0})],h.prototype,"updating",null),e([i({constructOnly:!0,nonNullable:!0})],h.prototype,"view",void 0),h=e([n("esri.views.draw.DrawTool")],h);export{h as DrawTool};
|