@arcgis/core 4.25.0-next.20220921 → 4.25.0-next.20220923
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/README.md +17 -9
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/10892098faaf2f36fd0a.js +1 -0
- package/assets/esri/core/workers/chunks/28932ef68b6f3784c760.js +1 -0
- package/assets/esri/core/workers/chunks/2dca9023f01864f724cb.js +1 -0
- package/assets/esri/core/workers/chunks/477e02c178d392cde5d3.js +1 -0
- package/assets/esri/core/workers/chunks/{cc7569489b572b8b3b53.js → 4ef7e925f94ee85f79bb.js} +1 -1
- package/assets/esri/core/workers/chunks/b175a80296002ee9bca8.js +1 -0
- package/assets/esri/core/workers/chunks/{b8eba8c9d5424a7ae5f2.js → c06e7bd2468646631db2.js} +1 -1
- package/assets/esri/core/workers/chunks/e00327925ca82b63fded.js +1 -0
- package/assets/esri/core/workers/chunks/{64de93865088bbe0398f.js → e57a4d66f74510ce7a61.js} +1 -1
- package/assets/esri/core/workers/chunks/fb82788888990fbea11e.js +1 -0
- package/assets/esri/libs/linkchartlayout/lclayout.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BasemapGallery.scss +2 -2
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/dark/main.scss +7 -5
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ar.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_bg.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_bs.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ca.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_cs.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_da.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_de.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_el.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_en.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_es.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_et.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_fi.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_fr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_he.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_hr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_hu.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_id.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_it.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ja.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ko.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_lt.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_lv.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_nb.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_nl.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_pl.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_pt-BR.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_pt-PT.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ro.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_ru.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sk.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sl.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_sv.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_th.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_tr.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_uk.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_vi.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_zh-CN.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_zh-HK.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_zh-TW.json +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/form/elements/inputs/ComboBoxInput.js +1 -1
- package/form/elements/inputs/RadioButtonsInput.js +1 -1
- package/interfaces.d.ts +957 -5
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/networks/support/NetworkSystemLayers.js +5 -0
- package/package.json +1 -1
- package/rest/knowledgeGraph/DataModel.d.ts +4 -0
- package/rest/knowledgeGraph/Entity.d.ts +4 -0
- package/rest/knowledgeGraph/EntityType.d.ts +4 -0
- package/rest/knowledgeGraph/FieldIndex.d.ts +4 -0
- package/rest/knowledgeGraph/GraphNamedObject.d.ts +4 -0
- package/rest/knowledgeGraph/GraphObject.d.ts +4 -0
- package/rest/knowledgeGraph/GraphObjectType.d.ts +4 -0
- package/rest/knowledgeGraph/GraphProperty.d.ts +4 -0
- package/rest/knowledgeGraph/GraphQuery.d.ts +4 -0
- package/rest/knowledgeGraph/GraphQueryResult.d.ts +4 -0
- package/rest/knowledgeGraph/GraphSearch.d.ts +4 -0
- package/rest/knowledgeGraph/KnowledgeGraph.d.ts +4 -0
- package/rest/knowledgeGraph/Path.d.ts +4 -0
- package/rest/knowledgeGraph/Relationship.d.ts +4 -0
- package/rest/knowledgeGraph/RelationshipType.d.ts +4 -0
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/knowledgeGraphService.d.ts +4 -0
- package/rest/support/AggregateFeatureSet.js +1 -1
- package/support/featureFlags.js +1 -1
- package/support/revision.js +1 -1
- package/support/webSceneUtils.js +1 -1
- package/views/2d/MapViewConstraints.js +1 -1
- package/views/2d/constraints/GeometryConstraint.js +1 -1
- package/views/2d/constraints/RotationConstraint.js +1 -1
- package/views/2d/constraints/ZoomConstraint.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/layers/MapImageLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerFeatureView3D.js +5 -0
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/interactive/tooltip/ReshapeTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FormExpressionArcadeExecutor.js +5 -0
- package/widgets/FeatureForm/FormExpressionsManager.js +5 -0
- package/widgets/FeatureForm/InputField.js +1 -1
- package/widgets/FeatureForm/InputFieldGroup.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/01ac91fc0bc6b4d4e3c6.js +0 -1
- package/assets/esri/core/workers/chunks/43e4560d65e5ddeeef6f.js +0 -1
- package/assets/esri/core/workers/chunks/58824250492b89ec24ea.js +0 -1
- package/assets/esri/core/workers/chunks/64a6b837f1d5d7ad7619.js +0 -1
- package/assets/esri/core/workers/chunks/d1be3ab7846e3a555b6c.js +0 -1
- package/assets/esri/core/workers/chunks/e20e99f8f76f5002437e.js +0 -1
- package/assets/esri/core/workers/chunks/ef95d6ab7b1c032ab4ad.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isNone as t,isSome as s,applySome as r}from"../../../../../core/maybe.js";import{diff as o,hasDiff as a}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as i}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as h,setGeohashXY as n}from"../../../../../geohash/geohashUtils.js";import{fromRect as l}from"../../../../../geometry/support/aaBoundingBox.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as g}from"../../../../../geometry/support/spatialReferenceUtils.js";import{getBoundsOptimizedGeometry as c,quantizeX as d,quantizeY as f,convertFromPolygon as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as m,OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import y from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as I,project as b}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as v}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as R}from"../../../engine/webgl/DisplayId.js";import{featureAdapter as M}from"../FeatureStore2D.js";import{Store2D as x}from"../Store2D.js";import{FeatureSetReaderJSON as C}from"./FeatureSetReaderJSON.js";import j from"../../../../../geometry/SpatialReference.js";import L from"../../../../../geometry/Polygon.js";import B from"../../../../../geometry/Extent.js";const F=12,w=64,S=1;class V extends m{constructor(e,t,s,r,o){super(new y([],[t,s]),r,null,e),this.geohashBoundsInfo=o}get count(){return this.attributes.cluster_count}static create(e,t,s,r,o,a,i,h){const n=new V(t,s,r,a,i);return n.displayId=e.createDisplayId(!0),n.referenceId=h,n.tileLevel=o,n}update(e,t,s,r,o,a){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=o,this.referenceId=null,this.referenceId=a,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function T(e){return 57.29577951308232*e}class D extends x{constructor(t,s,r,o){super(t,r),this.events=new e,this.objectIdField="aggregateId",this.featureAdapter=M,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=o,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=I(s,j.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,s){const r=this._schema;try{await super.updateSchema(e,s),await this._projectionSupportCheck}catch(n){}this._fields=this._schema.params.fields;const h=o(r,s);s&&(!t(h)||e.source||e.storage.filters)?((a(h,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new i(this._statisticFields,this._serviceInfo),this._rebuildTree(),has("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),has("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",h),e.targets[s.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):r&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){this._clusters.forEach(((r,o)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(o))}))}onTileData(e,s,r,o,a=!0){if(!this._schema||t(s.addOrUpdate))return s;const i=this._getTransforms(e,this._spatialReference);{const e=s.addOrUpdate.getCursor();for(;e.next();)this._update(e,o)}if(s.status.mesh||!a)return s;const h=new Array,n=this._schema.params.clusterRadius;this._getClustersForTile(h,e,n,r,i),s.addOrUpdate=C.fromOptimizedFeatures(h,this._serviceInfo),s.addOrUpdate.attachStorage(r),s.clear=!0,s.end=!0;{const t=s.addOrUpdate.getCursor();for(;t.next();){const s=t.getDisplayId();this._bitsets.computed.unset(s),this.setComputedAttributes(r,t,s,e.scale)}}return this._aggregateValueRangesChanged&&s.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),s}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((t?.displayId&R)==(e&R))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach((t=>{if(!t)return;const s=t.toJSON(),r=C.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,s,r){const{hasM:o,hasZ:a}=this.geometryInfo;for(const i of e){const e=c([0,0,0,0],i.readGeometry(),a,o);t(e)||s(l(r,e))}}toArray(){const e=[];return this.forEach((t=>e.push(t))),e}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),o=this._geohashBuf[2*t],a=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,o,a,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,o=t.isVisible(s);if(o===r.has(s))return;if(!o)return void this._remove(e);const a=e.getXHydrated(),i=e.getYHydrated();if(!this._setGeohash(s,a,i))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,a,i,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const o=T(t/u.radius),a=o-360*Math.floor((o+180)/360),i=T(Math.PI/2-2*Math.atan(Math.exp(-s/u.radius)));h(r,e,i,a,F)}else{const o=b({x:t,y:s},this._spatialReference,j.WGS84);if(!o)return!1;h(r,e,o.y,o.x,F)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,o,a,i,h,n=!0){const l=this._schema.params.clusterPixelBuffer,u=2*a,g=Math.ceil(2**o.key.level*v/u)+1,c=Math.ceil(l/u)+0,p=Math.ceil(v/u),{row:m,col:y}=o.key,I=y*v,b=m*v,R=Math.floor(I/u)-c,M=Math.floor(b/u)-c,x=R+p+2*c,C=M+p+2*c,j=o.tileInfoView.getLODInfoAt(o.key.level);for(let v=R;v<=x;v++)for(let a=M;a<=C;a++){let l=v;j.wrap&&(l=v<0?v+g:v%g);const u=j.wrap&&v<0,c=j.wrap&&v%g!==v,p=this._lookupCluster(i,j,o.key.level,l,a,o);if(s(p)){const o=r(h,(e=>u?e.left:c?e.right:e.tile));if(n&&t(o))continue;if(!p.count)continue;if(s(o)&&n){const t=p.geometry.clone();let r=p.attributes;t.coords[0]=d(o,t.coords[0]),t.coords[1]=f(o,t.coords[1]),1===p.count&&s(p.referenceId)&&(r={...p.attributes,referenceId:p.referenceId});const a=new _(t,r);a.displayId=p.displayId,e.push(a)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),F)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/S)+1)*S-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=g(t);if(!r)return{tile:s,left:null,right:null};const[o,a]=r.valid;return{tile:s,left:{...s,translate:[a,e.bounds[3]]},right:{...s,translate:[o-a+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,o=2*r;let a=s%2?t*o:t*o-r;const i=s*o;let h=a+o;const n=i-o,l=2**e.level*v;e.wrap&&a<0&&(a=0),e.wrap&&h>l&&(h=l);const u=a/v,g=i/v,c=h/v,d=n/v;return[e.getXForColumn(u),e.getYForRow(g),e.getXForColumn(c),e.getYForRow(d)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return n(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[e,r,o,a]=t,i={x:e,y:r},h={x:o,y:a};let l=0,g=0,c=0,d=0;{const e=T(i.x/u.radius);l=e-360*Math.floor((e+180)/360),g=T(Math.PI/2-2*Math.atan(Math.exp(-i.y/u.radius)))}{const e=T(h.x/u.radius);c=e-360*Math.floor((e+180)/360),d=T(Math.PI/2-2*Math.atan(Math.exp(-h.y/u.radius)))}const f={geohashX:0,geohashY:0},p={geohashX:0,geohashY:0};n(f,g,l,s),n(p,d,c,s);return{bounds:[e,r,o,a],geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:p.geohashX,yTR:p.geohashY},level:s}}const r=L.fromExtent(B.fromBounds(t,this._spatialReference)),o=b(r,this._spatialReference,j.WGS84,{densificationStep:e.resolution*w});if(!o)return null;const a=p(new y,o,!1,!1),i=a.coords.filter(((e,t)=>!(t%2))),h=a.coords.filter(((e,t)=>t%2)),l=Math.min(...i),g=Math.min(...h),c=Math.max(...i),d=Math.max(...h),f=this._getGeohash(l,g,s),m=this._getGeohash(c,d,s);return{bounds:t,geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:m.geohashX,yTR:m.geohashY},level:s}}_lookupCluster(e,r,o,a,i,h){const n=this._getClusterId(o,a,i),l=this._clusters.get(n),u=this._getClusterBounds(r,a,i),g=this._getGeohashBounds(h,u);if(t(g))return null;const c=this._tree.getRegionStatistics(g),{count:d,xTotal:f,yTotal:p,referenceId:m}=c,_=d?f/d:0,y=d?p/d:0;if(0===d)return this._clusters.set(n,null),null;const I={cluster_count:d,...c.attributes},b=s(l)?l.update(_,y,o,I,g,m):V.create(e,n,_,y,o,I,g,m);if(0===d){const[e,t,s,r]=u;b.geometry.coords[0]=(e+s)/2,b.geometry.coords[1]=(t+r)/2}return this._clusters.set(n,b),this._updateAggregateValueRangeForCluster(b,b.tileLevel),b}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,o=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(o,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&o===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(v/s),{row:o,col:a}=e.key,i=a*v,h=o*v,n=Math.floor(i/s),l=Math.floor(h/s);for(let u=n;u<n+r;u++)for(let t=l;t<l+r;t++)this._markForDeletion(e.key.level,u,t)}}export{V as ClusterInfo,D as ClusterStore};
|
|
5
|
+
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isNone as t,isSome as s,applySome as r}from"../../../../../core/maybe.js";import{diff as o,hasDiff as a}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as i}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as h,setGeohashXY as n}from"../../../../../geohash/geohashUtils.js";import{fromRect as l}from"../../../../../geometry/support/aaBoundingBox.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as g}from"../../../../../geometry/support/spatialReferenceUtils.js";import{getBoundsOptimizedGeometry as c,quantizeX as d,quantizeY as f,convertFromPolygon as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as m,OptimizedFeature as _}from"../../../../../layers/graphics/OptimizedFeature.js";import y from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as I,project as b}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as v}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as R}from"../../../engine/webgl/DisplayId.js";import{featureAdapter as M}from"../FeatureStore2D.js";import{Store2D as x}from"../Store2D.js";import{FeatureSetReaderJSON as C}from"./FeatureSetReaderJSON.js";import j from"../../../../../geometry/SpatialReference.js";import L from"../../../../../geometry/Polygon.js";import B from"../../../../../geometry/Extent.js";const F=12,w=64,S=1;class V extends m{constructor(e,t,s,r,o){super(new y([],[t,s]),r,null,e),this.geohashBoundsInfo=o}get count(){return this.attributes.cluster_count}static create(e,t,s,r,o,a,i,h){const n=new V(t,s,r,a,i);return n.displayId=e.createDisplayId(!0),n.referenceId=h,n.tileLevel=o,n}update(e,t,s,r,o,a){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=o,this.referenceId=null,this.referenceId=a,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function T(e){return 57.29577951308232*e}class D extends x{constructor(t,s,r,o){super(t,r),this.events=new e,this.objectIdField="aggregateId",this.featureAdapter=M,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=o,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=I(s,j.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,s){const r=this._schema;try{await super.updateSchema(e,s),await this._projectionSupportCheck}catch(n){}this._fields=this._schema.params.fields;const h=o(r,s);s&&(!t(h)||e.source||e.storage.filters)?((a(h,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new i(this._statisticFields,this._serviceInfo),this._rebuildTree(),has("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),has("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",h),e.targets[s.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):r&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){this._clusters.forEach(((r,o)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(o))}))}onTileData(e,s,r,o,a=!0){if(!this._schema||t(s.addOrUpdate))return s;this.events.emit("changed");const i=this._getTransforms(e,this._spatialReference);{const e=s.addOrUpdate.getCursor();for(;e.next();)this._update(e,o)}if(s.status.mesh||!a)return s;const h=new Array,n=this._schema.params.clusterRadius;this._getClustersForTile(h,e,n,r,i),s.addOrUpdate=C.fromOptimizedFeatures(h,this._serviceInfo),s.addOrUpdate.attachStorage(r),s.clear=!0,s.end=!0;{const t=s.addOrUpdate.getCursor();for(;t.next();){const s=t.getDisplayId();this._bitsets.computed.unset(s),this.setComputedAttributes(r,t,s,e.scale)}}return this._aggregateValueRangesChanged&&s.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),s}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((t?.displayId&R)==(e&R))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach((t=>{if(!t)return;const s=t.toJSON(),r=C.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,s,r){const{hasM:o,hasZ:a}=this.geometryInfo;for(const i of e){const e=c([0,0,0,0],i.readGeometry(),a,o);t(e)||s(l(r,e))}}toArray(){const e=[];return this.forEach((t=>e.push(t))),e}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),o=this._geohashBuf[2*t],a=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,o,a,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,o=t.isVisible(s);if(o===r.has(s))return;if(!o)return void this._remove(e);const a=e.getXHydrated(),i=e.getYHydrated();if(!this._setGeohash(s,a,i))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,a,i,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const o=T(t/u.radius),a=o-360*Math.floor((o+180)/360),i=T(Math.PI/2-2*Math.atan(Math.exp(-s/u.radius)));h(r,e,i,a,F)}else{const o=b({x:t,y:s},this._spatialReference,j.WGS84);if(!o)return!1;h(r,e,o.y,o.x,F)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,o,a,i,h,n=!0){const l=this._schema.params.clusterPixelBuffer,u=2*a,g=Math.ceil(2**o.key.level*v/u)+1,c=Math.ceil(l/u)+0,p=Math.ceil(v/u),{row:m,col:y}=o.key,I=y*v,b=m*v,R=Math.floor(I/u)-c,M=Math.floor(b/u)-c,x=R+p+2*c,C=M+p+2*c,j=o.tileInfoView.getLODInfoAt(o.key.level);for(let v=R;v<=x;v++)for(let a=M;a<=C;a++){let l=v;j.wrap&&(l=v<0?v+g:v%g);const u=j.wrap&&v<0,c=j.wrap&&v%g!==v,p=this._lookupCluster(i,j,o.key.level,l,a,o);if(s(p)){const o=r(h,(e=>u?e.left:c?e.right:e.tile));if(n&&t(o))continue;if(!p.count)continue;if(s(o)&&n){const t=p.geometry.clone();let r=p.attributes;t.coords[0]=d(o,t.coords[0]),t.coords[1]=f(o,t.coords[1]),1===p.count&&s(p.referenceId)&&(r={...p.attributes,referenceId:p.referenceId});const a=new _(t,r);a.displayId=p.displayId,e.push(a)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),F)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/S)+1)*S-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=g(t);if(!r)return{tile:s,left:null,right:null};const[o,a]=r.valid;return{tile:s,left:{...s,translate:[a,e.bounds[3]]},right:{...s,translate:[o-a+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,o=2*r;let a=s%2?t*o:t*o-r;const i=s*o;let h=a+o;const n=i-o,l=2**e.level*v;e.wrap&&a<0&&(a=0),e.wrap&&h>l&&(h=l);const u=a/v,g=i/v,c=h/v,d=n/v;return[e.getXForColumn(u),e.getYForRow(g),e.getXForColumn(c),e.getYForRow(d)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return n(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[e,r,o,a]=t,i={x:e,y:r},h={x:o,y:a};let l=0,g=0,c=0,d=0;{const e=T(i.x/u.radius);l=e-360*Math.floor((e+180)/360),g=T(Math.PI/2-2*Math.atan(Math.exp(-i.y/u.radius)))}{const e=T(h.x/u.radius);c=e-360*Math.floor((e+180)/360),d=T(Math.PI/2-2*Math.atan(Math.exp(-h.y/u.radius)))}const f={geohashX:0,geohashY:0},p={geohashX:0,geohashY:0};n(f,g,l,s),n(p,d,c,s);return{bounds:[e,r,o,a],geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:p.geohashX,yTR:p.geohashY},level:s}}const r=L.fromExtent(B.fromBounds(t,this._spatialReference)),o=b(r,this._spatialReference,j.WGS84,{densificationStep:e.resolution*w});if(!o)return null;const a=p(new y,o,!1,!1),i=a.coords.filter(((e,t)=>!(t%2))),h=a.coords.filter(((e,t)=>t%2)),l=Math.min(...i),g=Math.min(...h),c=Math.max(...i),d=Math.max(...h),f=this._getGeohash(l,g,s),m=this._getGeohash(c,d,s);return{bounds:t,geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:m.geohashX,yTR:m.geohashY},level:s}}_lookupCluster(e,r,o,a,i,h){const n=this._getClusterId(o,a,i),l=this._clusters.get(n),u=this._getClusterBounds(r,a,i),g=this._getGeohashBounds(h,u);if(t(g))return null;const c=this._tree.getRegionStatistics(g),{count:d,xTotal:f,yTotal:p,referenceId:m}=c,_=d?f/d:0,y=d?p/d:0;if(0===d)return this._clusters.set(n,null),null;const I={cluster_count:d,...c.attributes},b=s(l)?l.update(_,y,o,I,g,m):V.create(e,n,_,y,o,I,g,m);if(0===d){const[e,t,s,r]=u;b.geometry.coords[0]=(e+s)/2,b.geometry.coords[1]=(t+r)/2}return this._clusters.set(n,b),this._updateAggregateValueRangeForCluster(b,b.tileLevel),b}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,o=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(o,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&o===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(v/s),{row:o,col:a}=e.key,i=a*v,h=o*v,n=Math.floor(i/s),l=Math.floor(h/s);for(let u=n;u<n+r;u++)for(let t=l;t<l+r;t++)this._markForDeletion(e.key.level,u,t)}}export{V as ClusterInfo,D as ClusterStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{convertFromFeatures as r,convertFromFeatureSet as s,convertToFeature as i,convertToGeometry as n,getQuantizedArea as o,unquantizeOptimizedGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as u}from"../../../../../layers/graphics/OptimizedFeature.js";import{FeatureSetReader as
|
|
5
|
+
import{isNone as t,isSome as e}from"../../../../../core/maybe.js";import{convertFromFeatures as r,convertFromFeatureSet as s,convertToFeature as i,convertToGeometry as n,getQuantizedArea as o,unquantizeOptimizedGeometry as a}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as u}from"../../../../../layers/graphics/OptimizedFeature.js";import h from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetReader as d}from"./FeatureSetReader.js";function c({coords:t,lengths:e}){let r=0;for(const s of e){for(let e=1;e<s;e++)t[2*(r+e)]+=t[2*(r+e)-2],t[2*(r+e)+1]+=t[2*(r+e)-1];r+=s}}class _ extends d{constructor(t,e,r){super(t,r),this._exceededTransferLimit=!1,this._featureIndex=-1,this._dateFields=new Set,this._geometryType=r?.geometryType,this._features=e}static fromFeatures(t,e){const{objectIdField:s,geometryType:i}=e,n=r([],t,i,!1,!1,s);for(let r=0;r<n.length;r++)n[r].displayId=t[r].displayId;return _.fromOptimizedFeatures(n,e)}static fromFeatureSet(t,e){const r=s(t,e.objectIdField);return _.fromOptimizedFeatureSet(r,e)}static fromOptimizedFeatureSet(t,e){const{features:r}=t,s=_.fromOptimizedFeatures(r,e);s._exceededTransferLimit=t.exceededTransferLimit,s._transform=t.transform;for(const i of t.fields)"esriFieldTypeDate"===i.type&&s._dateFields.add(i.name);return s}static fromOptimizedFeatures(t,e,r){const s=d.createInstance(),i=new _(s,t,e);return i._transform=r,i}get _current(){return this._features[this._featureIndex]}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}removeIds(t){const e=new Set(t);this._features=this._features.filter((t=>!(t.objectId&&e.has(t.objectId))))}append(t){for(const e of t)this._features.push(e)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getIndex(){return this._featureIndex}setIndex(t){this._featureIndex=t}getObjectId(){return this._current.objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){this._current.displayId=t}getGroupId(){return this._current.groupId}setGroupId(t){this._current.groupId=t}copy(){const t=new _(this.instance,this._features,this.fullSchema());return this.copyInto(t),t}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readLegacyFeature(){return i(this._current,this.geometryType,this.hasZ,this.hasM)}readOptimizedFeature(){return this._current}readLegacyPointGeometry(){return this.readGeometry()?{x:this.getX(),y:this.getY()}:null}readLegacyGeometry(){const t=this.readGeometry();return n(t,this.geometryType,this.hasZ,this.hasM)}readLegacyCentroid(){const e=this.readCentroid();return t(e)?null:{x:e.coords[0]*this._sx+this._tx,y:e.coords[1]*this._sy+this._ty}}readGeometryArea(){return u(this._current)?o(this._current.geometry,2):0}readUnquantizedGeometry(){const t=this.readGeometry();if("esriGeometryPoint"===this.geometryType||!t)return t;const e=t.clone();return c(e),e}readHydratedGeometry(){const r=this._current.geometry;if(t(r))return null;const s=r.clone();return e(this._transform)&&a(s,s,this.hasZ,this.hasM,this._transform),s}getXHydrated(){if(!u(this._current))return 0;const e=this._current.geometry.coords[0],r=this.getQuantizationTransform();return t(r)?e:e*r.scale[0]+r.translate[0]}getYHydrated(){if(!u(this._current))return 0;const e=this._current.geometry.coords[1],r=this.getQuantizationTransform();return t(r)?e:r.translate[1]-e*r.scale[1]}getX(){return u(this._current)?this._current.geometry.coords[0]*this._sx+this._tx:0}getY(){return u(this._current)?this._current.geometry.coords[1]*this._sy+this._ty:0}readGeometry(){if(!u(this._current)){if(e(this._current.centroid)){const[t,e]=this._current.centroid.coords;return new h([5],[t-1,e+1,2,0,0,-2,-2,0,0,2])}return null}const t=this._current.geometry.clone();if(t.isPoint)return t.coords[0]=t.coords[0]*this._sx+this._tx,t.coords[1]=t.coords[1]*this._sy+this._ty,t;let r=0;for(const e of t.lengths)t.coords[2*r]=t.coords[2*r]*this._sx+this._tx,t.coords[2*r+1]=t.coords[2*r+1]*this._sy+this._ty,r+=e;return t}readCentroid(){return u(this._current)?this._computeCentroid():this._current.centroid}hasField(t){if(t in this._current.attributes)return!0;return this.getFieldNames().map((t=>t.toLowerCase())).includes(t.toLowerCase())}getFieldNames(){return Object.keys(this._current.attributes)}_readAttribute(t,e){const r=this._current.attributes[t];if(void 0!==r)return null!=r&&e&&this._dateFields.has(t)?new Date(r):r;const s=this.readAttributes(),i=t.toLocaleLowerCase().trim();for(const n in s)if(n.toLocaleLowerCase().trim()===i){const t=this._current.attributes[n];return null!=t&&e&&this._dateFields.has(n)?new Date(t):t}}copyInto(t){super.copyInto(t),t._featureIndex=this._featureIndex,t._transform=this._transform,t._dateFields=this._dateFields}_readAttributes(){return this._current.attributes}}export{_ as FeatureSetReaderJSON};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{isNone as r,isSome as s,assertIsSome as i}from"../../../../../core/maybe.js";import n from"../../../../../core/pbf.js";import{convertToGeometry as a,unquantizeOptimizedGeometry as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as o}from"../../../../../layers/graphics/OptimizedFeature.js";import d from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";import{parseHeader as c}from"./FeatureSetReaderPBFHeader.js";const g=!0,_=268435455,l=128,f=128e3,y={small:{delta:new Int32Array(l),decoded:new Int32Array(l)},large:{delta:new Int32Array(f),decoded:new Int32Array(f)}};function I(e){return e<=y.small.delta.length?y.small:(e<=y.large.delta.length||(y.large.delta=new Int32Array(Math.round(1.25*e)),y.large.decoded=new Int32Array(Math.round(1.25*e))),y.large)}function p(e){return e.toLowerCase().trim()}function m(r){try{const e=2,t=new n(new Uint8Array(r),new DataView(r));for(;t.next();){if(t.tag()===e)return x(t.getMessage());t.skip()}}catch(s){const r=new e("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:s});t.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r)}return null}function x(e){const t=1;for(;e.next();){if(e.tag()===t)return e.getMessage();e.skip()}return null}function S(e){const t=1,r=2,s=3,i=4,n=5,a=6,h=7,o=8,d=9,u=e.getLength(),c=e.pos()+u;for(;e.pos()<c&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case i:return e.getSInt32();case n:return e.getUInt32();case a:return e.getInt64();case h:return e.getUInt64();case o:return e.getSInt64();case d:return e.getBool();default:return e.skip(),null}return null}function F(e,t,r,s,i,n){return.5*Math.abs(e*s+r*n+i*t-e*n-r*t-i*s)}function G(e,t,r,s){return 0===e*s-r*t&&e*r+t*s>0}class v extends u{constructor(e,t,r,s){super(e,s),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=s.geometryType,this._reader=t,this._header=r,this._hasNext=r.hasFeatures,this._isPoints="esriGeometryPoint"===s.geometryType}static fromBuffer(e,t,r=!1){const s=t.geometryType,i=m(e),n=c(i,"esriGeometryPoint"===s,r),a=u.createInstance();return new v(a,i,n,t)}get geometryType(){return this._geometryType}get _size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}hasField(e){return this._header.hasField(e)||this._header.hasField(p(e))}getFieldNames(){return this._header.fields.map((e=>e.fieldName))}getSize(){return this._size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";return this._header.fields.forEach((({index:t})=>{e+=this._readAttributeAtIndex(t)+"."})),e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(void 0===this._cache.legacyFeature){const e=this.readCentroid(),t={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null};return this._cache.legacyFeature=t,t}return this._cache.legacyFeature}readOptimizedFeature(){if(void 0===this._cache.optFeature){const e=new o(this.readGeometry(),this.readAttributes(),this.readCentroid());return e.objectId=this.getObjectId(),e.displayId=this.getDisplayId(),this._cache.optFeature=e,e}return this._cache.optFeature}getXHydrated(){const e=this._header.centroid[2*this._featureIndex],t=this.getQuantizationTransform();return r(t)?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return r(t)?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readGeometry(e);return a(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,r]=e.coords;return{x:t,y:r}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(void 0===this._cache.unquantGeometry){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;const r=I(t.coords.length).decoded,s=t.clone(r),i=s.coords;let n=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(n+t),r=2*(n+t-1);i[e]+=i[r],i[e+1]+=i[r+1]}n+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}readHydratedGeometry(){if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===_)return null;const e=this.getXHydrated(),t=this.getYHydrated();return new d([],[e,t])}const e=this.readGeometry();if(!e)return null;const t=e.clone(),r=this.getQuantizationTransform();return s(r)&&h(t,t,this.hasZ,this.hasM,r),t}readGeometry(e=!1){if(void 0===this._cache.geometry){let r=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===_)return null;const e=this.getX(),t=this.getY();r=new d([],[e,t])}else{const s=this._header.offsets.geometry[this._featureIndex],i=this._reader;if(0===s)return null;i.move(s);try{r=e?this._parseGeometryForDisplay(i):this._parseGeometry(i)}catch(t){return console.error("Failed to parse geometry!",t),null}}return this._cache.geometry=r,r}return this._cache.geometry}readCentroid(){if(void 0===this._cache.centroid){let e;const t=this._header.centroid[2*this._featureIndex]+this._tx,r=this._header.centroid[2*this._featureIndex+1]+this._ty;return t===_?(e=this._computeCentroid(),e&&(this._header.centroid[2*this._featureIndex]=e.coords[0]-this._tx,this._header.centroid[2*this._featureIndex+1]=e.coords[1]-this._ty)):e=new d([],[t,r]),this._cache.centroid=e??void 0,e??null}return this._cache.centroid}copy(){const e=this._reader.clone(),t=new v(this.instance,e,this._header,this.fullSchema());return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}_readAttribute(e,t){const r=this._header.hasField(e)?e:p(e),s=this._header.getFieldIndex(r);if(null==s)return;const i=this._readAttributeAtIndex(s);if(!t)return i;if(null==i)return i;return this._header.isDateField(r)?new Date(i):i}_readAttributes(){const e={};return this._header.fields.forEach((({fieldName:t,index:r})=>{e[t]=this._readAttributeAtIndex(r)})),e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext}_readAttributeAtIndex(e){const t=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;return r.move(t),S(r)}_parseGeometry(e){const t=2,r=3,s=e.asUnsafe(),i=s.getLength(),n=s.pos()+i,a=[],h=[];for(;s.pos()<n&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;)h.push(s.getUInt32());break}case r:{const e=s.getUInt32(),t=s.pos()+e;for(a.push(s.getSInt32()+this._tx),a.push(s.getSInt32()+this._ty),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();s.pos()<t;)a.push(s.getSInt32()),a.push(s.getSInt32()),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();break}default:s.skip()}return new d(h,a)}_parseGeometryForDisplay(e){const t=2,r=3,s=e.asUnsafe(),n=s.getLength(),a=s.pos()+n,h=[],o=[];let u=0,c=0,_=null,l=0;const f="esriGeometryPolygon"===this.geometryType;for(;s.pos()<a&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;){const e=s.getUInt32();h.push(e),u+=e}_=I(2*u).delta;break}case r:{s.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);i(_);for(const t of h)if(c+e*t>_.length)for(let e=0;e<t;e++)s.getSInt32(),s.getSInt32(),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();else if(f&&g){const e=this.getAreaSimplificationThreshold(t,this._header.vertexCount);let r=2,i=1;const n=!1;let a=s.getSInt32(),h=s.getSInt32();_[c++]=a,_[c++]=h,this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();let d=s.getSInt32(),u=s.getSInt32();for(this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();r<t;){let t=s.getSInt32(),n=s.getSInt32();this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();const o=a+d,g=h+u;F(a,h,o,g,o+t,g+n)>=e?(l+=-.5*(o-a)*(g+h),i>1&&G(_[c-2],_[c-1],d,u)?(_[c-2]+=d,_[c-1]+=u):(_[c++]=d,_[c++]=u,i++),a=o,h=g):(t+=d,n+=u),d=t,u=n,r++}i<3||n?c-=2*i:(l+=-.5*(a+d-a)*(h+u+h),G(_[c-2],_[c-1],d,u)?(_[c-2]+=d,_[c-1]+=u,o.push(i)):(_[c++]=d,_[c++]=u,o.push(++i)))}else{let e=0,r=s.getSInt32(),i=s.getSInt32();this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32(),_[c++]=r,_[c++]=i,e+=1;for(let n=1;n<t;n++){const t=s.getSInt32(),a=s.getSInt32(),h=r+t,o=i+a;l+=-.5*(h-r)*(o+i),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32(),n>2&&G(_[c-2],_[c-1],t,a)?(_[c-2]+=t,_[c-1]+=a):(_[c++]=t,_[c++]=a,e+=1),r=h,i=o}o.push(e)}break}default:s.skip()}if(this._cache.area=l,!o.length)return null;if(this._tx||this._ty){let e=0;i(_);for(const t of o)_[2*e]+=this._tx,_[2*e+1]+=this._ty,e+=t}return new d(o,_)}}export{v as FeatureSetReaderPBF};
|
|
5
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{isNone as r,isSome as s,assertIsSome as i}from"../../../../../core/maybe.js";import n from"../../../../../core/pbf.js";import{convertToGeometry as a,unquantizeOptimizedGeometry as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as o}from"../../../../../layers/graphics/OptimizedFeature.js";import d from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetReader as u}from"./FeatureSetReader.js";import{parseHeader as c}from"./FeatureSetReaderPBFHeader.js";const g=!0,l=268435455,_=128,f=128e3,y={small:{delta:new Int32Array(_),decoded:new Int32Array(_)},large:{delta:new Int32Array(f),decoded:new Int32Array(f)}};function I(e){return e<=y.small.delta.length?y.small:(e<=y.large.delta.length||(y.large.delta=new Int32Array(Math.round(1.25*e)),y.large.decoded=new Int32Array(Math.round(1.25*e))),y.large)}function p(e){return e.toLowerCase().trim()}function m(r){try{const e=2,t=new n(new Uint8Array(r),new DataView(r));for(;t.next();){if(t.tag()===e)return x(t.getMessage());t.skip()}}catch(s){const r=new e("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:s});t.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r)}return null}function x(e){const t=1;for(;e.next();){if(e.tag()===t)return e.getMessage();e.skip()}return null}function S(e){const t=1,r=2,s=3,i=4,n=5,a=6,h=7,o=8,d=9,u=e.getLength(),c=e.pos()+u;for(;e.pos()<c&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case i:return e.getSInt32();case n:return e.getUInt32();case a:return e.getInt64();case h:return e.getUInt64();case o:return e.getSInt64();case d:return e.getBool();default:return e.skip(),null}return null}function F(e,t,r,s,i,n){return.5*Math.abs(e*s+r*n+i*t-e*n-r*t-i*s)}function v(e,t,r,s){return 0===e*s-r*t&&e*r+t*s>0}class G extends u{constructor(e,t,r,s){super(e,s),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=s.geometryType,this._reader=t,this._header=r,this._hasNext=r.hasFeatures,this._isPoints="esriGeometryPoint"===s.geometryType}static fromBuffer(e,t,r=!1){const s=t.geometryType,i=m(e),n=c(i,"esriGeometryPoint"===s,r),a=u.createInstance();return new G(a,i,n,t)}get geometryType(){return this._geometryType}get _size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}hasField(e){return this._header.hasField(e)||this._header.hasField(p(e))}getFieldNames(){return this._header.fields.map((e=>e.fieldName))}getSize(){return this._size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";return this._header.fields.forEach((({index:t})=>{e+=this._readAttributeAtIndex(t)+"."})),e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(void 0===this._cache.legacyFeature){const e=this.readCentroid(),t={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null};return this._cache.legacyFeature=t,t}return this._cache.legacyFeature}readOptimizedFeature(){if(void 0===this._cache.optFeature){const e=new o(this.readGeometry(),this.readAttributes(),this.readCentroid());return e.objectId=this.getObjectId(),e.displayId=this.getDisplayId(),this._cache.optFeature=e,e}return this._cache.optFeature}getXHydrated(){const e=this._header.centroid[2*this._featureIndex],t=this.getQuantizationTransform();return r(t)?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return r(t)?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readGeometry(e);return a(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,r]=e.coords;return{x:t,y:r}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(void 0===this._cache.unquantGeometry){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;const r=I(t.coords.length).decoded,s=t.clone(r),i=s.coords;let n=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(n+t),r=2*(n+t-1);i[e]+=i[r],i[e+1]+=i[r+1]}n+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}readHydratedGeometry(){if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===l)return null;const e=this.getXHydrated(),t=this.getYHydrated();return new d([],[e,t])}const e=this.readGeometry();if(!e)return null;const t=e.clone(),r=this.getQuantizationTransform();return s(r)&&h(t,t,this.hasZ,this.hasM,r),t}readGeometry(e=!1){if(void 0===this._cache.geometry){let r=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===l)return null;const e=this.getX(),t=this.getY();r=new d([],[e,t])}else{const s=this._header.offsets.geometry[this._featureIndex],i=this._reader;if(0===s){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return new d([5],[t-1,r+1,2,0,0,-2,-2,0,0,2])}i.move(s);try{if(r=e?this._parseGeometryForDisplay(i):this._parseGeometry(i),null===r){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return new d([5],[t-1,r+1,2,0,0,-2,-2,0,0,2])}}catch(t){return console.error("Failed to parse geometry!",t),null}}return this._cache.geometry=r,r}return this._cache.geometry}readCentroid(){if(void 0===this._cache.centroid){let e;return e=this._computeCentroid(),e||(e=this._readServerCentroid()),this._cache.centroid=e??void 0,e??null}return this._cache.centroid}copy(){const e=this._reader.clone(),t=new G(this.instance,e,this._header,this.fullSchema());return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}_readAttribute(e,t){const r=this._header.hasField(e)?e:p(e),s=this._header.getFieldIndex(r);if(null==s)return;const i=this._readAttributeAtIndex(s);if(!t)return i;if(null==i)return i;return this._header.isDateField(r)?new Date(i):i}_readAttributes(){const e={};return this._header.fields.forEach((({fieldName:t,index:r})=>{e[t]=this._readAttributeAtIndex(r)})),e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext}_readAttributeAtIndex(e){const t=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;return r.move(t),S(r)}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex]+this._tx,t=this._header.centroid[2*this._featureIndex+1]+this._ty;return e===l?null:new d([],[e,t])}_parseGeometry(e){const t=2,r=3,s=e.asUnsafe(),i=s.getLength(),n=s.pos()+i,a=[],h=[];for(;s.pos()<n&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;)h.push(s.getUInt32());break}case r:{const e=s.getUInt32(),t=s.pos()+e;for(a.push(s.getSInt32()+this._tx),a.push(s.getSInt32()+this._ty),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();s.pos()<t;)a.push(s.getSInt32()),a.push(s.getSInt32()),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();break}default:s.skip()}return new d(h,a)}_parseGeometryForDisplay(e){const t=2,r=3,s=e.asUnsafe(),n=s.getLength(),a=s.pos()+n,h=[],o=[];let u=0,c=0,l=null,_=0;const f="esriGeometryPolygon"===this.geometryType;for(;s.pos()<a&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;){const e=s.getUInt32();h.push(e),u+=e}l=I(2*u).delta;break}case r:{s.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);i(l);for(const t of h)if(c+e*t>l.length)for(let e=0;e<t;e++)s.getSInt32(),s.getSInt32(),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();else if(f&&g){const e=this.getAreaSimplificationThreshold(t,this._header.vertexCount);let r=2,i=1;const n=!1;let a=s.getSInt32(),h=s.getSInt32();l[c++]=a,l[c++]=h,this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();let d=s.getSInt32(),u=s.getSInt32();for(this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();r<t;){let t=s.getSInt32(),n=s.getSInt32();this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();const o=a+d,g=h+u;F(a,h,o,g,o+t,g+n)>=e?(_+=-.5*(o-a)*(g+h),i>1&&v(l[c-2],l[c-1],d,u)?(l[c-2]+=d,l[c-1]+=u):(l[c++]=d,l[c++]=u,i++),a=o,h=g):(t+=d,n+=u),d=t,u=n,r++}i<3||n?c-=2*i:(_+=-.5*(a+d-a)*(h+u+h),v(l[c-2],l[c-1],d,u)?(l[c-2]+=d,l[c-1]+=u,o.push(i)):(l[c++]=d,l[c++]=u,o.push(++i)))}else{let e=0,r=s.getSInt32(),i=s.getSInt32();this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32(),l[c++]=r,l[c++]=i,e+=1;for(let n=1;n<t;n++){const t=s.getSInt32(),a=s.getSInt32(),h=r+t,o=i+a;_+=-.5*(h-r)*(o+i),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32(),n>2&&v(l[c-2],l[c-1],t,a)?(l[c-2]+=t,l[c-1]+=a):(l[c++]=t,l[c++]=a,e+=1),r=h,i=o}o.push(e)}break}default:s.skip()}if(this._cache.area=_,!o.length)return null;if(this._tx||this._ty){let e=0;i(l);for(const t of o)l[2*e]+=this._tx,l[2*e+1]+=this._ty,e+=t}return new d(o,l)}}export{G as FeatureSetReaderPBF};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{bidiText as s}from"../../../../core/BidiText.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import has from"../../../../core/has.js";import{isSome as r,isNone as o}from"../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as h,throwIfAbortError as n}from"../../../../core/promiseUtils.js";import{watch as l}from"../../../../core/reactiveUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/SpatialReference.js";import{width as g,height as u,create as m}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as _}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as f,isPolygon as y,isPolyline as S,isExtent as b,isPoint as w,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianForDisplay as v}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as U,project as G}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as M}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as j,errorPointSymbol2D as P}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as A}from"../../engine/webgl/enums.js";import{GraphicTile as R}from"../../engine/webgl/GraphicTile.js";import{TileData as q}from"../../engine/webgl/TileData.js";import D from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as F}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as z}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as O}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as H}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as k,createSymbolSchemaOptions as E}from"../features/schemaUtils.js";import N from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as V}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as B}from"../features/support/GraphicsReader.js";import L from"./GraphicStore.js";import{intersectingInternationalDateline as W,isMarkerSymbol as J,isTextSymbol as Z,polygonFromExtent as K,TILE_SIZE as Q,PIXEL_BUFFER as X}from"./graphicsUtils.js";import{expandSymbol as Y}from"../support/cimSymbolUtils.js";import{GraphicsView as $}from"../../../layers/GraphicsView.js";import{getWebGLCapabilities as ee}from"../../../webgl/capabilities.js";import{createSymbolSchema as te}from"../features/createSymbolSchema.js";const se=has("esri-2d-graphic-debug");function ie(e,t,s){if(s.has(e))return s.get(e);const i={tile:t,addedOrModified:[],removed:[]};return s.set(e,i),i}let re=class extends($(i(t))){constructor(e){super(e),this._storage=new V,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,s){if(e){const i=k({indexCount:0,fields:{}},"feature",e);this._matcher=H(i,t,null,s)}}_createDisplayId(e){return this._displayIds.has(e)||this._displayIds.set(e,this._storage.createDisplayId()),this._displayIds.get(e)}initialize(){this._attributeStore=new N({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},ee("2d"),(()=>this.notifyChange("updating"))),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},s=new O(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new L(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new z(null,this.uid,s),this._templateStore=s,this.handles.add([l((()=>this.renderer),(e=>{this._createMatcher(e,s,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",(e=>this._onTileUpdate(e))),this.container.on("attach",(()=>{se&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this.renderer,s,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const i=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:i,removed:[]})}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0||this._attributeStore.isUpdating()}hitTest(e){if(!this.view||!this.view.position)return[];const{resolution:t,rotation:s}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,s)}update(e){a(this._controller.signal);const t=e.state,{resolution:s}=t;if(this._graphicStore.updateLevel(s),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:s,newValue:i}=e;switch(s){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,i),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e)));this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===g(t)||0===u(t))return[];const s=W(t,this.view.spatialReference);return r(s)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(s[0]),...this.view.graphicsTileStore.boundsIntersections(s[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){a(this._controller.signal);const t=e.tile,s=this._getGraphicsData(this._templateStore,t,e.addedOrModified),i=await this._processGraphics(t,s);return a(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:i,remove:e.removed,end:!0,clear:!1,sort:!1}),i}_patchTile(e,t){if(!this._tiles.has(e))return;const s=this._tiles.get(e);this.container.onTileData(s,t),this.container.requestRender()}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const s of e.added)t.added.add(s);for(const s of e.moved)t.updated.add(s);for(const s of e.removed)this._pendingUpdate.added.has(s)?t.added.delete(s):t.removed.add(s);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const s of this.graphics.items)t.added.has(s)?e.added.push(s):t.updated.has(s)&&e.updated.push(s);for(const s of t.removed)this._graphicStore.has(s)&&e.removed.push(s);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:s}=this._getGraphicsToUpdate(),i=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<s.length;e++){const t=s[e],h=this._getIntersectingTiles(t);for(const e of h){r=e.id;ie(r,e,i).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const h=s.length;for(let t=0;t<e.length;t++){const s=e[t];a[h+t]=s,this._graphicsSet.add(s),o.push(this._addGraphic(s))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const s of t){r=s.id;ie(r,s,i).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let n;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){n=a[e];const t=this._getIntersectingTiles(n);for(const e of t){r=e.id;ie(r,e,i).addedOrModified.push(n)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of i)l.push(this._updateTile(t));await Promise.all(l)}catch(o){h(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,null);if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){h(o),0}i.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return o(e.geometry)?null:{geometryType:f(e.geometry),spatialReference:c.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return a(this._controller.signal),r(e.symbol)?Promise.resolve(e.symbol):r(this.renderer)?this.renderer.getSymbolAsync(e,{scale:this.view.scale,signal:r(t)?t.signal:null}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,s){let i=this._hashToCIM.get(t);if(i)return Promise.resolve(i);const o=M(e);if(r(o)){if("CIMSymbolReference"===o.type)return i=o,this._hashToCIM.set(t,i),Promise.resolve(i);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=o.fetchCIMSymbol(s).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),n(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,s,i){const r=this._hashToExpandedSymbol.get(s);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(s);if(o)return o;const a=this.container.stage,h=this._getArcadeInfo(t),n=E(null),l=te(e,n);return o=Y(l,h,a.resourceManager,i),this._hashToExpandedSymbolPromise.set(s,o),o.then((e=>(this._hashToExpandedSymbol.set(s,e),this._hashToExpandedSymbolPromise.delete(s),e))),o}async _getSymbolResources(e,t){a(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((i=>{const r=i.hash();return this._getCIMSymbol(i,r,t).then((i=>o(i)?null:this._expandCIMSymbol(i,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const i=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=s(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));i[e]={symbol:r,id:e,glyphIds:o}}const o=new Map;return this.container.getMaterialItems(i).then((s=>{for(let e=0;e<t.length;e++){const i=t[e];o.set(i.cim,{text:i.text,mosaicItem:s[e].mosaicItem})}return{symbol:e,textInfo:o,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(n(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(a(this._controller.signal),o(e.geometry)||"mesh"===e.geometry.type)return null;let s=e.geometry;if(y(s)){const e=s.rings;s.rings=e}else if(S(s)){const e=s.paths;s.paths=e}else if(b(s)){const i=await this._getSymbolForGraphic(e,t);if(a(this._controller.signal),J(i.type)||Z(i.type)){s=s.center}else s=K(s)}await U(s.spatialReference,this.view.spatialReference);const i=v(s),r=G(i,s.spatialReference,this.view.spatialReference);return _(r),r}_onTileUpdate(e){const t=I(this.view.spatialReference);if(e.added&&e.added.length>0)for(const s of e.added)this._addNewTile(s,t);if(e.removed&&e.removed.length>0)for(const s of e.removed)this._removeTile(s.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),a(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const s={signal:t.signal};try{await this._addOrUpdateGraphic(e,s),a(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(i){if(this._graphicIdToAbortController.delete(e.uid),!h(i))throw i}}_updateGraphic(e,t){a(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{a(this._controller.signal),this._graphicStore.addOrModify(e,s,t)}))}_addOrUpdateGraphic(e,t){a(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{a(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,s,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(m(),e),s=new R(e,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addNewTile(e,t){const s=this._addTile(e.key),i=this._graphicStore.queryTileData(this._templateStore,e);if(0===i.length)return;if(t){const s=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of i)e.geometry&&(w(e.geometry)||T(e.geometry))&&this._wrapPoints(e,s)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,i),remove:[],end:!0,sort:!1};s.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!h(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const s=this._displayIds.get(e),i=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(s,0,0,i|(t?x:0))}_getGraphicsData(e,t,s){const i=this.view,r=I(i.spatialReference),o=this._graphicStore.getGraphicsData(e,t,s);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(w(t.geometry)||T(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const s=e.geometry;T(s)?this._wrapMultipoint(s,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const s=e.points,i=[];let r=0,o=0;for(const[a,h]of s){if(i.push([a+r,h]),r=0,t===Q){const e=5*X;a+o<e?(i.push([t,0]),r=-t):a+o>Q-e&&(i.push([-t,0]),r=t)}else a+o<-X?(i.push([t,0]),r=-t):a+o>Q+X&&(i.push([-t,0]),r=t);o+=a}e.points=i}_wrapPoint(e,t){const s=e.geometry;if(t===Q){const i=5*X;s.x<i?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q-i&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}else s.x<-X?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q+X&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}_processGraphics(e,t,s){if(!(t&&t.length)||!this._meshFactory)return null;const i=B.from(t,this.uid),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(i,this.container.stage.resourceManager,t,null,null,s).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,i))))))}_processAnalyzedGraphics(e,t){const s=this._meshFactory,i=t.getSize(),r=t.getCursor(),o={features:i,records:i,metrics:0},a=new F(e.key.id,o,A.DEFAULT,!1,!1),h=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const i=new D(t.displayId);i.insertAfter=t.insertAfter,h.push(i),s.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const n=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(n);if(1!==l.length)return new q;const d=l[0].message;return q.fromVertexData(d,h)}_abortProcessingGraphic(e){if(this._graphicIdToAbortController.has(e)){this._graphicIdToAbortController.get(e).abort()}}_getNullSymbol(e){const t=e.geometry;return S(t)?C:y(t)||b(t)?j:P}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([d({constructOnly:!0})],re.prototype,"requestUpdateCallback",void 0),e([d()],re.prototype,"container",void 0),e([d({constructOnly:!0})],re.prototype,"graphics",void 0),e([d()],re.prototype,"updating",null),e([d()],re.prototype,"view",void 0),e([d()],re.prototype,"updateRequested",void 0),re=e([p("esri.views.2d.layers.support.GraphicsView2D")],re);const oe=re;export{oe as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{bidiText as s}from"../../../../core/BidiText.js";import{HandleOwnerMixin as i}from"../../../../core/HandleOwner.js";import has from"../../../../core/has.js";import{isSome as r,isNone as o}from"../../../../core/maybe.js";import{throwIfAborted as a,isAbortError as h,throwIfAbortError as n}from"../../../../core/promiseUtils.js";import{watch as l}from"../../../../core/reactiveUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/arrayUtils.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../geometry/SpatialReference.js";import{width as g,height as m,create as u}from"../../../../geometry/support/aaBoundingRect.js";import{closeRingsAndFixWinding as _}from"../../../../geometry/support/coordsUtils.js";import{getJsonType as f,isPolygon as y,isPolyline as b,isExtent as S,isPoint as w,isMultipoint as T}from"../../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridianForDisplay as v}from"../../../../geometry/support/normalizeUtilsSync.js";import{getInfo as I}from"../../../../geometry/support/spatialReferenceUtils.js";import{checkProjectionSupport as U,project as G}from"../../../../layers/graphics/data/projectionSupport.js";import{symbolToCIM as M}from"../../../../symbols/cim/CIMSymbolHelper.js";import{errorPolylineSymbol2D as C,errorPolygonSymbol2D as j,errorPointSymbol2D as P}from"../../../../symbols/support/defaults.js";import{FILTER_FLAG_0 as x}from"../../engine/webgl/definitions.js";import{WGLSymbologyType as A}from"../../engine/webgl/enums.js";import{GraphicTile as R}from"../../engine/webgl/GraphicTile.js";import{TileData as q}from"../../engine/webgl/TileData.js";import D from"../../engine/webgl/WGLDisplayObject.js";import{MeshData as F}from"../../engine/webgl/mesh/MeshData.js";import{WGLMeshFactory as z}from"../../engine/webgl/mesh/factories/WGLMeshFactory.js";import{WGLTemplateStore as O}from"../../engine/webgl/mesh/templates/WGLTemplateStore.js";import{createMatcher as H}from"../../engine/webgl/util/Matcher.js";import{createMatcherSchema as k,createSymbolSchemaOptions as E}from"../features/schemaUtils.js";import N from"../features/support/AttributeStore.js";import{ComputedAttributeStorage as B}from"../features/support/ComputedAttributeStorage.js";import{GraphicsReader as L}from"../features/support/GraphicsReader.js";import V from"./GraphicStore.js";import{intersectingInternationalDateline as W,isMarkerSymbol as J,isTextSymbol as Z,polygonFromExtent as K,TILE_SIZE as Q,PIXEL_BUFFER as X}from"./graphicsUtils.js";import{expandSymbol as Y}from"../support/cimSymbolUtils.js";import{GraphicsView as $}from"../../../layers/GraphicsView.js";import{getWebGLCapabilities as ee}from"../../../webgl/capabilities.js";import{createSymbolSchema as te}from"../features/createSymbolSchema.js";const se=has("esri-2d-graphic-debug");function ie(e,t,s){if(s.has(e))return s.get(e);const i={tile:t,addedOrModified:[],removed:[]};return s.set(e,i),i}let re=class extends($(i(t))){constructor(e){super(e),this._storage=new B,this._displayIds=new Map,this._controller=new AbortController,this._tiles=new Map,this._graphicStoreUpdate=!1,this._graphicsSet=new Set,this._matcher=Promise.resolve(null),this._tileUpdateSet=new Set,this._tilesToUpdate=new Map,this._graphicIdToAbortController=new Map,this._attached=!1,this._updatingGraphicsTimer=null,this._hashToExpandedSymbol=new Map,this._hashToExpandedSymbolPromise=new Map,this._hashToCIMSymbolPromise=new Map,this._hashToCIM=new Map,this._processing=!1,this._needsProcessing=!1,this._pendingUpdate={added:new Set,updated:new Set,removed:new Set},this.lastUpdateId=-1,this.updateRequested=!1,this.graphicUpdateHandler=this.graphicUpdateHandler.bind(this)}destroy(){this._updatingGraphicsTimer&&(clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=null,this.notifyChange("updating")),this._controller.abort(),this.container.destroy(),this._set("graphics",null),this._graphicStore.clear(),this._attributeStore=null,this._hashToExpandedSymbol.clear(),this.view=null,this.renderer=null,this._hashToCIM.clear(),this._hashToCIMSymbolPromise.clear(),this._hashToExpandedSymbolPromise.clear()}_createMatcher(e,t,s){if(e){const i=k({indexCount:0,fields:{}},"feature",e);this._matcher=H(i,t,null,s)}}_createDisplayId(e){return this._displayIds.has(e)||this._displayIds.set(e,this._storage.createDisplayId()),this._displayIds.get(e)}initialize(){this._attributeStore=new N({type:"local",initialize:e=>Promise.resolve(this.container.attributeView.initialize(e)),update:e=>this.container.attributeView.requestUpdate(e),render:()=>this.container.requestRender()},ee("2d"),(()=>this.notifyChange("updating"))),this.container.hasHighlight=()=>this._attributeStore.hasHighlight;const e=e=>{this._createDisplayId(e.uid),this._setFilterState(e.uid,e.visible)},t=e=>{const t=this._displayIds.get(e.uid);this._displayIds.delete(e.uid),this._storage.releaseDisplayId(t)},s=new O(this.container.getMaterialItems.bind(this.container),this.view.featuresTilingScheme.tileInfo);this._graphicStore=new V(this.view.featuresTilingScheme,this.view.state.scale,this.uid,this.graphics,e,t,this._hashToCIM),this._meshFactory=new z(null,this.uid,s),this._templateStore=s,this.handles.add([l((()=>this.renderer),(e=>{this._createMatcher(e,s,this.container.stage.resourceManager);for(const t of this.graphics)this._pendingUpdate.updated.add(t);this.requestUpdate()})),this.view.graphicsTileStore.on("update",(e=>this._onTileUpdate(e))),this.container.on("attach",(()=>{se&&this.container.enableRenderingBounds((()=>this._graphicStore.getAllBounds())),this.graphics.items.length>0&&this._graphicsChangeHandler({target:this.graphics,added:this.graphics.items,removed:[],moved:[]}),this.handles.add(this.graphics.on("change",(e=>this._graphicsChangeHandler(e))),"graphics");const e=this.container.stage.resourceManager;this._createMatcher(this.renderer,s,e),this._graphicStore.setResourceManager(e),this._attached=!0,this.notifyChange("updating")}))]);const i=this.view.graphicsTileStore.tiles;this._onTileUpdate({added:i,removed:[]})}get updating(){return!this._attached||null!==this._updatingGraphicsTimer||this._tileUpdateSet.size>0||this._tilesToUpdate.size>0||this._attributeStore.isUpdating()}hitTest(e){if(!this.view||!this.view.position)return[];const{resolution:t,rotation:s}=this.view.state;return this._graphicStore.hitTest(e.x,e.y,2,t,s)}update(e){a(this._controller.signal);const t=e.state,{resolution:s}=t;if(this._graphicStore.updateLevel(s),this._graphicStoreUpdate=!0,this.updateRequested=!1,this._pendingUpdate.updated.size>0){if(!this._processing)return void this._updateGraphics();this._needsProcessing=!0}}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.requestUpdateCallback())}processUpdate(e){this.updateRequested&&(this.updateRequested=!1,this.update(e))}graphicUpdateHandler(e){const{graphic:t,property:s}=e;switch(s){case"attributes":case"geometry":case"symbol":this._pendingUpdate.updated.add(t),this.requestUpdate();break;case"visible":this._setFilterState(t.uid,t.visible),this._attributeStore.sendUpdates()}}setHighlight(e){const t=e.map((e=>this._displayIds.get(e)));this._attributeStore.setHighlight(e,t)}_getIntersectingTiles(e){const t=this._graphicStore.getBounds(e);if(!t||0===g(t)||0===m(t))return[];const s=W(t,this.view.spatialReference);return r(s)?[...new Set([...this.view.graphicsTileStore.boundsIntersections(s[0]),...this.view.graphicsTileStore.boundsIntersections(s[1])])]:this.view.graphicsTileStore.boundsIntersections(t)}async _updateTile(e){a(this._controller.signal);const t=e.tile,s=this._getGraphicsData(this._templateStore,t,e.addedOrModified),i=await this._processGraphics(t,s);return a(this._controller.signal),this._patchTile(t.key,{type:"update",addOrUpdate:i,remove:e.removed,end:!0,clear:!1,sort:!1}),i}_patchTile(e,t){if(!this._tiles.has(e))return;const s=this._tiles.get(e);this.container.onTileData(s,t),this.container.requestRender()}_graphicsChangeHandler(e){const t=this._pendingUpdate;for(const s of e.added)t.added.add(s);for(const s of e.moved)t.updated.add(s);for(const s of e.removed)this._pendingUpdate.added.has(s)?t.added.delete(s):t.removed.add(s);this._processing?this._needsProcessing=!0:this._updateGraphics()}_getGraphicsToUpdate(){const e={added:[],removed:[],updated:[]};if(!this.graphics)return e;const t=this._pendingUpdate;for(const s of this.graphics.items)t.added.has(s)?e.added.push(s):t.updated.has(s)&&e.updated.push(s);for(const s of t.removed)this._graphicStore.has(s)&&e.removed.push(s);return t.added.clear(),t.removed.clear(),t.updated.clear(),e}async _updateGraphics(){this._processing=!0;const{added:e,removed:t,updated:s}=this._getGraphicsToUpdate(),i=this._tilesToUpdate;let r;try{if(!this._graphicStoreUpdate){const e=this.view.state,{resolution:t}=e;this._graphicStore.updateLevel(t)}const o=[],a=new Array(e.length+t.length);for(let e=0;e<s.length;e++){const t=s[e],h=this._getIntersectingTiles(t);for(const e of h){r=e.id;ie(r,e,i).removed.push(this._displayIds.get(t.uid))}o.push(this._updateGraphic(t,null)),a[e]=t}const h=s.length;for(let t=0;t<e.length;t++){const s=e[t];a[h+t]=s,this._graphicsSet.add(s),o.push(this._addGraphic(s))}for(const e of t){this._abortProcessingGraphic(e.uid);const t=this._getIntersectingTiles(e);for(const s of t){r=s.id;ie(r,s,i).removed.push(this._displayIds.get(e.uid))}this._graphicsSet.delete(e),this._graphicStore.remove(e)}let n;this._flipUpdatingGraphics(),await Promise.all(o);for(let e=0;e<a.length;e++){n=a[e];const t=this._getIntersectingTiles(n);for(const e of t){r=e.id;ie(r,e,i).addedOrModified.push(n)}}this._graphicStore.updateZ();const l=[];for(const[e,t]of i)l.push(this._updateTile(t));await Promise.all(l)}catch(o){h(o),0}for(const a of t)try{const e=await this._getSymbolForGraphic(a,null);if(e){const t=e.hash();this._hashToExpandedSymbol.delete(t)}}catch(o){h(o),0}i.clear(),this.notifyChange("updating"),this._processing=!1,this._needsProcessing&&(this._needsProcessing=!1,this._updateGraphics())}_getArcadeInfo(e){const t=(e.attributes?Object.keys(e.attributes):[]).map((t=>({name:t,alias:t,type:"string"==typeof e.attributes[t]?"esriFieldTypeString":"esriFieldTypeDouble"})));return o(e.geometry)?null:{geometryType:f(e.geometry),spatialReference:c.fromJSON(e.geometry.spatialReference),fields:t}}_getSymbolForGraphic(e,t){return a(this._controller.signal),r(e.symbol)?Promise.resolve(e.symbol):r(this.renderer)?this.renderer.getSymbolAsync(e,{scale:this.view.scale,signal:r(t)?t.signal:null}):Promise.resolve(this._getNullSymbol(e))}_getCIMSymbol(e,t,s){let i=this._hashToCIM.get(t);if(i)return Promise.resolve(i);const o=M(e);if(r(o)){if("CIMSymbolReference"===o.type)return i=o,this._hashToCIM.set(t,i),Promise.resolve(i);let e=this._hashToCIMSymbolPromise.get(t);return e||(e=o.fetchCIMSymbol(s).then((e=>(this._hashToCIM.set(t,e.data),this._hashToCIMSymbolPromise.delete(t),e))).catch((e=>(this._hashToCIMSymbolPromise.delete(t),n(e),null))),this._hashToCIMSymbolPromise.set(t,e),e)}return Promise.resolve(null)}_expandCIMSymbol(e,t,s,i){const r=this._hashToExpandedSymbol.get(s);if(r)return Promise.resolve(r);let o=this._hashToExpandedSymbolPromise.get(s);if(o)return o;const a=this.container.stage,h=this._getArcadeInfo(t),n=E(null),l=te(e,n);return o=Y(l,h,a.resourceManager,i),this._hashToExpandedSymbolPromise.set(s,o),o.then((e=>(this._hashToExpandedSymbol.set(s,e),this._hashToExpandedSymbolPromise.delete(s),e))),o}async _getSymbolResources(e,t){a(this._controller.signal);return this.container.stage?this._getSymbolForGraphic(e,t).then((i=>{const r=i.hash();return this._getCIMSymbol(i,r,t).then((i=>o(i)?null:this._expandCIMSymbol(i,e,r,t).then((e=>{const t=e.layers.filter((e=>"text"===e.type&&"string"==typeof e.text));if(t&&t.length>0){const i=new Array(t.length);for(let e=0;e<t.length;e++){const r=t[e],o=[],[a]=s(r.text);r.text=a;for(let e=0;e<a.length;e++)o.push(a.charCodeAt(e));i[e]={symbol:r,id:e,glyphIds:o}}const o=new Map;return this.container.getMaterialItems(i).then((s=>{for(let e=0;e<t.length;e++){const i=t[e];o.set(i.cim,{text:i.text,mosaicItem:s[e].mosaicItem})}return{symbol:e,textInfo:o,hash:r}}))}return{symbol:e,hash:r}}))))})).catch((e=>(n(e),null))):null}async _projectAndNormalizeGeometry(e,t){if(a(this._controller.signal),o(e.geometry)||"mesh"===e.geometry.type)return null;let s=e.geometry;if(y(s)){const e=s.rings;s.rings=e}else if(b(s)){const e=s.paths;s.paths=e}else if(S(s)){const i=await this._getSymbolForGraphic(e,t);if(a(this._controller.signal),J(i.type)||Z(i.type)){s=s.center}else s=K(s)}await U(s.spatialReference,this.view.spatialReference);const i=v(s),r=G(i,s.spatialReference,this.view.spatialReference);return _(r),r}_onTileUpdate(e){const t=I(this.view.spatialReference);if(e.added&&e.added.length>0)for(const s of e.added)this._addNewTile(s,t);if(e.removed&&e.removed.length>0)for(const s of e.removed)this._removeTile(s.key)}async _addGraphic(e){this._abortProcessingGraphic(e.uid),a(this._controller.signal);const t=new AbortController;this._graphicIdToAbortController.set(e.uid,t);const s={signal:t.signal};try{await this._addOrUpdateGraphic(e,s),a(this._controller.signal),this._graphicIdToAbortController.delete(e.uid)}catch(i){if(this._graphicIdToAbortController.delete(e.uid),!h(i))throw i}}_updateGraphic(e,t){a(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{a(this._controller.signal),this._graphicStore.addOrModify(e,s,t)}))}_addOrUpdateGraphic(e,t){a(this._controller.signal);const s=this._projectAndNormalizeGeometry(e,t),i=this._getSymbolResources(e,t);return Promise.all([s,i]).then((([t,s])=>{a(this._controller.signal),this._graphicsSet.has(e)&&this._graphicStore.addOrModify(e,s,t)}))}_addTile(e){const t=this.view.featuresTilingScheme.getTileBounds(u(),e),s=new R(e,t[0],t[3]);return this._tiles.set(e,s),this.container.addChild(s),s}async _addNewTile(e,t){const s=this._addTile(e.key),i=this._graphicStore.queryTileData(this._templateStore,e);if(0===i.length)return;if(t){const s=Math.round((t.valid[1]-t.valid[0])/e.resolution);for(const e of i)e.geometry&&(w(e.geometry)||T(e.geometry))&&this._wrapPoints(e,s)}const r=e.key;this._tileUpdateSet.add(e.key),this.notifyChange("updating");try{const t={type:"update",clear:!1,addOrUpdate:await this._processGraphics(e,i),remove:[],end:!0,sort:!1};s.patch(t),this._tileUpdateSet.delete(r),this.notifyChange("updating")}catch(o){if(this._tileUpdateSet.delete(r),this.notifyChange("updating"),!h(o))throw o}}_removeTile(e){if(!this._tiles.has(e))return;const t=this._tiles.get(e);this.container.removeChild(t),t.destroy(),this._tiles.delete(e)}_setFilterState(e,t){const s=this._displayIds.get(e),i=this._attributeStore.getHighlightFlag(e);this._attributeStore.setData(s,0,0,i|(t?x:0))}_getGraphicsData(e,t,s){const i=this.view,r=I(i.spatialReference),o=this._graphicStore.getGraphicsData(e,t,s);if(r){const e=Math.round((r.valid[1]-r.valid[0])/t.resolution);for(const t of o)t.geometry&&(w(t.geometry)||T(t.geometry))&&this._wrapPoints(t,e)}return o}_wrapPoints(e,t){const s=e.geometry;T(s)?this._wrapMultipoint(s,t):this._wrapPoint(e,t)}_wrapMultipoint(e,t){const s=e.points,i=[];let r=0,o=0;for(const[a,h]of s){if(i.push([a+r,h]),r=0,t===Q){const e=5*X;a+o<e?(i.push([t,0]),r=-t):a+o>Q-e&&(i.push([-t,0]),r=t)}else a+o<-X?(i.push([t,0]),r=-t):a+o>Q+X&&(i.push([-t,0]),r=t);o+=a}e.points=i}_wrapPoint(e,t){const s=e.geometry;if(t===Q){const i=5*X;s.x<i?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q-i&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}else s.x<-X?e.geometry={points:[[s.x,s.y],[t,0]]}:s.x>Q+X&&(e.geometry={points:[[s.x,s.y],[-t,0]]})}_processGraphics(e,t,s){if(!(t&&t.length)||!this._meshFactory)return null;const i=L.from(t,this.uid),r=this._meshFactory;return this._matcher.then((t=>r.analyzeGraphics(i,this.container.stage.resourceManager,t,null,null,s).then((()=>(this._attributeStore.sendUpdates(),this._processAnalyzedGraphics(e,i))))))}_processAnalyzedGraphics(e,t){const s=this._meshFactory,i=t.getSize(),r=t.getCursor(),o={features:i,records:i,metrics:0},a=new F(e.key.id,o,A.DEFAULT,!1,!1),h=[];for(;r.next();){const t=r.readGraphic();t.insertAfter=-1===t.insertAfter?-1:this._displayIds.get(t.insertAfter),t.displayId=this._displayIds.get(t.attributes[this.uid]);const i=new D(t.displayId);i.insertAfter=t.insertAfter,h.push(i),s.writeGraphic(a,r,e.level,this.container.stage.resourceManager)}const n=e.tileInfoView.tileInfo.isWrappable,l=a.serialize(n);if(1!==l.length)return new q;const d=l[0].message;return q.fromVertexData(d,h)}_abortProcessingGraphic(e){if(this._graphicIdToAbortController.has(e)){this._graphicIdToAbortController.get(e).abort()}}_getNullSymbol(e){const t=e.geometry;return b(t)?C:y(t)||S(t)?j:P}_flipUpdatingGraphics(){this._updatingGraphicsTimer&&clearTimeout(this._updatingGraphicsTimer),this._updatingGraphicsTimer=setTimeout((()=>{this._updatingGraphicsTimer=null,this.notifyChange("updating")}),160),this.notifyChange("updating")}};e([d({constructOnly:!0})],re.prototype,"requestUpdateCallback",void 0),e([d()],re.prototype,"container",void 0),e([d({constructOnly:!0})],re.prototype,"graphics",void 0),e([d()],re.prototype,"updating",null),e([d()],re.prototype,"view",void 0),e([d()],re.prototype,"updateRequested",void 0),re=e([p("esri.views.2d.layers.support.GraphicsView2D")],re);const oe=re;export{oe 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as r}from"../../../core/mathUtils.js";import{destroyMaybe as i,isSome as o,isNone as n}from"../../../core/maybe.js";import{when as a,syncAndInitial as h,watch as p,initial as l}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as m}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{isMoon as u,isEarth as w}from"../../../geometry/support/spatialReferenceUtils.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as g}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as f}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{cloudPresets as b}from"./CloudsPresets.js";import{Fog as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as r}from"../../../core/mathUtils.js";import{destroyMaybe as i,isSome as o,isNone as n}from"../../../core/maybe.js";import{when as a,syncAndInitial as h,watch as p,initial as l}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as m}from"../../../chunks/vec3.js";import{getReferenceEllipsoid as c}from"../../../geometry/projectionEllipsoid.js";import{isMoon as u,isEarth as w}from"../../../geometry/support/spatialReferenceUtils.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as g}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as f}from"./CloudsData.js";import{CloudsGenerator as R}from"./CloudsGenerator.js";import{cloudPresets as b}from"./CloudsPresets.js";import{Fog as E}from"./Fog.js";import{PanoramicAtmosphere as N}from"./PanoramicAtmosphere.js";import{Precipitation as j}from"./Precipitation.js";import T from"./SimpleAtmosphere.js";import{Stars as x}from"./Stars.js";import{weatherHeightLimit as A}from"./weather.js";import{ShaderOutput as C}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as P}from"../webgl-engine/lib/RenderSlot.js";var O;const S=[P.POSTPROCESSING_ENVIRONMENT_OPAQUE,P.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let M,U=O=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._atmosphere=null}initialize(){this.view._stage.addRenderPlugin(S,this)}destroy(){null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=i(this._handles),this._set("view",null)}get atmosphereType(){return o(this._atmosphere)?this._atmosphere.type:y.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return o(this._atmosphere)&&this._atmosphere.type===y.Realistic}updateAnimation(e){return!!o(this._precipitation)&&this._precipitation.update(e)}get updating(){return o(this._stars)&&this._stars.updating||o(this._clouds)&&this._clouds.running}get weatherVisible(){return m(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=A}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||n(this._context)?(i(s),null):o(s)?s:new x({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||n(this._context))return i(e),null;const t=this.view,s=this._context;return o(e)&&e.context===s?e:(i(e),new j({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||n(this._context))return i(e),null;if(o(e))return e;const t=this.view,s=this._context;return i(e),new R({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||n(this._context))return i(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,r=c(this.view.spatialReference).radius;return o(e)&&e.viewingMode===t&&e.planetRadius===r?e:(i(e),new v({rctx:s,viewingMode:t,planetRadius:r,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||n(this._context))return i(e),null;if(o(e))return e;const t=this.view,s=this._context;return i(e),new E({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this._handles.add([a((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),h),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),h),p((()=>this._stars),t),p((()=>this._precipitation),t),p((()=>this._clouds),(()=>this._updateWeather()),l),p((()=>this._fog),(()=>this._updateFog()),l),p((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFog()}),h)])}uninitializeRenderContext(){this._context=null,this._atmosphere=i(this._atmosphere),this._set("_stars",i(this._stars)),this._set("_precipitation",i(this._precipitation)),this._set("_clouds",i(this._clouds)),this._set("_cloudsComposition",i(this._cloudsComposition)),this._set("_fog",i(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=f(this._clouds)?this._clouds:null}render(e){if(e.output===C.Color)switch(e.bindParameters.slot){case P.POSTPROCESSING_ENVIRONMENT_OPAQUE:o(this._stars)&&this._stars.render(e),o(this._atmosphere)&&(this._atmosphere.render(e),o(this._cloudsComposition)&&o(e.bindParameters.cloudsFade.data)&&(this.weatherVisible&&o(this._clouds)&&this._clouds.ensureWeatherTile(),this._cloudsComposition.render(e)));break;case P.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(o(this._atmosphere)){const t=this.weatherEnabled?this.view.environment.weather.type:"disabled";if(this._atmosphere.renderHaze(e,"rainy"===t),o(this._fog)){const s="foggy"===t||"rainy"===t||"snowy"===t;(s||this._selectAtmosphereType()!==y.Realistic)&&this._fog.render(e,s,"rainy"===t)}if(o(this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return n(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeather(){const e=this._weatherUpdateParameters;n(e)||n(this._clouds)||(this._clouds.applyPreset(b[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){o(this._context)&&this._context.requestRender()}_updateFog(){const e=this._weatherUpdateParameters;if(!n(this._fog)&&!n(e))switch(e.type){case"foggy":this._fog.strength=r(3e-5,.005,e.weatherAdjustment**3),this._setNeedsRender();break;case"rainy":case"snowy":this._fog.strength=r(4e-6,2e-4,e.effect**3),this._setNeedsRender();break;default:this._fog.strength=4e-6,this._setNeedsRender()}}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;const t=this._getAtmosphereClass();if(!t)return o(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();o(this._context)&&(i(this._atmosphere),this._atmosphere=new t(this.view),this._atmosphere.initializeRenderContext(this._context),this._setNeedsRender(),this._updateBasemapTerrain())}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case y.None:return null;case y.Realistic:return g;case y.Panoramic:return N;case y.Simple:return T;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||u(this.view.spatialReference)?y.None:"local"===s?y.Panoramic:"high"===t&&o(this._context)&&g.isSupported(this._context)&&w(this.view.spatialReference)?y.Realistic:y.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=o(this._atmosphere)&&this.atmosphereType===y.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{M=O.prototype._getAtmosphereClass,O.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{O.prototype._getAtmosphereClass=M}}}};e([d({constructOnly:!0})],U.prototype,"view",void 0),e([d({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([d({readOnly:!0})],U.prototype,"weatherVisible",null),e([d()],U.prototype,"_context",void 0),e([d({readOnly:!0})],U.prototype,"_stars",null),e([d({readOnly:!0})],U.prototype,"_precipitation",null),e([d({readOnly:!0})],U.prototype,"_clouds",null),e([d({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([d({readOnly:!0})],U.prototype,"_fog",null),e([d({readOnly:!0})],U.prototype,"weatherEnabled",null),e([d({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([d({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=O=e([_("esri.views.3d.environment.EnvironmentRenderer")],U);export{U as EnvironmentRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import i from"../../../../../core/Evented.js";import{HandleOwner as a}from"../../../../../core/HandleOwner.js";import o from"../../../../../core/Handles.js";import{handlesGroup as n,destroyHandle as r}from"../../../../../core/handleUtils.js";import{destroyMaybe as s,isSome as l,isNone as p,unwrap as h,removeMaybe as d}from"../../../../../core/maybe.js";import{zeroMeters as u,scale as c,createLength as m}from"../../../../../core/quantityUtils.js";import{watch as g,when as _,initial as f}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../../../core/unitUtils.js";import{property as M}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as x}from"../../../../../chunks/mat4f64.js";import{l as O,b,h as E,s as G,a as S,g as V}from"../../../../../chunks/vec3.js";import{f as I,c as T}from"../../../../../chunks/vec3f64.js";import w from"../../../../../geometry/Polyline.js";import{projectPoint as H}from"../../../../../geometry/support/plane.js";import{sv3d as A}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as L}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as P}from"../../../../../symbols/support/utils.js";import{Manipulator3D as j}from"../../Manipulator3D.js";import{createManipulatorMaterial as U,createManipulatorOutlineMaterial as k,placeAtGraphic as N}from"../../manipulatorUtils.js";import{SegmentLabels3D as C}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as R}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as F,convertToMapCoordinates as z,screenToMapXYAtLocation as X,screenToMapXYForGraphicAtLocation as Y}from"../dragEventPipeline3D.js";import{ManipulatorType as Z}from"../ManipulatorType.js";import{canMoveZ as q}from"../manipulatorUtils.js";import{settings as W,colors as K}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as J}from"../manipulations/config.js";import{ManipulationType as Q,MoveManipulation as $}from"../manipulations/MoveManipulation.js";import{shapeOrientation as ee,axisConstrainedDragSign as te}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ie}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ae,createEdgeOffsetOperation as oe,edgeOffsetRotationMatrix as ne,screenEdgeLengthSquared as re}from"./edgeOffsetUtils.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as le}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pe,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as de}from"../../../../input/IViewEvents.js";import{addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as _e,ManipulatorStateCustomFlags as fe}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as ve}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as Me}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as ye}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as xe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as Oe}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as be}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Ee,TranslateGraphicXYTooltipInfo as Ge,TranslateGraphicTooltipInfo as Se,TranslateVertexZTooltipInfo as Ve,TranslateVertexXYTooltipInfo as Ie,TranslateVertexTooltipInfo as Te}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByElevationMode as we}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as He,autoLengthByElevationMode as Ae}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as De,elevationOfPoint as Le}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Pe}from"../../../../support/geodesicLengthMeasurementUtils.js";let je=class extends(i.EventedMixin(a)){constructor(e){super(e),this._vertexManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.vertex.color),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.outlineColor),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.hoverOutlineColor),W.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edge.color),W.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.edge.outlineColor),W.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.color),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.hoverColor),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.selected.color),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.outlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.hoverOutlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._editGeometryOperations=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Fe.NONE,this._outlineVisualElement=null,this._segmentLabels=null,this.outputGeometry=null,this._snappingPipeline=new xe,this._snappingPipelineHandle=new xe,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new le({graphic:e});this._tooltip=new be({view:t}),this.addHandles([g((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),g((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{l(e)&&(e.visible=t,e.edgeDistance=i?"far":"default")}),f),_((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),f),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=s(this._segmentLabels),this._tooltip=s(this._tooltip),this._removeManipulators()}get inputGeometry(){return l(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this.updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=s(this._moveManipulation),this._graphicMoveManipulation=s(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(p(this._editGeometryOperations))return;const e=L(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(p(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(p(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._tooltip.clear(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._tooltip.clear(),p(e)||(s(this._editGeometryOperations),this._editGeometryOperations=ve.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),s(this._segmentLabels),this._segmentLabels=new C({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:L(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}))}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],o=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),n=e===ze.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||n&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(Fe.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Fe.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)"vertex"===t.type&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Fe.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const o=[];for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected&&!n.manipulator.grabbing||n===e.info)&&o.push(n);this._moveVertices(o,e,Me.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case Fe.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Fe.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Fe.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Fe.MOVING:switch(this._reshapeEventState){case Fe.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Fe.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case Fe.RESHAPING:switch(this._reshapeEventState){case Fe.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Fe.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulation(){const{tool:e,view:t}=this,i=this._graphicState;if(this._graphicMoveManipulation=new ie({tool:e,view:t,graphicState:i}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=h(this._editGeometryOperations).createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(ze.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=d(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=d(e)))))}))),this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()})))))}_createMoveManipulation(e){const{graphic:t,handles:i,tool:a,view:o}=this,n=this._graphicState;this._moveManipulation=new $({tool:a,view:o,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t),snapToScene:!1,radius:$.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>i.add([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const r=e=>t=>{i.add(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(r(Q.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(r(Q.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(r(Q.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=h(t.geometry).spatialReference;i.add([this._moveManipulation.createDragPipeline(((i,o,n,r,s)=>{const l=n.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===Z.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:{...e,info:null}})).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:r,snappingManager:a.snappingManager,snappingContext:new ye({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipelineHandle.next).next(ue()).next((e=>this._perGraphicManipulatorDragAction(ze.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(i,e),e)));return r.next((()=>this._onDragCancel())),l}),e,s,t),g((()=>n.displaying),(()=>{this._updateMoveManipulationPosition()}),f),n.on("changed",(()=>this._updateMoveManipulationPosition())),g((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),f)])}_createVisualElements(){const{graphic:e,view:t}=this,i=B({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,Z.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});l(i)&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null),l(this._outlineVisualElement)&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=L(this.graphic)){const i=W.reshapeManipulators.edgeOffset,a=i.size/2,o=a+i.collisionPadding;if(p(this._edgeOffsetManipulatorGeometryInside)||p(this._edgeOffsetManipulatorGeometryOutside)){const e=a/o,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=pe(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=pe(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:_e.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:_e.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:_e.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:_e.Focused}],s=new j({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new j({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:s,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const n of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(n);l(e)&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=n(u),this._manipulatorHandles.add(d.locationUpdateHandle,s),this._manipulatorHandles.add([this._watchAndUpdateGrabState(s,!0),this._watchAndUpdateGrabState(h,!0)],s),this._manipulatorHandles.add(ce(s,this._createEdgeOffsetPipeline(d,t)),s),this._manipulatorHandles.add(ce(h,((e,i,a,o)=>{if("touch"===o){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const o=this.graphic,n=l(o.geometry)?o.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(me(this.view,e.elevationAlignedLocation)).next(X(this.view,e.elevationAlignedLocation,t,n,o)).next(ge()).next(ue()).next((e=>this._perGraphicManipulatorDragAction(ze.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),s);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([s.events.on("immediate-click",c),h.events.on("immediate-click",c),s.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;"focus"===e&&t.enabled?this._tooltip.info=new Oe({tooltipOptions:t}):this._tooltip.clear()}))],s),this._manipulatorInfos.push(d),this.manipulators.add(s),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,o=()=>{e.visibilityHandle=d(e.visibilityHandle);const o=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),s=l(o)&&l(r)&&re(o.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||s)&&(i.grabbable=!s,a.grabbable=!s,e.visibilityHandle=n([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",o),a.events.on("focus-changed",o),{remove:()=>{d(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}}],i),o()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const t=h(this._editGeometryOperations).data.coordinateHelper,i=ae(this.view,e.manipulator.elevationAlignedLocation,oe(t,e.handle,h(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(p(a)||p(o))return;const n=a.manipulator.renderLocation,r=o.manipulator.renderLocation,s=l(i)?ne(i,n,r):x;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const d=O(b(Ce,n,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-d,0,0],[d,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,o)=>{this._clearSelection();const{step:n,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(me(this.view,i.elevationAlignedLocation)).next(n).next(F(this.view)).next(z(this.view,h(this._editGeometryOperations).data.spatialReference)).next(ue()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),o.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const i=h(this._editGeometryOperations),a=oe(i.data.coordinateHelper,e.handle,t),o=i.createUndoGroup(),s=ae(this.view,e.manipulator.elevationAlignedLocation,a);if(a.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);l(t)&&this._splitEdgeManipulator(t,1)}if(a.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);l(t)&&this._splitEdgeManipulator(t,0)}const u=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:h(this._editGeometryOperations).data.spatialReference}),c=new se({view:this.view,isDraped:this._graphicState.isDraped,geometry:u(),elevationInfo:e.elevationInfo,width:W.visualElements.lineGraphics.outline.width,color:W.colorToVec4(K.main),attached:!0});let m;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=d(m)},f=this.on("undo",_);return m=n([r(c),g((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=u())),o,f]),{step:e=>p(a)||p(s)?(_(),null):{...e,operation:a,plane:s},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||p(t.operation))return t;this._updateEventState(Fe.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o}=t;return(i||a||o)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return p(t)||p(i)?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,o=this._tooltip,n=this._tooltipOptions;if(!n.enabled||p(i))return o.clear(),e;const r="end"===e.action?u:ke(this._graphicState.isDraped,i*a.selectedArrow,t,a.plane,h(this._editGeometryOperations).data.coordinateHelper);return p(o.info)||"reshape-edge-offset"!==o.info.type?o.info=new Oe({tooltipOptions:n,distance:r}):o.info.distance=r,e}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,o=e.handle.rightVertex,n=h(this._editGeometryOperations).data.coordinateHelper,r=1e-6,s=[];if(t&&n.distance(t.pos,i.pos)<r){const e=this._getManipulatorInfoFromHandle(i);l(e)&&s.push(e)}if(n.distance(i.pos,o.pos)<r||a&&n.distance(a.pos,o.pos)<r){const e=this._getManipulatorInfoFromHandle(o);l(e)&&s.push(e)}s.length&&this._removeVertices(s)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=L(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(p(this._vertexManipulatorGeometry)||p(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.vertex);this._vertexManipulatorGeometry=he(e,16,16),this._vertexManipulatorOutlineGeometry=he(t,16,16)}if(p(this._edgeManipulatorGeometry)||p(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.edge);this._edgeManipulatorGeometry=he(e,16,16),this._edgeManipulatorOutlineGeometry=he(t,16,16)}const i=l(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Re.Vertex|_e.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:Re.Vertex|_e.Unfocused|_e.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Re.Vertex|_e.Focused|_e.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:_e.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:_e.Selected|_e.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:_e.Selected|_e.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Re.Edge|_e.Focused|_e.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Re.Edge|_e.Focused|_e.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:Re.Edge|_e.Unfocused|_e.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:Re.Edge|_e.Unfocused|_e.Unselected});const a=new j({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible),metadata:{deleting:!1}});this._setTypeSpecificManipulatorSettings(a,e,t);const o="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(o),this.manipulators.add(a),this._updateManipulatorPosition(o),"edge"===o.type){const e=[];for(const t of[o.handle.leftVertex,o.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);l(i)&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o))))}o.locationUpdateHandle=n(e),this._manipulatorHandles.add(o.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=ce(a,((e,i,a,n)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=h(this._editGeometryOperations).createUndoGroup()),"edge"===o.type){const t=this._splitEdgeManipulator(o);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:o,snapOrigin:o.handle.pos}})).next(me(this.view,e.elevationAlignedLocation)).next(Y(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new ye({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next(ue()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(r=d(r)),this._updateTranslateVertexTooltip(e,Q.XY,t)})),a.next((()=>this._onDragCancel(!e.metadata.deleting,(()=>r=d(r)))))}));return this._manipulatorHandles.add([r,a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,o))),a.events.on("select-changed",(()=>{o.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),a.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==o.type?this._updateTranslateVertexTooltip(a,Q.XY):this._tooltip.clear()}))],a),this.emit("manipulators-changed"),o}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&(this.undo(),this.outputGeometry=l(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null),l(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case Fe.NONE:break;case Fe.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Fe.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(Fe.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=Re.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=W.reshapeManipulators.vertex.size/2+W.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=Re.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=W.reshapeManipulators.edge.size/2+W.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>this._onGrabStateChanged(e,t,i.action,i.pointerType)))}_onGrabStateChanged(e,t,i,a="mouse"){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Fe.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=e.manipulator.grabbing||!this._numGrabbing&&l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(e){p(e)||(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),t(this._manipulatorInfos,e),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(p(e))return;const t=h(this._editGeometryOperations);if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ne),e.manipulator.grabbing&&l(this._vertexLaserLineVisualElement)&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(p(i)||p(a))return;const o=i.manipulator,n=a.manipulator;if(l(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=o.location,a=n.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(s,l,p,t.data.spatialReference)}else E(Ce,o.renderLocation,n.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=h(this._editGeometryOperations),a=h(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const o=L(this.graphic);let n;this.enableEdgeOffset?(this._removeManipulator(e),n=this._createVertexOrEdgeManipulator(a)):(n=e,n.handle=a,n.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(n),this.enableEdgeOffset||this._updateTranslateVertexTooltip(n.manipulator,Q.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(Fe.RESHAPING),s=i.data.coordinateHelper.vectorToArray(n.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:h(a.index)}],added:s}),r&&this._updateEventState(Fe.NONE),n}_updateMoveManipulationPosition(){const e=G(Ce,0,0,0);let t=0,i=!1,a=null,o=null;for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected?(t++,S(e,e,n.manipulator.renderLocation),p(a)||n.selectedIndex>a.selectedIndex?(o=a,a=n):(p(o)||n.selectedIndex>o.selectedIndex)&&(o=n)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&q(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&q(this.graphic)}if(0!==t){let e=0;if(l(a)){const t=a.handle.pos,i=l(o)?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,n=p(o)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&n?this._moveManipulation.xyAxisManipulation.available=!1:i?e=Ue(i,t):n&&(e=Ue(t,n))}this._moveManipulation.angle=e,this._moveManipulation.radius=J}else this._moveManipulation.angle=ee(h(this.graphic.geometry)),this._moveManipulation.radius=$.radiusForSymbol(this.graphic.symbol);0!==t&&i?(V(e,e,1/t),Ne.spatialReference=h(this._editGeometryOperations).data.spatialReference,Ne.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ne),this._moveManipulation.elevationAlignedLocation=Ne):l(this._outlineVisualElement)&&!this._graphicState.isDraped&&l(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:N(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=h(this._editGeometryOperations);for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=h(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:h(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Fe.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(Fe.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?Me.NEW_STEP:Me.ACCUMULATE_STEPS)){const a=h(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const o of e)this._updateManipulatorPosition(o)}_offsetEdge(e,t){if(p(t.operation)||p(t.signedDistance))return;const i=h(this._editGeometryOperations),a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,e.button===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const i=this._tooltipOptions;if(!i.enabled)return;const a=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case Q.XY:this._tooltip.info=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>He(e,t,a)));break;case Q.XY_AXIS:this._tooltip.info=new Ge({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const o=He(e,i,a);return c(o,te(t))}));break;case Q.Z:this._tooltip.info=new Ee({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,De)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let o;const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case Q.XY:o=new Te({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>He(e,t,n))),this._updateTranslateVertexTooltipSum(o);break;case Q.XY_AXIS:o=new Ie({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>{const a=He(e,t,n);return c(a,te(i))})),this._updateTranslateVertexTooltipSum(o);break;case Q.Z:o=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,De)}const r=Le(e.elevationAlignedLocation);l(r)&&(o.elevation={mode:"absolute-height",...r}),this._tooltip.info=o}_updateTranslateTooltipDistance(e,t,i){if(l(t)&&"end"!==t.action){const{mapStart:a,mapEnd:o}=t,n=i(a,o);e.distance=l(n)?n:u}}_updateTranslateVertexTooltipSum(e){const{geometry:t}=this.graphic;if(p(t))return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?we(t,i):null,e.totalLength="polyline"===t.type?Ae(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function Ue(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function ke(e,t,i,a,o){if(e){const e=o.toXYZ(o.pointToVector(i)),n=H(a,e,A.get()),r=Pe(n,e,o.spatialReference);if(l(r))return m(r.value*Math.sign(t),r.unit)}return m(t*v(i.spatialReference),"meters")}e([M()],je.prototype,"_segmentLabels",void 0),e([M({constructOnly:!0})],je.prototype,"tool",void 0),e([M()],je.prototype,"_tooltip",void 0),e([M()],je.prototype,"inputGeometry",null),e([M()],je.prototype,"outputGeometry",void 0),e([M({readOnly:!0})],je.prototype,"updating",null),e([M()],je.prototype,"manipulators",null),e([M()],je.prototype,"view",null),e([M()],je.prototype,"graphic",null),e([M()],je.prototype,"enableZShape",null),e([M()],je.prototype,"enableZVertex",null),e([M()],je.prototype,"enableMoveGraphic",null),e([M()],je.prototype,"enableMidpoints",null),e([M()],je.prototype,"enableEdgeOffset",null),e([M()],je.prototype,"_labelOptions",null),e([M()],je.prototype,"_tooltipOptions",null),je=e([y("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],je);const Ne=D(0,0,null,null),Ce=T();var Re,Fe,ze;!function(e){e.Vertex=fe.Custom1,e.Edge=fe.Custom2}(Re||(Re={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Fe||(Fe={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(ze||(ze={}));export{je as ReshapeOperation};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import i from"../../../../../core/Evented.js";import{HandleOwner as a}from"../../../../../core/HandleOwner.js";import o from"../../../../../core/Handles.js";import{handlesGroup as n,destroyHandle as r}from"../../../../../core/handleUtils.js";import{destroyMaybe as s,isSome as l,isNone as p,unwrap as h,removeMaybe as d}from"../../../../../core/maybe.js";import{zeroMeters as u,scale as c,createLength as m}from"../../../../../core/quantityUtils.js";import{watch as g,when as _,initial as f}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../../../core/unitUtils.js";import{property as M}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as O}from"../../../../../chunks/mat4f64.js";import{l as x,b,h as E,s as G,a as S,g as V}from"../../../../../chunks/vec3.js";import{f as I,c as T}from"../../../../../chunks/vec3f64.js";import w from"../../../../../geometry/Polyline.js";import{projectPoint as H}from"../../../../../geometry/support/plane.js";import{sv3d as A}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as L}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as P}from"../../../../../symbols/support/utils.js";import{Manipulator3D as j}from"../../Manipulator3D.js";import{createManipulatorMaterial as U,createManipulatorOutlineMaterial as k,placeAtGraphic as N}from"../../manipulatorUtils.js";import{SegmentLabels3D as C}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as R}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as F,convertToMapCoordinates as z,screenToMapXYAtLocation as X,screenToMapXYForGraphicAtLocation as Y}from"../dragEventPipeline3D.js";import{ManipulatorType as Z}from"../ManipulatorType.js";import{canMoveZ as q}from"../manipulatorUtils.js";import{settings as W,colors as K}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as J}from"../manipulations/config.js";import{ManipulationType as Q,MoveManipulation as $}from"../manipulations/MoveManipulation.js";import{shapeOrientation as ee,axisConstrainedDragSign as te}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ie}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ae,createEdgeOffsetOperation as oe,edgeOffsetRotationMatrix as ne,screenEdgeLengthSquared as re}from"./edgeOffsetUtils.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as le}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pe,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as de}from"../../../../input/IViewEvents.js";import{addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as _e,ManipulatorStateCustomFlags as fe}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as ve}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as Me}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as ye}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as Oe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as xe}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as be}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Ee,TranslateGraphicXYTooltipInfo as Ge,TranslateGraphicTooltipInfo as Se,TranslateVertexZTooltipInfo as Ve,TranslateVertexXYTooltipInfo as Ie,TranslateVertexTooltipInfo as Te}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByElevationMode as we}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as He,autoLengthByElevationMode as Ae}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as De,elevationOfPoint as Le}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Pe}from"../../../../support/geodesicLengthMeasurementUtils.js";let je=class extends(i.EventedMixin(a)){constructor(e){super(e),this._vertexManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.vertex.color),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.outlineColor),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.hoverOutlineColor),W.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edge.color),W.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.edge.outlineColor),W.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.color),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.hoverColor),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.selected.color),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.outlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.hoverOutlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._editGeometryOperations=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=ze.NONE,this._outlineVisualElement=null,this._segmentLabels=null,this.outputGeometry=null,this._snappingPipeline=new Oe,this._snappingPipelineHandle=new Oe,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new le({graphic:e});this._tooltip=new be({view:t}),this.addHandles([g((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),g((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{l(e)&&(e.visible=t,e.edgeDistance=i?"far":"default")}),f),_((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),f),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=s(this._segmentLabels),this._tooltip=s(this._tooltip),this._removeManipulators()}get inputGeometry(){return l(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this.updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=s(this._moveManipulation),this._graphicMoveManipulation=s(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(p(this._editGeometryOperations))return;const e=L(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(p(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(p(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._tooltip.clear(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._tooltip.clear(),p(e)||(s(this._editGeometryOperations),this._editGeometryOperations=ve.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),s(this._segmentLabels),this._segmentLabels=new C({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:L(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}))}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],o=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),n=e===Xe.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||n&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(ze.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(ze.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)"vertex"===t.type&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(ze.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const o=[];for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected&&!n.manipulator.grabbing||n===e.info)&&o.push(n);this._moveVertices(o,e,Me.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case ze.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case ze.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case ze.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case ze.MOVING:switch(this._reshapeEventState){case ze.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case ze.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case ze.RESHAPING:switch(this._reshapeEventState){case ze.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case ze.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulation(){const{tool:e,view:t}=this,i=this._graphicState;if(this._graphicMoveManipulation=new ie({tool:e,view:t,graphicState:i}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=h(this._editGeometryOperations).createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(Xe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=d(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=d(e)))))}))),this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()})))))}_createMoveManipulation(e){const{graphic:t,handles:i,tool:a,view:o}=this,n=this._graphicState;this._moveManipulation=new $({tool:a,view:o,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t),snapToScene:!1,radius:$.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>i.add([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const r=e=>t=>{i.add(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(r(Q.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(r(Q.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(r(Q.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=h(t.geometry).spatialReference;i.add([this._moveManipulation.createDragPipeline(((i,o,n,r,s)=>{const l=n.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===Z.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:{...e,info:null}})).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:r,snappingManager:a.snappingManager,snappingContext:new ye({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipelineHandle.next).next(ue()).next((e=>this._perGraphicManipulatorDragAction(Xe.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(i,e),e)));return r.next((()=>this._onDragCancel())),l}),e,s,t),g((()=>n.displaying),(()=>{this._updateMoveManipulationPosition()}),f),n.on("changed",(()=>this._updateMoveManipulationPosition())),g((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),f)])}_createVisualElements(){const{graphic:e,view:t}=this,i=B({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,Z.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});l(i)&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null),l(this._outlineVisualElement)&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=L(this.graphic)){const i=W.reshapeManipulators.edgeOffset,a=i.size/2,o=a+i.collisionPadding;if(p(this._edgeOffsetManipulatorGeometryInside)||p(this._edgeOffsetManipulatorGeometryOutside)){const e=a/o,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=pe(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=pe(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:_e.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:_e.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:_e.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:_e.Focused}],s=new j({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new j({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:s,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const n of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(n);l(e)&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=n(u),this._manipulatorHandles.add(d.locationUpdateHandle,s),this._manipulatorHandles.add([this._watchAndUpdateGrabState(s,!0),this._watchAndUpdateGrabState(h,!0)],s),this._manipulatorHandles.add(ce(s,this._createEdgeOffsetPipeline(d,t)),s),this._manipulatorHandles.add(ce(h,((e,i,a,o)=>{if("touch"===o){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const o=this.graphic,n=l(o.geometry)?o.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(me(this.view,e.elevationAlignedLocation)).next(X(this.view,e.elevationAlignedLocation,t,n,o)).next(ge()).next(ue()).next((e=>this._perGraphicManipulatorDragAction(Xe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),s);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([s.events.on("immediate-click",c),h.events.on("immediate-click",c),s.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;if("focus"===e&&t.enabled){const e=this._tooltip.info=new xe({tooltipOptions:t});this._updateTooltipAreaOrTotalLength(e)}else this._tooltip.clear()}))],s),this._manipulatorInfos.push(d),this.manipulators.add(s),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,o=()=>{e.visibilityHandle=d(e.visibilityHandle);const o=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),s=l(o)&&l(r)&&re(o.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||s)&&(i.grabbable=!s,a.grabbable=!s,e.visibilityHandle=n([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",o),a.events.on("focus-changed",o),{remove:()=>{d(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}}],i),o()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const{coordinateHelper:t}=h(this._editGeometryOperations).data,i=ae(this.view,e.manipulator.elevationAlignedLocation,oe(t,e.handle,h(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(p(a)||p(o))return;const n=a.manipulator.renderLocation,r=o.manipulator.renderLocation,s=l(i)?ne(i,n,r):O;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const d=x(b(Ce,n,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-d,0,0],[d,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,o)=>{this._clearSelection();const{step:n,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(me(this.view,i.elevationAlignedLocation)).next(n).next(F(this.view)).next(z(this.view,h(this._editGeometryOperations).data.spatialReference)).next(ue()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),o.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const i=h(this._editGeometryOperations),a=oe(i.data.coordinateHelper,e.handle,t),o=i.createUndoGroup(),s=ae(this.view,e.manipulator.elevationAlignedLocation,a);if(a.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);l(t)&&this._splitEdgeManipulator(t,1)}if(a.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);l(t)&&this._splitEdgeManipulator(t,0)}const u=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:i.data.spatialReference}),c=new se({view:this.view,isDraped:this._graphicState.isDraped,geometry:u(),elevationInfo:e.elevationInfo,width:W.visualElements.lineGraphics.outline.width,color:W.colorToVec4(K.main),attached:!0});let m;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=d(m)},f=this.on("undo",_);return m=n([r(c),g((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=u())),o,f]),{step:e=>p(a)||p(s)?(_(),null):{...e,operation:a,plane:s},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||p(t.operation))return t;this._updateEventState(ze.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o}=t;return(i||a||o)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return p(t)||p(i)?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,o=this._tooltip,n=this._tooltipOptions;if(!n.enabled||p(i))return o.clear(),e;let r=o.info;(p(r)||"reshape-edge-offset"!==r.type)&&(r=o.info=new xe({tooltipOptions:n}));const{coordinateHelper:s}=h(this._editGeometryOperations).data;return r.distance="end"===e.action?u:ke(this._graphicState.isDraped,i*a.selectedArrow,t,a.plane,s),this._updateTooltipAreaOrTotalLength(r),e}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,o=e.handle.rightVertex,n=h(this._editGeometryOperations).data.coordinateHelper,r=[];if(t&&n.distance(t.pos,i.pos)<Re){const e=this._getManipulatorInfoFromHandle(i);l(e)&&r.push(e)}if(n.distance(i.pos,o.pos)<Re||a&&n.distance(a.pos,o.pos)<Re){const e=this._getManipulatorInfoFromHandle(o);l(e)&&r.push(e)}r.length&&this._removeVertices(r)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=L(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(p(this._vertexManipulatorGeometry)||p(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.vertex);this._vertexManipulatorGeometry=he(e,16,16),this._vertexManipulatorOutlineGeometry=he(t,16,16)}if(p(this._edgeManipulatorGeometry)||p(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.edge);this._edgeManipulatorGeometry=he(e,16,16),this._edgeManipulatorOutlineGeometry=he(t,16,16)}const i=l(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Fe.Vertex|_e.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:Fe.Vertex|_e.Unfocused|_e.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Fe.Vertex|_e.Focused|_e.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:_e.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:_e.Selected|_e.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:_e.Selected|_e.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Fe.Edge|_e.Focused|_e.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Fe.Edge|_e.Focused|_e.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:Fe.Edge|_e.Unfocused|_e.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:Fe.Edge|_e.Unfocused|_e.Unselected});const a=new j({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible),metadata:{deleting:!1}});this._setTypeSpecificManipulatorSettings(a,e,t);const o="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(o),this.manipulators.add(a),this._updateManipulatorPosition(o),"edge"===o.type){const e=[];for(const t of[o.handle.leftVertex,o.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);l(i)&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o))))}o.locationUpdateHandle=n(e),this._manipulatorHandles.add(o.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=ce(a,((e,i,a,n)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=h(this._editGeometryOperations).createUndoGroup()),"edge"===o.type){const t=this._splitEdgeManipulator(o);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:o,snapOrigin:o.handle.pos}})).next(me(this.view,e.elevationAlignedLocation)).next(Y(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new ye({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new R}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next(ue()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(r=d(r)),this._updateTranslateVertexTooltip(e,Q.XY,t)})),a.next((()=>this._onDragCancel(!e.metadata.deleting,(()=>r=d(r)))))}));return this._manipulatorHandles.add([r,a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,o))),a.events.on("select-changed",(()=>{o.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),a.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==o.type?this._updateTranslateVertexTooltip(a,Q.XY):this._tooltip.clear()}))],a),this.emit("manipulators-changed"),o}_trackNumDragging(e){switch(e.action){case"start":this._numDragging++;break;case"end":this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&(this.undo(),this.outputGeometry=l(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null),l(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case ze.NONE:break;case ze.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case ze.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(ze.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=Fe.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=W.reshapeManipulators.vertex.size/2+W.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=Fe.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=W.reshapeManipulators.edge.size/2+W.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",(i=>this._onGrabStateChanged(e,t,i.action,i.pointerType)))}_onGrabStateChanged(e,t,i,a="mouse"){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(ze.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=e.manipulator.grabbing||!this._numGrabbing&&l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.emit("manipulators-changed"))}_removeManipulator(e){p(e)||(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),t(this._manipulatorInfos,e),this.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(p(e))return;const t=h(this._editGeometryOperations);if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ne),e.manipulator.grabbing&&l(this._vertexLaserLineVisualElement)&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(p(i)||p(a))return;const o=i.manipulator,n=a.manipulator;if(l(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=o.location,a=n.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=D(s,l,p,t.data.spatialReference)}else E(Ce,o.renderLocation,n.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=h(this._editGeometryOperations),a=h(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const o=L(this.graphic);let n;this.enableEdgeOffset?(this._removeManipulator(e),n=this._createVertexOrEdgeManipulator(a)):(n=e,n.handle=a,n.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(n),this.enableEdgeOffset||this._updateTranslateVertexTooltip(n.manipulator,Q.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(ze.RESHAPING),s=i.data.coordinateHelper.vectorToArray(n.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:h(a.index)}],added:s}),r&&this._updateEventState(ze.NONE),n}_updateMoveManipulationPosition(){const e=G(Ce,0,0,0);let t=0,i=!1,a=null,o=null;for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected?(t++,S(e,e,n.manipulator.renderLocation),p(a)||n.selectedIndex>a.selectedIndex?(o=a,a=n):(p(o)||n.selectedIndex>o.selectedIndex)&&(o=n)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&q(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&q(this.graphic)}if(0!==t){let e=0;if(l(a)){const t=a.handle.pos,i=l(o)?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,n=p(o)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&n?this._moveManipulation.xyAxisManipulation.available=!1:i?e=Ue(i,t):n&&(e=Ue(t,n))}this._moveManipulation.angle=e,this._moveManipulation.radius=J}else this._moveManipulation.angle=ee(h(this.graphic.geometry)),this._moveManipulation.radius=$.radiusForSymbol(this.graphic.symbol);0!==t&&i?(V(e,e,1/t),Ne.spatialReference=h(this._editGeometryOperations).data.spatialReference,Ne.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ne),this._moveManipulation.elevationAlignedLocation=Ne):l(this._outlineVisualElement)&&!this._graphicState.isDraped&&l(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:N(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=h(this._editGeometryOperations);for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=h(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:h(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(ze.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(ze.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?Me.NEW_STEP:Me.ACCUMULATE_STEPS)){const a=h(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const o of e)this._updateManipulatorPosition(o)}_offsetEdge(e,t){if(p(t.operation)||p(t.signedDistance))return;const i=h(this._editGeometryOperations),a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,e.button===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const i=this._tooltipOptions;if(!i.enabled)return;const a=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case Q.XY:this._tooltip.info=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>He(e,t,a)));break;case Q.XY_AXIS:this._tooltip.info=new Ge({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const o=He(e,i,a);return c(o,te(t))}));break;case Q.Z:this._tooltip.info=new Ee({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,De)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let o;const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case Q.XY:o=new Te({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>He(e,t,n))),this._updateTooltipAreaOrTotalLength(o);break;case Q.XY_AXIS:o=new Ie({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>{const a=He(e,t,n);return c(a,te(i))})),this._updateTooltipAreaOrTotalLength(o);break;case Q.Z:o=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,De)}const r=Le(e.elevationAlignedLocation);l(r)&&(o.elevation={mode:"absolute-height",...r}),this._tooltip.info=o}_updateTranslateTooltipDistance(e,t,i){if(l(t)&&"end"!==t.action){const{mapStart:a,mapEnd:o}=t,n=i(a,o);e.distance=l(n)?n:u}}_updateTooltipAreaOrTotalLength(e){const{geometry:t}=this.graphic;if(p(t))return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?we(t,i):null,e.totalLength="polyline"===t.type?Ae(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function Ue(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function ke(e,t,i,a,o){if(e){const e=o.toXYZ(o.pointToVector(i)),n=H(a,e,A.get()),r=Pe(n,e,o.spatialReference);if(l(r))return m(r.value*Math.sign(t),r.unit)}return m(t*v(i.spatialReference),"meters")}e([M()],je.prototype,"_segmentLabels",void 0),e([M({constructOnly:!0})],je.prototype,"tool",void 0),e([M()],je.prototype,"_tooltip",void 0),e([M()],je.prototype,"inputGeometry",null),e([M()],je.prototype,"outputGeometry",void 0),e([M({readOnly:!0})],je.prototype,"updating",null),e([M()],je.prototype,"manipulators",null),e([M()],je.prototype,"view",null),e([M()],je.prototype,"graphic",null),e([M()],je.prototype,"enableZShape",null),e([M()],je.prototype,"enableZVertex",null),e([M()],je.prototype,"enableMoveGraphic",null),e([M()],je.prototype,"enableMidpoints",null),e([M()],je.prototype,"enableEdgeOffset",null),e([M()],je.prototype,"_labelOptions",null),e([M()],je.prototype,"_tooltipOptions",null),je=e([y("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],je);const Ne=D(0,0,null,null),Ce=T(),Re=1e-6;var Fe,ze,Xe;!function(e){e.Vertex=fe.Custom1,e.Edge=fe.Custom2}(Fe||(Fe={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(ze||(ze={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Xe||(Xe={}));export{je as ReshapeOperation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../core/Logger.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/Error.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import t from"./DynamicLayerView3D.js";import s from"../../layers/MapImageLayerView.js";import{createQueryGeometry as i}from"../../support/drapedUtils.js";let o=class extends(s(t)){constructor(){super(...arguments),this.type="map-image-3d"}initialize(){this.updatingHandles.add((()=>this.exportImageVersion),(()=>this.updatingHandles.addPromise(this.refreshDebounced())))}createFetchPopupFeaturesQueryGeometry(e,r){return i(e,r,this.view)}highlight(e){return{remove:()=>{}}}highlightGraphicUpdated(e,r){}getFetchOptions(){return{timeExtent:this.timeExtent}}};o=e([r("esri.views.3d.layers.MapImageLayerView3D")],o);const a=o;export{a 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.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import i from"../../../core/Accessor.js";import{ClonableMixin as o}from"../../../core/Clonable.js";import{IdentifiableMixin as s}from"../../../core/Identifiable.js";import{JSONSupportMixin as t}from"../../../core/JSONSupport.js";import{isSome as r,unwrap as a}from"../../../core/maybe.js";import{watch as n,initial as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import l from"./FeatureLayerView3D.js";let y=class extends(t(o(s(i)))){constructor(e){super(e),this._originalDefinitionExpression=null,this.associatedLayerView=null,this.objectIds=[],this._loaded=!1}initialize(){this.associatedLayer.load().then((e=>{this.destroyed||(this._originalDefinitionExpression=e.definitionExpression,this.addHandles(n((()=>this._definitionExpression),(e=>this.associatedLayer.definitionExpression=e),p)),this.associatedLayerView=new l({layer:this.associatedLayer,view:this.view}),this._loaded=!0)}))}destroy(){r(this.associatedLayerView)&&(this.associatedLayer.definitionExpression=a(this._originalDefinitionExpression))}get updating(){return!this._loaded||r(this.associatedLayerView)&&this.associatedLayerView.updating}get _definitionExpression(){const e=this.objectIds;return 0===e.length?"1 = 0":`OBJECTID IN (${e.join(",")})`}};e([d()],y.prototype,"updating",null),e([d()],y.prototype,"view",void 0),e([d()],y.prototype,"associatedLayer",void 0),e([d()],y.prototype,"associatedLayerView",void 0),e([d()],y.prototype,"objectIds",void 0),e([d()],y.prototype,"_definitionExpression",null),e([d()],y.prototype,"_loaded",void 0),y=e([c("esri.views.3d.layers.SceneLayerFeatureView3D")],y);export{y as SceneLayerFeatureView3D};
|