@arcgis/core 4.34.0-next.40 → 4.34.0-next.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/016d421114118307d4dd.js +1 -0
- package/assets/esri/core/workers/chunks/1a2278b9fe9666342728.js +1 -0
- package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +1 -0
- package/assets/esri/core/workers/chunks/3245d20ea4bb779f87ef.js +1 -0
- package/assets/esri/core/workers/chunks/6b73926feb5c5d957062.js +1 -0
- package/assets/esri/core/workers/chunks/{6269c4bbf0f224a954e9.js → 6f4079b7a2b45f304ee6.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e6e5677b90b00622146.js → 7ef7f3925495b9ade88c.js} +1 -1
- package/assets/esri/core/workers/chunks/82955562805ad5514ed8.js +346 -0
- package/assets/esri/core/workers/chunks/{5fe3c279d57f44416c28.js → a1d3f1c221389eb6090c.js} +1 -1
- package/assets/esri/core/workers/chunks/{306a68137e62656b0f05.js → d5d2d4df407cf078bb81.js} +1 -1
- package/assets/esri/core/workers/chunks/{94850c094e076d81a016.js → dca2b487152cde45fb65.js} +1 -1
- package/assets/esri/core/workers/chunks/{31ad9949b08a5b07218c.js → eea3e0bd17479a767160.js} +2 -2
- package/assets/esri/core/workers/chunks/fe6fa1f2c2d54d41645e.js +1 -0
- package/config.js +1 -1
- package/core/workers/registry.js +1 -1
- package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
- package/geometry/support/curves/closestPointOnCurve.js +1 -1
- package/geometry/support/curves/curveExtent.js +1 -1
- package/geometry/support/curves/curveLength.js +1 -1
- package/geometry/support/curves/curveUtils.js +1 -1
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/curves/splitCurveAtPoint.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/interfaces.d.ts +24 -2
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/PointCloudLayer.js +1 -1
- package/package.json +1 -1
- package/rest/networks/support/CircuitPath.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/webgl/BitBlitRenderer.js +1 -1
- package/views/2d/engine/webgl/Mesh2D.js +1 -1
- package/views/2d/engine/webgl/VertexStream.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushStencil.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushTileDebugInfo.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLBackground.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightRenderer.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/meshing/SimpleMesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/interactive/editingTools/ControlPointsTransformTool.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/BaseDynamicLayerView2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
- package/views/3d/support/GaussianSplatSortWorker.js +5 -0
- package/views/3d/support/GaussianSplatWorkerHandle.js +5 -0
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/flow/loadUtils.js +1 -1
- package/views/3d/support/intersectionUtils.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/ScreenSpaceGeometry.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePathData.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgeBufferWriters.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/BackedBufferObject.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +5 -0
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoCache.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +5 -0
- package/views/PopupView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/AppendVertex.js +1 -1
- package/views/interactive/editGeometry/operations/ClosePart.js +5 -0
- package/views/interactive/editGeometry/operations/MoveMesh.js +1 -1
- package/views/interactive/editGeometry/operations/MoveVertex.js +1 -1
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/editGeometry/operations/RemoveVertices.js +1 -1
- package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
- package/views/interactive/editGeometry/operations/ScaleVertex.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/editGeometry/operations/SetVertexPosition.js +1 -1
- package/views/interactive/editGeometry/operations/SplitSegment.js +5 -0
- package/views/interactive/editGeometry/operations/UpdateVertices.js +1 -1
- package/views/interactive/editGeometry/operations/curveOperationUtils.js +5 -0
- package/views/interactive/editGeometry/operations.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/views/support/TileTreeDebugger.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/views/webgl/VertexBuffer.js +1 -1
- package/views/webgl/testFloatBufferBlend.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/Editor/AddAssociationWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMeshManager.js +5 -0
- package/widgets/PanoramicViewer/support/PanoramicMeshWorker.js +5 -0
- package/widgets/Spinner.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
- package/widgets/smartMapping/HeatmapSlider/HeatmapSliderViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/01bd8f90e55081e65b38.js +0 -1
- package/assets/esri/core/workers/chunks/0a27f9b11d03874809ee.js +0 -346
- package/assets/esri/core/workers/chunks/34f677e8c1691c10e4e9.js +0 -1
- package/assets/esri/core/workers/chunks/e95a8c988ef822723503.js +0 -1
- package/assets/esri/core/workers/chunks/fd3009164d5e38fda85f.js +0 -1
- package/views/interactive/editGeometry/operations/CloseComponent.js +0 -5
- package/views/interactive/editGeometry/operations/SplitEdge.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unique as e}from"../../../../../core/arrayUtils.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{i1616to32 as i}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as s}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{vertexLayoutHash as f}from"../shaderGraph/techniques/mesh/utils.js";import{PrimitiveType as o,DataType as n}from"../../../../webgl/enums.js";import{VertexArrayObject as u}from"../../../../webgl/VertexArrayObject.js";
|
|
5
|
+
import{unique as e}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{i1616to32 as i}from"../number.js";import{MappedBuffer as r}from"./Buffer.js";import{unpackDataView as s}from"../shaderGraph/techniques/mesh/dataViewUtils.js";import{vertexLayoutHash as f}from"../shaderGraph/techniques/mesh/utils.js";import{PrimitiveType as o,DataType as n}from"../../../../webgl/enums.js";import{VertexArrayObject as u}from"../../../../webgl/VertexArrayObject.js";const a=1e3,h=4,l=[{name:"visibility",offset:0,type:n.FLOAT,count:1}],d={hash:f(l),attributes:l,stride:h};function _(t,i){return e(t.attributes,(e,t)=>e.name===t.name).filter(e=>i.locations.has(e.name)).map(e=>({name:e.name,type:e.type,count:e.count,divisor:0,normalized:e.normalized??!1,offset:e.offset,stride:t.stride})).sort((e,t)=>i.locations.get(e.name)-i.locations.get(t.name))}function m(t,i){const r=[],s=e(t.attributes,(e,t)=>e.name===t.name).filter(e=>i.locations.has(e.name));for(const e of s){r.push({name:e.name,type:e.type,count:e.count,divisor:0,normalized:e.normalized??!1,offset:e.offset,stride:t.stride});const s=i.computeAttributeMap[e.name];null!=s&&2===s.length&&(r.push({name:s[0],count:e.count,divisor:0,type:e.type,normalized:e.normalized??!1,offset:e.offset+t.stride,stride:t.stride}),r.push({name:s[1],count:e.count,divisor:0,type:e.type,normalized:e.normalized??!1,offset:e.offset+2*t.stride,stride:t.stride}))}return r.sort((e,t)=>i.locations.get(e.name)-i.locations.get(t.name))}class c{constructor(e,t,i){if(this._bufferPool=e,this._layout=t,this.useVisibility=i,this._invalidatedGeometry=!1,this._invalidatedCompute=!1,this._position=this._layout.attributes.find(e=>"pos"===e.name||"position"===e.name),!this._position)throw new Error("InternalError: Unable to find position attribute")}destroy(){this._indexBuffer=t(this._indexBuffer),this._vertexBuffer=t(this._vertexBuffer),this._visibilityBuffer=t(this._visibilityBuffer),this._computeVAO?.disposeVAOOnly(),this._geometryVAO?.disposeVAOOnly()}get layout(){return this._layout}getDrawArgs(e,t,i,r){return r?{primitive:o.POINTS,count:t/3,offset:i/3}:{primitive:e,count:t,offset:i}}getAttributePrecisionPackFactors(){const e={};for(const t of this.layout.attributes)t.packPrecisionFactor&&(e[t.name]=t.packPrecisionFactor);return e}getDebugVertexInfo(e=!1,t){if(!this._vertexBuffer)return null;const i=this._layout,r=i.stride,f=this._vertexBuffer.getView(0,this._vertexBuffer.byteSize),o=[];if(e)if(null==t)console.log("must provide location info to see compute attributes");else for(const s of i.attributes){const e=t.computeAttributeMap[s.name];null!=e&&2===e.length&&(o.push({...s,name:e[0],offset:s.offset+r}),o.push({...s,name:e[1],offset:s.offset+2*r}))}const n=new DataView(f.slice().buffer);let u=f.byteLength/r;e&&(u=this._indexBuffer.fillPointer/3);const a=this._indexBuffer.getView(0,this._indexBuffer.byteSize);let h=0;const l=[];for(let d=0;d<u;d++){if(e){h=a[3*d]*r}const t={};for(const e of[...i.attributes,...o]){let i=`${e.offset} ${e.name}`,r=s(n,e,h);if(e.packPrecisionFactor)if(i+=` (precision: ${e.packPrecisionFactor})`,"number"==typeof r)r/=e.packPrecisionFactor;else for(let t=0;t<r.length;t++)r[t]/=e.packPrecisionFactor;t[i]=r}h+=r,l.push(t)}return{vertices:l,layout:i}}_ensure(e,t){if(this._vertexBuffer&&this._indexBuffer)this._indexBuffer.ensure(Math.max(e,a)),this._vertexBuffer.ensure(Math.max(t,a)),this._visibilityBuffer&&this._visibilityBuffer.ensure(Math.max(t,a));else{const i=this._layout.stride/Uint32Array.BYTES_PER_ELEMENT;this._indexBuffer=new r("index",Math.max(e,a),1,this._bufferPool),this._vertexBuffer=new r("vertex",Math.max(t,a),i,this._bufferPool),this.useVisibility&&(this._visibilityBuffer=new r("vertex",Math.max(t,a),h/Uint32Array.BYTES_PER_ELEMENT,this._bufferPool))}}append(e){const t=e.layout.stride,i=e.indices.byteLength/Uint32Array.BYTES_PER_ELEMENT,r=e.vertices.byteLength/t;this._ensure(i,r);const{vertices:s,indices:f}=e,o=this._vertexBuffer.insert(s,0,s.byteLength/t,0),n=new Uint32Array(r);new Float32Array(n.buffer).fill(255),this._visibilityBuffer&&this._visibilityBuffer.insert(n,0,n.byteLength/h,0);return{vertexFrom:o,indexFrom:this._indexBuffer.insert(f,0,f.byteLength/4,o)}}setEntityRecordRangeVisibility(e,t,i,r){if(!(t+i>e.length))for(let s=t;s<t+i;s++){const{vertexStart:t,vertexCount:i}=e[s];this._visibilityBuffer.setF32Range(t,t+i,r)}}getEntityRecordVisibility(e,t){const i=e.records[t];return this._visibilityBuffer.getF32(i.vertexStart)}copyRecordFrom(e,t,r,s){const{indexStart:f,indexCount:o,vertexStart:n,vertexCount:u}=t;this._ensure(o,u);const a=e._position,h=r*(a.packPrecisionFactor??1),l=s*(a.packPrecisionFactor??1),d=a.offset,_=i(h,l),m=this._vertexBuffer.copyFrom(e._vertexBuffer,n,u,_,d);this._visibilityBuffer&&e._visibilityBuffer&&this._visibilityBuffer.copyFrom(e._visibilityBuffer,n,u,0,0);const c=this._indexBuffer.copyFrom(e._indexBuffer,f,o,m-n,0),y=t.clone();return y.vertexStart=m,y.indexStart=c,y.overlaps=0,y}remove(e,t,i,r){this._indexBuffer.free(e,t),this._vertexBuffer.free(i,r),this._visibilityBuffer&&this._visibilityBuffer.free(i,r)}upload(){this._invalidatedGeometry=!0,this._invalidatedCompute=!0}getGeometryVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedGeometry){if((this._vertexBuffer.invalidated||this._indexBuffer.invalidated||this._visibilityBuffer?.invalidated)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer&&this._visibilityBuffer.invalidate(),this._geometryVAO?.disposeVAOOnly(),this._geometryVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer&&this._visibilityBuffer.upload(),!this._geometryVAO){const i=this._indexBuffer.getIndexBuffer(e,!1),r=new Map([["geometry",this._vertexBuffer.getVertexBuffer(e,_(this.layout,t))]]);this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getVertexBuffer(e,_(d,t))),this._geometryVAO=new u(e,r,i)}this._invalidatedGeometry=!1}return this._geometryVAO}getComputeVAO(e,t){if(!this._vertexBuffer||!this._indexBuffer||!this._vertexBuffer.bufferSize)return null;if(this._invalidatedCompute&&((this._vertexBuffer.invalidated||this._indexBuffer.invalidatedComputeBuffer)&&(this._vertexBuffer.invalidate(),this._indexBuffer.invalidate(),this._visibilityBuffer?.invalidate(),this._computeVAO?.disposeVAOOnly(),this._computeVAO=null),this._vertexBuffer.upload(),this._indexBuffer.upload(),this._visibilityBuffer?.upload(),!this._computeVAO)){const i=this._indexBuffer.getIndexBuffer(e,!0),r=new Map([["geometry",this._vertexBuffer.getVertexBuffer(e,m(this.layout,t))]]);this._visibilityBuffer&&r.set("visibility",this._visibilityBuffer.getVertexBuffer(e,_(d,t))),this._computeVAO=new u(e,r,i),this._invalidatedCompute=!1}return this._computeVAO}get memoryStats(){return{bytesUsed:this._vertexBuffer.memoryStats.bytesUsed+this._indexBuffer.memoryStats.bytesUsed,bytesReserved:this._vertexBuffer.memoryStats.bytesReserved+this._indexBuffer.memoryStats.bytesReserved,vertex:this._vertexBuffer.memoryStats,index:this._indexBuffer.memoryStats}}reshuffle(e){this._vertexBuffer&&this._vertexBuffer.reshuffle(e.vertex.count,e.vertex.operations),this._indexBuffer&&this._indexBuffer.reshuffle(e.index.count,e.index.operations),this._visibilityBuffer&&this._visibilityBuffer.reshuffle(e.vertex.count,e.vertex.operations)}}export{c as MappedMesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{textureBindingHighlight0 as r,textureBindingHighlight1 as e}from"../../definitions.js";import{alphaToRgbaChannelSelectorMatrix as s,rgbaToRgbaChannelSelectorMatrix as i,sigma as t}from"./parameters.js";import{highlight as o,blur as u}from"../../shaders/HighlightPrograms.js";import{
|
|
5
|
+
import{textureBindingHighlight0 as r,textureBindingHighlight1 as e}from"../../definitions.js";import{alphaToRgbaChannelSelectorMatrix as s,rgbaToRgbaChannelSelectorMatrix as i,sigma as t}from"./parameters.js";import{highlight as o,blur as u}from"../../shaders/HighlightPrograms.js";import{PrimitiveType as h,DataType as a}from"../../../../../webgl/enums.js";import{createProgram as n}from"../../../../../webgl/ProgramTemplate.js";import{VertexArrayObject as m}from"../../../../../webgl/VertexArrayObject.js";import{VertexBuffer as l}from"../../../../../webgl/VertexBuffer.js";import{VertexElementDescriptor as g}from"../../../../../webgl/VertexElementDescriptor.js";class _{constructor(){this._width=void 0,this._height=void 0,this._resources=null}dispose(){this._resources&&(this._resources.quadGeometry.dispose(),this._resources.quadVAO.dispose(),this._resources.highlightProgram.dispose(),this._resources.blurProgram.dispose(),this._resources=null)}preBlur(e,i){e.bindTexture(i,r),e.useProgram(this._resources.blurProgram),this._resources.blurProgram.setUniform4fv("u_direction",[1,0,1/this._width,0]),this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector",s),e.bindVAO(this._resources.quadVAO),e.drawArrays(h.TRIANGLE_STRIP,0,4),e.bindVAO(null)}finalBlur(e,s){e.bindTexture(s,r),e.useProgram(this._resources.blurProgram),this._resources.blurProgram.setUniform4fv("u_direction",[0,1,0,1/this._height]),this._resources.blurProgram.setUniformMatrix4fv("u_channelSelector",i),e.bindVAO(this._resources.quadVAO),e.drawArrays(h.TRIANGLE_STRIP,0,4),e.bindVAO(null)}renderHighlight(e,s,i){e.bindTexture(s,r),e.useProgram(this._resources.highlightProgram),i.applyHighlightOptions(e,this._resources.highlightProgram),e.bindVAO(this._resources.quadVAO),e.setBlendingEnabled(!0),e.setBlendFunction(1,771),e.drawArrays(h.TRIANGLE_STRIP,0,4),e.bindVAO(null)}_initialize(s,i,h){this._width=i,this._height=h;const _=new l(s,[new g("a_position",2,a.BYTE,0,4),new g("a_texcoord",2,a.BYTE,2,4)],new Int8Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]).buffer),d=new m(s,_),c=n(s,o,d.locations),f=n(s,u,d.locations);s.useProgram(c),c.setUniform1i("u_texture",r),c.setUniform1i("u_shade",e),c.setUniform1f("u_sigma",t),s.useProgram(f),f.setUniform1i("u_texture",r),f.setUniform1f("u_sigma",t),this._resources={quadGeometry:_,quadVAO:d,highlightProgram:c,blurProgram:f}}setup(r,e,s){this._resources?(this._width=e,this._height=s):this._initialize(r,e,s)}}export{_ 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{toConst as r}from"../../../../../core/compilerUtils.js";import{BufferObject as e}from"../../../../webgl/BufferObject.js";import"../../../../webgl/FramebufferObject.js";import"../../../../webgl/Program.js";import"../../../../../core/has.js";import"../../../../webgl/Renderbuffer.js";import"../../../../webgl/Texture.js";import{VertexArrayObject as t}from"../../../../webgl/VertexArrayObject.js";import{dataSizeInBytes as s}from"./definitions.js";import{VertexBuffer as
|
|
5
|
+
import{toConst as r}from"../../../../../core/compilerUtils.js";import{BufferObject as e}from"../../../../webgl/BufferObject.js";import"../../../../webgl/FramebufferObject.js";import"../../../../webgl/Program.js";import"../../../../../core/has.js";import"../../../../webgl/Renderbuffer.js";import"../../../../webgl/Texture.js";import{VertexArrayObject as t}from"../../../../webgl/VertexArrayObject.js";import{dataSizeInBytes as s}from"./definitions.js";import{VertexBuffer as i}from"../../../../webgl/VertexBuffer.js";class o{constructor(r,t){this._boundPart=null,this.vertexBuffers=new Map,this.indexBuffers=new Map,this.groups=[];for(const e in t.vertex){const{data:s,layout:o}=t.vertex[e],n=new i(r,o,s);this.vertexBuffers.set(e,n)}for(const s in t.index){const{data:i}=t.index[s],o=e.createIndex(r,35044,i);this.indexBuffers.set(s,o)}for(const e of t.groups)this.groups.push({...e,vertexArrays:new Map});this.parts=t.parts}bind(e,s,i){this._boundPart=i;const{group:o}=this.parts[this._boundPart],n=this.groups[o];if(!n)throw new Error(`Missing group ${o}.`);let f=n.vertexArrays.get(s.stringHash);if(!f){const i=r(new Set(s.locations.keys())),o=n.index?this.indexBuffers.get(n.index):null,a=new Map;for(const[r,e]of this.vertexBuffers){e.layout.filter(r=>i.has(r.name)).length>0&&a.set(r,e)}f=new t(e,a,o),n.vertexArrays.set(s.stringHash,f)}e.bindVAO(f)}draw(r){if(null==this._boundPart)throw new Error("Mesh.bind() has not been called.");const{start:e,count:t}=this.parts[this._boundPart],{group:i}=this.parts[this._boundPart],{primitive:o,index:n}=this.groups[i];if(n){const i=this.indexBuffers.get(n);if(!i)throw new Error(`Missing index buffer "${n}".`);const{indexType:f}=i;if(!f)throw new Error("Buffer type error.");r.drawElements(o,t,f,e*s[f])}else r.drawArrays(o,e,t)}unbind(r){this._boundPart=null,r.bindVAO(null)}destroy(){this.groups.forEach(({vertexArrays:r})=>r.forEach(r=>r.disposeVAOOnly())),this.vertexBuffers.forEach(r=>r.dispose()),this.indexBuffers.forEach(r=>r.dispose())}}export{o as Mesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{dataSizeInBytes as t}from"./definitions.js";import{Mesh as e}from"./Mesh.js";import{DataType as r,PrimitiveType as i}from"../../../../webgl/enums.js";import{VertexElementDescriptor as n}from"../../../../webgl/VertexElementDescriptor.js";const o={position:{type:r.SHORT,count:2}};class s extends e{static create(e,r){const i=[];let{stride:o}=r;if(null==o){o=0;for(const[e,{count:i,type:n,offset:s}]of Object.entries(r.layout)){if(null!=s)throw new Error("Stride cannot be computed automatically when attribute offsets are supplied explicitly.");o+=i*t[n]}}let
|
|
5
|
+
import{dataSizeInBytes as t}from"./definitions.js";import{Mesh as e}from"./Mesh.js";import{DataType as r,PrimitiveType as i}from"../../../../webgl/enums.js";import{VertexElementDescriptor as n}from"../../../../webgl/VertexElementDescriptor.js";const o={position:{type:r.SHORT,count:2}};class s extends e{static create(e,r){const i=[];let{stride:o}=r;if(null==o){o=0;for(const[e,{count:i,type:n,offset:s}]of Object.entries(r.layout)){if(null!=s)throw new Error("Stride cannot be computed automatically when attribute offsets are supplied explicitly.");o+=i*t[n]}}let l=0;for(const[s,{count:d,offset:f,type:m,normalized:x}]of Object.entries(r.layout)){null!=f&&(l=f);const e=new n(s,d,m,l,o,null!=x&&x,0);i.push(e),l+=d*t[m]}const a={primitive:r.primitive};null!=r.index&&(a.index="indexData");let{count:u}=r;if(null==u&&(u=r.index?r.index.length:r.vertex.byteLength/o,Math.floor(u)!==u))throw new Error(`The byte length of vertex data must be an exact multiple of the stride, which is ${o}.`);const c={start:0,count:u,group:0,primitive:r.primitive},p={vertex:{vertexData:{data:r.vertex,layout:i}},parts:[c],groups:[a]};return null!=r.index&&(p.index={indexData:{data:r.index}}),new s(e,p,r.layout)}static fromVertexStream(t,e){return s.create(t,{primitive:i.TRIANGLE_STRIP,vertex:new Uint16Array(e),layout:o})}constructor(t,e,r){super(t,e),this._spec=r}bind(t,e,r=0){super.bind(t,e,r)}}export{s as SimpleMesh};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e}from"../../../../../../../core/maybe.js";import{Mesh as t}from"../../../meshing/Mesh.js";import{simplePipelineState as s}from"../../utils.js";import{Technique as i}from"../Technique.js";import{OverlayShader as r}from"../shaders/OverlayShader.js";import{PrimitiveType as
|
|
5
|
+
import{destroyMaybe as e}from"../../../../../../../core/maybe.js";import{Mesh as t}from"../../../meshing/Mesh.js";import{simplePipelineState as s}from"../../utils.js";import{Technique as i}from"../Technique.js";import{OverlayShader as r}from"../shaders/OverlayShader.js";import{PrimitiveType as o,DataType as n}from"../../../../../../webgl/enums.js";import{VertexElementDescriptor as a}from"../../../../../../webgl/VertexElementDescriptor.js";class h extends i{constructor(){super(...arguments),this.type=19,this._mesh=null,this.shaders={overlay:new r}}render(e,t){const{context:i,painter:r}=e,o=this._getMesh(e,t);r.setPipelineState(s);const{isWrapAround:n,wrapAroundShift:a}=t.config,h={...t.config,wrapAroundShift:0},p={shader:this.shaders.overlay,uniforms:{transform:t.transform,config:h},defines:null,optionalAttributes:null,useComputeBuffer:!1};r.setPipelineState({...s,stencil:{write:!1,test:{compare:514,op:{fail:7680,zFail:7680,zPass:7681},ref:0,mask:255}}}),r.submitDrawMeshUntyped(i,p,o),n&&(h.wrapAroundShift=a,r.submitDrawMeshUntyped(i,p,o))}shutdown(){e(this._mesh)}_getMesh(e,s){const{context:i}=e;if(this._mesh){const e=this._mesh.vertexBuffers.get("positions");if(!e)throw new Error("Buffer not found");e.setData(s.position)}else{const e=null!=s.index?s.index.length:s.position.length/2;this._mesh=new t(i,{vertex:{positions:{data:s.position,layout:[new a("pos",2,n.FLOAT,0,8)]},uvs:{data:s.tex,layout:[new a("uv",2,n.UNSIGNED_SHORT,0,4)]}},index:null!=s.index?{index:{data:s.index}}:void 0,groups:[{index:null!=s.index?"index":void 0,primitive:o.TRIANGLE_STRIP}],parts:[{group:0,start:0,count:e}]})}return this._mesh}}export{h as OverlayTechnique};
|
package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e}from"../../../../../../../core/maybe.js";import{Mesh as t}from"../../../meshing/Mesh.js";import{simplePipelineState as r}from"../../utils.js";import{Technique as s}from"../Technique.js";import{VideoScreenShader as o}from"../shaders/VideoScreenShader.js";import{PrimitiveType as n,DataType as i}from"../../../../../../webgl/enums.js";import{VertexElementDescriptor as m}from"../../../../../../webgl/VertexElementDescriptor.js";class c extends s{constructor(){super(...arguments),this.type=26,this._mesh=null,this.shaders={geometry:new o}}render(e,t){const{context:s,painter:o}=e,{texture:n,textureCoords:i}=t,m=this._getMesh(e),c=t.ndcRect[2],a=t.ndcRect[3],h=t.ndcRect[0],u=t.ndcRect[1],d=new Float32Array(180);for(let r=0;r<6;r++){const e=a*r/5;for(let t=0;t<6;t++){const s=c*t/5,{u:o,v:n}=i[6*r+t];d[5*(6*r+t)]=h+s,d[5*(6*r+t)+1]=u-e,d[5*(6*r+t)+2]=o,d[5*(6*r+t)+3]=n,d[5*(6*r+t)+4]=1}}m.vertexBuffers.get("geometry")?.
|
|
5
|
+
import{destroyMaybe as e}from"../../../../../../../core/maybe.js";import{Mesh as t}from"../../../meshing/Mesh.js";import{simplePipelineState as r}from"../../utils.js";import{Technique as s}from"../Technique.js";import{VideoScreenShader as o}from"../shaders/VideoScreenShader.js";import{PrimitiveType as n,DataType as i}from"../../../../../../webgl/enums.js";import{VertexElementDescriptor as m}from"../../../../../../webgl/VertexElementDescriptor.js";class c extends s{constructor(){super(...arguments),this.type=26,this._mesh=null,this.shaders={geometry:new o}}render(e,t){const{context:s,painter:o}=e,{texture:n,textureCoords:i}=t,m=this._getMesh(e),c=t.ndcRect[2],a=t.ndcRect[3],h=t.ndcRect[0],u=t.ndcRect[1],d=new Float32Array(180);for(let r=0;r<6;r++){const e=a*r/5;for(let t=0;t<6;t++){const s=c*t/5,{u:o,v:n}=i[6*r+t];d[5*(6*r+t)]=h+s,d[5*(6*r+t)+1]=u-e,d[5*(6*r+t)+2]=o,d[5*(6*r+t)+3]=n,d[5*(6*r+t)+4]=1}}m.vertexBuffers.get("geometry")?.setData(d);const p={texture:{texture:n,unit:0},opacity:t.opacity},l={shader:this.shaders.geometry,uniforms:{config:p},defines:{},optionalAttributes:null,useComputeBuffer:!1};o.setPipelineState(r),o.submitDrawMeshUntyped(s,l,m)}shutdown(){e(this._mesh)}_getMesh(e){const{context:r}=e,s=new Uint32Array(150);for(let t=0;t<5;t++)for(let e=0;e<5;e++){const r=6*(5*t+e),o=6*(t+1)+e+1,n=o-1,i=o-6,m=o-7;s[r]=o,s[r+1]=n,s[r+2]=i,s[r+3]=n,s[r+4]=m,s[r+5]=i}return this._mesh||(this._mesh=new t(r,{vertex:{geometry:{data:new Float32Array(180),layout:[new m("position",2,i.FLOAT,0,20),new m("texcoord",2,i.FLOAT,8,20),new m("w",1,i.FLOAT,16,20)]}},index:{index:{data:s}},groups:[{primitive:n.TRIANGLES,index:"index"}],parts:[{group:0,start:0,count:s.length}]})),this._mesh}}export{c as VideoScreenTechnique};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../../Color.js";import i from"../../../../Graphic.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{project as a,initializeProjection as h}from"../../../../geometry/projectionUtils.js";import{isValid as c}from"../../../../geometry/support/spatialReferenceUtils.js";import l from"../../../../layers/GraphicsLayer.js";import p from"../../../../symbols/CIMSymbol.js";import{applyCIMSymbolColor as d}from"../../../../symbols/support/cimSymbolUtils.js";import{DragManipulation as m}from"./manipulations/DragManipulation.js";import{primaryKey as y}from"../../../input/keys.js";import{InteractiveToolBase as _}from"../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as g}from"../../../interactive/editGeometry/EditGeometryOperations.js";const f={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",toggleOpacity:"t",shift:"Shift",primaryKey:y},u=1,P=10,v=new e("#009af2");let S=class extends _{constructor(t){super(t),this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new l({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)",title:"ControlPointsTransformationTool layer"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0,this.type="reshape"}initialize(){this._initialize()}destroy(){const{map:t}=this.view;this._controlPointManipulations.forEach(t=>t.destroy()),this._controlPointEditGeometryOperations.forEach(t=>t.destroy()),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=o(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return c(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const t=this._undoStack[this._undoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canUndo}canRedo(){const t=this._redoStack[this._redoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canRedo}undo(){if(this._undoStack.length>0){const t=this._undoStack.pop();this._controlPointEditGeometryOperations[t].undo(),this.updateGraphics(),this._redoStack.push(t)}}redo(){if(this._redoStack.length>0){const t=this._redoStack.pop();this._controlPointEditGeometryOperations[t].redo(),this.updateGraphics(),this._undoStack.push(t)}}refresh(){const{mediaElement:t}=this;if(null==t.georeference)return;const e=t.georeference;"control-points"===e.type&&null!=e.coords&&(this._georeference=e,this._georeference.controlPoints.forEach(({mapPoint:t},e)=>{const i=this._controlPointEditGeometryOperations[e],o=i.data.components[0].vertices[0];i.setVertexPosition(o,i.data.coordinateHelper.pointToVector(t))}),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._georeference,e=t.controlPoints,i=e[0].mapPoint.spatialReference,o=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((r,s)=>{const n=r.data.geometry;return this._controlPointGraphics[s].geometry=n,{mapPoint:a(n,i),sourcePoint:o?e[s].sourcePoint:t.toSource(n)}})}updateActiveHandle(t){if(this.activeHandle===t)return;const e=this._controlPointGraphics[this.activeHandle].symbol.clone();d(e,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=e;const i=this._controlPointGraphics[t].symbol.clone();d(i,v),this._controlPointGraphics[t].symbol=i,this.activeHandle=t,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const t=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=t.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}async _initialize(){const{view:t,mediaElement:e}=this;if(null==e.georeference)return;const o=e.georeference;"control-points"===o.type&&null!=o.coords&&(this._georeference=o,this._initialControlPoints=this._georeference.controlPoints,t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:e})=>g.fromGeometry(a(e,t.spatialReference),2)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((t,e)=>new i({symbol:new p({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e===this.activeHandle?v.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:t.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(e=>new m({tool:this,view:t,graphic:e})),this.addHandles([...this._controlPointManipulations.map((t,e)=>t.createDragPipeline(this._getInfo.bind(this,e),(t,i)=>{"start"===t.action&&(this._undoStack.push(e),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0),this.updateGraphics()})),r(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((t,e)=>{const i=t=>{this.addHandles([t.events.on(["click","grab-changed"],t=>this.updateActiveHandle(e))])};t.forEachManipulator(i)}),this.addHandles([t.on("key-down",i=>{t.activeTool===this&&(i.key!==f.shift||i.repeat||(this._isModifierActive=!0,i.stopPropagation()),i.key!==f.toggleOpacity||i.repeat||(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled,i.stopPropagation()),i.key!==f.primaryKey||i.repeat||(this._factor=P,i.stopPropagation()),this._isModifierActive&&(i.key===f.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===f.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===f.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===f.right&&(this._move(this._factor,0),i.stopPropagation())))}),t.on("key-up",e=>{t.activeTool===this&&(e.key===f.shift&&(this._isModifierActive=!1,e.stopPropagation()),e.key===f.primaryKey&&(this._factor=u,e.stopPropagation()))})]))}async _loadProjectionEngine(){const t=this._georeference.controlPoints[0].mapPoint;return h(t.spatialReference,this.view.spatialReference)}_getInfo(t){return{editGeometryOperations:this._controlPointEditGeometryOperations[t],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(t,e){const i=this._controlPointEditGeometryOperations[this.activeHandle].move(t*this.view.resolution,e*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([s()],S.prototype,"_hasValidSpatialReference",null),t([s()],S.prototype,"activeHandle",void 0),t([s({constructOnly:!0,nonNullable:!0})],S.prototype,"mediaElement",void 0),t([s({readOnly:!0})],S.prototype,"type",void 0),t([s({constructOnly:!0})],S.prototype,"view",void 0),S=t([n("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],S);export{S as ControlPointsTransformTool,f as keys};
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../Color.js";import i from"../../../../Graphic.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{watch as r}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{project as n,initializeProjection as h}from"../../../../geometry/projectionUtils.js";import{isValid as c}from"../../../../geometry/support/spatialReferenceUtils.js";import l from"../../../../layers/GraphicsLayer.js";import p from"../../../../symbols/CIMSymbol.js";import{applyCIMSymbolColor as d}from"../../../../symbols/support/cimSymbolUtils.js";import{DragManipulation as m}from"./manipulations/DragManipulation.js";import{primaryKey as y}from"../../../input/keys.js";import{InteractiveToolBase as _}from"../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as g}from"../../../interactive/editGeometry/EditGeometryOperations.js";const f={up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",toggleOpacity:"t",shift:"Shift",primaryKey:y},u=1,P=10,v=new e("#009af2");let S=class extends _{constructor(t){super(t),this._isOpacityToggled=!1,this._isModifierActive=!1,this._factor=1,this._initialControlPoints=null,this._graphicsLayer=new l({internal:!0,listMode:"hide",visible:!1,effect:"drop-shadow(0px, 0px, 3px)",title:"ControlPointsTransformationTool layer"}),this._undoStack=[],this._redoStack=[],this._sharedUndoStack=[],this._sharedRedoStack=[],this._highlightHandle=null,this.activeHandle=0,this.type="reshape"}initialize(){this._initialize()}destroy(){const{map:t}=this.view;this._controlPointManipulations.forEach(t=>t.destroy()),this._controlPointEditGeometryOperations.forEach(t=>t.destroy()),t.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=o(this._graphicsLayer),this._georeference=null,this._controlPointGraphics=null,this._controlPointManipulations=null,this._graphicsLayer=null,this._controlPointEditGeometryOperations=null,this._undoStack=null,this._redoStack=null,this._initialControlPoints=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _hasValidSpatialReference(){return c(this.view.spatialReference)}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){const t=this._undoStack[this._undoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canUndo}canRedo(){const t=this._redoStack[this._redoStack.length-1];return null!=t&&this._controlPointEditGeometryOperations[t].canRedo}undo(){if(this._undoStack.length>0){const t=this._undoStack.pop();this._controlPointEditGeometryOperations[t].undo(),this.updateGraphics(),this._redoStack.push(t)}}redo(){if(this._redoStack.length>0){const t=this._redoStack.pop();this._controlPointEditGeometryOperations[t].redo(),this.updateGraphics(),this._undoStack.push(t)}}refresh(){const{mediaElement:t}=this;if(null==t.georeference)return;const e=t.georeference;"control-points"===e.type&&null!=e.coords&&(this._georeference=e,this._georeference.controlPoints.forEach(({mapPoint:t},e)=>{const i=this._controlPointEditGeometryOperations[e],o=i.data.parts[0].vertices[0];i.setVertexPosition(o,i.data.coordinateHelper.pointToVector(t))}),this.updateGraphics())}reset(){this._georeference.controlPoints=this._initialControlPoints,this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const t=this._georeference,e=t.controlPoints,i=e[0].mapPoint.spatialReference,o=this._hasValidSpatialReference;this._georeference.controlPoints=this._controlPointEditGeometryOperations.map((r,s)=>{const a=r.data.geometry;return this._controlPointGraphics[s].geometry=a,{mapPoint:n(a,i),sourcePoint:o?e[s].sourcePoint:t.toSource(a)}})}updateActiveHandle(t){if(this.activeHandle===t)return;const e=this._controlPointGraphics[this.activeHandle].symbol.clone();d(e,this.view.effectiveTheme.accentColor),this._controlPointGraphics[this.activeHandle].symbol=e;const i=this._controlPointGraphics[t].symbol.clone();d(i,v),this._controlPointGraphics[t].symbol=i,this.activeHandle=t,this.view.surface===document.activeElement&&this.highlightActiveHandle()}async highlightActiveHandle(){this.removeHighlightActiveHandle();const t=await this.view.whenLayerView(this._graphicsLayer);this._highlightHandle=t.highlight(this._controlPointGraphics[this.activeHandle])}removeHighlightActiveHandle(){this._highlightHandle&&this._highlightHandle.remove()}setSharedUndoStack(t){this._sharedUndoStack=t}setSharedRedoStack(t){this._sharedRedoStack=t}async _initialize(){const{view:t,mediaElement:e}=this;if(null==e.georeference)return;const o=e.georeference;"control-points"===o.type&&null!=o.coords&&(this._georeference=o,this._initialControlPoints=this._georeference.controlPoints,t.map.addMany([this._graphicsLayer]),t.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._controlPointEditGeometryOperations=this._georeference.controlPoints.map(({mapPoint:e})=>g.fromGeometry(n(e,t.spatialReference),2)),this._controlPointGraphics=this._controlPointEditGeometryOperations.map((t,e)=>new i({symbol:new p({data:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,colorLocked:!0,anchorPoint:{x:0,y:-15.75},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:9,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:84.3,ymax:84.3},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[83.2,32.5],[84.3,40.7],[83.8,48.9],[81.7,56.9],[78.1,64.3],[73,70.9],[66.9,76.4],[59.7,80.5],[51.9,83.2],[43.7,84.3],[35.4,83.8],[27.4,81.7],[20,78],[13.4,73],[7.9,66.8],[3.8,59.7],[1.1,51.9],[0,43.7],[.5,35.4],[2.6,27.4],[6.3,20],[11.3,13.4],[17.5,7.9],[24.7,3.8],[32.5,1.1],[39.8,.1],[47.1,.3],[54.3,1.8],[61.1,4.5],[67.4,8.4],[72.9,13.3],[77.4,19.1],[80.9,25.5],[83.2,32.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:[255,255,255,255]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[84.3,0],[84.3,84.3],[0,84.3],[0,0]]]}},rotation:0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-11.25},anchorPointUnits:"Absolute",dominantSizeAxis3D:"Y",size:22.5,billboardMode3D:"FaceNearPlane",frame:{xmin:0,ymin:0,xmax:197.7,ymax:294.7},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[98.9,0],[119.4,23.2],[139.4,49.3],[156.8,75.2],[171.2,100.8],[182.4,125.3],[190.6,148.8],[195.7,171.4],[197.7,192.9],[197.7,195.8],[197.7,200.3],[197.6,202.5],[197.5,204.8],[197.3,207.1],[197,209.4],[196.7,211.7],[196.4,214.1],[196,216.4],[195.5,218.7],[195,221.1],[194.4,223.4],[193.7,225.8],[193,228.1],[192.2,230.5],[191.4,232.8],[190.5,235.1],[189.5,237.5],[188.5,239.7],[187.4,242],[186.2,244.3],[185,246.5],[183.7,248.7],[182.4,250.9],[181,253.1],[179.5,255.2],[178,257.3],[176.4,259.4],[174.7,261.4],[173.1,263.3],[171.3,265.3],[169.5,267.2],[167.7,269],[165.8,270.8],[163.9,272.5],[161.9,274.2],[159.9,275.8],[157.8,277.4],[155.7,278.9],[153.6,280.4],[151.4,281.7],[149.2,283.1],[147,284.4],[144.8,285.6],[142.5,286.7],[140.3,287.8],[138,288.8],[135.7,289.8],[133.4,290.7],[131,291.5],[128.7,292.3],[126.4,293],[124,293.6],[121.7,294.2],[119.4,294.7],[117,295.2],[114.7,295.6],[112.4,296],[110.1,296.3],[107.8,296.5],[105.5,296.7],[103.3,296.8],[101.1,296.9],[98.8,296.9],[83.1,295.7],[67.8,292],[53.3,285.9],[39.9,277.5],[28.1,267.2],[18,255.1],[10,241.5],[4.2,226.9],[.9,211.5],[0,195.8],[.1,192.9],[2.1,171.4],[7.2,148.8],[15.4,125.3],[26.6,100.8],[41,75.2],[58.4,49.3],[78.4,23.2],[98.9,0]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:e===this.activeHandle?v.toArray():this.view.effectiveTheme.accentColor.toArray()}]}}],scaleSymbolsProportionally:!0,respectFrame:!0,clippingPath:{type:"CIMClippingPath",clippingType:"Intersect",path:{rings:[[[0,0],[197.7,0],[197.7,294.7],[0,294.7],[0,0]]]}},rotation:0}],haloSize:1,scaleX:1,angleAlignment:"Display",angle:0}}}),geometry:t.data.geometry})),this._graphicsLayer.graphics.addMany([...this._controlPointGraphics]),this._controlPointManipulations=this._controlPointGraphics.map(e=>new m({tool:this,view:t,graphic:e})),this.addHandles([...this._controlPointManipulations.map((t,e)=>t.createDragPipeline(this._getInfo.bind(this,e),(t,i)=>{"start"===t.action&&(this._undoStack.push(e),this._redoStack=[],this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0),this.updateGraphics()})),r(()=>this.view.scale,()=>this.active?this.updateGraphics():null)]),this._controlPointManipulations.forEach((t,e)=>{const i=t=>{this.addHandles([t.events.on(["click","grab-changed"],t=>this.updateActiveHandle(e))])};t.forEachManipulator(i)}),this.addHandles([t.on("key-down",i=>{t.activeTool===this&&(i.key!==f.shift||i.repeat||(this._isModifierActive=!0,i.stopPropagation()),i.key!==f.toggleOpacity||i.repeat||(e.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled,i.stopPropagation()),i.key!==f.primaryKey||i.repeat||(this._factor=P,i.stopPropagation()),this._isModifierActive&&(i.key===f.up&&(this._move(0,this._factor),i.stopPropagation()),i.key===f.down&&(this._move(0,-this._factor),i.stopPropagation()),i.key===f.left&&(this._move(-this._factor,0),i.stopPropagation()),i.key===f.right&&(this._move(this._factor,0),i.stopPropagation())))}),t.on("key-up",e=>{t.activeTool===this&&(e.key===f.shift&&(this._isModifierActive=!1,e.stopPropagation()),e.key===f.primaryKey&&(this._factor=u,e.stopPropagation()))})]))}async _loadProjectionEngine(){const t=this._georeference.controlPoints[0].mapPoint;return h(t.spatialReference,this.view.spatialReference)}_getInfo(t){return{editGeometryOperations:this._controlPointEditGeometryOperations[t],constraints:this._hasValidSpatialReference?null:{xmin:0,ymin:0,xmax:this._georeference.width,ymax:this._georeference.height}}}_move(t,e){const i=this._controlPointEditGeometryOperations[this.activeHandle].move(t*this.view.resolution,e*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};t([s()],S.prototype,"_hasValidSpatialReference",null),t([s()],S.prototype,"activeHandle",void 0),t([s({constructOnly:!0,nonNullable:!0})],S.prototype,"mediaElement",void 0),t([s({readOnly:!0})],S.prototype,"type",void 0),t([s({constructOnly:!0})],S.prototype,"view",void 0),S=t([a("esri.views.2d.interactive.editingTools.ControlPointsTransformTool")],S);export{S as ControlPointsTransformTool,f as keys};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as i}from"../../../../core/colorUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{subtract as h,normalize as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,UNIT_X as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as d,l as _,n as m,f as u,m as y,d as g}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import v from"../../../../geometry/Point.js";import G from"../../../../geometry/Polygon.js";import{project as w,initializeProjection as R}from"../../../../geometry/projectionUtils.js";import{a as b,c as C}from"../../../../chunks/boundedPlane.js";import{equals as j}from"../../../../geometry/support/spatialReferenceUtils.js";import k from"../../../../layers/GraphicsLayer.js";import T from"../../../../symbols/SimpleFillSymbol.js";import S from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as A}from"./manipulations/DragManipulation.js";import{RotateManipulation as P}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as M}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as x,SnapRotation as O}from"./manipulations/utils.js";import{InteractiveToolBase as D}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as U,mediaKeys as L}from"../../../interactive/keybindings.js";import{EditGeometry as B}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as E}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as H}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as I}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as z}from"../../../support/screenUtils.js";const V=80,q=10,F=30,N=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],J=1,K=10;let Q=class extends D{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=b(),this._displayPlaneCache=b(),this._mainAxisCache=l(),this._rotationHandleCache=f(),this._cornerA=f(),this._cornerB=f(),this._cornerC=f(),this._cornerD=f(),this._avgAB=f(),this._avgBC=f(),this._avgCD=f(),this._avgDA=f(),this._preserveAspectRatio=new x,this._snapRotation=new O,this._graphicsLayer=new k({internal:!0,listMode:"hide",visible:!1,title:"TransformTool layer"}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=J,this.preserveAspectRatio=null,this.snapRotation=null,this.type="transform"}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=s(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(null==e)return null;const t=this._editGeometryOperations.data,i=t.components[0].edges[0],s=h(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);c(s,s);let o=V*this.view.resolution;const a=this.view.spatialReference;return j(a,e.spatialReference)&&(o*=r(a)/r(e.spatialReference)),H(s,t,o,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;C(e,t);const i=q*this.view.resolution;return d(t.basis1,t.basis1,1+i/_(t.basis1)),d(t.basis2,t.basis2,1+i/_(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new G({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return m(t,e.basis1),d(t,t,F*this.view.resolution),u(t,t,e.origin),u(t,t,e.basis1),new v({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=y(this._avgAB,i,s,.5),n=y(this._avgBC,s,o,.5),h=y(this._avgCD,o,r,.5),c=y(this._avgDA,r,i,.5);return[new v({x:i[0],y:i[1],spatialReference:t}),new v({x:s[0],y:s[1],spatialReference:t}),new v({x:o[0],y:o[1],spatialReference:t}),new v({x:r[0],y:r[1],spatialReference:t}),new v({x:a[0],y:a[1],spatialReference:t}),new v({x:n[0],y:n[1],spatialReference:t}),new v({x:h[0],y:h[1],spatialReference:t}),new v({x:c[0],y:c[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,i="georeference"in t?t.georeference.coords:t.geometry,s=this._editGeometryOperations,o=s.data.components[0].vertices,r=B.fromGeometry(w(i,e.spatialReference),2).components[0].vertices;o.forEach((e,t)=>{s.setVertexPosition(e,r[t].pos)}),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;"control-points"===t.type&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;if("georeference"in this.target){this.target.georeference.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:s}=this;if("georeference"in s){const e=s.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints="control-points"===e.type?e.controlPoints:null}else this._graphic=s,this._initialGeometry=s.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=E.fromGeometry(w(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new T({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new S({color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(s=>new t({symbol:new S({size:6,style:"square",color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:s})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new A({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new P({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,i)=>new M({tool:this,view:e,graphic:t,direction:N[i],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),o(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on("click",async t=>{if(null!=e.activeTool&&e.activeTool!==this)return;const i=z(t),o=[];e.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const r=await this.view.hitTest(i,{exclude:o}),a=r.results;if(0===a.length)e.activeTool=null;else{const t=I(r.results),i="georeference"in s,o=a.map(e=>"media"===e.type?e.element:null).filter(Boolean),n=new Set([...this._graphicsLayer.graphics,i?null:s].filter(Boolean));i&&o.includes(s)||null!=t&&n.has(t.graphic)?null==e.activeTool&&(e.activeTool=this):e.activeTool=null}})]);const r=e=>{this.addHandles(e.events.on("grab-changed",e=>{"georeference"in s&&("start"===e.action?s.opacity*=.5:"end"===e.action&&(s.opacity*=2))}))};this._dragManipulation.forEachManipulator(r),this._rotateManipulation.forEachManipulator(r),this._scaleManipulations.forEach(e=>e.forEachManipulator(r));const a=new U;a.addToggle(L.preserveAspectRatio,()=>{null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),a.addToggle(L.rotateIncrements,()=>{null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled)}),a.add(L.toggleOpacity,()=>{"georeference"in s&&(s.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),a.addToggle(L.factorModifier,e=>this._factor="key-down"===e.type?K:J),a.add(L.scaleUp,()=>this._scale(this._factor)),a.add(L.scaleDown,()=>this._scale(-this._factor)),a.add(L.moveUp,()=>this._move(0,this._factor)),a.add(L.moveDown,()=>this._move(0,-this._factor)),a.add(L.moveLeft,()=>this._move(-this._factor,0)),a.add(L.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on("key-down",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)}),e.on("key-up",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){const e=this._graphic.geometry;return R(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:i,origin:s}=e,o=this._cornerA;u(o,s,t),u(o,o,i);const r=this._cornerB;u(r,s,t),g(r,r,i);const a=this._cornerC;g(a,s,t),g(a,a,i);const n=this._cornerD;g(n,s,t),u(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){"start"===e.action&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){const t=this._editGeometryOperations,i=t.data.geometry.extent?.width,s=(i+e*this.view.resolution)/i,o=t.scale(this._plane.origin,p,s,s,0,1);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const i=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([a()],Q.prototype,"_plane",null),e([a()],Q.prototype,"_backgroundGraphicGeometry",null),e([a()],Q.prototype,"_rotateGraphicGeometry",null),e([a()],Q.prototype,"_scaleGraphicGeometries",null),e([a()],Q.prototype,"preserveAspectRatio",void 0),e([a()],Q.prototype,"snapRotation",void 0),e([a({constructOnly:!0,nonNullable:!0})],Q.prototype,"target",void 0),e([a({readOnly:!0})],Q.prototype,"type",void 0),e([a({constructOnly:!0})],Q.prototype,"view",void 0),Q=e([n("esri.views.2d.interactive.editingTools.TransformTool")],Q);export{Q as TransformTool};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as i}from"../../../../core/colorUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as r}from"../../../../core/unitUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{subtract as h,normalize as c}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as l,UNIT_X as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{g as d,l as _,n as m,f as u,m as y,d as g}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import v from"../../../../geometry/Point.js";import G from"../../../../geometry/Polygon.js";import{project as w,initializeProjection as R}from"../../../../geometry/projectionUtils.js";import{a as b,c as C}from"../../../../chunks/boundedPlane.js";import{equals as j}from"../../../../geometry/support/spatialReferenceUtils.js";import k from"../../../../layers/GraphicsLayer.js";import T from"../../../../symbols/SimpleFillSymbol.js";import S from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as A}from"./manipulations/DragManipulation.js";import{RotateManipulation as P}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as M}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as x,SnapRotation as O}from"./manipulations/utils.js";import{InteractiveToolBase as D}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as U,mediaKeys as L}from"../../../interactive/keybindings.js";import{EditGeometry as B}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as E}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as H}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as I}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as z}from"../../../support/screenUtils.js";const V=80,q=10,F=30,N=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]],J=1,K=10;let Q=class extends D{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=b(),this._displayPlaneCache=b(),this._mainAxisCache=l(),this._rotationHandleCache=f(),this._cornerA=f(),this._cornerB=f(),this._cornerC=f(),this._cornerD=f(),this._avgAB=f(),this._avgBC=f(),this._avgCD=f(),this._avgDA=f(),this._preserveAspectRatio=new x,this._snapRotation=new O,this._graphicsLayer=new k({internal:!0,listMode:"hide",visible:!1,title:"TransformTool layer"}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=J,this.preserveAspectRatio=null,this.snapRotation=null,this.type="transform"}initialize(){this._initialize()}destroy(){const{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=s(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){const e=this._graphic.geometry;if(null==e)return null;const t=this._editGeometryOperations.data,i=t.parts[0].segments[0],s=h(this._mainAxisCache,i.leftVertex.pos,i.rightVertex.pos);c(s,s);let o=V*this.view.resolution;const a=this.view.spatialReference;return j(a,e.spatialReference)&&(o*=r(a)/r(e.spatialReference)),H(s,t,o,this._planeCache)}get _displayPlane(){const e=this._plane;if(!e)return null;const t=this._displayPlaneCache;C(e,t);const i=q*this.view.resolution;return d(t.basis1,t.basis1,1+i/_(t.basis1)),d(t.basis2,t.basis2,1+i/_(t.basis2)),t}get _backgroundGraphicGeometry(){const e=this._displayPlane;if(!e)return null;const t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new G({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){const e=this._plane;if(!e)return null;const t=this._rotationHandleCache;return m(t,e.basis1),d(t,t,F*this.view.resolution),u(t,t,e.origin),u(t,t,e.basis1),new v({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){const e=this._displayPlane;if(!e)return[];const t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);const{_cornerA:i,_cornerB:s,_cornerC:o,_cornerD:r}=this,a=y(this._avgAB,i,s,.5),n=y(this._avgBC,s,o,.5),h=y(this._avgCD,o,r,.5),c=y(this._avgDA,r,i,.5);return[new v({x:i[0],y:i[1],spatialReference:t}),new v({x:s[0],y:s[1],spatialReference:t}),new v({x:o[0],y:o[1],spatialReference:t}),new v({x:r[0],y:r[1],spatialReference:t}),new v({x:a[0],y:a[1],spatialReference:t}),new v({x:n[0],y:n[1],spatialReference:t}),new v({x:h[0],y:h[1],spatialReference:t}),new v({x:c[0],y:c[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){const{view:e,target:t}=this,i="georeference"in t?t.georeference.coords:t.geometry,s=this._editGeometryOperations,o=s.data.parts[0].vertices,r=B.fromGeometry(w(i,e.spatialReference),2).parts[0].vertices;o.forEach((e,t)=>{s.setVertexPosition(e,r[t].pos)}),this.updateGraphics()}reset(){const{target:e}=this;if("georeference"in e){const t=e.georeference;"control-points"===t.type&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){const e=this._editGeometryOperations.data.geometry;if("georeference"in this.target){this.target.georeference.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){const{view:e,target:s}=this;if("georeference"in s){const e=s.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints="control-points"===e.type?e.controlPoints:null}else this._graphic=s,this._initialGeometry=s.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=E.fromGeometry(w(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new T({color:"transparent",outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new S({color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(s=>new t({symbol:new S({size:6,style:"square",color:i(e.effectiveTheme.accentColor),outline:{type:"simple-line",color:e.effectiveTheme.accentColor,width:1}}),geometry:s})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new A({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new P({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,i)=>new M({tool:this,view:e,graphic:t,direction:N[i],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),o(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on("click",async t=>{if(null!=e.activeTool&&e.activeTool!==this)return;const i=z(t),o=[];e.map.allLayers.forEach(e=>{"vector-tile"!==e.type&&"imagery"!==e.type||o.push(e)});const r=await this.view.hitTest(i,{exclude:o}),a=r.results;if(0===a.length)e.activeTool=null;else{const t=I(r.results),i="georeference"in s,o=a.map(e=>"media"===e.type?e.element:null).filter(Boolean),n=new Set([...this._graphicsLayer.graphics,i?null:s].filter(Boolean));i&&o.includes(s)||null!=t&&n.has(t.graphic)?null==e.activeTool&&(e.activeTool=this):e.activeTool=null}})]);const r=e=>{this.addHandles(e.events.on("grab-changed",e=>{"georeference"in s&&("start"===e.action?s.opacity*=.5:"end"===e.action&&(s.opacity*=2))}))};this._dragManipulation.forEachManipulator(r),this._rotateManipulation.forEachManipulator(r),this._scaleManipulations.forEach(e=>e.forEachManipulator(r));const a=new U;a.addToggle(L.preserveAspectRatio,()=>{null==this.preserveAspectRatio&&(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),a.addToggle(L.rotateIncrements,()=>{null==this.snapRotation&&(this._snapRotation.enabled=!this._snapRotation.enabled)}),a.add(L.toggleOpacity,()=>{"georeference"in s&&(s.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),a.addToggle(L.factorModifier,e=>this._factor="key-down"===e.type?K:J),a.add(L.scaleUp,()=>this._scale(this._factor)),a.add(L.scaleDown,()=>this._scale(-this._factor)),a.add(L.moveUp,()=>this._move(0,this._factor)),a.add(L.moveDown,()=>this._move(0,-this._factor)),a.add(L.moveLeft,()=>this._move(-this._factor,0)),a.add(L.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on("key-down",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)}),e.on("key-up",t=>{e.activeTool===this&&a.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){const e=this._graphic.geometry;return R(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){const{basis1:t,basis2:i,origin:s}=e,o=this._cornerA;u(o,s,t),u(o,o,i);const r=this._cornerB;u(r,s,t),g(r,r,i);const a=this._cornerC;g(a,s,t),g(a,a,i);const n=this._cornerD;g(n,s,t),u(n,n,i)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){"start"===e.action&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){const t=this._editGeometryOperations,i=t.data.geometry.extent?.width,s=(i+e*this.view.resolution)/i,o=t.scale(this._plane.origin,p,s,s,0,1);this._sharedUndoStack.push({tool:this,operation:o}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){const i=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([a()],Q.prototype,"_plane",null),e([a()],Q.prototype,"_backgroundGraphicGeometry",null),e([a()],Q.prototype,"_rotateGraphicGeometry",null),e([a()],Q.prototype,"_scaleGraphicGeometries",null),e([a()],Q.prototype,"preserveAspectRatio",void 0),e([a()],Q.prototype,"snapRotation",void 0),e([a({constructOnly:!0,nonNullable:!0})],Q.prototype,"target",void 0),e([a({readOnly:!0})],Q.prototype,"type",void 0),e([a({constructOnly:!0})],Q.prototype,"view",void 0),Q=e([n("esri.views.2d.interactive.editingTools.TransformTool")],Q);export{Q as TransformTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../core/Logger.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{BitmapContainer as a}from"../engine/BitmapContainer.js";import{LayerView2DMixin as o}from"./LayerView2D.js";import p from"./support/ExportStrategy.js";import n from"../../layers/LayerView.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";let h=class extends(m(o(n))){update(t){this._strategy.update(t).catch(t=>{r(t)||e.getLogger(this).error(t)}),this.notifyChange("updating")}attach(){this._bitmapContainer=new a,this.container.addChild(this._bitmapContainer),this._strategy=new p({container:this._bitmapContainer,fetchSource:this.fetchBitmapData.bind(this),requestUpdate:this.requestUpdate.bind(this)})}detach(){this._strategy.destroy(),this._strategy=null,this.container.removeChild(this._bitmapContainer),this._bitmapContainer.removeAllChildren()}viewChange(){}moveEnd(){this.requestUpdate()}fetchBitmapData(t,e,r){return this.layer.fetchImageBitmap(t,e,r)}async doRefresh(){this.requestUpdate()}isUpdating(){return this._strategy.updating||this.updateRequested}};t([i()],h.prototype,"_strategy",void 0),
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Logger.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import{BitmapContainer as a}from"../engine/BitmapContainer.js";import{LayerView2DMixin as o}from"./LayerView2D.js";import p from"./support/ExportStrategy.js";import n from"../../layers/LayerView.js";import{RefreshableLayerView as m}from"../../layers/RefreshableLayerView.js";let h=class extends(m(o(n))){update(t){this._strategy.update(t).catch(t=>{r(t)||e.getLogger(this).error(t)}),this.notifyChange("updating")}attach(){this._bitmapContainer=new a,this.container.addChild(this._bitmapContainer),this._strategy=new p({container:this._bitmapContainer,fetchSource:this.fetchBitmapData.bind(this),requestUpdate:this.requestUpdate.bind(this)})}detach(){this._strategy.destroy(),this._strategy=null,this.container.removeChild(this._bitmapContainer),this._bitmapContainer.removeAllChildren()}viewChange(){}moveEnd(){this.requestUpdate()}fetchBitmapData(t,e,r){return this.layer.fetchImageBitmap(t,e,r)}async doRefresh(){this.requestUpdate()}isUpdating(){return this._strategy.updating||this.updateRequested}};t([i()],h.prototype,"_strategy",void 0),h=t([s("esri.views.2d.layers.BaseDynamicLayerView2D")],h);const c=h;export{c as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import A from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as j}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as x}from"../../../layers/support/featureLayerUtils.js";import{packFields as I}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as E}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as k}from"../../../layers/support/timeSupport.js";import C from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import q from"../../../rest/support/AttributeBinsQuery.js";import R from"../../../rest/support/FeatureSet.js";import Q from"../../../rest/support/Query.js";import{LayerView2DMixin as O}from"./LayerView2D.js";import{FeatureContainer as L}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as T}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as P}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as M}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as D}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as H}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as N}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as J}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as G}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as $}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as B}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as Z}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as K}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as X}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as Y}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ee}from"./support/util.js";import{FeatureTileSubscriptionManager as te}from"../tiling/FeatureTileSubscriptionManager.js";import{FeatureLayerView as re}from"../../layers/FeatureLayerView.js";import se from"../../layers/LayerView.js";import{RefreshableLayerView as ie}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ae}from"../../support/highlightOptionsUtils.js";function oe(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const ne=4294967294;function ue(e,t){return l(e.map(e=>w(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t)))}let le=class extends(re(ie(O(se)))){constructor(){super(...arguments),this._commandsQueue=new X({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new A,this._lastUpdate=0}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===E(e)?.operations.supportsQuery)throw new n("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await T(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),g(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map(({vvEvaluators:e,deconflictionEnabled:s,labelingInfo:i})=>({labelingInfo:i,container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r}))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new H(this.layer):new M(this.layer);case"geojson":case"csv":case"wfs":return new H(this.layer);case"parquet":return new $(this.layer);case"subtype-group":return new z(this.layer);case"ogc-feature":return new J(this.layer);case"stream":return new B(this.layer);case"oriented-imagery":return new G(this.layer);case"knowledge-graph-sublayer":return new N(this.layer);case"catalog-footprint":return new P(this.layer);default:o(this.layer)}return null}get timeExtent(){return k(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return u();const n=ae(t);return this._addHighlights(o,n),u(()=>!this.destroyed&&this._removeHighlights(o,n))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map(r=>this._createGraphicHit(e,t.fromJSON(r))),...l.map(t=>this._createGraphicHit(e,s.fromJSON(t))),...n.map(t=>this._createGraphicHit(e,r.fromJSON(t)))]}async queryStatistics(){const e=await this.getWorker();return Y(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return Y(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return Y(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return Y(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return Y(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return Y(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return Y(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=R.fromJSON(e);return t.features.forEach(e=>this._setLayersForFeature(e)),t})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await Y(r,{features:[]}),i=R.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await Y(r,{features:[]}),i=C.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return Y(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return Y(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return Y(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return Y(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return Y(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return Y(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await Y(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await Y(r,{features:[]});return V.fromJSON(s)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){const t=performance.now();if(t-this._lastUpdate<200)return;if(this._lastUpdate=t,!this.subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const r=this.subscriptionManager.update(e.targetState,this._lastTargetState),s=new Set(this.subscriptionManager.coverage?.target.keys());for(const i of this.featureContainer.tiles||[])i.isCoverage=s.has(i.id);this.featureContainer.setVisibleTiles(r)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new L(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this.subscriptionManager=new te({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then(t=>t.pipeline.updateSubscriptions(e))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([ue([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),w(()=>this.updateSuspended,e=>{e||(this.subscriptionManager.resume(),this.view.labelManager.requestUpdate())}),w(()=>this.visible,e=>{this.view.labelManager.requestUpdate()})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this.subscriptionManager=c(this.subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=ee(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await Z({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=Q.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=q.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=Q.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ne+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ne+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=ee(this.layer.geometryType),i=D(this.layer),a=[];for(const o of e.added){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),x(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this.subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads();const t=this._lastSchema?.processor.mesh.factory.symbology?.type;let r=!0;"subtype-group"!==this.layer.type&&"dictionary"===this.layer.renderer?.type&&"dictionary"===t&&(r=!1),e.updateStart(r);const s=this.featureEffect,i={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},a=await this._createViewSchemaConfig(),o={source:this.layerAdapter.createSourceSchema(a,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(i,a,this._displayRefreshVersion)},n=o.processor.mesh.factory.labels;n&&this.view.labelManager.setLabelSchemaStyles(n,this.featureContainer);const u=p(this._lastSchema?.source.mutable,o.source.mutable)||p(this._lastSchema?.processor,o.processor);if(!u)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(r),void(this.featureEffectView.featureEffect=s);this._lastSchema=o,this._fields=null;const l=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${l}] FeatureLayerView2D._doUpdate`,{changes:u});const h=await this.getWorker();await h.pipeline.updateSchema(o,l),e.updateEnd(r),this.featureEffectView.featureEffect=s,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender();const c=o.processor.mesh.strategy,d="cluster"===c.type||"binning"===c.type,y="heatmap"===o.processor.mesh.factory.symbology.type,f=d||y?"target-defer":"eager";this.subscriptionManager.setVisibilityStrategy(f),has("esri-2d-update-debug")&&console.debug(`Version[${l}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{for(const r of e.messages)switch(r.type){case"edit":{const e=new K;e.add(await this._resolveEdit(r.event)),await t.pipeline.onOverride(e.toMessage());break}case"override":{const e=new K;e.add(this._resolveOverrides(r.options)),await t.pipeline.onOverride(e.toMessage());break}}}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=oe(this._lastAvailableFields,e);return this._lastAvailableFields=t,I(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[he(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{m(e)||h.getLogger(this).error(e)});this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function he(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=v(i.where,a));let u=i?.toJSON()??null;return s.size&&(u??=(new U).toJSON(),u.hiddenIds=Array.from(s)),u}e([_()],le.prototype,"_commandsQueue",void 0),e([_()],le.prototype,"_sourceRefreshVersion",void 0),e([_()],le.prototype,"_displayRefreshVersion",void 0),e([_({readOnly:!0})],le.prototype,"_pipelineUpdating",void 0),e([_()],le.prototype,"_sourceUpdating",void 0),e([_({readOnly:!0})],le.prototype,"dataUpdating",null),e([_({readOnly:!0})],le.prototype,"hasAllFeatures",null),e([_({readOnly:!0})],le.prototype,"hasAllFeaturesInView",null),e([_({readOnly:!0})],le.prototype,"hasFullGeometries",null),e([_()],le.prototype,"featureEffectView",void 0),e([_()],le.prototype,"labelingCollisionInfos",null),e([_()],le.prototype,"layerAdapter",null),e([_({readOnly:!0})],le.prototype,"timeExtent",null),e([_()],le.prototype,"updating",void 0),le=e([b("esri.views.2d.layers.FeatureLayerView2D")],le);export{le as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../AggregateGraphic.js";import r from"../../../Graphic.js";import s from"../../../TrackGraphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import a from"../../../core/Collection.js";import{neverReached as o}from"../../../core/compilerUtils.js";import n from"../../../core/Error.js";import{makeHandle as u,handlesGroup as l}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import h from"../../../core/Logger.js";import{destroyMaybe as c}from"../../../core/maybe.js";import{notDeepEqual as p}from"../../../core/object.js";import{createAbortError as d,createResolver as y,ignoreAbortErrors as f,throwIfNotAbortError as g,isAbortError as m}from"../../../core/promiseUtils.js";import{watch as w}from"../../../core/reactiveUtils.js";import{sqlAnd as v}from"../../../core/sql.js";import{property as _}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import F from"../../../geometry/Extent.js";import A from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as j}from"../../../layers/graphics/featureConversionUtils.js";import U from"../../../layers/support/FeatureFilter.js";import{checkServiceCurrentUserSupport as x}from"../../../layers/support/featureLayerUtils.js";import{packFields as I}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as E}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as k}from"../../../layers/support/timeSupport.js";import C from"../../../rest/support/AggregateFeatureSet.js";import V from"../../../rest/support/AttributeBinsFeatureSet.js";import q from"../../../rest/support/AttributeBinsQuery.js";import R from"../../../rest/support/FeatureSet.js";import Q from"../../../rest/support/Query.js";import{LayerView2DMixin as O}from"./LayerView2D.js";import{FeatureContainer as L}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as T}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as W}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as P}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as M}from"./features/layerAdapters/FeatureLayerAdapter.js";import{createFeatureIdInfo as D}from"./features/layerAdapters/featureServiceUtils.js";import{InMemoryLayerAdapter as H}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as N}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as J}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as G}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as $}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as B}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as z}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as Z}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import{DebouncedFeatureOverride as K}from"./support/DebouncedFeatureOverride.js";import{FeatureCommandQueue as X}from"./support/FeatureCommandQueue.js";import{handleNoEngineError as Y}from"./support/handleNoEngineError.js";import{toJSONGeometryType as ee}from"./support/util.js";import{FeatureTileSubscriptionManager as te}from"../tiling/FeatureTileSubscriptionManager.js";import{FeatureLayerView as re}from"../../layers/FeatureLayerView.js";import se from"../../layers/LayerView.js";import{RefreshableLayerView as ie}from"../../layers/RefreshableLayerView.js";import{getHighlightName as ae}from"../../support/highlightOptionsUtils.js";function oe(e,t){const r=new Set;return e&&e.forEach(e=>r.add(e)),t&&t.forEach(e=>r.add(e)),r.has("*")?["*"]:Array.from(r)}const ne=4294967294;function ue(e,t){return l(e.map(e=>w(()=>{const t=e();return t&&"object"==typeof t?"getTime"in t&&"function"==typeof t.getTime?t.getTime():JSON.stringify(t):t},t)))}let le=class extends(re(ie(O(se)))){constructor(){super(...arguments),this._commandsQueue=new X({process:e=>{switch(e.type){case"override-batch":return this._doOverride(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new W,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new S,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new A,this._lastUpdate=0}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(d()),this._commandsQueue.destroy()}initialize(){this._workerAttached=y(),f(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new n("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===E(e)?.operations.supportsQuery)throw new n("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await T(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(d()),g(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryAllFeatures}get hasAllFeaturesInView(){const e=this.effectiveDisplayFilter?.where||null,t=!this.eventLog.willQueryAllFeatures&&null!=e&&"1=1"!==e;return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&!t}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllData&&this.eventLog.willQueryFullResolutionGeometry}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map(({vvEvaluators:e,deconflictionEnabled:s,labelingInfo:i})=>({labelingInfo:i,container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:s,geometryType:t,visible:r}))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new H(this.layer):new M(this.layer);case"geojson":case"csv":case"wfs":return new H(this.layer);case"parquet":return new $(this.layer);case"subtype-group":return new z(this.layer);case"ogc-feature":return new J(this.layer);case"stream":return new B(this.layer);case"oriented-imagery":return new G(this.layer);case"knowledge-graph-sublayer":return new N(this.layer);case"catalog-footprint":return new P(this.layer);default:o(this.layer)}return null}get timeExtent(){return k(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t){let s;e instanceof r?s=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?s=[e]:a.isCollection(e)&&e.length>0?s=e.map(e=>e?.getObjectId()).toArray():Array.isArray(e)&&e.length>0&&(s="number"==typeof e[0]||"string"==typeof e[0]?e:e.map(e=>e?.getObjectId()));const o=s?.filter(i);if(!o?.length)return u();const n=ae(t);return this._addHighlights(o,n),u(()=>!this.destroyed&&this._removeHighlights(o,n))}async hitTest(e,i){const a=await this.featureContainer.hitTest(i);if(0===a.length)return null;const o=await this.getWorker(),{features:n,aggregates:u,tracks:l}=await o.pipeline.getDisplayFeatures(a),h=this.featureContainer.getSortKeys(a),c=({displayId:e},{displayId:t})=>h.has(e)&&h.has(t)?h.get(e)-h.get(t):e-t;return n.sort(c).reverse(),u.sort(c).reverse(),[...u.map(r=>this._createGraphicHit(e,t.fromJSON(r))),...l.map(t=>this._createGraphicHit(e,s.fromJSON(t))),...n.map(t=>this._createGraphicHit(e,r.fromJSON(t)))]}async queryStatistics(){const e=await this.getWorker();return Y(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),i,r);return Y(a,{})}async queryAggregateSummaryStatistics(e,t,r){const s={...t,scale:this.view.scale},i=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),s,r);return Y(i,{})}async queryUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForUniqueValues(this._cleanUpQuery(e),i,r);return Y(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),i,r);return Y(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForClassBreaks(this._cleanUpQuery(e),i,r);return Y(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),i,r);return Y(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.features.executeQueryForHistogram(this._cleanUpQuery(e),i,r);return Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const s=await this.getWorker(),i={...t,scale:this.view.scale},a=s.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),i,r);return Y(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then(e=>{const t=R.fromJSON(e);return t.features.forEach(e=>this._setLayersForFeature(e)),t})}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),s=await Y(r,{features:[]}),i=R.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),s=await Y(r,{features:[]}),i=C.fromJSON(s);return i.features.forEach(e=>this._setLayersForFeature(e)),i}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return Y(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return Y(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return Y(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return Y(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return Y(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return Y(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),s=await Y(r,{count:0,extent:null});return{count:s.count,extent:F.fromJSON(s.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),s=await Y(r,{features:[]});return V.fromJSON(s)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){const t=performance.now();if(t-this._lastUpdate<200)return;if(this._lastUpdate=t,!this.subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const r=this.subscriptionManager.update(e.targetState,this._lastTargetState),s=new Set(this.subscriptionManager.coverage?.target.keys());for(const i of this.featureContainer.tiles||[])i.isCoverage=s.has(i.id);this.featureContainer.setVisibleTiles(r)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),f(this._updatingHandles.addPromise(this._workerAttached.promise)),f(this._attachProxy()),this.featureContainer=new L(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this.subscriptionManager=new te({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),f(this._updatingHandles.addPromise(this.getWorker().then(t=>t.pipeline.updateSubscriptions(e))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([ue([()=>this._displayRefreshVersion,()=>this.layer.displayFilterInfo,()=>this.timeExtent,()=>this.clips,()=>this.filter,()=>this.effectiveDisplayFilterClause,()=>this.featureEffect,()=>this._sourceRefreshVersion,()=>this.view.timeZone,()=>this.view.timeExtent,...this.layerAdapter.getUpdateHashProperties(this.view)],()=>this._update()),w(()=>this.updateSuspended,e=>{e||(this.subscriptionManager.resume(),this.view.labelManager.requestUpdate())}),w(()=>this.visible,e=>{this.view.labelManager.requestUpdate()})]),this._update(),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",e=>this._editUpdatingHandles.addPromise(this._edit(e))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this.subscriptionManager=c(this.subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=y(),f(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}addOverrides(e){return this._commandsQueue.push({type:"override",options:{...e,release:[]}})}removeOverrides(e){for(const r of e)if(null==r)throw new n("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:r});const t={added:[],updated:[],removed:[],release:e,isWeak:!1,historicMoment:null};return this._commandsQueue.push({type:"override",options:t})}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredPromise,s=this.featureContainer.updatingHandles.updating,i=this.updateRequested||e&&(t||r)||s||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${i}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${s}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return i}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const s of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(s));return r}return Promise.all(t.map(t=>e.view.stage.painter.textureManager.rasterizeItem(t)))},fetchDictionary:e=>Promise.all(e.map(e=>this._fetchDictionaryRequest(e)))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const s={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map(e=>e.toJSON()));const i=r.visualVariableUniforms,a=ee(this.layer.geometryType),o=await t.getSymbolForControlString(e.controlString,a,!1);if(!o||!o.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await Z({...o.data,hasTextStringTemplates:!0},{uniforms:i,path:"renderer",schemaOptions:s})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=Q.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=q.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=Q.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const s of t.aggregateIds??[])r.push(s);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}_edit(e){return this._commandsQueue.push({type:"edit",event:e})}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ne+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ne+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?h.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const s="globalIdField"in this.layer&&this.layer.globalIdField,i=s&&this.availableFields.includes(s);if(r.length&&!i)return h.getLogger(this).error(new n("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${s} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}_resolveOverrides(e){const t=!1,r=!1,s=ee(this.layer.geometryType),i=D(this.layer),a=[];for(const o of e.added){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.updated){const e=j(o,s,t,r,i);if(null==e.objectId)throw new n("featurelayerview:bad-override","Feature does not have an objectId",{feature:o});a.push(e)}for(const o of e.removed)if(null==o)throw new n("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:o});return{type:"override",updates:a,removed:e.removed,release:e.release,isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null}}async _resolveEdit(e){const t=this.layer,r=e.historicMoment?.getTime()??null,s="layerId"in t&&e.editedFeatures?.find(e=>e.layerId===t.layerId);if(s&&this._canEditByFeature(s)){const{adds:e,deletes:t,updates:i}=s.editedFeatures,a=this.layer.objectIdField,o=i.map(e=>e.current),n=t.map(e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e),u=await this._resolveIdenifiers(n);return this._resolveOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0,release:[]})}const[i,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]);return{type:"override-by-id",updates:[...i,...a],removed:o,historicMoment:r,isWeak:!0}}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every(e=>this.view.spatialReference.equals(e.geometry?.spatialReference))&&r.every(e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._handleChange(),x(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this.subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads();const t=this._lastSchema?.processor.mesh.factory.symbology?.type;let r=!0;"subtype-group"!==this.layer.type&&"dictionary"===this.layer.renderer?.type&&"dictionary"===t&&(r=!1),e.updateStart(r);const s=this.featureEffect,i={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},a=await this._createViewSchemaConfig(),o={source:this.layerAdapter.createSourceSchema(a,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(i,a,this._displayRefreshVersion)},n=o.processor.mesh.factory.labels;n&&this.view.labelManager.setLabelSchemaStyles(n,this.featureContainer);const u=p(this._lastSchema?.source.mutable,o.source.mutable)||p(this._lastSchema?.processor,o.processor);if(!u)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(r),void(this.featureEffectView.featureEffect=s);this._lastSchema=o,this._fields=null;const l=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${l}] FeatureLayerView2D._doUpdate`,{changes:u});const h=await this.getWorker();await h.pipeline.updateSchema(o,l),e.updateEnd(r),this.featureEffectView.featureEffect=s,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.trySwapRenderState(),this.featureContainer.requestRender();const c=o.processor.mesh.strategy,d="cluster"===c.type||"binning"===c.type,y="heatmap"===o.processor.mesh.factory.symbology.type,f=d||y?"target-defer":"eager";this.subscriptionManager.setVisibilityStrategy(f),has("esri-2d-update-debug")&&console.debug(`Version[${l}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{for(const r of e.messages)switch(r.type){case"edit":{const e=new K;e.add(await this._resolveEdit(r.event)),await t.pipeline.onOverride(e.toMessage());break}case"override":{const e=new K;e.add(this._resolveOverrides(r.options)),await t.pipeline.onOverride(e.toMessage());break}}}catch(r){m(r),0}}_getEffectiveAvailableFields(e){const t=oe(this._lastAvailableFields,e);return this._lastAvailableFields=t,I(this.layer.fieldsIndex,t)}async _createViewSchemaConfig(){const e=this.requiresCurrentUser?await this.signedInUser:null,t=[he(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter,this.effectiveDisplayFilterClause),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),displayFilterEnabled:this.displayFilterEnabled,filters:t,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent,currentUser:e}}_processHighlight(){this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=this._getHighlights(),t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch(e=>{m(e)||h.getLogger(this).error(e)});this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function he(e,t,r,s,i,a){i&&(i=i.clone());const o=null!=i?i.timeExtent:null,n=null!=r&&null!=o?r.intersection(o):r||o;n&&(i??=new U,i.timeExtent=n),i=t.addFilters?.(i,e)??i,a&&(i??=new U,i.where=v(i.where,a));let u=i?.toJSON()??null;return s.size&&(u??=(new U).toJSON(),u.hiddenIds=Array.from(s)),u}e([_()],le.prototype,"_commandsQueue",void 0),e([_()],le.prototype,"_sourceRefreshVersion",void 0),e([_()],le.prototype,"_displayRefreshVersion",void 0),e([_({readOnly:!0})],le.prototype,"_pipelineUpdating",void 0),e([_()],le.prototype,"_sourceUpdating",void 0),e([_({readOnly:!0})],le.prototype,"dataUpdating",null),e([_({readOnly:!0})],le.prototype,"hasAllFeatures",null),e([_({readOnly:!0})],le.prototype,"hasAllFeaturesInView",null),e([_({readOnly:!0})],le.prototype,"hasFullGeometries",null),e([_()],le.prototype,"featureEffectView",void 0),e([_()],le.prototype,"labelingCollisionInfos",null),e([_()],le.prototype,"layerAdapter",null),e([_({readOnly:!0})],le.prototype,"timeExtent",null),le=e([b("esri.views.2d.layers.FeatureLayerView2D")],le);export{le 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{version as i}from"../../../kernel.js";import t from"../../../core/Collection.js";import{abortMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{queryToObject as l,objectToQuery as r}from"../../../core/urlUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{load as m,project as c}from"../../../geometry/projectionUtils.js";import d from"../../../geometry/SpatialReference.js";import{KMLMapImage as y}from"../../../layers/support/KMLMapImage.js";import{getGraphics as g,fetchService as w,parseKML as u}from"../../../layers/support/kmlUtils.js";import{parseUrl as _}from"../../../rest/utils.js";import{GraphicsCollection as b}from"../../../support/GraphicsCollection.js";import{Bitmap as V}from"../engine/Bitmap.js";import{BitmapContainer as f}from"../engine/BitmapContainer.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import S from"./graphics/GraphicContainer.js";import I from"./graphics/GraphicsView2D.js";import x from"../../layers/LayerView.js";import{ImageReprojector as C}from"../../support/imageReprojection.js";class j{constructor(){this.allSublayers=new Map,this.allPoints=[],this.allPolylines=[],this.allPolygons=[],this.allMapImages=[]}}let k=class extends(v(x)){constructor(){super(...arguments),this._bitmapIndex=new Map,this._mapImageContainer=new f,this._kmlVisualData=new j,this._fetchController=null,this.allVisiblePoints=new b,this.allVisiblePolylines=new b,this.allVisiblePolygons=new b,this.allVisibleMapImages=new t}async hitTest(e,i){const t=this.layer;return[this._pointsView?.hitTest(e),this._polylinesView?.hitTest(e),this._polygonsView?.hitTest(e)].flat().filter(Boolean).map(i=>(i.layer=t,i.sourceLayer=t,{type:"graphic",graphic:i,layer:t,mapPoint:e}))}update(e){this._polygonsView&&this._polygonsView.processUpdate(e),this._polylinesView&&this._polylinesView.processUpdate(e),this._pointsView&&this._pointsView.processUpdate(e)}attach(){this._fetchController=new AbortController,this.container.addChild(this._mapImageContainer),this._polygonsView=new I({view:this.view,graphics:this.allVisiblePolygons,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polygonsView.container),this._polylinesView=new I({view:this.view,graphics:this.allVisiblePolylines,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polylinesView.container),this._pointsView=new I({view:this.view,graphics:this.allVisiblePoints,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._pointsView.container),this.addAttachHandles([this.allVisibleMapImages.on("change",e=>{e.added.forEach(e=>this._addMapImage(e)),e.removed.forEach(e=>this._removeMapImage(e))}),o(()=>this.layer.visibleSublayers,e=>{for(const i of this._kmlVisualData.allSublayers.values())i.visibility=0;for(const i of e){const e=this._kmlVisualData.allSublayers.get(i.id);e&&(e.visibility=1)}this._refreshCollections()})]),this._updatingHandles.addPromise(this._fetchService(this._fetchController.signal)),this._imageReprojector=new C}detach(){this._fetchController=s(this._fetchController),this._mapImageContainer.removeAllChildren(),this.container.removeAllChildren(),this._bitmapIndex.clear(),this._polygonsView=a(this._polygonsView),this._polylinesView=a(this._polylinesView),this._pointsView=a(this._pointsView),this._imageReprojector=a(this._imageReprojector)}viewChange(){this._polygonsView.viewChange(),this._polylinesView.viewChange(),this._pointsView.viewChange()}moveEnd(){}isUpdating(){return this._pointsView.updating||this._polygonsView.updating||this._polylinesView.updating}_addMapImage(e){(this.view.spatialReference?.isWGS84||this.view.spatialReference?.isWebMercator)&&this._imageReprojector.loadAndReprojectBitmapData(e.href,e.extent,this.view.spatialReference).then(i=>{const t=new V(i.bitmapData);t.x=i.extent.xmin,t.y=i.extent.ymax,t.resolution=i.extent.width/i.bitmapData.width,t.rotation=e.rotation,this._mapImageContainer.addChild(t),this._bitmapIndex.set(e,t)})}async _getViewDependentUrl(e,t){const{viewFormat:s,viewBoundScale:a,httpQuery:o}=e;if(null!=s){if(null==t)throw new Error("Loading this network link requires a view state.");let n;if(await m(),null!=a&&1!==a){const e=new p(t.extent);e.expand(a),n=e}else n=t.extent;n=c(n,d.WGS84);const h=c(n,d.WebMercator),y=n.xmin,g=n.xmax,w=n.ymin,u=n.ymax,b=t.size[0]*t.pixelRatio,V=t.size[1]*t.pixelRatio,f=Math.max(h.width,h.height),v={"[bboxWest]":y.toString(),"[bboxEast]":g.toString(),"[bboxSouth]":w.toString(),"[bboxNorth]":u.toString(),"[lookatLon]":n.center.x.toString(),"[lookatLat]":n.center.y.toString(),"[lookatRange]":f.toString(),"[lookatTilt]":"0","[lookatHeading]":t.rotation.toString(),"[lookatTerrainLon]":n.center.x.toString(),"[lookatTerrainLat]":n.center.y.toString(),"[lookatTerrainAlt]":"0","[cameraLon]":n.center.x.toString(),"[cameraLat]":n.center.y.toString(),"[cameraAlt]":f.toString(),"[horizFov]":"60","[vertFov]":"60","[horizPixels]":b.toString(),"[vertPixels]":V.toString(),"[terrainEnabled]":"0","[clientVersion]":i,"[kmlVersion]":"2.2","[clientName]":"ArcGIS API for JavaScript","[language]":"en-US"},S=e=>{for(const i in e){let t;for(t in v)e[i]=e[i].replace(t,v[t])}},I=l(s);S(I);let x={};null!=o&&(x=l(o),S(x));const C=_(e.href);C.query={...C.query,...I,...x};return`${C.path}?${r(I)}`}return e.href}async _fetchService(e){const i=new j;await this._loadVisualData(this.layer.url,i,e),this._kmlVisualData=i,this._refreshCollections()}_refreshCollections(){this.allVisiblePoints.removeAll(),this.allVisiblePolylines.removeAll(),this.allVisiblePolygons.removeAll(),this.allVisibleMapImages.removeAll(),this.allVisiblePoints.addMany(this._kmlVisualData.allPoints.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolylines.addMany(this._kmlVisualData.allPolylines.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolygons.addMany(this._kmlVisualData.allPolygons.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisibleMapImages.addMany(this._kmlVisualData.allMapImages.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))}_isSublayerVisible(e){const i=this._kmlVisualData.allSublayers.get(e);return!!i?.visibility&&(-1===i.parentFolderId||this._isSublayerVisible(i.parentFolderId))}_loadVisualData(e,i,t){return this._fetchParsedKML(e,t).then(async e=>{for(const s of e.sublayers){i.allSublayers.set(s.id,s);const e=s.points?await g(s.points):[],a=s.polylines?await g(s.polylines):[],o=s.polygons?await g(s.polygons):[],l=s.mapImages?.map(e=>y.fromJSON(e))??[];if(i.allPoints.push(...e.map(e=>({item:e,sublayerId:s.id}))),i.allPolylines.push(...a.map(e=>({item:e,sublayerId:s.id}))),i.allPolygons.push(...o.map(e=>({item:e,sublayerId:s.id}))),i.allMapImages.push(...l.map(e=>({item:e,sublayerId:s.id}))),s.networkLink){const e=await this._getViewDependentUrl(s.networkLink,this.view.state);await this._loadVisualData(e,i,t)}}})}_fetchParsedKML(e,i){return w(e,this.layer.spatialReference,this.layer.refreshInterval,i).then(e=>u(e.data))}_removeMapImage(e){const i=this._bitmapIndex.get(e);i&&(this._mapImageContainer.removeChild(i),this._bitmapIndex.delete(e))}};e([n()],k.prototype,"_pointsView",void 0),e([n()],k.prototype,"_polylinesView",void 0),e([n()],k.prototype,"_polygonsView",void 0),
|
|
5
|
+
import{__decorate as e}from"tslib";import{version as i}from"../../../kernel.js";import t from"../../../core/Collection.js";import{abortMaybe as s,destroyMaybe as a}from"../../../core/maybe.js";import{watch as o}from"../../../core/reactiveUtils.js";import{queryToObject as l,objectToQuery as r}from"../../../core/urlUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../geometry/Extent.js";import{load as m,project as c}from"../../../geometry/projectionUtils.js";import d from"../../../geometry/SpatialReference.js";import{KMLMapImage as y}from"../../../layers/support/KMLMapImage.js";import{getGraphics as g,fetchService as w,parseKML as u}from"../../../layers/support/kmlUtils.js";import{parseUrl as _}from"../../../rest/utils.js";import{GraphicsCollection as b}from"../../../support/GraphicsCollection.js";import{Bitmap as V}from"../engine/Bitmap.js";import{BitmapContainer as f}from"../engine/BitmapContainer.js";import{LayerView2DMixin as v}from"./LayerView2D.js";import S from"./graphics/GraphicContainer.js";import I from"./graphics/GraphicsView2D.js";import x from"../../layers/LayerView.js";import{ImageReprojector as C}from"../../support/imageReprojection.js";class j{constructor(){this.allSublayers=new Map,this.allPoints=[],this.allPolylines=[],this.allPolygons=[],this.allMapImages=[]}}let k=class extends(v(x)){constructor(){super(...arguments),this._bitmapIndex=new Map,this._mapImageContainer=new f,this._kmlVisualData=new j,this._fetchController=null,this.allVisiblePoints=new b,this.allVisiblePolylines=new b,this.allVisiblePolygons=new b,this.allVisibleMapImages=new t}async hitTest(e,i){const t=this.layer;return[this._pointsView?.hitTest(e),this._polylinesView?.hitTest(e),this._polygonsView?.hitTest(e)].flat().filter(Boolean).map(i=>(i.layer=t,i.sourceLayer=t,{type:"graphic",graphic:i,layer:t,mapPoint:e}))}update(e){this._polygonsView&&this._polygonsView.processUpdate(e),this._polylinesView&&this._polylinesView.processUpdate(e),this._pointsView&&this._pointsView.processUpdate(e)}attach(){this._fetchController=new AbortController,this.container.addChild(this._mapImageContainer),this._polygonsView=new I({view:this.view,graphics:this.allVisiblePolygons,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polygonsView.container),this._polylinesView=new I({view:this.view,graphics:this.allVisiblePolylines,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._polylinesView.container),this._pointsView=new I({view:this.view,graphics:this.allVisiblePoints,requestUpdateCallback:()=>this.requestUpdate(),container:new S(this.view.featuresTilingScheme)}),this.container.addChild(this._pointsView.container),this.addAttachHandles([this.allVisibleMapImages.on("change",e=>{e.added.forEach(e=>this._addMapImage(e)),e.removed.forEach(e=>this._removeMapImage(e))}),o(()=>this.layer.visibleSublayers,e=>{for(const i of this._kmlVisualData.allSublayers.values())i.visibility=0;for(const i of e){const e=this._kmlVisualData.allSublayers.get(i.id);e&&(e.visibility=1)}this._refreshCollections()})]),this._updatingHandles.addPromise(this._fetchService(this._fetchController.signal)),this._imageReprojector=new C}detach(){this._fetchController=s(this._fetchController),this._mapImageContainer.removeAllChildren(),this.container.removeAllChildren(),this._bitmapIndex.clear(),this._polygonsView=a(this._polygonsView),this._polylinesView=a(this._polylinesView),this._pointsView=a(this._pointsView),this._imageReprojector=a(this._imageReprojector)}viewChange(){this._polygonsView.viewChange(),this._polylinesView.viewChange(),this._pointsView.viewChange()}moveEnd(){}isUpdating(){return this._pointsView.updating||this._polygonsView.updating||this._polylinesView.updating}_addMapImage(e){(this.view.spatialReference?.isWGS84||this.view.spatialReference?.isWebMercator)&&this._imageReprojector.loadAndReprojectBitmapData(e.href,e.extent,this.view.spatialReference).then(i=>{const t=new V(i.bitmapData);t.x=i.extent.xmin,t.y=i.extent.ymax,t.resolution=i.extent.width/i.bitmapData.width,t.rotation=e.rotation,this._mapImageContainer.addChild(t),this._bitmapIndex.set(e,t)})}async _getViewDependentUrl(e,t){const{viewFormat:s,viewBoundScale:a,httpQuery:o}=e;if(null!=s){if(null==t)throw new Error("Loading this network link requires a view state.");let n;if(await m(),null!=a&&1!==a){const e=new p(t.extent);e.expand(a),n=e}else n=t.extent;n=c(n,d.WGS84);const h=c(n,d.WebMercator),y=n.xmin,g=n.xmax,w=n.ymin,u=n.ymax,b=t.size[0]*t.pixelRatio,V=t.size[1]*t.pixelRatio,f=Math.max(h.width,h.height),v={"[bboxWest]":y.toString(),"[bboxEast]":g.toString(),"[bboxSouth]":w.toString(),"[bboxNorth]":u.toString(),"[lookatLon]":n.center.x.toString(),"[lookatLat]":n.center.y.toString(),"[lookatRange]":f.toString(),"[lookatTilt]":"0","[lookatHeading]":t.rotation.toString(),"[lookatTerrainLon]":n.center.x.toString(),"[lookatTerrainLat]":n.center.y.toString(),"[lookatTerrainAlt]":"0","[cameraLon]":n.center.x.toString(),"[cameraLat]":n.center.y.toString(),"[cameraAlt]":f.toString(),"[horizFov]":"60","[vertFov]":"60","[horizPixels]":b.toString(),"[vertPixels]":V.toString(),"[terrainEnabled]":"0","[clientVersion]":i,"[kmlVersion]":"2.2","[clientName]":"ArcGIS API for JavaScript","[language]":"en-US"},S=e=>{for(const i in e){let t;for(t in v)e[i]=e[i].replace(t,v[t])}},I=l(s);S(I);let x={};null!=o&&(x=l(o),S(x));const C=_(e.href);C.query={...C.query,...I,...x};return`${C.path}?${r(I)}`}return e.href}async _fetchService(e){const i=new j;await this._loadVisualData(this.layer.url,i,e),this._kmlVisualData=i,this._refreshCollections()}_refreshCollections(){this.allVisiblePoints.removeAll(),this.allVisiblePolylines.removeAll(),this.allVisiblePolygons.removeAll(),this.allVisibleMapImages.removeAll(),this.allVisiblePoints.addMany(this._kmlVisualData.allPoints.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolylines.addMany(this._kmlVisualData.allPolylines.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisiblePolygons.addMany(this._kmlVisualData.allPolygons.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e)),this.allVisibleMapImages.addMany(this._kmlVisualData.allMapImages.filter(e=>this._isSublayerVisible(e.sublayerId)).map(({item:e})=>e))}_isSublayerVisible(e){const i=this._kmlVisualData.allSublayers.get(e);return!!i?.visibility&&(-1===i.parentFolderId||this._isSublayerVisible(i.parentFolderId))}_loadVisualData(e,i,t){return this._fetchParsedKML(e,t).then(async e=>{for(const s of e.sublayers){i.allSublayers.set(s.id,s);const e=s.points?await g(s.points):[],a=s.polylines?await g(s.polylines):[],o=s.polygons?await g(s.polygons):[],l=s.mapImages?.map(e=>y.fromJSON(e))??[];if(i.allPoints.push(...e.map(e=>({item:e,sublayerId:s.id}))),i.allPolylines.push(...a.map(e=>({item:e,sublayerId:s.id}))),i.allPolygons.push(...o.map(e=>({item:e,sublayerId:s.id}))),i.allMapImages.push(...l.map(e=>({item:e,sublayerId:s.id}))),s.networkLink){const e=await this._getViewDependentUrl(s.networkLink,this.view.state);await this._loadVisualData(e,i,t)}}})}_fetchParsedKML(e,i){return w(e,this.layer.spatialReference,this.layer.refreshInterval,i).then(e=>u(e.data))}_removeMapImage(e){const i=this._bitmapIndex.get(e);i&&(this._mapImageContainer.removeChild(i),this._bitmapIndex.delete(e))}};e([n()],k.prototype,"_pointsView",void 0),e([n()],k.prototype,"_polylinesView",void 0),e([n()],k.prototype,"_polygonsView",void 0),k=e([h("esri.views.2d.layers.KMLLayerView2D")],k);const P=k;export{P 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.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import e from"../../../core/Logger.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{GraphicsCollection as o}from"../../../support/GraphicsCollection.js";import{BitmapContainer as p}from"../engine/BitmapContainer.js";import{LayerView2DMixin as g}from"./LayerView2D.js";import l from"./graphics/GraphicsView2D.js";import n from"./graphics/HighlightGraphicContainer.js";import m from"./support/ExportStrategy.js";import
|
|
5
|
+
import{__decorate as t}from"tslib";import{makeHandle as i}from"../../../core/handleUtils.js";import e from"../../../core/Logger.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as a}from"../../../core/accessorSupport/decorators/subclass.js";import{GraphicsCollection as o}from"../../../support/GraphicsCollection.js";import{BitmapContainer as p}from"../engine/BitmapContainer.js";import{LayerView2DMixin as g}from"./LayerView2D.js";import l from"./graphics/GraphicsView2D.js";import n from"./graphics/HighlightGraphicContainer.js";import m from"./support/ExportStrategy.js";import c from"../../layers/LayerView.js";import d from"../../layers/MapImageLayerView.js";import{RefreshableLayerView as u}from"../../layers/RefreshableLayerView.js";import{getHighlightGraphics as f}from"../../layers/support/highlightUtils.js";import{MapServiceLayerViewHelper as y}from"../../layers/support/MapServiceLayerViewHelper.js";import{createQueryGeometry as _}from"../../support/drapedUtils.js";import{getHighlightName as H}from"../../support/highlightOptionsUtils.js";let w=class extends(d(u(g(c)))){constructor(){super(...arguments),this._highlightGraphics=new o,this._updateHash=""}fetchPopupFeaturesAtLocation(t,i){return this._popupHighlightHelper.fetchPopupFeaturesAtLocation(t,i)}update(t){const i=`${this.exportImageVersion}/${t.state.id}/${t.pixelRatio}/${t.stationary}`;this._updateHash!==i&&(this._updateHash=i,this.strategy.update(t).catch(t=>{r(t)||e.getLogger(this).error(t)}),t.stationary&&this._popupHighlightHelper.updateHighlightedFeatures(t.state.resolution)),this._highlightView.processUpdate(t)}attach(){const{imageMaxWidth:t,imageMaxHeight:i,version:e}=this.layer,r=e>=10.3,h=e>=10;this._bitmapContainer=new p,this.container.addChild(this._bitmapContainer),this._highlightView=new l({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new n(this.view.featuresTilingScheme),defaultPointSymbolEnabled:!1}),this.container.addChild(this._highlightView.container),this._popupHighlightHelper=new y({createFetchPopupFeaturesQueryGeometry:(t,i)=>_(t,i,this.view),highlightGraphics:this._highlightGraphics,highlightGraphicUpdated:({graphic:t,property:i})=>this._highlightView.graphicUpdateHandler({graphic:t,property:i}),layerView:this,updatingHandles:this._updatingHandles}),this.strategy=new m({container:this._bitmapContainer,fetchSource:this.fetchImageBitmap.bind(this),requestUpdate:this.requestUpdate.bind(this),imageMaxWidth:t,imageMaxHeight:i,imageRotationSupported:r,imageNormalizationSupported:h,hidpi:!0}),this.addAttachHandles(s(()=>this.exportImageVersion,()=>this.requestUpdate())),this.requestUpdate()}detach(){this.strategy.destroy(),this.container.removeAllChildren(),this._bitmapContainer.removeAllChildren(),this._highlightView.destroy(),this._popupHighlightHelper.destroy()}viewChange(){}moveEnd(){this.requestUpdate()}supportsSpatialReference(t){return this.layer.serviceSupportsSpatialReference(t)}async doRefresh(){this._updateHash="",this.requestUpdate()}isUpdating(){return this.strategy.updating||this.updateRequested}fetchImage(t,i,e,r){return this.layer.fetchImage(t,i,e,{timeExtent:this.timeExtent,floors:this.floors,...r})}fetchImageBitmap(t,i,e,r){return this.layer.fetchImageBitmap(t,i,e,{timeExtent:this.timeExtent,floors:this.floors,...r})}highlight(t,e){const r=f(t);if(0===r.length)return i();const s=H(e);return this._addHighlightGraphics(r,s),i(()=>!this.destroyed&&this._removeHighlightGraphics(r,s))}_processHighlight(){const t=this._getHighlights();this._highlightView?.setHighlight(t)}_addHighlightGraphics(t,i){this._highlightGraphics.addMany(t),this._addHighlights(t.map(t=>t.uid),i)}_removeHighlightGraphics(t,i){this._highlightGraphics.removeMany(t),this._removeHighlights(t.map(t=>t.uid),i)}};t([h()],w.prototype,"strategy",void 0),w=t([a("esri.views.2d.layers.MapImageLayerView2D")],w);const j=w;export{j as default};
|