@arcgis/core 4.34.0-next.16 → 4.34.0-next.17
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/analysis/Analysis.js +1 -1
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/analysis/DimensionAnalysis.js +1 -1
- package/analysis/DimensionSimpleStyle.js +1 -1
- package/analysis/DirectLineMeasurementAnalysis.js +1 -1
- package/analysis/LengthDimension.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/analysis/SlicePlane.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{58f403f956b7b3467344.js → 42da01bd3f401a017c0f.js} +1 -1
- package/assets/esri/core/workers/chunks/{a6bcae413e62cd879b46.js → 5859e425c9bca96b6c80.js} +1 -1
- package/assets/esri/core/workers/chunks/5bfccd5dffda74740aa4.js +1 -0
- package/assets/esri/core/workers/chunks/{948c5454881e661c3bdc.js → 78a57f5aeb277b84b3da.js} +1 -1
- package/assets/esri/core/workers/chunks/{2990145d7ac3af0d68be.js → 8599df135928d73da4a3.js} +1 -1
- package/assets/esri/core/workers/chunks/974c6b0e3a1f1dd523fa.js +1 -0
- package/assets/esri/core/workers/chunks/aeabe203da7bcdd580cf.js +1 -0
- package/assets/esri/core/workers/chunks/{9959a91c8de6fef499c2.js → beb01d400f1aa089d2dc.js} +1 -1
- package/assets/esri/core/workers/chunks/{243eb8a317333ec2715b.js → f3e179b48bca50c94538.js} +1 -1
- package/config.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/interfaces.d.ts +22 -10
- package/kernel.js +1 -1
- package/layers/VideoLayer.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToDataModelFactories.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/jsonUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/widgets/LineOfSight/LineOfSightTarget.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/assets/esri/core/workers/chunks/54814a269d44855f0673.js +0 -1
- package/assets/esri/core/workers/chunks/632d1a1287dde980479e.js +0 -1
- package/assets/esri/core/workers/chunks/95507ff0a243e451b99e.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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{DateOnly as t}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as r}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as s}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as o}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as n,quantizeY as d}from"../../../../../geometry/support/quantizationUtils.js";import{getCentroidOptimizedGeometry as u}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as h,quantizeForDisplay as c,unquantizeOptimizedGeometry as l}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as m}from"../../../../../layers/graphics/OptimizedFeature.js";import y from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as f,unknown as p}from"../../../../../time/constants.js";import{FeatureSetCache as g}from"./FeatureSetCache.js";const _=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],b=_[0],x=_[1],D=_[2],T=_[3],F=has("featurelayer-simplify-payload-size-factors")??[1,2,4],A=F[0],S=F[1],I=F[2],B=has("featurelayer-simplify-mobile-factor")??2,j=has("esri-mobile"),G=4294967295;function C(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class M{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=j?B:1;t>4e6?r=I*s:t>1e6?r=S*s:t>5e5?r=A*s:t>1e5&&(r=s);let i=0;return e>4e3?i=T*r:e>2e3?i=D*r:e>100?i=x:e>15&&(i=b),i}getBounds(e){if(C(this._boundsBuffer,4*this.getIndex()+4,0),this.getBoundsXMin()===G)return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(!t)return this.setBoundsXMin(G),!1;let r=1/0,s=1/0,a=-1/0,o=-1/0;return t.forEachVertex(((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),a=Math.max(a,e),o=Math.max(o,t)})),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(a),this.setBoundsYMax(o),i(e,r,s,a,o),!0}const t=this.getBoundsXMin(),r=this.getBoundsYMin(),s=this.getBoundsXMax(),a=this.getBoundsYMax();return i(e,t,r,s,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new m(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return h(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&(t=c(t,e,this.metadata.geometryType,this.hasZ,this.hasM)),!t){const t=this.readCentroidForDisplay();if(!t)return null;const r=n(e,t.coords[0]),s=d(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(r,s).deltaDecode()}return t}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&l(t,t,this.hasZ,this.hasM,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&l(r,r,this.hasZ,this.hasM,s),r}setCache(e){let t=this._caches.get(e);null==t&&(t=new g(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);return"esriGeometryPoint"!==this.geometryType&&t&&this.getInTransform()?t.deltaDecode():t}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some((t=>t.hasField(e)))}geometry(){const e=this.readGeometryWorldSpace(),t=h(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??f):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===p}field(s){let i=this.fields.get(s);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(this.readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(this.readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,this.readAttribute(s,!0));default:return this.readAttribute(s,!1)}for(const a of this._joined)if(a.setIndex(this.getIndex()),i=a.fields.get(s),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(a._readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(a._readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(a._readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,a._readAttribute(s,!0));default:return this.readAttribute(s,!1)}throw new Error(`Field ${s} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}return!0}_computeDisplayCentroid(e){if(null==this.getInTransform())return u(new y,e,this.hasM,this.hasZ);const t=s.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=o(t);return r?(r[1]*=-1,new y([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return h(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new y([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new y([2],[e-1,t+1,1,-1])}}export{M as FeatureSetReader};
|
|
5
|
+
import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import has from"../../../../../core/has.js";import{DateOnly as t}from"../../../../../core/sql/DateOnly.js";import{TimeOnly as r}from"../../../../../core/sql/TimeOnly.js";import{GeometryCursor as s}from"../../../../../geometry/GeometryCursor.js";import{fromRectValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{fromJSON as a}from"../../../../../geometry/support/jsonUtils.js";import{getLabelPoint as o}from"../../../../../geometry/support/labelPoint.js";import{quantizeX as n,quantizeY as d}from"../../../../../geometry/support/quantizationUtils.js";import{getCentroidOptimizedGeometry as u}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as h,generalizeOptimizedGeometry as c,quantizeForDisplay as l,unquantizeOptimizedGeometry as m}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as y}from"../../../../../layers/graphics/OptimizedFeature.js";import f from"../../../../../layers/graphics/OptimizedGeometry.js";import{system as p,unknown as g}from"../../../../../time/constants.js";import{FeatureSetCache as _}from"./FeatureSetCache.js";const b=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],x=b[0],D=b[1],T=b[2],F=b[3],A=has("featurelayer-simplify-payload-size-factors")??[1,2,4],S=A[0],I=A[1],B=A[2],j=has("featurelayer-simplify-mobile-factor")??2,G=has("esri-mobile"),M=4294967295;function C(e,t,r){if(!(e.length>t))for(;e.length<=t;)e.push(r)}class v{constructor(e){this.metadata=e,this.type="FeatureSetReader",this._overrides=null,this._joined=[],this._objectIdToIndex=null,this._boundsBuffer=[],this._caches=new Map,this.arcadeDeclaredClass="esri.arcade.Feature",this._contextTimeZone=null}destroy(){}[Symbol.dispose](){this.destroy()}getAreaSimplificationThreshold(e,t){let r=1;const s=G?j:1;t>4e6?r=B*s:t>1e6?r=I*s:t>5e5?r=S*s:t>1e5&&(r=s);let i=0;return e>4e3?i=F*r:e>2e3?i=T*r:e>100?i=D:e>15&&(i=x),i}getBounds(e){if(C(this._boundsBuffer,4*this.getIndex()+4,0),this.getBoundsXMin()===M)return!1;if(0===this.getBoundsXMin()){const t=this.readGeometryWorldSpace();if(!t)return this.setBoundsXMin(M),!1;let r=1/0,s=1/0,a=-1/0,o=-1/0;return t.forEachVertex(((e,t)=>{r=Math.min(r,e),s=Math.min(s,t),a=Math.max(a,e),o=Math.max(o,t)})),this.setBoundsXMin(r),this.setBoundsYMin(s),this.setBoundsXMax(a),this.setBoundsYMax(o),i(e,r,s,a,o),!0}const t=this.getBoundsXMin(),r=this.getBoundsYMin(),s=this.getBoundsXMax(),a=this.getBoundsYMax();return i(e,t,r,s,a),!0}getBoundsXMin(){return this._boundsBuffer[4*this.getIndex()]}setBoundsXMin(e){this._boundsBuffer[4*this.getIndex()]=e}getBoundsYMin(){return this._boundsBuffer[4*this.getIndex()+1]}setBoundsYMin(e){this._boundsBuffer[4*this.getIndex()+1]=e}getBoundsXMax(){return this._boundsBuffer[4*this.getIndex()+2]}setBoundsXMax(e){this._boundsBuffer[4*this.getIndex()+2]=e}getBoundsYMax(){return this._boundsBuffer[4*this.getIndex()+3]}setBoundsYMax(e){this._boundsBuffer[4*this.getIndex()+3]=e}readAttributeAsTimestamp(e){const t=this.readAttribute(e);return"string"==typeof t?new Date(t).getTime():"number"==typeof t||null==t?t:null}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}registerOverrides(e){this._overrides=e}withoutOverrides(){const e=this.copy();return e._overrides=null,e}readOptimizedFeatureWorldSpace(){const e=this.readGeometryWorldSpace(),t=this.readAttributes(),r=this.readCentroidWorldSpace();return new y(e,t,r,this.getObjectId(),this.getDisplayId())}readLegacyFeatureForDisplay(){const e=this.readCentroidForDisplay();return{attributes:this.readAttributes(),geometry:this.readLegacyGeometryForDisplay(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyFeatureWorldSpace(){const e=this.readCentroidWorldSpace();return{attributes:this.readAttributes(),geometry:this._readLegacyGeometryWorldSpace(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null}}readLegacyGeometryForDisplay(){const e=this.readGeometryForDisplay();return h(e,this.geometryType,!1,!1)}readXForDisplay(){return this._readX()}readYForDisplay(){return this._readY()}readXWorldSpace(){const e=this._readX(),t=this.getInTransform();return null==t?e:e*t.scale[0]+t.translate[0]}readYWorldSpace(){const e=this._readY(),t=this.getInTransform();return null==t?e:t.translate[1]-e*t.scale[1]}readGeometryForDisplay(){const e=this._readGeometryDeltaDecoded(!0);if(!e){const e=this._createDeltaQuantizedGeometryFromServerCentroid();return e?e.deltaDecode():null}return e}readGeometryForDisplayTransformed(e){let t=this.readGeometryForDisplay();if(t&&"esriGeometryPolyline"===this.metadata.geometryType&&(t=c(new f,t,this.hasZ,this.hasM,this.metadata.geometryType,e.scale[0])),t&&(t=l(t,e,this.metadata.geometryType,this.hasZ,this.hasM)),!t){const t=this.readCentroidForDisplay();if(!t)return null;const r=n(e,t.coords[0]),s=d(e,t.coords[1]);return this._createDeltaQuantizedExtrudedGeometry(r,s).deltaDecode()}return t}readGeometryWorldSpace(){let e=this._readGeometry();if(e||(e=this._createDeltaQuantizedGeometryFromServerCentroid()),!e)return null;const t=e.clone(),r=this.getInTransform();return null!=r&&m(t,t,this.hasZ,this.hasM,r),t}readCentroidForDisplay(){const e=this.readGeometryForDisplay();return e?this._computeDisplayCentroid(e):this._readServerCentroid()}readCentroidWorldSpace(){const e=this.readGeometryForDisplay(),t=e?this._computeDisplayCentroid(e):this._readServerCentroid();if(!t)return null;const r=t.clone(),s=this.getInTransform();return null!=s&&m(r,r,this.hasZ,this.hasM,s),r}setCache(e){let t=this._caches.get(e);null==t&&(t=new _(this.getSize()),this._caches.set(e,t)),this._activeCache=t}setCachedValue(e){this._activeCache.set(this.getIndex(),e)}hasCachedValue(){return this._activeCache.has(this.getIndex())}getCachedValue(){return this._activeCache.get(this.getIndex())}_readGeometryDeltaDecoded(e){const t=this._readGeometry(e);return"esriGeometryPoint"!==this.geometryType&&t&&this.getInTransform()?t.deltaDecode():t}get contextTimeZone(){return this._contextTimeZone}set contextTimeZone(e){this._contextTimeZone=e}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)||this._joined.some((t=>t.hasField(e)))}geometry(){const e=this.readGeometryWorldSpace(),t=h(e,this.geometryType,this.hasZ,this.hasM),r=a(t);if(r){if(!this.metadata.outSpatialReference)throw new Error("InternalError: Expected spatial reference to be defined");r.spatialReference=this.metadata.outSpatialReference}return r}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeZone??p):r}isUnknownDateTimeField(e){return this.metadata.fieldsIndex.getTimeZone(e)===g}field(s){let i=this.fields.get(s);if(i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(this.readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(this.readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(this.readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,this.readAttribute(s,!0));default:return this.readAttribute(s,!1)}for(const a of this._joined)if(a.setIndex(this.getIndex()),i=a.fields.get(s),i)switch(i.type){case"date-only":case"esriFieldTypeDateOnly":return t.fromReader(a._readAttribute(s,!1));case"time-only":case"esriFieldTypeTimeOnly":return r.fromReader(a._readAttribute(s,!1));case"esriFieldTypeTimestampOffset":case"timestamp-offset":return e.fromReaderAsTimeStampOffset(a._readAttribute(s,!1));case"date":case"esriFieldTypeDate":return this.autocastArcadeDate(s,a._readAttribute(s,!0));default:return this.readAttribute(s,!1)}throw new Error(`Field ${s} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeatureForDisplay());const t=this.readLegacyFeatureForDisplay();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this.metadata.arcadeSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}_getExists(){if(this._overrides){const e=this.getObjectId();return!this._overrides.hasOverride(e)}return!0}_computeDisplayCentroid(e){if(null==this.getInTransform())return u(new f,e,this.hasM,this.hasZ);const t=s.fromOptimized(e,this.geometryType);t.yFactor*=-1;const r=o(t);return r?(r[1]*=-1,new f([],r)):null}copyInto(e){e._joined=this._joined,e._overrides=this._overrides,e._objectIdToIndex=this._objectIdToIndex,e._boundsBuffer=this._boundsBuffer,e._activeCache=this._activeCache,e._caches=this._caches,e._contextTimeZone=this._contextTimeZone}_readLegacyGeometryWorldSpace(){const e=this.readGeometryWorldSpace();return h(e,this.geometryType,!1,!1)}_createDeltaQuantizedGeometryFromServerCentroid(){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this._createDeltaQuantizedExtrudedGeometry(t,r)}_createDeltaQuantizedExtrudedGeometry(e,t){return"esriGeometryPolyline"===this.geometryType?this._createDeltaQuantizedExtrudedLine(e,t):this._createDeltaQuantizedExtrudedQuad(e,t)}_createDeltaQuantizedExtrudedQuad(e,t){return new f([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}_createDeltaQuantizedExtrudedLine(e,t){return new f([2],[e-1,t+1,1,-1])}}export{v as FeatureSetReader};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{equals as r}from"../../core/arrayUtils.js";import t from"../../core/Collection.js";import s from"../../core/Error.js";import i from"../../core/Logger.js";import{mapCollection as n}from"../../core/mapCollectionUtils.js";import{destroyMaybe as a}from"../../core/maybe.js";import{watch as m,syncAndInitial as c}from"../../core/reactiveUtils.js";import{convertToSpatialReferenceUnit as p,convertFromSpatialReferenceUnit as l}from"../../core/unitUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{e as h}from"../../chunks/earcut.js";import{create as d}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as g}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../geometry/ellipsoidUtils.js";import j from"../../geometry/Point.js";import{project as w}from"../../geometry/projectionUtils.js";import{execute as v}from"../../geometry/operators/gx/operatorDensify.js";import{execute as _}from"../../geometry/operators/gx/operatorSimplify.js";import{fromSpatialReference as A,fromPolygon as x,toPolygon as b}from"../../geometry/operators/support/apiConverter.js";import{computeTranslationToOriginAndRotation as R}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as M}from"../../geometry/support/DoubleArray.js";import{earth as N}from"../../geometry/support/Ellipsoid.js";import{newIndexArray as k}from"../../geometry/support/Indices.js";import{t as C}from"../../chunks/vec3.js";import{ViewingMode as U}from"../ViewingMode.js";import{ElevationContext as V}from"./layers/graphics/ElevationContext.js";import{extrudePolygon as G}from"./layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{computeCentroid as H}from"./layers/graphics/graphicUtils.js";import{geometryToRenderInfo as F}from"./support/renderInfoUtils/polygon.js";import{FocusAreaColorNode as I}from"./webgl-engine/effects/focusArea/FocusAreaColorNode.js";import{FocusAreaGeometry as P,FocusAreaMaskNode as E}from"./webgl-engine/effects/focusArea/FocusAreaMaskNode.js";import{FocusAreaOutlineItem as S}from"./webgl-engine/effects/focusArea/FocusAreaOutlineItem.js";const D=2e4;let L=class extends o{constructor(e){super(e),this._volumes=new Map,this._elevationContext=new V,this._outlineMap=new t}initialize(){this.addHandles([m((()=>this.polygons),(e=>this._updateVolumes(e)),c)]),this._outlineMap=n((()=>this.areas?.areas),(e=>new S({area:e,view:this.view})),{recycleItems:!0})}destroy(){this.removeAllHandles(),this._outlineMap.destroy()}get areas(){return this.view.map?.focusAreas}get enabledAreas(){return this.areas?.areas.toArray().filter((({enabled:e})=>e))??[]}get style(){return this.areas?.style??"bright"}get polygons(){return this.enabledAreas.reduce(((e,o)=>e.concat(o.geometries.toArray())),new Array)}containsGeometry(e){if(0===this.polygons.length)return!0;const o=new j(e);return this.polygons.some((e=>e.contains(o)))}_updateVolumes(e){this._extrude(e),this._ensureRenderNodes()}_extrude(e){if(!this.view.renderCoordsHelper||r(Array.from(this._volumes.keys()),e))return;const o=this.view.renderCoordsHelper,t=g(),n=o.viewingMode===U.Global,a=d(),m=d(),c=this.view.spatialReference,u=A(c),f=y(c).radius/N.radius,j=p(5e5*f,"meters",c,!0);n||o.worldUpAtPosition([0,0,0],t);const V=new Map;for(const r of e){const e=this._volumes.get(r);if(e)V.set(r,e);else try{const e=c.equals(r.spatialReference)?r:w(r,c),s=Math.max(e.extent.width,e.extent.height),i=l(s,c,"meters",!0),p=Math.max(5*i,D*f),d=this._reduceGeometryHeight(e,p,
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../core/Accessor.js";import{equals as r}from"../../core/arrayUtils.js";import t from"../../core/Collection.js";import s from"../../core/Error.js";import i from"../../core/Logger.js";import{mapCollection as n}from"../../core/mapCollectionUtils.js";import{destroyMaybe as a}from"../../core/maybe.js";import{watch as m,syncAndInitial as c}from"../../core/reactiveUtils.js";import{convertToSpatialReferenceUnit as p,convertFromSpatialReferenceUnit as l}from"../../core/unitUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import{e as h}from"../../chunks/earcut.js";import{create as d}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as g}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as y}from"../../geometry/ellipsoidUtils.js";import j from"../../geometry/Point.js";import{project as w}from"../../geometry/projectionUtils.js";import{execute as v}from"../../geometry/operators/gx/operatorDensify.js";import{execute as _}from"../../geometry/operators/gx/operatorSimplify.js";import{fromSpatialReference as A,fromPolygon as x,toPolygon as b}from"../../geometry/operators/support/apiConverter.js";import{computeTranslationToOriginAndRotation as R}from"../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as M}from"../../geometry/support/DoubleArray.js";import{earth as N}from"../../geometry/support/Ellipsoid.js";import{newIndexArray as k}from"../../geometry/support/Indices.js";import{t as C}from"../../chunks/vec3.js";import{ViewingMode as U}from"../ViewingMode.js";import{ElevationContext as V}from"./layers/graphics/ElevationContext.js";import{extrudePolygon as G}from"./layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{computeCentroid as H}from"./layers/graphics/graphicUtils.js";import{geometryToRenderInfo as F}from"./support/renderInfoUtils/polygon.js";import{FocusAreaColorNode as I}from"./webgl-engine/effects/focusArea/FocusAreaColorNode.js";import{FocusAreaGeometry as P,FocusAreaMaskNode as E}from"./webgl-engine/effects/focusArea/FocusAreaMaskNode.js";import{FocusAreaOutlineItem as S}from"./webgl-engine/effects/focusArea/FocusAreaOutlineItem.js";const D=2e4;let L=class extends o{constructor(e){super(e),this._volumes=new Map,this._elevationContext=new V,this._outlineMap=new t}initialize(){this.addHandles([m((()=>this.polygons),(e=>this._updateVolumes(e)),c)]),this._outlineMap=n((()=>this.areas?.areas),(e=>new S({area:e,view:this.view})),{recycleItems:!0})}destroy(){this.removeAllHandles(),this._outlineMap.destroy()}get areas(){return this.view.map?.focusAreas}get enabledAreas(){return this.areas?.areas.toArray().filter((({enabled:e})=>e))??[]}get style(){return this.areas?.style??"bright"}get polygons(){return this.enabledAreas.reduce(((e,o)=>e.concat(o.geometries.toArray())),new Array)}containsGeometry(e){if(0===this.polygons.length)return!0;const o=new j(e);return this.polygons.some((e=>e.contains(o)))}_updateVolumes(e){this._extrude(e),this._ensureRenderNodes()}_extrude(e){if(!this.view.renderCoordsHelper||r(Array.from(this._volumes.keys()),e))return;const o=this.view.renderCoordsHelper,t=g(),n=o.viewingMode===U.Global,a=d(),m=d(),c=this.view.spatialReference,u=A(c),f=y(c).radius/N.radius,j=p(5e5*f,"meters",c,!0);n||o.worldUpAtPosition([0,0,0],t);const V=new Map;for(const r of e){const e=this._volumes.get(r);if(e)V.set(r,e);else try{const e=c.equals(r.spatialReference)?r:w(r,c),s=Math.max(e.extent.width,e.extent.height),i=l(s,c,"meters",!0),p=Math.max(5*i,D*f),d=n?f/10:f,g=this._reduceGeometryHeight(e,p,d),y=H(g);if(null==y)continue;const A=x(g),N=_(A,u,!1)??A,U=v(N,j,0,0),I=b(U,c);if(null==I)continue;R(c,[y.x,y.y,0],a,o.spatialReference),m[12]=-a[12],m[13]=-a[13],m[14]=-a[14];const E=F(I,this.view.elevationProvider,o,this._elevationContext),{polygons:S,mapPositions:L,position:O}=E,q=new Array;for(const o of S){const e=o.count,r=h(o.mapPositions,o.holeIndices,3);if(0===r.length)continue;const s=r.length,i=6*e,c=i+s,l=M(3*i),u=k(c),f=k(s);G(O,L,r,o,l,null,null,null,u,f,p,t,n),C(l,l,m);const d=new P(l,f,u,p,[a[12],a[13],a[14]]);q.push(d)}V.set(r,q)}catch(I){i.getLogger(this).error(new s("focusareasview:projection-failed","Failed to project focus area geometry to view spatial reference",{geometry:r,error:I}))}}this._volumes=V,this._maskRenderNode?.updateGeometries()}_ensureRenderNodes(){this.view.stage&&(0===this.volumes.size?(this._maskRenderNode=a(this._maskRenderNode),this._colorRenderNode=a(this._colorRenderNode)):(this._maskRenderNode??=new E({focusAreasView:this}),this._colorRenderNode??=new I({focusAreasView:this}),this.view.stage.renderView.requestRender()))}_reduceGeometryHeight(e,o,r){const t=-12e5*r,s=Math.max(-o/2,t),i=e.rings.map((e=>e.map((e=>[e[0],e[1],s])))),n=e.clone();return n.rings=i,n.hasZ=!0,n}get volumes(){return this._volumes}};e([u()],L.prototype,"_volumes",void 0),e([u({constructOnly:!0})],L.prototype,"view",void 0),L=e([f("esri.views.3d.FocusAreasView")],L);export{L as FocusAreasView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import a from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as r}from"../../../../core/lang.js";import{mapCollection as p}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as l,destroyMaybe as u}from"../../../../core/maybe.js";import{memoize as d}from"../../../../core/memoize.js";import{ignoreAbortErrors as c}from"../../../../core/promiseUtils.js";import{watch as m,initial as h,sync as g,syncAndInitial as f,when as _}from"../../../../core/reactiveUtils.js";import{property as M}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../../core/support/UpdatingHandles.js";import S from"../../../../geometry/Point.js";import{clonePoint as w}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as b,LengthDimensionConstraint as P,applyConstraint as O,computeConstraint as D,constraintDependencies as H}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as j,LengthDimensionPointManipulator as T,pointManipulatorHandles as x,createOffsetManipulator as G,offsetManipulatorHandles as z,LineOfSightOrientationManipulator as U,headingManipulatorHandles as V,rotationManipulatorHandles as I,createMeasureTypeManipulator as A,measureTypeManipulatorHandles as R,updateOffsetManipulatorTransform as k,updateHeadingManipulatorTransform as E,updateRotationManipulatorTransform as L,updateMeasureTypeManipulatorTransform as F,unfocusedOffsetWidth as q,focusedOffsetWidth as B}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as N,arePointsVerticallyAligned as J,computationToGeometryDependencies as K,computeGeometryFromDimension as Q}from"./lengthDimensionUtils.js";import{disabledPointColor as W,pointRadius as X,getTransparentAccentColor as Y,getContrastColor as Z,initialOffsetPx as $}from"./settings.js";import{getRotateHeadingTexture as tt}from"../images/Factory.js";import{SnappingVisualizer3D as et}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as it}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as at}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as nt}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as st}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as ot}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as rt}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as pt}from"../../../interactive/coordinateHelper.js";import{EditGeometry as lt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as ut}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as dt}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as ct}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as mt}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as ht}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as gt}from"../../../interactive/snapping/snappingUtils.js";let ft=class extends n{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._updatingHandles=new C,this._getSnappingContext=d((t=>new dt({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new ut(new lt("point",pt(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new et})));const{view:i}=t;this._snappingManagerResult=mt(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:ot(2)}),this._constraintSnappingIndicator=new it({view:i,attached:!0,width:1,renderOccluded:nt.OccludeAndTransparent,stipplePattern:ot(5),isDecoration:!0});const a=e.toUnitRGBA(W);this._stagedStartIndicator=new at({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*X,outlineSize:0,renderOccluded:nt.OccludeAndTransparent,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new ht({view:t});const i=Y(t.effectiveTheme),a=Z(t.effectiveTheme),n=!t.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=tt(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial=new st({draped:!1,texture:this._textureHandle.texture,writeDepth:!1,renderOccluded:nt.Opaque,isDecoration:!0});const s=p((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles([m((()=>({accentColor:Y(t.effectiveTheme),contrastColor:Z(t.effectiveTheme)})),(({accentColor:i,contrastColor:a})=>{const s=this._textureHandle;this._textureHandle=tt(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial.setParameters({texture:this._textureHandle.texture}),s?.release();const o=e.toUnitRGBA(i);this._unfocusedOffsetManipulatorMaterial.setParameters({color:o}),this._focusedOffsetManipulatorMaterial.setParameters({color:o}),this._thinOffsetManipulatorMaterial.setParameters({color:o}),this._constraintSnappingIndicator.color=o}),h),o(s),m((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=w(t,new S);this._applyPointUpdate(e,{endPoint:i})}),g),m((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),f),m((()=>this.analysis.style.lineSize),(t=>this._updateManipulatorStyle(t)),h),m((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),m((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),gt(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(c(this._snappingOperation.snapAgainNearPreviousMapPoint(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);b(t,i,{constraint:a,view:this.view})}}}))}destroy(){this._textureHandle=l(this._textureHandle),this._snappingOperation=u(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorMaterial.dispose()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[_((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...f,equals:r}),m((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:a,computation:n}=t;switch(n.previousConstraint){case P.Horizontal:n.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case P.Vertical:n.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case P.Direct:n.preConstraintProperties={measureType:i.Direct,orientation:a};break;default:n.preConstraintProperties={measureType:e,orientation:a}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),g)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[m((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1})),m((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==P.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(c(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const s=new a({startPoint:w(n,new S),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=w(a,new S);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),a=this._setupPointManipulator(t,{isStart:!1}),n=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new j({start:e,end:a,offset:n,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([m((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...f,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new T(i,{metadata:a}),s=x(n,{isStart:e.isStart,createSnappingPipelineStep:t=>ct({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=G(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=z(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new U(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=V(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new U(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=A(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=R(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,a={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:s,firstGrabbedManipulator:o}=a,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=N(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==n&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);J(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;k(l,g,f),u.available&&E(u,t,f),d.available&&L(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&F(e,t,i,f)}))}_updateManipulatorStyle(t){const e=q(t),i=B(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=K(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=Q(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});O(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,_t);const{state:e,renderCoordsHelper:i}=this.view,a=e.camera.computeScreenPixelSizeAt(_t);t.dimension.offset=$*a*i.unitInMeters}_computeConstraint(t){return D(H(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new rt({width:1,renderOccluded:nt.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get test(){}};t([M({constructOnly:!0})],ft.prototype,"analysis",void 0),t([M({constructOnly:!0})],ft.prototype,"analysisViewData",void 0),t([M({constructOnly:!0})],ft.prototype,"manipulators",void 0),t([M({constructOnly:!0})],ft.prototype,"parentTool",void 0),t([M({constructOnly:!0,nonNullable:!0})],ft.prototype,"view",void 0),t([M({readOnly:!0})],ft.prototype,"updating",null),t([M()],ft.prototype,"firstGrabbedManipulator",null),t([M()],ft.prototype,"hasGrabbedManipulators",null),t([M()],ft.prototype,"snappingOptions",null),t([M()],ft.prototype,"_stagedDimension",void 0),t([M()],ft.prototype,"_activeComputation",null),t([M()],ft.prototype,"_stagedComputation",null),ft=t([v("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],ft);const _t=y();export{ft as LengthDimensionSubTool};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import a from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o,handlesGroup as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as p}from"../../../../core/lang.js";import{mapCollection as l}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as u,destroyMaybe as d}from"../../../../core/maybe.js";import{memoize as c}from"../../../../core/memoize.js";import{ignoreAbortErrors as m}from"../../../../core/promiseUtils.js";import{watch as h,initial as g,sync as f,syncAndInitial as _,when as M}from"../../../../core/reactiveUtils.js";import{property as v}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as y}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as C}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../core/support/UpdatingHandles.js";import w from"../../../../geometry/Point.js";import{clonePoint as b}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as P,LengthDimensionConstraint as O,applyConstraint as D,computeConstraint as H,constraintDependencies as j}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as T,LengthDimensionPointManipulator as x,pointManipulatorHandles as G,createOffsetManipulator as z,offsetManipulatorHandles as U,LineOfSightOrientationManipulator as V,headingManipulatorHandles as I,rotationManipulatorHandles as A,createMeasureTypeManipulator as R,measureTypeManipulatorHandles as k,updateOffsetManipulatorTransform as E,updateHeadingManipulatorTransform as L,updateRotationManipulatorTransform as F,updateMeasureTypeManipulatorTransform as q,unfocusedOffsetWidth as B,focusedOffsetWidth as N}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as J,arePointsVerticallyAligned as K,computationToGeometryDependencies as Q,computeGeometryFromDimension as W}from"./lengthDimensionUtils.js";import{disabledPointColor as X,pointRadius as Y,getTransparentAccentColor as Z,getContrastColor as $,initialOffsetPx as tt}from"./settings.js";import{getRotateHeadingTexture as et}from"../images/Factory.js";import{SnappingVisualizer3D as it}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as at}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as nt}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as st}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as ot}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as rt}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as pt}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as lt}from"../../../interactive/coordinateHelper.js";import{EditGeometry as ut}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as dt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as ct}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as mt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as ht}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as gt}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as ft}from"../../../interactive/snapping/snappingUtils.js";let _t=class extends n{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._updatingHandles=new S,this._getSnappingContext=c((t=>new ct({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new dt(new ut("point",lt(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new it})));const{view:i}=t;this._snappingManagerResult=ht(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:rt(2)}),this._constraintSnappingIndicator=new at({view:i,attached:!0,width:1,renderOccluded:st.OccludeAndTransparent,stipplePattern:rt(5),isDecoration:!0});const a=e.toUnitRGBA(X);this._stagedStartIndicator=new nt({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*Y,outlineSize:0,renderOccluded:st.OccludeAndTransparent,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new gt({view:t});const i=Z(t.effectiveTheme),a=$(t.effectiveTheme),n=!t.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=et(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial=new ot({draped:!1,texture:this._textureHandle.texture,writeDepth:!1,renderOccluded:st.Opaque,isDecoration:!0});const s=l((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles([h((()=>({accentColor:Z(t.effectiveTheme),contrastColor:$(t.effectiveTheme)})),(({accentColor:i,contrastColor:a})=>{const s=this._textureHandle;this._textureHandle=et(t.stage.textures,{accentColor:i,contrastColor:a,preMultiplyAlpha:n}),this._orientationManipulatorMaterial.setParameters({texture:this._textureHandle.texture}),s?.release();const o=e.toUnitRGBA(i);this._unfocusedOffsetManipulatorMaterial.setParameters({color:o}),this._focusedOffsetManipulatorMaterial.setParameters({color:o}),this._thinOffsetManipulatorMaterial.setParameters({color:o}),this._constraintSnappingIndicator.color=o}),g),o(s),h((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=b(t,new w);this._applyPointUpdate(e,{endPoint:i})}),f),h((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),_),h((()=>this.analysis.style.lineSize),(t=>this._updateManipulatorStyle(t)),g),h((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),h((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=C();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),ft(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(m(this._snappingOperation.snapAgainNearPreviousMapPoint(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);P(t,i,{constraint:a,view:this.view})}}}))}destroy(){this._textureHandle=u(this._textureHandle),this._snappingOperation=d(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorMaterial.dispose()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[M((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{..._,equals:p}),h((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:a,computation:n}=t;switch(n.previousConstraint){case O.Horizontal:n.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case O.Vertical:n.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case O.Direct:n.preConstraintProperties={measureType:i.Direct,orientation:a};break;default:n.preConstraintProperties={measureType:e,orientation:a}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),f)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[h((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1})),h((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==O.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(m(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const s=new a({startPoint:b(n,new w),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=b(a,new w);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),a=this._setupPointManipulator(t,{isStart:!1}),n=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),p=this._setupMeasureTypeManipulator(t,i.Direct),l=this._setupMeasureTypeManipulator(t,i.Horizontal),u=this._setupMeasureTypeManipulator(t,i.Vertical),d=new T({start:e,end:a,offset:n,heading:s,rotation:o,direct:p,horizontal:l,vertical:u});this._setupComputationToManipulatorsSync(t,d),this._computationManipulators.set(t,d),this.manipulators.addMany(d.values());const c=r(d.values().map((t=>t.events.on("focus-changed",(()=>{d.values().some((t=>t.focused))&&this._resetSnappingState()})))));return{manipulators:d,remove:()=>{c.remove(),this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of d.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([h((()=>t.geometry),(()=>this._updateManipulators(t,e)),{..._,equals:p})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new x(i,{metadata:a}),s=G(n,{isStart:e.isStart,createSnappingPipelineStep:t=>mt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=z(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=U(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new V(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new V(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=A(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=R(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=k(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,a={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:s,firstGrabbedManipulator:o}=a,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=J(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==n&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);K(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;E(l,g,f),u.available&&L(u,t,f),d.available&&F(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&q(e,t,i,f)}))}_updateManipulatorStyle(t){const e=B(t),i=N(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=Q(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=W(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});D(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,Mt);const{state:e,renderCoordsHelper:i}=this.view,a=e.camera.computeScreenPixelSizeAt(Mt);t.dimension.offset=tt*a*i.unitInMeters}_computeConstraint(t){return H(j(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new pt({width:1,renderOccluded:st.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get test(){}};t([v({constructOnly:!0})],_t.prototype,"analysis",void 0),t([v({constructOnly:!0})],_t.prototype,"analysisViewData",void 0),t([v({constructOnly:!0})],_t.prototype,"manipulators",void 0),t([v({constructOnly:!0})],_t.prototype,"parentTool",void 0),t([v({constructOnly:!0,nonNullable:!0})],_t.prototype,"view",void 0),t([v({readOnly:!0})],_t.prototype,"updating",null),t([v()],_t.prototype,"firstGrabbedManipulator",null),t([v()],_t.prototype,"hasGrabbedManipulators",null),t([v()],_t.prototype,"snappingOptions",null),t([v()],_t.prototype,"_stagedDimension",void 0),t([v()],_t.prototype,"_activeComputation",null),t([v()],_t.prototype,"_stagedComputation",null),_t=t([y("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],_t);const Mt=C();export{_t as LengthDimensionSubTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../analysis/SlicePlane.js";import t from"../../../../core/Accessor.js";import a from"../../../../core/Logger.js";import{watch as l,sync as s}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as o}from"../../../../chunks/boundedPlane.js";import c from"../../../../layers/Layer.js";import h from"../../../../layers/buildingSublayers/BuildingComponentSublayer.js";import{isIBuildingSceneLayerView3D as u,projectAndElevationAlignShape as d,projectedShapeToPlane as p,planeToShape as y}from"./sliceToolUtils.js";import{logFailedGeometryProjectionError as w}from"../support/projectionUtils.js";import{isTerrainSurfaceLayer as v}from"../../terrain/isTerrainSurfaceLayer.js";let f=class extends t{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on("before-add",(e=>{const i=e.item;null!=i&&(i instanceof c||i instanceof h)?i instanceof c&&v(i)?(a.getLogger(this).error("excludedLayers",`Layer '${i.title}, id:${i.id}' of type '${i.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(i)&&e.preventDefault():(a.getLogger(this).error("excludedLayers","Invalid layer type, layer must derive from Layer or BuildingComponentSublayer"),e.preventDefault())}))),S(this.view,this),this.addHandles([l((()=>this.analysisViewData.plane),(()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()}),s),l((()=>this.analysis.excludeGroundSurface),(()=>this._updateLayerViews()),s),this.analysis.excludedLayers.on("change",(()=>this._updateLayerViews())),l((()=>[this.analysisViewData.active,this.analysisViewData.visible]),(()=>{this._updateActiveController(),this._updateViewSlicePlane()}),s),l((()=>this._allLayerAndSubLayerViews),(()=>this._updateLayerViews()))]),this.addHandles([l((()=>this.analysis.shape),(()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())}),s),l((()=>"web-scene"!==this.analysis.origin?.type),(()=>this._updateViewSlicePlaneDecoration()),s)],"analysis"),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slice.plane=null,this._updateActiveController(),this._updateViewSlicePlane()),L(this.view,this),this.set("view",null)}get _allLayerAndSubLayerViews(){const e=this.view.allLayerViews.items;return e.concat(e.filter(u).flatMap((({sublayerViews:e})=>e.items)))}_updateBoundedPlaneFromSlicePlane(){const e=this.analysis.shape,i=this._currentSlicePlane;if(null==i&&null==e||null!=i&&null!=e&&e.equals(i))return;let t=null,l=null;if(null!=e?.position){const i=e.position.spatialReference,s=d(e,this.view);null==s&&w(this.analysis,i,a.getLogger(this)),t=p(s,this.view,{tiltEnabled:this.analysis.tiltEnabled},o()),null!=t&&(l={heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height})}this._currentSlicePlane=l,this._internalChange=!0,this.analysisViewData.plane=t,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){const e=this.analysisViewData.plane,t=y(e,this.view,this.view.spatialReference,new i);let a=null;null!=t&&(a={heading:t.heading,tilt:t.tilt,position:t.position,width:t.width,height:t.height}),this._currentSlicePlane=a,this._internalChange=!0,this.analysis.shape=t,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(g)return;const e=b(this.view);if(!e)return;if(this.analysisViewData.active)null!=e.activeController&&e.activeController!==this?(g=!0,e.activeController.analysisViewData.active=!1,g=!1):null!=e.activeController&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(null!=e.activeController&&e.activeController!==this)return;null!=e.activeController&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}_updateViewSlicePlane(){V(this.view)}_updateViewSlicePlaneDecoration(){_(this.view)}_updateLayerViews(){const e=null!=this.analysisViewData.plane&&this.analysisViewData.visible&&this.analysisViewData.active,i=[],t=e=>{"layers"in e?e.layers.forEach(t):i.push(e)};this.analysis.excludedLayers.forEach(t),this.view.allLayerViews.forEach((t=>{t.destroyed||("slicePlaneEnabled"in t&&(t.slicePlaneEnabled=e&&!i.includes(t.layer)),"sublayerViews"in t&&t.sublayerViews.forEach((t=>{t.slicePlaneEnabled=e&&!i.includes(t.sublayer)})))})),null!=this.view.basemapTerrain&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};e([n()],f.prototype,"view",void 0),e([n()],f.prototype,"analysis",void 0),e([n()],f.prototype,"analysisViewData",void 0),e([n()],f.prototype,"_allLayerAndSubLayerViews",null),f=e([r("esri.views.3d.analysis.Slice.SliceController")],f);const m=new Map;let g=!1;function V(e){const i=b(e),t=i?.activeController;null!=t?.analysisViewData.plane&&t.analysisViewData.visible?e.slice.plane=t.analysisViewData.plane:e.slice.plane=null}function _(e){const i=b(e),t=i?.activeController;e.slice.isDecoration="web-scene"!==t?.analysis.origin?.type}function S(e,i){m.has(e)||m.set(e,{all:[],activeController:null}),m.get(e)?.all.push(i)}function b(e){return m.get(e)}function L(e,i){if(!m.has(e))throw new Error("view expected in global slice register");const t=m.get(e),a=t?.all.lastIndexOf(i)??-1;if(!t||-1===a)throw new Error("controller expected in global slice register");t.all.splice(a,1),0===t.all.length&&m.delete(e)}export{f as SliceController};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../analysis/SlicePlane.js";import t from"../../../../core/Accessor.js";import a from"../../../../core/Logger.js";import{watch as l,sync as s}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as o}from"../../../../chunks/boundedPlane.js";import c from"../../../../layers/Layer.js";import h from"../../../../layers/buildingSublayers/BuildingComponentSublayer.js";import{isIBuildingSceneLayerView3D as u,projectAndElevationAlignShape as d,projectedShapeToPlane as p,planeToShape as y}from"./sliceToolUtils.js";import{logFailedGeometryProjectionError as w}from"../support/projectionUtils.js";import{isTerrainSurfaceLayer as v}from"../../terrain/isTerrainSurfaceLayer.js";let f=class extends t{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on("before-add",(e=>{const i=e.item;null!=i&&(i instanceof c||i instanceof h)?i instanceof c&&v(i)?(a.getLogger(this).error("excludedLayers",`Layer '${i.title}, id:${i.id}' of type '${i.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(i)&&e.preventDefault():(a.getLogger(this).error("excludedLayers","Invalid layer type, layer must derive from Layer or BuildingComponentSublayer"),e.preventDefault())}))),S(this.view,this),this.addHandles([l((()=>this.analysisViewData.plane),(()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()}),s),l((()=>this.analysis.excludeGroundSurface),(()=>this._updateLayerViews()),s),this.analysis.excludedLayers.on("change",(()=>this._updateLayerViews())),l((()=>[this.analysisViewData.active,this.analysisViewData.visible]),(()=>{this._updateActiveController(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()}),s),l((()=>this._allLayerAndSubLayerViews),(()=>this._updateLayerViews()))]),this.addHandles([l((()=>this.analysis.shape),(()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())}),s),l((()=>"web-scene"!==this.analysis.origin?.type),(()=>this._updateViewSlicePlaneDecoration()),s)],"analysis"),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slice.plane=null,this._updateActiveController(),this._updateViewSlicePlane()),L(this.view,this),this.set("view",null)}get _allLayerAndSubLayerViews(){const e=this.view.allLayerViews.items;return e.concat(e.filter(u).flatMap((({sublayerViews:e})=>e.items)))}_updateBoundedPlaneFromSlicePlane(){const e=this.analysis.shape,i=this._currentSlicePlane;if(null==i&&null==e||null!=i&&null!=e&&e.equals(i))return;let t=null,l=null;if(null!=e?.position){const i=e.position.spatialReference,s=d(e,this.view);null==s&&w(this.analysis,i,a.getLogger(this)),t=p(s,this.view,{tiltEnabled:this.analysis.tiltEnabled},o()),null!=t&&(l={heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height})}this._currentSlicePlane=l,this._internalChange=!0,this.analysisViewData.plane=t,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){const e=this.analysisViewData.plane,t=y(e,this.view,this.view.spatialReference,new i);let a=null;null!=t&&(a={heading:t.heading,tilt:t.tilt,position:t.position,width:t.width,height:t.height}),this._currentSlicePlane=a,this._internalChange=!0,this.analysis.shape=t,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(g)return;const e=b(this.view);if(!e)return;if(this.analysisViewData.active)null!=e.activeController&&e.activeController!==this?(g=!0,e.activeController.analysisViewData.active=!1,g=!1):null!=e.activeController&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(null!=e.activeController&&e.activeController!==this)return;null!=e.activeController&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}_updateViewSlicePlane(){V(this.view)}_updateViewSlicePlaneDecoration(){_(this.view)}_updateLayerViews(){const e=null!=this.analysisViewData.plane&&this.analysisViewData.visible&&this.analysisViewData.active,i=[],t=e=>{"layers"in e?e.layers.forEach(t):i.push(e)};this.analysis.excludedLayers.forEach(t),this.view.allLayerViews.forEach((t=>{t.destroyed||("slicePlaneEnabled"in t&&(t.slicePlaneEnabled=e&&!i.includes(t.layer)),"sublayerViews"in t&&t.sublayerViews.forEach((t=>{t.slicePlaneEnabled=e&&!i.includes(t.sublayer)})))})),null!=this.view.basemapTerrain&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};e([n()],f.prototype,"view",void 0),e([n()],f.prototype,"analysis",void 0),e([n()],f.prototype,"analysisViewData",void 0),e([n()],f.prototype,"_allLayerAndSubLayerViews",null),f=e([r("esri.views.3d.analysis.Slice.SliceController")],f);const m=new Map;let g=!1;function V(e){const i=b(e),t=i?.activeController;null!=t?.analysisViewData.plane&&t.analysisViewData.visible?e.slice.plane=t.analysisViewData.plane:e.slice.plane=null}function _(e){const i=b(e),t=i?.activeController;e.slice.isDecoration="web-scene"!==t?.analysis.origin?.type}function S(e,i){m.has(e)||m.set(e,{all:[],activeController:null}),m.get(e)?.all.push(i)}function b(e){return m.get(e)}function L(e,i){if(!m.has(e))throw new Error("view expected in global slice register");const t=m.get(e),a=t?.all.lastIndexOf(i)??-1;if(!t||-1===a)throw new Error("controller expected in global slice register");t.all.splice(a,1),0===t.all.length&&m.delete(e)}export{f as SliceController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{
|
|
5
|
+
import{createTask as o}from"../../core/asyncUtils.js";import{handlesGroup as t}from"../../core/handleUtils.js";import{removeMaybe as e}from"../../core/maybe.js";import{throwIfAborted as n,isAbortError as i,onAbort as a}from"../../core/promiseUtils.js";import{watch as r,syncAndInitial as l,on as s,whenOnce as c}from"../../core/reactiveUtils.js";function u(t,n){t.interactive=!0;const{tool:i,view:r}=t;r.activeTool=i;let l=a(n,(()=>{r.activeTool===i&&(r.activeTool=null)}));return o((async o=>{await c((()=>!t.tool?.active),o),l=e(l)}),n)}function m(o,t){return r((()=>o.interactive),(()=>p(o,t)),l)}function p(o,t){o.interactive?v(o,t):f(o)}function v(o,t){f(o);const{view:e,analysis:n}=o,i=new t({view:e,analysis:n,analysisViewData:o});return o.tool=i,e.tools.add(i),i}function f(o){const{view:t,tool:e}=o;null!=e&&(t.tools.remove(e),o.tool=null)}function y(e,a){const r=e.userOperation,l=o((async o=>{if(r){const t=r.promise.catch((()=>{}));r?.abort(),await t,n(o)}const l=u(e,{signal:o}),c=a?.shouldRejectOnCancel??(()=>!0),m=t([s((()=>e.tool),"cancel",(()=>{c()&&l.abort()}))]),{tool:p}=e;try{p&&(p.resetCreated(),a?.onToolActivated?.(p)),await l.promise,n(o)}catch(v){if(o.aborted||!i(v)||c())throw v}finally{m?.remove()}}),{signal:a?.abortOptions?.signal});return e.userOperation=l,l.promise.finally((()=>{e.userOperation===l&&(e.userOperation=null)}))}function d(o,t){const e=o.analysis.clone();return y(o,{abortOptions:t?.placementOptions,onToolActivated:t?.onToolActivated,shouldRejectOnCancel:()=>{const{analysis:t}=o;return!t.valid||t.equals(e)}})}export{u as activateAnalysisViewTool,m as connectAnalysisViewToTool,f as removeAnalysisViewTool,y as startExclusiveInteractiveOperation,d as startPlaceOperation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import t from"../../core/Accessor.js";import{deprecated as r}from"../../core/deprecate.js";import i from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Point.js";let n=class extends t{constructor(e){super(e),this.location=null,this.intersectedLocation=null,this.intersectedGraphic=null,this.visible=void 0,r(i.getLogger(this),"LineOfSightTarget",{replacement:"Use the LineOfSightAnalysisTarget on LineOfSightAnalysis instead.",warnOnce:!0,version:"4.33"})}};e([s({type:p})],n.prototype,"location",void 0),e([s({type:p})],n.prototype,"intersectedLocation",void 0),e([s({type:o})],n.prototype,"intersectedGraphic",void 0),e([s({type:Boolean})],n.prototype,"visible",void 0),n=e([c("esri.widgets.LineOfSight.LineOfSightTarget")],n);const a=n;export{a as default};
|