@arcgis/core 4.33.0-next.20250509 → 4.33.0-next.20250511
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/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06eb4832b6c86744e52e.js +1 -0
- package/assets/esri/core/workers/chunks/170c346cf5a18adb25b0.js +1 -0
- package/assets/esri/core/workers/chunks/253bcc3cc7bc4c2dc6ea.js +1 -0
- package/assets/esri/core/workers/chunks/{d874d24568b1acedebc4.js → 297d2c0a9d3f1e978318.js} +1 -1
- package/assets/esri/core/workers/chunks/4bd5cbf6e0be2fc7e84d.js +1 -0
- package/assets/esri/core/workers/chunks/{b1035bf4a016b1199236.js → 83d6a1b3db7d364d156b.js} +1 -1
- package/assets/esri/core/workers/chunks/{7ed9a9c33a08ebba5570.js → 92cbe9af8a6c061bfb57.js} +1 -1
- package/assets/esri/core/workers/chunks/a1d697e2be1e892a666a.js +1 -0
- package/assets/esri/core/workers/chunks/{61c74a733718d667b071.js → d551f70560a2b1ef5696.js} +1 -1
- package/assets/esri/core/workers/chunks/f6a1fec33b0d81acce61.js +1 -0
- package/core/has.js +1 -1
- package/core/sql/StandardizedFunctions.js +1 -1
- package/core/sql/WhereGrammar.js +1 -1
- package/geometry/support/meshUtils/External.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/interfaces.d.ts +340 -14
- package/layers/SceneLayer.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/graphics/sources/support/uploadAssets.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/support/meshFeatureSet.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
- package/views/3d/layers/i3s/I3SQueryResultGeometry.js +5 -0
- package/views/3d/webgl/ManagedFBOResource.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/interactive/keybindings.js +1 -1
- package/webdoc/IPSInfo.js +1 -1
- package/webdoc/ips/AppleIPSProperties.d.ts +4 -0
- package/webdoc/ips/AppleIPSProperties.js +5 -0
- package/webdoc/ips/Configuration.d.ts +4 -0
- package/webdoc/ips/Configuration.js +5 -0
- package/webdoc/ips/GNSSProperties.d.ts +4 -0
- package/webdoc/ips/GNSSProperties.js +5 -0
- package/webdoc/ips/PathSnappingProperties.d.ts +4 -0
- package/webdoc/ips/PathSnappingProperties.js +5 -0
- package/webdoc/ips/SmoothingProperties.d.ts +4 -0
- package/webdoc/ips/SmoothingProperties.js +5 -0
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/assets/esri/core/workers/chunks/46104db7f77952bb6c12.js +0 -1
- package/assets/esri/core/workers/chunks/47bbfc10c2a3b9e4bdd6.js +0 -1
- package/assets/esri/core/workers/chunks/49f0e53b3c9ba8451442.js +0 -1
- package/assets/esri/core/workers/chunks/5371df31553626528c69.js +0 -1
- package/assets/esri/core/workers/chunks/ad9bcd9dae45cdf90cbb.js +0 -1
- package/assets/esri/core/workers/chunks/c28d4717ed588c0d8bf1.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{destroyMaybe as t,removeMaybe as i}from"../../../../core/maybe.js";import{initial as s,watch as r,sync as a}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{t as c}from"../../../../chunks/boundedPlane.js";import{Deconflictor as n,DeconflictorGraphic as h}from"./Deconflictor.js";import{VisibilityGroup as l,VisibilityFlag as d}from"./enums.js";import{LabelDeconflictor as p}from"./LabelDeconflictor.js";import{TaskPriority as m}from"../../../support/Scheduler.js";let _=class extends n{constructor(){super(...arguments),this._contexts=new Map,this.visibilityGroup=l.GRAPHIC,this._marginFactor=-.1,this.test={overrideMarginFactor:e=>{this._marginFactor=e,this.setDirty()}}}get labels(){return this._labels}get viewState(){return this._viewState}initialize(){this._updatingHandles.add((()=>this.view?.state?.camera),(()=>{this._updateViewState(),this.setDirty()})),this._updatingHandles.add((()=>this.view?.slice?.plane),(()=>{this._updateSlicePlane(),this._slicePlaneChanged()}),s),this.addHandles(r((()=>this.view.allLayerViews.some((e=>e.updating))),((e,t)=>{!e&&t&&this.setDirty()}),a)),this._frameTask=this.view.resourceController.scheduler.registerTask(m.GRAPHICS_DECONFLICTOR,this),this._labels=new p({view:this.view,parent:this})}destroy(){this._labels=t(this._labels),this._frameTask=i(this._frameTask)}get marginFactor(){return this._marginFactor}setDirty(){this._contexts.size>0&&(super.setDirty(),this._labels.setDirty())}runTask(e){const t=super.runTask(e);return this.running||this._labels.setDirty(),t}_updateViewState(){this.view?.state&&(this._viewState.camera.copyFrom(this.view.state.camera),this._updateSlicePlane())}_updateSlicePlane(){const e=this.view?.slice?.plane;null!=e&&c(e,this._viewState.camera.viewMatrix,this._viewState.slicePlane),this._viewState.slicePlaneEnabled=null!=e}_slicePlaneChanged(){for(const e of this._contexts.keys())if(e.symbolCreationContext.slicePlaneEnabled)return void this.setDirty()}addGraphicsOwner(e){const t=this._getGraphicsContext(e);return{addGraphic:i=>this._addGraphic(e,t,i),removeGraphic:e=>this._removeGraphic(t,e),labelingInfoChange:()=>this._labelsEnabledChanged(e,t),featureReductionChange:()=>this._enabledChanged(e,t),slicePlaneEnabledChange:()=>this._slicePlaneEnabledChanged(e,t),clear:()=>t.forEach((e=>this._removeGraphic(t,e.graphics3DGraphic))),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._contexts.get(e);t&&(t.forEach((e=>this._removeGraphic(t,e.graphics3DGraphic))),this._contexts.delete(e),this.setDirty())}_addGraphic(e,t,i){const s=i.graphic.uid,r=new h(i,e.symbolCreationContext.slicePlaneEnabled);t.set(s,r),this.addToCheckOcclusion(r),u(e)&&this.addToActiveGraphics(r),e.labelsEnabled&&(this._labels.addToCheckOcclusion(r),this._labels.addToActiveGraphics(r));const a=!this._graphicSupportsDeconfliction(i)||!u(e);i.setVisibilityFlag(l.GRAPHIC,d.DECONFLICTION,a)}_removeGraphic(e,t){const i=t.graphic.uid,s=e.get(i);s&&(this.removeFromActiveGraphics(s),this.removeFromCheckOcclusion(s),this._labels.removeFromActiveGraphics(s),this._labels.removeFromCheckOcclusion(s),e.delete(i),this.setDirty())}_enabledChanged(e,t){u(e)?t.forEach((e=>this.addToActiveGraphics(e))):(t.forEach((e=>this.removeFromActiveGraphics(e))),b(e))}_labelsEnabledChanged(e,t){e.labelsEnabled?(t.forEach((e=>this._labels.addToCheckOcclusion(e))),t.forEach((e=>this._labels.addToActiveGraphics(e)))):(t.forEach((e=>this._labels.removeFromCheckOcclusion(e))),t.forEach((e=>this._labels.removeFromActiveGraphics(e))))}_slicePlaneEnabledChanged(e,t){const i=e.symbolCreationContext.slicePlaneEnabled;t.forEach((e=>e.slicePlaneEnabled=i)),this.setDirty()}_graphicSupportsDeconfliction(e){if(e.isDraped)return!1;const t=e.layers;if(!t?.length)return!1;for(const i of t)if(this.layerSupportsDeconfliction(i))return!0;return!1}_getGraphicsContext(e){const t=this._contexts.get(e);if(t)return t;const i=new Map;return this._contexts.set(e,i),this.setDirty(),i}};function u(e){const t=e.layer;return!(!t?.featureReduction||"selection"!==t.featureReduction.type)}function b(e){const t=e.graphics3DGraphics;t&&t.forEach((e=>e.setVisibilityFlag(l.GRAPHIC,d.DECONFLICTION,!0)))}_=e([o("esri.views.3d.layers.graphics.GraphicsDeconflictor")],_);export{_ as GraphicsDeconflictor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as r}from"../../../../chunks/tslib.es6.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{Deconflictor as s,State as e}from"./Deconflictor.js";import{VisibilityGroup as i}from"./enums.js";import{RenderState as c}from"../../../support/RenderState.js";import{Yield as n}from"../../../support/Yield.js";const p=2e3;let a=class extends s{constructor(r){super(r),this.visibilityGroup=i.LABEL,this.marginFactor=.05,this._lastDeconfliction=0}get viewState(){return this.parent.viewState}runTask(r){if(this.parent.running)return n;const t=performance.now();if(this.view.state.mode!==c.IDLE&&t-this._lastDeconfliction<p)return n;const o=super.runTask(r);return this.state===e.Idle&&(this._lastDeconfliction=t),o}};r([t({constructOnly:!0})],a.prototype,"parent",void 0),a=r([o("esri.views.3d.layers.graphics.LabelDeconflictor")],a);export{a as LabelDeconflictor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import i from"../../../../geometry/Extent.js";import{fallbackObjectIDAttribute as o}from"../../../../layers/LayerConstants.js";import{QueryEngine as a}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import y from"../../../../rest/support/FeatureSet.js";import c from"../../../../rest/support/Query.js";const l=a;let p=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.layerView.on("visible-geometry-changed",(()=>this.spatialIndex.events.emit("changed"))))}destroy(){this._dataQueryEngineInstance=r(this._dataQueryEngineInstance),this._set("layerView",null)}get spatialReference(){return this.layerView.view.spatialReference}get layer(){return this.layerView.i3slayer}get defaultQueryJSON(){return new c({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:r,extent:s}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:i.fromJSON(s)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQuery(e,t){const r=this._ensureQueryJSON(e),s=await this._dataQueryEngine.executeQuery(r,t);if(e?.returnGeometry){const{processQueryGeometries:e}=await import("./I3SQueryResultGeometry.js");return e(this.layerView,s)}return y.fromJSON(s)}_ensureQueryJSON(e){return null==e?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e=this.layer.objectIdField||o,t="esriGeometryPolygon",r=this.layer.fieldsIndex?.toJSON()||new u([]),s=this.layerView.view.resourceController.scheduler,n=this.spatialReference.toJSON(),i=this.priority,a=this.spatialIndex;return this._dataQueryEngineInstance=new l({hasZ:!0,hasM:!1,geometryType:t,fieldsIndex:r,timeInfo:null,spatialReference:n,objectIdField:e,featureStore:a,scheduler:s,priority:i}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],p.prototype,"layerView",void 0),e([s({constructOnly:!0})],p.prototype,"priority",void 0),e([s({constructOnly:!0})],p.prototype,"spatialIndex",void 0),e([s()],p.prototype,"spatialReference",null),e([s()],p.prototype,"layer",null),e([s()],p.prototype,"defaultQueryJSON",null),p=e([n("esri.views.3d.layers.i3s.I3SQueryEngine")],p);export{p as I3SQueryEngine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as t}from"../../../../geometry/support/aaBoundingBox.js";import{getCentroidOptimizedGeometry as e}from"../../../../layers/graphics/centroid.js";import r from"../../../../layers/graphics/OptimizedGeometry.js";import{getCachedAttributeValue as i}from"./I3SBinaryReader.js";class o{constructor(t){this._objectIdField=t.objectIdField,this._getFeatureExtent=t.getFeatureExtent}getObjectId(t){return t.id}getAttributes(t){const{meta:e,index:r}=t,o={};this._objectIdField&&(o[this._objectIdField]=t.id);const n=e.attributeInfo?.attributeData;if(null!=n)for(const s of Object.keys(n))o[s]=i(n[s],r);return o}getAttribute(t,e){if(e===this._objectIdField)return t.id;const{meta:r,index:o}=t,n=r.attributeInfo?.attributeData;return null!=n?i(n[e],o):null}getGeometry(t){if(t.geometry)return t.geometry;const[e,i,o,n,u]=this._getFeatureExtent(t,s);return new r([5],[e,i,o,n,i,o,n,
|
|
5
|
+
import{create as t}from"../../../../geometry/support/aaBoundingBox.js";import{getCentroidOptimizedGeometry as e}from"../../../../layers/graphics/centroid.js";import r from"../../../../layers/graphics/OptimizedGeometry.js";import{getCachedAttributeValue as i}from"./I3SBinaryReader.js";class o{constructor(t){this._objectIdField=t.objectIdField,this._getFeatureExtent=t.getFeatureExtent}getObjectId(t){return t.id}getAttributes(t){const{meta:e,index:r}=t,o={};this._objectIdField&&(o[this._objectIdField]=t.id);const n=e.attributeInfo?.attributeData;if(null!=n)for(const s of Object.keys(n))o[s]=i(n[s],r);return o}getAttribute(t,e){if(e===this._objectIdField)return t.id;const{meta:r,index:o}=t,n=r.attributeInfo?.attributeData;return null!=n?i(n[e],o):null}getGeometry(t){if(t.geometry)return t.geometry;const[e,i,o,n,a,u]=this._getFeatureExtent(t,s);return new r([5,5],[e,i,o,n,i,o,n,a,o,e,a,o,e,i,o,e,i,u,n,i,u,n,a,u,e,a,u,e,i,u])}getCentroid(t,i){if(t.geometry)return e(new r,t.geometry,i.hasZ,i.hasM);const[o,n,a,u,d,c]=this._getFeatureExtent(t,s);return new r([0],[(o+u)/2,(n+d)/2,(a+c)/2])}cloneWithGeometry(t,e){const{id:r,index:i,meta:o}=t;return new n(r,i,o,e)}getMetadata(t){return t}}class n{constructor(t,e,r,i){this.id=t,this.index=e,this.meta=r,this.geometry=i}get usedMemory(){return 32+(this.geometry?.usedMemory??0)}}const s=t();export{n as I3SQueryFeature,o as I3SQueryFeatureAdapter};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import e from"../../../../core/Error.js";import t from"../../../../geometry/Mesh.js";import o from"../../../../geometry/SpatialReference.js";import{projectBuffer as r}from"../../../../geometry/projection/projectBuffer.js";import{fromJSON as n}from"../../../../geometry/support/jsonUtils.js";import s from"../../../../geometry/support/MeshGeoreferencedVertexSpace.js";import{MeshVertexAttributes as a}from"../../../../geometry/support/MeshVertexAttributes.js";import{b as i,a as m}from"../../../../chunks/vec3.js";import{Metadata as c}from"../../../../geometry/support/meshUtils/Metadata.js";import p from"../../../../rest/support/FeatureSet.js";function f(e,r){const a=new Array,i=o.fromJSON(r.spatialReference);for(const o of r.features){const r=o.metadata,m=n(o.geometry);if(!r||!m){a.push(null);continue}m.spatialReference=i;const p=m.extent,f=new c,d=r.meta.node.index,u=r.index;f.externalSources.add({extent:p,source:{type:"loadable",load:t=>l(e,t,d,u)}});const y=new t({metadata:f,vertexSpace:new s,spatialReference:i});a.push(y),o.geometry=null}const m=p.fromJSON(r);for(let t=0;t<m.features.length;t++){const e=m.features[t],o=a[t];e.geometry=o}return m}async function l(t,o,n,s){const c=t.getNodeComponentHandle(n);if(!c?.intersectionGeometry)throw new e("i3s-layer-view-geometry-missing","Cannot load mesh because scene layer view data is no longer available.");const p={indices:null,data:null,stride:0,startIndex:0,endIndex:0};c.intersectionGeometry.getComponentPositions(s,p);const{indices:f,data:l,stride:d,startIndex:u,endIndex:y}=p,g=new Float64Array(3*(y-u));let x=0;for(let e=u;e<y;e+=3){const t=d*f[e],o=d*f[e+1],r=d*f[e+2];g[x++]=l[t],g[x++]=l[t+1],g[x++]=l[t+2],g[x++]=l[o],g[x++]=l[o+1],g[x++]=l[o+2],g[x++]=l[r],g[x++]=l[r+1],g[x++]=l[r+2]}const j=c.transform;i(g,g,j.rotationScale),m(g,g,j.position),r(g,t.view.renderSpatialReference,0,g,o.spatialReference,0),o.vertexAttributes=new a({position:g})}export{f as processQueryGeometries};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class e{constructor(e,t){this.key=e,this.
|
|
5
|
+
class e{constructor(e,t){this.key=e,this._free=t,this.incarnation=0,this._refCount=1}retain(e=1){this._refCount+=e}release(){return 0===this._refCount?(console.log(`Releasing already released FBO attachment "${this.name}" in ${(new Error).stack}`),!0):(--this._refCount,0===this._refCount&&(this._free(),!0))}}var t;!function(e){e[e.FBO=0]="FBO",e[e.DEPTH=1]="DEPTH",e[e.COLOR=2]="COLOR"}(t||(t={}));export{t as AttachmentType,e as ManagedFBOResource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as e,destroyMaybe as i}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{multiply as o,fromTranslation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as u,a as p}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as a}from"../../webgl.js";import f from"../../webgl/RenderNode.js";import{ColorFormat as _}from"../core/FBOCacheFormats.js";import{
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as e,destroyMaybe as i}from"../../../../core/maybe.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{multiply as o,fromTranslation as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{i as u,a as p}from"../../../../chunks/vec32.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{RenderCategory as a}from"../../webgl.js";import f from"../../webgl/RenderNode.js";import{ColorFormat as _}from"../core/FBOCacheFormats.js";import{RenderRequestType as l}from"./basicInterfaces.js";import{Default3D as d}from"./DefaultVertexAttributeLocations.js";import{TaskPriority as m}from"../../../support/Scheduler.js";import{Yield as g}from"../../../support/Yield.js";import{PixelFormat as x,PixelType as v,TextureSamplingMode as w}from"../../../webgl/enums.js";import{makePipelineState as j,defaultColorWrite as y}from"../../../webgl/renderState.js";import{Sync as T}from"../../../webgl/Sync.js";import{Texture as b}from"../../../webgl/Texture.js";import{TextureDescriptor as P}from"../../../webgl/TextureDescriptor.js";let B=class extends f{constructor(){super(...arguments),this.produces=a.COMPOSITE,this.consumes={required:[a.COMPOSITE]},this.running=!1,this.done=!0,this._startQuery=!1,this._origin=c(),this._textureWidth=256,this._uploadBuffer=new Float32Array(3*this._textureWidth),this._counter=0,this._width=0,this._height=0,this._pipeline=j({colorWrite:y})}initialize(){this.view.resourceController.scheduler.registerTask(m.GRAPHICS_CORE,this)}destroy(){this._program=e(this._program);const t=this.gl;this._sync=i(this._sync),this._pixelBuffer&&(t.deleteBuffer(this._pixelBuffer),this._pixelBuffer=null),this._texture=e(this._texture)}precompile(){this._startQuery&&this._ensureShader(this.renderingContext)}render(t){const e=t.find((({name:t})=>t===a.COMPOSITE));if(this._sync||!this._startQuery)return e;this._startQuery=!1;const i=this.renderingContext,r=this.gl,s=e.getTexture(r.DEPTH_STENCIL_ATTACHMENT);if(!s)return e;const h=this.view.stage.renderer.fboCache.acquire(this._width,this._height,"hud visibility",_.R32FLOAT);i.bindFramebuffer(h.fbo),i.setPipelineState(this._pipeline);const u=this._ensureShader(i);i.useProgram(u);const p=0;i.bindTexture(s,p),u.setUniform1i("depthTex",p);const c=1;return i.bindTexture(this._texture,c),u.setUniform1i("positionTex",c),o(A,this.camera.viewMatrix,n(A,this._origin)),u.setUniformMatrix4fv("view",A),u.setUniformMatrix4fv("proj",this.camera.projectionMatrix),u.setUniform1i("count",this._counter),i.screen.draw(),this._pixelBuffer||(this._pixelBuffer=r.createBuffer()),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pixelBuffer),r.bufferData(r.PIXEL_PACK_BUFFER,4*this._width*this._height,r.STREAM_READ),r.readPixels(0,0,this._width,this._height,r.RED,r.FLOAT,0),this._sync=new T(r),h.release(),setTimeout((()=>this.running=!0),0),e}runTask(){if(!this._sync)return void(this.running=!1);try{if(!this._sync.poll())return g}catch(e){return this.running=!1,void(this._sync=i(this._sync))}this.running=!1,this._sync=i(this._sync);const t=this.gl;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pixelBuffer),this._cpuBuffer=new Float32Array(this._width*this._height),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._cpuBuffer),t.bindBuffer(t.PIXEL_PACK_BUFFER,null),this.done=!0}init(t,e){const i=this._textureWidth;if(this._width=i,this._height=Math.ceil(t/i),this._counter=0,this._texture?.dispose(),0===this._height)return;const r=new P(this._width,this._height);r.pixelFormat=x.RGB,r.dataType=v.FLOAT,r.samplingMode=w.NEAREST,this._texture=new b(this.renderingContext,r),this.done=!1,u(this._origin,Math.fround(e[0]),Math.fround(e[1]),Math.fround(e[2]))}addPosition(t){const e=this._width;if(this._counter>=e*this._height)return-1;const i=this._counter%e;return p(F,t,this._origin),this._uploadBuffer[3*i+0]=F[0],this._uploadBuffer[3*i+1]=F[1],this._uploadBuffer[3*i+2]=F[2],i===e-1&&this._flush(),this._counter++}start(){if(0===this._width||0===this._height)return;const t=this._width;this._counter%t>0&&this._flush(),this._startQuery=!0,this.requestRender(l.UPDATE)}getOcclusion(t){return this._cpuBuffer?.[t]??-1}_flush(){const t=this._width,e=Math.floor(this._counter/t);this._texture?.updateData(0,0,e,t,1,this._uploadBuffer)}_ensureShader(t){return null!=this._program||(this._program=t.programCache.acquire(C,E,d)),this._program}};t([r()],B.prototype,"running",void 0),t([r()],B.prototype,"done",void 0),B=t([s("esri.views.3d.webgl-engine.lib.GPUPointOcclusionQuery")],B);const C="#version 300 es\nprecision highp float;\nin vec2 position;\n\nvoid main() {\n gl_Position = vec4(position, 0.0, 1.0);\n}",E="#version 300 es\nprecision highp float;\nout highp vec4 fragColor;\n\nuniform highp mat4 proj;\nuniform highp mat4 view;\n\nuniform highp int count;\n\nuniform highp sampler2D depthTex;\nuniform highp sampler2D positionTex;\n\nfloat linearizeDepth(float depth) {\n float depthNdc = depth * 2.0 - 1.0;\n float c1 = proj[3][2];\n float c2 = proj[2][2];\n return -c1 / (depthNdc + c2 + 1e-7);\n}\n\nvoid main() {\n int u = int(floor(gl_FragCoord.x));\n int v = int(floor(gl_FragCoord.y));\n if (u + v * textureSize(positionTex, 0).x >= count) {\n fragColor = vec4(-1);\n return;\n }\n vec4 posWorld = vec4(texelFetch(positionTex, ivec2(u, v), 0).rgb, 1.0);\n\n vec4 posView = view * posWorld;\n vec4 projected = proj * posView;\n\n vec3 clipPos = projected.xyz / projected.w;\n\n if (clipPos.x < -1.0 || clipPos.x > 1.0 || clipPos.y < -1.0 || clipPos.y > 1.0) {\n fragColor = vec4(-1);\n return;\n }\n\n vec3 uvDepth = 0.5 * clipPos + vec3(0.5);\n\n float depth = texture(depthTex, uvDepth.xy).r;\n\n if (uvDepth.z <= depth) {\n fragColor = vec4(0);\n return;\n }\n\n fragColor = vec4(linearizeDepth(depth) - linearizeDepth(uvDepth.z));\n}\n",F=c(),A=h();export{B as GPUPointOcclusionQuery};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
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{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,g as m,c as d,l as g,j as O,f as T,o as S,e as b}from"../../../../chunks/vec32.js";import{create as v,fromValues as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as E,create as R,freeze as I}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as x}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as F}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as P,BufferViewVec3f as _,BufferViewFloat as C,BufferViewVec2f as y,BufferViewVec4f as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as L}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as N}from"../../support/debugFlags.js";import{newLayout as j}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as U,isColorOrColorEmission as z}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as M}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as w}from"../effects/geometry/olidUtils.js";import{GLTextureMaterialBindParameters as B,GLTextureMaterial as V}from"../lib/GLTextureMaterial.js";import{Material as X,RenderOccludedFlag as q}from"../lib/Material.js";import{RenderSlot as G}from"../lib/RenderSlot.js";import{applyScaleFactor as H,applyPrecomputedScaleFactor as W,precomputeScaleFactor as Y}from"../lib/screenSizePerspectiveUtils.js";import{assert as Z}from"../lib/Util.js";import{VertexAttribute as k}from"../lib/VertexAttribute.js";import{ScaleInfo as J}from"./ScaleInfo.js";import{writePosition as K,writeNormal as Q,writeColor as $,writeBufferFloat as ee,writeBufferVec4 as te,writeBufferVec4Zeros as ie,writeOlidColor as se}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as re}from"./internal/MaterialUtil.js";import{c as ae,f as ne}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as oe}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as le}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ce}from"../../../../webscene/support/AlphaCutoff.js";class fe extends X{constructor(e,t){super(e,ze),this.produces=new Map([[G.HUD_MATERIAL,e=>U(e)&&!this.parameters.drawAsLabel],[G.LABEL_MATERIAL,e=>U(e)&&this.parameters.drawAsLabel],[G.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[G.DRAPED_MATERIAL,e=>this.parameters.draped&&U(e)]]),this._visible=!0,this._configuration=new le(t)}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.occlusionTestEnabled=this.parameters.occlusionTest,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.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===G.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===G.OCCLUSION_PIXELS,z(e)&&(this._configuration.debugDrawLabelBorder=!!N.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:S,camera:b}=s,{parameters:A}=this;if(!l||!c||T&&A.isLabel||!e.visible||!S||!b)return;const R=e.attributes.get(k.FEATUREATTRIBUTE),I=null==R?null:E(R.data,Ce),{scaleX:x,scaleY:F}=Ve(I,A,b.pixelRatio);i(Re,t),e.attributes.has(k.FEATUREATTRIBUTE)&&me(Re);const P=e.attributes.get(k.POSITION),_=e.attributes.get(k.SIZE),C=e.attributes.get(k.NORMAL),y=e.attributes.get(k.ROTATION),D=e.attributes.get(k.CENTEROFFSETANDDISTANCE);Z(P.size>=3);const L=ae(A),N="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<P.data.length/P.size;i++){const e=i*P.size;f(Oe,P.data[e],P.data[e+1],P.data[e+2]),u(Oe,Oe,t),u(Oe,Oe,b.viewMatrix);const a=i*D.size;if(f(Pe,D.data[a],D.data[a+1],D.data[a+2]),!N&&(Oe[0]+=Pe[0],Oe[1]+=Pe[1],0!==Pe[2])){const e=Pe[2];p(Pe,Oe),h(Oe,Oe,m(Pe,Pe,e))}const n=i*C.size;if(f(Te,C.data[n],C.data[n+1],C.data[n+2]),he(Te,Re,b,ye),Xe(this.parameters,Oe,ye,b,ge),b.applyProjection(Oe,Se),Se[0]>-1){N&&(Pe[0]||Pe[1])&&(Se[0]+=Pe[0]*b.pixelRatio,0!==Pe[1]&&(Se[1]+=H(Pe[1],ge.factorAlignment)*b.pixelRatio),b.unapplyProjection(Se,Oe)),Se[0]+=this.parameters.screenOffset[0]*b.pixelRatio,Se[1]+=this.parameters.screenOffset[1]*b.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]);const e=i*_.size;Ne[0]=_.data[e],Ne[1]=_.data[e+1],W(Ne,ge.factor,Ne);const t=De*b.pixelRatio;let a=0;if(A.textureIsSignedDistanceField){a=Math.min(A.outlineSize,.5*Ne[0])*b.pixelRatio/2}Ne[0]*=x,Ne[1]*=F;const n=i*y.size,l=A.rotation+y.data[n];if(de(S,Se[0],Se[1],Ne,t,a,l,A,L)){const e=s.ray;if(u(ve,Oe,r(xe,b.viewMatrix)),Se[0]=S[0],Se[1]=S[1],b.unprojectFromRenderScreen(Se,Oe)){const t=v();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Oe)*i,t,-1,ve)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get(k.POSITION),n=e.attributes.get(k.SIZE),o=e.attributes.get(k.ROTATION),l=this.parameters,c=ae(l),f=e.attributes.get(k.FEATUREATTRIBUTE),u=null==f?null:E(f.data,Ce),{scaleX:p,scaleY:h}=Ve(u,l,e.screenToWorldRatio),m=Le*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,f=a.data[t],u=a.data[t+1],g=d*n.size;Ne[0]=n.data[g],Ne[1]=n.data[g+1];let O=0;if(l.textureIsSignedDistanceField){O=Math.min(l.outlineSize,.5*Ne[0])*e.screenToWorldRatio/2}Ne[0]*=p,Ne[1]*=h;const T=d*o.size,S=l.rotation+o.data[T];de(i,f,u,Ne,m,O,S,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Be}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=he(t,i,r,ye);return this._applyVerticalGroundOffsetView(e,o,r,n),Xe(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_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 d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*M,o=m(Oe,t.normal,a*n);return T(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Te,i),T(i,i,m(Te,Te,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(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&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);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]>=ce||t>=ce&&i[3]>=ce;return this._visible&&s}createGLMaterial(e){return new ue(e)}calculateRelativeScreenBounds(e,t,i=F()){return pe(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class ue extends V{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(oe,e)}}function pe(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 he(e,t,s,r){return x(t)&&(t=i(Ie,t)),S(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=b(be,Ue),r}function me(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function de(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(Ee,i,s),o(Ae,e,Ee,t(c)),Ae[0]>p&&Ae[0]<h&&Ae[1]>m&&Ae[1]<d}const ge=new J,Oe=v(),Te=v(),Se=R(),be=v(),ve=v(),Ae=c(),Ee=c(),Re=s(),Ie=s(),xe=a(),Fe=R(),Pe=v(),_e=v(),Ce=R(),ye={normal:be,cosAngle:0},De=1,Le=2,Ne=l(0,0),je=6,Ue=A(0,0,1);class ze extends B{constructor(){super(...arguments),this.renderOccluded=q.Occlude,this.isDecoration=!1,this.color=I(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=I(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=R(),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.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusEffect="none",this.draped=!1,this.isLabel=!1}}const Me=j().vec3f(k.POSITION).vec3f(k.NORMAL).vec2i16(k.UVI).vec4u8(k.COLOR).vec2f(k.SIZE).f32(k.ROTATION).vec4f(k.CENTEROFFSETANDDISTANCE).vec4f(k.FEATUREATTRIBUTE),we=Me.clone().vec4u8(k.OLIDCOLOR);class Be{constructor(){this.vertexBufferLayout=w()?we:Me}elementCount(e){return e.get(k.POSITION).indices.length*je}write(e,t,i,s,r,a){const{position:n,normal:o,uvi:l,color:c,size:f,rotation:u,centerOffsetAndDistance:p,featureAttribute:h}=r;K(i.get(k.POSITION),e,n,a,je),Q(i.get(k.NORMAL),t,o,a,je);const m=i.get(k.UVI)?.data;let d=0,g=0,O=-1-ne,T=-1-ne;m&&m.length>=4&&(d=m[0],g=m[1],O=-1-m[2],T=-1-m[3]);let S=i.get(k.POSITION).indices.length,b=a;for(let E=0;E<S;++E)l.set(b,0,d),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,g),b++;$(i.get(k.COLOR),4,c,a,je);const{data:v,indices:A}=i.get(k.SIZE);S=A.length,b=a;for(let E=0;E<S;++E){const e=v[2*A[E]],t=v[2*A[E]+1];for(let i=0;i<je;++i)f.set(b,0,e),f.set(b,1,t),b++}if(ee(i.get(k.ROTATION),u,a,je),i.get(k.CENTEROFFSETANDDISTANCE)?te(i.get(k.CENTEROFFSETANDDISTANCE),p,a,je):ie(p,a,S*je),i.get(k.FEATUREATTRIBUTE)?te(i.get(k.FEATUREATTRIBUTE),h,a,je):ie(h,a,S*je),null!=s){const e=i.get(k.POSITION)?.indices;if(e){const t=e.length,i=r.getField(k.OLIDCOLOR,P);se(s,i,t,a,je)}}return{numVerticesPerItem:je,numItems:S}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:b,camera:A}=s;if(!l||!c||S&&t.isLabel||!b)return;const E=this.vertexBufferLayout.createView(e),R=E.getField(k.POSITION,_),I=E.getField(k.NORMAL,_),x=E.getField(k.ROTATION,C),F=E.getField(k.SIZE,y),P=E.getField(k.FEATUREATTRIBUTE,D),L=E.getField(k.CENTEROFFSETANDDISTANCE,D),N="screen"===t.centerOffsetUnits,j=ae(t);if(null==R||null==I||null==x||null==F||null==L||null==A)return;const U=null==P?null:P.getVec(0,Ce),{scaleX:z,scaleY:M}=Ve(U,t,A.pixelRatio),w=R.count/je;for(let _=0;_<w;_++){const e=_*je;if(R.getVec(e,Oe),null!=i&&T(Oe,Oe,i),u(Oe,Oe,A.viewMatrix),L.getVec(e,Fe),f(Pe,Fe[0],Fe[1],Fe[2]),!N&&(Oe[0]+=Pe[0],Oe[1]+=Pe[1],0!==Pe[2])){const e=Pe[2];p(Pe,Oe),h(Oe,Oe,m(Pe,Pe,e))}if(I.getVec(e,Te),he(Te,Re,A,ye),Xe(t,Oe,ye,A,ge),A.applyProjection(Oe,Se),Se[0]>-1){N&&(Pe[0]||Pe[1])&&(Se[0]+=Pe[0]*A.pixelRatio,0!==Pe[1]&&(Se[1]+=H(Pe[1],ge.factorAlignment)*A.pixelRatio),A.unapplyProjection(Se,Oe)),Se[0]+=t.screenOffset[0]*A.pixelRatio,Se[1]+=t.screenOffset[1]*A.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),F.getVec(e,Ne),W(Ne,ge.factor,Ne);const i=De*A.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*Ne[0])*A.pixelRatio/2}Ne[0]*=z,Ne[1]*=M;const n=x.get(e),l=t.rotation+n;if(de(b,Se[0],Se[1],Ne,i,a,l,t,j)){const e=s.ray;if(u(ve,Oe,r(xe,A.viewMatrix)),Se[0]=b[0],Se[1]=b[1],A.unprojectFromRenderScreen(Se,Oe)){const t=v();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Oe)*i,t,_,ve)}}}}}}function Ve(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(L(_e,t,e),{scaleX:_e[0]*i,scaleY:_e[1]*i})}function Xe(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){qe(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=re(s,a,e.verticalOffset,i.cosAngle,n);return qe(e,r,a,i.cosAngle),m(i.normal,i.normal,o),T(t,t,i.normal)}function qe(e,t,i,s){null!=e.screenSizePerspective?Y(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Y(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{fe as HUDMaterial,ze as Parameters};
|
|
5
|
+
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{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as f,t as u,n as p,d as h,g as m,c as d,l as g,j as O,f as T,a as S,o as b,e as v}from"../../../../chunks/vec32.js";import{create as A,fromValues as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as R,create as I,freeze as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as F}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as P}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as _,BufferViewVec3f as C,BufferViewFloat as y,BufferViewVec2f as D,BufferViewVec4f as L}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as N}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as j}from"../../support/debugFlags.js";import{newLayout as U}from"../../support/buffer/InterleavedLayout.js";import{isColorEmissionHighlightOrOID as z,isColorOrColorEmission as M}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as w}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as B}from"../effects/geometry/olidUtils.js";import{GLTextureMaterialBindParameters as V,GLTextureMaterial as X}from"../lib/GLTextureMaterial.js";import{Material as q,RenderOccludedFlag as G}from"../lib/Material.js";import{RenderSlot as H}from"../lib/RenderSlot.js";import{applyScaleFactor as W,applyPrecomputedScaleFactor as Y,precomputeScaleFactor as Z}from"../lib/screenSizePerspectiveUtils.js";import{assert as k}from"../lib/Util.js";import{VertexAttribute as J}from"../lib/VertexAttribute.js";import{ScaleInfo as K}from"./ScaleInfo.js";import{writePosition as Q,writeNormal as $,writeColor as ee,writeBufferFloat as te,writeBufferVec4 as ie,writeBufferVec4Zeros as se,writeOlidColor as re}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ae}from"./internal/MaterialUtil.js";import{c as ne,f as oe}from"../../../../chunks/HUDMaterial.glsl.js";import{HUDMaterialTechnique as le}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ce}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as fe}from"../../../../webscene/support/AlphaCutoff.js";class ue extends q{constructor(e,t){super(e,Me),this.produces=new Map([[H.HUD_MATERIAL,e=>z(e)&&!this.parameters.drawAsLabel],[H.LABEL_MATERIAL,e=>z(e)&&this.parameters.drawAsLabel],[H.OCCLUSION_PIXELS,()=>this.parameters.occlusionTest],[H.DRAPED_MATERIAL,e=>this.parameters.draped&&z(e)]]),this._visible=!0,this._configuration=new ce(t)}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.occlusionTestEnabled=this.parameters.occlusionTest,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.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.occlusionPass=t.slot===H.OCCLUSION_PIXELS,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||t.slot===H.OCCLUSION_PIXELS,M(e)&&(this._configuration.debugDrawLabelBorder=!!j.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:T},point:S,camera:b}=s,{parameters:v}=this;if(!l||!c||T&&v.isLabel||!e.visible||!S||!b)return;const E=e.attributes.get(J.FEATUREATTRIBUTE),I=null==E?null:R(E.data,ye),{scaleX:x,scaleY:F}=Xe(I,v,b.pixelRatio);i(Ie,t),e.attributes.has(J.FEATUREATTRIBUTE)&&de(Ie);const P=e.attributes.get(J.POSITION),_=e.attributes.get(J.SIZE),C=e.attributes.get(J.NORMAL),y=e.attributes.get(J.ROTATION),D=e.attributes.get(J.CENTEROFFSETANDDISTANCE);k(P.size>=3);const L=ne(v),N="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<P.data.length/P.size;i++){const e=i*P.size;f(Te,P.data[e],P.data[e+1],P.data[e+2]),u(Te,Te,t),u(Te,Te,b.viewMatrix);const a=i*D.size;if(f(_e,D.data[a],D.data[a+1],D.data[a+2]),!N&&(Te[0]+=_e[0],Te[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,Te),h(Te,Te,m(_e,_e,e))}const n=i*C.size;if(f(Se,C.data[n],C.data[n+1],C.data[n+2]),me(Se,Ie,b,De),qe(this.parameters,Te,De,b,Oe),b.applyProjection(Te,be),be[0]>-1){N&&(_e[0]||_e[1])&&(be[0]+=_e[0]*b.pixelRatio,0!==_e[1]&&(be[1]+=W(_e[1],Oe.factorAlignment)*b.pixelRatio),b.unapplyProjection(be,Te)),be[0]+=this.parameters.screenOffset[0]*b.pixelRatio,be[1]+=this.parameters.screenOffset[1]*b.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]);const e=i*_.size;je[0]=_.data[e],je[1]=_.data[e+1],Y(je,Oe.factor,je);const t=Le*b.pixelRatio;let a=0;if(v.textureIsSignedDistanceField){a=Math.min(v.outlineSize,.5*je[0])*b.pixelRatio/2}je[0]*=x,je[1]*=F;const n=i*y.size,l=v.rotation+y.data[n];if(ge(S,be[0],be[1],je,t,a,l,v,L)){const e=s.ray;if(u(Ae,Te,r(Fe,b.viewMatrix)),be[0]=S[0],be[1]=S[1],b.unprojectFromRenderScreen(be,Te)){const t=A();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Te)*i,t,-1,Ae)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get(J.POSITION),n=e.attributes.get(J.SIZE),o=e.attributes.get(J.ROTATION),l=this.parameters,c=ne(l),f=e.attributes.get(J.FEATUREATTRIBUTE),u=null==f?null:R(f.data,ye),{scaleX:p,scaleY:h}=Xe(u,l,e.screenToWorldRatio),m=Ne*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,f=a.data[t],u=a.data[t+1],g=d*n.size;je[0]=n.data[g],je[1]=n.data[g+1];let O=0;if(l.textureIsSignedDistanceField){O=Math.min(l.outlineSize,.5*je[0])*e.screenToWorldRatio/2}je[0]*=p,je[1]*=h;const T=d*o.size,S=l.rotation+o.data[T];ge(i,f,u,je,m,O,S,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new Ve}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=me(t,i,r,De);return this._applyVerticalGroundOffsetView(e,o,r,n),qe(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_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 d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?f:1/f),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*w,o=m(Te,t.normal,a*n);return T(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(Se,i),S(i,i,m(Se,Se,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(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&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);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]>=fe||t>=fe&&i[3]>=fe;return this._visible&&s}createGLMaterial(e){return new pe(e)}calculateRelativeScreenBounds(e,t,i=P()){return he(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class pe extends X{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(le,e)}}function he(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 me(e,t,s,r){return F(t)&&(t=i(xe,t)),b(r.normal,e,t),u(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=v(ve,ze),r}function de(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],f=1/Math.sqrt(t*t+i*i+s*s),u=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*f,e[1]=i*f,e[2]=s*f,e[3]=r*u,e[4]=a*u,e[5]=n*u,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function ge(e,i,s,r,a,l,c,f,u){let p=i-a-r[0]*u[0],h=p+r[0]+2*a,m=s-a-r[1]*u[1],d=m+r[1]+2*a;const g=f.distanceFieldBoundingBox;return f.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(Re,i,s),o(Ee,e,Re,t(c)),Ee[0]>p&&Ee[0]<h&&Ee[1]>m&&Ee[1]<d}const Oe=new K,Te=A(),Se=A(),be=I(),ve=A(),Ae=A(),Ee=c(),Re=c(),Ie=s(),xe=s(),Fe=a(),Pe=I(),_e=A(),Ce=A(),ye=I(),De={normal:ve,cosAngle:0},Le=1,Ne=2,je=l(0,0),Ue=6,ze=E(0,0,1);class Me extends V{constructor(){super(...arguments),this.renderOccluded=G.Occlude,this.isDecoration=!1,this.color=x(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=x(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=I(),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.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusEffect="none",this.draped=!1,this.isLabel=!1}}const we=U().vec3f(J.POSITION).vec3f(J.NORMAL).vec2i16(J.UVI).vec4u8(J.COLOR).vec2f(J.SIZE).f32(J.ROTATION).vec4f(J.CENTEROFFSETANDDISTANCE).vec4f(J.FEATUREATTRIBUTE),Be=we.clone().vec4u8(J.OLIDCOLOR);class Ve{constructor(){this.vertexBufferLayout=B()?Be:we}elementCount(e){return e.get(J.POSITION).indices.length*Ue}write(e,t,i,s,r,a){const{position:n,normal:o,uvi:l,color:c,size:f,rotation:u,centerOffsetAndDistance:p,featureAttribute:h}=r;Q(i.get(J.POSITION),e,n,a,Ue),$(i.get(J.NORMAL),t,o,a,Ue);const m=i.get(J.UVI)?.data;let d=0,g=0,O=-1-oe,T=-1-oe;m&&m.length>=4&&(d=m[0],g=m[1],O=-1-m[2],T=-1-m[3]);let S=i.get(J.POSITION).indices.length,b=a;for(let E=0;E<S;++E)l.set(b,0,d),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,g),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,O),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,T),b++,l.set(b,0,d),l.set(b,1,g),b++;ee(i.get(J.COLOR),4,c,a,Ue);const{data:v,indices:A}=i.get(J.SIZE);S=A.length,b=a;for(let E=0;E<S;++E){const e=v[2*A[E]],t=v[2*A[E]+1];for(let i=0;i<Ue;++i)f.set(b,0,e),f.set(b,1,t),b++}if(te(i.get(J.ROTATION),u,a,Ue),i.get(J.CENTEROFFSETANDDISTANCE)?ie(i.get(J.CENTEROFFSETANDDISTANCE),p,a,Ue):se(p,a,S*Ue),i.get(J.FEATUREATTRIBUTE)?ie(i.get(J.FEATUREATTRIBUTE),h,a,Ue):se(h,a,S*Ue),null!=s){const e=i.get(J.POSITION)?.indices;if(e){const t=e.length,i=r.getField(J.OLIDCOLOR,_);re(s,i,t,a,Ue)}}return{numVerticesPerItem:Ue,numItems:S}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:S},point:b,camera:v}=s;if(!l||!c||S&&t.isLabel||!b)return;const E=this.vertexBufferLayout.createView(e),R=E.getField(J.POSITION,C),I=E.getField(J.NORMAL,C),x=E.getField(J.ROTATION,y),F=E.getField(J.SIZE,D),P=E.getField(J.FEATUREATTRIBUTE,L),_=E.getField(J.CENTEROFFSETANDDISTANCE,L),N="screen"===t.centerOffsetUnits,j=ne(t);if(null==R||null==I||null==x||null==F||null==_||null==v)return;const U=null==P?null:P.getVec(0,ye),{scaleX:z,scaleY:M}=Xe(U,t,v.pixelRatio),w=R.count/Ue;for(let C=0;C<w;C++){const e=C*Ue;if(R.getVec(e,Te),null!=i&&T(Te,Te,i),u(Te,Te,v.viewMatrix),_.getVec(e,Pe),f(_e,Pe[0],Pe[1],Pe[2]),!N&&(Te[0]+=_e[0],Te[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,Te),h(Te,Te,m(_e,_e,e))}if(I.getVec(e,Se),me(Se,Ie,v,De),qe(t,Te,De,v,Oe),v.applyProjection(Te,be),be[0]>-1){N&&(_e[0]||_e[1])&&(be[0]+=_e[0]*v.pixelRatio,0!==_e[1]&&(be[1]+=W(_e[1],Oe.factorAlignment)*v.pixelRatio),v.unapplyProjection(be,Te)),be[0]+=t.screenOffset[0]*v.pixelRatio,be[1]+=t.screenOffset[1]*v.pixelRatio,be[0]=Math.floor(be[0]),be[1]=Math.floor(be[1]),F.getVec(e,je),Y(je,Oe.factor,je);const i=Le*v.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*je[0])*v.pixelRatio/2}je[0]*=z,je[1]*=M;const n=x.get(e),l=t.rotation+n;if(ge(b,be[0],be[1],je,i,a,l,t,j)){const e=s.ray;if(u(Ae,Te,r(Fe,v.viewMatrix)),be[0]=b[0],be[1]=b[1],v.unprojectFromRenderScreen(be,Te)){const t=A();d(t,e.direction);const i=1/g(t);m(t,t,i);o(O(e.origin,Te)*i,t,C,Ae)}}}}}}function Xe(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(N(Ce,t,e),{scaleX:Ce[0]*i,scaleY:Ce[1]*i})}function qe(e,t,i,s,r){if(!e.verticalOffset?.screenLength){if(e.screenSizePerspective||e.screenSizePerspectiveAlignment){Ge(e,r,g(t),i.cosAngle)}else r.factor.scale=1,r.factorAlignment.scale=1;return t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ae(s,a,e.verticalOffset,i.cosAngle,n);return Ge(e,r,a,i.cosAngle),m(i.normal,i.normal,o),T(t,t,i.normal)}function Ge(e,t,i,s){null!=e.screenSizePerspective?Z(s,i,e.screenSizePerspective,t.factor):(t.factor.scale=1,t.factor.factor=0,t.factor.minScaleFactor=0),null!=e.screenSizePerspectiveAlignment?Z(s,i,e.screenSizePerspectiveAlignment,t.factorAlignment):(t.factorAlignment.factor=t.factor.factor,t.factorAlignment.scale=t.factor.scale,t.factorAlignment.minScaleFactor=t.factor.minScaleFactor)}export{ue as HUDMaterial,Me as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{remove as e}from"../../core/arrayUtils.js";import{makeHandle as t,handlesGroup as i}from"../../core/handleUtils.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{ViewEventPriorities as r}from"../input/InputManager.js";import{primaryKey as n}from"../input/keys.js";const s="z",a="r",p={cancel:"Escape",complete:"Enter"},c={...p,redo:a,undo:s,center:"Alt",constraint:"Shift",delete:["Backspace","Delete"],vertexAdd:"f",pan:" "},f={toggle:"Control"},d={enterInputMode:"Tab",commit:"Enter",discard:"Escape",next:"Tab"},h={moveUp:{key:"ArrowUp",modifier:"Shift",repeats:!0},moveDown:{key:"ArrowDown",modifier:"Shift",repeats:!0},moveLeft:{key:"ArrowLeft",modifier:"Shift",repeats:!0},moveRight:{key:"ArrowRight",modifier:"Shift",repeats:!0},scaleUp:{key:"+",modifier:"Shift"},scaleDown:{key:"-",modifier:"Shift"},factorModifier:{key:n,continuePropagation:!0},toggleOpacity:"t",preserveAspectRatio:{key:"Shift",continuePropagation:!0},rotateIncrements:{key:"Shift",continuePropagation:!0},editSourcePoints:{key:"Alt",continuePropagation:!0},undo:s,redo:a};class
|
|
5
|
+
import{remove as e}from"../../core/arrayUtils.js";import{makeHandle as t,handlesGroup as i}from"../../core/handleUtils.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{ViewEventPriorities as r}from"../input/InputManager.js";import{primaryKey as n}from"../input/keys.js";const s="z",a="r",p={cancel:"Escape",complete:"Enter"},c={...p,redo:a,undo:s,center:"Alt",constraint:"Shift",delete:["Backspace","Delete"],vertexAdd:"f",pan:" "},f={toggle:"Control"},d={enterInputMode:"Tab",commit:"Enter",discard:"Escape",next:"Tab"},h={moveUp:{key:"ArrowUp",modifier:"Shift",repeats:!0},moveDown:{key:"ArrowDown",modifier:"Shift",repeats:!0},moveLeft:{key:"ArrowLeft",modifier:"Shift",repeats:!0},moveRight:{key:"ArrowRight",modifier:"Shift",repeats:!0},scaleUp:{key:"+",modifier:"Shift"},scaleDown:{key:"-",modifier:"Shift"},factorModifier:{key:n,continuePropagation:!0},toggleOpacity:"t",preserveAspectRatio:{key:"Shift",continuePropagation:!0},rotateIncrements:{key:"Shift",continuePropagation:!0},editSourcePoints:{key:"Alt",continuePropagation:!0},undo:s,redo:a},m={invertType:["Control","Meta"]};class y{constructor(){this._bindings=new Map}add(e,t){return this.addToggle(e,(e=>{"key-down"===e.type&&t(e)}))}addToggle(i,r){const n=g.fromDefinition(i,r),s=o(this._bindings,n.key,(()=>[]));return s.push(n),t((()=>e(s,n)))}register(e,t=r.WIDGET){return i([e.on("key-down",(t=>this.dispatch(e.inputManager,t)),t),e.on("key-up",(t=>this.dispatch(e.inputManager,t)),t)])}dispatch(e,t){const i=t.key,o=this._bindings.get(i);if(o)for(const r of o)r.process(e,t)}}class g{constructor(e,t,i,o,r){this.key=e,this.modifiers=t,this.repeats=i,this.continuePropagation=o,this.callback=r}process(e,t){if(!(t.key!==this.key||"repeat"in t&&t.repeat&&!this.repeats)){for(const t of this.modifiers)if(!e.isModifierKeyDown(t))return;this.continuePropagation||t.stopPropagation(),this.callback(t)}}static fromDefinition(e,t){if("string"==typeof e)return new g(e,[],!1,!1,t);const{key:i,modifier:o,repeats:r,continuePropagation:n}=e;return new g(i,o?Array.isArray(o)?o:[o]:[],!!r,!!n,t)}}export{y as KeyBindings,p as interactiveToolKeys,h as mediaKeys,m as selectionKeys,c as sketchKeys,f as snappingKeys,d as tooltipKeys};
|
package/webdoc/IPSInfo.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../chunks/tslib.es6.js";import r from"../core/Clonable.js";import
|
|
5
|
+
import{_ as o}from"../chunks/tslib.es6.js";import r from"../core/Clonable.js";import i from"../core/JSONSupport.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as t}from"../core/accessorSupport/decorators/subclass.js";import e from"./ips/Configuration.js";import p from"./ips/PositioningService.js";let c=class extends(r.ClonableMixin(i)){constructor(o){super(o),this.positioningService=null,this.configuration=null}};o([s({type:p,json:{write:{isRequired:!0}}})],c.prototype,"positioningService",void 0),o([s({type:e,json:{write:!0}})],c.prototype,"configuration",void 0),c=o([t("esri.webdoc.IPSInfo")],c);const n=c;export{n as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import e from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(r.ClonableMixin(e)){constructor(o){super(o),this.enabled=!0}};o([s({type:Boolean,nonNullable:!0,json:{write:!0}})],p.prototype,"enabled",void 0),p=o([t("esri.webdoc.ips.AppleIPSProperties")],p);const c=p;export{c as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import t from"../../core/JSONSupport.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import e from"./AppleIPSProperties.js";import i from"./GNSSProperties.js";import n from"./PathSnappingProperties.js";import m from"./SmoothingProperties.js";let a=class extends(r.ClonableMixin(t)){constructor(o){super(o),this.appleIPS=null,this.gnss=null,this.smoothing=null,this.pathSnapping=null}};o([p({type:e,json:{name:"AppleIPS",write:!0}})],a.prototype,"appleIPS",void 0),o([p({type:i,json:{name:"GNSS",write:!0}})],a.prototype,"gnss",void 0),o([p({type:m,json:{write:!0}})],a.prototype,"smoothing",void 0),o([p({type:n,json:{write:!0}})],a.prototype,"pathSnapping",void 0),a=o([s("esri.webdoc.ips.Configuration")],a);const l=a;export{l as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import e from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(r.ClonableMixin(e)){constructor(o){super(o),this.enabled=!0}};o([s({type:Boolean,nonNullable:!0,json:{write:!0}})],p.prototype,"enabled",void 0),p=o([t("esri.webdoc.ips.GNSSProperties")],p);const c=p;export{c as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(e.ClonableMixin(r)){constructor(o){super(o),this.enabled=!0,this.distance=5,this.units="meter"}};o([t({type:Boolean,nonNullable:!0,json:{write:!0}})],p.prototype,"enabled",void 0),o([t({type:Number,nonNullable:!0,json:{write:!0}})],p.prototype,"distance",void 0),o([t({type:["feet","meter"],nonNullable:!0,json:{write:!0}})],p.prototype,"units",void 0),p=o([s("esri.webdoc.ips.PathSnappingProperties")],p);const i=p;export{i as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import e from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as t}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends(r.ClonableMixin(e)){constructor(o){super(o),this.enabled=!0}};o([s({type:Boolean,nonNullable:!0,json:{write:!0}})],p.prototype,"enabled",void 0),p=o([t("esri.webdoc.ips.SmoothingProperties")],p);const c=p;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Color.js";import{round as l,numDigits as
|
|
5
|
+
import e from"../../../Color.js";import{getColorLuminance as t}from"../../../core/colorUtils.js";import{round as l,numDigits as i,percentChange as o}from"../../../renderers/support/numberUtils.js";import{updateReferenceSizeSymbol as s}from"../../../smartMapping/renderers/support/referenceSizeUtils.js";import{getSpikeSymbolBaseWidth as n,updateSpikeSymbol as r}from"../../../smartMapping/renderers/support/spikeUtils.js";import a from"../../../symbols/SimpleLineSymbol.js";import u from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolColor as c}from"../../../symbols/support/cimSymbolUtils.js";import{isSymbol3D as m}from"../../../symbols/support/typeUtils.js";import{isVolumetricSymbol as p,getSymbolOutlineSize as f}from"../../../symbols/support/utils.js";import{getAuthoringInfoVisualVariableByTheme as y,getSymbolForFlowRenderer as b,createStopLabel as h}from"./utils.js";import"../../support/widgetUtils.js";import{isDarkMode as d}from"../../../support/modeUtils.js";const g=30,w=12,S=24,v=10,z=[255,255,255],k=[200,200,200],j=[128,128,128],V=20,x=5;function I(e){return"esri.symbols.SimpleMarkerSymbol"===e.declaredClass}function U(e){return"esri.symbols.PictureMarkerSymbol"===e.declaredClass}function M(e){return"esri.symbols.SimpleLineSymbol"===e.declaredClass}function C(e){return"esri.symbols.TextSymbol"===e.declaredClass}function L(e,t){const l=e.length-1;return e.map(((e,i)=>h(e,i,l,t)))}async function D(e,t,i,o,s,r,a){const u=t.legendOptions,c=u?.customValues,m=a||await E(e,i),b=t.stops,h=!!m,d=!!c,g=null!=t.minSize&&null!=t.maxSize,w=b&&b.length>1,z=!!t.target;if(!h||!d&&!(g||w&&!z))return;const k=p(m);let j=!1,V=null,x=null;V=k&&!w?l([t.minDataValue,t.maxDataValue]):c??await O(t,m,o,s?.type);const I=e?.authoringInfo,U="univariate-color-size"===I?.type,M=U&&"above-and-below"===I?.univariateTheme,C=!!y(e,"reference-size"),D=!!y(e,"spike");if(!V&&w&&(V=b.map((e=>e.value)),j=b.some((e=>!!e.label)),"flow"===e.type&&(V=l(V)),j&&(x=b.map((e=>e.label)))),k&&null!=V&&V?.length>2&&!M&&(V=[V[0],V[V.length-1]]),!V)return null;U&&5!==V?.length&&(V=A({minSize:V[0],maxSize:V[V.length-1]}));const q=k?T(e,V):null,B=f(m),P=j?null:L(V,r);return(await Promise.all(V.map((async(l,i)=>{let r=k?q[i]:await J(t,m,l,o,s?.type),a=r;C&&(r*=S/t.maxSize||1,a=S),D&&"cim"===m.type&&(a={width:n(m)??v,height:r});return{value:l,symbol:K(m,r,e,i),label:j?x[i]:P[i],size:a,outlineSize:B}})))).reverse()}function T(e,t){const l=e?.authoringInfo,i="univariate-color-size"===l?.type;let o=[w,g];if(i){const e=t[0],l=t[t.length-1],i=w,s=g;o=t.map((t=>i+(t-e)/(l-e)*(s-i)))}return i&&"below"===l?.univariateTheme&&o.reverse(),o}function q(t,l,i,o){const n="class-breaks"===t.type,r=n?t.classBreakInfos?.[0]?.symbol?.clone():t.uniqueValueInfos?.[0]?.symbol?.clone();return r&&"type"in r&&"cim"===r.type?(s(r,{color:o??(n?null:new e(k)),innerDotSize:l*(S/i)||1,outerRingSize:S}),r):null}function B(e,t){const l=e.classBreakInfos,i=l.length,o=i<2||!(t>=2)?l[0].symbol.clone():l[i-1].symbol.clone(),s=e.visualVariables?.some((e=>"color"===e.type));return s&&(o.type.includes("3d")?R(o):H(o)),o}async function E(l,i){if("flow"===l.type)return b(l,i);if("pie-chart"===l.type)return new u({color:null,outline:l.outline?.width?l.outline:new a});let o=null,n=null;if("simple"===l.type)o=l.symbol;else if("class-breaks"===l.type){const e=l.classBreakInfos;o=e&&e[0]&&e[0].symbol,n=e.length>1}else if("unique-value"===l.type){const e=l.uniqueValueInfos;o=e?.[0]?.symbol,n=null!=e&&e.length>1}if(!o||P(o))return null;if(o=o.clone(),i||n)if(o.type.includes("3d"))R(o);else if(y(l,"reference-size")&&"cim"===o.type)s(o,{color:i??("class-breaks"!==l.type?new e(k):null)});else if(y(l,"spike")&&"cim"===o.type){const s=new e(k);let n,a=i??void 0;if(a){const e=t(a),l=d();if(!l&&e>225||l&&e<25){const e="CIMPointSymbol"===o.data.symbol?.type?o.data.symbol.symbolLayers:null,t=e?.some((e=>"CIMSolidFill"===e?.type));t?a=s:n=s}}else a="class-breaks"!==l.type?s:void 0;r(o,{color:a,strokeColor:n})}else H(o);return o}function P(e){return m(e)?e.symbolLayers?.some((e=>"fill"===e?.type))??!1:e?.type.includes("fill")??!1}function R(e){"line-3d"===e.type?e.symbolLayers.forEach((e=>{e.material={color:j}})):e.symbolLayers.forEach((e=>{"icon"!==e.type||e.resource?.href?e.material={color:k}:(e.material={color:z},e.outline={color:j,size:1.5})}))}function H(t){const l=d();if("cim"===t.type)c(t,new e(k));else if(t.type.includes("line"))t.color=j;else if(t.color=l?j:z,"simple-marker"===t.type)if(t.outline){const e=t.outline?.color?.toHex();"#ffffff"===e&&(t.outline.color=j)}else t.outline={color:j,width:1.5}}async function O(e,t,i,o){const s=(await import("../../../renderers/visualVariables/support/visualVariableUtils.js")).getSizeRangeAtScale(e,i,o),n=s&&A(s);if(!s||!n)return;let r=n.map((t=>F(t,e,s)));r=l(r);for(let l=1;l<r.length-1;l++){const s=await G(e,t,r[l],r[l-1],i,o);s&&(r[l]=s[0],n[l]=s[1])}return r}function A(e){const t=e.minSize,l=e.maxSize,i=x,o=(l-t)/(i-1),s=[];for(let n=0;n<i;n++)s.push(t+o*n);return s}function F(e,t,l){const i=l.minSize,o=l.maxSize,s=t.minDataValue,n=t.maxDataValue;let r;if(e<=i)r=s;else if(e>=o)r=n;else{r=(e-i)/(o-i)*(n-s)+s}return r}async function G(e,t,s,n,r,a){const u=await J(e,t,s,r,a),c=await J(e,t,n,r,a),m=i(s),p=m.fractional,f=V;let y=m.integer,b=null,h=null;s>0&&s<1&&(b=10**p,y=i(s*=b).integer);for(let i=y-1;i>=0;i--){const n=10**i;let m=Math.floor(s/n)*n,p=Math.ceil(s/n)*n;null!=b&&(m/=b,p/=b);let y=(m+p)/2;[,y]=l([m,y,p],{indexes:[1]});const d=await J(e,t,m,r,a),g=await J(e,t,p,r,a),w=await J(e,t,y,r,a),S=o(u,d,c,null),v=o(u,g,c,null),z=o(u,w,c,null);let k=S.previous<=f,j=v.previous<=f;if(k&&j&&(S.previous<=v.previous?(k=!0,j=!1):(j=!0,k=!1)),k?h=[m,d]:j?h=[p,g]:z.previous<=f&&(h=[y,w]),h)break}return h}async function J(e,t,l,i,o){const{getSize:s}=await import("../../../renderers/visualVariables/support/visualVariableUtils.js");return s(e,l,{scale:i,view:o,shape:"simple-marker"===t.type?t.style:null})}function K(e,t,l,i){"univariate-color-size"===l?.authoringInfo?.type&&"above-and-below"===l?.authoringInfo?.univariateTheme&&"class-breaks"===l.type&&(e=B(l,i));const o=e.clone();if(m(o))p(o)||o.symbolLayers.forEach((e=>{"fill"!==e.type&&(e.size=t)}));else if(I(o))o.size=t;else if(U(o)){const e=o.width,l=o.height;o.height=t,o.width=t*(e/l)}else M(o)?o.width=t:C(o)?o.font&&(o.font.size=t):"cim"===o.type&&y(l,"reference-size")?s(o,{innerDotSize:t,outerRingSize:S}):"cim"===o.type&&y(l,"spike")&&r(o,{defaultHeight:t,primitiveOverrides:null});return o}export{D as getRampStops,q as getReferenceSizeSymbol,g as realWorldMaxSize,w as realWorldMinSize};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{createTask as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{createTask as t}from"../../../core/asyncUtils.js";import o from"../../../core/Collection.js";import r from"../../../core/Evented.js";import{makeHandle as s}from"../../../core/handleUtils.js";import i from"../../../core/Logger.js";import{abortMaybe as n}from"../../../core/maybe.js";import{debounce as l,onAbort as a,ignoreAbortErrors as c}from"../../../core/promiseUtils.js";import{createScreenPoint as p}from"../../../core/screenUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import m from"../../../geometry/Point.js";import y from"../../../geometry/Polygon.js";import{isClockwise as u}from"../../../geometry/support/coordsUtils.js";import{sketchKeys as f,selectionKeys as g}from"../../../views/interactive/keybindings.js";import{getSelectionFromGeometry as v}from"./selectorUtils.js";const _=100;let w=class extends r.EventedAccessor{constructor(e){super(e),this._isConstraintKeyDown=!1,this._processTask=null,this.options=null,this.selection=new o,this.selectionManager=null,this.sources=null,this.type="add",this._process=l((async(e,o)=>{const{callback:r,selector:s,completed:i}=e,n=t((async e=>{const{effectiveSelectionManager:t,options:o,selection:n,sources:l,view:a}=this,c=!l?.length&&!t.sources.length;if(n.removeAll(),!c&&a){if(s&&null!=l){const r=await v({returnGeometry:o?.returnGeometry,selector:s,signal:e,sources:l,view:a});if(n.addMany(r),i&&!1!==o?.persistSelection)switch(this.effectiveType){case"remove":t.updateSelection({current:[],added:[],removed:r});break;case"replace":t.clear(),t.updateSelection({current:r,added:[],removed:[]});break;default:t.updateSelection({current:r,added:[],removed:[]})}}r&&r()}}));return a(o,(()=>n.abort())),this._processTask=n,n.promise}),_),this._onOperationFinish=this._onOperationFinish.bind(this)}initialize(){this._setup()}get _selectionArea(){const e=this._tool.coordinates;if(0===e.length)return;const t=p(),o=this.view.spatialReference,r=e=>{t.x=e[0],t.y=e[1];const o=this.view.toMap(t);return[o?.x??0,o?.y??0]};if(1===e.length||e.every((([t,o])=>t===e[0][0]&&o===e[0][1]))){const[t,s]=r(e[0]);return new m({x:t,y:s,spatialReference:o})}const s=e.map(r);if(0===s.length)return;u(s)||s.reverse();return new y({spatialReference:o,rings:[s]})}get effectiveSelectionManager(){return this.selectionManager??this.view.selectionManager}get effectiveType(){const e=this.type??"add";if(this._isConstraintKeyDown)switch(e){case"add":return"remove";case"remove":case"replace":return"add";default:return e}return e}get processingFinalSelection(){return!(!this._processTask||!this._tool?.drawOperation.isCompleted)}cancel(){this.selection.removeAll(),this._onOperationFinish(!0)}destroy(){this._toolImportController=n(this._toolImportController)}async _setup(){const{view:e}=this;if(await e.whenReady(),this.destroyed||this._toolImportController)return;const t=new AbortController;this._toolImportController=t;const o=await import("../../../views/draw/DrawScreenTool.js");if(t.signal.aborted)return;const{options:r}=this,n=r?.createTool??"rectangle",l=r?.mode??("polygon"===n?"click":"hybrid"),a=Symbol();try{this._tool=new o.DrawScreenTool({view:e,mode:l,geometryType:n})}finally{this._toolImportController=null}this._tool?(r?.selectOnComplete||this.addHandles(this._tool.on(["cursor-update","vertex-add","vertex-remove"],(()=>c(this._process({selector:this._selectionArea})))),a),this.addHandles([e.on("key-down",(e=>{if(!e.repeat)switch(e.key){case f.constraint:this._tool.uniformSizeToggled=!0,e.stopPropagation();break;case f.center:this._tool.centeredToggled=!0,e.stopPropagation()}})),e.on("key-up",(e=>{switch(e.key){case f.constraint:this._tool.uniformSizeToggled=!1,e.stopPropagation();break;case f.center:this._tool.centeredToggled=!1,e.stopPropagation()}})),this._tool.on("complete",(async t=>{this._isConstraintKeyDown=g.invertType.some((t=>e.inputManager.isModifierKeyDown(t))),this.removeHandles(a),t.aborted?this.cancel():(this._tool.cursor="progress",await this._process({selector:this._selectionArea,callback:this._onOperationFinish,completed:!0}))}))],a),this.addHandles(s((()=>e.tools.remove(this._tool)))),e.addAndActivateTool(this._tool)):i.getLogger(this).warn("Unable to import Draw module. SelectionOperation failed to load.")}_onOperationFinish(e=!1){this.removeAllHandles(),this._processTask?.abort(),this.emit("complete",{aborted:e,operationType:this.effectiveType,selection:this.selection.toArray()})}};e([d()],w.prototype,"_isConstraintKeyDown",void 0),e([d()],w.prototype,"_processTask",void 0),e([d()],w.prototype,"_selectionArea",null),e([d()],w.prototype,"effectiveSelectionManager",null),e([d()],w.prototype,"effectiveType",null),e([d()],w.prototype,"options",void 0),e([d()],w.prototype,"processingFinalSelection",null),e([d({readOnly:!0})],w.prototype,"selection",void 0),e([d()],w.prototype,"selectionManager",void 0),e([d()],w.prototype,"sources",void 0),e([d({constructOnly:!0})],w.prototype,"type",void 0),e([d({constructOnly:!0})],w.prototype,"view",void 0),w=e([h("esri.widgets.support.Selector2D.SelectionOperation")],w);export{w as default};
|