UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 3.38 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../../core/Accessor.js";import r from"../../core/Collection.js";import i from"../../core/Logger.js";import s from"../../core/ReactiveMap.js";import{property as o,subclass as n}from"../../core/accessorSupport/decorators.js";import{isSharedTemplateOrMetadata as l}from"../../editing/templateUtils.js";import{hasCircularArc as a,isCurvedGeometry as p}from"../../geometry/support/curves/curveUtils.js";import u from"./Edits.js";const d=()=>i.getLogger("esri.widgets.Editor.CreateFeaturesWorkflowData");let g=class extends t{constructor(e){super(e),this.creationInfo=null,this.editorItem=null,this.fullTemplate=null,this.parent=null,this.temporaryHighlightFeature=null,this.sketchOptions=null,this.snappingManager=null,this.templateExecutorInfo=null,this.viewModel=null,this.upload=null,this._pendingEdits=new s}get curveResizeDisabled(){return this.hasCurves&&a(this.selectedPendingFeature?.geometry)&&!this.editorItem?.supportedCurveTypes.includes("elliptic-arc")}get curveUpdatesDisabled(){return this.hasCurves&&!1===this.editorItem?.capabilities.supportsTrueCurveUpdate}get hasCurves(){const e=this.selectedPendingFeature;return!(!e?.geometry||!p(e.geometry))}get isSharedTemplateWorkflow(){return!!this.fullTemplate&&l(this.fullTemplate)}get pendingFeatures(){return new r([...this._pendingEdits.keys()])}set selectedPendingFeature(e){this._set("selectedPendingFeature",e),this.temporaryHighlightFeature=null}set timeZone(e){this._set("timeZone",e),this._pendingEdits.forEach(t=>{t.timeZone=e})}isSubmittable(e){const t=this._pendingEdits.get(e);return!!t?.submittable||!!t?.isAssociation}isDisplayable(e){return!this._pendingEdits.get(e)?.isAssociation}addPendingFeature(e,t=e,r={isAssociation:!1}){this.temporaryHighlightFeature=null;const{_pendingEdits:i}=this;if(i.has(e))return i.get(e);e.sourceLayer||d().warn("source-layer-not-set","A feature added to `pendingFeatures` did not have `sourceLayer` set. This may cause problems throughout `CreateFeaturesWorkflow`.");const s=new u({feature:e,isAssociation:r.isAssociation});return s.trackChanges(t),i.set(e,s),s}getEditsForPendingFeature(e){return this._pendingEdits.get(e)}removePendingFeature(e){this.temporaryHighlightFeature=null;const{_pendingEdits:t}=this,r=t.get(e);r&&(r.destroy(),t.delete(e)),this.selectedPendingFeature===e&&(this.selectedPendingFeature=null)}getFeatureTitle(e){return this._pendingEdits.get(e)?.displayTitle}};e([o()],g.prototype,"creationInfo",void 0),e([o()],g.prototype,"curveResizeDisabled",null),e([o()],g.prototype,"curveUpdatesDisabled",null),e([o()],g.prototype,"editorItem",void 0),e([o()],g.prototype,"fullTemplate",void 0),e([o()],g.prototype,"hasCurves",null),e([o()],g.prototype,"isSharedTemplateWorkflow",null),e([o()],g.prototype,"parent",void 0),e([o()],g.prototype,"pendingFeatures",null),e([o()],g.prototype,"selectedPendingFeature",null),e([o()],g.prototype,"temporaryHighlightFeature",void 0),e([o({constructOnly:!0})],g.prototype,"sketchOptions",void 0),e([o()],g.prototype,"snappingManager",void 0),e([o()],g.prototype,"templateExecutorInfo",void 0),e([o()],g.prototype,"viewModel",void 0),e([o()],g.prototype,"upload",void 0),e([o()],g.prototype,"timeZone",null),g=e([n("esri.widgets.Editor.CreateFeaturesWorkflowData")],g);const h=g;export{h as default};