@arcgis/core 4.32.0-next.20241021 → 4.32.0-next.20241023
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/MapViewer/templateUtils.d.ts +4 -0
- package/applications/MapViewer/templateUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0b7ee57bec7ffac312f2.js +1 -0
- package/assets/esri/core/workers/chunks/{1ba1d9c867ec6a492af9.js → 0f3912bca9fe25eea75c.js} +1 -1
- package/assets/esri/core/workers/chunks/{842ebde78db9bfcaf07b.js → 1678d1d0ecb9b2af69a8.js} +1 -1
- package/assets/esri/core/workers/chunks/1d16ca7791f64dd7c7fb.js +1 -0
- package/assets/esri/core/workers/chunks/1d4be734ff961e313257.js +1 -0
- package/assets/esri/core/workers/chunks/{b292758308dfac4ba8ee.js → 2d8aa31dc96bbd014036.js} +1 -1
- package/assets/esri/core/workers/chunks/{53f648321c5fde26bfe4.js → 319e06888467f9f460ab.js} +1 -1
- package/assets/esri/core/workers/chunks/33cae7ece52a77394b05.js +1 -0
- package/assets/esri/core/workers/chunks/{210a954f5299fe105e0b.js → 539060ffb7f230fb1bd0.js} +1 -1
- package/assets/esri/core/workers/chunks/545441dcc8e915e63ff1.js +1 -0
- package/assets/esri/core/workers/chunks/{303f39b9b7bd33109df8.js → 587df97288a83721d251.js} +1 -1
- package/assets/esri/core/workers/chunks/5caa02a7a85d05e253b4.js +1 -0
- package/assets/esri/core/workers/chunks/5cfecb320e1dcd258b2e.js +1 -0
- package/assets/esri/core/workers/chunks/67018ef25736f0722f6e.js +1 -0
- package/assets/esri/core/workers/chunks/89f74819ac1b5884c149.js +1 -0
- package/assets/esri/core/workers/chunks/92b2d81ef16877341f97.js +1 -0
- package/assets/esri/core/workers/chunks/{e6e77cbdeb99d90caad1.js → 97f62fad6d416a666319.js} +1 -1
- package/assets/esri/core/workers/chunks/98c1956b2e27058c8a51.js +1 -0
- package/assets/esri/core/workers/chunks/9c8a910b6261a4d5da77.js +1 -0
- package/assets/esri/core/workers/chunks/ab6eaa3ae2e233f91a5e.js +1 -0
- package/assets/esri/core/workers/chunks/{63719f892a7d1025c7d3.js → b42c1ab7579a3c464f72.js} +1 -1
- package/assets/esri/core/workers/chunks/{03eba36affe6ed1f5a11.js → bc4ef18d0a02354186e3.js} +7 -7
- package/assets/esri/core/workers/chunks/{c71304c88fce556340ef.js → c859f73b57a764e99b02.js} +1 -1
- package/assets/esri/core/workers/chunks/cb3038ec3ef0d86bf2a0.js +1 -0
- package/assets/esri/core/workers/chunks/{ae20ca2008a2ea6a46b2.js → d8f4bd2b4366388f8a28.js} +1 -1
- package/assets/esri/core/workers/chunks/e71fa25ed45bae5a1adb.js +320 -0
- package/assets/esri/core/workers/chunks/{9c9a8a529494c6d1dfa3.js → ec9d5af8887854e821c8.js} +1 -1
- package/assets/esri/libs/parquet/pkg/arcgis_parquet_bg.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +14 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Bufferer-BhkgvSV4.js +5 -0
- package/chunks/{Distance2DCalculator-DM4OojiI.js → Distance2DCalculator-BX0Ep7eP.js} +1 -1
- package/chunks/{GeodeticDistanceCalculator-DzvUOSaR.js → GeodeticDistanceCalculator-B5uO-Y_z.js} +1 -1
- package/chunks/OperatorCrosses.js +5 -0
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorIntersects.js +5 -0
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +5 -0
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorTouches.js +5 -0
- package/chunks/OperatorWithin.js +5 -0
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/SSAOBlur.glsl.js +5 -5
- package/chunks/SideCalculator2D-CoWc8Oe3.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/MemCachePool.js +1 -1
- package/core/unitUtils.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/affineTransformOperator.js +1 -1
- package/geometry/operators/alphaShapeOperator.js +1 -1
- package/geometry/operators/areaOperator.js +1 -1
- package/geometry/operators/autoCompleteOperator.js +1 -1
- package/geometry/operators/boundaryOperator.js +1 -1
- package/geometry/operators/bufferOperator.js +1 -1
- package/geometry/operators/centroidOperator.js +1 -1
- package/geometry/operators/clipOperator.js +1 -1
- package/geometry/operators/containsOperator.js +1 -1
- package/geometry/operators/convexHullOperator.js +1 -1
- package/geometry/operators/crossesOperator.js +1 -1
- package/geometry/operators/cutOperator.js +1 -1
- package/geometry/operators/densifyOperator.js +1 -1
- package/geometry/operators/differenceOperator.js +1 -1
- package/geometry/operators/disjointOperator.js +1 -1
- package/geometry/operators/distanceOperator.js +1 -1
- package/geometry/operators/equalsOperator.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/generalizeOperator.js +1 -1
- package/geometry/operators/geodesicBufferOperator.js +1 -1
- package/geometry/operators/geodesicProximityOperator.js +1 -1
- package/geometry/operators/geodeticAreaOperator.js +1 -1
- package/geometry/operators/geodeticDensifyOperator.js +1 -1
- package/geometry/operators/geodeticDistanceOperator.js +1 -1
- package/geometry/operators/geodeticLengthOperator.js +1 -1
- package/geometry/operators/graphicBufferOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBoundary.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
- package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
- package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorProject.js +1 -1
- package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/integrateOperator.js +1 -1
- package/geometry/operators/intersectionOperator.js +1 -1
- package/geometry/operators/intersectsOperator.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/containsOperator.js +5 -0
- package/geometry/operators/json/crossesOperator.js +5 -0
- package/geometry/operators/json/disjointOperator.js +5 -0
- package/geometry/operators/json/intersectsOperator.js +5 -0
- package/geometry/operators/json/offsetOperator.js +5 -0
- package/geometry/operators/json/overlapsOperator.js +5 -0
- package/geometry/operators/json/touchesOperator.js +5 -0
- package/geometry/operators/json/withinOperator.js +5 -0
- package/geometry/operators/labelPointOperator.js +1 -1
- package/geometry/operators/lengthOperator.js +1 -1
- package/geometry/operators/linesToPolygonsOperator.js +1 -1
- package/geometry/operators/locateBetweenOperator.js +1 -1
- package/geometry/operators/minimumBoundingCircleOperator.js +1 -1
- package/geometry/operators/multiPartToSinglePartOperator.js +1 -1
- package/geometry/operators/offsetOperator.js +1 -1
- package/geometry/operators/overlapsOperator.js +1 -1
- package/geometry/operators/polygonOverlayOperator.js +1 -1
- package/geometry/operators/polygonSlicerOperator.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/proximityOperator.js +1 -1
- package/geometry/operators/relateOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOperator.js +1 -1
- package/geometry/operators/singlePartToMultiPartOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +5 -0
- package/geometry/operators/support/initNoPeFactory.js +5 -0
- package/geometry/operators/support/jsonConverter.js +5 -0
- package/geometry/operators/support/proximityResult.js +1 -1
- package/geometry/operators/symmetricDifferenceOperator.js +1 -1
- package/geometry/operators/touchesOperator.js +1 -1
- package/geometry/operators/unionOperator.js +1 -1
- package/geometry/operators/withinOperator.js +1 -1
- package/geometry/support/MeshVertexAttributes.js +1 -1
- package/interfaces.d.ts +134 -0
- package/layers/LinkChartLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/knowledgeGraph/supportUtils.js +1 -1
- package/layers/support/ElevationQueryTileCache.js +1 -1
- package/layers/support/ElevationTileData.js +1 -1
- package/layers/support/mediaUtils.js +1 -1
- package/layers/support/parquetLayerUtils.js +1 -1
- package/layers/support/rasterFunctions/ClipFunction.js +1 -1
- package/layers/support/rasterFunctions/clipUtils.js +1 -1
- package/layers/support/rasterFunctions/localUtils.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/linkChart/LinkChartProperties.js +1 -1
- package/package.json +1 -1
- package/smartMapping/raster/renderers/classBreaks.js +1 -1
- package/smartMapping/raster/renderers/rgb.js +1 -1
- package/smartMapping/raster/renderers/stretch.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/smartMapping/raster/support/adapters/RasterLayerAdapter.js +1 -1
- package/smartMapping/renderers/support/rendererUtils.d.ts +4 -0
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/CachedMeshData.js +5 -0
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/FovController.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl/ManagedFBO.js +1 -1
- package/views/3d/webgl/ManagedFBOAttachment.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOPool.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/materials/ProceduralTextureRepository.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/SSAOBlur.glsl.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/css.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/ElevationProfile/support/ElevationProfileView2D.js +1 -1
- package/widgets/ElevationProfile/support/ProfileLine2D.js +5 -0
- package/widgets/ElevationProfile/support/ProfileLines3D.js +1 -1
- package/widgets/ElevationProfile/support/constants.js +1 -1
- package/widgets/ElevationProfile/support/visualizationUtils.js +5 -0
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/support/columnUtils.js +1 -1
- package/widgets/FeatureTable/support/tableUtils.js +1 -1
- package/widgets/FeatureTable/support/templateUtils.js +5 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/assets/esri/core/workers/chunks/03d0394fff1463c224f9.js +0 -1
- package/assets/esri/core/workers/chunks/0c40cac18711f79f0a7d.js +0 -1
- package/assets/esri/core/workers/chunks/1a97f98facfc62a9fc69.js +0 -1
- package/assets/esri/core/workers/chunks/1e3ed3ee48c2977cff6f.js +0 -1
- package/assets/esri/core/workers/chunks/1fc064e37d030e449d5e.js +0 -1
- package/assets/esri/core/workers/chunks/4daab36de5efa03a8cbb.js +0 -1
- package/assets/esri/core/workers/chunks/77d129134c2a66cd86d8.js +0 -1
- package/assets/esri/core/workers/chunks/88bd9e023764da377aa7.js +0 -1
- package/assets/esri/core/workers/chunks/92ce57cb12d9a7a3699e.js +0 -1
- package/assets/esri/core/workers/chunks/a5675c989d00b7400f98.js +0 -1
- package/assets/esri/core/workers/chunks/c06c5c815b5e37717fa1.js +0 -1
- package/assets/esri/core/workers/chunks/ca1385e165aae8a32ca2.js +0 -1
- package/assets/esri/core/workers/chunks/ce8c1208916f54af7e68.js +0 -320
- package/assets/esri/core/workers/chunks/df51c93b2dbcc89efc23.js +0 -1
- package/assets/esri/core/workers/chunks/efa3c919261672871f2f.js +0 -1
- package/chunks/Bufferer-fr1_Nc47.js +0 -5
- package/geometry/operators/support/converterAPI.js +0 -5
package/package.json
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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import{formatNumber as r}from"../../../intl/number.js";import{createClassBreaksRenderer as a,getVariableRasterInfo as t,getField as s}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as n}from"../support/utils.js";function o(e){const{rasterInfo:r,layer:a}=e,s=r.multidimensionalInfo?"imagery"===a.type?a.mosaicRule?.multidimensionalDefinition?.[0]?.variableName:a.multidimensionalDefinition?.[0]?.variableName:"";return t(r,s)}async function i(r){const a=o((r=await n(r)).layer);if(a.bandCount>1)throw new e("raster-class-breaks-renderer:not-supported","Multiband raster is not supported");const{attributeTable:t}=a;r.field||(r.field=s(t,"value")?.name??"value");const{colors:i,numClasses:l}=r;if(i&&l&&i.length!==l)throw new e("raster-class-breaks-renderer:not-supported","The size of the `colors` parameter does not match 'numClasses'");return r.classificationMethod||(r.classificationMethod="natural-breaks"),r}async function l(r){const t=o((r=await i(r)).layer).clone(),s=t.attributeTable?.fields.find((e=>e.name.toLowerCase()===r.field?.toLowerCase()));if(
|
|
5
|
+
import e from"../../../core/Error.js";import{formatNumber as r}from"../../../intl/number.js";import{createClassBreaksRenderer as a,getVariableRasterInfo as t,getField as s}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as n}from"../support/utils.js";function o(e){const{rasterInfo:r,layer:a}=e,s=r.multidimensionalInfo?"imagery"===a.type?a.mosaicRule?.multidimensionalDefinition?.[0]?.variableName:a.multidimensionalDefinition?.[0]?.variableName:"";return t(r,s)}async function i(r){const a=o((r=await n(r)).layer);if(a.bandCount>1)throw new e("raster-class-breaks-renderer:not-supported","Multiband raster is not supported");const{attributeTable:t}=a;r.field||(r.field=s(t,"value")?.name??"value");const{colors:i,numClasses:l}=r;if(i&&l&&i.length!==l)throw new e("raster-class-breaks-renderer:not-supported","The size of the `colors` parameter does not match 'numClasses'");return r.classificationMethod||(r.classificationMethod="natural-breaks"),r}async function l(r){const t=o((r=await i(r)).layer).clone(),s=t.attributeTable?.fields.find((e=>e.name.toLowerCase()===r.field?.toLowerCase()));if(s||t.histograms||await r.layer.updateRasterInfoWithEstimatedStats(t,{rasterFunction:r.rasterFunction,signal:r.signal}),null==t.histograms)throw new e("raster-class-breaks-renderer:not-supported","Histograms or raster attribute table is required on the source raster. Unable to estimate histograms");const n=a(t,r);if(null==n)throw new e("raster-class-breaks-renderer:not-supported","Class breaks renderer is not supported on this data");const l={minValue:n.minValue,maxValue:n.classBreakInfos[n.classBreakInfos.length-1].maxValue,normalizationTotal:null,classBreakInfos:n.classBreakInfos.map((e=>{const r=u(e.minValue,e.maxValue);return e.label=r,{minValue:e.minValue,maxValue:e.maxValue,label:r}}))};return{renderer:n,classBreaksResult:l}}function u(e,a){return r(e,{maximumFractionDigits:3})+" - "+r(a,{maximumFractionDigits:3})}export{l as createRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../core/Error.js";import{createStretchRenderer as e,getDefaultBandCombination as r}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as n}from"../support/utils.js";async function a(e){e=await n(e);const{rasterInfo:a}=e.layer;if(1===a.bandCount)throw new t("raster-rgb-renderer:not-supported","Only multiband image is supported");const{rgbBandIds:s}=e;if(s&&3!==s.length)throw new t("raster-rgb-renderer:invalid-parameters","rgb band ids must have exactly three 0-based band indices");if(!s){const t=r(a);t&&t.length<3&&2===a.bandCount?e.rgbBandIds=[0,1,1]:e.rgbBandIds=t}return e}async function s(t){const r=(t=await a(t)).layer,{rasterInfo:n}=r,{rgbBandIds:s}=t,d={bandIds:s,stretchType:t.stretchType,includeStatisticsInStretch:t.includeStatisticsInStretch};let o=e(n,d);if(t.estimateStatistics){
|
|
5
|
+
import t from"../../../core/Error.js";import{createStretchRenderer as e,getDefaultBandCombination as r}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as n}from"../support/utils.js";async function a(e){e=await n(e);const{rasterInfo:a}=e.layer;if(1===a.bandCount)throw new t("raster-rgb-renderer:not-supported","Only multiband image is supported");const{rgbBandIds:s}=e;if(s&&3!==s.length)throw new t("raster-rgb-renderer:invalid-parameters","rgb band ids must have exactly three 0-based band indices");if(!s){const t=r(a);t&&t.length<3&&2===a.bandCount?e.rgbBandIds=[0,1,1]:e.rgbBandIds=t}return e}async function s(t){const r=(t=await a(t)).layer,{rasterInfo:n}=r,{rgbBandIds:s}=t,d={bandIds:s,stretchType:t.stretchType,includeStatisticsInStretch:t.includeStatisticsInStretch};let o=e(n,d);if(t.estimateStatistics){t.includeStatisticsInStretch=!0;const a=n.clone();await r.updateRasterInfoWithEstimatedStats(a,{rasterFunction:t.rasterFunction,signal:t.signal}),o=e(a,d)}return i(o,t),{renderer:o,rgbBandIds:s}}function i(t,e){const{gamma:r,useGamma:n,dynamicRangeAdjustment:a}=e;3===r?.length&&(t.gamma=r),null!=n&&(t.useGamma=n),null!=a&&(t.dynamicRangeAdjustment=a)}export{s as createRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createStretchRenderer as t}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as e}from"../support/utils.js";async function a(a){const
|
|
5
|
+
import{createStretchRenderer as t}from"../../../renderers/support/rasterRendererHelper.js";import{processRasterRendererParameters as e}from"../support/utils.js";async function a(a){const r=[(a=await e(a)).bandId||0],s={bandIds:r,variableName:a.variableName,stretchType:a.stretchType,includeStatisticsInStretch:a.includeStatisticsInStretch},i=a.layer,{rasterInfo:c}=i;let m=t(c,s);if(a.estimateStatistics){a.includeStatisticsInStretch=!0;const e=c.clone();await i.updateRasterInfoWithEstimatedStats(e,{rasterFunction:a.rasterFunction,signal:a.signal}),m=t(e,s)}return n(m,a),{renderer:m,bandId:r[0]}}function n(t,e){const{gamma:a,useGamma:n,dynamicRangeAdjustment:r,colorRamp:s}=e;null!=a&&(t.gamma=[a]),null!=n&&(t.useGamma=n),null!=r&&(t.dynamicRangeAdjustment=r),void 0!==s&&(t.colorRamp=s)}export{a as createRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Error.js";import{property as e}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 s from"../../../../geometry/Extent.js";import{estimateStatisticsHistograms as o}from"../../../../layers/support/rasterFunctions/stretchUtils.js";import i from"./RasterLayerAdapter.js";let n=class extends i{async generateRasterInfo(t){const{layer:r}=this,e=t?.rasterFunction;if("imagery-tile"===r.type&&e)try{return await r.generateRasterInfo(e,{signal:t?.signal})}catch{return r.serviceRasterInfo}return this.rasterInfo}async estimateStatisticsHistograms(t){const{layer:e}=this,a=e.multidimensionalDefinition?.[0]?.variableName??"",s=`${e.rasterFunction?.functionName??"default"}${a}`,i=this._statsCache.get(s);if(i)return i;const{raster:n}=e,{extent:l,width:h,height:c}=m(n.rasterInfo),{pixelBlock:p}=await e.fetchPixels(l,h,c,t);if(null==p)throw new r("raster-layer-adapter","Unable to estimate histograms");const f=o(p);return f&&this._statsCache.put(s,f),f}supportsMultidirectionalHillshade(){return!0}load(t){return this.addResolvingPromise(this.layer.load(t).then((()=>this.rasterInfo=this.layer.raster.rasterInfo))),Promise.resolve(this)}};function m(t,r=1e3){const{pyramidScalingFactor:e,maximumPyramidLevel:a}=t.storageInfo;let{extent:o,width:i,height:n,pixelSize:m}=t,l=Math.ceil(Math.log(Math.max(i,n)/r)/Math.log(e))-1,h=0,c=0;if(l<=a){const t=e**l;i=Math.floor(i/t),n=Math.floor(n/t)}else l=0,i=Math.min(i,r),n=Math.min(n,r),h=Math.max(Math.floor(i/2-500),0),c=Math.max(Math.floor(n/2-500),0),o=new s({xmin:o.xmin+h*m.x,xmax:Math.min(o.xmax,o.xmin+h*m.x*r),ymin:o.ymin+c*m.y,ymax:Math.min(o.ymax,o.ymin+c*m.y*r)});return{extent:o,width:i,height:n,origin:{x:h,y:c}}}t([e()],n.prototype,"layer",void 0),n=t([a("esri.smartMapping.raster.support.adapters.ImageryTileLayerAdapter")],n);const l=n;export{l as default};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Error.js";import{property as e}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 s from"../../../../geometry/Extent.js";import{estimateStatisticsHistograms as o}from"../../../../layers/support/rasterFunctions/stretchUtils.js";import i from"./RasterLayerAdapter.js";let n=class extends i{async generateRasterInfo(t){const{layer:r}=this,e=t?.rasterFunction;if("imagery-tile"===r.type&&e)try{return await r.generateRasterInfo(e,{signal:t?.signal})}catch{return r.serviceRasterInfo}return this.rasterInfo}async estimateStatisticsHistograms(t){const{layer:e}=this,a=e.multidimensionalDefinition?.[0]?.variableName??"",s=`${e.rasterFunction?.functionName??"default"}${a}`,i=this._statsCache.get(s);if(i)return i;const{raster:n}=e,{extent:l,width:h,height:c}=m(n.rasterInfo),{pixelBlock:p}=await e.fetchPixels(l,h,c,t);if(null==p)throw new r("raster-layer-adapter","Unable to estimate histograms");const f=o(p);return f&&this._statsCache.put(s,f),f}supportsMultidirectionalHillshade(){return!0}load(t){return this.addResolvingPromise(this.layer.load(t).then((()=>this.rasterInfo=this.layer.raster.rasterInfo))),Promise.resolve(this)}};function m(t,r=1e3){const{pyramidScalingFactor:e,maximumPyramidLevel:a}=t.storageInfo;let{extent:o,width:i,height:n,pixelSize:m}=t,l=Math.max(0,Math.ceil(Math.log(Math.max(i,n)/r)/Math.log(e))-1),h=0,c=0;if(l<=a){const t=e**l;i=Math.floor(i/t),n=Math.floor(n/t)}else l=0,i=Math.min(i,r),n=Math.min(n,r),h=Math.max(Math.floor(i/2-500),0),c=Math.max(Math.floor(n/2-500),0),o=new s({xmin:o.xmin+h*m.x,xmax:Math.min(o.xmax,o.xmin+h*m.x*r),ymin:o.ymin+c*m.y,ymax:Math.min(o.ymax,o.ymin+c*m.y*r)});return{extent:o,width:i,height:n,origin:{x:h,y:c}}}t([e()],n.prototype,"layer",void 0),n=t([a("esri.smartMapping.raster.support.adapters.ImageryTileLayerAdapter")],n);const l=n;export{l 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import s from"../../../../core/Loadable.js";import{LRUCache as r}from"../../../../core/LRUCache.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";let a=class extends s{constructor(){super(...arguments),this.type="raster-layer-adapter",this._statsCache=new r(20)}get serviceRasterInfo(){return this.rasterInfo}async updateRasterInfo(t){this.rasterInfo=await this.generateRasterInfo(t),this.rasterFunction=t?.rasterFunction}async updateRasterInfoWithEstimatedStats(t,s){
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import s from"../../../../core/Loadable.js";import{LRUCache as r}from"../../../../core/LRUCache.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";let a=class extends s{constructor(){super(...arguments),this.type="raster-layer-adapter",this._statsCache=new r(20)}get serviceRasterInfo(){return this.rasterInfo}async updateRasterInfo(t){this.rasterInfo=await this.generateRasterInfo(t),this.rasterFunction=t?.rasterFunction}async updateRasterInfoWithEstimatedStats(t,s){const r=await this.estimateStatisticsHistograms(s);r?.statistics&&(t.statistics=r.statistics),r?.histograms&&(t.histograms=r.histograms)}};t([o()],a.prototype,"layer",void 0),t([o()],a.prototype,"serviceRasterInfo",null),t([o()],a.prototype,"rasterInfo",void 0),t([o()],a.prototype,"rasterFunction",void 0),t([o({readOnly:!0})],a.prototype,"type",void 0),t([o()],a.prototype,"version",void 0),a=t([e("esri.smartMapping.raster.support.adapters.RasterLayerAdapter")],a);const i=a;export{i as default};
|
package/support/revision.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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20241023",d="946164ebba11fe46b36cb6b586984d15b171dd04";export{b as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{setId as i}from"../CIMCursor.js";import{GeometricEffectControlMeasureLineRule as h}from"../enums.js";class e{static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(s,t,i,h,e){return new r(s,t,i)}}e.instance=null;class r{constructor(s,t,i){this._defaultPointSize=20,this._inputGeometries=s,this._geomUnitsPerPoint=i,this._rule=t.rule??h.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let i;for(;i=this._inputGeometries.next();){const h=this._processGeom(t(i));if(h?.length)return s.fromJSONCIM({paths:h})}return null}_clone(s){return[s[0],s[1]]}_mid(s,t){return[(s[0]+t[0])/2,(s[1]+t[1])/2]}_mix(s,t,i,h){return[s[0]*t+i[0]*h,s[1]*t+i[1]*h]}_add(s,t){return[s[0]+t[0],s[1]+t[1]]}_add2(s,t,i){return[s[0]+t,s[1]+i]}_sub(s,t){return[s[0]-t[0],s[1]-t[1]]}_dist(s,t){return Math.sqrt((s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1]))}_norm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}_normalize(s,t=1){const i=t/this._norm(s);s[0]*=i,s[1]*=i}_leftPerpendicular(s){const t=-s[1],i=s[0];s[0]=t,s[1]=i}_leftPerp(s){return[-s[1],s[0]]}_rightPerpendicular(s){const t=s[1],i=-s[0];s[0]=t,s[1]=i}_rightPerp(s){return[s[1],-s[0]]}_dotProduct(s,t){return s[0]*t[0]+s[1]*t[1]}_crossProduct(s,t){return s[0]*t[1]-s[1]*t[0]}_rotateDirect(s,t,i){const h=s[0]*t-s[1]*i,e=s[0]*i+s[1]*t;s[0]=h,s[1]=e}_makeCtrlPt(s){const t=[s[0],s[1]];return i(t,1),t}_addAngledTicks(s,t,i,h){const e=this._sub(i,t);this._normalize(e);const r=this._crossProduct(e,this._sub(h,t));let _;_=r>0?this._rightPerp(e):this._leftPerp(e);const c=Math.abs(r)/2,u=[];u.push([t[0]+(_[0]-e[0])*c,t[1]+(_[1]-e[1])*c]),u.push(t),u.push(i),u.push([i[0]+(_[0]+e[0])*c,i[1]+(_[1]+e[1])*c]),s.push(u)}_addBezier2(s,t,i,h,e){if(0==e--)return void s.push(h);const r=this._mid(t,i),_=this._mid(i,h),c=this._mid(r,_);this._addBezier2(s,t,r,c,e),this._addBezier2(s,c,_,h,e)}_addBezier3(s,t,i,h,e,r){if(0==r--)return void s.push(e);const _=this._mid(t,i),c=this._mid(i,h),u=this._mid(h,e),o=this._mid(_,c),a=this._mid(c,u),n=this._mid(o,a);this._addBezier3(s,t,_,o,n,r),this._addBezier3(s,n,a,u,e,r)}_add90DegArc(s,t,i,h,e){const r=e??this._crossProduct(this._sub(i,t),this._sub(h,t))>0,_=this._mid(t,i),c=this._sub(_,t);r?this._leftPerpendicular(c):this._rightPerpendicular(c),_[0]+=c[0],_[1]+=c[1],this._addBezier3(s,t,this._mix(t,.33333,_,.66667),this._mix(i,.33333,_,.66667),i,4)}_addArrow(s,t,i){const h=t[0],e=t[1],r=t[t.length-1],_=this._sub(h,e),c=this._norm(_);this._normalize(_);const u=Math.abs(this._crossProduct(_,this._sub(r,e)));let o=this._dotProduct(_,this._sub(r,e));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const a=.5*u,n=this._leftPerp(_),p=[e[0]+_[0]*o,e[1]+_[1]*o],d=t.length-1,l=[];l.push(i?[-n[0],-n[1]]:n);let b=[-_[0],-_[1]];for(let P=1;P<d-1;P++){const s=this._sub(t[P+1],t[P]);this._normalize(s);const i=this._dotProduct(s,b),h=this._crossProduct(s,b),e=Math.sqrt((1+i)/2),r=this._sub(s,b);this._normalize(r),r[0]/=e,r[1]/=e,l.push(h<0?[-r[0],-r[1]]:r),b=s}l.push(this._rightPerp(b));for(let P=l.length-1;P>0;P--)s.push([t[P][0]+l[P][0]*a,t[P][1]+l[P][1]*a]);s.push([p[0]+l[0][0]*a,p[1]+l[0][1]*a]),s.push([p[0]+l[0][0]*u,p[1]+l[0][1]*u]),s.push(h),s.push([p[0]-l[0][0]*u,p[1]-l[0][1]*u]),s.push([p[0]-l[0][0]*a,p[1]-l[0][1]*a]);for(let P=1;P<l.length;P++)s.push([t[P][0]-l[P][0]*a,t[P][1]-l[P][1]*a])}_addDash(s,t,i){const h=this._norm(i)/7;this._normalize(i);let e=[];for(let r=0;r<=7;r++)e.push([t[0]+i[0]*r*h,t[1]+i[1]*r*h]),1&r&&(s.push(e),e=[])}_cp2(s,t,i){return s.length>=2?s[1]:this._add2(s[0],t*this._defaultSize,i*this._defaultSize)}_cp3(s,t,i,h){if(s.length>=3)return s[2];const e=this._mix(s[0],1-i,t,i),r=this._sub(t,s[0]);return this._normalize(r),this._rightPerpendicular(r),[e[0]+r[0]*h*this._defaultSize,e[1]+r[1]*h*this._defaultSize]}_arrowPath(s){if(s.length>2)return s;const t=s[0],i=this._cp2(s,-4,0),h=this._sub(t,i);this._normalize(h);const e=this._rightPerp(h);return[t,i,[t[0]+(e[0]-h[0])*this._defaultSize,t[1]+(e[1]-h[1])*this._defaultSize]]}_arrowLastSeg(s){const t=s[0],i=this._cp2(s,-4,0);let h;if(s.length>=3)h=s[s.length-1];else{const s=this._sub(t,i);this._normalize(s);const e=this._rightPerp(s);h=[t[0]+(e[0]-s[0])*this._defaultSize,t[1]+(e[1]-s[1])*this._defaultSize]}return[i,h]}_processGeom(s){if(!s)return null;const t=[];for(const e of s){if(!e||0===e.length)continue;const s=e.length;let r=e[0];switch(this._rule){case h.PerpendicularFromFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=[];h.push(i),h.push(this._mid(r,s)),t.push(h);break}case h.ReversedFirstSegment:{const s=this._cp2(e,0,-1);t.push([s,r]);break}case h.PerpendicularToSecondSegment:{if(e.length<3)return[];const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=[];h.push(this._mid(s,i)),h.push(r),t.push(h);break}case h.SecondSegmentWithTicks:{if(e.length<3)return[];const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);let _;_=this._crossProduct(h,this._sub(r,s))>0?this._rightPerp(h):this._leftPerp(h);const c=[];c.push([s[0]+(_[0]-h[0])/3,s[1]+(_[1]-h[1])/3]),c.push(s),c.push(i),c.push([i[0]+(_[0]+h[0])/3,i[1]+(_[1]+h[1])/3]),t.push(c);break}case h.DoublePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push(r),u.push([i[0]+_[0]*c,i[1]+_[1]*c]),t.push(u);const o=[];o.push([i[0]-_[0]*c,i[1]-_[1]*c]),o.push(s),t.push(o);break}case h.OppositeToFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c,i[1]+_[1]*c]),u.push([i[0]-_[0]*c,i[1]-_[1]*c]),t.push(u);break}case h.TriplePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c*.8,i[1]+_[1]*c*.8]),u.push([h[0]+.8*(r[0]-h[0]),h[1]+.8*(r[1]-h[1])]),t.push(u),t.push([i,h]);const o=[];o.push([i[0]-_[0]*c*.8,i[1]-_[1]*c*.8]),o.push([h[0]+.8*(s[0]-h[0]),h[1]+.8*(s[1]-h[1])]),t.push(o);break}case h.HalfCircleFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s);let _=this._sub(s,r);const c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18),o=Math.sqrt((1+c)/2),a=Math.sqrt((1-c)/2),n=[];let p;this._crossProduct(_,this._sub(i,r))>0?(n.push(r),_=this._sub(r,h),p=s):(n.push(s),_=this._sub(s,h),p=r),this._rotateDirect(_,o,a),_[0]/=o,_[1]/=o;for(let t=1;t<=18;t++)n.push(this._add(h,_)),this._rotateDirect(_,c,u);n.push(p),t.push(n);break}case h.HalfCircleSecondSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,1,-1);let h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s))/2;this._leftPerpendicular(h);const c=[s[0]+h[0]*_,s[1]+h[1]*_];h=this._sub(s,c);const u=Math.cos(Math.PI/18);let o=Math.sin(Math.PI/18);_>0&&(o=-o);const a=[s];for(let t=1;t<=18;t++)this._rotateDirect(h,u,o),a.push(this._add(c,h));t.push(a);break}case h.HalfCircleExtended:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,1,-1);let _;if(s>=4)_=e[3];else{const s=this._sub(r,i);_=this._add(h,s)}const c=this._dist(i,h)/2/.75,u=this._sub(i,r);this._normalize(u,c);const o=this._sub(h,_);this._normalize(o,c);const a=[_,h];t.push(a);const n=[this._clone(h)];this._addBezier3(n,h,this._add(h,o),this._add(i,u),i,4),n.push(r),t.push(n);break}case h.OpenCircle:{const s=this._cp2(e,-2,0),i=this._sub(s,r),h=Math.cos(Math.PI/18),_=-Math.sin(Math.PI/18),c=[s];for(let t=1;t<=33;t++)this._rotateDirect(i,h,_),c.push(this._add(r,i));t.push(c);break}case h.CoverageEdgesWithTicks:{const i=this._cp2(e,0,-1);let h,_;if(s>=3)h=e[2];else{const s=this._sub(i,r),t=this._leftPerp(s);h=[r[0]+t[0]-.25*s[0],r[1]+t[1]-.25*s[1]]}if(s>=4)_=e[3];else{const s=this._mid(r,i),t=this._sub(r,i);this._normalize(t),this._leftPerpendicular(t);const e=this._crossProduct(t,this._sub(h,s));this._rightPerpendicular(t),_=[h[0]+t[0]*e*2,h[1]+t[1]*e*2]}const c=this._sub(i,r);let u,o;u=this._crossProduct(c,this._sub(h,r))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push(h),o.push(r),o.push([r[0]+(u[0]-c[0])/3,r[1]+(u[1]-c[1])/3]),t.push(o),u=this._crossProduct(c,this._sub(_,i))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push([i[0]+(u[0]+c[0])/3,i[1]+(u[1]+c[1])/3]),o.push(i),o.push(_),t.push(o);break}case h.GapExtentWithDoubleTicks:{const i=this._cp2(e,0,2),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}this._addAngledTicks(t,r,i,this._mid(h,_)),this._addAngledTicks(t,h,_,this._mid(r,i));break}case h.GapExtentMidline:{const i=this._cp2(e,2,0),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}const c=[];c.push(this._mid(r,h)),c.push(this._mid(i,_)),t.push(c);break}case h.Chevron:{const i=this._cp2(e,-1,-1);let h;if(s>=3)h=e[2];else{const s=this._sub(i,r);this._leftPerpendicular(s),h=this._add(r,s)}t.push([i,this._makeCtrlPt(r),h]);break}case h.PerpendicularWithArc:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,.5,-1),_=this._sub(i,r),c=this._norm(_);_[0]/=c,_[1]/=c;const u=this._crossProduct(_,this._sub(h,r));let o=this._dotProduct(_,this._sub(h,r));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const a=[r[0]+_[0]*o,r[1]+_[1]*o];let n=this._leftPerp(_),p=[];if(p.push([a[0]-n[0]*u,a[1]-n[1]*u]),p.push([a[0]+n[0]*u,a[1]+n[1]*u]),t.push(p),s>=4){const s=e[3];let i=this._dotProduct(_,this._sub(s,r));i<.1*c?i=.1*c:i>.9*c&&(i=.9*c);const h=[r[0]+_[0]*i,r[1]+_[1]*i],u=this._crossProduct(_,this._sub(s,r)),o=[];o.push([h[0]-n[0]*u,h[1]-n[1]*u]),o.push([h[0]+n[0]*u,h[1]+n[1]*u]),t.push(o)}const d=[i[0]+n[0]*u,i[1]+n[1]*u];n=this._sub(i,d);const l=Math.cos(Math.PI/18);let b=Math.sin(Math.PI/18);u<0&&(b=-b),p=[r,i];for(let s=1;s<=9;s++)this._rotateDirect(n,l,b),p.push(this._add(d,n));t.push(p);break}case h.ClosedHalfCircle:{const s=this._cp2(e,2,0),i=this._mid(r,s),h=this._sub(s,i),_=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),u=[r,s];for(let t=1;t<=18;t++)this._rotateDirect(h,_,c),u.push(this._add(i,h));t.push(u);break}case h.TripleParallelExtended:{const s=this._cp2(e,0,-2),h=this._cp3(e,s,1,-2),_=this._mid(r,s),c=this._sub(h,s);this._normalize(c);const u=Math.abs(this._crossProduct(c,this._sub(_,s)))/2,o=this._dist(s,h),a=[s,r];a.push([r[0]+c[0]*o*.5,r[1]+c[1]*o*.5]),t.push(a);const n=[];n.push([_[0]-c[0]*u,_[1]-c[1]*u]),n.push([_[0]+c[0]*o*.375,_[1]+c[1]*o*.375]),i(n[n.length-1],1),n.push([_[0]+c[0]*o*.75,_[1]+c[1]*o*.75]),t.push(n);const p=[s,h];t.push(p);break}case h.ParallelWithTicks:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(i,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),this._addAngledTicks(t,r,s,i),this._addAngledTicks(t,this._mix(r,1,h,_),this._mix(s,1,h,_),this._mid(r,s));break}case h.Parallel:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._leftPerp(h),c=this._crossProduct(h,this._sub(i,r));let u=[r,s];t.push(u),u=[],u.push([r[0]+_[0]*c,r[1]+_[1]*c]),u.push([s[0]+_[0]*c,s[1]+_[1]*c]),t.push(u);break}case h.PerpendicularToFirstSegment:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._mid(r,s),_=this._sub(s,r);this._normalize(_);const c=this._crossProduct(_,this._sub(i,r));this._leftPerpendicular(_);const u=[];u.push([h[0]-_[0]*c*.25,h[1]-_[1]*c*.25]),u.push([h[0]+_[0]*c*1.25,h[1]+_[1]*c*1.25]),t.push(u);break}case h.ParallelOffset:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);const u=[];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(u);break}case h.OffsetOpposite:{if(e.length<3)return[];const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);break}case h.OffsetSame:{if(e.length<3)return[];const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]+h[0]*_,r[1]+h[1]*_]),c.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(c);break}case h.CircleWithArc:{let h=this._cp2(e,3,0);const _=this._cp3(e,h,.5,-1);let c,u;if(s>=4)c=e[3],u=this._crossProduct(this._sub(c,h),this._sub(_,h))>0;else{c=h,u=this._crossProduct(this._sub(c,r),this._sub(_,r))>0;const s=24*this._geomUnitsPerPoint,t=this._sub(c,r);this._normalize(t,s);const i=Math.sqrt(2)/2;this._rotateDirect(t,i,u?i:-i),h=this._add(r,t)}const o=this._sub(h,r),a=Math.cos(Math.PI/18),n=Math.sin(Math.PI/18),p=[h];for(let s=1;s<=36;s++)this._rotateDirect(o,a,n),p.push(this._add(r,o));this._add90DegArc(p,h,c,_,u),i(p[p.length-8],1),t.push(p);break}case h.DoubleJog:{let i,h=this._cp2(e,-3,1),_=this._cp3(e,h,-1,-.5);if(s>=4)i=e[3];else{const s=r;r=h,i=_;const t=this._dist(r,s),e=this._dist(i,s);let c=30*this._geomUnitsPerPoint;.5*t<c&&(c=.5*t),.5*e<c&&(c=.5*e),h=this._mix(r,c/t,s,(t-c)/t),_=this._mix(i,c/e,s,(e-c)/e)}const c=this._mid(r,h),u=this._mid(i,_),o=this._dist(r,h),a=this._dist(_,i);let n=Math.min(o,a)/8;n=Math.min(n,24*this._geomUnitsPerPoint);const p=Math.cos(Math.PI/4);let d=this._sub(r,h);this._normalize(d,n),this._crossProduct(d,this._sub(i,h))>0?this._rotateDirect(d,p,-p):this._rotateDirect(d,p,p);let l=[];l.push(h),l.push(this._add(c,d)),l.push(this._sub(c,d)),l.push(r),t.push(l),d=this._sub(i,_),this._normalize(d,n),this._crossProduct(d,this._sub(r,_))<0?this._rotateDirect(d,p,p):this._rotateDirect(d,p,-p),l=[],l.push(_),l.push(this._add(u,d)),l.push(this._sub(u,d)),l.push(i),t.push(l);break}case h.PerpendicularOffset:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_);t.push([c,r]);break}case h.LineExcludingLastSegment:{const s=this._arrowPath(e),i=[];let h=s.length-2;for(;h--;)i.push(s[h]);t.push(i);break}case h.MultivertexArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!1),t.push(i);break}case h.CrossedArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!0),t.push(i);break}case h.ChevronArrow:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);const u=this._crossProduct(_,this._sub(i,s));let o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const a=[s[0]+_[0]*o,s[1]+_[1]*o],n=this._leftPerp(_),p=[];p.push([a[0]+n[0]*u+_[0]*h,a[1]+n[1]*u+_[1]*h]),p.push(r),p.push([a[0]-n[0]*u+_[0]*h,a[1]-n[1]*u+_[1]*h]),t.push(p);break}case h.ChevronArrowOffset:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);const c=this._crossProduct(h,this._sub(i,s));let u=this._dotProduct(h,this._sub(i,s));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=[s[0]+h[0]*u,s[1]+h[1]*u];this._leftPerpendicular(h);const a=[];a.push([o[0]+h[0]*c*.5,o[1]+h[1]*c*.5]),a.push(this._mid(o,r)),a.push([o[0]-h[0]*c*.5,o[1]-h[1]*c*.5]),t.push(a);break}case h.PartialFirstSegment:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);let c=this._dotProduct(h,this._sub(i,s));c<.05*_?c=.05*_:c>.95*_&&(c=.95*_);const u=[s[0]+h[0]*c,s[1]+h[1]*c];t.push([s,u]);break}case h.Arch:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=this._sub(r,s),_=this._mix(i,1,h,.55),c=this._mix(i,1,h,-.55),u=[r];this._addBezier2(u,r,_,i,4),this._addBezier2(u,i,c,s,4),t.push(u);break}case h.CurvedParallelTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_),u=this._sub(this._mix(s,.75,i,.25),_),o=this._sub(this._mix(s,.25,i,.75),_),a=[s];this._addBezier2(a,s,u,c,3),this._addBezier2(a,c,o,i,3),t.push(a);for(let e=0;e<8;e++){const s=a[2*e+1],i=[this._clone(s)];i.push(this._add(s,[h[0]/4,h[1]/4])),t.push(i)}break}case h.Arc90Degrees:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=[s];this._add90DegArc(h,s,r,i),t.push(h);break}case h.TipWithPerpendicularAndTicks:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);let u=this._crossProduct(_,this._sub(i,s)),o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const a=this._leftPerp(_),n=[r[0]-_[0]*h,r[1]-_[1]*h],p=.5*Math.max(c-o-h,h);u=Math.abs(u);const d=[];d.push([n[0]+a[0]*(u+p)-_[0]*p,n[1]+a[1]*(u+p)-_[1]*p]),d.push([n[0]+a[0]*u,n[1]+a[1]*u]),d.push([n[0]-a[0]*u,n[1]-a[1]*u]),d.push([n[0]-a[0]*(u+p)-_[0]*p,n[1]-a[1]*(u+p)-_[1]*p]),t.push(d),t.push([n,r]);break}case h.ConcentricCircles:{const h=this._cp2(e,1,0),_=this._cp3(e,h,2,0),c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18);let o=this._dist(h,r),a=[o,0],n=[];for(let s=0;s<=36;s++)n.push(this._add(r,a)),this._rotateDirect(a,c,u);if(t.push(n),s>=4){n=[];const s=e[3];o=this._dist(s,r),a=[o,0];for(let t=0;t<=36;t++)n.push(this._add(r,a)),0===t&&(n.push(this._add(r,a)),i(n[1],1)),this._rotateDirect(a,c,u);t.push(n)}n=[],o=this._dist(_,r),a=[o,0];for(let s=0;s<=36;s++)n.push(this._add(r,a)),this._rotateDirect(a,c,u);t.push(n);break}case h.DoubleJogArrow:{r=this._arrowPath(e)[0];const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);const c=Math.abs(this._crossProduct(h,this._sub(i,r)));let u=Math.abs(this._dotProduct(h,this._sub(i,r)));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=Math.max(c,u),a=this._leftPerp(h);let n=[];const p=[r[0]-h[0]*u*.5+a[0]*c*.5,r[1]-h[1]*u*.5+a[1]*c*.5];n.push([p[0],p[1]]),p[0]+=h[0]*o*.5+a[0]*o*.4,p[1]+=h[1]*o*.5+a[1]*o*.4,n.push([p[0],p[1]]),p[0]-=a[0]*o*.25,p[1]-=a[1]*o*.25,n.push([p[0],p[1]]),p[0]+=h[0]*o*.5+a[0]*o*.4,p[1]+=h[1]*o*.5+a[1]*o*.4,n.push([p[0],p[1]]),t.push(n),n=[],p[0]=r[0]-h[0]*u*.5-a[0]*c*.5,p[1]=r[1]-h[1]*u*.5-a[1]*c*.5,n.push([p[0],p[1]]),p[0]+=h[0]*o*.5-a[0]*o*.4,p[1]+=h[1]*o*.5-a[1]*o*.4,n.push([p[0],p[1]]),p[0]+=a[0]*o*.25,p[1]+=a[1]*o*.25,n.push([p[0],p[1]]),p[0]+=h[0]*o*.5-a[0]*o*.4,p[1]+=h[1]*o*.5-a[1]*o*.4,n.push([p[0],p[1]]),t.push(n);break}case h.LinkedChevrons:{const s=this._cp2(e,-5,0),i=this._cp3(e,s,-.2,1),h=this._sub(r,s);this._normalize(h);const _=this._leftPerp(h),c=Math.abs(this._crossProduct(h,this._sub(i,s)));t.push([s,r]);const u=[];u.push([r[0]-h[0]*c+_[0]*c,r[1]-h[1]*c+_[1]*c]),u.push(r),u.push([r[0]-h[0]*c-_[0]*c,r[1]-h[1]*c-_[1]*c]),t.push(u),this._addDash(t,s,[-h[0]*c+_[0]*c,-h[1]*c+_[1]*c]),this._addDash(t,s,[-h[0]*c-_[0]*c,-h[1]*c-_[1]*c]);break}case h.SegmentThenHalfCircle:{const i=this._cp2(e,2,0),h=this._cp3(e,i,1.5,0);let _;_=s>=4?e[3]:this._cp3(e,i,1.25,-.5);const c=this._sub(i,r);this._normalize(c);const u=.5*this._dist(i,h),o=this._crossProduct(c,this._sub(_,r))>0,a=Math.cos(Math.PI/18);let n=Math.sin(Math.PI/18);o&&(n=-n);const p=[r,i];c[0]*=u,c[1]*=u;const d=this._add(i,c);c[0]=-c[0],c[1]=-c[1];for(let s=1;s<=18;s++)this._rotateDirect(c,a,n),p.push(this._add(d,c));t.push(p);break}case h.LineWithStraightTicks:{const s=this._cp2(e,-2,1),i=this._cp3(e,s,-1,-.5),h=this._sub(i,s);this._normalize(h);const _=this._dotProduct(h,this._sub(s,r)),c=this._dotProduct(h,this._sub(i,r));let u=[r];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push(s),t.push(u),u=[r],u.push([r[0]+h[0]*c,r[1]+h[1]*c]),u.push(i),t.push(u);break}case h.DoubleCurve:{const s=this._cp2(e,-5,-1),h=this._cp3(e,s,2,0),_=Math.atan2(1,5),c=Math.cos(_),u=Math.sin(_),o=this._sub(s,r),a=this._dist(r,s);this._normalize(o),this._rotateDirect(o,c,-u);const n=[r];n.push([r[0]+o[0]*a*.5,r[1]+o[1]*a*.5]),i(n[1],1),n.push([r[0]+o[0]*a*.8,r[1]+o[1]*a*.8]),this._addBezier2(n,n[2],[r[0]+o[0]*a,r[1]+o[1]*a],s,3);const p=this._sub(h,s),d=this._dist(s,h);this._normalize(p),this._rotateDirect(p,c,-u),this._addBezier2(n,s,[h[0]-p[0]*d,h[1]-p[1]*d],[h[0]-p[0]*d*.8,h[1]-p[1]*d*.8],3),n.push(h),t.push(n);break}case h.ParallelWithTicksByWidth:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),_>0?(this._addAngledTicks(t,r,[r[0]+h[0]*_,r[1]+h[1]*_],s),this._addAngledTicks(t,s,[s[0]+h[0]*_,s[1]+h[1]*_],r)):(this._addAngledTicks(t,[r[0]+h[0]*_,r[1]+h[1]*_],r,s),this._addAngledTicks(t,[s[0]+h[0]*_,s[1]+h[1]*_],r,s));break}case h.EnclosingRoundedRectangle:{const s=this._cp2(e,3,-2),t=[Math.min(r[0],s[0]),Math.max(r[1],s[1])],i=[Math.max(r[0],s[0]),Math.min(r[1],s[1])],h=i[0]-t[0],_=t[1]-i[1],c=Math.min(h,_)/10,u=[];u.push([t[0]+c+.75*(h-2*c),t[1]]),u.push([i[0]-c,t[1]]),this._add90DegArc(u,[i[0]-c,t[1]],[i[0],t[1]-c],[i[0],t[1]]),u.push([i[0],i[1]+c]),this._add90DegArc(u,[i[0],i[1]+c],[i[0]-c,i[1]],i),u.push([t[0]+c,i[1]]),this._add90DegArc(u,[t[0]+c,i[1]],[t[0],i[1]+c],[t[0],i[1]]),u.push([t[0],t[1]-c]),this._add90DegArc(u,[t[0],t[1]-c],[t[0]+c,t[1]],t),u.push([t[0]+c+.75*(h-2*c),t[1]]);break}case h.FullGeometry:default:t.push(e)}}return t}}export{e as EffectControlMeasureLine};
|
|
5
|
+
import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{setId as i}from"../CIMCursor.js";import{GeometricEffectControlMeasureLineRule as h}from"../enums.js";class e{static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(s,t,i,h,e){return new r(s,t,i)}}e.instance=null;class r{constructor(s,t,i){this._defaultPointSize=20,this._inputGeometries=s,this._geomUnitsPerPoint=i,this._rule=t.rule??h.FullGeometry,this._defaultSize=this._defaultPointSize*i}next(){let i;for(;i=this._inputGeometries.next();){const h=this._processGeom(t(i));if(h?.length)return s.fromJSONCIM({paths:h})}return null}_clone(s){return[s[0],s[1]]}_mid(s,t){return[(s[0]+t[0])/2,(s[1]+t[1])/2]}_mix(s,t,i,h){return[s[0]*t+i[0]*h,s[1]*t+i[1]*h]}_add(s,t){return[s[0]+t[0],s[1]+t[1]]}_add2(s,t,i){return[s[0]+t,s[1]+i]}_sub(s,t){return[s[0]-t[0],s[1]-t[1]]}_dist(s,t){return Math.sqrt((s[0]-t[0])*(s[0]-t[0])+(s[1]-t[1])*(s[1]-t[1]))}_norm(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}_normalize(s,t=1){const i=t/this._norm(s);s[0]*=i,s[1]*=i}_leftPerpendicular(s){const t=-s[1],i=s[0];s[0]=t,s[1]=i}_leftPerp(s){return[-s[1],s[0]]}_rightPerpendicular(s){const t=s[1],i=-s[0];s[0]=t,s[1]=i}_rightPerp(s){return[s[1],-s[0]]}_dotProduct(s,t){return s[0]*t[0]+s[1]*t[1]}_crossProduct(s,t){return s[0]*t[1]-s[1]*t[0]}_rotateDirect(s,t,i){const h=s[0]*t-s[1]*i,e=s[0]*i+s[1]*t;s[0]=h,s[1]=e}_makeCtrlPt(s){const t=[s[0],s[1]];return i(t,1),t}_addAngledTicks(s,t,i,h){const e=this._sub(i,t);this._normalize(e);const r=this._crossProduct(e,this._sub(h,t));let _;_=r>0?this._rightPerp(e):this._leftPerp(e);const c=Math.abs(r)/2,u=[];u.push([t[0]+(_[0]-e[0])*c,t[1]+(_[1]-e[1])*c]),u.push(t),u.push(i),u.push([i[0]+(_[0]+e[0])*c,i[1]+(_[1]+e[1])*c]),s.push(u)}_addBezier2(s,t,i,h,e){if(0==e--)return void s.push(h);const r=this._mid(t,i),_=this._mid(i,h),c=this._mid(r,_);this._addBezier2(s,t,r,c,e),this._addBezier2(s,c,_,h,e)}_addBezier3(s,t,i,h,e,r){if(0==r--)return void s.push(e);const _=this._mid(t,i),c=this._mid(i,h),u=this._mid(h,e),o=this._mid(_,c),a=this._mid(c,u),n=this._mid(o,a);this._addBezier3(s,t,_,o,n,r),this._addBezier3(s,n,a,u,e,r)}_add90DegArc(s,t,i,h,e){const r=e??this._crossProduct(this._sub(i,t),this._sub(h,t))>0,_=this._mid(t,i),c=this._sub(_,t);r?this._leftPerpendicular(c):this._rightPerpendicular(c),_[0]+=c[0],_[1]+=c[1],this._addBezier3(s,t,this._mix(t,.33333,_,.66667),this._mix(i,.33333,_,.66667),i,4)}_addArrow(s,t,i){const h=t[0],e=t[1],r=t[t.length-1],_=this._sub(h,e),c=this._norm(_);this._normalize(_);const u=Math.abs(this._crossProduct(_,this._sub(r,e)));let o=this._dotProduct(_,this._sub(r,e));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const a=.5*u,n=this._leftPerp(_),p=[e[0]+_[0]*o,e[1]+_[1]*o],d=t.length-1,l=[];l.push(i?[-n[0],-n[1]]:n);let b=[-_[0],-_[1]];for(let P=1;P<d-1;P++){const s=this._sub(t[P+1],t[P]);this._normalize(s);const i=this._dotProduct(s,b),h=this._crossProduct(s,b),e=Math.sqrt((1+i)/2),r=this._sub(s,b);this._normalize(r),r[0]/=e,r[1]/=e,l.push(h<0?[-r[0],-r[1]]:r),b=s}l.push(this._rightPerp(b));for(let P=l.length-1;P>0;P--)s.push([t[P][0]+l[P][0]*a,t[P][1]+l[P][1]*a]);s.push([p[0]+l[0][0]*a,p[1]+l[0][1]*a]),s.push([p[0]+l[0][0]*u,p[1]+l[0][1]*u]),s.push(h),s.push([p[0]-l[0][0]*u,p[1]-l[0][1]*u]),s.push([p[0]-l[0][0]*a,p[1]-l[0][1]*a]);for(let P=1;P<l.length;P++)s.push([t[P][0]-l[P][0]*a,t[P][1]-l[P][1]*a])}_addDash(s,t,i){const h=this._norm(i)/7;this._normalize(i);let e=[];for(let r=0;r<=7;r++)e.push([t[0]+i[0]*r*h,t[1]+i[1]*r*h]),1&r&&(s.push(e),e=[])}_cp2(s,t,i){return s.length>=2?s[1]:this._add2(s[0],t*this._defaultSize,i*this._defaultSize)}_cp3(s,t,i,h){if(s.length>=3)return s[2];const e=this._mix(s[0],1-i,t,i),r=this._sub(t,s[0]);return this._normalize(r),this._rightPerpendicular(r),[e[0]+r[0]*h*this._defaultSize,e[1]+r[1]*h*this._defaultSize]}_arrowPath(s){if(s.length>2)return s;const t=s[0],i=this._cp2(s,-4,0),h=this._sub(t,i);this._normalize(h);const e=this._rightPerp(h);return[t,i,[t[0]+(e[0]-h[0])*this._defaultSize,t[1]+(e[1]-h[1])*this._defaultSize]]}_arrowLastSeg(s){const t=s[0],i=this._cp2(s,-4,0);let h;if(s.length>=3)h=s[s.length-1];else{const s=this._sub(t,i);this._normalize(s);const e=this._rightPerp(s);h=[t[0]+(e[0]-s[0])*this._defaultSize,t[1]+(e[1]-s[1])*this._defaultSize]}return[i,h]}_processGeom(s){if(!s)return null;const t=[];for(const e of s){if(!e||0===e.length)continue;const s=e.length;let r=e[0];switch(this._rule){case h.PerpendicularFromFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=[];h.push(i),h.push(this._mid(r,s)),t.push(h);break}case h.ReversedFirstSegment:{const s=this._cp2(e,0,-1);t.push([s,r]);break}case h.PerpendicularToSecondSegment:{if(e.length<3)return[];const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=[];h.push(this._mid(s,i)),h.push(r),t.push(h);break}case h.SecondSegmentWithTicks:{if(e.length<3)return[];const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);let _;_=this._crossProduct(h,this._sub(r,s))>0?this._rightPerp(h):this._leftPerp(h);const c=[];c.push([s[0]+(_[0]-h[0])/3,s[1]+(_[1]-h[1])/3]),c.push(s),c.push(i),c.push([i[0]+(_[0]+h[0])/3,i[1]+(_[1]+h[1])/3]),t.push(c);break}case h.DoublePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push(r),u.push([i[0]+_[0]*c,i[1]+_[1]*c]),t.push(u);const o=[];o.push([i[0]-_[0]*c,i[1]-_[1]*c]),o.push(s),t.push(o);break}case h.OppositeToFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c,i[1]+_[1]*c]),u.push([i[0]-_[0]*c,i[1]-_[1]*c]),t.push(u);break}case h.TriplePerpendicular:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s),_=this._sub(h,i);this._normalize(_);const c=this._crossProduct(_,this._sub(r,i));this._leftPerpendicular(_);const u=[];u.push([i[0]+_[0]*c*.8,i[1]+_[1]*c*.8]),u.push([h[0]+.8*(r[0]-h[0]),h[1]+.8*(r[1]-h[1])]),t.push(u),t.push([i,h]);const o=[];o.push([i[0]-_[0]*c*.8,i[1]-_[1]*c*.8]),o.push([h[0]+.8*(s[0]-h[0]),h[1]+.8*(s[1]-h[1])]),t.push(o);break}case h.HalfCircleFirstSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,4),h=this._mid(r,s);let _=this._sub(s,r);const c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18),o=Math.sqrt((1+c)/2),a=Math.sqrt((1-c)/2),n=[];let p;this._crossProduct(_,this._sub(i,r))>0?(n.push(r),_=this._sub(r,h),p=s):(n.push(s),_=this._sub(s,h),p=r),this._rotateDirect(_,o,a),_[0]/=o,_[1]/=o;for(let t=1;t<=18;t++)n.push(this._add(h,_)),this._rotateDirect(_,c,u);n.push(p),t.push(n);break}case h.HalfCircleSecondSegment:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,1,-1);let h=this._sub(r,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,s))/2;this._leftPerpendicular(h);const c=[s[0]+h[0]*_,s[1]+h[1]*_];h=this._sub(s,c);const u=Math.cos(Math.PI/18);let o=Math.sin(Math.PI/18);_>0&&(o=-o);const a=[s];for(let t=1;t<=18;t++)this._rotateDirect(h,u,o),a.push(this._add(c,h));t.push(a);break}case h.HalfCircleExtended:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,1,-1);let _;if(s>=4)_=e[3];else{const s=this._sub(r,i);_=this._add(h,s)}const c=this._dist(i,h)/2/.75,u=this._sub(i,r);this._normalize(u,c);const o=this._sub(h,_);this._normalize(o,c);const a=[_,h];t.push(a);const n=[this._clone(h)];this._addBezier3(n,h,this._add(h,o),this._add(i,u),i,4),n.push(r),t.push(n);break}case h.OpenCircle:{const s=this._cp2(e,-2,0),i=this._sub(s,r),h=Math.cos(Math.PI/18),_=-Math.sin(Math.PI/18),c=[s];for(let t=1;t<=33;t++)this._rotateDirect(i,h,_),c.push(this._add(r,i));t.push(c);break}case h.CoverageEdgesWithTicks:{const i=this._cp2(e,0,-1);let h,_;if(s>=3)h=e[2];else{const s=this._sub(i,r),t=this._leftPerp(s);h=[r[0]+t[0]-.25*s[0],r[1]+t[1]-.25*s[1]]}if(s>=4)_=e[3];else{const s=this._mid(r,i),t=this._sub(r,i);this._normalize(t),this._leftPerpendicular(t);const e=this._crossProduct(t,this._sub(h,s));this._rightPerpendicular(t),_=[h[0]+t[0]*e*2,h[1]+t[1]*e*2]}const c=this._sub(i,r);let u,o;u=this._crossProduct(c,this._sub(h,r))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push(h),o.push(r),o.push([r[0]+(u[0]-c[0])/3,r[1]+(u[1]-c[1])/3]),t.push(o),u=this._crossProduct(c,this._sub(_,i))>0?this._rightPerp(c):this._leftPerp(c),o=[],o.push([i[0]+(u[0]+c[0])/3,i[1]+(u[1]+c[1])/3]),o.push(i),o.push(_),t.push(o);break}case h.GapExtentWithDoubleTicks:{const i=this._cp2(e,0,2),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}this._addAngledTicks(t,r,i,this._mid(h,_)),this._addAngledTicks(t,h,_,this._mid(r,i));break}case h.GapExtentMidline:{const i=this._cp2(e,2,0),h=this._cp3(e,i,0,1);let _;if(s>=4)_=e[3];else{const s=this._sub(i,r);_=this._add(h,s)}const c=[];c.push(this._mid(r,h)),c.push(this._mid(i,_)),t.push(c);break}case h.Chevron:{const i=this._cp2(e,-1,-1);let h;if(s>=3)h=e[2];else{const s=this._sub(i,r);this._leftPerpendicular(s),h=this._add(r,s)}t.push([i,this._makeCtrlPt(r),h]);break}case h.PerpendicularWithArc:{const i=this._cp2(e,0,-2),h=this._cp3(e,i,.5,-1),_=this._sub(i,r),c=this._norm(_);_[0]/=c,_[1]/=c;const u=this._crossProduct(_,this._sub(h,r));let o=this._dotProduct(_,this._sub(h,r));o<.05*c?o=.05*c:o>.95*c&&(o=.95*c);const a=[r[0]+_[0]*o,r[1]+_[1]*o];let n=this._leftPerp(_),p=[];if(p.push([a[0]-n[0]*u,a[1]-n[1]*u]),p.push([a[0]+n[0]*u,a[1]+n[1]*u]),t.push(p),s>=4){const s=e[3];let i=this._dotProduct(_,this._sub(s,r));i<.1*c?i=.1*c:i>.9*c&&(i=.9*c);const h=[r[0]+_[0]*i,r[1]+_[1]*i],u=this._crossProduct(_,this._sub(s,r)),o=[];o.push([h[0]-n[0]*u,h[1]-n[1]*u]),o.push([h[0]+n[0]*u,h[1]+n[1]*u]),t.push(o)}const d=[i[0]+n[0]*u,i[1]+n[1]*u];n=this._sub(i,d);const l=Math.cos(Math.PI/18);let b=Math.sin(Math.PI/18);u<0&&(b=-b),p=[r,i];for(let s=1;s<=9;s++)this._rotateDirect(n,l,b),p.push(this._add(d,n));t.push(p);break}case h.ClosedHalfCircle:{const s=this._cp2(e,2,0),i=this._mid(r,s),h=this._sub(s,i),_=Math.cos(Math.PI/18),c=Math.sin(Math.PI/18),u=[r,s];for(let t=1;t<=18;t++)this._rotateDirect(h,_,c),u.push(this._add(i,h));t.push(u);break}case h.TripleParallelExtended:{const s=this._cp2(e,0,-2),h=this._cp3(e,s,1,-2),_=this._mid(r,s),c=this._sub(h,s);this._normalize(c);const u=Math.abs(this._crossProduct(c,this._sub(_,s)))/2,o=this._dist(s,h),a=[s,r];a.push([r[0]+c[0]*o*.5,r[1]+c[1]*o*.5]),t.push(a);const n=[];n.push([_[0]-c[0]*u,_[1]-c[1]*u]),n.push([_[0]+c[0]*o*.375,_[1]+c[1]*o*.375]),i(n[n.length-1],1),n.push([_[0]+c[0]*o*.75,_[1]+c[1]*o*.75]),t.push(n);const p=[s,h];t.push(p);break}case h.ParallelWithTicks:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(i,s);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),this._addAngledTicks(t,r,s,i),this._addAngledTicks(t,this._mix(r,1,h,_),this._mix(s,1,h,_),this._mid(r,s));break}case h.Parallel:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._leftPerp(h),c=this._crossProduct(h,this._sub(i,r));let u=[r,s];t.push(u),u=[],u.push([r[0]+_[0]*c,r[1]+_[1]*c]),u.push([s[0]+_[0]*c,s[1]+_[1]*c]),t.push(u);break}case h.PerpendicularToFirstSegment:{const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._mid(r,s),_=this._sub(s,r);this._normalize(_);const c=this._crossProduct(_,this._sub(i,r));this._leftPerpendicular(_);const u=[];u.push([h[0]-_[0]*c*.25,h[1]-_[1]*c*.25]),u.push([h[0]+_[0]*c*1.25,h[1]+_[1]*c*1.25]),t.push(u);break}case h.ParallelOffset:{if(e.length<3)return[];const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);const u=[];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(u);break}case h.OffsetOpposite:{if(e.length<3)return[];const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]-h[0]*_,r[1]-h[1]*_]),c.push([s[0]-h[0]*_,s[1]-h[1]*_]),t.push(c);break}case h.OffsetSame:{if(e.length<3)return[];const s=this._cp2(e,3,0),i=this._cp3(e,s,.5,-1),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h);const c=[];c.push([r[0]+h[0]*_,r[1]+h[1]*_]),c.push([s[0]+h[0]*_,s[1]+h[1]*_]),t.push(c);break}case h.CircleWithArc:{let h=this._cp2(e,3,0);const _=this._cp3(e,h,.5,-1);let c,u;if(s>=4)c=e[3],u=this._crossProduct(this._sub(c,h),this._sub(_,h))>0;else{c=h,u=this._crossProduct(this._sub(c,r),this._sub(_,r))>0;const s=24*this._geomUnitsPerPoint,t=this._sub(c,r);this._normalize(t,s);const i=Math.sqrt(2)/2;this._rotateDirect(t,i,u?i:-i),h=this._add(r,t)}const o=this._sub(h,r),a=Math.cos(Math.PI/18),n=Math.sin(Math.PI/18),p=[h];for(let s=1;s<=36;s++)this._rotateDirect(o,a,n),p.push(this._add(r,o));this._add90DegArc(p,h,c,_,u),i(p[p.length-8],1),t.push(p);break}case h.DoubleJog:{let i,h=this._cp2(e,-3,1),_=this._cp3(e,h,-1,-.5);if(s>=4)i=e[3];else{const s=r;r=h,i=_;const t=this._dist(r,s),e=this._dist(i,s);let c=30*this._geomUnitsPerPoint;.5*t<c&&(c=.5*t),.5*e<c&&(c=.5*e),h=this._mix(r,c/t,s,(t-c)/t),_=this._mix(i,c/e,s,(e-c)/e)}const c=this._mid(r,h),u=this._mid(i,_),o=this._dist(r,h),a=this._dist(_,i);let n=Math.min(o,a)/8;n=Math.min(n,24*this._geomUnitsPerPoint);const p=Math.cos(Math.PI/4);let d=this._sub(r,h);this._normalize(d,n),this._crossProduct(d,this._sub(i,h))>0?this._rotateDirect(d,p,-p):this._rotateDirect(d,p,p);let l=[];l.push(h),l.push(this._add(c,d)),l.push(this._sub(c,d)),l.push(r),t.push(l),d=this._sub(i,_),this._normalize(d,n),this._crossProduct(d,this._sub(r,_))<0?this._rotateDirect(d,p,p):this._rotateDirect(d,p,-p),l=[],l.push(_),l.push(this._add(u,d)),l.push(this._sub(u,d)),l.push(i),t.push(l);break}case h.PerpendicularOffset:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_);t.push([c,r]);break}case h.LineExcludingLastSegment:{const s=this._arrowPath(e),i=[];let h=s.length-2;for(;h--;)i.push(s[h]);t.push(i);break}case h.MultivertexArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!1),t.push(i);break}case h.CrossedArrow:{const s=this._arrowPath(e),i=[];this._addArrow(i,s,!0),t.push(i);break}case h.ChevronArrow:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);const u=this._crossProduct(_,this._sub(i,s));let o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const a=[s[0]+_[0]*o,s[1]+_[1]*o],n=this._leftPerp(_),p=[];p.push([a[0]+n[0]*u+_[0]*h,a[1]+n[1]*u+_[1]*h]),p.push(r),p.push([a[0]-n[0]*u+_[0]*h,a[1]-n[1]*u+_[1]*h]),t.push(p);break}case h.ChevronArrowOffset:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);const c=this._crossProduct(h,this._sub(i,s));let u=this._dotProduct(h,this._sub(i,s));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=[s[0]+h[0]*u,s[1]+h[1]*u];this._leftPerpendicular(h);const a=[];a.push([o[0]+h[0]*c*.5,o[1]+h[1]*c*.5]),a.push(this._mid(o,r)),a.push([o[0]-h[0]*c*.5,o[1]-h[1]*c*.5]),t.push(a);break}case h.PartialFirstSegment:{const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);let c=this._dotProduct(h,this._sub(i,s));c<.05*_?c=.05*_:c>.95*_&&(c=.95*_);const u=[s[0]+h[0]*c,s[1]+h[1]*c];t.push([s,u]);break}case h.Arch:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=this._sub(r,s),_=this._mix(i,1,h,.55),c=this._mix(i,1,h,-.55),u=[r];this._addBezier2(u,r,_,i,4),this._addBezier2(u,i,c,s,4),t.push(u);break}case h.CurvedParallelTicks:{const s=this._cp2(e,-4,1),i=this._cp3(e,s,.882353,-1.94),h=this._sub(i,s);this._crossProduct(h,this._sub(r,s))>0?this._rightPerpendicular(h):this._leftPerpendicular(h);const _=[h[0]/8,h[1]/8],c=this._sub(this._mid(s,i),_),u=this._sub(this._mix(s,.75,i,.25),_),o=this._sub(this._mix(s,.25,i,.75),_),a=[s];this._addBezier2(a,s,u,c,3),this._addBezier2(a,c,o,i,3),t.push(a);for(let e=0;e<8;e++){const s=a[2*e+1],i=[this._clone(s)];i.push(this._add(s,[h[0]/4,h[1]/4])),t.push(i)}break}case h.Arc90Degrees:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,1),h=[s];this._add90DegArc(h,s,r,i),t.push(h);break}case h.TipWithPerpendicularAndTicks:{const[s,i]=this._arrowLastSeg(e),h=10*this._geomUnitsPerPoint,_=this._sub(r,s),c=this._norm(_);this._normalize(_);let u=this._crossProduct(_,this._sub(i,s)),o=this._dotProduct(_,this._sub(i,s));o<.05*c?o=.05*c:o>.95*c-h&&(o=.95*c-h);const a=this._leftPerp(_),n=[r[0]-_[0]*h,r[1]-_[1]*h],p=.5*Math.max(c-o-h,h);u=Math.abs(u);const d=[];d.push([n[0]+a[0]*(u+p)-_[0]*p,n[1]+a[1]*(u+p)-_[1]*p]),d.push([n[0]+a[0]*u,n[1]+a[1]*u]),d.push([n[0]-a[0]*u,n[1]-a[1]*u]),d.push([n[0]-a[0]*(u+p)-_[0]*p,n[1]-a[1]*(u+p)-_[1]*p]),t.push(d),t.push([n,r]);break}case h.ConcentricCircles:{const h=this._cp2(e,1,0),_=this._cp3(e,h,2,0),c=Math.cos(Math.PI/18),u=Math.sin(Math.PI/18);let o=this._dist(h,r),a=[o,0],n=[];for(let s=0;s<=36;s++)n.push(this._add(r,a)),this._rotateDirect(a,c,u);if(t.push(n),s>=4){n=[];const s=e[3];o=this._dist(s,r),a=[o,0];for(let t=0;t<=36;t++)n.push(this._add(r,a)),0===t&&(n.push(this._add(r,a)),i(n[1],1)),this._rotateDirect(a,c,u);t.push(n)}n=[],o=this._dist(_,r),a=[o,0];for(let s=0;s<=36;s++)n.push(this._add(r,a)),this._rotateDirect(a,c,u);t.push(n);break}case h.DoubleJogArrow:{r=this._arrowPath(e)[0];const[s,i]=this._arrowLastSeg(e),h=this._sub(r,s),_=this._norm(h);this._normalize(h);const c=Math.abs(this._crossProduct(h,this._sub(i,r)));let u=Math.abs(this._dotProduct(h,this._sub(i,r)));u<.05*_?u=.05*_:u>.95*_&&(u=.95*_);const o=Math.max(c,u),a=this._leftPerp(h);let n=[];const p=[r[0]-h[0]*u*.5+a[0]*c*.5,r[1]-h[1]*u*.5+a[1]*c*.5];n.push([p[0],p[1]]),p[0]+=h[0]*o*.5+a[0]*o*.4,p[1]+=h[1]*o*.5+a[1]*o*.4,n.push([p[0],p[1]]),p[0]-=a[0]*o*.25,p[1]-=a[1]*o*.25,n.push([p[0],p[1]]),p[0]+=h[0]*o*.5+a[0]*o*.4,p[1]+=h[1]*o*.5+a[1]*o*.4,n.push([p[0],p[1]]),t.push(n),n=[],p[0]=r[0]-h[0]*u*.5-a[0]*c*.5,p[1]=r[1]-h[1]*u*.5-a[1]*c*.5,n.push([p[0],p[1]]),p[0]+=h[0]*o*.5-a[0]*o*.4,p[1]+=h[1]*o*.5-a[1]*o*.4,n.push([p[0],p[1]]),p[0]+=a[0]*o*.25,p[1]+=a[1]*o*.25,n.push([p[0],p[1]]),p[0]+=h[0]*o*.5-a[0]*o*.4,p[1]+=h[1]*o*.5-a[1]*o*.4,n.push([p[0],p[1]]),t.push(n);break}case h.LinkedChevrons:{const s=this._cp2(e,-5,0),i=this._cp3(e,s,-.2,1),h=this._sub(r,s);this._normalize(h);const _=this._leftPerp(h),c=Math.abs(this._crossProduct(h,this._sub(i,s)));t.push([s,r]);const u=[];u.push([r[0]-h[0]*c+_[0]*c,r[1]-h[1]*c+_[1]*c]),u.push(r),u.push([r[0]-h[0]*c-_[0]*c,r[1]-h[1]*c-_[1]*c]),t.push(u),this._addDash(t,s,[-h[0]*c+_[0]*c,-h[1]*c+_[1]*c]),this._addDash(t,s,[-h[0]*c-_[0]*c,-h[1]*c-_[1]*c]);break}case h.SegmentThenHalfCircle:{const i=this._cp2(e,2,0),h=this._cp3(e,i,1.5,0);let _;_=s>=4?e[3]:this._cp3(e,i,1.25,-.5);const c=this._sub(i,r);this._normalize(c);const u=.5*this._dist(i,h),o=this._crossProduct(c,this._sub(_,r))>0,a=Math.cos(Math.PI/18);let n=Math.sin(Math.PI/18);o&&(n=-n);const p=[r,i];c[0]*=u,c[1]*=u;const d=this._add(i,c);c[0]=-c[0],c[1]=-c[1];for(let s=1;s<=18;s++)this._rotateDirect(c,a,n),p.push(this._add(d,c));t.push(p);break}case h.LineWithStraightTicks:{const s=this._cp2(e,-2,1),i=this._cp3(e,s,-1,-.5),h=this._sub(i,s);this._normalize(h);const _=this._dotProduct(h,this._sub(s,r)),c=this._dotProduct(h,this._sub(i,r));let u=[r];u.push([r[0]+h[0]*_,r[1]+h[1]*_]),u.push(s),t.push(u),u=[r],u.push([r[0]+h[0]*c,r[1]+h[1]*c]),u.push(i),t.push(u);break}case h.DoubleCurve:{const s=this._cp2(e,-5,-1),h=this._cp3(e,s,2,0),_=Math.atan2(1,5),c=Math.cos(_),u=Math.sin(_),o=this._sub(s,r),a=this._dist(r,s);this._normalize(o),this._rotateDirect(o,c,-u);const n=[r];n.push([r[0]+o[0]*a*.5,r[1]+o[1]*a*.5]),i(n[1],1),n.push([r[0]+o[0]*a*.8,r[1]+o[1]*a*.8]),this._addBezier2(n,n[2],[r[0]+o[0]*a,r[1]+o[1]*a],s,3);const p=this._sub(h,s),d=this._dist(s,h);this._normalize(p),this._rotateDirect(p,c,-u),this._addBezier2(n,s,[h[0]-p[0]*d,h[1]-p[1]*d],[h[0]-p[0]*d*.8,h[1]-p[1]*d*.8],3),n.push(h),t.push(n);break}case h.ParallelWithTicksByWidth:{const s=this._cp2(e,0,-1),i=this._cp3(e,s,.5,3),h=this._sub(s,r);this._normalize(h);const _=this._crossProduct(h,this._sub(i,r));this._leftPerpendicular(h),_>0?(this._addAngledTicks(t,r,[r[0]+h[0]*_,r[1]+h[1]*_],s),this._addAngledTicks(t,s,[s[0]+h[0]*_,s[1]+h[1]*_],r)):(this._addAngledTicks(t,[r[0]+h[0]*_,r[1]+h[1]*_],r,s),this._addAngledTicks(t,[s[0]+h[0]*_,s[1]+h[1]*_],r,s));break}case h.EnclosingRoundedRectangle:{const s=this._cp2(e,3,-2),t=[Math.min(r[0],s[0]),Math.max(r[1],s[1])],i=[Math.max(r[0],s[0]),Math.min(r[1],s[1])],h=i[0]-t[0],_=t[1]-i[1],c=Math.min(h,_)/10,u=[];u.push([t[0]+c+.75*(h-2*c),t[1]]),u.push([i[0]-c,t[1]]),this._add90DegArc(u,[i[0]-c,t[1]],[i[0],t[1]-c],[i[0],t[1]]),u.push([i[0],i[1]+c]),this._add90DegArc(u,[i[0],i[1]+c],[i[0]-c,i[1]],i),u.push([t[0]+c,i[1]]),this._add90DegArc(u,[t[0]+c,i[1]],[t[0],i[1]+c],[t[0],i[1]]),u.push([t[0],t[1]-c]),this._add90DegArc(u,[t[0],t[1]-c],[t[0]+c,t[1]],t),u.push([t[0]+c+.75*(h-2*c),t[1]]);break}case h.FullGeometry:default:t.push(e)}}return t}}export{e as EffectControlMeasureLine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as t}from"../../../../core/maybe.js";import{estimateSize as e}from"../../../../core/typedArrayUtil.js";import"../../tiling/TileInfoView.js";import r from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{BucketType as n}from"./enums.js";import{deserializeSymbols as
|
|
5
|
+
import{disposeMaybe as t}from"../../../../core/maybe.js";import{estimateSize as e}from"../../../../core/typedArrayUtil.js";import"../../tiling/TileInfoView.js";import r from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{BucketType as n}from"./enums.js";import{deserializeSymbols as i}from"./decluttering/util.js";import{BufferObject as s}from"../../../webgl/BufferObject.js";import{Usage as a}from"../../../webgl/enums.js";import{VertexArrayObject as o}from"../../../webgl/VertexArrayObject.js";class h{constructor(t,e){this.layerUIDs=[],this.isDestroyed=!1,this._data=t;let r=1;const n=new Uint32Array(t);this.layerUIDs=[];const i=n[r++];for(let s=0;s<i;s++)this.layerUIDs[s]=n[r++];this.bufferDataOffset=r,e&&(this.layer=e.getStyleLayerByUID(this.layerUIDs[0]))}get isPreparedForRendering(){return null==this._data}get offset(){return this.bufferDataOffset}get data(){return this._data}destroy(){this.isDestroyed||(this.doDestroy(),this._data=null,this.isDestroyed=!0)}prepareForRendering(t){null!=this._data&&(this.doPrepareForRendering(t,this._data,this.bufferDataOffset),this._data=null)}}class c extends h{constructor(t,e){super(t,e),this.type=n.LINE,this.lineIndexStart=0,this.lineIndexCount=0;const r=new Uint32Array(t);let i=this.bufferDataOffset;this.lineIndexStart=r[i++],this.lineIndexCount=r[i++];const s=r[i++];if(s>0){this.patternMap=new Map;for(let t=0;t<s;t++){const t=r[i++],e=r[i++],n=r[i++];this.patternMap.set(t,[e,n])}}this.bufferDataOffset=i}get usedMemory(){return(this.data?.byteLength??0)+(this.vao?.cachedMemory??0)}hasData(){return this.lineIndexCount>0}triangleCount(){return this.lineIndexCount/3}doDestroy(){this.vao=t(this.vao)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),i=new Int32Array(n.buffer),h=n[r++],c=s.createVertex(t,a.STATIC_DRAW,new Int32Array(i.buffer,4*r,h));r+=h;const l=n[r++],f=s.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,l));r+=l;const u=this.layer.lineMaterial;this.vao=new o(t,u.getAttributeLocations(),u.getLayoutInfo(),new Map([["geometry",c]]),f)}}class l extends h{constructor(t,e){super(t,e),this.type=n.FILL,this.fillIndexStart=0,this.fillIndexCount=0,this.outlineIndexStart=0,this.outlineIndexCount=0;const r=new Uint32Array(t);let i=this.bufferDataOffset;this.fillIndexStart=r[i++],this.fillIndexCount=r[i++],this.outlineIndexStart=r[i++],this.outlineIndexCount=r[i++];const s=r[i++];if(s>0){this.patternMap=new Map;for(let t=0;t<s;t++){const t=r[i++],e=r[i++],n=r[i++];this.patternMap.set(t,[e,n])}}this.bufferDataOffset=i}get usedMemory(){return(this.data?.byteLength??0)+(this.fillVAO?.cachedMemory??0)+(this.outlineVAO?.cachedMemory??0)}hasData(){return this.fillIndexCount>0||this.outlineIndexCount>0}triangleCount(){return(this.fillIndexCount+this.outlineIndexCount)/3}doDestroy(){this.fillVAO=t(this.fillVAO),this.outlineVAO=t(this.outlineVAO)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),i=new Int32Array(n.buffer),h=n[r++],c=s.createVertex(t,a.STATIC_DRAW,new Int32Array(i.buffer,4*r,h));r+=h;const l=n[r++],f=s.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,l));r+=l;const u=n[r++],y=s.createVertex(t,a.STATIC_DRAW,new Int32Array(i.buffer,4*r,u));r+=u;const d=n[r++],A=s.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,d));r+=d;const p=this.layer,I=p.fillMaterial,g=p.outlineMaterial;this.fillVAO=new o(t,I.getAttributeLocations(),I.getLayoutInfo(),new Map([["geometry",c]]),f),this.outlineVAO=new o(t,g.getAttributeLocations(),g.getLayoutInfo(),new Map([["geometry",y]]),A)}}class f extends h{constructor(t,e,s){super(t,e),this.type=n.SYMBOL,this.iconPerPageElementsMap=new Map,this.glyphPerPageElementsMap=new Map,this.symbolInstances=[],this.isIconSDF=!1,this.opacityChanged=!1,this.lastOpacityUpdate=0,this.symbols=[];const a=new Uint32Array(t),o=new Int32Array(t),h=new Float32Array(t);let c=this.bufferDataOffset;this.isIconSDF=!!a[c++];const l=a[c++],f=a[c++],u=a[c++],y=new r(l,f,u,0),d=a[c++];for(let r=0;r<d;r++){const t=a[c++],e=a[c++],r=a[c++];this.iconPerPageElementsMap.set(t,[e,r])}const A=a[c++];for(let r=0;r<A;r++){const t=a[c++],e=a[c++],r=a[c++];this.glyphPerPageElementsMap.set(t,[e,r])}const p=a[c++],I=a[c++];this.iconOpacity=new Int32Array(p),this.textOpacity=new Int32Array(I),c=i(a,o,h,c,this.symbols,s,y),this.bufferDataOffset=c}get usedMemory(){return(this.data?.byteLength??0)+(this.iconVAO?.cachedMemory??0)+(this.textVAO?.cachedMemory??0)+e(this.iconOpacity)+e(this.textOpacity)}hasData(){return this.iconPerPageElementsMap.size>0||this.glyphPerPageElementsMap.size>0}triangleCount(){let t=0;for(const e of this.iconPerPageElementsMap.values())t+=e[1];for(const e of this.glyphPerPageElementsMap.values())t+=e[1];return t/3}doDestroy(){this.iconVAO=t(this.iconVAO),this.textVAO=t(this.textVAO)}updateOpacityInfo(){if(!this.opacityChanged)return;this.opacityChanged=!1;const t=this.iconOpacity,e=this.iconVAO.vertexBuffers.get("opacity");t.length>0&&t.byteLength===e.usedMemory&&e.setSubData(t,0,0,t.length);const r=this.textOpacity,n=this.textVAO.vertexBuffers.get("opacity");r.length>0&&r.byteLength===n.usedMemory&&n.setSubData(r,0,0,r.length)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),i=new Int32Array(n.buffer),h=n[r++],c=s.createVertex(t,a.STATIC_DRAW,new Int32Array(i.buffer,4*r,h));r+=h;const l=n[r++],f=s.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,l));r+=l;const u=n[r++],y=s.createVertex(t,a.STATIC_DRAW,new Int32Array(i.buffer,4*r,u));r+=u;const d=n[r++],A=s.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,d));r+=d;const p=s.createVertex(t,a.STATIC_DRAW,this.iconOpacity.buffer),I=s.createVertex(t,a.STATIC_DRAW,this.textOpacity.buffer),g=this.layer,x=g.iconMaterial,b=g.textMaterial;this.iconVAO=new o(t,x.getAttributeLocations(),x.getLayoutInfo(),new Map([["geometry",c],["opacity",p]]),f),this.textVAO=new o(t,b.getAttributeLocations(),b.getLayoutInfo(),new Map([["geometry",y],["opacity",I]]),A)}}class u extends h{constructor(t,e){super(t,e),this.type=n.CIRCLE,this.circleIndexStart=0,this.circleIndexCount=0;const r=new Uint32Array(t);let i=this.bufferDataOffset;this.circleIndexStart=r[i++],this.circleIndexCount=r[i++],this.bufferDataOffset=i}get usedMemory(){return(this.data?.byteLength??0)+(this.vao?.cachedMemory??0)}hasData(){return this.circleIndexCount>0}triangleCount(){return this.circleIndexCount/3}doDestroy(){this.vao=t(this.vao)}doPrepareForRendering(t,e,r){const n=new Uint32Array(e),i=new Int32Array(n.buffer),h=n[r++],c=s.createVertex(t,a.STATIC_DRAW,new Int32Array(i.buffer,4*r,h));r+=h;const l=n[r++],f=s.createIndex(t,a.STATIC_DRAW,new Uint32Array(n.buffer,4*r,l));r+=l;const u=this.layer.circleMaterial;this.vao=new o(t,u.getAttributeLocations(),u.getLayoutInfo(),new Map([["geometry",c]]),f)}}export{u as CircleRenderBucket,l as FillRenderBucket,c as LineRenderBucket,h as RenderBucketBase,f as SymbolRenderBucket};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as
|
|
5
|
+
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as o}from"../../../../geometry/support/aaBoundingRect.js";import{TileHandler as s}from"./TileHandler.js";import{VectorTile as r}from"./VectorTile.js";import n from"../../tiling/TileInfoViewPOT.js";import l from"../../tiling/TileKey.js";class a extends s{constructor(e,t,i,o){super(e,t,i,e.tileInfo.lods.length-1),this._memCache=o,this._ongoingTileRequests=new Map,this._ongoingRequestToController=new Map,this._tileInfoView=new n(e.tileInfo,e.fullExtent)}destroy(){super.destroy(),this._ongoingRequestToController.forEach((e=>e.abort())),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear()}async getVectorTile(s,n){const a=new l(s[0],s[1],s[2],0);let g=this._memCache.get(a.id);if(g)return g.retain(),g;const h=await this._getVectorTileData(a);if(t(n),!this._layer)return null;if(g=this._memCache.get(a.id),g)return g.retain(),g;const c=this._layer.tileInfo.getTileBounds(o(),a),m=this._tileInfoView.getTileResolution(s[0]);return g=new r(a,m,c[0],c[3],512,512,this._styleRepository,this._memCache),g.setData(h),h&&(g.retain(),this._memCache.put(a.id,g,e)),g.neededForCoverage=!0,g.transforms.tileUnitsToPixels=i(1/8,0,0,0,1/8,0,0,0,1),g}_getVectorTileData(e){const t=e.id;if(this._ongoingTileRequests.has(t))return this._ongoingTileRequests.get(t);const i=new AbortController,o={signal:i.signal},s=this._getParsedVectorTileData(e,o).then((e=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),e))).catch((()=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),null)));return this._ongoingTileRequests.set(t,s),this._ongoingRequestToController.set(t,i),s}_getParsedVectorTileData(e,t){return this.fetchTileData(e,t).then((i=>this.parseTileData({key:e,data:i},t)))}}export{a 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{identity as e,translate as t,rotate as s,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{BucketType as i}from"./enums.js";import{CircleRenderBucket as o,SymbolRenderBucket as h,LineRenderBucket as n,FillRenderBucket as l}from"./RenderBucket.js";import{fadeDuration as c}from"./decluttering/config.js";import{TiledDisplayObject as d}from"../webgl/TiledDisplayObject.js";const u=null;class y extends d{constructor(e,t,s,r,a,i,o,h=null){super(e,t,s,r,a,i,4096,4096),this.styleRepository=o,this._memCache=h,this.type="vector-tile",this._referenced=1,this._hasSymbolBuckets=!1,this._usedMemory=256,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this.featureIndex=null,this.triangleCount=0,this._processed=!1,this.id=e.id}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<c}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<c)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e){const e=this.layerData.get(s);e&&(this._usedMemory-=e.usedMemory,e.type===i.SYMBOL&&this.symbols.delete(s)&&(t=!0),e.destroy(),this.layerData.delete(s))}this._memCache?.updateSize(this.key.id,this
|
|
5
|
+
import"../../../../core/has.js";import{identity as e,translate as t,rotate as s,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{BucketType as i}from"./enums.js";import{CircleRenderBucket as o,SymbolRenderBucket as h,LineRenderBucket as n,FillRenderBucket as l}from"./RenderBucket.js";import{fadeDuration as c}from"./decluttering/config.js";import{TiledDisplayObject as d}from"../webgl/TiledDisplayObject.js";const u=null;class y extends d{constructor(e,t,s,r,a,i,o,h=null){super(e,t,s,r,a,i,4096,4096),this.styleRepository=o,this._memCache=h,this.type="vector-tile",this._referenced=1,this._hasSymbolBuckets=!1,this._usedMemory=256,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this.featureIndex=null,this.triangleCount=0,this._processed=!1,this.id=e.id}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<c}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<c)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e){const e=this.layerData.get(s);e&&(this._usedMemory-=e.usedMemory,e.type===i.SYMBOL&&this.symbols.delete(s)&&(t=!0),e.destroy(),this.layerData.delete(s))}this._memCache?.updateSize(this.key.id,this),t&&(this.featureIndex?.clear(),this.emit("symbols-changed")),this.requestRender()}processed(){return this._processed}hasData(){return this.layerData.size>0}hasFeatures(){const e=this.layerData.values();for(const t of e)if(t.hasData())return!0;return!1}dispose(){"unloaded"!==this.status&&(y._destroyRenderBuckets(this.layerData),this.layerData.clear(),this.featureIndex=null,this._usedMemory=0,this.destroy(),this.status="unloaded")}release(){0==--this._referenced&&(this.dispose(),this.stage=null)}retain(){++this._referenced}get cachedMemory(){return this._usedMemory}get usedMemory(){return this._usedMemory}get usedMemoryPerReference(){return this._usedMemory/(this._referenced||1)}changeDataImpl(e){this.featureIndex?.clear();let t=!1;if(e){const{bucketsWithData:s,emptyBuckets:r}=e,a=this._createRenderBuckets(s);if(r&&r.byteLength>0){const e=new Uint32Array(r);for(const t of e)this._deleteLayerData(t)}for(const[e,o]of a)this._deleteLayerData(e),o.type===i.SYMBOL&&(this.symbols.set(e,o.symbols),t=!0),this._usedMemory+=o.usedMemory,this.layerData.set(e,o);this._memCache?.updateSize(this.key.id,this)}this._hasSymbolBuckets=!1;for(const s of this.layerData.values())s.type===i.SYMBOL&&(this._hasSymbolBuckets=!0);t&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(e){e.processDetach()},untrashDisplayObject:()=>!1}}setTransform(a){super.setTransform(a);const i=this.resolution/(a.resolution*a.pixelRatio),o=this.width/this.rangeX*i,h=this.height/this.rangeY*i,n=[0,0];a.toScreen(n,[this.x,this.y]);const l=this.transforms.tileUnitsToPixels;e(l),t(l,l,n),s(l,l,Math.PI*a.rotation/180),r(l,l,[o,h,1])}_createTransforms(){return{displayViewScreenMat3:a(),tileMat3:a(),tileUnitsToPixels:a()}}static _destroyRenderBuckets(e){if(!e)return;const t=new Set;for(const s of e.values())t.has(s)||(s.destroy(),t.add(s));e.clear()}_createRenderBuckets(e){const t=new Map,s=new Map;for(const r of e){const e=this._deserializeBucket(r,s);for(const s of e.layerUIDs)t.set(s,e)}return t}_deserializeBucket(e,t){let s=t.get(e);if(s)return s;switch(new Uint32Array(e)[0]){case i.FILL:s=new l(e,this.styleRepository);break;case i.LINE:s=new n(e,this.styleRepository);break;case i.SYMBOL:s=new h(e,this.styleRepository,this);break;case i.CIRCLE:s=new o(e,this.styleRepository)}return t.set(e,s),s}_deleteLayerData(e){if(!this.layerData.has(e))return;const t=this.layerData.get(e);this._usedMemory-=t.usedMemory,t.destroy(),this.layerData.delete(e)}}export{y as VectorTile,u as tracer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{minMaxZoomPrecisionFactor as t}from"../../../definitions.js";import{AAnimatedMeshWriter as i,packAnimatedBitset as r}from"./AnimatedMeshWriter.js";import{getMinMaxZoom as s}from"../fill/meshWriterUtils.js";import{DataType as o}from"../../../../../../webgl/enums.js";class
|
|
5
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{minMaxZoomPrecisionFactor as t}from"../../../definitions.js";import{AAnimatedMeshWriter as i,packAnimatedBitset as r}from"./AnimatedMeshWriter.js";import{getMinMaxZoom as s}from"../fill/meshWriterUtils.js";import{c256ToRad as n}from"../shaders/constants.js";import{DataType as o}from"../../../../../../webgl/enums.js";class a extends i{get vertexSpec(){return{createComputedParams:t=>{let{pixelDimensions:i,texelDimensions:r,baseSize:s,referenceSize:n,strokeWidth:o}=t;i||(i=t.sprite.sdf?[0,0]:[t.sprite.width,t.sprite.height]),r||(r=t.sprite.sdf?[0,0]:i),s=e(s),n=e(n),o=e(o);return{...t,pixelDimensions:i,texelDimensions:r,baseSize:s,referenceSize:n,strokeWidth:o}},optionalAttributes:{zoomRange:{type:o.SHORT,count:2,packPrecisionFactor:t,pack:({scaleInfo:e},{tileInfo:t})=>s(e,t)}},attributes:{id:{type:o.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:o.UNSIGNED_BYTE,count:1,pack:r},pos:{type:o.SHORT,count:2,pack:"position",packPrecisionFactor:1},offset:{type:o.FLOAT,count:2,packAlternating:{count:4,pack:e=>{const t=e.texelDimensions;return[[-.5*t[0],-.5*t[1]],[.5*t[0],-.5*t[1]],[-.5*t[0],.5*t[1]],[.5*t[0],.5*t[1]]]}}},uv:{type:o.SHORT,count:2,packPrecisionFactor:1,packAlternating:{count:4,packTessellation:({texXmax:e,texXmin:t,texYmax:i,texYmin:r})=>[[t,r],[e,r],[t,i],[e,i]]}},animationPointerAndBaseSizeAndReferenceSize:{type:o.UNSIGNED_SHORT,count:4,packPrecisionFactor:1,pack:({animations:e,baseSize:t,referenceSize:i})=>[e.dataColumn,e.dataRow,t,i]},sizing:{type:o.UNSIGNED_SHORT,count:4,packPrecisionFactor:8,pack:({strokeWidth:e,pixelDimensions:t,baseSize:i,sprite:r})=>{const s=Math.max(i*r.width/r.height,i),n=r.sdfDecodeCoeff*s;return[t[0],t[1],e,n]}},angle:{type:o.BYTE,count:1,packTessellation:({angle:e})=>e}}}}_write(e,t){const i=this.evaluatedMeshParams.sprite,{textureBinding:r}=i;e.recordStart(this.instanceId,this.attributeLayout,r);const s=t.getDisplayId();if("esriGeometryPolygon"===t.geometryType){const i=t.readCentroidForDisplay();if(!i)return;const[r,n]=i.coords;this._writeQuad(e,s,r,n)}else if("esriGeometryPoint"===t.geometryType){const i=t.readXForDisplay(),r=t.readYForDisplay();this._writeQuad(e,s,i,r)}else{const i=t.readGeometryForDisplay();if(i){const{angleToLine:t}=this.evaluatedMeshParams;if(t){let t=!0,r=null,o=null;i.forEachVertex(((i,a)=>{if(null!=r&&null!=o){const c=Math.atan2(a-o,i-r)/n;t&&(this._writeQuad(e,s,r,o,c),t=!1),this._writeQuad(e,s,i,a,c)}r=i,o=a}))}else i.forEachVertex(((t,i)=>{this._writeQuad(e,s,t,i)}))}}e.recordEnd()}_writeQuad(e,t,i,r,s=0){const n=this.evaluatedMeshParams.sprite,{rect:o}=n,a=o.x+2,c=o.y+2,p=o.x+o.width-2,d=o.y+o.height-2,l=e.vertexCount();e.recordBounds(i,r,64,64);const m={texXmin:a,texYmin:c,texXmax:p,texYmax:d,angle:s};for(let u=0;u<4;u++)this._writeVertex(e,t,i,r,m);e.indexEnsureSize(6),e.indexWrite(l),e.indexWrite(l+1),e.indexWrite(l+2),e.indexWrite(l+1),e.indexWrite(l+3),e.indexWrite(l+2)}}export{a as AnimatedMarkerMeshWriter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{animationDebugFlags as i}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{location as s,ComputeVertexInput as o,input as r}from"../../GraphShaderModule.js";import{cond as l,Float as a,equal as n,Mat2 as d,cos as u,sin as m,or as p,Bool as h,Vec4 as c,mix as x,Mat3 as y,ifElse as v,lessThan as f,Vec3 as S,distance as w,greaterThan as b,Vec2 as g,negate as z,step as P}from"../../graph/glsl.js";import{AAnimatedVertexInput as _,AAnimatedFragmentInput as V,AAnimatedShader as C,getValue as N}from"./AnimatedShader.js";import{AnimationParamIndex as k}from"./enums.js";import{MarkerConstants as D}from"../markers/markerConstants.js";import{distPointTriangle as
|
|
5
|
+
import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{animationDebugFlags as i}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{location as s,ComputeVertexInput as o,input as r}from"../../GraphShaderModule.js";import{cond as l,Float as a,equal as n,Mat2 as d,cos as u,sin as m,or as p,Bool as h,Vec4 as c,mix as x,Mat3 as y,ifElse as v,lessThan as f,Vec3 as S,distance as w,greaterThan as b,Vec2 as g,negate as z,step as P}from"../../graph/glsl.js";import{AAnimatedVertexInput as _,AAnimatedFragmentInput as V,AAnimatedShader as C,getValue as N}from"./AnimatedShader.js";import{AnimationParamIndex as k}from"./enums.js";import{MarkerConstants as D}from"../markers/markerConstants.js";import{c256ToRad as M}from"../shaders/constants.js";import{distPointTriangle as j,xyToBarycentric as F,inTriangle as R,failHittest as U}from"../shaders/hittestUtils.js";import{getBit as T,getBitBool as q}from"../shaders/utils.js";import{getVisualVariableSize as A,getVisualVariableColor as I,getVisualVariableOpacity as O}from"../shaders/vvUtils.js";class W extends _{}t([s(5,g)],W.prototype,"offset",void 0),t([s(6,g)],W.prototype,"uv",void 0),t([s(7,c)],W.prototype,"sizing",void 0),t([s(8,a)],W.prototype,"angle",void 0);class B extends o{}t([s(12,g)],B.prototype,"offsetNextVertex1",void 0),t([s(13,g)],B.prototype,"offsetNextVertex2",void 0),t([s(14,g)],B.prototype,"textureUVNextVertex1",void 0),t([s(15,g)],B.prototype,"textureUVNextVertex2",void 0);class E extends V{}function G(t,e,i,s){return e.multiply(t.x).add(i.multiply(t.y)).add(s.multiply(t.z))}class H extends C{constructor(){super(...arguments),this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"],uv:["textureUVNextVertex1","textureUVNextVertex2"]}}_vertexPreamble(t){const{id:e,pos:i,offset:s,animationPointerAndBaseSizeAndReferenceSize:o,uv:r,sizing:p,angle:h}=t,c=o.xy,x=o.z,y=o.w,v=p.xy,f=p.z,S=T(t.bitset,D.bitset.isStroke),w=p.w,b=T(t.bitset,D.bitset.scaleSymbolsProportionally),g=this._getEvalParams(t,v),z=N(c,k.transform,g),P=l([n(T(t.bitset,D.bitset.isMapAligned),new a(1)),this.view.rotation.divide(180).multiply(Math.PI)],[!0,new a(0)]),_=new d(u(P),m(P.multiply(-1)),m(P),u(P)).multiply(z.xy),V=z.z.subtract(P).subtract(h.multiply(M)),C=z.w,j=T(t.bitset,D.bitset.isSDF),F=A(this,e,new a(y)).divide(new a(y));return{baseSize:x,animationPointer:c,strokeWidth:f,isOutline:S,unscaledDistanceToPx:w,scaleSymbolsProportionally:b,isSDF:j,position:this._getScreenPosition({id:e,pos:i,offset:s,referenceSize:y,translation:_,rotation:V,scale:C,vvScale:F}),uv:r,evalParams:g,vvScale:F,scale:C}}vertex(t,e){const{position:i,animationPointer:s,evalParams:o,isOutline:r,unscaledDistanceToPx:l,vvScale:n,uv:d,strokeWidth:u,scaleSymbolsProportionally:m,scale:v,isSDF:f,baseSize:S}=this._vertexPreamble(t),w=this._toNdc(i),b=N(s,k.color,o);let g=I(this,t.id,b,p(q(t.bitset,D.bitset.colorLocked),new h(r)));g=new c(g.rgb.multiply(g.a),g.a);const z=O(this,t.id),P=g.multiply(z),_=this.clip(t.id,t.zoomRange),V=l.multiply(n);return{glPosition:new c(w,_,1),uv:d.divide(this.mosaicInfo.size),color:P.multiply(new a(1).subtract(r)),outlineColor:P.multiply(r),distanceToPx:V,strokeWidth:u.multiply(x(new a(1),v,m)),isOutline:r,isSDF:f,...this.maybeRunHittest(t,e,{pos:t.pos,size:S,sizeCorrection:new a(1),isMapAligned:new a(1),vvRotationMat3:new y(1,0,0,0,1,0,0,0,1),placementMat3:new y(1,0,0,0,1,0,0,0,1),outlineSize:new a(1),distanceToPx:V,isSDF:f})}}fragment(t){let e=this._getColor(t.uv,{color:t.color,distanceToPx:t.distanceToPx,isSDF:t.isSDF,outlineColor:t.outlineColor,outlineSize:t.strokeWidth});return i.spotlightAnimatedSymbols&&(e=e.add(new c(0,.3,0,.3))),this.getFragmentOutput(e,t)}hittest(t,e,i){return v(f(i.size,this.hittestRequest.smallSymbolSizeThreshold),this._hittestSmallMarker(t,e,i),this._hittestMarker(t,e,i))}_hittestSmallMarker(t,e,i){const{position:s,distance:o,smallSymbolDistance:r}=this.hittestRequest,l=o.subtract(r),{viewMat3:a,tileMat3:n}=this.view,d=a.multiply(n).multiply(new S(i.pos,1)).xy,u=i.size.multiply(.5);return w(d,s).subtract(u).add(l)}_hittestMarker(t,e,i){const s=this._vertexPreamble({...t}).position,o=this._vertexPreamble({...t,offset:e.offsetNextVertex1,uv:e.textureUVNextVertex1}).position,r=this._vertexPreamble({...t,offset:e.offsetNextVertex2,uv:e.textureUVNextVertex2}).position,l=this.hittestRequest.position,a=this.hittestRequest.distance,n=j(l,s,o,r);return v(b(n,a),n,this._hittestSamples(s,o,r,t,e,i))}_hittestSamples(t,e,i,s,o,r){const{outlineSize:l,isSDF:n,distanceToPx:d}=r,u=this.hittestRequest.position,m=this.hittestRequest.distance,p=F(u.add(new g(z(m),z(m))),t,e,i),h=F(u.add(new g(0,z(m))),t,e,i),x=F(u.add(new g(m,z(m))),t,e,i),y=F(u.add(new g(z(m),0)),t,e,i),v=F(u,t,e,i),f=F(u.add(new g(m,0)),t,e,i),S=F(u.add(new g(z(m),m)),t,e,i),w=F(u.add(new g(0,m)),t,e,i),b=F(u.add(new g(m,m)),t,e,i),_=s.uv.divide(this.mosaicInfo.size),V=o.textureUVNextVertex1.divide(this.mosaicInfo.size),C=o.textureUVNextVertex2.divide(this.mosaicInfo.size),N={color:new c(1,1,1,1),outlineSize:l,outlineColor:new c(1,1,1,1),isSDF:n,distanceToPx:d};let k=new a(0);return k=k.add(R(p).multiply(this._getColor(G(p,_,V,C),N).a)),k=k.add(R(h).multiply(this._getColor(G(h,_,V,C),N).a)),k=k.add(R(x).multiply(this._getColor(G(x,_,V,C),N).a)),k=k.add(R(y).multiply(this._getColor(G(y,_,V,C),N).a)),k=k.add(R(v).multiply(this._getColor(G(v,_,V,C),N).a)),k=k.add(R(f).multiply(this._getColor(G(f,_,V,C),N).a)),k=k.add(R(S).multiply(this._getColor(G(S,_,V,C),N).a)),k=k.add(R(w).multiply(this._getColor(G(w,_,V,C),N).a)),k=k.add(R(b).multiply(this._getColor(G(b,_,V,C),N).a)),P(k,new a(.05)).multiply(U(this.hittestRequest))}}t([e(0,r(W)),e(1,r(B))],H.prototype,"vertex",null),t([e(0,r(E))],H.prototype,"fragment",null);export{E as AnimatedMarkerFragmentInput,H as AnimatedMarkerShader,W as AnimatedMarkerVertexInput};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Handles.js";import{deg2rad as r}from"../../../core/mathUtils.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import{convertUnit as s,getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{fromRotation as a,translate as m,rotate as c,scaleByVec2 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{set as h,sub as d,scale as f,rotate as j}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as u}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{project as _}from"../../../geometry/projection.js";import{getClosestDenormalizedXToReference as C}from"../../../geometry/support/normalizeUtils.js";import{getResolutionInMetersForScale as y}from"../../../geometry/support/scaleUtils.js";import{equals as v}from"../../../geometry/support/spatialReferenceUtils.js";import{DisplayObject as b}from"../engine/DisplayObject.js";import{WGLDrawPhase as L}from"../engine/webgl/enums.js";import{GridTechnique as x}from"../engine/webgl/shaderGraph/techniques/grid/GridTechnique.js";import{minimumPixelsPerStrideForDisplayWhenScalingOff as w}from"./constants.js";import{getScaleFactor as M}from"./gridUtils.js";const U=g();class q extends b{constructor(){super(),this._handles=new e,this._projectedCenter=null,this._technique=new x,this._grid=null,this.visible=!0}destroy(){this._handles=t(this._handles),this._technique.shutdown()}get grid(){return this._grid}set grid(e){this._grid=e,this._handles.removeAll(),this._handles.add([i((()=>e?.center),(()=>{this._projectedCenter=null}),o),i((()=>[e?.center,e?.dynamicScaling,e?.majorLineColor,e?.majorLineInterval,e?.minorLineColor,e?.rotateWithMap,e?.rotation,e?.spacing,e?.units]),(()=>this.requestRender()),o)])}_createTransforms(){return{displayViewScreenMat3:p()}}doRender(e){if(e.drawPhase!==L.MAP||null==this.grid||!this.visible)return;const{spacing:r,units:t,majorLineInterval:i,dynamicScaling:o,majorLineColor:n,minorLineColor:a}=this.grid
|
|
5
|
+
import e from"../../../core/Handles.js";import{deg2rad as r}from"../../../core/mathUtils.js";import{destroyMaybe as t}from"../../../core/maybe.js";import{watch as i,initial as o}from"../../../core/reactiveUtils.js";import{convertUnit as s,getMetersPerUnitForSR as n}from"../../../core/unitUtils.js";import{fromRotation as a,translate as m,rotate as c,scaleByVec2 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{set as h,sub as d,scale as f,rotate as j}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as u}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{project as _}from"../../../geometry/projection.js";import{getClosestDenormalizedXToReference as C}from"../../../geometry/support/normalizeUtils.js";import{getResolutionInMetersForScale as y}from"../../../geometry/support/scaleUtils.js";import{equals as v}from"../../../geometry/support/spatialReferenceUtils.js";import{DisplayObject as b}from"../engine/DisplayObject.js";import{WGLDrawPhase as L}from"../engine/webgl/enums.js";import{GridTechnique as x}from"../engine/webgl/shaderGraph/techniques/grid/GridTechnique.js";import{minimumPixelsPerStrideForDisplayWhenScalingOff as w}from"./constants.js";import{getScaleFactor as M}from"./gridUtils.js";const U=g();class q extends b{constructor(){super(),this._handles=new e,this._projectedCenter=null,this._technique=new x,this._grid=null,this.visible=!0}destroy(){this._handles=t(this._handles),this._technique.shutdown()}get grid(){return this._grid}set grid(e){this._grid=e,this._handles.removeAll(),this._handles.add([i((()=>e?.center),(()=>{this._projectedCenter=null}),o),i((()=>[e?.center,e?.dynamicScaling,e?.majorLineColor,e?.majorLineInterval,e?.minorLineColor,e?.rotateWithMap,e?.rotation,e?.spacing,e?.units]),(()=>this.requestRender()),o)])}_createTransforms(){return{displayViewScreenMat3:p()}}doRender(e){if(e.drawPhase!==L.MAP||null==this.grid||!this.visible)return;const{spacing:r,units:t,majorLineInterval:i,dynamicScaling:o,majorLineColor:n,minorLineColor:a}=this.grid;if(0===r)return;const{scale:m}=e.state,c=s(r,t,"meters"),l=y(m),p=c/l;if(!o&&p<w)return;const h=c*M(i,p,o);this._updateTransform(e,l,h),this._technique.render(e,{transform:{dvs:this.transforms.displayViewScreenMat3},config:{pxPerCell:h/l,minorLineColor:W(a),majorLineColor:W(n),majorLineInterval:i,halfWidth:.25,aaWidth:.5}})}_updateTransform(e,t,i){const{grid:o}=this,{center:s,rotation:p,size:g,spatialReference:y}=e.state;if(null==o)return;if(this._projectedCenter&&v(this._projectedCenter.spatialReference,y)||(v(o.center.spatialReference,y)?this._projectedCenter=o.center:this._projectedCenter=_(o.center,y)),!this._projectedCenter)return;const b=t*(g[0]/2),L=t*(g[1]/2),x=n(y)/i,w=this._projectedCenter,M=r(o.rotation),q=r(p),W=this.transforms.displayViewScreenMat3;a(W,-M);const I=y.isWrappable?C(w.x,s[0],y):w.x,S=h(U,I,w.y),T=d(U,s,S);f(T,T,x),o.rotateWithMap||j(T,T,u,-q),j(T,T,u,-M),f(T,T,1/o.majorLineInterval),R(T,T),f(T,T,o.majorLineInterval),j(T,T,u,M),m(W,W,T),o.rotateWithMap&&c(W,W,q);const A=h(U,b/i,L/i);l(W,W,A)}}function R(e,r){return e[0]=r[0]-Math.trunc(r[0]),e[1]=r[1]-Math.trunc(r[1]),e}function W(e){const[r,t,i,o]=e.toArray().map((e=>e/255));return[r*o,t*o,i*o,o]}export{q 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.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{notDeepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m}from"../../../core/reactiveUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as b}from"../../../layers/graphics/featureConversionUtils.js";import F from"../../../layers/support/FeatureFilter.js";import{packFields as A}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as S}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as E}from"../../../layers/support/timeSupport.js";import x from"../../../rest/support/AggregateFeatureSet.js";import j from"../../../rest/support/FeatureSet.js";import C from"../../../rest/support/Query.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as R}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as U}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as k}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as q}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as Q}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as I}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as O}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as L}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as T}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as H}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as P}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as W}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as M}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{handleNoEngineError as N}from"./support/handleNoEngineError.js";import{HighlightCounter as G}from"./support/HighlightCounter.js";import{toJSONGeometryType as J}from"./support/util.js";import{FeatureTileSubscriptionManager as $}from"../tiling/FeatureTileSubscriptionManager.js";import z from"../../layers/FeatureLayerView.js";import B from"../../layers/LayerView.js";import Z from"../../layers/RefreshableLayerView.js";import K from"../../../geometry/Extent.js";function X(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 Y=4294967294;let ee=class extends(z(Z(V(B)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"edit-by-feature":case"edit-by-id":return this._doEdit(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new G,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new k,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new v}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=p(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===S(e)?.operations.supportsQuery)throw new o("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 U(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(c()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get hasAllFeatures(){return this.layer.visible&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new I(this.layer):new Q(this.layer);case"geojson":case"csv":case"wfs":return new I(this.layer);case"parquet":return new H(this.layer);case"subtype-group":return new W(this.layer);case"ogc-feature":return new L(this.layer);case"stream":return new P(this.layer);case"oriented-imagery":return new T(this.layer);case"knowledge-graph-sublayer":return new O(this.layer);case"catalog-footprint":return new q(this.layer);default:a(this.layer)}return null}get timeExtent(){return E(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="default"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return N(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return N(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return N(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return N(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return N(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return N(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return N(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return N(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return N(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=j.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),i=await N(r,{features:[]}),s=j.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await N(r,{features:[]}),s=x.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return N(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return N(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return N(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return N(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return N(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return N(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await N(r,{count:0,extent:null});return{count:i.count,extent:K.fromJSON(i.extent)}}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){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new R(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new $({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),d(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([f((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),m),f((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),f((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>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=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=p(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>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 i={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 s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await M(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=C.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=C.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this._getEffectiveEdit(e);return t?this._commandsQueue.push(t).catch(y):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%Y+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%Y+1}_getEffectiveEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);if(r&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null;const s=this.layer,a=e.historicMoment?.getTime()??null,n="layerId"in s&&e.editedFeatures?.find((e=>e.layerId===s.layerId));if(n&&this._canEditByFeature(n)){const e=!1,r=!1,i=J(this.layer.geometryType),{adds:s,deletes:o,updates:u}=n.editedFeatures,l=this.layer.objectIdField,h=s.map((t=>b(t,i,e,r))),c=u.map((t=>b(t.current,i,e,r)));return{type:"edit-by-feature",added:h,removed:o.map((e=>"attributes"in e?{globalId:t?e.attributes[t]:null,objectId:l?e.attributes[l]:null}:e)),updated:c,historicMoment:a}}return{type:"edit-by-id",added:e.addedFeatures,updated:e.updatedFeatures,removed:e.deletedFeatures,historicMoment:a}}_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 this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(r){g(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=X(this._lastAvailableFields,e);return this._lastAvailableFields=t,A(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[te(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlights(e,t){this._highlightCounter.addGroup(e,t),this._commandsQueue.push({type:"highlight"})}_removeHighlights(e,t){this._highlightCounter.deleteGroup(e,t),this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightGroups(i),r=this._getHighlightBits(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{g(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&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 te(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new F,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new F).toJSON(),n.hiddenIds=Array.from(i)),n}e([w()],ee.prototype,"_commandsQueue",void 0),e([w()],ee.prototype,"_sourceRefreshVersion",void 0),e([w()],ee.prototype,"_displayRefreshVersion",void 0),e([w({readOnly:!0})],ee.prototype,"_pipelineUpdating",void 0),e([w({readOnly:!0})],ee.prototype,"hasAllFeatures",null),e([w({readOnly:!0})],ee.prototype,"hasAllFeaturesInView",null),e([w({readOnly:!0})],ee.prototype,"hasFullGeometries",null),e([w()],ee.prototype,"featureEffectView",void 0),e([w()],ee.prototype,"labelingCollisionInfos",null),e([w()],ee.prototype,"layerAdapter",null),e([w({readOnly:!0})],ee.prototype,"timeExtent",null),e([w()],ee.prototype,"updating",void 0),ee=e([_("esri.views.2d.layers.FeatureLayerView2D")],ee);const re=ee;export{re as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{notDeepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as p,ignoreAbortErrors as d,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m}from"../../../core/reactiveUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import v from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as b}from"../../../layers/graphics/featureConversionUtils.js";import F from"../../../layers/support/FeatureFilter.js";import{packFields as A}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as S}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as E}from"../../../layers/support/timeSupport.js";import x from"../../../rest/support/AggregateFeatureSet.js";import j from"../../../rest/support/FeatureSet.js";import C from"../../../rest/support/Query.js";import{LayerView2DMixin as V}from"./LayerView2D.js";import{FeatureContainer as R}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as U}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as k}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as q}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as Q}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as I}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as O}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as L}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as T}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as H}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as P}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as W}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as M}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import D from"./support/FeatureCommandQueue.js";import{handleNoEngineError as N}from"./support/handleNoEngineError.js";import{HighlightCounter as G}from"./support/HighlightCounter.js";import{toJSONGeometryType as J}from"./support/util.js";import{FeatureTileSubscriptionManager as $}from"../tiling/FeatureTileSubscriptionManager.js";import z from"../../layers/FeatureLayerView.js";import B from"../../layers/LayerView.js";import Z from"../../layers/RefreshableLayerView.js";import K from"../../../geometry/Extent.js";function X(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 Y=4294967294;let ee=class extends(z(Z(V(B)))){constructor(){super(...arguments),this._commandsQueue=new D({process:e=>{switch(e.type){case"edit-by-feature":case"edit-by-id":return this._doEdit(e);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new G,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new k,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._fields=null,this.featureEffectView=new v}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=p(),d(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransitions()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===S(e)?.operations.supportsQuery)throw new o("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 U(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(c()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new I(this.layer):new Q(this.layer);case"geojson":case"csv":case"wfs":return new I(this.layer);case"parquet":return new H(this.layer);case"subtype-group":return new W(this.layer);case"ogc-feature":return new L(this.layer);case"stream":return new P(this.layer);case"oriented-imagery":return new T(this.layer);case"knowledge-graph-sublayer":return new O(this.layer);case"catalog-footprint":return new q(this.layer);default:a(this.layer)}return null}get timeExtent(){return E(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="default"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return N(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return N(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return N(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return N(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return N(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return N(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return N(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return N(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return N(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=j.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),i=await N(r,{features:[]}),s=j.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await N(r,{features:[]}),s=x.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return N(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return N(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return N(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return N(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return N(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return N(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await N(r,{count:0,extent:null});return{count:i.count,extent:K.fromJSON(i.extent)}}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){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),d(this._updatingHandles.addPromise(this._workerAttached.promise)),d(this._attachProxy()),this.featureContainer=new R(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new $({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),d(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([f((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),m),f((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),f((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>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=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=p(),d(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("dataUpdating",e.data)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:t=>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 i={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 s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await M(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=C.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=C.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this._getEffectiveEdit(e);return t?this._commandsQueue.push(t).catch(y):void 0}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%Y+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%Y+1}_getEffectiveEdit(e){const t="globalIdField"in this.layer&&this.layer.globalIdField,r=e.deletedFeatures.some((e=>-1===e.objectId||!e.objectId)),i=t&&this.availableFields.includes(t);if(r&&!i)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected on the map`)),null;const s=this.layer,a=e.historicMoment?.getTime()??null,n="layerId"in s&&e.editedFeatures?.find((e=>e.layerId===s.layerId));if(n&&this._canEditByFeature(n)){const e=!1,r=!1,i=J(this.layer.geometryType),{adds:s,deletes:o,updates:u}=n.editedFeatures,l=this.layer.objectIdField,h=s.map((t=>b(t,i,e,r))),c=u.map((t=>b(t.current,i,e,r)));return{type:"edit-by-feature",added:h,removed:o.map((e=>"attributes"in e?{globalId:t?e.attributes[t]:null,objectId:l?e.attributes[l]:null}:e)),updated:c,historicMoment:a}}return{type:"edit-by-id",added:e.addedFeatures,updated:e.updatedFeatures,removed:e.deletedFeatures,historicMoment:a}}_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 this._updateRequiredFields(),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransitions(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doEdit(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onEdits(e),this.featureContainer.editEnd()}catch(r){g(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=X(this._lastAvailableFields,e);return this._lastAvailableFields=t,A(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[te(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone}}_addHighlights(e,t){this._highlightCounter.addGroup(e,t),this._commandsQueue.push({type:"highlight"})}_removeHighlights(e,t){this._highlightCounter.deleteGroup(e,t),this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightGroups(i),r=this._getHighlightBits(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{g(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&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 te(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new F,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new F).toJSON(),n.hiddenIds=Array.from(i)),n}e([w()],ee.prototype,"_commandsQueue",void 0),e([w()],ee.prototype,"_sourceRefreshVersion",void 0),e([w()],ee.prototype,"_displayRefreshVersion",void 0),e([w({readOnly:!0})],ee.prototype,"_pipelineUpdating",void 0),e([w({readOnly:!0})],ee.prototype,"hasAllFeatures",null),e([w({readOnly:!0})],ee.prototype,"hasAllFeaturesInView",null),e([w({readOnly:!0})],ee.prototype,"hasFullGeometries",null),e([w()],ee.prototype,"featureEffectView",void 0),e([w()],ee.prototype,"labelingCollisionInfos",null),e([w()],ee.prototype,"layerAdapter",null),e([w({readOnly:!0})],ee.prototype,"timeExtent",null),e([w()],ee.prototype,"updating",void 0),ee=e([_("esri.views.2d.layers.FeatureLayerView2D")],ee);const re=ee;export{re as default};
|