@arcgis/core 5.1.0-next.23 → 5.1.0-next.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/359d3ba9d6e3b1de05d1.js +1 -0
- package/assets/esri/core/workers/chunks/53817ef8c00d8cce4b8e.js +1 -0
- package/assets/esri/core/workers/chunks/{73e02f6c7ccc2013c812.js → 5fa5a2fb69f84e9092ba.js} +1 -1
- package/assets/esri/libs/linkchartlayout/lclayout.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/HUDMaterial.glsl.js +50 -35
- package/chunks/lclayout.js +1 -1
- package/config.js +1 -1
- package/core/workers.d.ts +1 -1
- package/editing/sharedTemplates/SharedTemplate.d.ts +12 -3
- package/editing/sharedTemplates/SharedTemplateMetadata.d.ts +11 -2
- package/interfaces.d.ts +4 -12
- package/kernel.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/types.d.ts +7 -0
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
- package/views/2d/layers/GraphicsLayerView2D.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/types.d.ts +4 -3
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelParameters.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/types.d.ts +2 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
- package/views/layers/GeoRSSLayerView.d.ts +5 -4
- package/views/layers/GeoRSSLayerView.js +2 -0
- package/views/layers/GraphicsLayerView.d.ts +21 -21
- package/views/layers/GraphicsLayerView.js +2 -0
- package/views/layers/KMLLayerView.d.ts +10 -10
- package/views/layers/KMLLayerView.js +2 -0
- package/views/layers/VectorTileLayerView.d.ts +5 -5
- package/views/layers/VectorTileLayerView.js +2 -0
- package/widgets/Editor.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/responsiveToolbarUtils.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/7642905920e169a147f3.js +0 -1
- package/assets/esri/core/workers/chunks/8aabc71d7f15c4407d7d.js +0 -1
- package/views/3d/layers/graphics/focusAreaStyle.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{disposeMaybe as l,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import c from"../../../../core/Queue.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as d}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as m,LineCalloutSymbolLayerRenderingInfo as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as x}from"./graphicSymbolUtils.js";import{LabelInfo as _}from"./LabelInfo.js";import{LabelParameters as L}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as v,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{placePointOnGeometry as D}from"./pointUtils.js";import{TextRenderer as A}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as I}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as S}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as P,isInEffectiveScaleRange as R}from"../../../support/layerViewUtils.js";import{TaskPriority as V}from"../../../support/Scheduler.js";import{Yield as j}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class z{constructor(e,t,s,i,a){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=a,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class E{constructor(e,t,s,i,a,l,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=a,this.elevationInfoOverride=l,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this._labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new S(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let F=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new c,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h(()=>this.view.state?.camera,()=>this.setDirty()),h(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),h(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(V.LABELER,this)]),P()&&this.addHandles(h(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new I({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=l(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),B.graphic=null,B.renderingInfo=null,B.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>U(t.stageObject,e))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),j}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(Q(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();const{graphic3DGraphic:t,labelingContext:s}=this._focusAreasLabelsQueue.pop();if(0===t.labelLayers.length||!s.active)continue;const i=D(t.graphic.geometry);if(null==i)continue;const a=this.view.focusAreasView?.containsGeometry(i)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>e.material.parameters.isFocused!==a)&&(this._removeGraphic(s,t),this._addGraphic(s,t),this.setDirty())})}0===this._focusAreasLabelsQueue.length&&(this.notifyChange("readyToRun"),this.notifyChange("updating"))}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const l=e.graphics3DCore,r=l.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=x(l.getOrCreateGraphics3DSymbol(n));if(null==h)return void a.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;g(n)&&n.hasVisibleCallout()&&(b=f(n,l.symbolCreationContext),await b.load(),o(t));const u=await i(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===u.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const a=new z(s,h,b,i,u.value);this._updateLabelClassContextVisibility(a),e.setLabelClassContext(r,a)}else a.getLogger(this).error(`Label expression failed to evaluate: ${u.error}`),c=!0}),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(n(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)s&&--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,r(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,a,l){if(!this._textTextureAtlas)return null;const r=new L(s,v(s.anchor),G(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return B.graphic=t,B.layer=i,B.renderingInfo=null,a.createLabel(B,r,this._hudMaterials,this._textTextureAtlas,()=>l.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,a){B.graphic=e,B.layer=a;const l=i.screenOffset[0];return B.renderingInfo=new C(null,t,i.translation,i.centerOffset,i.groundDistance,l,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(B,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(Q(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let a=!1;const l=t.graphic,r=s.layer,o=W(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n],b=i[n];if(null==c||null==h||null==b)continue;const u=b.graphics3DSymbol,p=k(u),d=u.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new _(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,l,h,r,d,y);if(null==g)return!1;g.labelClass=b.labelClass,g.labelClassContextIndex=n,t.addLabelGraphic(g,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,o),t.setVisibilityFlag(16,2,b.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),P()&&b.graphics.set(l.uid,t),a=!0;const f=b.graphics3DCalloutSymbolLayer;if(f&&h.hasLabelVerticalOffset){f.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(l,p,f,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return a&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s.labelClass)continue;const e=t[s.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(Q(s))return;const i=e.graphics3DGraphic.graphic;for(let l=0;l<s.length;l++){const r=s[l];if(e.textRenderers[l]=null,e.textLabelPlacements[l]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?d(i,t.layer,null):i;n=o.evaluate(e)}catch(a){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,u=r.labelClass,p=t.disablePlacement,y=new _(h,b,u,p).placement;if(null==y)continue;const g=v(y.anchor),f=w(g);e.textRenderers[l]=new A(n,f,r.textRenderParameters,I.maxSize),e.textLabelPlacements[l]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const a of i.graphics3DGraphic.labelLayers){if(null==a.labelClass)continue;if(!e.labelClassContexts[a.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(t.graphic,a))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),e.labelClassContexts.forEach(e=>e?.graphics.delete(s)),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){if(!s)continue;const i=new Map;t.graphics.forEach(e=>i.set(e.graphic.uid,e));const a=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,a),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,a=s?.elevationInfoOverride||null,l=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new E(this.view.stage,r,e,t,i,a,l,W(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>W(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged("screenSizePerspectiveEnabled",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!H(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!P())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},a=R(i,this.view.scale),l=null==e.scaleVisibility||e.scaleVisibility!==a;e.scaleVisibility=a,l&&s.size&&(s.forEach(e=>e.setVisibilityFlag(16,2,a)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>H(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(H(t)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};function M(e,t){e.geometries[0].setAttributeData("size",[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],"size")}function U(e,t){e.geometries[0].setAttributeData("uvi",t),e.geometryVertexAttributeUpdated(e.geometries[0],"uvi",!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function Q(e){return 0===(e?.length??0)}function k(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([b({constructOnly:!0})],F.prototype,"view",void 0),e([b({constructOnly:!0})],F.prototype,"deconflictor",void 0),e([b()],F.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],F.prototype,"updating",null),F=e([u("esri.views.3d.layers.graphics.Labeler")],F);const B=new m(null,null,null);export{F as Labeler,W as areLabelsVisible};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import a from"../../../../core/Logger.js";import{disposeMaybe as l,abortMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import c from"../../../../core/Queue.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b,subclass as u}from"../../../../core/accessorSupport/decorators.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as d}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as m,LineCalloutSymbolLayerRenderingInfo as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as x}from"./graphicSymbolUtils.js";import{LabelInfo as _}from"./LabelInfo.js";import{LabelParameters as L}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as v,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{TextRenderer as D}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as I}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as S}from"../../webgl-engine/lib/WebGLLayer.js";import{hasLayerBasedScaleVisibility as P,isInEffectiveScaleRange as R}from"../../../support/layerViewUtils.js";import{TaskPriority as V}from"../../../support/Scheduler.js";import{Yield as j}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class z{constructor(e,t,s,i,a){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=a,this.calloutSymbolLayerIndex=0,this.graphics=new Map,this.scaleVisibility=null}}class E{constructor(e,t,s,i,a,l,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=a,this.elevationInfoOverride=l,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this._labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new S(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}get labelClassContexts(){return this._labelClassContexts}setLabelClassContext(e,t){this._labelClassContexts[e]=t}resetLabelClassContext(){this._labelClassContexts.length=0}}let F=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._focusAreasLabelsQueue=new c,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h(()=>this.view.state?.camera,()=>this.setDirty()),h(()=>this.view.state?.rasterPixelRatio,()=>this._resetAllLabels()),h(()=>this.view.focusAreasView?.polygons,()=>this._updateFocus()),this.view.resourceController.scheduler.registerTask(V.LABELER,this)]),P()&&this.addHandles(h(()=>this.view.scale,()=>this._updateScaleVisibility())),this._textTextureAtlas=new I({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=l(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),B.graphic=null,B.renderingInfo=null,B.layer=null}_updateFocus(){this._focusAreasLabelsQueue.clear(),this._labelingContexts.forEach(e=>{e.graphics.forEach(t=>{this._focusAreasLabelsQueue.push({graphic3DGraphic:t,labelingContext:e})})})}_activateLabelingContext(e){e.graphics.forEach((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(16,1,!0)}),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach((e,t)=>{e.setVisibilityFlag(16,1,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)}),e.active=!1}_addLabelTextureToAtlas(e){if(this._textTextureAtlas)for(const t of e.graphics3DGraphic.labelLayers){if(!t.labelClass)continue;const s=e.textRenderers[t.labelClassContextIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,e=>U(t.stageObject,e))),M(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach(e=>e.remove()),e.textureAtlasHandles.length=0}get readyToRun(){return this.view.ready&&(this._dirty||this.deconflictor.readyToRun||this._focusAreasLabelsQueue.length>0)}runTask(e){return this._updateLabels(e),this._applyFocusAreasUpdates(e),!this._dirty&&this.deconflictor.readyToRun&&this.deconflictor.runTask(e),j}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(H(t))this._dirty=!0;else if(Q(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}_applyFocusAreasUpdates(e){for(;this._focusAreasLabelsQueue.length>0&&!e.done;){e.madeProgress();const{graphic3DGraphic:t,labelingContext:s}=this._focusAreasLabelsQueue.pop();if(0===t.labelLayers.length||!s.active)continue;const i=A(t.graphic.geometry);if(null==i)continue;const a=this.view.focusAreasView?.containsGeometry(i)??!0;t.labelLayers.forEach(e=>{e.stageObject.geometries.some(e=>null==e.material.parameters.focusAreaStyle!==a)&&(this._removeGraphic(s,t),this._addGraphic(s,t),this.setDirty())})}0===this._focusAreasLabelsQueue.length&&(this.notifyChange("readyToRun"),this.notifyChange("updating"))}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const l=e.graphics3DCore,r=l.layer,n=r.labelingInfo?.filter(e=>!!e.symbol);if(!n||0===n.length)return;let c=!1;await s(n,async(s,r)=>{const n=s.symbol,h=x(l.getOrCreateGraphics3DSymbol(n));if(null==h)return void a.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;g(n)&&n.hasVisibleCallout()&&(b=f(n,l.symbolCreationContext),await b.load(),o(t));const u=await i(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===u.ok){const i=await this._createTextRenderParameters(h.symbol);o(t);const a=new z(s,h,b,i,u.value);this._updateLabelClassContextVisibility(a),e.setLabelClassContext(r,a)}else a.getLogger(this).error(`Label expression failed to evaluate: ${u.error}`),c=!0}),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch(t=>{if(n(t))throw t;e.resetLabelClassContext()}).then(()=>{e.labelClassAbortController=null,this.notifyChange("updating")}).catch(()=>{}),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)s&&--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,r(t),e.resetLabelClassContext(),e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,a,l){if(!this._textTextureAtlas)return null;const r=new L(s,v(s.anchor),G(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return B.graphic=t,B.layer=i,B.renderingInfo=null,a.createLabel(B,r,this._hudMaterials,this._textTextureAtlas,()=>l.placement?.elevationOffset??null)}_createLineCalloutGraphic(e,t,s,i,a){B.graphic=e,B.layer=a;const l=i.screenOffset[0];return B.renderingInfo=new C(null,t,i.translation,i.centerOffset,i.groundDistance,l,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(B,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(Q(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let a=!1;const l=t.graphic,r=s.layer,o=W(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n],b=i[n];if(null==c||null==h||null==b)continue;const u=b.graphics3DSymbol,p=k(u),d=u.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new _(t,p,b.labelClass),g=this._createTextSymbolGraphic(c,l,h,r,d,y);if(null==g)return!1;g.labelClass=b.labelClass,g.labelClassContextIndex=n,t.addLabelGraphic(g,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(16,1,o),t.setVisibilityFlag(16,2,b.scaleVisibility??!0),t.setVisibilityFlag(16,8,!1),P()&&b.graphics.set(l.uid,t),a=!0;const f=b.graphics3DCalloutSymbolLayer;if(f&&h.hasLabelVerticalOffset){f.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(l,p,f,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return a&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s.labelClass)continue;const e=t[s.labelClassContextIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(Q(s))return;const i=e.graphics3DGraphic.graphic;for(let l=0;l<s.length;l++){const r=s[l];if(e.textRenderers[l]=null,e.textLabelPlacements[l]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?d(i,t.layer,null):i;n=o.evaluate(e)}catch(a){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,u=r.labelClass,p=t.disablePlacement,y=new _(h,b,u,p).placement;if(null==y)continue;const g=v(y.anchor),f=w(g);e.textRenderers[l]=new D(n,f,r.textRenderParameters,I.maxSize),e.textLabelPlacements[l]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const a of i.graphics3DGraphic.labelLayers){if(null==a.labelClass)continue;if(!e.labelClassContexts[a.labelClassContextIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(t.graphic,a))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),e.labelClassContexts.forEach(e=>e?.graphics.delete(s)),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){if(!s)continue;const i=new Map;t.graphics.forEach(e=>i.set(e.graphic.uid,e));const a=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,a),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))}),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,a=s?.elevationInfoOverride||null,l=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new E(this.view.stage,r,e,t,i,a,l,W(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>W(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),screenSizePerspectiveEnabledChanged:()=>this._globalPropertyChanged("screenSizePerspectiveEnabled",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach(e=>this._removeGraphic(t,e)),t.destroy(),this.setDirty()}_updateScaleVisibility(){for(const e of this._labelingContexts)if(e.active&&!H(e))for(const t of e.labelClassContexts)this._updateLabelClassContextVisibility(t)}_updateLabelClassContextVisibility(e){if(!e||!P())return;const{labelClass:t,graphics:s}=e,i={minScale:t.minScale,maxScale:t.maxScale},a=R(i,this.view.scale),l=null==e.scaleVisibility||e.scaleVisibility!==a;e.scaleVisibility=a,l&&s.size&&(s.forEach(e=>e.setVisibilityFlag(16,2,a)),this.deconflictor.setDirty(),this.setDirty())}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some(e=>H(e))||this._focusAreasLabelsQueue.length>0}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce((e,t)=>e+(H(t)?0:1),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get usedMemory(){return this._textTextureAtlas?.usedMemory??0}get test(){}};function M(e,t){e.geometries[0].setAttributeData("size",[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],"size")}function U(e,t){e.geometries[0].setAttributeData("uvi",t),e.geometryVertexAttributeUpdated(e.geometries[0],"uvi",!0)}function H(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function Q(e){return 0===(e?.length??0)}function k(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!!e.labelsVisible&&!!e.labelingInfo?.some(e=>!!e.symbol)}e([b({constructOnly:!0})],F.prototype,"view",void 0),e([b({constructOnly:!0})],F.prototype,"deconflictor",void 0),e([b()],F.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],F.prototype,"updating",null),F=e([u("esri.views.3d.layers.graphics.Labeler")],F);const B=new m(null,null,null);export{F as Labeler,W as areLabelsVisible};
|
package/views/3d/types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type OGCFeatureLayerView from "../layers/OGCFeatureLayerView.js";
|
|
|
12
12
|
import type OrientedImageryLayerView from "../layers/OrientedImageryLayerView.js";
|
|
13
13
|
import type SceneLayerView from "../layers/SceneLayerView.js";
|
|
14
14
|
import type StreamLayerView from "../layers/StreamLayerView.js";
|
|
15
|
+
import type VectorTileLayerView from "../layers/VectorTileLayerView.js";
|
|
15
16
|
import type ViewshedLayerView from "../layers/ViewshedLayerView.js";
|
|
16
17
|
import type WFSLayerView from "../layers/WFSLayerView.js";
|
|
17
18
|
import type { PointCloudLayerView } from "../layers/PointCloudLayerView.js";
|
|
@@ -81,7 +82,7 @@ export interface LayerView3DMap {
|
|
|
81
82
|
/** @since 5.0 */
|
|
82
83
|
tile: never;
|
|
83
84
|
/** @since 5.0 */
|
|
84
|
-
"vector-tile":
|
|
85
|
+
"vector-tile": VectorTileLayerView;
|
|
85
86
|
/** @since 5.0 */
|
|
86
87
|
viewshed: ViewshedLayerView;
|
|
87
88
|
/** @since 5.0 */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as n}from"./FocusAreaColorTechnique.js";import{DepthStencilAttachment as c}from"../../../../webgl/enums.js";let d=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[i.FOCUSAREA_COLOR,i.FOCUSAREA]},this.produces=i.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new a}precompile(){this.techniques.precompile(n)}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=this.techniques.get(n),s=e.find(({name:e})=>e===this.produces);if(!t.compiled)return this.requestRender(1),s;const r=this.focusAreasView.style,o=this.bindParameters,a=o.camera,d=a.fullViewport[2],m=a.fullViewport[3];this._startTime??=this.view.stage?.renderer.renderContext.time;const u=this.view.qualitySettings.fadeDuration,p=u>0?Math.min(u,this.view.stage?.renderer.renderContext.time-this._startTime)/u:1,l=e.find(({name:e})=>e===i.FOCUSAREA),f=this.fboCache.acquire(d,m,this.produces),A=this.renderingContext;return A.bindFramebuffer(f.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=l.getTexture(),this._passParameters.effect=h[r],this._passParameters.fadeFactor.value=0===this._fadeDirection?p:1-p,A.bindTechnique(t,o,this._passParameters),A.screen.draw(),f.attachDepth(s.getAttachment(c)),p<1&&this.requestRender(2),f}};e([s()],d.prototype,"consumes",void 0),e([s()],d.prototype,"produces",void 0),e([s({constructOnly:!0})],d.prototype,"focusAreasView",void 0),d=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],d);const h={bright:0,dark:1};export{d as FocusAreaColorNode};
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t}from"../../../../../core/reactiveUtils.js";import{property as s,subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{InternalRenderCategory as i}from"../../../webgl.js";import o from"../../../webgl/RenderNode.js";import{F as a}from"../../../../../chunks/FocusAreaColor.glsl.js";import{FocusAreaColorTechnique as n}from"./FocusAreaColorTechnique.js";import{DepthStencilAttachment as c}from"../../../../webgl/enums.js";let d=class extends o{constructor(e){super({...e,view:e.focusAreasView.view}),this.consumes={required:[i.FOCUSAREA_COLOR,i.FOCUSAREA]},this.produces=i.FOCUSAREA_COLOR,this._fadeDirection=0,this._passParameters=new a}precompile(){this.techniques.precompile(n)}fadeOut(e){this.removeAllHandles(),this._startTime=null,this._fadeDirection=1,this.addHandles(t(()=>this._passParameters.fadeFactor.value,t=>{0===t&&(this.removeAllHandles(),e())})),this.requestRender(2)}render(e){const t=this.techniques.get(n),s=e.find(({name:e})=>e===this.produces);if(!t.compiled)return this.requestRender(1),s;const r=this.focusAreasView.style,o=this.bindParameters,a=o.camera,d=a.fullViewport[2],m=a.fullViewport[3];this._startTime??=this.view.stage?.renderer.renderContext.time;const u=this.view.qualitySettings.fadeDuration,p=u>0?Math.min(u,this.view.stage?.renderer.renderContext.time-this._startTime)/u:1,l=e.find(({name:e})=>e===i.FOCUSAREA),f=this.fboCache.acquire(d,m,this.produces),A=this.renderingContext;return A.bindFramebuffer(f.fbo),this._passParameters.color=s.getTexture(),this._passParameters.focusArea=l.getTexture(),this._passParameters.effect=h[r],this._passParameters.fadeFactor.value=0===this._fadeDirection?p:1-p,A.bindTechnique(t,o,this._passParameters),A.screen.draw(),f.attachDepth(s.getAttachment(c)),p<1&&this.requestRender(2),f}};e([s()],d.prototype,"consumes",void 0),e([s()],d.prototype,"produces",void 0),e([s({constructOnly:!0})],d.prototype,"focusAreasView",void 0),d=e([r("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaColorNode")],d);const h={bright:0,dark:1};export{d as FocusAreaColorNode,h as styleToEffect};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as u,transformMat4 as f,normalize as p,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as P,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as j}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as M}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as w,isColor as A}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as U}from"../lib/GLTextureMaterial.js";import{Material as L}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as B}from"../lib/screenSizePerspectiveUtils.js";import{assert as E}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as N,writeBufferFloat as G,writeBufferVec3 as q,writeBufferZeros as X,writeBufferVec4 as Y,writeOlidColor as k}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as J}from"./internal/MaterialUtil.js";import{c as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends L{constructor(e,t,i=!1){super(e,Ve),this.produces=new Map([[14,e=>w(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[15,e=>w(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[16,e=>w(e)&&this.parameters.drawAsLabel],[13,()=>this.parameters.useVisibilityPixel],[20,e=>this.parameters.draped&&w(e)]]),this._visible=!0,this._configuration=new ee(t,i)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.useVisibilityPixel=this.parameters.useVisibilityPixel,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=13===t.slot,this._configuration.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||13===t.slot,this._configuration.hasVertexColor=this.parameters.hasVertexColor,this._configuration.hasVertexSize=this.parameters.hasVertexSize,this._configuration.hasVertexRotation=this.parameters.hasVertexRotation,this._configuration.hasVertexUVi=this.parameters.hasVertexUVi,this._configuration.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,A(e)&&(this._configuration.debugDrawLabelBorder=!!M.LABELS_SHOW_BORDER),this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasOcclusionTexture=this._configuration.transparentOccluded&&0!==t.oitPass,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:h},point:O,camera:z}=s,{parameters:y}=this;if(!l||!c||h&&y.isLabel||!e.visible||!O||!z)return;const P=e.attributes.get("featureAttribute"),C=null==P?null:V(P.data,xe),{scaleX:j,scaleY:D}=Ce(C,y,z.pixelRatio),R=e.attributes.get("position"),M=e.attributes.get("size"),w=e.attributes.get("normal"),A=e.attributes.get("rotation"),F=e.attributes.get("centerOffset"),T=this.parameters.size;E(R.size>=3);const U=K(y),L="screen"===this.parameters.centerOffsetUnits;for(let V=0;V<R.data.length/R.size;V++){const e=V*R.size;if(u(le,R.data[e],R.data[e+1],R.data[e+2]),f(le,le,t),f(le,le,z.viewMatrix),F){const e=V*F.size;u(be,F.data[e],F.data[e+1],F.data[e+2])}else u(be,0,0,0);if(!L&&(le[0]+=be[0],le[1]+=be[1],0!==be[2])){const e=be[2];p(be,le),m(le,le,d(be,be,e))}const a=V*w.size;u(ce,w.data[a],w.data[a+1],w.data[a+2]),g(ce,ce,i(de,t));const{normal:n,cosAngle:l}=ae(ce,z,Se),c=De(this.parameters,le,l,z,oe);if(b(le,le,n,c),z.applyProjection(le,he),he[0]>-1){if(L&&(be[0]||be[1])&&(he[0]+=be[0]*z.pixelRatio,0!==be[1]&&(he[1]+=oe.alignmentEvaluator.apply(be[1])*z.pixelRatio),z.unapplyProjection(he,le)),he[0]+=this.parameters.screenOffset[0]*z.pixelRatio,he[1]+=this.parameters.screenOffset[1]*z.pixelRatio,he[0]=Math.floor(he[0]),he[1]=Math.floor(he[1]),_e[0]=T[0],_e[1]=T[1],null!=M){const e=V*M.size;_e[0]*=M.data[e],_e[1]*=M.data[e+1]}oe.evaluator.applyVec2(_e,_e);const e=Oe*z.pixelRatio;let t=0;if(y.textureIsSignedDistanceField){t=Math.min(y.outlineSize,.5*_e[0])*z.pixelRatio/2}_e[0]*=j,_e[1]*=D;const i=y.rotation+(null!=A?A.data[V*A.size]:0);if(ne(O,he[0],he[1],_e,e,t,i,y,U)){const e=s.ray;if(f(fe,le,r(ge,z.viewMatrix)),he[0]=O[0],he[1]=O[1],z.unprojectFromRenderScreen(he,le)){const t=_();v(t,e.direction);const i=1/x(t);d(t,t,i);o(S(e.origin,le)*i,t,-1,fe)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=K(l),h=l.size,u=e.attributes.get("featureAttribute"),f=null==u?null:V(u.data,xe),{scaleX:p,scaleY:m}=Ce(f,l,e.screenToWorldRatio),d=ze*e.screenToWorldRatio;for(let g=0;g<a.data.length/a.size;g++){const t=g*a.size,u=a.data[t],f=a.data[t+1];if(_e[0]=h[0],_e[1]=h[1],null!=n){const e=g*n.size;_e[0]*=n.data[e],_e[1]*=n.data[e+1]}let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*_e[0])*e.screenToWorldRatio/2}_e[0]*=p,_e[1]*=m;const v=l.rotation+(null!=o?o.data[g*o.size]:0);ne(i,u,f,_e,d,b,v,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Pe(this.parameters)}applyShaderOffsets(e,t,s,r,a,n,o,l){g(ue,s,i(de,r));const c=ae(ue,o,Se),h=je(x(t),o),u=De(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,u+h),b(e,e,ue,u+h);const f=n+u;this._applyPolygonOffsetView(t,c,f,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,i,s,r,a){return this._applyCenterOffsetNDC(e,t,s,r),null!=a&&v(a,r),this._applyPolygonOffsetNDC(r,i,s,r),r}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(i.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&v(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ce,i),O(i,i,d(ce,ce,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&v(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=j()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends U{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,i){return f(i.normal,e,t.viewInverseTransposeMatrix),i.cosAngle=z(i.normal,ye),i}function ne(e,i,s,r,a,l,c,h,u){let f=i-a-r[0]*u[0],p=f+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=h.distanceFieldBoundingBox;return h.textureIsSignedDistanceField&&null!=g&&(f+=r[0]*g[0],m+=r[1]*g[1],p-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),f-=l,p+=l,m-=l,d+=l),n(me,i,s),o(pe,e,me,t(c)),pe[0]>f&&pe[0]<p&&pe[1]>m&&pe[1]<d}const oe=new B,le=_(),ce=_(),he=C(),ue=_(),fe=_(),pe=h(),me=h(),de=s(),ge=a(),be=_(),ve=_(),xe=C(),Se={normal:_(),cosAngle:0},Oe=1,ze=2,_e=c(0,0),ye=y(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=P,this.size=l,this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=P,this.outlineSize=0,this.distanceFieldBoundingBox=C(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.useVisibilityPixel=!0,this.occludedVisibilityMode="hidden",this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Pe{constructor(e){this.baseInstanceLayout=Q,this.layout=Z(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:u,groundDistance:f,featureAttribute:p,uvi:m}=r;I(i.get("position"),e,n,a),W(i.get("normal"),t,o,a);const d=i.get("position").indices.length;if(m){const e=i.get("uvi")?.data;if(e&&e.length>=4){const[t,i,s,r]=e;for(let e=0;e<d;++e){const n=a+e;m.setValues(n,t,i,s,r)}}}if(l&&H(i.get("color"),4,l,a),c&&N(i.get("size"),c,a),h&&G(i.get("rotation"),h,a),u&&(i.get("centerOffset")?q(i.get("centerOffset"),u,a):X(u,a,d)),i.get("groundDistance")?G(i.get("groundDistance"),f,a):X(f,a,d),p&&(i.get("featureAttribute")?Y(i.get("featureAttribute"),p,a):X(p,a,d)),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);k(s,i,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:i}=t;N(e.get("uv0"),i,0)}}function Ce(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(R(ve,t,e),{scaleX:ve[0]*i,scaleY:ve[1]*i})}function je(e,t){const i=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*i}function De(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=x(t);return r.update(i,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=J(s,a,e.verticalOffset,i,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ie as HUDMaterial,Ve as Parameters};
|
|
2
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as u,transformMat4 as f,normalize as p,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as P,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as j}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as U}from"../lib/GLTextureMaterial.js";import{Material as L}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as B}from"../lib/screenSizePerspectiveUtils.js";import{assert as E}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as N,writeBufferFloat as G,writeBufferVec3 as q,writeBufferZeros as X,writeBufferVec4 as Y,writeOlidColor as k}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as J}from"./internal/MaterialUtil.js";import{c as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends L{constructor(e,t,i=!1){super(e,Ve),this.produces=new Map([[14,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[15,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[16,e=>M(e)&&this.parameters.drawAsLabel],[13,()=>this.parameters.useVisibilityPixel],[20,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ee(t,i)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.useVisibilityPixel=this.parameters.useVisibilityPixel,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=13===t.slot,this._configuration.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,this._configuration.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,this._configuration.depthTestEnabled=this.parameters.depthEnabled||13===t.slot,this._configuration.hasVertexColor=this.parameters.hasVertexColor,this._configuration.hasVertexSize=this.parameters.hasVertexSize,this._configuration.hasVertexRotation=this.parameters.hasVertexRotation,this._configuration.hasVertexUVi=this.parameters.hasVertexUVi,this._configuration.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,w(e)&&(this._configuration.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasOcclusionTexture=this._configuration.transparentOccluded&&0!==t.oitPass,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:h},point:O,camera:z}=s,{parameters:_}=this;if(!l||!c||h&&_.isLabel||!e.visible||!O||!z)return;const P=e.attributes.get("featureAttribute"),C=null==P?null:V(P.data,xe),{scaleX:j,scaleY:D}=Ce(C,_,z.pixelRatio),R=e.attributes.get("position"),A=e.attributes.get("size"),M=e.attributes.get("normal"),w=e.attributes.get("rotation"),F=e.attributes.get("centerOffset"),T=this.parameters.size;E(R.size>=3);const U=K(_),L="screen"===this.parameters.centerOffsetUnits;for(let V=0;V<R.data.length/R.size;V++){const e=V*R.size;if(u(le,R.data[e],R.data[e+1],R.data[e+2]),f(le,le,t),f(le,le,z.viewMatrix),F){const e=V*F.size;u(be,F.data[e],F.data[e+1],F.data[e+2])}else u(be,0,0,0);if(!L&&(le[0]+=be[0],le[1]+=be[1],0!==be[2])){const e=be[2];p(be,le),m(le,le,d(be,be,e))}const a=V*M.size;u(ce,M.data[a],M.data[a+1],M.data[a+2]),g(ce,ce,i(de,t));const{normal:n,cosAngle:l}=ae(ce,z,Se),c=De(this.parameters,le,l,z,oe);if(b(le,le,n,c),z.applyProjection(le,he),he[0]>-1){if(L&&(be[0]||be[1])&&(he[0]+=be[0]*z.pixelRatio,0!==be[1]&&(he[1]+=oe.alignmentEvaluator.apply(be[1])*z.pixelRatio),z.unapplyProjection(he,le)),he[0]+=this.parameters.screenOffset[0]*z.pixelRatio,he[1]+=this.parameters.screenOffset[1]*z.pixelRatio,he[0]=Math.floor(he[0]),he[1]=Math.floor(he[1]),ye[0]=T[0],ye[1]=T[1],null!=A){const e=V*A.size;ye[0]*=A.data[e],ye[1]*=A.data[e+1]}oe.evaluator.applyVec2(ye,ye);const e=Oe*z.pixelRatio;let t=0;if(_.textureIsSignedDistanceField){t=Math.min(_.outlineSize,.5*ye[0])*z.pixelRatio/2}ye[0]*=j,ye[1]*=D;const i=_.rotation+(null!=w?w.data[V*w.size]:0);if(ne(O,he[0],he[1],ye,e,t,i,_,U)){const e=s.ray;if(f(fe,le,r(ge,z.viewMatrix)),he[0]=O[0],he[1]=O[1],z.unprojectFromRenderScreen(he,le)){const t=y();v(t,e.direction);const i=1/x(t);d(t,t,i);o(S(e.origin,le)*i,t,-1,fe)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=K(l),h=l.size,u=e.attributes.get("featureAttribute"),f=null==u?null:V(u.data,xe),{scaleX:p,scaleY:m}=Ce(f,l,e.screenToWorldRatio),d=ze*e.screenToWorldRatio;for(let g=0;g<a.data.length/a.size;g++){const t=g*a.size,u=a.data[t],f=a.data[t+1];if(ye[0]=h[0],ye[1]=h[1],null!=n){const e=g*n.size;ye[0]*=n.data[e],ye[1]*=n.data[e+1]}let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*ye[0])*e.screenToWorldRatio/2}ye[0]*=p,ye[1]*=m;const v=l.rotation+(null!=o?o.data[g*o.size]:0);ne(i,u,f,ye,d,b,v,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Pe(this.parameters)}applyShaderOffsets(e,t,s,r,a,n,o,l){g(ue,s,i(de,r));const c=ae(ue,o,Se),h=je(x(t),o),u=De(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,u+h),b(e,e,ue,u+h);const f=n+u;this._applyPolygonOffsetView(t,c,f,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,i,s,r,a){return this._applyCenterOffsetNDC(e,t,s,r),null!=a&&v(a,r),this._applyPolygonOffsetNDC(r,i,s,r),r}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(i.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&v(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ce,i),O(i,i,d(ce,ce,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&v(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=j()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends U{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,i){return f(i.normal,e,t.viewInverseTransposeMatrix),i.cosAngle=z(i.normal,_e),i}function ne(e,i,s,r,a,l,c,h,u){let f=i-a-r[0]*u[0],p=f+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=h.distanceFieldBoundingBox;return h.textureIsSignedDistanceField&&null!=g&&(f+=r[0]*g[0],m+=r[1]*g[1],p-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),f-=l,p+=l,m-=l,d+=l),n(me,i,s),o(pe,e,me,t(c)),pe[0]>f&&pe[0]<p&&pe[1]>m&&pe[1]<d}const oe=new B,le=y(),ce=y(),he=C(),ue=y(),fe=y(),pe=h(),me=h(),de=s(),ge=a(),be=y(),ve=y(),xe=C(),Se={normal:y(),cosAngle:0},Oe=1,ze=2,ye=c(0,0),_e=_(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=P,this.size=l,this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=P,this.outlineSize=0,this.distanceFieldBoundingBox=C(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.useVisibilityPixel=!0,this.occludedVisibilityMode="hidden",this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Pe{constructor(e){this.baseInstanceLayout=Q,this.layout=Z(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:u,groundDistance:f,featureAttribute:p,uvi:m}=r;I(i.get("position"),e,n,a),W(i.get("normal"),t,o,a);const d=i.get("position").indices.length;if(m){const e=i.get("uvi")?.data;if(e&&e.length>=4){const[t,i,s,r]=e;for(let e=0;e<d;++e){const n=a+e;m.setValues(n,t,i,s,r)}}}if(l&&H(i.get("color"),4,l,a),c&&N(i.get("size"),c,a),h&&G(i.get("rotation"),h,a),u&&(i.get("centerOffset")?q(i.get("centerOffset"),u,a):X(u,a,d)),i.get("groundDistance")?G(i.get("groundDistance"),f,a):X(f,a,d),p&&(i.get("featureAttribute")?Y(i.get("featureAttribute"),p,a):X(p,a,d)),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);k(s,i,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:i}=t;N(e.get("uv0"),i,0)}}function Ce(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(R(ve,t,e),{scaleX:ve[0]*i,scaleY:ve[1]*i})}function je(e,t){const i=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*i}function De(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=x(t);return r.update(i,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=J(s,a,e.verticalOffset,i,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{ie as HUDMaterial,Ve as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import"../core/shaderLibrary/hud/HUDVisibility.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/output/ReadDepth.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"./alphaCutoff.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,c as calculateAnchorPosition}from"../../../../chunks/HUDMaterial.glsl.js";
|
|
2
|
+
import"../../../../core/libs/gl-matrix-2/math/vec2.js";import"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../core/shaderLibrary/Slice.glsl.js";import"../core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js";import"../core/shaderLibrary/hud/AlignPixel.glsl.js";import"../core/shaderLibrary/hud/HUD.glsl.js";import"../core/shaderLibrary/hud/HUDOcclusionPass.glsl.js";import"../core/shaderLibrary/hud/HUDVisibility.glsl.js";import"../core/shaderLibrary/output/OutputHighlight.glsl.js";import"../core/shaderLibrary/output/ReadDepth.glsl.js";import"../core/shaderLibrary/shading/PositionOutsideClipSpace.js";import"../core/shaderLibrary/shading/VisualVariables.glsl.js";import"../core/shaderLibrary/util/ColorConversion.glsl.js";import"../core/shaderLibrary/util/ScreenSizePerspective.glsl.js";import"../core/shaderLibrary/util/View.glsl.js";import"../core/shaderModules/Float2PassUniform.js";import"../core/shaderModules/Float4BindUniform.js";import"../core/shaderModules/Float4PassUniform.js";import"../core/shaderModules/FloatPassUniform.js";import"../core/shaderModules/glsl.js";import"../core/shaderModules/IntegerPassUniform.js";import"../core/shaderModules/Texture2DBindUniform.js";import"../core/shaderModules/Texture2DPassUniform.js";import"../effects/focusArea/FocusAreaColorNode.js";import"./alphaCutoff.glsl.js";import"./OutputColorHighlightOLID.glsl.js";import"../../../webgl/ShaderBuilder.js";export{b as build,c as calculateAnchorPosition}from"../../../../chunks/HUDMaterial.glsl.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../materials/DefaultTechniqueConfiguration.js";class i extends o{constructor(e,t){super(),this.spherical=e,this.screenCenterOffsetUnitsEnabled=!1,this.useVisibilityPixel=!0,this.signedDistanceFieldEnabled=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.hasRotation=!1,this.debugDrawLabelBorder=!1,this.hasPolygonOffset=!1,this.depthTestEnabled=!0,this.pixelSnappingEnabled=!0,this.draped=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.occludedFragmentFade=!1,this.hasOcclusionTexture=!1,this.
|
|
2
|
+
import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{DefaultTechniqueConfiguration as o}from"../materials/DefaultTechniqueConfiguration.js";class i extends o{constructor(e,t){super(),this.spherical=e,this.screenCenterOffsetUnitsEnabled=!1,this.useVisibilityPixel=!0,this.signedDistanceFieldEnabled=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.hasVVSize=!1,this.hasVVColor=!1,this.hasVerticalOffset=!1,this.hasScreenSizePerspective=!1,this.hasRotation=!1,this.debugDrawLabelBorder=!1,this.hasPolygonOffset=!1,this.depthTestEnabled=!0,this.pixelSnappingEnabled=!0,this.draped=!1,this.terrainDepthTest=!1,this.cullAboveTerrain=!1,this.occlusionPass=!1,this.occludedFragmentFade=!1,this.hasOcclusionTexture=!1,this.hasFocusAreaStyle=!1,this.hasVertexColor=!0,this.hasVertexSize=!0,this.hasVertexRotation=!0,this.hasVertexUVi=!0,this.hasVertexCenterOffset=!0,this.olidColorInstanced=!1,this.textureCoordinateType=0,this.emissionSource=0,this.discardInvisibleFragments=!0,this.hasVVInstancing=!1,this.snowCover=!1,this.transparentOccluded=t}}e([t()],i.prototype,"transparentOccluded",void 0),e([t()],i.prototype,"screenCenterOffsetUnitsEnabled",void 0),e([t()],i.prototype,"useVisibilityPixel",void 0),e([t()],i.prototype,"signedDistanceFieldEnabled",void 0),e([t()],i.prototype,"sampleSignedDistanceFieldTexelCenter",void 0),e([t()],i.prototype,"hasVVSize",void 0),e([t()],i.prototype,"hasVVColor",void 0),e([t()],i.prototype,"hasVerticalOffset",void 0),e([t()],i.prototype,"hasScreenSizePerspective",void 0),e([t()],i.prototype,"hasRotation",void 0),e([t()],i.prototype,"debugDrawLabelBorder",void 0),e([t()],i.prototype,"hasPolygonOffset",void 0),e([t()],i.prototype,"depthTestEnabled",void 0),e([t()],i.prototype,"pixelSnappingEnabled",void 0),e([t()],i.prototype,"draped",void 0),e([t()],i.prototype,"terrainDepthTest",void 0),e([t()],i.prototype,"cullAboveTerrain",void 0),e([t()],i.prototype,"occlusionPass",void 0),e([t()],i.prototype,"occludedFragmentFade",void 0),e([t()],i.prototype,"hasOcclusionTexture",void 0),e([t()],i.prototype,"hasFocusAreaStyle",void 0),e([t()],i.prototype,"hasVertexColor",void 0),e([t()],i.prototype,"hasVertexSize",void 0),e([t()],i.prototype,"hasVertexRotation",void 0),e([t()],i.prototype,"hasVertexUVi",void 0),e([t()],i.prototype,"hasVertexCenterOffset",void 0);export{i as HUDMaterialTechniqueConfiguration};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import type GeoRSSLayer from "../../layers/GeoRSSLayer.js";
|
|
1
2
|
import type LayerView from "./LayerView.js";
|
|
2
|
-
import type { LayerViewProperties } from "./LayerView.js";
|
|
3
|
-
|
|
4
|
-
export interface GeoRSSLayerViewProperties extends LayerViewProperties {}
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Represents the [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) of a [GeoRSSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoRSSLayer/)
|
|
@@ -12,4 +10,7 @@ export interface GeoRSSLayerViewProperties extends LayerViewProperties {}
|
|
|
12
10
|
* @since 4.0
|
|
13
11
|
* @see [GeoRSSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoRSSLayer/)
|
|
14
12
|
*/
|
|
15
|
-
export default
|
|
13
|
+
export default abstract class GeoRSSLayerView extends LayerView {
|
|
14
|
+
/** The layer being viewed. */
|
|
15
|
+
get layer(): GeoRSSLayer;
|
|
16
|
+
}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type Graphic from "../../Graphic.js";
|
|
2
2
|
import type Collection from "../../core/Collection.js";
|
|
3
|
+
import type GraphicsLayer from "../../layers/GraphicsLayer.js";
|
|
3
4
|
import type LayerView from "./LayerView.js";
|
|
4
5
|
import type HighlightOptions from "../support/HighlightOptions.js";
|
|
5
6
|
import type { ResourceHandle } from "../../core/Handles.js";
|
|
6
7
|
import type { ObjectId } from "../types.js";
|
|
7
|
-
import type { LayerViewProperties } from "./LayerView.js";
|
|
8
8
|
import type { LayerViewHighlightOptions } from "./types.js";
|
|
9
9
|
import type { HighlightOptionsProperties } from "../support/HighlightOptions.js";
|
|
10
10
|
|
|
11
|
-
export interface GraphicsLayerViewProperties extends LayerViewProperties {}
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Represents the [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) of a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/)
|
|
15
13
|
* after it has been added to a [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) in either a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) or
|
|
@@ -23,23 +21,7 @@ export interface GraphicsLayerViewProperties extends LayerViewProperties {}
|
|
|
23
21
|
* @since 4.4
|
|
24
22
|
* @see [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/)
|
|
25
23
|
*/
|
|
26
|
-
export default
|
|
27
|
-
/**
|
|
28
|
-
* Returns all graphics available for drawing in the layer view
|
|
29
|
-
* as a [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/).
|
|
30
|
-
*
|
|
31
|
-
* @returns When resolved, a [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of all [graphics](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) is returned.
|
|
32
|
-
* @since 4.8
|
|
33
|
-
* @example
|
|
34
|
-
* let layer = new GraphicsLayer();
|
|
35
|
-
*
|
|
36
|
-
* // returns all the graphics from the layer view
|
|
37
|
-
* const layerView = await view.whenLayerView(layer);
|
|
38
|
-
* await reactiveUtils.whenOnce(() => !layerView.updating);
|
|
39
|
-
* const results = await layerView.queryGraphics();
|
|
40
|
-
* console.log(results); // prints the array of client-side graphics to the console
|
|
41
|
-
*/
|
|
42
|
-
queryGraphics(): Promise<Collection<Graphic>>;
|
|
24
|
+
export default abstract class GraphicsLayerView extends LayerView {
|
|
43
25
|
/**
|
|
44
26
|
* Options for configuring the highlight. Use the [FeatureLikeLayerView.highlight()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#highlight) method on the layer view to highlight a feature
|
|
45
27
|
*
|
|
@@ -67,6 +49,8 @@ export default interface GraphicsLayerView extends LayerView {
|
|
|
67
49
|
*/
|
|
68
50
|
get highlightOptions(): HighlightOptions | null | undefined;
|
|
69
51
|
set highlightOptions(value: HighlightOptionsProperties | null | undefined);
|
|
52
|
+
/** The layer being viewed. */
|
|
53
|
+
get layer(): GraphicsLayer;
|
|
70
54
|
/**
|
|
71
55
|
* Highlights the given feature(s) in a layer view using the named [HighlightOptions](https://developers.arcgis.com/javascript/latest/references/core/views/support/HighlightOptions/)
|
|
72
56
|
* from the view's [View.highlights](https://developers.arcgis.com/javascript/latest/references/core/views/View/#highlights) collection. If no `name` is provided, the
|
|
@@ -136,5 +120,21 @@ export default interface GraphicsLayerView extends LayerView {
|
|
|
136
120
|
* });
|
|
137
121
|
* });
|
|
138
122
|
*/
|
|
139
|
-
highlight(target: Graphic | Graphic[] | ObjectId | ObjectId[], options?: LayerViewHighlightOptions): ResourceHandle;
|
|
123
|
+
abstract highlight(target: Graphic | Graphic[] | ObjectId | ObjectId[], options?: LayerViewHighlightOptions): ResourceHandle;
|
|
124
|
+
/**
|
|
125
|
+
* Returns all graphics available for drawing in the layer view
|
|
126
|
+
* as a [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/).
|
|
127
|
+
*
|
|
128
|
+
* @returns When resolved, a [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) of all [graphics](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) is returned.
|
|
129
|
+
* @since 4.8
|
|
130
|
+
* @example
|
|
131
|
+
* let layer = new GraphicsLayer();
|
|
132
|
+
*
|
|
133
|
+
* // returns all the graphics from the layer view
|
|
134
|
+
* const layerView = await view.whenLayerView(layer);
|
|
135
|
+
* await reactiveUtils.whenOnce(() => !layerView.updating);
|
|
136
|
+
* const results = await layerView.queryGraphics();
|
|
137
|
+
* console.log(results); // prints the array of client-side graphics to the console
|
|
138
|
+
*/
|
|
139
|
+
abstract queryGraphics(): Promise<Collection<Graphic>>;
|
|
140
140
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{deprecatedProperty as t}from"../../core/deprecate.js";import e from"../../core/Logger.js";import i from"./LayerView.js";function r(i){t(e.getLogger(i),"highlightOptions",{replacement:"View.highlights",version:"4.34",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}class s extends i{constructor(){super(...arguments),this.layer=null}get highlightOptions(){return r(this),null}set highlightOptions(t){r(this)}}export{s as default};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type Graphic from "../../Graphic.js";
|
|
2
2
|
import type Collection from "../../core/Collection.js";
|
|
3
|
+
import type KMLLayer from "../../layers/KMLLayer.js";
|
|
3
4
|
import type KMLMapImage from "../../layers/support/KMLMapImage.js";
|
|
4
5
|
import type LayerView from "./LayerView.js";
|
|
5
|
-
import type { LayerViewProperties } from "./LayerView.js";
|
|
6
|
-
|
|
7
|
-
export interface KMLLayerViewProperties extends LayerViewProperties {}
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* Represents the [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) of a [KMLLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KMLLayer/)
|
|
@@ -15,13 +13,15 @@ export interface KMLLayerViewProperties extends LayerViewProperties {}
|
|
|
15
13
|
* @see [KMLSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/KMLSublayer/)
|
|
16
14
|
* @see [Sample - KMLLayer](https://developers.arcgis.com/javascript/latest/sample-code/layers-kml/)
|
|
17
15
|
*/
|
|
18
|
-
export default
|
|
16
|
+
export default abstract class KMLLayerView extends LayerView {
|
|
17
|
+
/** A collection of all the [MapImages](https://developers.arcgis.com/javascript/latest/references/core/layers/support/KMLMapImage/) from visible sublayers. */
|
|
18
|
+
abstract readonly allVisibleMapImages: Collection<KMLMapImage>;
|
|
19
19
|
/** A collection of graphics representing all the points from visible sublayers. */
|
|
20
|
-
readonly allVisiblePoints: Collection<Graphic>;
|
|
21
|
-
/** A collection of graphics representing all the polylines from visible sublayers. */
|
|
22
|
-
readonly allVisiblePolylines: Collection<Graphic>;
|
|
20
|
+
abstract readonly allVisiblePoints: Collection<Graphic>;
|
|
23
21
|
/** A collection of graphics representing all the polygons from visible sublayers. */
|
|
24
|
-
readonly allVisiblePolygons: Collection<Graphic>;
|
|
25
|
-
/** A collection of all the
|
|
26
|
-
readonly
|
|
22
|
+
abstract readonly allVisiblePolygons: Collection<Graphic>;
|
|
23
|
+
/** A collection of graphics representing all the polylines from visible sublayers. */
|
|
24
|
+
abstract readonly allVisiblePolylines: Collection<Graphic>;
|
|
25
|
+
/** The layer being viewed. */
|
|
26
|
+
get layer(): KMLLayer;
|
|
27
27
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import type VectorTileLayer from "../../layers/VectorTileLayer.js";
|
|
1
2
|
import type LayerView from "./LayerView.js";
|
|
2
|
-
import type { LayerViewProperties } from "./LayerView.js";
|
|
3
|
-
|
|
4
|
-
export interface VectorTileLayerViewProperties extends LayerViewProperties {}
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Represents the [LayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/LayerView/) of a [VectorTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/)
|
|
@@ -12,7 +10,9 @@ export interface VectorTileLayerViewProperties extends LayerViewProperties {}
|
|
|
12
10
|
* @since 4.31
|
|
13
11
|
* @see [VectorTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VectorTileLayer/)
|
|
14
12
|
*/
|
|
15
|
-
export default
|
|
13
|
+
export default abstract class VectorTileLayerView extends LayerView {
|
|
16
14
|
/** When `false`, it indicates that tiles have no visible features within the current extent. */
|
|
17
|
-
readonly hasVisibleFeatures: boolean;
|
|
15
|
+
abstract readonly hasVisibleFeatures: boolean;
|
|
16
|
+
/** The layer being viewed. */
|
|
17
|
+
get layer(): VectorTileLayer;
|
|
18
18
|
}
|
package/widgets/Editor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as r,abortMaybe as a,mappedFind as n}from"../core/maybe.js";import{createResolver as l}from"../core/promiseUtils.js";import{watch as c,initial as d,on as h,when as m}from"../core/reactiveUtils.js";import{property as p,subclass as u}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../core/support/UpdatingHandles.js";import w from"../views/interactive/sketch/SketchLabelOptions.js";import v from"../views/interactive/sketch/SketchTooltipOptions.js";import _ from"../views/interactive/sketch/SketchValueOptions.js";import f from"../views/interactive/snapping/SnappingOptions.js";import y from"./Attachments.js";import b from"./BatchAttributeForm.js";import k from"./FeatureForm.js";import M from"./FeatureTemplates.js";import F from"./Spinner.js";import A from"./Widget.js";import T from"./BatchAttributeForm/VisibleElements.js";import{css as S}from"./Editor/css.js";import C from"./Editor/EditorViewModel.js";import{isModelUpload as L}from"./Editor/modelUploadUtils.js";import E from"./Editor/VisibleElements.js";import{findEditorItemForLayer as W,isFeatureFormViewModel as I,isUpdateWorkflow as P,isUpdateFeaturesWorkflow as U,isUpdateFeatureWorkflow as j,isBatchAttributeFormViewModel as V}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as D,CreateFeaturesPanelContent as x}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as B,FeatureList as O}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as N,FooterActions as H}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as G,Notice as z}from"./Editor/components/Notices.js";import{loadPanelContentComponents as R,PanelContent as q,PanelContentSection as K,PanelContentMessage as Z}from"./Editor/components/PanelContent.js";import{PanelToolbar as $,loadPanelToolbarComponents as J}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as Q,Prompt as X}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as Y,UpdateFeaturePanelContent as ee}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as te,UploadDetails as ie}from"./Editor/components/UploadDetails.js";import se from"./Sketch/CreateToolVisibilityMap.js";import oe from"./Sketch/SelectionToolVisibilityMap.js";import re from"./Sketch/VisibleElements.js";import{loadCalciteComponents as ae}from"./support/componentsUtils.js";import{globalCss as ne}from"./support/globalCss.js";import{incrementHeadingLevel as le,Heading as ce}from"./support/Heading.js";import{renderItem as de}from"./support/ItemList.js";import{connectDelayedLoading as he}from"./support/loaderUtils.js";import me from"./support/SelectionList.js";import pe from"./support/SelectionToolbar.js";import{messageBundle as ue,vmEvent as ge,tsx as we}from"./support/widget.js";import{isLayerItem as ve}from"./support/SelectionList/selectionListUtils.js";import _e from"./support/SelectionList/VisibleElements.js";import fe from"./support/SelectionToolbar/VisibleElements.js";const ye=Symbol("sketch-setup-handles");let be=class extends A{constructor(e,s){super(e,s),this._batchAttributeForm=new b({suppressDeprecationWarning:!0,visibleElements:new T({loadingIndicator:!1})}),this._featureForm=new k({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new y({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new M({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?we("calcite-icon",{class:S.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new F,this._loading=!1,this._selectionList=new me({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!W(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new _e({header:!1})}),this._selectionToolbar=new pe({visibleElements:new fe({chip:!1})}),this._updatingHandles=new g,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new E,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?we("div",{class:S.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>we("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return we("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?we($,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&L(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&I(t.formViewModel)&&t.formViewModel.activeAssociation?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(P(e)){const t=e.activeWorkflow;U(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(P(e)){const t=e.activeWorkflow;if(j(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new C({useLegacyCreateTools:e?.useLegacyCreateTools??"2d"!==e?.view?.type}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([c(()=>le(this.headingLevel),e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},d),h(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),m(()=>this.viewModel.formViewModel,e=>{V(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},d),m(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},d),m(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),c(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,r])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=r,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},d),c(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},d),c(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},d),m(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),m(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),m(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:r}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{r(),this._clearPrompt()}}}})}),c(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),c(()=>this.viewModel.featureFormDisabled,e=>this._featureForm.disabled=e),c(()=>this.visibleElements.sketch,()=>this._setupSketch(),d),c(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,d),he({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=r(this._sketchToolbar),this._sketchImportAbortController=a(this._sketchImportAbortController)}loadDependencies(){return Promise.all([ae({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),D(),B(),N(),G(),R(),J(),Q(),Y(),te()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!W(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!W(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!W(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!ve(e))return!0;const t=W(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(S.base,ne.widget,ne.panel);if(!t)return we("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,r=s.map((e,t)=>this._renderPage(e,t===o));return we("div",{class:i,key:"base"},e.flow?we("calcite-flow",{inert:!!this._prompt,key:"flow"},r):r,this._prompt?we(X,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return we("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return we(t,{heading:i.selectTemplate,key:"templates-panel",...e},we(q,{key:"feature-templates"},we(K,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?we(t,{heading:s.createFeatures,key:"upload-details-panel",...e},we(ie,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:r,viewModel:a}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return we(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?we(ee,{editorViewModel:a,headingLevel:r,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):we(x,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return we(t,{heading:a,key:"update-feature-panel",...e},we(ee,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return we(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},we(x,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this;return we(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},we(ee,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(a);return we(t,{heading:n,key:"viewing-associated-layers-panel",...e},we(ee,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state||this.viewModel.featureFormDisabled;return t?we(i,{heading:a,key:"add-association-select-feature",...e},we(q,{key:"select-feature"},we(K,null,t.render())),we(H,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(r?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):we(i,{heading:a,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,r="add-association"===o?.type?o.sourceFeatureItem:null,a=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;r&&a&&n&&l&&(t.sourceFeature=r,t.targetFeature=a,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state;return we(i,{heading:a,key:"add-association",...e},we(q,{key:"add-association-content"},we(K,null,t.render())),we(H,{buttons:[{label:o.add,disabled:n||!r.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=n(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?we(z,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return we(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},we(q,{key:"attachments"},this._renderAttachments()),we(H,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:r,_visibleSelectionCount:a,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=r;return we(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?we("div",{class:S.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,we(q,{key:"selection-list"},we(K,null,this._renderSelectionList())),we(H,{buttons:[c?{label:t(n.batchEditing.editCount,{count:a}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:r}=this;return s?we(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},we(q,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?we(H,{buttons:[{label:r.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return we(t,{heading:i.widgetLabel,key:"landing-panel",...e},we(q,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?we(K,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?we(K,{key:"create-actions"},this._renderCreateActions()):null]:we(Z,{key:"no-content"},i.noEditableLayers)),o?we("div",{class:S.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return we("div",{class:S.updateActions,key:"update-actions"},we(ce,{level:le(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?we("div",{class:S.selectionToolbarContainer},this._renderSelectionToolbar()):we("calcite-list",{class:S.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},de({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return we("div",{key:"create-actions"},we(ce,{level:le(this.headingLevel)},this.messages.createFeatures),we("div",{class:S.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const r=o.data.candidates,a=t(this.messages.multipleFeaturesTemplate,{total:r.length});return we(i,{heading:a,key:"feature-list",...e},we(O,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=l(),{view:r}=this,a=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),a&&r?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=a(this._sketchImportAbortController),this._sketchToolbar=r(this._sketchToolbar),void this.removeHandles(ye);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new re({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new se({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new oe({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([c(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},d),c(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},d),m(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},d),m(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},d)],ye)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([p()],be.prototype,"_batchAttributeForm",void 0),e([p()],be.prototype,"_featureForm",void 0),e([p()],be.prototype,"_sketchToolbar",void 0),e([p()],be.prototype,"_attachments",void 0),e([p()],be.prototype,"_associationItemList",void 0),e([p()],be.prototype,"_associationSettings",void 0),e([p()],be.prototype,"_featureTemplates",void 0),e([p()],be.prototype,"_filterText",void 0),e([p()],be.prototype,"_hasInvalidBatchSelection",null),e([p()],be.prototype,"_hasSelectionFromMultipleLayers",null),e([p()],be.prototype,"_hasSelectionWithUneditableFeatures",null),e([p()],be.prototype,"_prompt",void 0),e([p()],be.prototype,"_spinner",void 0),e([p()],be.prototype,"_deleteButtonCommonInfo",null),e([p()],be.prototype,"_loading",void 0),e([p()],be.prototype,"_selectionCountExceedsMaximum",null),e([p()],be.prototype,"_selectionList",void 0),e([p()],be.prototype,"_selectionListItemActionConfigs",null),e([p()],be.prototype,"_selectionToolbar",void 0),e([p()],be.prototype,"_visibleSelectionCount",null),e([p({readOnly:!0})],be.prototype,"activeWorkflow",null),e([p()],be.prototype,"editorItems",null),e([p()],be.prototype,"effectiveSelectionManager",null),e([p()],be.prototype,"headingLevel",void 0),e([p()],be.prototype,"hideTemplatesForInactiveLayers",null),e([p()],be.prototype,"icon",null),e([p()],be.prototype,"label",null),e([p({type:w})],be.prototype,"labelOptions",null),e([p()],be.prototype,"layerInfos",null),e([p(),ue("esri/widgets/Editor/t9n/Editor")],be.prototype,"messages",void 0),e([p(),ue("esri/t9n/common")],be.prototype,"messagesCommon",void 0),e([p(),ue("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],be.prototype,"messagesTemplates",void 0),e([p(),ue("esri/widgets/Feature/t9n/Feature")],be.prototype,"messagesFeature",void 0),e([p()],be.prototype,"selectionManager",null),e([p({type:f})],be.prototype,"snappingOptions",null),e([p()],be.prototype,"syncWithViewSelectionManager",null),e([p()],be.prototype,"syncViewSelection",null),e([p({type:v})],be.prototype,"tooltipOptions",null),e([p()],be.prototype,"supportingWidgetDefaults",void 0),e([p({type:_,nonNullable:!0})],be.prototype,"valueOptions",null),e([p({value:!1})],be.prototype,"useLegacyCreateTools",null),e([p()],be.prototype,"isUsingLegacyCreateTools",null),e([p()],be.prototype,"view",null),e([p({type:C}),ge(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],be.prototype,"viewModel",void 0),e([p({type:E,nonNullable:!0})],be.prototype,"visibleElements",void 0),e([p()],be.prototype,"_helpMessage",null),e([p()],be.prototype,"_noticeMessage",null),be=e([u("esri.widgets.Editor")],be);const ke=be;export{ke as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{substitute as t}from"../intl.js";import{deprecateWidget as i,deprecatedFunction as s}from"../core/deprecate.js";import o from"../core/Logger.js";import{destroyMaybe as r,abortMaybe as a,mappedFind as n}from"../core/maybe.js";import{createResolver as l}from"../core/promiseUtils.js";import{watch as c,initial as d,on as h,when as m}from"../core/reactiveUtils.js";import{property as p,subclass as u}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../core/support/UpdatingHandles.js";import w from"../views/interactive/sketch/SketchLabelOptions.js";import v from"../views/interactive/sketch/SketchTooltipOptions.js";import _ from"../views/interactive/sketch/SketchValueOptions.js";import f from"../views/interactive/snapping/SnappingOptions.js";import y from"./Attachments.js";import b from"./BatchAttributeForm.js";import k from"./FeatureForm.js";import M from"./FeatureTemplates.js";import F from"./Spinner.js";import A from"./Widget.js";import T from"./BatchAttributeForm/VisibleElements.js";import{css as S}from"./Editor/css.js";import C from"./Editor/EditorViewModel.js";import{isModelUpload as L}from"./Editor/modelUploadUtils.js";import E from"./Editor/VisibleElements.js";import{findEditorItemForLayer as W,isFeatureFormViewModel as I,isUpdateWorkflow as P,isUpdateFeaturesWorkflow as U,isUpdateFeatureWorkflow as j,isBatchAttributeFormViewModel as V}from"./Editor/workflowUtils.js";import{loadCreateFeaturesPanelContentComponents as D,CreateFeaturesPanelContent as x}from"./Editor/components/CreateFeaturesPanelContent.js";import{loadFeatureListComponents as B,FeatureList as O}from"./Editor/components/FeatureList.js";import{loadFooterActionsComponents as N,FooterActions as H}from"./Editor/components/FooterActions.js";import{loadNoticesComponents as G,Notice as z}from"./Editor/components/Notices.js";import{loadPanelContentComponents as R,PanelContent as q,PanelContentSection as K,PanelContentMessage as Z}from"./Editor/components/PanelContent.js";import{PanelToolbar as $,loadPanelToolbarComponents as J}from"./Editor/components/PanelToolbar.js";import{loadPromptComponents as Q,Prompt as X}from"./Editor/components/Prompt.js";import{loadUpdateFeaturePanelContentComponents as Y,UpdateFeaturePanelContent as ee}from"./Editor/components/UpdateFeaturePanelContent.js";import{loadUploadDetailsComponents as te,UploadDetails as ie}from"./Editor/components/UploadDetails.js";import se from"./Sketch/CreateToolVisibilityMap.js";import oe from"./Sketch/SelectionToolVisibilityMap.js";import re from"./Sketch/VisibleElements.js";import{loadCalciteComponents as ae}from"./support/componentsUtils.js";import{globalCss as ne}from"./support/globalCss.js";import{incrementHeadingLevel as le,Heading as ce}from"./support/Heading.js";import{renderItem as de}from"./support/ItemList.js";import{connectDelayedLoading as he}from"./support/loaderUtils.js";import me from"./support/SelectionList.js";import pe from"./support/SelectionToolbar.js";import{messageBundle as ue,vmEvent as ge,tsx as we}from"./support/widget.js";import{isLayerItem as ve}from"./support/SelectionList/selectionListUtils.js";import _e from"./support/SelectionList/VisibleElements.js";import fe from"./support/SelectionToolbar/VisibleElements.js";const ye=Symbol("sketch-setup-handles");let be=class extends A{constructor(e,s){super(e,s),this._batchAttributeForm=new b({suppressDeprecationWarning:!0,visibleElements:new T({loadingIndicator:!1})}),this._featureForm=new k({suppressDeprecationWarning:!0}),this._sketchToolbar=null,this._attachments=new y({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1},suppressDeprecationWarning:!0}),this._associationItemList=null,this._associationSettings=null,this._featureTemplates=new M({suppressDeprecationWarning:!0,enableListScroll:!1,renderItemContentEnd:e=>e.supportsUpload?we("calcite-icon",{class:S.templateItemContentEnd,icon:"upload-to",key:"upload-icon"}):null,renderItemLabel:e=>e.label,renderCustomGroupContent:e=>this._renderCustomTemplateGroupContent(e)}),this._filterText="",this._prompt=null,this._spinner=new F,this._loading=!1,this._selectionList=new me({displayMode:"layer",itemActionConfigs:this._selectionListItemActionConfigs,itemUnavailableFunction:({item:e})=>!W(this.editorItems,e.layer)?.editable,onListItemSelect:({item:e})=>this._onSelectionListItemSelect(e),visibleElements:new _e({header:!1})}),this._selectionToolbar=new pe({visibleElements:new fe({chip:!1})}),this._updatingHandles=new g,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.messagesFeature=null,this.supportingWidgetDefaults=null,this.viewModel=null,this.visibleElements=new E,this._renderAttachments=()=>this._attachments.render(),this._renderFeatureForm=()=>this._featureForm.render(),this._renderBatchAttributeForm=()=>this._batchAttributeForm.render(),this._renderFeatureTemplates=()=>this._featureTemplates.render(),this._renderSelectionList=()=>this._selectionList.render(),this._renderSelectionToolbar=()=>this._selectionToolbar.render(),this._renderSketch=()=>this._sketchToolbar?we("div",{class:S.sketchContainer,key:"editor-sketch-container"},this._sketchToolbar?.render()):void 0,this._renderSelectIcon=()=>we("calcite-icon",{icon:"cursor",slot:"content-start"}),this.EditorPanel=({heading:e,key:t,selected:i},...s)=>{const{visibleElements:o}=this;return we("calcite-flow-item",{closable:!1,heading:e,headingLevel:this.headingLevel,key:t,loading:this._loading,selected:i,onCalciteFlowItemBack:this._onBack},o.settingsMenu?we($,{editorViewModel:this.viewModel,messagesCommon:this.messagesCommon,visibleElements:o}):null,...s)},this._showConfirmationPrompt=e=>this._showPromptAndWait(this.messages[e]),this._showDiscardEditsPrompt=()=>{const{messages:e,activeWorkflow:t}=this,i={title:e.cancelEditTitle,message:e.cancelEditWarningMessage,yesLabel:e.discardEdits,noLabel:e.continueEditing};return"create-features"===t?.type&&L(t.data.creationInfo)?this._showPromptAndWait("success"===t.data.upload?.state?e.modelUploads.cancelPlacementPrompt:e.modelUploads.cancelUploadPrompt):"update"===t?.type&&I(t.formViewModel)&&t.formViewModel.activeAssociation?this._showPromptAndWait({...i,message:e.cancelAssociationEditWarning}):this._showPromptAndWait(i)},this._showGenericCancelPrompt=()=>{const{messages:e,messagesCommon:t}=this;return this._showPromptAndWait({title:e.cancelRequestTitle,message:e.cancelRequestWarningMessage,yesLabel:t.form.yes,noLabel:t.form.no})},this._showPrompt=e=>{this._prompt?.cancel?.(),this._prompt=e},this._clearPrompt=()=>{this._prompt=null},this._onSave=()=>{this.viewModel.saveWorkflow()},this._onMerge=()=>{const{activeWorkflow:e}=this.viewModel;if(P(e)){const t=e.activeWorkflow;U(t)&&e.startMergingFeatures(t.viewGraphics,{initialFeatures:t.data.initialFeatures})}},this._onSplit=()=>{const{activeWorkflow:e}=this.viewModel;if(P(e)){const t=e.activeWorkflow;if(j(t)){const i=t.viewGraphic;i&&e.startSplittingFeature(i,{initialFeature:t.data.edits.initialFeature??i})}}},this._onDelete=()=>{const e=this.viewModel.activeFeatureCount,i=e>1?this.messages.multiFeature:this.messages.singleFeature;this._showPrompt({title:i.deleteWarningTitle,message:i.deleteWarningMessage,context:"danger",actions:{primary:{label:t(i.delete,{count:e}),action:()=>{this.deleteFeatures(),this._clearPrompt()}},secondary:{label:i.keep,action:this._clearPrompt}}})},this._onDeleteAssociation=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAssociationTitle,message:e.deleteAssociationMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteAssociationFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepAssociation,action:this._clearPrompt}}})},this._onToggleUpdateWorkflow=()=>this.viewModel.toggleUpdateWorkflow(),this._onBack=e=>(e?.stopPropagation(),this.viewModel.back()),this._onAttachmentAdd=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type||"update"===e.type&&"create-features"===e.activeWorkflow?.type?(this._attachments.addFile(),e.back()):this._attachments.addAttachment().then(()=>e.back()))},this._onAttachmentUpdate=()=>{const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.back()):this._attachments.updateAttachment().then(()=>e.back()))},this._onAttachmentDelete=()=>{const{messages:e,messagesCommon:t}=this;this._showPrompt({title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}})},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.back(),this._clearPrompt())},this._onAttachmentsError=e=>{this._showPrompt({title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}})},this.viewModel=e?.viewModel||new C({useLegacyCreateTools:e?.useLegacyCreateTools??"3d"===e?.view?.type}),this.announceDeprecation=()=>{i(o.getLogger(this),"Editor","arcgis-editor",{version:"5.0"})}}initialize(){this._featureForm.showPrompt=this._showPrompt,this._featureForm.clearPrompt=this._clearPrompt,this.addHandles([c(()=>le(this.headingLevel),e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e},d),h(()=>this.viewModel.activeWorkflow,"cancel-request",({controller:e})=>{(this.viewModel.hasPendingEdits?this._showDiscardEditsPrompt():this._showGenericCancelPrompt()).then(t=>t?e.allow():e.deny())}),m(()=>this.viewModel.formViewModel,e=>{V(e)?this._batchAttributeForm.viewModel=e:this._featureForm.viewModel=e},d),m(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel,e=>{this._associationItemList?this._associationItemList.viewModel=e:this._updatingHandles.consumePromise(this._initializeAssociationItemList(e))},d),m(()=>this.viewModel.utilityNetworkAssociationAddAssociationViewModel?.association,()=>{this._setUpAssociationSettings()}),c(()=>[this.viewModel,this.viewModel?.attachmentsViewModel,this.viewModel?.featureTemplatesViewModel,this.viewModel?.spinnerViewModel,this.viewModel?.selectionListViewModel,this.viewModel?.selectionToolbarViewModel],([e,t,i,s,o,r])=>{this._attachments.viewModel=t,this._featureTemplates.viewModel=i,this._spinner.viewModel=s,this._selectionList.viewModel=o,this._selectionToolbar.viewModel=r,e.showDiscardEditsPrompt=this._showDiscardEditsPrompt,e.showConfirmationPrompt=this._showConfirmationPrompt},d),c(()=>this.view,(e,t)=>{const i=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,i),e?.ui.add(this._spinner,{key:i,position:"manual"}),this._associationItemList&&(this._associationItemList.view=e)},d),c(()=>[this.supportingWidgetDefaults,this.viewModel.sketchViewModel],([e])=>{e&&(e.attachments&&this._attachments.set(e.attachments),e.featureForm&&this._featureForm.set(e.featureForm),e.featureTemplates&&this._featureTemplates.set(e.featureTemplates),e.selectionToolbar&&this._selectionToolbar.set(e.selectionToolbar),e.sketch&&this.viewModel.sketchViewModel?.set(e.sketch))},d),m(()=>this._attachments?.error,e=>this._onAttachmentsError(e)),m(()=>this._selectionListItemActionConfigs,()=>{this._selectionList.itemActionConfigs=this._selectionListItemActionConfigs}),m(()=>this.viewModel?.failures,e=>{const{messages:i}=this,[{error:s,retry:o,cancel:r}]=e;this._showPrompt({title:i.errorWarningTitle,message:t(i.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:i.retry,action:()=>{o(),this._clearPrompt()}},secondary:{label:i.ignore,action:()=>{r(),this._clearPrompt()}}}})}),c(()=>this.viewModel?.state,e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}}),c(()=>this.viewModel.featureFormDisabled,e=>this._featureForm.disabled=e),c(()=>this.visibleElements.sketch,()=>this._setupSketch(),d),c(()=>this.visibleElements.zoomToButton,e=>this._selectionList.visibleElements.zoomToButton=e,d),he({getLoading:()=>{const{viewModel:e}=this;return e.syncing||e.updating||this._attachments.submitting||this._updatingHandles.updating},setEffectiveLoading:e=>{this._loading=e}})])}destroy(){this._associationItemList?.destroy(),this._associationSettings?.destroy(),this._selectionList.destroy(),this._selectionToolbar.destroy(),this._attachments.destroy(),this._batchAttributeForm.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._spinner.destroy(),this._sketchToolbar=r(this._sketchToolbar),this._sketchImportAbortController=a(this._sketchImportAbortController)}loadDependencies(){return Promise.all([ae({flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),list:()=>import("@esri/calcite-components/dist/components/calcite-list")}),D(),B(),N(),G(),R(),J(),Q(),Y(),te()])}get _hasInvalidBatchSelection(){return this._hasSelectionWithUneditableFeatures||this._hasSelectionFromMultipleLayers||this._selectionCountExceedsMaximum||0===this._selectionList.visibleFeatureCount}get _hasSelectionFromMultipleLayers(){return this._selectionList.visibleLayerCount>1}get _hasSelectionWithUneditableFeatures(){const e=this.editorItems;return this._selectionList.visibleFeatureItems.some(t=>!W(e,t.layer))}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger"}}get _selectionCountExceedsMaximum(){const e=this._batchAttributeForm.maximumFeatureCount,{activeLayerItem:t,effectiveCount:i,filterText:s,visibleFeatureCount:o}=this._selectionList;return null!=s&&""!==s?o>e:t?t.total>e:i>e}get _selectionListItemActionConfigs(){const{messages:e,visibleElements:t}=this,i=t?.mergeButton??!0;return[{label:e?.batchEditing?.editThisFeature,icon:"edit-attributes",type:"feature",hidden:({item:e})=>!W(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.editTheseFeatures,icon:"edit-attributes",type:"layer",hidden:({item:e})=>!W(this.editorItems,e.layer)?.editable,callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"update")},{label:e?.batchEditing.mergeTheseFeatures,icon:"merge",type:"layer",hidden:!i||(({item:e})=>{if(!ve(e))return!0;const t=W(this.editorItems,e.layer);return!t||(!t.editable||!t.supportsMergeFeaturesWorkflow||e.visibleTotal<2)}),callback:({item:e})=>this._onSelectionListMenuItemSelect(e,"merge")}]}get _visibleSelectionCount(){const{activeLayerItem:e,effectiveCount:t,filterText:i,visibleFeatureCount:s}=this._selectionList;return null!=i&&""!==i?s:e?e.total:t}get activeWorkflow(){return this.viewModel.activeWorkflow}get editorItems(){return this.viewModel.editorItems}get effectiveSelectionManager(){return this.viewModel.effectiveSelectionManager}get hideTemplatesForInactiveLayers(){return this.viewModel.hideTemplatesForInactiveLayers}set hideTemplatesForInactiveLayers(e){this.viewModel.hideTemplatesForInactiveLayers=e}get icon(){return"pencil"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get selectionManager(){return this.viewModel.selectionManager}set selectionManager(e){this.viewModel.selectionManager=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get syncWithViewSelectionManager(){return this.syncViewSelection}set syncWithViewSelectionManager(e){this.syncViewSelection=e}get syncViewSelection(){return this.viewModel.syncViewSelection}set syncViewSelection(e){this.viewModel.syncViewSelection=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get valueOptions(){return this.viewModel.valueOptions}set valueOptions(e){this.viewModel.valueOptions=e}get useLegacyCreateTools(){return this.viewModel.useLegacyCreateTools}set useLegacyCreateTools(e){this.viewModel.useLegacyCreateTools=e}get isUsingLegacyCreateTools(){return this.viewModel.isUsingLegacyCreateTools}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}activateSelectionTool(e){return this.viewModel.activateSelectionTool(e)}cancelSelectionTool(){this.viewModel.cancelSelectionTool()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureEdit(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureEdit(e)}startMergeFeaturesWorkflow(e,t={}){return this.viewModel.startMergeFeaturesWorkflow(e,t)}startSplitFeatureWorkflow(e,t={}){return this.viewModel.startSplitFeatureWorkflow(e,t)}async startUpdateFeaturesWorkflow(e){return this.viewModel.startUpdateFeaturesWorkflow(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}startUpdateWorkflowWithActiveSelection(){return this.viewModel.startUpdateWorkflowWithActiveSelection()}deleteFeatureFromWorkflow(){return s(o.getLogger(this),"Editor.deleteFeatureFromWorkflow is deprecated. Use Editor.deleteFeatures instead.",{version:"4.33",replacement:"Editor.deleteFeatures",warnOnce:!0}),this.deleteFeatures()}async deleteFeatures(){await this.viewModel.deleteFeatures()}deleteAssociationFromWorkflow(){return this.viewModel.deleteAssociationFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{visibleElements:e,viewModel:t}=this,i=this.classes(S.base,ne.widget,ne.panel);if(!t)return we("div",{class:i,key:"empty"});const{pageStack:s}=t,o=s.length-1,r=s.map((e,t)=>this._renderPage(e,t===o));return we("div",{class:i,key:"base"},e.flow?we("calcite-flow",{inert:!!this._prompt,key:"flow"},r):r,this._prompt?we(X,{...this._prompt,headingLevel:this.headingLevel}):void 0)}_renderPage(e,t){const i={selected:t};switch(e){case"disabled":break;case"ready":return this._renderReady(i);case"viewing-selection-list":return this._renderSelectionListPage(i);case"awaiting-feature-creation-info":return this._renderAwaitingFeatureCreationInfo(i);case"creating-features-upload-details":return this._renderUploadDetails(i);case"creating-features":return this._renderCreatingFeatures(i);case"editing-existing-feature":case"editing-features":case"editing-attributes":case"choosing-key-feature":return this._renderUpdateFeature(i);case"awaiting-update-feature-candidate":return this._renderFeatureList(i);case"adding-attachment":return this._renderAttachmentAdding(i);case"editing-attachment":return this._renderAttachmentEditing(i);case"viewing-associated-layers":case"viewing-associated-features":return this._renderViewAssociatedLayers(i);case"add-association-select-layer":case"add-association-select-feature":return this._renderSelectFeature(i);case"add-association-create-association":return this._renderAddAssociation(i);case"drawing-splitter-geometry":return this._renderDrawingSplitGeometry(i);case"reviewing-features":return this._renderReviewingSplitFeatures(i)}return we("div",{key:"empty-page"})}_renderAwaitingFeatureCreationInfo(e){const{EditorPanel:t,messages:i}=this;return we(t,{heading:i.selectTemplate,key:"templates-panel",...e},we(q,{key:"feature-templates"},we(K,null,this._renderFeatureTemplates())))}_renderUploadDetails(e){const{EditorPanel:t,activeWorkflow:i,messages:s}=this;if("create-features"!==i?.type)return null;const o=i.data.upload;return o?we(t,{heading:s.createFeatures,key:"upload-details-panel",...e},we(ie,{helpMessage:this._helpMessage,messages:s,upload:o})):null}_renderCreatingFeatures(e){const{EditorPanel:t,activeWorkflow:i,messages:s,messagesCommon:o,headingLevel:r,viewModel:a}=this;if(!i)return null;const n="create-features"===i.type&&i.numPendingFeatures>0||"update"===i.type&&"create-features"===i?.activeWorkflow?.type&&i.activeWorkflow?.numPendingFeatures>0;return we(t,{heading:s.createFeatures,key:"create-features-panel",...e},n?we(ee,{editorViewModel:a,headingLevel:r,messages:s,messagesCommon:o,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}):we(x,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderUpdateFeature(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.activeFeatureCount>1?i.multiFeature.editPanelTitle:i.singleFeature.editPanelTitle;return we(t,{heading:a,key:"update-feature-panel",...e},we(ee,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onMerge:this._onMerge,onSave:this._onSave,onSplit:this._onSplit}))}_renderDrawingSplitGeometry(e){const{EditorPanel:t}=this;return we(t,{heading:this.messages.splitFeature,key:"draw-split-geometry-panel",...e},we(x,{helpMessage:this._helpMessage,noticeMessage:this._noticeMessage,renderSketchToolbar:this._renderSketch}))}_renderReviewingSplitFeatures(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this;return we(t,{heading:i.splitFeature,key:"review-split-features-panel",...e},we(ee,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,visibleElements:this.visibleElements,onSave:this._onSave}))}_getAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;if(e.title)return e.title;const{messagesFeature:i}=this;switch(e.type){case"attachment":return i.associationsAttachments;case"connectivity":return i.associationsConnectivity;case"structure":return i.associationsStructure;case"content":return i.associationsContents;case"container":return i.associationsContainer}}_getAddAssociationTypeTitle(e){const{messages:t}=this;if(!e)return t.singleFeature.editPanelTitle;const i=t.associations;switch(e.type){case"attachment":return i.addAttachment;case"connectivity":return i.addConnectivity;case"structure":return i.addStructure;case"content":return i.addContent;case"container":return i.addContainer}}async _initializeAssociationItemList(e){const t=(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js")).default;this._associationItemList=new t({view:this.view,viewModel:e})}async _initializeAssociationSettings(){const e=new(0,(await import("./FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationSettings.js")).default);return this._associationSettings=e,e}_renderViewAssociatedLayers(e){const{EditorPanel:t,messages:i,messagesCommon:s,headingLevel:o,viewModel:r}=this,a=r.featureFormViewModel?.activeAssociationInput?.activeAssociationType,n=this._getAssociationTypeTitle(a);return we(t,{heading:n,key:"viewing-associated-layers-panel",...e},we(ee,{editorViewModel:r,headingLevel:o,messages:i,messagesCommon:s,renderAttachments:this._renderAttachments,renderBatchAttributeForm:this._renderBatchAttributeForm,renderFeatureForm:this._renderFeatureForm,renderSketchToolbar:this._renderSketch,visibleElements:this.visibleElements,onDelete:this._onDelete,onDeleteAssociation:this._onDeleteAssociation,onSave:this._onSave}))}_renderSelectFeature(e){const{_associationItemList:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this,r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state||this.viewModel.featureFormDisabled;return t?we(i,{heading:a,key:"add-association-select-feature",...e},we(q,{key:"select-feature"},we(K,null,t.render())),we(H,{buttons:[t.filterOptionsVisible?{appearance:"solid",label:o.apply,disabled:n,onClick:()=>t.applyFilterOptions(),type:"button"}:void 0,{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&(r?.reset(),s.activeWorkflow.cancelActiveWorkflow())},type:"button"}]})):we(i,{heading:a,key:"add-association-select-feature",...e})}async _setUpAssociationSettings(){const{viewModel:e}=this,t=this._associationSettings??await this._updatingHandles.addPromise(this._initializeAssociationSettings()),i=e.utilityNetworkAssociationAddAssociationViewModel,s="update"===e.activeWorkflow?.type?e.activeWorkflow:null,o=s?s.activeWorkflow:null,r="add-association"===o?.type?o.sourceFeatureItem:null,a=i?.selectedFeature,n=i?.association,l=i?.utilityNetwork;r&&a&&n&&l&&(t.sourceFeature=r,t.targetFeature=a,t.association=n,t.utilityNetwork=l)}_renderAddAssociation(e){const{_associationSettings:t,EditorPanel:i,viewModel:s,messagesCommon:o}=this;if(!t)return null;const r=s.utilityNetworkAssociationAddAssociationViewModel,a=this._getAddAssociationTypeTitle(r?.associationType),n="ready"!==r?.state;return we(i,{heading:a,key:"add-association",...e},we(q,{key:"add-association-content"},we(K,null,t.render())),we(H,{buttons:[{label:o.add,disabled:n||!r.canAddAssociation,onClick:()=>this._onSave(),type:"button"},{appearance:"outline",label:o.cancel,disabled:n,onClick:()=>{"update"===s.activeWorkflow?.type&&s.activeWorkflow.cancelActiveWorkflow()},type:"button"}]}))}_renderCustomTemplateGroupContent(e){const{messages:t,viewModel:i}=this,s=n(e.group.items,e=>i.itemHasInvalidFormTemplate(e)?t.formFieldCreateError:void 0);return s?we(z,{kind:"warning",message:s}):null}_renderAttachmentAdding(e){const{EditorPanel:t,_attachments:i,messages:s,messagesCommon:o}=this;return we(t,{heading:s.addAttachment,key:"attachment-adding-panel",...e},we(q,{key:"attachments"},this._renderAttachments()),we(H,{buttons:[{label:i.submitting?o.cancel:o.add,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentAdd,type:"button"}]}))}_renderSelectionListPage(e){const{_hasSelectionFromMultipleLayers:i,_hasInvalidBatchSelection:s,_selectionCountExceedsMaximum:o,_selectionList:r,_visibleSelectionCount:a,messages:n,EditorPanel:l}=this,{batchUpdateActions:c}=this.visibleElements,{maxVisibleFeatureCountPerLayer:d}=r;return we(l,{heading:n.widgetLabel,key:"selection-list-panel",...e},this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?we("div",{class:S.selectionToolbarContainer},this._renderSelectionToolbar()):void 0,we(q,{key:"selection-list"},we(K,null,this._renderSelectionList())),we(H,{buttons:[c?{label:t(n.batchEditing.editCount,{count:a}),disabled:s,onClick:()=>this.startUpdateWorkflowWithActiveSelection(),type:"button"}:void 0],notice:c&&i?{text:n.batchEditing.selectOneLayer,icon:"information"}:c&&o?{text:t(this.messages.multiFeature.formFailedToLoadTooManyFeatures,{num:d}),icon:"information"}:void 0}))}_renderAttachmentEditing(e){const{EditorPanel:t,_attachments:i,activeWorkflow:s,messages:o,messagesCommon:r}=this;return s?we(t,{heading:o.editAttachment,key:"attachment-editing-panel",...e},we(q,{key:"attachments"},this._renderAttachments()),s.shouldAllowAttachmentEditing?we(H,{buttons:[{label:r.update,disabled:i.submitting||!i.selectedFile,onClick:this._onAttachmentUpdate,type:"button"},{...this._deleteButtonCommonInfo,onClick:this._onAttachmentDelete,disabled:i.submitting,label:r.delete,type:"button"}]}):void 0):null}_renderReady(e){const{EditorPanel:t,messages:i,visibleElements:s}=this,o=this._helpMessage;return we(t,{heading:i.widgetLabel,key:"landing-panel",...e},we(q,{key:"landing-content"},this.editorItems.length?[s.editFeaturesSection?we(K,{key:"edit-actions"},this._renderUpdateActions()):null,s.createFeaturesSection&&this.viewModel.canCreateVisible?we(K,{key:"create-actions"},this._renderCreateActions()):null]:we(Z,{key:"no-content"},i.noEditableLayers)),o?we("div",{class:S.helpMessage,key:"footer-actions",slot:"footer"},o):void 0)}get _helpMessage(){return this.getHelpMessageString(this.activeWorkflow?.helpMessage)}get _noticeMessage(){return this.getHelpMessageString(this.activeWorkflow?.noticeMessage)}_renderUpdateActions(){const{messages:e,messagesCommon:t,viewModel:i}=this,s={id:"select",label:t.select};return we("div",{class:S.updateActions,key:"update-actions"},we(ce,{level:le(this.headingLevel)},e.editFeatures),this.visibleElements.selectionToolbar&&"3d"!==this.view?.type?we("div",{class:S.selectionToolbarContainer},this._renderSelectionToolbar()):we("calcite-list",{class:S.updateActionsList,label:e.editFeaturesList,selectionAppearance:"border",selectionMode:"single"},de({disabled:!i.canUpdateVisible,grouped:!1,item:s,selectedItem:"awaiting-feature-to-update"===i.activeWorkflow?.stepId?s:void 0,renderIcon:this._renderSelectIcon,onItemSelect:this._onToggleUpdateWorkflow})))}_renderCreateActions(){return we("div",{key:"create-actions"},we(ce,{level:le(this.headingLevel)},this.messages.createFeatures),we("div",{class:S.featureTemplatesContainer,key:"templates"},this._renderFeatureTemplates()))}_renderFeatureList(e){const{EditorPanel:i,viewModel:s}=this,{activeWorkflow:o}=s;if("update"!==o?.type)return null;const r=o.data.candidates,a=t(this.messages.multipleFeaturesTemplate,{total:r.length});return we(i,{heading:a,key:"feature-list",...e},we(O,{editorItems:this.editorItems,editorMessages:this.messages,filterText:this._filterText,id:this.id,messagesTemplates:this.messagesTemplates,workflow:o,onFilterTextChange:e=>this._filterText=e,onSelectFeature:(e,t)=>s.selectFeature(e,t),onZoomTo:e=>s.zoomTo(e)}))}_showPromptAndWait({title:e,message:t,yesLabel:i,noLabel:s}){const o=l(),{view:r}=this,a=r?.focused;return this._showPrompt({title:e,message:t,context:"danger",actions:{primary:{label:i,action:()=>o.resolve(!0)},secondary:{label:s,action:()=>o.resolve(!1)}}}),o.promise.finally(()=>{this._clearPrompt(),a&&r?.focus()})}async _onSelectionListItemSelect(e){await this.viewModel.onSelectionListItemSelect(e)}async _onSelectionListMenuItemSelect(e,t){await this.viewModel.onSelectionListMenuItemSelect(e,t)}async _setupSketch(){if(!!!this.visibleElements.sketch)return this._sketchImportAbortController=a(this._sketchImportAbortController),this._sketchToolbar=r(this._sketchToolbar),void this.removeHandles(ye);if(this._sketchImportAbortController)return;const e=new AbortController;this._sketchImportAbortController=e;const t=await import("./Sketch.js");if(!e.signal.aborted)try{this._sketchToolbar=new t.default({toolbarKind:"docked",contextualToolLocation:"inline-end",scale:"s",suppressDeprecationWarning:!0,visibleElements:new re({deleteButton:!1,settingsMenu:!1,directionModePicker:!1,selectionCountLabel:!1,duplicateButton:!1,createTools:new se({freehandPolygon:!0,freehandPolyline:!0}),selectionTools:new oe({"lasso-selection":!1,"rectangle-selection":!1})})}),this.addHandles([c(()=>{const e=this.viewModel.activeLeafWorkflow;return e&&"availableCreateTools"in e?e.availableCreateTools:null},e=>{this._sketchToolbar&&(this._sketchToolbar.availableCreateTools=e)},d),c(()=>this.visibleElements.undoRedoButtons,e=>{this._sketchToolbar&&(this._sketchToolbar.visibleElements.undoRedoMenu=e)},d),m(()=>this.viewModel?.sketchViewModel,e=>{this._sketchToolbar&&(this._sketchToolbar.viewModel=e)},d),m(()=>this.viewModel.sketchViewModel?.pluginManager,e=>{e.sketch=this._sketchToolbar},d)],ye)}finally{this._sketchImportAbortController=null}}getHelpMessageString(e){const{messages:t,view:i}=this;if("curveToolDensifyWarning"===e)return t.curveToolDensifyWarning;return e?t["3d"===i?.type?"helpMessages3d":"helpMessages2d"]?.[e]:void 0}get test(){return{sketch:this._sketchToolbar,showPrompt:this._showPromptAndWait.bind(this)}}};e([p()],be.prototype,"_batchAttributeForm",void 0),e([p()],be.prototype,"_featureForm",void 0),e([p()],be.prototype,"_sketchToolbar",void 0),e([p()],be.prototype,"_attachments",void 0),e([p()],be.prototype,"_associationItemList",void 0),e([p()],be.prototype,"_associationSettings",void 0),e([p()],be.prototype,"_featureTemplates",void 0),e([p()],be.prototype,"_filterText",void 0),e([p()],be.prototype,"_hasInvalidBatchSelection",null),e([p()],be.prototype,"_hasSelectionFromMultipleLayers",null),e([p()],be.prototype,"_hasSelectionWithUneditableFeatures",null),e([p()],be.prototype,"_prompt",void 0),e([p()],be.prototype,"_spinner",void 0),e([p()],be.prototype,"_deleteButtonCommonInfo",null),e([p()],be.prototype,"_loading",void 0),e([p()],be.prototype,"_selectionCountExceedsMaximum",null),e([p()],be.prototype,"_selectionList",void 0),e([p()],be.prototype,"_selectionListItemActionConfigs",null),e([p()],be.prototype,"_selectionToolbar",void 0),e([p()],be.prototype,"_visibleSelectionCount",null),e([p({readOnly:!0})],be.prototype,"activeWorkflow",null),e([p()],be.prototype,"editorItems",null),e([p()],be.prototype,"effectiveSelectionManager",null),e([p()],be.prototype,"headingLevel",void 0),e([p()],be.prototype,"hideTemplatesForInactiveLayers",null),e([p()],be.prototype,"icon",null),e([p()],be.prototype,"label",null),e([p({type:w})],be.prototype,"labelOptions",null),e([p()],be.prototype,"layerInfos",null),e([p(),ue("esri/widgets/Editor/t9n/Editor")],be.prototype,"messages",void 0),e([p(),ue("esri/t9n/common")],be.prototype,"messagesCommon",void 0),e([p(),ue("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],be.prototype,"messagesTemplates",void 0),e([p(),ue("esri/widgets/Feature/t9n/Feature")],be.prototype,"messagesFeature",void 0),e([p()],be.prototype,"selectionManager",null),e([p({type:f})],be.prototype,"snappingOptions",null),e([p()],be.prototype,"syncWithViewSelectionManager",null),e([p()],be.prototype,"syncViewSelection",null),e([p({type:v})],be.prototype,"tooltipOptions",null),e([p()],be.prototype,"supportingWidgetDefaults",void 0),e([p({type:_,nonNullable:!0})],be.prototype,"valueOptions",null),e([p({value:!1})],be.prototype,"useLegacyCreateTools",null),e([p()],be.prototype,"isUsingLegacyCreateTools",null),e([p()],be.prototype,"view",null),e([p({type:C}),ge(["sketch-create","sketch-delete","sketch-update","workflow-cancel","workflow-commit"])],be.prototype,"viewModel",void 0),e([p({type:E,nonNullable:!0})],be.prototype,"visibleElements",void 0),e([p()],be.prototype,"_helpMessage",null),e([p()],be.prototype,"_noticeMessage",null),be=e([u("esri.widgets.Editor")],be);const ke=be;export{ke as default};
|