@arcgis/core 5.2.0-next.126 → 5.2.0-next.128
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/WebScene.js +1 -1
- package/applications/Components/basemapToggleUtils.d.ts +53 -0
- package/applications/Components/basemapToggleUtils.js +2 -0
- package/applications/SceneViewer/sceneViewerUtils.d.ts +14 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/applications/WebEditor/sketchUtils.js +1 -1
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
- package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e35eb93c0fb1f6de8db0.js → 00d9e41deecf5828975c.js} +1 -1
- package/assets/esri/core/workers/chunks/038d2b80d96237c25b6f.js +1 -0
- package/assets/esri/core/workers/chunks/{ab8a1140bf31f46f8ebf.js → 1262918b2161d79851c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{d3ef23923424ad8c5048.js → 1c2723f9630e7d597843.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ca98fffd43e63d5ade3.js → 1c33aa349beea9a3792f.js} +1 -1
- package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js → 2226c20c38e20713bcb5.js} +2 -2
- package/assets/esri/core/workers/chunks/{54eeb4cac4fa092359ab.js.LICENSE.txt → 2226c20c38e20713bcb5.js.LICENSE.txt} +2 -2
- package/assets/esri/core/workers/chunks/{4d18451e0ea6ca54101a.js → 2ebad7e588b26e74cefe.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8258636096416c837a2.js → 3b7dff15a0058ea29886.js} +1 -1
- package/assets/esri/core/workers/chunks/{4716693eca44e8f89f5c.js → 3bf56c33876ba56c4b21.js} +1 -1
- package/assets/esri/core/workers/chunks/3c6ee445e49da0076ac1.js +1 -0
- package/assets/esri/core/workers/chunks/3f045f09ac95e7f22a97.js +1 -0
- package/assets/esri/core/workers/chunks/500f6d6f0ffa235cae85.js +1 -0
- package/assets/esri/core/workers/chunks/{56acda1eed3a013430e2.js → 58fb92775d668cfd295c.js} +1 -1
- package/assets/esri/core/workers/chunks/{e6637f9176566382ed3e.js → 606cca69eaea84bfcdc6.js} +1 -1
- package/assets/esri/core/workers/chunks/{fdbda3d2afea25142b86.js → 6267a1fe1603daa399b4.js} +1 -1
- package/assets/esri/core/workers/chunks/{b013b70e40dfb6ce013e.js → 668ec0bdfb2095e90c9e.js} +1 -1
- package/assets/esri/core/workers/chunks/{806f96ad09e882be41af.js → 67fd2cdb2e6834bfa710.js} +1 -1
- package/assets/esri/core/workers/chunks/{5fe5ef5ccf480634d159.js → 75294f515c7f8393181c.js} +1 -1
- package/assets/esri/core/workers/chunks/75879ae88fd87b089a87.js +1 -0
- package/assets/esri/core/workers/chunks/761ea719ec1b4d562db2.js +1 -0
- package/assets/esri/core/workers/chunks/{24673aac70d6c949b6fa.js → 86d7a3ae672a51b75fcc.js} +1 -1
- package/assets/esri/core/workers/chunks/{30604a29df320d7a4c6b.js → 88e11b645a1361f1bdbe.js} +1 -1
- package/assets/esri/core/workers/chunks/89dad6c1bfd81e4d7f8e.js +1 -0
- package/assets/esri/core/workers/chunks/{8daed13400d9e63e65ae.js → 8a842cde240aef12e417.js} +1 -1
- package/assets/esri/core/workers/chunks/{c692e583e87af58f6d91.js → 8b0d6205ceeec1ab446f.js} +1 -1
- package/assets/esri/core/workers/chunks/{57ab87e70ef85b9405f9.js → 8cb216404a6254bc695c.js} +1 -0
- package/assets/esri/core/workers/chunks/92509dd25996c6390a31.js +1 -0
- package/assets/esri/core/workers/chunks/9ccc2c8f7416943cc373.js +29 -0
- package/assets/esri/core/workers/chunks/a0a9c41400ae98df1912.js +1 -0
- package/assets/esri/core/workers/chunks/{b96358d475dc98034aa4.js → a15ed056e7493ddf3b4c.js} +1 -1
- package/assets/esri/core/workers/chunks/{25e212fe9a2ea37c9e81.js → a3a33ffa34f4d645ddfe.js} +1 -1
- package/assets/esri/core/workers/chunks/af0704494398f33aa315.js +1 -0
- package/assets/esri/core/workers/chunks/{ce1ccf9ec90b786591e5.js → b396c4b4bb144200acc7.js} +1 -1
- package/assets/esri/core/workers/chunks/{97602019a1ccad22a03a.js → bbfb80a6983574007ce5.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5f72670634e73c0b53a.js → bcf2e5cf6b9c6d0442bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{17218d714cb07b607c2f.js → c35e9dee87937f483a3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{85739ed6af0f0a3cb302.js → c94bdfed831c775e04c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e3fd81653dc0d86456c.js → cfeba0ffb7fdc2a9af05.js} +1 -1
- package/assets/esri/core/workers/chunks/d1187ad6cc4959683819.js +1 -0
- package/assets/esri/core/workers/chunks/d94a2b3b2ef49af9c2e3.js +1 -0
- package/assets/esri/core/workers/chunks/{cb7cb7d57c4e7f76600f.js → dc92710a8fdfb9135e55.js} +1 -1
- package/assets/esri/core/workers/chunks/ec187933b42fe65594b7.js +1 -0
- package/assets/esri/core/workers/chunks/eec5a93dbc258a90b6de.js +1 -0
- package/assets/esri/core/workers/chunks/{e1ae83ff3e0225708d4d.js → f479b4a4cee4bb2e046c.js} +1 -1
- package/assets/esri/core/workers/chunks/{78abd6c42f39e6f6ffbb.js → f983296b6f4a62a911eb.js} +1 -1
- package/assets/esri/images/portal/gaussiansplatlayer16.png +0 -0
- package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
- package/assets/esri/images/portal/propresentation16.png +0 -0
- package/assets/esri/images/portal/urbanproject16.png +0 -0
- package/assets/esri/images/support/loading-throb.gif +0 -0
- package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
- package/assets/esri/themes/base/icons/style.scss +0 -0
- package/assets/esri/themes/base/icons/variables.scss +0 -0
- package/assets/esri/themes/base/images/files/archive-32.svg +0 -0
- package/assets/esri/themes/base/images/files/cad-32.svg +0 -0
- package/assets/esri/themes/base/images/files/code-32.svg +0 -0
- package/assets/esri/themes/base/images/files/csv-32.svg +0 -0
- package/assets/esri/themes/base/images/files/excel-32.svg +0 -0
- package/assets/esri/themes/base/images/files/generic-32.svg +0 -0
- package/assets/esri/themes/base/images/files/gpx-32.svg +0 -0
- package/assets/esri/themes/base/images/files/image-32.svg +0 -0
- package/assets/esri/themes/base/images/files/pdf-32.svg +0 -0
- package/assets/esri/themes/base/images/files/report-32.svg +0 -0
- package/assets/esri/themes/base/images/files/sound-32.svg +0 -0
- package/assets/esri/themes/base/images/files/text-32.svg +0 -0
- package/assets/esri/themes/base/images/files/video-32.svg +0 -0
- package/assets/esri/themes/base/images/files/word-32.svg +0 -0
- package/assets/esri/themes/base/images/files/zip-32.svg +0 -0
- package/assets/esri/themes/base/images/loading-throb.gif +0 -0
- package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +42 -3
- 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/assets/esri/views/interactive/tooltip/t9n/messages.en.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
- package/chunks/GlobalIllumination.glsl.js +1 -0
- package/config.js +1 -1
- package/core/Accessor.d.ts +1 -1
- package/core/lang.js +1 -1
- package/core/units.js +1 -1
- package/geometry/HeightModelInfo.js +1 -1
- package/geometry/ellipsoidUtils.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/interfaces.d.ts +1 -0
- package/kernel.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/ParquetLayer.d.ts +21 -13
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/dehydratedFeatures.js +1 -1
- package/layers/graphics/transferFeatures.js +2 -0
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/mixins/HeightModelInfoMixin.js +2 -0
- package/layers/mixins/SceneService.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/raster/datasets/RasterFactory.js +1 -1
- package/package.json +3 -3
- package/popup/FeatureContentCollection.d.ts +15 -25
- package/popup/FeatureContentCollection.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/callouts/calloutAnalysisUtils.js +2 -0
- package/symbols/cim/callouts/effects/BackgroundCallout.js +1 -1
- package/symbols/cim/callouts/effects/BalloonCallout.js +1 -1
- package/symbols/cim/callouts/effects/PointSymbolCallout.js +1 -1
- package/symbols/cim/callouts/effects/SimpleLineCallout.js +1 -1
- package/symbols/cim/callouts/effects/calloutUtils.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/views/2d/engine/webgl/ClipMesh.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/CalloutMeshWriterCoordinator.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/MeshWriterGroupCoordinator.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/ComputedMarkerParams.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/CalloutMeshWriterPolicy.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterReferences.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/util/AnnotationMatcher.js +1 -1
- package/views/2d/engine/webgl/util/Matcher.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/support/annodime/MatcherGeometryOverride.js +1 -1
- package/views/2d/layers/support/annodime/PrivateMatcherGeometryOverrideEffect.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +5 -3
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementRootPlugin.js +1 -1
- package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/interactive/editingTools/manipulatedObjectUtils.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/FeatureGraphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/support/FeatureMemory.js +2 -0
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/support/PBFDecoder.js +1 -1
- package/views/3d/support/PBFDecoderWorker.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
- package/views/DOMContainer.d.ts +2 -2
- package/views/DOMContainer.js +1 -1
- package/views/PopupView.d.ts +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/interactive/options/TooltipVisibleElements.d.ts +11 -1
- package/views/interactive/options/TooltipVisibleElements.js +1 -1
- package/views/interactive/tooltip/components/ElevationModeSelect.js +2 -0
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/views/interactive/tooltip/infos/SketchTooltipInfo.js +1 -1
- package/views/support/hitTestSelectUtils.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.d.ts +1 -0
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +9 -1
- package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +1 -0
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/legacy/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/Popup/types.d.ts +0 -7
- package/widgets/Popup.d.ts +7 -7
- package/widgets/TimeSlider/TimeSliderViewModel.d.ts +2 -0
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/assets/esri/core/workers/chunks/0a2b7c691a577cb3d189.js +0 -1
- package/assets/esri/core/workers/chunks/2146c25c01c9fc11b16c.js +0 -1
- package/assets/esri/core/workers/chunks/4678a8170d8a3ccd1a7b.js +0 -1
- package/assets/esri/core/workers/chunks/56e97b98dcb8a3f2bcb7.js +0 -1
- package/assets/esri/core/workers/chunks/6c3535aa7250c08b9e5b.js +0 -1
- package/assets/esri/core/workers/chunks/6e75f09fb9452bd5f9fb.js +0 -1
- package/assets/esri/core/workers/chunks/7441d121f00ce747c08e.js +0 -1
- package/assets/esri/core/workers/chunks/76548469fe1b9c3b2051.js +0 -1
- package/assets/esri/core/workers/chunks/82ce034b5ba54de9b970.js +0 -29
- package/assets/esri/core/workers/chunks/ba435cc73956d9c64a11.js +0 -1
- package/assets/esri/core/workers/chunks/c77496c350004ee66eb2.js +0 -1
- package/assets/esri/core/workers/chunks/d371d9279b30548efa02.js +0 -1
- package/assets/esri/core/workers/chunks/dc52e036547612949d32.js +0 -1
- package/assets/esri/core/workers/chunks/e5ee64e2fb5bfcb716d8.js +0 -1
- package/views/2d/engine/webgl/mesh/bufcut.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{importLazily as e}from"../../../../../../../core/importUtils.js";import{memoize as t}from"../../../../../../../core/MapUtils.js";import{pt2px as i}from"../../../../../../../core/screenUtils.js";import{numericHash as r}from"../../../../../../../core/string.js";import{fromRotation as s,translate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as n}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a,set as l,sub as c,normalize as h,add as u,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as f}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as g,convertOptimizedGeometryToFlat as _,convertFlatToOptimizedGeometry as p,FlatGeometry as y}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as x}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as P}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as b,convertToGeometry as M}from"../../../../../../../layers/graphics/featureConversionUtils.js";import v from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as w}from"../../../definitions.js";import L from"../../../collisions/BoundingBox.js";import{LabelMetric as I}from"../../../collisions/LabelMetric.js";import{smoothPaths as B,pathDivide as G,closestPointOnPaths as z}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as C,processColorInput as D}from"../fill/meshWriterUtils.js";import{TextMeshWriter as S,maxLabelZoom as j}from"../text/TextMeshWriter.js";const R=1,F=0,V=128,A=w*w/16,E=e(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),O=e(()=>import("../../../../../../../chunks/FlatGeometry.js"));function $(e,t,i){return r(`${e}${t}${i}`)}function k(e,t,i,s,o){return r(`${e}${t}${i}${s*2**(j-o)}`)}function X(e,t,i){return r(`${e}${t}${i}`)}function Y(e,t,i,s,o){return r(`${e}${o}${t}${i*2**(j-s)}`)}const T=t(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class U extends S{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!0,this._zoomLevel=0,this._calloutVisuals=[],this._calloutVisualIndex=0}async loadDependencies(){await Promise.all([super.loadDependencies(),E.getImportPromise(),O.getImportPromise()])}getCalloutEffectGeometry(e){const t=this._calloutVisuals[this._calloutVisualIndex]?.metric;return t?x.fromJSON({x:t.anchorX,y:t.anchorY}):null}getLocalCalloutReferenceInfo(){const e=this._calloutVisuals[this._calloutVisualIndex],t=e?.referenceInfo;if(!t||!e)return t;const{metric:i,featureAnchor:r}=e;return{...t,anchor:{x:r[0]-i.anchorX,y:i.anchorY-r[1]}}}getCalloutVisualCount(){return this._calloutVisuals.length}setCalloutVisualIndex(e){if(e<0||e>=this._calloutVisuals.length)throw new Error("InternalError: callout visual index is out of bounds");this._calloutVisualIndex=e}includeCalloutRecordRange(e,t){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeRecordRange(e,t)}includeCalloutCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutCollisionBounds(e)}includeCalloutPartCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutPartCollisionBounds(e)}_write(e,{target:t,effectGeometry:i,level:r,viewExtent:s}){if(this._zoomLevel=r,this._calloutVisuals=[],this._calloutVisualIndex=0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=x.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new I(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=t.readGeometryForDisplay()?.justXY();e.requiresRefresh||=(r?.area()||0)>=A;const s=this._getPolygonLabelPoint(t,i);s&&this._writePoint(e,s[0],s[1],0,t)}_getPolygonLabelPoint(e,t){if(!t){const t=e.readCentroidForDisplay()?.coords;return t?[t[0],t[1]]:null}const i=E.module,r=O.module.constructFromFlatGeometry,s=e.readGeometryForDisplay()?.justXY(),o=e.readCentroidForDisplay()?.coords,n=s?.area()||0;if(!o)return;const a=n>=A,l=r(g(t)),c=r(g({x:o[0],y:o[1]})),h=!!i.execute(c,l,null);if(!s||!a||!h)return[o[0],o[1]];const u=r(_("polygon",s,null)),m=i.execute(u,l,null);if(!m)return[o[0],o[1]];const d=p(new y(m.toFlatGeometry())),f=x.fromOptimized(d,"esriGeometryPolygon",1),b=P(f)??o;return[b[0],b[1]]}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=$(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=X(s.getObjectId(),a,r),[h,u]=this._getMetricDir(),m=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointLabelReferenceBounds(),g=new I(n,a,l,c,t,i,h,u,m,d,f);this._calloutVisuals.push({metric:g,featureAnchor:[t,i],referenceInfo:this._createLocalCalloutReferenceInfo(o)}),e.metricStart(g),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_getPointLabelReferenceBounds(){const e=this._getPointReferenceBounds()??{offsetX:0,offsetY:0,size:0},t=this.evaluatedMeshParams.labelOffsetDistance??0,[i,r]=this._getMetricDir();return{...e,offsetX:e.offsetX+i*t,offsetY:e.offsetY-r*t}}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<R);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:C(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},calloutPaths:t.readLegacyGeometryForDisplay().paths.map(e=>e.map(([e,t])=>[e,t])),offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay()?.justXY();if(!n)return;const a=b(n,"esriGeometryPolyline",1)??new v,l=W(a,o),c=W(a,-o),h=M(c,"esriGeometryPolyline",!1,!1),u=M(l,"esriGeometryPolyline",!1,!1),m=B(u.paths,s.bounds.width),d=B(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<m.length;f++)this._current.pathIndex=f,G(m[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,G(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=B(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,G(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){if(e.x<0||e.x>w||e.y<0||e.y>w)return;const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:u}=this._current,m=this._current.zoomRange[0],d=T(t),f=this._current.shaping.bounds.width/(1<<R),g=Math.sqrt(n||V)/(1<<R),_=Math.min(i,r-i),p=h.isMultiline?j:Math.log2(_/(g+f/2)),y=0===t?p:Math.min(d,p),x=Math.max(m,this._zoomLevel+R-y),P=this._zoomLevel-x,b=h.bounds.width/2*2**P,M=k(a,c,u,t,this._zoomLevel),v=Y(c,u,t,this._zoomLevel,l);s&&P<0?this._placeStraightAlong(e,m,M,v):"parallel"===o||h.isMultiline?this._placeStraightAlong(e,x,M,v):"curved"===o&&this._placeCurved(e,x,b,M,v)}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current,a=this._createLineLabelMetric(n,r,s,e.x,e.y);this._registerLineCalloutMetric(a),o.metricStart(a);const l=e.clone(),c=e.angle*(180/Math.PI)%360,h=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(l,t,1,c),this._placeBack(e,l,t,i,1,c),this._placeForward(e,l,t,i,1,c)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(l,t,0,h),this._placeBack(e,l,t,i,0,h),this._placeForward(e,l,t,i,0,h)),o.metricEnd()}_placeStraightAlong(e,t,r,a){const{out:l,id:c,shaping:h,zoomRange:u,referenceBounds:m}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,_=e.clone(),p=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g),P=this._createLineLabelMetric(c,r,a,e.x,e.y);if(this._registerLineCalloutMetric(P),l.metricStart(P),x){const r=Math.max(t,u[0],0),a=Math.min(j,u[1]),f=s(n(),-e.angle),g={minZoom:r,maxZoom:a,clipAngle:p,mapAligned:!0,isLineLabel:!0},_=i(this.evaluatedMeshParams.offsetX),x=i(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=d(_,-1*x),[i,r]=h.shapeBackground(o(n(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,m,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=d(_,x),[i,r]=h.shapeBackground(o(n(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,m,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(_,t,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(_,t,0,y,!0),l.metricEnd()}_registerLineCalloutMetric(e){this._calloutVisuals.push({metric:e,featureAnchor:z(this._current.calloutPaths,e.anchorX,e.anchorY),referenceInfo:this._createLocalCalloutReferenceInfo(this._current.shaping)})}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+F;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+F}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+F;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+F}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,u=this._getBoundsOffset(e.angle);for(const m of h){const h=m.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(m.x+m.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+F))),_=Math.max(t,s?0:g);m.angle=e.angle+(1-i)*Math.PI;const p=[Math.max(l[0],_),Math.min(l[1],j)];this._writeLineGlyph(o,n,e.x,e.y,m,p,r,c),this._writeLineGlyphBox(o,m,i,p,u)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,u=c.glyphs,m=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*m,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const _ of u){const t=_.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const u=Math.abs(_.x+_.width/2-c.bounds.x),m=Math.max(0,this._zoomLevel+Math.log2(u/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(u/(i+e.length+F)));if(0===m)continue;_.angle=e.angle+(1-o)*Math.PI;const p=[d,m];this._writeLineGlyph(a,l,f.x,f.y,_,p,n,h),this._writeLineGlyphBox(a,_,o,p,g)}}_getBoundsOffset(e){const t=i(this.evaluatedMeshParams.offsetX),r=i(this.evaluatedMeshParams.offsetY),o=d(t,r),l=s(n(),-e);return a(o,o,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:u,outlineSize:m}=this._textMeshTransformProps,d=this._getDefaultGlyphMetrics(this.evaluatedMeshParams.glyphs),f=s.fontSize??h;this._writeQuad(e,t,i,r,{sdfSize:d.sdfSize,sdfRadius:d.sdfRadius,texcoords:l,offsets:c,fontSize:f,haloSize:u,outlineSize:m,color:s.color?D(s.color):D(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new L(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=i}}function W(e,t){const i=new v,{coords:r,lengths:s}=e,o=f(),n=f(),a=f(),d=f(),g=f(),_=f(),p=2;let y=0;for(let f=0;f<s.length;f++){const e=s[f];for(let s=0;s<e;s++){const f=p*(s+y-1),x=p*(s+y),P=p*(s+y+1);s>0?l(o,r[f],r[f+1]):l(o,0,0),l(n,r[x],r[x+1]),s<e-1?l(a,r[P],r[P+1]):l(a,0,0),0===s?l(d,0,0):(c(d,n,o),h(d,d),l(d,d[1],-d[0])),s===e-1?l(g,0,0):(c(g,a,n),h(g,g),l(g,g[1],-g[0])),u(_,d,g),h(_,_);const b=_[0]*g[0]+_[1]*g[1];0!==b&&m(_,_,b),m(_,_,t),i.coords.push(n[0]+_[0],n[1]+_[1])}i.lengths.push(e),y+=e}return i}export{U as LabelMeshWriter,$ as labelIdHash,X as labelMetricHash,k as lineLabelIdHash,Y as lineLabelMetricHash};
|
|
2
|
+
import{importLazily as e}from"../../../../../../../core/importUtils.js";import{memoize as t}from"../../../../../../../core/MapUtils.js";import{pt2px as i}from"../../../../../../../core/screenUtils.js";import{numericHash as r}from"../../../../../../../core/string.js";import{fromRotation as s,translate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as n}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a,set as l,sub as c,normalize as h,add as u,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as f}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as g,convertOptimizedGeometryToFlat as _,convertFlatToOptimizedGeometry as p,FlatGeometry as y}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as x}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as P}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as b,convertToGeometry as M}from"../../../../../../../layers/graphics/featureConversionUtils.js";import v from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as w}from"../../../definitions.js";import L from"../../../collisions/BoundingBox.js";import{LabelMetric as I}from"../../../collisions/LabelMetric.js";import{smoothPaths as B,pathDivide as z,closestPointOnPaths as C}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as G,processColorInput as D}from"../fill/meshWriterUtils.js";import{TextMeshWriter as S,maxLabelZoom as j}from"../text/TextMeshWriter.js";const R=1,A=0,F=128,V=w*w/16;function E(e,t,i,r){if(0===i&&0===r)return null;const s=Math.max(e.xmax-e.xmin,e.ymax-e.ymin)+1;return{x:t.x-i*s,y:t.y+r*s}}const O=e(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),X=e(()=>import("../../../../../../../chunks/FlatGeometry.js"));function Y(e,t,i){return r(`${e}${t}${i}`)}function $(e,t,i,s,o){return r(`${e}${t}${i}${s*2**(j-o)}`)}function k(e,t,i){return r(`${e}${t}${i}`)}function T(e,t,i,s,o){return r(`${e}${o}${t}${i*2**(j-s)}`)}const U=t(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class W extends S{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!0,this._zoomLevel=0,this._calloutVisuals=[],this._calloutVisualIndex=0}async loadDependencies(){await Promise.all([super.loadDependencies(),O.getImportPromise(),X.getImportPromise()])}getCalloutEffectGeometry(e){const t=this._calloutVisuals[this._calloutVisualIndex]?.metric;return t?x.fromJSON({x:t.anchorX,y:t.anchorY}):null}getLocalCalloutReferenceInfo(){const e=this._calloutVisuals[this._calloutVisualIndex],t=e?.referenceInfo;if(!t||!e)return t;const{metric:i,featureAnchor:r}=e,s=t.anchor??{x:0,y:0},o={x:r[0]-i.anchorX,y:i.anchorY-r[1]},n={x:o.x+s.x,y:o.y+s.y},a=E(t.bodyBounds,n,i.directionX,i.directionY);return{...t,anchor:n,...a?{layoutAnchor:a}:null}}getCalloutVisualCount(){return this._calloutVisuals.length}setCalloutVisualIndex(e){if(e<0||e>=this._calloutVisuals.length)throw new Error("InternalError: callout visual index is out of bounds");this._calloutVisualIndex=e}includeCalloutRecordRange(e,t){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeRecordRange(e,t)}includeCalloutCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutCollisionBounds(e)}includeCalloutPartCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutPartCollisionBounds(e)}_write(e,{target:t,effect:i,level:r,viewExtent:s}){if(this._zoomLevel=r,this._calloutVisuals=[],this._calloutVisualIndex=0,null!=i?.geometry)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=x.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new I(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=t.readGeometryForDisplay()?.justXY();e.requiresRefresh||=(r?.area()||0)>=V;const s=this._getPolygonLabelPoint(t,i);s&&this._writePoint(e,s[0],s[1],0,t)}_getPolygonLabelPoint(e,t){if(!t){const t=e.readCentroidForDisplay()?.coords;return t?[t[0],t[1]]:null}const i=O.module,r=X.module.constructFromFlatGeometry,s=e.readGeometryForDisplay()?.justXY(),o=e.readCentroidForDisplay()?.coords,n=s?.area()||0;if(!o)return;const a=n>=V,l=r(g(t)),c=r(g({x:o[0],y:o[1]})),h=!!i.execute(c,l,null);if(!s||!a||!h)return[o[0],o[1]];const u=r(_("polygon",s,null)),m=i.execute(u,l,null);if(!m)return[o[0],o[1]];const d=p(new y(m.toFlatGeometry())),f=x.fromOptimized(d,"esriGeometryPolygon",1),b=P(f)??o;return[b[0],b[1]]}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=Y(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=k(s.getObjectId(),a,r),[h,u]=this._getMetricDir(),m=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointLabelReferenceBounds(),g=new I(n,a,l,c,t,i,h,u,m,d,f);this._calloutVisuals.push({metric:g,featureAnchor:[t,i],referenceInfo:this._createLocalCalloutReferenceInfo(o,f)}),e.metricStart(g),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){return this._references?.get("label-reference-symbol")?.getBoundsInfo()??null}_getPointLabelReferenceBounds(){const e=this._getPointReferenceBounds()??{offsetX:0,offsetY:0,size:0},t=this.evaluatedMeshParams.labelOffsetDistance??0,[i,r]=this._getMetricDir();return{...e,offsetX:e.offsetX+i*t,offsetY:e.offsetY-r*t}}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<R);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:G(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},calloutPaths:t.readLegacyGeometryForDisplay().paths.map(e=>e.map(([e,t])=>[e,t])),offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay()?.justXY();if(!n)return;const a=b(n,"esriGeometryPolyline",1)??new v,l=Z(a,o),c=Z(a,-o),h=M(c,"esriGeometryPolyline",!1,!1),u=M(l,"esriGeometryPolyline",!1,!1),m=B(u.paths,s.bounds.width),d=B(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<m.length;f++)this._current.pathIndex=f,z(m[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,z(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=B(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,z(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){if(e.x<0||e.x>w||e.y<0||e.y>w)return;const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:u}=this._current,m=this._current.zoomRange[0],d=U(t),f=this._current.shaping.bounds.width/(1<<R),g=Math.sqrt(n||F)/(1<<R),_=Math.min(i,r-i),p=h.isMultiline?j:Math.log2(_/(g+f/2)),y=0===t?p:Math.min(d,p),x=Math.max(m,this._zoomLevel+R-y),P=this._zoomLevel-x,b=h.bounds.width/2*2**P,M=$(a,c,u,t,this._zoomLevel),v=T(c,u,t,this._zoomLevel,l);s&&P<0?this._placeStraightAlong(e,m,M,v):"parallel"===o||h.isMultiline?this._placeStraightAlong(e,x,M,v):"curved"===o&&this._placeCurved(e,x,b,M,v)}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current,a=this._createLineLabelMetric(n,r,s,e.x,e.y);this._registerLineCalloutMetric(a),o.metricStart(a);const l=e.clone(),c=e.angle*(180/Math.PI)%360,h=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(l,t,1,c),this._placeBack(e,l,t,i,1,c),this._placeForward(e,l,t,i,1,c)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(l,t,0,h),this._placeBack(e,l,t,i,0,h),this._placeForward(e,l,t,i,0,h)),o.metricEnd()}_placeStraightAlong(e,t,r,a){const{out:l,id:c,shaping:h,zoomRange:u,referenceBounds:m}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,_=e.clone(),p=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g),P=this._createLineLabelMetric(c,r,a,e.x,e.y);if(this._registerLineCalloutMetric(P),l.metricStart(P),x){const r=Math.max(t,u[0],0),a=Math.min(j,u[1]),f=s(n(),-e.angle),g={minZoom:r,maxZoom:a,clipAngle:p,mapAligned:!0,isLineLabel:!0},_=i(this.evaluatedMeshParams.offsetX),x=i(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=d(_,-1*x),[i,r]=h.shapeBackground(o(n(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,m,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=d(_,x),[i,r]=h.shapeBackground(o(n(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,m,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(_,t,1,p,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(_,t,0,y,!0),l.metricEnd()}_registerLineCalloutMetric(e){this._calloutVisuals.push({metric:e,featureAnchor:C(this._current.calloutPaths,e.anchorX,e.anchorY),referenceInfo:this._createLocalCalloutReferenceInfo(this._current.shaping)})}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+A;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+A}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+A;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+A}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,u=this._getBoundsOffset(e.angle);for(const m of h){const h=m.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(m.x+m.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+A))),_=Math.max(t,s?0:g);m.angle=e.angle+(1-i)*Math.PI;const p=[Math.max(l[0],_),Math.min(l[1],j)];this._writeLineGlyph(o,n,e.x,e.y,m,p,r,c),this._writeLineGlyphBox(o,m,i,p,u)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,u=c.glyphs,m=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*m,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const _ of u){const t=_.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const u=Math.abs(_.x+_.width/2-c.bounds.x),m=Math.max(0,this._zoomLevel+Math.log2(u/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(u/(i+e.length+A)));if(0===m)continue;_.angle=e.angle+(1-o)*Math.PI;const p=[d,m];this._writeLineGlyph(a,l,f.x,f.y,_,p,n,h),this._writeLineGlyphBox(a,_,o,p,g)}}_getBoundsOffset(e){const t=i(this.evaluatedMeshParams.offsetX),r=i(this.evaluatedMeshParams.offsetY),o=d(t,r),l=s(n(),-e);return a(o,o,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:u,outlineSize:m}=this._textMeshTransformProps,d=this._getDefaultGlyphMetrics(this.evaluatedMeshParams.glyphs),f=s.fontSize??h;this._writeQuad(e,t,i,r,{sdfSize:d.sdfSize,sdfRadius:d.sdfRadius,texcoords:l,offsets:c,fontSize:f,haloSize:u,outlineSize:m,color:s.color?D(s.color):D(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new L(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=i}}function Z(e,t){const i=new v,{coords:r,lengths:s}=e,o=f(),n=f(),a=f(),d=f(),g=f(),_=f(),p=2;let y=0;for(let f=0;f<s.length;f++){const e=s[f];for(let s=0;s<e;s++){const f=p*(s+y-1),x=p*(s+y),P=p*(s+y+1);s>0?l(o,r[f],r[f+1]):l(o,0,0),l(n,r[x],r[x+1]),s<e-1?l(a,r[P],r[P+1]):l(a,0,0),0===s?l(d,0,0):(c(d,n,o),h(d,d),l(d,d[1],-d[0])),s===e-1?l(g,0,0):(c(g,a,n),h(g,g),l(g,g[1],-g[0])),u(_,d,g),h(_,_);const b=_[0]*g[0]+_[1]*g[1];0!==b&&m(_,_,b),m(_,_,t),i.coords.push(n[0]+_[0],n[1]+_[1])}i.lengths.push(e),y+=e}return i}export{W as LabelMeshWriter,Y as labelIdHash,k as labelMetricHash,$ as lineLabelIdHash,T as lineLabelMetricHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{CIMSymbolUnits as i}from"../../../../../../../symbols/cim/types.js";import{spritePadding as r,gradientTextureExternalPadding as s}from"../../../definitions.js";import{packBitset as o}from"../fill/meshWriterUtils.js";import{bitset as n}from"./gradientStrokeConstants.js";import{LineMeshWriter as a,LineVertexSpec as c}from"./LineMeshWriter.js";import{DataType as p}from"../../../../../../webgl/enums.js";const m={createComputedParams:t=>t,optionalAttributes:c.optionalAttributes,attributes:{...c.attributes,bitset:{type:p.UNSIGNED_BYTE,count:1,pack:({gradientMethod:t,gradientSizeUnits:e,gradientType:r})=>o([[n.isAlongLine,"alongline"===t.toLowerCase()],[n.isAbsoluteSize,e===i.Absolute],[n.isDiscrete,"discrete"===r.toLowerCase()]])},tlbr:{type:p.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:i,height:o}=t,n=e.x+r+s,a=e.y+r;return[n,a,n+i-2*s,a+o]}},accumulatedDistance:{type:p.HALF_FLOAT,count:1,packTessellation:({distance:t,pathLength:e,distanceOffset:i})=>(i+t)/e},gradientSize:{type:p.HALF_FLOAT,count:1,pack:({gradientSize:e,gradientSizeUnits:r})=>r===i.Relative?e/100:t(e)},totalLength:{type:p.HALF_FLOAT,count:1,packTessellation:({pathLength:t})=>t},segmentDirection:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]}}};class l extends a{get _preventEffectClipping(){return!0}constructor(t,e,i,r){super(t,e,i,r),this.vertexSpec=m,this._tessellationOptions.textured=!0}_write(t,{target:i,
|
|
2
|
+
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{CIMSymbolUnits as i}from"../../../../../../../symbols/cim/types.js";import{spritePadding as r,gradientTextureExternalPadding as s}from"../../../definitions.js";import{packBitset as o}from"../fill/meshWriterUtils.js";import{bitset as n}from"./gradientStrokeConstants.js";import{LineMeshWriter as a,LineVertexSpec as c}from"./LineMeshWriter.js";import{DataType as p}from"../../../../../../webgl/enums.js";const m={createComputedParams:t=>t,optionalAttributes:c.optionalAttributes,attributes:{...c.attributes,bitset:{type:p.UNSIGNED_BYTE,count:1,pack:({gradientMethod:t,gradientSizeUnits:e,gradientType:r})=>o([[n.isAlongLine,"alongline"===t.toLowerCase()],[n.isAbsoluteSize,e===i.Absolute],[n.isDiscrete,"discrete"===r.toLowerCase()]])},tlbr:{type:p.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:i,height:o}=t,n=e.x+r+s,a=e.y+r;return[n,a,n+i-2*s,a+o]}},accumulatedDistance:{type:p.HALF_FLOAT,count:1,packTessellation:({distance:t,pathLength:e,distanceOffset:i})=>(i+t)/e},gradientSize:{type:p.HALF_FLOAT,count:1,pack:({gradientSize:e,gradientSizeUnits:r})=>r===i.Relative?e/100:t(e)},totalLength:{type:p.HALF_FLOAT,count:1,packTessellation:({pathLength:t})=>t},segmentDirection:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]}}};class l extends a{get _preventEffectClipping(){return!0}constructor(t,e,i,r){super(t,e,i,r),this.vertexSpec=m,this._tessellationOptions.textured=!0}_write(t,{target:i,effect:r}){const s=r?.geometry??e.fromFeatureSetReaderCIM(i);if(!s)return;const{sprite:o}=this.evaluatedMeshParams;this._writeGeometry(t,i,s,o?.textureBinding)}}export{l as GradientStrokeMeshWriter,m as GradientStrokeVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{thinLineHalfWidthThreshold as s}from"../../../definitions.js";import{LineTessellation as i}from"../../../TurboLine.js";import{clipLinesMarshall as r}from"../../../mesh/templates/templateUtils.js";import{processLineCapInput as n,processLineJoinInput as o,packRounded as a,processColorInput as h,getMinMaxZoom as c}from"../fill/meshWriterUtils.js";import{MeshWriter as l}from"../mesh/MeshWriter.js";import{getLineClippingMargin as u}from"../mesh/utils.js";import{DataType as m}from"../../../../../../webgl/enums.js";class f{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const d={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:m.HALF_FLOAT,count:2,pack:({scaleInfo:t},{tileInfo:e})=>c(t,e)}},attributes:{id:{type:m.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:m.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:m.UNSIGNED_BYTE,count:1},color:{type:m.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>h(t)},offset:{type:m.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[a(t,16),a(e,16)]},normal:{type:m.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[a(t,16),a(e,16)]},halfWidth:{type:m.HALF_FLOAT,count:1,pack:({width:e})=>t(.5*e)},referenceHalfWidth:{type:m.HALF_FLOAT,count:1,pack:({referenceWidth:e})=>t(.5*e)}}};class p{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const _=65535;function x(t,e,i=0){const r=e&&t<s?0:Math.max(1,2*t+1);return Math.max(r,i)}class T extends l{getCalloutCollisionPadding(){return t(.5*this.evaluatedMeshParams.width)}get _effectRotation(){const{effectRotation:t,effectRotationType:e,useEffectOrigin:s,viewRotation:i}=this.evaluatedMeshParams;return null==t&&null==i?null:{value:t,type:e,useEffectOrigin:!!s,viewRotation:i}}constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=d,this._currentWrite=new p,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:_,textured:!1},this._tessParams=new f,this._initializeTessellator()}writeLineVertices(t,e,s){const
|
|
2
|
+
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{thinLineHalfWidthThreshold as s}from"../../../definitions.js";import{LineTessellation as i}from"../../../TurboLine.js";import{clipLinesMarshall as r}from"../../../mesh/templates/templateUtils.js";import{processLineCapInput as n,processLineJoinInput as o,packRounded as a,processColorInput as h,getMinMaxZoom as c}from"../fill/meshWriterUtils.js";import{MeshWriter as l}from"../mesh/MeshWriter.js";import{getLineClippingMargin as u}from"../mesh/utils.js";import{DataType as m}from"../../../../../../webgl/enums.js";class f{constructor(){this.extrusionOffsetX=0,this.extrusionOffsetY=0,this.normalX=0,this.normalY=0,this.directionX=0,this.directionY=0,this.distance=0,this.pathLength=0,this.distanceOffset=0,this.lineLength=0}}const d={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:m.HALF_FLOAT,count:2,pack:({scaleInfo:t},{tileInfo:e})=>c(t,e)}},attributes:{id:{type:m.UNSIGNED_BYTE,count:3,pack:"id"},pos:{type:m.SHORT,count:2,pack:"position",packPrecisionFactor:10},bitset:{type:m.UNSIGNED_BYTE,count:1},color:{type:m.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:t})=>h(t)},offset:{type:m.BYTE,count:2,packPrecisionFactor:16,packTessellation:({extrusionOffsetX:t,extrusionOffsetY:e})=>[a(t,16),a(e,16)]},normal:{type:m.BYTE,count:2,packPrecisionFactor:16,packTessellation:({normalX:t,normalY:e})=>[a(t,16),a(e,16)]},halfWidth:{type:m.HALF_FLOAT,count:1,pack:({width:e})=>t(.5*e)},referenceHalfWidth:{type:m.HALF_FLOAT,count:1,pack:({referenceWidth:e})=>t(.5*e)}}};class p{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0,this.distanceOffset=0}}const _=65535;function x(t,e,i=0){const r=e&&t<s?0:Math.max(1,2*t+1);return Math.max(r,i)}class T extends l{getCalloutCollisionPadding(){return t(.5*this.evaluatedMeshParams.width)}getRenderedLineWidth(){return t(this.evaluatedMeshParams.width)}get _effectRotation(){const{effectRotation:t,effectRotationType:e,useEffectOrigin:s,viewRotation:i}=this.evaluatedMeshParams;return null==t&&null==i?null:{value:t,type:e,useEffectOrigin:!!s,viewRotation:i}}constructor(t,e,s,i){super(t,e,s,i),this.vertexSpec=d,this._currentWrite=new p,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:_,textured:!1},this._tessParams=new f,this._initializeTessellator()}writeLineVertices(t,e,s,i){const r=this._getLines(e,i);null!=r&&this._writeVertices(t,s,r)}_initializeTessellator(){this._lineTessellator=new i(this._writeTesselatedVertex.bind(this),this._writeTriangle.bind(this),!0)}_write(t,{target:s,effect:i}){const r=i?.geometry??e.fromFeatureSetReaderCIM(s);r&&this._writeGeometry(t,s,r)}_writeGeometry(t,e,s,i){t.recordStart(this.instanceId,this.attributeLayout,i),this.writeLineVertices(t,s,e),t.recordEnd()}_getLines(t,e){return r(t,e??u(this.evaluatedMeshParams))}_writeVertices(e,s,i){const{_currentWrite:r,_tessellationOptions:a,evaluatedMeshParams:h}=this,{width:c,capType:l,joinType:u,miterLimit:m,hasSizeVV:f}=h,d=t(.5*c);a.halfWidth=d,a.capType=n(l),a.joinType=o(u),a.miterLimit=m;const p=!f;r.out=e,r.id=s.getDisplayId(),r.vertexCount=0,r.indexCount=0,r.vertexFrom=e.vertexCount(),r.vertexBounds=x(d,p,h.minPixelBuffer);for(const{line:t,start:n,pathLength:o}of i)a.initialDistance=n%_,r.pathLength=o,r.distanceOffset=Math.floor(n/_)*_,this._lineTessellator.tessellate(t,a,p)}_writeTesselatedVertex(t,e,s,i,r,n,o,a,h,c,l){const{out:u,id:m,vertexBounds:f,pathLength:d,distanceOffset:p}=this._currentWrite;return this.hasEffects&&u.recordBounds(t,e,f,f),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=a,this._tessParams.normalX=h,this._tessParams.normalY=c,this._tessParams.directionX=r,this._tessParams.directionY=n,this._tessParams.distance=l,this._tessParams.pathLength=d,this._tessParams.distanceOffset=p,this._writeVertex(u,m,t,e,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(t,e,s){const{out:i}=this._currentWrite;i.indexEnsureSize(3),i.indexWrite(t),i.indexWrite(e),i.indexWrite(s),this._currentWrite.indexCount+=3}}export{T as LineMeshWriter,f as LineTessellationParams,d as LineVertexSpec,x as getLinePixelBufferSize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{spritePadding as r}from"../../../definitions.js";import{packBitset as s}from"../fill/meshWriterUtils.js";import{LineMeshWriter as o,LineVertexSpec as i}from"./LineMeshWriter.js";import{bitsetGenericConsiderAlphaOnly as a,bitsetLineScaleDash as c,bitsetLineIsSdf as n}from"../shaders/constants.js";import{DataType as p}from"../../../../../../webgl/enums.js";const u={createComputedParams:t=>t,optionalAttributes:i.optionalAttributes,attributes:{...i.attributes,bitset:{type:p.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:t,shouldScaleDash:e,isSDF:r})=>s([[a,t],[c,e],[n,r]])},tlbr:{type:p.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:o}=t,i=e.x+r,a=e.y+r;return[i,a,i+s,a+o]}},accumulatedDistance:{type:p.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},segmentDirection:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},offsetAlongLine:{type:p.HALF_FLOAT,count:1,pack:({offsetAlongLine:e})=>t(e)},capType:{type:p.UNSIGNED_BYTE,count:1,pack:({capType:t})=>{switch(t){case"Butt":case"butt":default:return 0;case"Square":case"square":return 1;case"Round":case"round":return 2}}}}};class m extends o{constructor(t,e,r,s){super(t,e,r,s),this.vertexSpec=u,this._tessellationOptions.textured=!0}_write(t,{target:r,
|
|
2
|
+
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{spritePadding as r}from"../../../definitions.js";import{packBitset as s}from"../fill/meshWriterUtils.js";import{LineMeshWriter as o,LineVertexSpec as i}from"./LineMeshWriter.js";import{bitsetGenericConsiderAlphaOnly as a,bitsetLineScaleDash as c,bitsetLineIsSdf as n}from"../shaders/constants.js";import{DataType as p}from"../../../../../../webgl/enums.js";const u={createComputedParams:t=>t,optionalAttributes:i.optionalAttributes,attributes:{...i.attributes,bitset:{type:p.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:t,shouldScaleDash:e,isSDF:r})=>s([[a,t],[c,e],[n,r]])},tlbr:{type:p.UNSIGNED_SHORT,count:4,pack:({sprite:t})=>{const{rect:e,width:s,height:o}=t,i=e.x+r,a=e.y+r;return[i,a,i+s,a+o]}},accumulatedDistance:{type:p.UNSIGNED_SHORT,count:1,packTessellation:({distance:t})=>t},segmentDirection:{type:p.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:t,directionY:e})=>[t,e]},offsetAlongLine:{type:p.HALF_FLOAT,count:1,pack:({offsetAlongLine:e})=>t(e)},capType:{type:p.UNSIGNED_BYTE,count:1,pack:({capType:t})=>{switch(t){case"Butt":case"butt":default:return 0;case"Square":case"square":return 1;case"Round":case"round":return 2}}}}};class m extends o{constructor(t,e,r,s){super(t,e,r,s),this.vertexSpec=u,this._tessellationOptions.textured=!0}_write(t,{target:r,effect:s}){const o=s?.geometry??e.fromFeatureSetReaderCIM(r);if(!o)return;const{sprite:i}=this.evaluatedMeshParams;this._writeGeometry(t,r,o,i?.textureBinding)}}export{m as TexturedLineMeshWriter,u as texturedLineVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{applyParentTransform as e}from"../../../../../../../symbols/cim/utils.js";import{spritePadding as i}from"../../../definitions.js";class s{static from(t){return"width"in t?this.fromSimpleMeshParams(t):this.fromComplexMeshParams(t)}static fromSimpleMeshParams(e){const i=new s(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects),{type:h,width:o,height:a,angle:r,alignment:n,outlineSize:c,referenceSize:m,sprite:d,overrideOutlineColor:l}=e;return i.rawWidth=t(o),i.rawHeight=t(a),i.angle=r,i.alignment=n,i.outlineSize=t(c),i.referenceSize=t(m),i.overrideOutlineColor=l,i.offsetX=t(e.offsetX),i.offsetY=t(e.offsetY),"simple"!==h||d.sdf||(i.rawWidth=d.width,i.rawHeight=d.height),i._initializeSizeComputation(!1,e.hasSizeVV),i._captureBaseSizeState(),i._computeSize(),i._captureBaseComputedSize(),i}static fromComplexMeshParams(i){const h=new s(i.sprite,i.color,i.outlineColor,i.minPixelBuffer,i.placement,i.scaleInfo,i.effects);let{alignment:o,transforms:a,size:r,scaleX:n,anchorX:c,anchorY:m,angle:d,colorLocked:l,frameHeight:f,widthRatio:u,offsetX:p,offsetY:g,outlineSize:_,referenceSize:S,scaleFactor:z,sizeRatio:b,isAbsoluteAnchorPoint:C,rotateClockwise:w,scaleSymbolsProportionally:x,sprite:H}=i;if(a&&a.infos.length>0){const t=e(r,d,w,p,g,a);r=t.size,d=t.rotation,p=t.offsetX,g=t.offsetY,w=!1}z&&(r*=z,p*=z,g*=z);const
|
|
2
|
+
import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{applyParentTransform as e}from"../../../../../../../symbols/cim/utils.js";import{spritePadding as i}from"../../../definitions.js";class s{static from(t){return"width"in t?this.fromSimpleMeshParams(t):this.fromComplexMeshParams(t)}static fromSimpleMeshParams(e){const i=new s(e.sprite,e.color,e.outlineColor,e.minPixelBuffer,e.placement,e.scaleInfo,e.effects),{type:h,width:o,height:a,angle:r,alignment:n,outlineSize:c,referenceSize:m,sprite:d,overrideOutlineColor:l}=e;return i.rawWidth=t(o),i.rawHeight=t(a),i.angle=r,i.alignment=n,i.outlineSize=t(c),i.referenceSize=t(m),i.overrideOutlineColor=l,i.offsetX=t(e.offsetX),i.offsetY=t(e.offsetY),"simple"!==h||d.sdf||(i.rawWidth=d.width,i.rawHeight=d.height),i._initializeSizeComputation(!1,e.hasSizeVV),i._captureBaseSizeState(),i._computeSize(),i._captureBaseComputedSize(),i}static fromComplexMeshParams(i){const h=new s(i.sprite,i.color,i.outlineColor,i.minPixelBuffer,i.placement,i.scaleInfo,i.effects);let{alignment:o,transforms:a,size:r,scaleX:n,anchorX:c,anchorY:m,angle:d,colorLocked:l,frameHeight:f,widthRatio:u,offsetX:p,offsetY:g,outlineSize:_,referenceSize:S,scaleFactor:z,sizeRatio:b,isAbsoluteAnchorPoint:C,rotateClockwise:w,scaleSymbolsProportionally:x,sprite:H}=i;if(a&&a.infos.length>0){const t=e(r,d,w,p,g,a);r=t.size,d=t.rotation,p=t.offsetX,g=t.offsetY,w=!1}z&&(r*=z,p*=z,g*=z);const X=n*(H.width/H.height);h.alignment=o,h.rawHeight=t(r),h.rawWidth=h.rawHeight*X,h.referenceSize=t(S),h.sizeRatio=b,h.sdfDecodeCoeff=(H.sdfDecodeCoeff??1)*b,h.angle=d,h.rotateClockwise=w,h.anchorX=c,h.anchorY=m,h.offsetX=t(p),h.offsetY=t(g),C&&r&&(H.sdf?h.anchorX=c/(r*u):h.anchorX=c/(r*X),h.anchorY=m/r);const W=x&&f?r/f:1;return h.outlineSize=0===_||isNaN(_)?0:t(_)*W,h.scaleSymbolsProportionally=x,h.colorLocked=l,h._initializeSizeComputation(!0,i.hasSizeVV),h._captureBaseSizeState(),h._computeSize(),h._captureBaseComputedSize(),h}constructor(t,e,i,s,h,o,a){this.sprite=t,this.color=e,this.outlineColor=i,this.minPixelBuffer=s,this.placement=h,this.scaleInfo=o,this.effects=a,this.rawWidth=0,this.rawHeight=0,this.angle=0,this.outlineSize=0,this.referenceSize=0,this.sizeRatio=1,this.sdfDecodeCoeff=1,this.alignment=0,this.scaleSymbolsProportionally=!1,this.overrideOutlineColor=!1,this.colorLocked=!1,this.anchorX=0,this.anchorY=0,this.computedWidth=0,this.computedHeight=0,this.texXmin=0,this.texYmin=0,this.texXmax=0,this.texYmax=0,this.offsetX=0,this.offsetY=0,this.rotateClockwise=!0,this._baseRawWidth=0,this._baseRawHeight=0,this._baseComputedWidth=0,this._baseComputedHeight=0,this._baseAnchorX=0,this._baseAnchorY=0,this._isCIM=!1,this._hasSizeVV=!1}applyPointSymbolCalloutBackgroundScale(t,e,i,s=0,h=1,o=1,a=!1){if(e+=2*s,i+=2*s,a&&(e+=s,i+=s),!Number.isFinite(e)||!Number.isFinite(i)||e<=0||i<=0||h<=0||o<=0||this._baseComputedWidth<=0||this._baseComputedHeight<=0)return void this.resetSizeOverride();let r=this._baseComputedWidth,n=this._baseComputedHeight;switch(t){case 1:{const t=e/(this._baseComputedWidth*h),s=i/(this._baseComputedHeight*o),c=a?Math.sqrt(t*t+s*s):Math.max(t,s);r*=c,n*=c;break}case 2:case 4:r=e,n=i;break;case 3:{const t=Math.max(e-this._baseComputedWidth,i-this._baseComputedHeight);r+=t,n+=t;break}}this._applyComputedSizeTarget(r,n),0!==t&&(this.anchorX=0,this.anchorY=0)}getPointSymbolCalloutBounds(t){const e=this.computedWidth,i=this.computedHeight,s=(t.xmin+t.xmax)/2+this.offsetX-this.anchorX*e,h=(t.ymin+t.ymax)/2+this.offsetY-this.anchorY*i;return{xmin:s-e/2,ymin:h-i/2,xmax:s+e/2,ymax:h+i/2}}resetSizeOverride(){this._restoreBaseSize(),this._computeSize()}get boundsInfo(){return{size:Math.max(this.computedHeight,this.computedWidth),offsetX:this.offsetX,offsetY:this.offsetY}}_initializeSizeComputation(t,e){this._isCIM=t,this._hasSizeVV=e}_captureBaseSizeState(){this._baseRawWidth=this.rawWidth,this._baseRawHeight=this.rawHeight,this._baseAnchorX=this.anchorX,this._baseAnchorY=this.anchorY}_captureBaseComputedSize(){this._baseComputedWidth=this.computedWidth,this._baseComputedHeight=this.computedHeight}_restoreBaseSize(){this.rawWidth=this._baseRawWidth,this.rawHeight=this._baseRawHeight,this.anchorX=this._baseAnchorX,this.anchorY=this._baseAnchorY}_applyComputedSizeTarget(t,e){const i=this._baseComputedWidth,s=this._baseComputedHeight;!Number.isFinite(t)||!Number.isFinite(e)||t<=0||e<=0||i<=0||s<=0?this.resetSizeOverride():(this._restoreBaseSize(),this.rawWidth*=t/i,this.rawHeight*=e/s,this._computeSize())}_computeSize(){const{sprite:t}=this,e=this._hasSizeVV,s=this._isCIM,a=!!t.sdf,r=t.sdfPaddingRatio??.5,{rawWidth:n,rawHeight:c,sizeRatio:m,outlineSize:d}=this,l=t.rect;let f=n*m,u=c*m,p=0,g=0;if(a){const i=1/(1-r);if(f*=i,u*=i,e)this.computedWidth=f,this.computedHeight=u;else{const e=s&&n>c?f:n,i=c,h=d+2*1;this.computedWidth=Math.min(e+h,f),this.computedHeight=Math.min(i+h,u);const o=Math.max(t.width,t.height)/Math.max(f,u);p=(this.computedWidth-f)*o,g=(this.computedHeight-u)*o}}else this.computedWidth=f*(l.width/t.width),this.computedHeight=u*(l.height/t.height),p=2*i,g=2*i;const _=l.x+i-p/2,S=l.y+i-g/2,z=_+t.width+p,b=S+t.height+g;this.texXmin=h(_),this.texYmin=h(S),this.texXmax=o(z),this.texYmax=o(b),this.computedWidth*=(this.texXmax-this.texXmin)/(z-_),this.computedHeight*=(this.texYmax-this.texYmin)/(b-S),this.anchorX*=f/this.computedWidth,this.anchorY*=u/this.computedHeight}}function h(t,e=1e-7){const i=Math.ceil(t);return i-t<e?i:Math.floor(t)}function o(t,e=1e-7){const i=Math.floor(t);return t-i<e?i:Math.ceil(t)}export{s as ComputedMarkerParams};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as o,rotate as r}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as a}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as s}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as o,rotate as r}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as a}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as s}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as u,processColorInput as m,getMinMaxZoom as d,getBitMask as f}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as p}from"./markerConstants.js";import{MeshWriter as y}from"../mesh/MeshWriter.js";import{DataType as P}from"../../../../../../webgl/enums.js";const g=3.14159265359/180,x=128/Math.PI;function M(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return M(e*x,256)}function k(e,s,i,n,c=!1){const l=a(),u=c?1:-1;return t(l),(s||i)&&o(l,l,[s,-i]),n&&r(l,l,u*g*-n),l}const S={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:P.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:P.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:P.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:P.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:o,overrideOutlineColor:r,colorLocked:a})=>{let s=0;return e.sdf&&(s|=f(p.bitset.isSDF)),1===t&&(s|=f(p.bitset.isMapAligned)),o&&(s|=f(p.bitset.scaleSymbolsProportionally)),r&&(s|=f(p.bitset.overrideOutlineColor)),a&&(s|=f(p.bitset.colorLocked)),s}},offset:{type:P.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:o,anchorX:r,anchorY:a,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=k(0,i,n,-e,c),u=-(.5+r)*t,m=-(.5-a)*o,d=[u,m],f=[u+t,m],h=[u,m+o],p=[u+t,m+o];return s(d,d,l),s(f,f,l),s(h,h,l),s(p,p,l),[d,f,h,p]}}},textureUV:{type:P.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:o,texYmin:r})=>[[t,r],[e,r],[t,o],[e,o]]}},color:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>m(e)},outlineColor:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>m(e)},sizing:{type:P.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:o,referenceSize:r})=>{const a=Math.max(e,t);return[u(a,128),u(o,128),u(r,128),0]}},placementAngle:{type:P.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:P.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class v extends y{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=S}get _requiresPerFeaturePacking(){return null!=this._getPointSymbolCalloutMarkerEffect()}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}getLocalCalloutReferenceInfo(){const e=this.evaluatedMeshParams.boundsInfo;if(!e)return;const t=e.size/2;return{anchor:{x:0,y:0},bodyBounds:{xmin:e.offsetX-t,ymin:e.offsetY-t,xmax:e.offsetX+t,ymax:e.offsetY+t},bodyBoundsUseReferenceScale:!0}}getCalloutCollisionBounds(e){if(this._getPointSymbolCalloutMarkerEffect())return this.evaluatedMeshParams.getPointSymbolCalloutBounds(e.bodyBounds)}_prepareEvaluatedMeshParams(t,o,r,a){const s=this._getPointSymbolCalloutMarkerEffect();if(!s)return;const i=a?.effect?.referenceBounds;if(!i)return void t.resetSizeOverride();const n=i.xmax-i.xmin,c=i.ymax-i.ymin;t.applyPointSymbolCalloutBackgroundScale(s.backgroundScale,n,c,e(s.gap??0),s.contentWidthRatio,s.contentHeightRatio,s.contentRequiresRadialFit)}_write(e,{target:t,effect:o,scaleFactor:r}){const a=o?.geometry,s=this.evaluatedMeshParams.sprite?.textureBinding,i=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,s);const l=this.evaluatedMeshParams.minPixelBuffer,u=Math.max(this.evaluatedMeshParams.computedWidth,l),m=Math.max(this.evaluatedMeshParams.computedHeight,l),d=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,f=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,h=this.evaluatedMeshParams.offsetX+d,p=-this.evaluatedMeshParams.offsetY+f;if(null!=this.evaluatedMeshParams.placement){let o=null;if(null!=a){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(o=n(a,2*(e*(r??1)),!1),null===o)return}this._writePlacedMarkers(e,t,o,u,m)}else if(a?.nextPath()){a.nextPoint();const t=a.x,o=a.y;e.recordBounds(t+h,o+p,u,m),this._writeQuad(e,i,t,o)}else if("esriGeometryPolygon"===t.geometryType){const o=t.readCentroidForDisplay();if(!o)return;const[r,a]=o.coords;e.recordBounds(r+h,a+p,u,m),this._writeQuad(e,i,r,a)}else if("esriGeometryPoint"===t.geometryType){const o=t.readXForDisplay(),r=t.readYForDisplay();e.recordBounds(o+h,r+p,u,m),this._writeQuad(e,i,o,r)}else{const o=t.readGeometryForDisplay();o?.forEachVertex((t,o)=>{e.recordBounds(t+h,o+p,u,m),Math.abs(t)>c||Math.abs(o)>c||this._writeQuad(e,i,t,o)})}e.recordEnd()}_writePlacedMarkers(t,o,r,a,s){const n=r??i.fromFeatureSetReaderCIM(o);if(!n)return;const u=-1,m=l.getPlacement(n,u,this.evaluatedMeshParams.placement,e(1),t.id);if(!m)return;const d=o.getDisplayId();let f=m.next();const h=this.evaluatedMeshParams.offsetX,p=-this.evaluatedMeshParams.offsetY;for(;null!=f;){const e=f.tx,o=-f.ty;if(Math.abs(e)>c||Math.abs(o)>c){f=m.next();continue}const r=-f.getAngle();t.recordBounds(e+h,o+p,a,s),this._writeQuad(t,d,e,o,r),f=m.next()}}_writeQuad(e,t,o,r,a){const s=e.vertexCount(),i=null==a?null:{placementAngle:a};this._writeVertex(e,t,o,r,i),e.indexWrite(s+0),e.indexWrite(s+1),e.indexWrite(s+2),e.indexWrite(s+1),e.indexWrite(s+3),e.indexWrite(s+2)}_getPointSymbolCalloutMarkerEffect(){for(const{effect:e}of this.effectInfos??[])if("CIMPointSymbolCallout"===e.type&&"marker"===e.part)return e}}export{v as MarkerMeshWriter,S as MarkerVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{GeometryCursor as
|
|
2
|
+
import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{getBalloonBodyBounds as t,getBalloonCornerRadius as o,inflateBounds as n,scaleMargins as r,autoSnap as i,contains as l,distance as u,createBalloonGeometry as s,createAccentBar as a,createLeaderPath as c}from"../../../../../../../symbols/cim/callouts/effects/calloutUtils.js";const f=96/72,y=1,d=16;class m{constructor(e){this._properties=e}getEffectExecutionContextOverrides(e,t=!1){const o=this.getReferenceInfo(),n=p(e),r=o?.bodyBoundsUseReferenceScale?e.scaleFactor??1:1;return{scaleFactor:r,callout:{relativeAnchor:o?.anchor??void 0,relativeLayoutAnchor:o?.layoutAnchor??void 0,absoluteAnchor:n?{x:n.x,y:-n.y}:void 0,bodyBounds:o?x(o.bodyBounds,r):void 0,preserveInputGeometry:t}}}resolveEffectGeometry(t,o,n){const r=this._getReferencedEffectGeometry(t);return r?{geometry:r,preserveInputGeometry:!0}:{geometry:n?o:e.fromJSON({x:0,y:0}),preserveInputGeometry:!1}}getViewRotation(e){return this._properties.collisionVisibility?0:e}getCollisionBounds(e=1){const o=this.getReferenceInfo();if(!o)return;if(g(this._properties.writer))return this._properties.writer.getCalloutCollisionBounds(o,e);const n=o.bodyBoundsUseReferenceScale?e:1,r=x(o.collisionBodyBounds??o.bodyBounds,n);for(const i of this._properties.effects??[]){if(!O(i)||"background"!==i.part||"CIMBackgroundCallout"!==i.type&&"CIMBalloonCallout"!==i.type)continue;const e=i.margin,o=f*n,l={xmin:r.xmin-(e?.left??0)*o,ymin:r.ymin-(e?.bottom??0)*o,xmax:r.xmax+(e?.right??0)*o,ymax:r.ymax+(e?.top??0)*o};return"CIMBalloonCallout"===i.type?t(l,i.balloonStyle):l}}getCornerRadius(e=1){const t=this.getReferenceInfo();if(!t)return 0;const i=t.bodyBoundsUseReferenceScale?e:1,l=x(t.bodyBounds,i);for(const u of this._properties.effects??[])if(O(u)&&"background"===u.part&&"CIMBalloonCallout"===u.type)return o(n(l,r(u.margin,f*i)),u.balloonStyle);return 0}getPartCollisionBounds(e=1){const t=this.getReferenceInfo();if(!t)return[];if(h(this._properties.writer))return this._properties.writer.getCalloutPartCollisionBounds(e);const o=t.bodyBoundsUseReferenceScale?e:1,n=x(t.bodyBounds,o),r=x(t.collisionBodyBounds??t.bodyBounds,o),i=U(n),l=U(r),u=t.anchor??i,s=t.layoutAnchor??u,a={x:u.x-(i.x-l.x),y:u.y-(i.y-l.y)},c={x:s.x-(i.x-l.x),y:s.y-(i.y-l.y)},d=f*o,m=Math.max(y,C(this._properties.writer)),p=[];for(const f of this._properties.effects??[])O(f)&&p.push(...b(f,r,a,c,d,m));return p}getReferenceInfo(){return G(this._properties.reference)}getReferencedRotation(){const e=this._properties.reference;if(e&&E(e)){const t=e.getCalloutRotation();return null!=t&&Number.isFinite(t)?t:void 0}}_getReferencedEffectGeometry(e){const t=this._properties.reference;return t&&A(t)?t.getCalloutEffectGeometry(e)??void 0:void 0}}function x(e,t){return 1===t?e:{xmin:e.xmin*t,ymin:e.ymin*t,xmax:e.xmax*t,ymax:e.ymax*t}}function p(e){const{matcher:t,target:o,tileKey:n}=e;if(!t||!o||null==n||"function"!=typeof o.getObjectId||!("getMatcherGeometryOverride"in t)||"function"!=typeof t.getMatcherGeometryOverride)return null;const r=t;return r.getMatcherGeometryOverride(`${n}_${o.getObjectId()}`)?.absoluteCalloutAnchor??null}function C(e){return B(e)?e.getCalloutCollisionPadding():0}function g(e){return"getCalloutCollisionBounds"in e&&"function"==typeof e.getCalloutCollisionBounds}function h(e){return"getCalloutPartCollisionBounds"in e&&"function"==typeof e.getCalloutPartCollisionBounds}function B(e){return"getCalloutCollisionPadding"in e&&"function"==typeof e.getCalloutCollisionPadding}function b(e,t,o,n,r,i){switch(e.type){case"CIMBackgroundCallout":return I(e,t,o,n,r,i);case"CIMBalloonCallout":return M(e,t,o,n,r,i);case"CIMPointSymbolCallout":return R(e,t,o,n,r,i);case"CIMSimpleLineCallout":return v(e,t,o,n,r,i)}}function I(e,t,o,i,l,u){const s=n(t,r(e.margin,l));return"background"===e.part?[]:"accent-bar"===e.part?S(a(s,i,(e.gap??0)*l,1),u):N(s,o,i,e,l,u)}function M(e,t,o,i,l,u){const a=n(t,r(e.margin,l));return S(s(a,o,e.balloonStyle,(e.leaderTolerance??0)*l,1,null!=e.dartWidth?e.dartWidth*l:null,i),u,(e,t)=>L(e,o)||L(t,o))}function R(e,t,o,n,r,i){return"marker"===e.part?[]:N(t,o,n,e,r,i)}function N(e,t,o,n,r,s){return l(e,o)||u(i(e,o),o)<(n.leaderTolerance??0)*r?[]:S(c(e,o,n.lineStyle,(n.leaderOffset??0)*r,1,t),s)}function v(e,t,o,n,r,s){const a=!1===e.autoSnap?{x:t.xmin,y:t.ymin}:i(t,n);return l(t,n)||u(a,n)<(e.leaderTolerance??0)*r?[]:_(a,o,s)}function S(e,t,o=()=>!0){const n=[];for(e.reset();e.nextPath();){let r=null;for(;e.nextPoint();){const i={x:e.x,y:e.y};r&&o(r,i)&&n.push(..._(r,i,t)),r=i}}return e.reset(),n}function _(e,t,o){const n=t.x-e.x,r=t.y-e.y,i=0!==n&&0!==r?Math.ceil(Math.max(Math.abs(n),Math.abs(r))/d):1,l=[];for(let u=0;u<i;u++){const t=u/i,s=(u+1)/i,a=e.x+n*t,c=e.y+r*t,f=e.x+n*s,y=e.y+r*s;l.push({xmin:Math.min(a,f)-o,ymin:Math.min(c,y)-o,xmax:Math.max(a,f)+o,ymax:Math.max(c,y)+o})}return l}function G(e){return P(e)?w(e.getLocalCalloutReferenceInfo()):k(e.getBoundsInfo())}function P(e){return"getLocalCalloutReferenceInfo"in e&&"function"==typeof e.getLocalCalloutReferenceInfo}function A(e){return"getCalloutEffectGeometry"in e&&"function"==typeof e.getCalloutEffectGeometry}function E(e){return"getCalloutRotation"in e&&"function"==typeof e.getCalloutRotation}function O(e){return"CIMBackgroundCallout"===e.type||"CIMBalloonCallout"===e.type||"CIMPointSymbolCallout"===e.type||"CIMSimpleLineCallout"===e.type}function k(e){if(!j(e))return;const t=e.size/2,o={xmin:e.offsetX-t,ymin:e.offsetY-t,xmax:e.offsetX+t,ymax:e.offsetY+t};return{anchor:U(o),bodyBounds:o}}function w(e){if(!e||!X(e.bodyBounds))return;const t=e.anchor??U(e.bodyBounds),o=e.layoutAnchor??t,n=e.collisionBodyBounds;return Y(t)&&Y(o)?{anchor:t,...e.layoutAnchor?{layoutAnchor:o}:null,bodyBounds:e.bodyBounds,...n&&X(n)?{collisionBodyBounds:n}:null,...e.bodyBoundsUseReferenceScale?{bodyBoundsUseReferenceScale:!0}:null}:void 0}function U(e){return{x:(e.xmin+e.xmax)/2,y:(e.ymin+e.ymax)/2}}function L(e,t){return e.x===t.x&&e.y===t.y}function j(e){return null!=e&&null!=e.offsetX&&!isNaN(e.offsetX)&&null!=e.offsetY&&!isNaN(e.offsetY)&&null!=e.size&&!isNaN(e.size)}function X(e){return!(null==e.xmin||isNaN(e.xmin)||null==e.ymin||isNaN(e.ymin)||null==e.xmax||isNaN(e.xmax)||null==e.ymax||isNaN(e.ymax))}function Y(e){return null!=e.x&&!isNaN(e.x)&&null!=e.y&&!isNaN(e.y)}export{m as CalloutMeshWriterPolicy,G as getCalloutReferenceInfo,P as isLocalCalloutReferenceProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as
|
|
2
|
+
import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as r}from"../../../../../../../symbols/cim/CIMEffects.js";import{getEffectsInflateSize as s}from"../../../../../../../symbols/cim/utils.js";import{EffectHelper as i}from"../../../../../../../symbols/cim/effects/EffectHelper.js";import{MeshWriterVertexPack as a}from"./MeshWriterVertexPack.js";const n=96/72;class o{constructor(e,t,r,s){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=r,this._viewParams=s,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=a.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||this._requiresPerFeaturePacking||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),e.collisionVisibility=!!this._evaluator.inputMeshParams.collisionVisibility,this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effects(){return this.evaluatedMeshParams.effects}get collisionVisibility(){return!!this._evaluator.inputMeshParams.collisionVisibility}get effectClippingPadding(){return 0}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get placementInfo(){return this._evaluator.inputMeshParams.placement}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}get _requiresPerFeaturePacking(){return!1}get _effectRotation(){return null}setReferences(e){this._references=e}getReference(e){return this._references?.get(e)}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:e}of this.effectInfos||[])await t(e);this.placementInfo&&await r(this.placementInfo.placement)}enqueueRequest(e,t,r){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,r)}write(e,t,r,s,i,a,n,o,c={}){const u={target:r,options:s,level:i,viewExtent:a,scaleFactor:n,matcher:o,...c};this.ensurePacked(t,r,s,u);const l=e.id||"",f=this.evaluatedMeshParams.effects,h=this._createEffectExecutionContext(r,s,l,n,o,u.effect?.executionContext);if(!f||0===f.length)return void this._write(e,u);const m=this.getEffectCursor(r,f,h,u);if(!m)return;let p;for(;p=m.next();)p.invertY(),this._write(e,{...u,effect:{...u.effect,geometry:p},scaleFactor:n})}ensurePacked(e,t,r,s){if(!this._evaluator.hasDynamicProperties&&!this._requiresPerFeaturePacking)return;const i=this._evaluator.hasDynamicProperties?this._evaluator.evaluateMeshParams(e,t,r):this.evaluatedMeshParams;this._prepareEvaluatedMeshParams(i,t,r,s),this._vertexPack.pack(i,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,r,s,i){const a=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,r,s,a,i)}_prepareEvaluatedMeshParams(e,t,r,s){}_createEffectExecutionContext(e,t,r,i,a,o){return{geomUnitsPerPoint:n,maxInflateSize:s(this.evaluatedMeshParams.effects),scale:t.$view.scale,spatialReference:e.metadata.outSpatialReference??e.metadata.spatialReference,preventClipping:this._preventEffectClipping,tileKey:r,scaleFactor:i,matcher:a,target:e,...o}}getEffectCursor(t,r,s,a){null==s.scaleFactor&&(s={...s,scaleFactor:1});const n=void 0!==a.effect?.inputGeometry?a.effect.inputGeometry:null!=t.geometryType&&t.readGeometryForDisplay()?e.fromOptimizedCIM(t.readGeometryForDisplay().clone(),t.geometryType):null;if(!n)return;const o=e.fromOptimizedCIM(n.asOptimized(),n.geometryType);o.invertY();const u=i.executeEffects(r,o,s),l=this._effectRotation,f=l?.value,h=null==f||isNaN(f)?a.effect?.rotation:f,m=a.effect?.viewRotation??l?.viewRotation;if((null==h||isNaN(h))&&(null==m||isNaN(m)))return u;const p=(null==h||isNaN(h)?0:null==f||isNaN(f)||"arithmetic"!==l?.type?h:90-h)+(null==m||isNaN(m)?0:-m);if(0===p)return u;let _=null;return"esriGeometryPoint"===o.geometryType&&(o.reset(),o.nextPath()&&o.nextPoint()&&(_=[o.x,o.y]),o.reset()),new c(u,s,_,l?.useEffectOrigin??!1,-p*Math.PI/180)}}class c{constructor(e,t,r,s,i){this._cursor=e,this._executionContext=t,this._sourceOrigin=r,this._useEffectOrigin=s,this._cos=Math.cos(i),this._sin=Math.sin(i)}next(){this._executionContext.effectOrigin=null;const e=this._cursor.next();if(!e)return null;const t=(this._useEffectOrigin?this._executionContext.effectOrigin:null)??this._sourceOrigin;if(!t)return e;const[r,s]=t,i=e.clone();for(;i.nextPath();)for(;i.nextPoint();){const e=i.x-r,t=i.y-s;i.x=r+e*this._cos-t*this._sin,i.y=s+e*this._sin+t*this._cos}return i.reset(),i}}export{o as MeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const e=new Set(["CIMSimpleLineCallout","CIMBackgroundCallout","CIMBalloonCallout","CIMPointSymbolCallout"]);function n(e){if(0===e.length)return[];const n=new Set(e.filter(t)),
|
|
2
|
+
const e=new Set(["CIMSimpleLineCallout","CIMBackgroundCallout","CIMBalloonCallout","CIMPointSymbolCallout"]);function n(e){if(0===e.length)return[];const n=new Set(e.filter(t)),o=n.size>0?e.find(e=>!t(e)&&32===e.techniqueType)??e.find(e=>!t(e)&&23===e.techniqueType):void 0,l=e.find(e=>23===e.techniqueType&&!t(e))??o??e[0];if(n.size>0&&!o)throw new Error("InternalError: CIM callout symbol has no reference provider");return e.map(e=>{const t=[...e.references?.exports??[]],c=[...e.references?.dependencies??[]];return e===l&&r(t,"label-reference-symbol"),e===o&&r(t,"callout-body"),n.has(e)&&r(c,"callout-body"),{...e,references:{...e.references,...t.length?{exports:t}:null,...c.length?{dependencies:c}:null}}})}function t(n){const t=n.inputParams.effects;return"cim-effect-infos"===t?.type&&t.effectInfos.some(({effect:n})=>e.has(n.type))}function r(e,n){e.includes(n)||e.push(n)}export{n as defineMeshWriterReferences};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as s}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as r,getYDirection as n}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as a,labelPlacementOffsetPadding as l,maxLineHeightRatio as f,minLineHeightRatio as c,maxTextLineWidth as h,minTextLineWidth as d,magicLabelLineHeight as u,packDegreesU8 as m}from"../../../definitions.js";import{shapeTextResource as p,shapeTextResourceForMultipoint as g}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as y,getMinMaxZoom as x,packBitset as S}from"../fill/meshWriterUtils.js";import{MeshWriter as _}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as z,bitsetTextIsMapAligned as b}from"../shaders/constants.js";import{TextMeshTransformProps as M}from"./TextParams.js";import{DataType as R}from"../../../../../../webgl/enums.js";const P=28,B=[4,4],G=[16,4],L={topLeft:G,topRight:G,bottomLeft:G,bottomRight:G};function k(o){return null==o?h:t(e(o),d,h)}function C(e,o){return e/24*u*t(o,c,f)}const T=[4,2],v=[4,6],A={topLeft:T,topRight:T,bottomLeft:v,bottomRight:v},E={topLeft:T,topRight:v,bottomLeft:T,bottomRight:v},w={topLeft:v,topRight:v,bottomLeft:B,bottomRight:B},I={topLeft:B,topRight:B,bottomLeft:v,bottomRight:v},D={topLeft:v,topRight:B,bottomLeft:v,bottomRight:B},N={topLeft:B,topRight:v,bottomLeft:B,bottomRight:v};function U(t){return t.useBackgroundCallout?{backgroundColor:null,borderLineColor:null,borderLineSize:0}:{backgroundColor:t.boxBackgroundColor??t.backgroundColor??null,borderLineColor:t.boxBorderLineColor??t.borderLineColor??null,borderLineSize:t.boxBorderLineSize>0?t.boxBorderLineSize:t.borderLineWidth??0}}const H={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:R.UNSIGNED_SHORT,count:2,packPrecisionFactor:a,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||P]},clipAngle:{type:R.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>O(t||0)},referenceSymbol:{type:R.BYTE,count:4,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,s=r(i?"center":o.horizontalAlignment),a=n(i?"middle":o.verticalAlignment),{offsetX:l,offsetY:f,size:c}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(f),Math.round(e(c)),s+1<<2|a+1]}}},attributes:{pos:{type:R.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:R.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:R.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>S([[z,t],[b,!!e]])},offset:{type:R.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},textureUV:{type:R.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},color:{type:R.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:R.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:t,sdfSize:o,sdfRadius:i},{referenceSize:s})=>[Math.round(e(t)),Math.round(e(s||t)),o,i]},outlineColor:{type:R.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>y(t)},haloColor:{type:R.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>y(t)},outlineAndHaloSize:{type:R.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class Y extends _{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=H,this._textMeshParamsPropsInitialized=!1,this._calloutEffectGeometry=null}getCalloutEffectGeometry(t){return this._calloutEffectGeometry}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new M(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}getLocalCalloutReferenceInfo(){return this._createLocalCalloutReferenceInfo(this._getShaping())}_createLocalCalloutReferenceInfo(t){if(!t)return;const e=t.boundsT,[o,i]=this._getReferenceSymbolOffset(),s={xmin:e.xmin,ymin:-e.ymax,xmax:e.xmax,ymax:-e.ymin};return{anchor:{x:0,y:0},bodyBounds:{xmin:s.xmin+o,ymin:s.ymin-i,xmax:s.xmax+o,ymax:s.ymax-i},collisionBodyBounds:s}}_getReferenceSymbolOffset(){if(!this._references)return[0,0];for(const t of this._references){const o=t.getBoundsInfo();if(!o)continue;const i=e(o.size)/2+l+e(this.evaluatedMeshParams.labelOffsetDistance??0);return[e(o.offsetX)+r(this.evaluatedMeshParams.horizontalAlignment)*i,-e(o.offsetY)+n(this.evaluatedMeshParams.verticalAlignment)*i]}return[0,0]}_write(t,{target:e,effectGeometry:o}){this._calloutEffectGeometry=null;const s=this._getShaping();if(!s)return;const r=1===this.evaluatedMeshParams.alignment,n=e.getDisplayId(),{placement:a}=this.evaluatedMeshParams;if(null!=a){if("PrivatePlacementMultipoint"!==a.type)this._writePlacedTextMarkers(t,e,s,i(o));else{const s=this._getMultipointShaping();s&&this._writeMultipointText(t,e,s,i(o))}return}if(o?.nextPath())return o.nextPoint(),this._setCalloutEffectGeometry(o.x,o.y),this._writeGlyphs(t,n,o.x,o.y,s,0,void 0,{mapAligned:r});if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[i,a]=o.coords;return this._setCalloutEffectGeometry(i,a),this._writeGlyphs(t,n,i,a,s,0,void 0,{mapAligned:r})}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>{this._setCalloutEffectGeometry(e,o),this._writeGlyphs(t,n,e,o,s,0,void 0,{mapAligned:r})})}const l=e.readXForDisplay(),f=e.readYForDisplay();return this._setCalloutEffectGeometry(l,f),this._writeGlyphs(t,n,l,f,s,0,void 0,{mapAligned:r})}_writePlacedTextMarkers(t,i,r,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,f=s.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!f)return;const c=i.getDisplayId();let h=f.next();for(;null!=h;){const e=-h.getAngle(),o=h.tx,i=-h.ty;this._setCalloutEffectGeometry(o,i),this._writeGlyphs(t,c,o,i,r,e,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=f.next()}}_writeMultipointText(t,i,r,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,f=s.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!f)return;const c=i.getDisplayId();let h=f.next(),d=0;for(;null!=h;){const e=h.tx,o=-h.ty,i=-h.getAngle();if(this._setCalloutEffectGeometry(e,o),d>=r.glyphs.length)break;this._writeGlyph(t,c,e,o,r,d,i,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=f.next(),d++}}_setCalloutEffectGeometry(t,e){this._calloutEffectGeometry??=o.fromJSON({x:t,y:e})}_getShaping(o){const i=this._textMeshTransformProps,s=this.evaluatedMeshParams;if(!this._hasGlyphs(s.glyphs))return null;const r=e(i.fontSize),n=e(i.offsetX),a=e(i.offsetY),{sdfSize:l}=this._getDefaultGlyphMetrics(s.glyphs),h=k(s.lineWidth),d=C(l,s.lineHeightRatio),{backgroundColor:u,borderLineSize:m}=U(s);return p(s.glyphs,{scale:r/l,angle:i.postAngle,xOffset:n,yOffset:a,horizontalAlignment:s.horizontalAlignment,verticalAlignment:o||s.verticalAlignment,maxLineWidth:h,lineHeight:d,lineHeightRatio:t(s.lineHeightRatio,c,f),decoration:s.decoration,borderLineSizePx:e(m),hasBackground:!!u,useCIMAngleBehavior:s.useCIMAngleBehavior})}_getMultipointShaping(){const o=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!this._hasGlyphs(i.glyphs))return null;const s=e(o.fontSize),r=e(o.offsetX),n=e(o.offsetY),{sdfSize:a}=this._getDefaultGlyphMetrics(i.glyphs),l=k(i.lineWidth),h=C(a,i.lineHeightRatio),{backgroundColor:d,borderLineSize:u}=U(i);return g(i.glyphs,{scale:s/a,angle:o.postAngle,xOffset:r,yOffset:n,horizontalAlignment:i.horizontalAlignment,verticalAlignment:i.verticalAlignment,maxLineWidth:l,lineHeight:h,lineHeightRatio:t(i.lineHeightRatio,c,f),decoration:i.decoration,borderLineSizePx:e(u),hasBackground:!!d,useCIMAngleBehavior:i.useCIMAngleBehavior})}_hasGlyphs(t){return!!t&&("glyphs"===t.type?t.glyphs.length>0:t.runs.some(t=>t.glyphs.glyphs.length>0))}_getDefaultGlyphMetrics(t){if("glyphs"===t.type)return{sdfSize:t.sdfSize,sdfRadius:t.sdfRadius};const[e]=t.runs;return{sdfSize:e?.glyphs.sdfSize??24,sdfRadius:e?.glyphs.sdfRadius??8}}_writeGlyphs(t,o,i,s,r,n,a,l,f=!0){const c=this.evaluatedMeshParams,h=this._textMeshTransformProps,d=e(h.fontSize),u=h.haloSize,m=h.outlineSize,p=e(h.offsetX),g=e(h.offsetY),S=this._getDefaultGlyphMetrics(c.glyphs),_=y(c.color),[z,b]=x(c.scaleInfo,this.getTileInfo());0!==n&&r.setRotation(n);const M=r.bounds,R=i+M.x+p,P=s+M.y-g,B=2*(c.minPixelBuffer?c.minPixelBuffer/d:1),G=Math.max(M.width,M.height)*B;r.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),f&&t.recordBounds(R,P,G,G),this._writeTextBox(t,o,i,s,r.textBox,a,l),t.recordEnd());for(const e of r.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),f&&t.recordBounds(R,P,G,G);const{texcoords:r,offsets:n}=e,c=e.fontSize??d;this._writeQuad(t,o,i,s,{texcoords:r,offsets:n,fontSize:c,haloSize:u,outlineSize:m,sdfSize:S.sdfSize,sdfRadius:S.sdfRadius,color:e.color?y(e.color):_,isBackground:!1,referenceBounds:a,minZoom:z,maxZoom:b,...l}),t.recordEnd()}0!==n&&r.setRotation(-n)}_writeGlyph(t,o,i,s,r,n,a,l,f,c=!0){const h=this.evaluatedMeshParams,d=this._textMeshTransformProps,u=e(d.fontSize),m=d.haloSize,p=d.outlineSize,g=e(d.offsetX),x=e(d.offsetY),S=this._getDefaultGlyphMetrics(h.glyphs),_=y(h.color);0!==a&&r.setRotation(a);const z=r.bounds,b=i+z.x+g,M=s+z.y-x,R=2*(h.minPixelBuffer?h.minPixelBuffer/u:1),P=Math.max(z.width,z.height)*R,B=r.glyphs[n];t.recordStart(this.instanceId,this.attributeLayout,B.textureBinding),c&&t.recordBounds(b,M,P,P);const{texcoords:G,offsets:L}=B,k=B.fontSize??u;this._writeQuad(t,o,i,s,{texcoords:G,offsets:L,fontSize:k,haloSize:m,outlineSize:p,sdfSize:S.sdfSize,sdfRadius:S.sdfRadius,color:B.color?y(B.color):_,isBackground:!1,referenceBounds:l,minZoom:0,maxZoom:30,...f}),t.recordEnd(),0!==a&&r.setRotation(-a)}_writeTextBox(t,e,o,i,s,r,n){const a=this.evaluatedMeshParams,{fontSize:l,haloSize:f,outlineSize:c}=this._textMeshTransformProps,{backgroundColor:h,borderLineColor:d,borderLineSize:u}=U(a),{sdfSize:m,sdfRadius:p}=this._getDefaultGlyphMetrics(a.glyphs),g=!!d&&u>0,x={isBackground:!0,fontSize:l,haloSize:f,outlineSize:c,referenceBounds:r,sdfSize:m,sdfRadius:p,...n};h&&(this._writeQuad(t,e,o,i,{texcoords:L,offsets:s.main,color:y(h),...x}),g||(this._writeQuad(t,e,o,i,{texcoords:w,offsets:s.top,color:y(h),...x}),this._writeQuad(t,e,o,i,{texcoords:I,offsets:s.bot,color:y(h),...x}),this._writeQuad(t,e,o,i,{texcoords:D,offsets:s.left,color:y(h),...x}),this._writeQuad(t,e,o,i,{texcoords:N,offsets:s.right,color:y(h),...x}))),g&&(this._writeQuad(t,e,o,i,{texcoords:A,offsets:s.top,color:y(d),...x}),this._writeQuad(t,e,o,i,{texcoords:A,offsets:s.bot,color:y(d),...x}),this._writeQuad(t,e,o,i,{texcoords:E,offsets:s.left,color:y(d),...x}),this._writeQuad(t,e,o,i,{texcoords:E,offsets:s.right,color:y(d),...x}))}_writeQuad(t,e,o,i,s){const r=t.vertexCount();this._writeVertex(t,e,o,i,s),t.indexWrite(r+0),t.indexWrite(r+1),t.indexWrite(r+2),t.indexWrite(r+1),t.indexWrite(r+3),t.indexWrite(r+2)}}const O=t=>Math.round(t*m);export{Y as TextMeshWriter,H as TextVertexSpec,U as getTextBoxStyle,P as maxLabelZoom};
|
|
2
|
+
import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as s}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as r,getYDirection as n}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as a,maxLineHeightRatio as l,minLineHeightRatio as f,labelPlacementOffsetPadding as c,maxTextLineWidth as h,minTextLineWidth as d,magicLabelLineHeight as u,packDegreesU8 as m}from"../../../definitions.js";import{shapeTextResource as p,shapeTextResourceForMultipoint as g}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as y,getMinMaxZoom as x,packBitset as S}from"../fill/meshWriterUtils.js";import{MeshWriter as _}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as z,bitsetTextIsMapAligned as b}from"../shaders/constants.js";import{TextMeshTransformProps as P}from"./TextParams.js";import{DataType as M}from"../../../../../../webgl/enums.js";const R=28,G=[4,4],T=[16,4],B={topLeft:T,topRight:T,bottomLeft:T,bottomRight:T};function L(o){return null==o?h:t(e(o),d,h)}function C(e,o){return e/24*u*t(o,f,l)}const k=[4,2],v=[4,6],A={topLeft:k,topRight:k,bottomLeft:v,bottomRight:v},E={topLeft:k,topRight:v,bottomLeft:k,bottomRight:v},I={topLeft:v,topRight:v,bottomLeft:G,bottomRight:G},w={topLeft:G,topRight:G,bottomLeft:v,bottomRight:v},D={topLeft:v,topRight:G,bottomLeft:v,bottomRight:G},N={topLeft:G,topRight:v,bottomLeft:G,bottomRight:v};function U(t){return t.useBackgroundCallout?{backgroundColor:null,borderLineColor:null,borderLineSize:0}:{backgroundColor:t.boxBackgroundColor??t.backgroundColor??null,borderLineColor:t.boxBorderLineColor??t.borderLineColor??null,borderLineSize:t.boxBorderLineSize>0?t.boxBorderLineSize:t.borderLineWidth??0}}const H={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:M.UNSIGNED_SHORT,count:2,packPrecisionFactor:a,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||R]},clipAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>O(t||0)},referenceSymbol:{type:M.BYTE,count:4,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,s=r(i?"center":o.horizontalAlignment),a=n(i?"middle":o.verticalAlignment),{offsetX:l,offsetY:f,size:c}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(f),Math.round(e(c)),s+1<<2|a+1]}}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>S([[z,t],[b,!!e]])},offset:{type:M.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},textureUV:{type:M.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:M.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:t,sdfSize:o,sdfRadius:i},{referenceSize:s})=>[Math.round(e(t)),Math.round(e(s||t)),o,i]},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>y(t)},haloColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>y(t)},outlineAndHaloSize:{type:M.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class Y extends _{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=H,this._textMeshParamsPropsInitialized=!1,this._calloutEffectGeometry=null}getCalloutEffectGeometry({target:t}){if("esriGeometryPoint"!==t.geometryType&&"esriGeometryMultipoint"!==t.geometryType)return this._calloutEffectGeometry;const e=t.readGeometryForDisplay();return e&&t.geometryType?o.fromOptimizedCIM(e.clone(),t.geometryType):null}getCalloutRotation(){return this._textMeshParamsPropsInitialized?this._textMeshTransformProps.postAngle:null}ensurePacked(t,e,o){this._calloutEffectGeometry=null,super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new P(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}getLocalCalloutReferenceInfo(){return this._createLocalCalloutReferenceInfo(this._getShaping(),void 0,!0,!0)}_createLocalCalloutReferenceInfo(t,o,i=!1,s=!1){if(!t)return;const r=t.boundsT,n=s?t.bounds:r,[a,l]=o?this._getReferenceSymbolOffset(o):[0,0],f=s?e(this._textMeshTransformProps.offsetX):0,c=s?e(this._textMeshTransformProps.offsetY):0,h={xmin:r.xmin,ymin:-r.ymax,xmax:r.xmax,ymax:-r.ymin};return{anchor:{x:0,y:0},bodyBounds:{xmin:n.xmin+a+f,ymin:-n.ymax-l+c,xmax:n.xmax+a+f,ymax:-n.ymin-l+c},collisionBodyBounds:h,...i?{bodyBoundsUseReferenceScale:!0}:null}}_getReferenceSymbolOffset(t){const o=e(t.size)/2+c;return[e(t.offsetX)+r(this.evaluatedMeshParams.horizontalAlignment)*o,-e(t.offsetY)+n(this.evaluatedMeshParams.verticalAlignment)*o]}_write(t,{target:e,effect:o}){this._calloutEffectGeometry=null;const s=o?.geometry,r=this._getShaping();if(!r)return;const n=1===this.evaluatedMeshParams.alignment,a=e.getDisplayId(),{placement:l}=this.evaluatedMeshParams;if(null!=l){if("PrivatePlacementMultipoint"!==l.type)this._writePlacedTextMarkers(t,e,r,i(s));else{const o=this._getMultipointShaping();o&&this._writeMultipointText(t,e,o,i(s))}return}if(s?.nextPath())return s.nextPoint(),this._setCalloutEffectGeometry(s.x,s.y),this._writeGlyphs(t,a,s.x,s.y,r,0,void 0,{mapAligned:n});if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[i,s]=o.coords;return this._setCalloutEffectGeometry(i,s),this._writeGlyphs(t,a,i,s,r,0,void 0,{mapAligned:n})}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>{this._setCalloutEffectGeometry(e,o),this._writeGlyphs(t,a,e,o,r,0,void 0,{mapAligned:n})})}const f=e.readXForDisplay(),c=e.readYForDisplay();return this._setCalloutEffectGeometry(f,c),this._writeGlyphs(t,a,f,c,r,0,void 0,{mapAligned:n})}_writePlacedTextMarkers(t,i,r,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,f=s.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!f)return;const c=i.getDisplayId();let h=f.next();for(;null!=h;){const e=-h.getAngle(),o=h.tx,i=-h.ty;this._setCalloutEffectGeometry(o,i),this._writeGlyphs(t,c,o,i,r,e,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=f.next()}}_writeMultipointText(t,i,r,n){const a=n??o.fromFeatureSetReaderCIM(i);if(!a)return;const l=-1,f=s.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!f)return;const c=i.getDisplayId();let h=f.next(),d=0;for(;null!=h;){const e=h.tx,o=-h.ty,i=-h.getAngle();if(this._setCalloutEffectGeometry(e,o),d>=r.glyphs.length)break;this._writeGlyph(t,c,e,o,r,d,i,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=f.next(),d++}}_setCalloutEffectGeometry(t,e){this._calloutEffectGeometry??=o.fromJSON({x:t,y:e})}_getShaping(o){const i=this._textMeshTransformProps,s=this.evaluatedMeshParams;if(!this._hasGlyphs(s.glyphs))return null;const r=e(i.fontSize),n=e(i.offsetX),a=e(i.offsetY),{sdfSize:c}=this._getDefaultGlyphMetrics(s.glyphs),h=L(s.lineWidth),d=C(c,s.lineHeightRatio),{backgroundColor:u,borderLineSize:m}=U(s);return p(s.glyphs,{scale:r/c,angle:i.postAngle,xOffset:n,yOffset:a,horizontalAlignment:s.horizontalAlignment,verticalAlignment:o||s.verticalAlignment,maxLineWidth:h,lineHeight:d,lineHeightRatio:t(s.lineHeightRatio,f,l),decoration:s.decoration,borderLineSizePx:e(m),hasBackground:!!u,useCIMAngleBehavior:s.useCIMAngleBehavior})}_getMultipointShaping(){const o=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!this._hasGlyphs(i.glyphs))return null;const s=e(o.fontSize),r=e(o.offsetX),n=e(o.offsetY),{sdfSize:a}=this._getDefaultGlyphMetrics(i.glyphs),c=L(i.lineWidth),h=C(a,i.lineHeightRatio),{backgroundColor:d,borderLineSize:u}=U(i);return g(i.glyphs,{scale:s/a,angle:o.postAngle,xOffset:r,yOffset:n,horizontalAlignment:i.horizontalAlignment,verticalAlignment:i.verticalAlignment,maxLineWidth:c,lineHeight:h,lineHeightRatio:t(i.lineHeightRatio,f,l),decoration:i.decoration,borderLineSizePx:e(u),hasBackground:!!d,useCIMAngleBehavior:i.useCIMAngleBehavior})}_hasGlyphs(t){return!!t&&("glyphs"===t.type?t.glyphs.length>0:t.runs.some(t=>t.glyphs.glyphs.length>0))}_getDefaultGlyphMetrics(t){if("glyphs"===t.type)return{sdfSize:t.sdfSize,sdfRadius:t.sdfRadius,sdfPadding:t.sdfPadding};const[e]=t.runs;return{sdfSize:e?.glyphs.sdfSize??24,sdfRadius:e?.glyphs.sdfRadius??8,sdfPadding:e?.glyphs.sdfPadding??3}}_writeGlyphs(t,o,i,s,r,n,a,l,f=!0){const c=this.evaluatedMeshParams,h=this._textMeshTransformProps,d=e(h.fontSize),u=h.haloSize,m=h.outlineSize,p=e(h.offsetX),g=e(h.offsetY),S=this._getDefaultGlyphMetrics(c.glyphs),_=y(c.color),[z,b]=x(c.scaleInfo,this.getTileInfo());0!==n&&r.setRotation(n);const P=r.bounds,M=i+P.x+p,R=s+P.y-g,G=2*(c.minPixelBuffer?c.minPixelBuffer/d:1),T=Math.max(P.width,P.height)*G;r.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),f&&t.recordBounds(M,R,T,T),this._writeTextBox(t,o,i,s,r.textBox,a,l),t.recordEnd());for(const e of r.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),f&&t.recordBounds(M,R,T,T);const{texcoords:r,offsets:n}=e,c=e.fontSize??d;this._writeQuad(t,o,i,s,{texcoords:r,offsets:n,fontSize:c,haloSize:u,outlineSize:m,sdfSize:S.sdfSize,sdfRadius:S.sdfRadius,color:e.color?y(e.color):_,isBackground:!1,referenceBounds:a,minZoom:z,maxZoom:b,...l}),t.recordEnd()}0!==n&&r.setRotation(-n)}_writeGlyph(t,o,i,s,r,n,a,l,f,c=!0){const h=this.evaluatedMeshParams,d=this._textMeshTransformProps,u=e(d.fontSize),m=d.haloSize,p=d.outlineSize,g=e(d.offsetX),x=e(d.offsetY),S=this._getDefaultGlyphMetrics(h.glyphs),_=y(h.color);0!==a&&r.setRotation(a);const z=r.bounds,b=i+z.x+g,P=s+z.y-x,M=2*(h.minPixelBuffer?h.minPixelBuffer/u:1),R=Math.max(z.width,z.height)*M,G=r.glyphs[n];t.recordStart(this.instanceId,this.attributeLayout,G.textureBinding),c&&t.recordBounds(b,P,R,R);const{texcoords:T,offsets:B}=G,L=G.fontSize??u;this._writeQuad(t,o,i,s,{texcoords:T,offsets:B,fontSize:L,haloSize:m,outlineSize:p,sdfSize:S.sdfSize,sdfRadius:S.sdfRadius,color:G.color?y(G.color):_,isBackground:!1,referenceBounds:l,minZoom:0,maxZoom:30,...f}),t.recordEnd(),0!==a&&r.setRotation(-a)}_writeTextBox(t,e,o,i,s,r,n){const a=this.evaluatedMeshParams,{fontSize:l,haloSize:f,outlineSize:c}=this._textMeshTransformProps,{backgroundColor:h,borderLineColor:d,borderLineSize:u}=U(a),{sdfSize:m,sdfRadius:p}=this._getDefaultGlyphMetrics(a.glyphs),g=!!d&&u>0,x={isBackground:!0,fontSize:l,haloSize:f,outlineSize:c,referenceBounds:r,sdfSize:m,sdfRadius:p,...n};h&&(this._writeQuad(t,e,o,i,{texcoords:B,offsets:s.main,color:y(h),...x}),g||(this._writeQuad(t,e,o,i,{texcoords:I,offsets:s.top,color:y(h),...x}),this._writeQuad(t,e,o,i,{texcoords:w,offsets:s.bot,color:y(h),...x}),this._writeQuad(t,e,o,i,{texcoords:D,offsets:s.left,color:y(h),...x}),this._writeQuad(t,e,o,i,{texcoords:N,offsets:s.right,color:y(h),...x}))),g&&(this._writeQuad(t,e,o,i,{texcoords:A,offsets:s.top,color:y(d),...x}),this._writeQuad(t,e,o,i,{texcoords:A,offsets:s.bot,color:y(d),...x}),this._writeQuad(t,e,o,i,{texcoords:E,offsets:s.left,color:y(d),...x}),this._writeQuad(t,e,o,i,{texcoords:E,offsets:s.right,color:y(d),...x}))}_writeQuad(t,e,o,i,s){const r=t.vertexCount();this._writeVertex(t,e,o,i,s),t.indexWrite(r+0),t.indexWrite(r+1),t.indexWrite(r+2),t.indexWrite(r+1),t.indexWrite(r+3),t.indexWrite(r+2)}}const O=t=>Math.round(t*m);export{Y as TextMeshWriter,H as TextVertexSpec,U as getTextBoxStyle,R as maxLabelZoom};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{OverrideHelper as t}from"../../../../../symbols/cim/OverrideHelper.js";import{FeatureMatcher as r,combineMeshWriterGroups as
|
|
2
|
+
import has from"../../../../../core/has.js";import{clone as e}from"../../../../../core/lang.js";import{OverrideHelper as t}from"../../../../../symbols/cim/OverrideHelper.js";import{FeatureMatcher as r,combineMeshWriterGroups as s}from"./Matcher.js";import{getCIMSymbols as o,getCIMSymbol as n}from"../../../layers/support/annodime/cimAnnotations.js";import{createDebugWriters as i}from"../../../layers/support/annodime/debugUtils.js";import{createAnnotationMatcherFeatureInfo as m,mixFeature as l}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as c}from"../../../layers/support/annodime/TileObjectId.js";import{hasSymbolFields as y,symbolFields as a}from"../../../layers/support/annodime/virtualFields.js";class b extends r{constructor(e,t){super(),this._context=e,this._symbolCollection=t,this._meshWriters=new Map,this._matcherGeometryOverrides=new Map,this._symbols=o(t)}static async fromAnnotationSchema(e,t){return new b(e,t.symbolCollection)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(c(r,e.getObjectId()))}async fetchResources(e,t,r,s){this._meshWriters.clear(),this._matcherGeometryOverrides.clear();const o=t.getCursor();for(;o.next();){const r=m(o);if(!r)continue;const n=l(o,r);if(!n)continue;const i=await this._createSymbolReference(o,n,r);if(!i)continue;const y=c(s,o.getObjectId());let a=this._meshWriters.get(y);a||(a=await this._createGroup(i,e,t.geometryType),this._meshWriters.set(y,a)),this._matcherGeometryOverrides.set(y,r.geometryOverride)}}async _createGroup(e,t,r){const o=await t.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:e}),n=await u(this._context,o?.meshes||[]);if(has("esri-2d-annotation-dimension-debug")){const e=await i(this._context,t,r);return e.writers.length?s(n,e):n}return n}async _createSymbolReference(e,r,s){const o=this._getUnresolvedSymbolReference(s);if(!o)return null;f(o);const n=await t.resolveSymbolOverrides(o,r,e.metadata.outSpatialReference,null,e.geometryType);return n?{type:"CIMSymbolReference",symbol:n}:null}_getUnresolvedSymbolReference(t){const{annotationGraphic:r,annotationGeometryType:s}=t,{bloated:o,symbolID:n}=r;if(o||y(r))return this._getProcessedSymbolReference(t);if(null!=n){const t=this._symbols[n][s];return t?e(t.data):null}return null}_getProcessedSymbolReference(e){const{annotationGraphic:t,annotationGeometryType:r}=e,{bloated:s,symbol:o,symbolID:i}=t;let m=this._getRawSymbolReference(o,i);if(!m||!m.symbol)return null;if(s||(m=this._applySymbolFields(m,t)),!m.symbol||"CIMTextSymbol"!==m.symbol.type)return null;const{data:l}=n(m.symbol,r);return{type:"CIMSymbolReference",symbol:l.symbol,primitiveOverrides:[...m.primitiveOverrides||[],...l.primitiveOverrides||[]]}}_getRawSymbolReference(e,t){if(e&&null!=e.symbol&&"CIMTextSymbol"===e.symbol.type)return e;if(null!=t){const e=this._symbolCollection.find(e=>(e.iD??0)===t);if(e)return{type:"CIMSymbolReference",symbol:e.symbol}}return null}_applySymbolFields(t,r){if(!t.symbol||"CIMTextSymbol"!==t.symbol.type)return t;const s=e(t.symbol);for(const e of a)e.setOnSymbol(s,r);return{type:"CIMSymbolReference",symbol:s,primitiveOverrides:t.primitiveOverrides}}cleanup(e,t,r){const s=t.getObjectId(),o=c(r,s);this._matcherGeometryOverrides.delete(o),this._meshWriters.delete(o)}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}function u(e,t){const r=t.map(e=>({...e}));return e.createMeshWriters(r)}function p(e){return e}function f(e){if(!e.symbol||!("symbolLayers"in e.symbol))return;const t=p({type:"PrivateMatcherGeometryOverrideEffect"});e.symbol.symbolLayers=(e.symbol.symbolLayers||[]).map(e=>({...e,effects:[t,...e.effects||[]]}))}export{b as AnnotationMatcher};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function e(e,t){if(e.length!==t.length)throw new Error("InternalError: mesh writer schemas and writers must have matching lengths");const n=new Map;for(let r=0;r<t.length;r++){const s=e[r];for(const e of t[r].references?.exports??[]){if(n.has(e)){if("label-reference-symbol"===e)continue;throw new Error(`InternalError: multiple mesh writers export the "${e}" reference type`)}n.set(e,s)}}const s=new Map;let o=!1;for(let l=0;l<t.length;l++){const i=e[l],c=[...(t[l].references?.dependencies??[]).map(e=>r(e,n)),...(t[l].references?.externalDependencies??[]).map(e=>({type:e,external:!0}))];s.set(i,c),o||=c.length>0}return{writers:e,dependencies:s,exports:n,requiresCoordination:o}}function t(...e){const t=[],r=new Map,n=new Map;let s=!1;for(const o of e){t.push(...o.writers),s||=o.requiresCoordination;for(const[e,t]of o.dependencies)r.set(e,t);for(const[e,t]of o.exports){if(n.has(e)){if("label-reference-symbol"===e)continue;throw new Error(`InternalError: multiple mesh writer groups export the "${e}" reference type`)}n.set(e,t)}}return{writers:t,dependencies:r,exports:n,requiresCoordination:s}}function r(e,t){const r=t.get(e);if(!r)throw new Error(`InternalError: no mesh writer exports the "${e}" reference type`);return{type:e,writer:r,external:!1}}class n{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(e,t){const r=new n;return r.setDefault(await e.createMeshWriters(t.meshes)),r}size(){return 1}getDefault(){return this._defaultResult}setDefault(e){this._defaultResult=e}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(e){this._backgroundFillResult=e}hasArcadeDependency(e){return this._defaultResult?.writers.some(t=>t.hasArcadeDependency(e))??!1}match(e,r,n,s){const o=this.doMatch(e,r,s)||this.getDefault();if(o&&o.writers.length>0){const e=this.getBackgroundFill();if(e)return t(e,o)}return o}matchGroups(e,t,r,n){const s=this.match(e,t,r,n);return s?[s]:[]}cleanup(e,t,r,n,s){}getSortKey(e,t){return 0}
|
|
2
|
+
function e(e,t){if(e.length!==t.length)throw new Error("InternalError: mesh writer schemas and writers must have matching lengths");const n=new Map;for(let r=0;r<t.length;r++){const s=e[r];for(const e of t[r].references?.exports??[]){if(n.has(e)){if("label-reference-symbol"===e)continue;throw new Error(`InternalError: multiple mesh writers export the "${e}" reference type`)}n.set(e,s)}}const s=new Map;let o=!1;for(let l=0;l<t.length;l++){const i=e[l],c=[...(t[l].references?.dependencies??[]).map(e=>r(e,n)),...(t[l].references?.externalDependencies??[]).map(e=>({type:e,external:!0}))];s.set(i,c),o||=c.length>0}return{writers:e,dependencies:s,exports:n,requiresCoordination:o}}function t(...e){const t=[],r=new Map,n=new Map;let s=!1;for(const o of e){t.push(...o.writers),s||=o.requiresCoordination;for(const[e,t]of o.dependencies)r.set(e,t);for(const[e,t]of o.exports){if(n.has(e)){if("label-reference-symbol"===e)continue;throw new Error(`InternalError: multiple mesh writer groups export the "${e}" reference type`)}n.set(e,t)}}return{writers:t,dependencies:r,exports:n,requiresCoordination:s}}function r(e,t){const r=t.get(e);if(!r)throw new Error(`InternalError: no mesh writer exports the "${e}" reference type`);return{type:e,writer:r,external:!1}}class n{constructor(){this._defaultResult=null,this._backgroundFillResult=null}static async from(e,t){const r=new n;return r.setDefault(await e.createMeshWriters(t.meshes)),r}size(){return 1}getDefault(){return this._defaultResult}setDefault(e){this._defaultResult=e}getBackgroundFill(){return this._backgroundFillResult}setBackgroundFill(e){this._backgroundFillResult=e}hasArcadeDependency(e){return this._defaultResult?.writers.some(t=>t.hasArcadeDependency(e))??!1}match(e,r,n,s){const o=this.doMatch(e,r,s)||this.getDefault();if(o&&o.writers.length>0){const e=this.getBackgroundFill();if(e)return t(e,o)}return o}matchGroups(e,t,r,n){const s=this.match(e,t,r,n);return s?[s]:[]}cleanup(e,t,r,n,s){}getSortKey(e,t){return 0}doMatch(e,t,r){return null}async fetchResources(e,t,r,n){}}export{n as FeatureMatcher,t as combineMeshWriterGroups,e as createMeshWriterGroup};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import r from"../../../core/Error.js";import"../../../core/has.js";import h from"../../../core/Logger.js";import{watch as o,syncAndInitial as a,sync as n}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{isLinkChartView as c}from"../../../linkChart/guards.js";import{Container as g}from"../engine/Container.js";import{ClipMesh as d}from"../engine/webgl/ClipMesh.js";import{maxHighlightGroups as u}from"../engine/webgl/definitions.js";import{HighlightRegistry as f}from"./support/HighlightRegistry.js";import{createOrReuseHighlightGradient as m}from"./support/util.js";import y from"../../layers/support/ClipRect.js";import v from"../../layers/support/GeometryClipArea.js";import w from"../../layers/support/Path.js";import{defaultHighlightName as R}from"../../support/HighlightDefaults.js";import _ from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as S}from"../../support/layerViewUtils.js";const H=t.ofType({key:"type",base:null,typeMap:{rect:y,path:w,geometry:v}}),b=new(t.ofType(_)),j=y=>{const v=y;let w=class extends v{constructor(){super(...arguments),this._highlightRegistry=new f,this.attached=!1,this.clips=new H,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const e=this.view?.spatialReferenceLocked??!0,t=this.view?.spatialReference;t&&e&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new g),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,e=>{this.container&&(this.container.visible=!e)},a),o(()=>this.updateSuspended,e=>{this.view&&!e&&this.updateRequested&&this.view.requestUpdate()},a),o(()=>this.layer?.opacity??1,e=>{this.container&&(this.container.opacity=e)},a),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",e=>{this.container&&(this.container.blendMode=e)},a),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,e=>{this.container&&(this.container.effect=e)},a),o(()=>this._effectiveHighlightOptions.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{this.container.highlightGradient=m(this.container.highlightGradient,this._effectiveHighlightOptions.items)},a),o(()=>this._getHighlightFilterGroups(),()=>this._onHighlightChange(),n),o(()=>this.clips.map(e=>e.version),async()=>{if(this.container&&this.view?.spatialReference){const e=this.view.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{referenceSetter as i}from"../../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../../core/deprecate.js";import r from"../../../core/Error.js";import"../../../core/has.js";import h from"../../../core/Logger.js";import{watch as o,syncAndInitial as a,sync as n}from"../../../core/reactiveUtils.js";import{property as l,subclass as p}from"../../../core/accessorSupport/decorators.js";import{isLinkChartView as c}from"../../../linkChart/guards.js";import{Container as g}from"../engine/Container.js";import{ClipMesh as d}from"../engine/webgl/ClipMesh.js";import{maxHighlightGroups as u}from"../engine/webgl/definitions.js";import{HighlightRegistry as f}from"./support/HighlightRegistry.js";import{createOrReuseHighlightGradient as m}from"./support/util.js";import y from"../../layers/support/ClipRect.js";import v from"../../layers/support/GeometryClipArea.js";import w from"../../layers/support/Path.js";import{defaultHighlightName as R}from"../../support/HighlightDefaults.js";import _ from"../../support/HighlightOptions.js";import{isInEffectiveScaleRange as S}from"../../support/layerViewUtils.js";const H=t.ofType({key:"type",base:null,typeMap:{rect:y,path:w,geometry:v}}),b=new(t.ofType(_)),j=y=>{const v=y;let w=class extends v{constructor(){super(...arguments),this._highlightRegistry=new f,this.attached=!1,this.clips=new H,this.highlights=null,this.lastUpdateId=-1,this.moving=!1,this.updateRequested=!1,this._visibleAtCurrentScale=!0}initialize(){const e=this.view?.spatialReferenceLocked??!0,t=this.view?.spatialReference;t&&e&&!this.spatialReferenceSupported?this.addResolvingPromise(Promise.reject(new r("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",{layer:this.layer}))):(this.container||(this.container=new g),this.container.fadeTransitionEnabled=!0,this.container.visible=!1,this.container.endTransitions(),this.addHandles([o(()=>this.suspended,e=>{this.container&&(this.container.visible=!e)},a),o(()=>this.updateSuspended,e=>{this.view&&!e&&this.updateRequested&&this.view.requestUpdate()},a),o(()=>this.layer?.opacity??1,e=>{this.container&&(this.container.opacity=e)},a),o(()=>this.layer&&"blendMode"in this.layer?this.layer.blendMode:"normal",e=>{this.container&&(this.container.blendMode=e)},a),o(()=>this.layer&&"effect"in this.layer?this.layer.effect:null,e=>{this.container&&(this.container.effect=e)},a),o(()=>this._effectiveHighlightOptions.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{this.container.highlightGradient=m(this.container.highlightGradient,this._effectiveHighlightOptions.items)},a),o(()=>this._getHighlightFilterGroups(),()=>this._onHighlightChange(),n),o(()=>this.clips.map(e=>e.version),async()=>{if(this.container&&this.view?.spatialReference){const e=this.view.featuresTilingScheme,t=await this._updatingHandles.addPromise(Promise.all(this.clips.items.map(t=>d.create(t,e))));for(const i of this.container.clips)i.destroy();this.container.clips=t.filter(e=>!!e)}},a),o(()=>({scale:this.view?.scale,scaleRange:this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null}),({scale:e,scaleRange:t})=>{const i=S(t,e);i!==this._visibleAtCurrentScale&&(this._visibleAtCurrentScale=i)},a),o(()=>this.layer?.effectiveVisible,async e=>{this.container.requestDeclutter()})],"constructor"),this.view?.whenLayerView?this.view.whenLayerView(this.layer).then(e=>{e===this&&this.processAttach()},()=>{}):this.when().then(()=>{this.processAttach()},()=>{}))}destroy(){this.processDetach(),this.updateRequested=!1;for(const e of this.container?.clips??[])e.destroy()}get highlightOptions(){return this._logHighlightOptionsDeprecation(),this.highlights?.find(({name:e})=>e===R)}set highlightOptions(e){if(this._logHighlightOptionsDeprecation(),!this.highlights){if(!e)return;this.highlights=new t([new _])}const i=this.highlights.find(({name:e})=>e===R);e?i?.assignFrom(e):(this.highlights.remove(i),0===this.highlights.length&&(this.highlights=null))}_logHighlightOptionsDeprecation(){s(h.getLogger(this),"`LayerView.highlightOptions` is deprecated in favor of View.highlights",{replacement:"View.highlights",version:"4.34",see:"https://arcg.is/inbTa1#highlights",warnOnce:!0})}get hasHighlight(){return this._highlightRegistry.size>0}get _effectiveHighlightOptions(){if(!this.view)return b;if(!this.highlights)return this.view.highlights;const e=this.view.highlights.clone();for(const t of this.highlights){const i=e.find(e=>e.name===t.name);i&&i.assignFrom(t)}return e}get highlightIds(){return this._highlightRegistry.highlightIds}get scheduler(){return this.view.scheduler}get spatialReferenceSupported(){const e=this.view?.spatialReference;return null==e||this.supportsSpatialReference(e)}get updating(){if(!this.spatialReferenceSupported)return!1;if(!this.attached)return!0;if(this.suspended)return!1;return this.updateRequested||this.isUpdating()||this._updatingHandles?.updating||this.container.transitioning}get visibleAtCurrentScale(){return this._visibleAtCurrentScale}processAttach(){this.isResolved()&&!this.attached&&!this.destroyed&&this.spatialReferenceSupported&&(this.attach(),this.attached=!0,this.requestUpdate())}processDetach(){this.attached&&(this.attached=!1,this.removeHandles("attach"),this.detach(),this.updateRequested=!1)}requestUpdate(){this.destroyed||this.updateRequested||(this.updateRequested=!0,this.updateSuspended||this.view.requestUpdate())}processUpdate(e){!this.isFulfilled()||this.isResolved()?(this._set("updateParameters",e),this.updateRequested&&!this.updateSuspended&&(this.updateRequested=!1,this.update(e))):this.updateRequested=!1}hitTest(e,t,i){return Promise.resolve(null)}supportsSpatialReference(e){return!0}canResume(){if(!this.spatialReferenceSupported)return!1;switch(this.layer?.type){case"link-chart":case"knowledge-graph-sublayer":case"graphics":break;default:if(c(this.view)&&!this.view.inGeographicLayout)return!1}return!!super.canResume()&&this.visibleAtCurrentScale}getSuspendInfo(){const e=super.getSuspendInfo(),t=!this.spatialReferenceSupported;return t&&(e.spatialReferenceNotSupported=t),e}addAttachHandles(e){this.addHandles(e,"attach")}_addHighlightFilter(e,t){return this._highlightRegistry.register(t,e)}_removeHighlight(e){this._highlightRegistry.unregister(e)}_onHighlightChange(){}_getHighlightFilterGroups(){const e=[];for(const{name:t,filters:i}of this._highlightRegistry.highlightGroups){const s=this._effectiveHighlightOptions.findIndex(e=>e.name===t);s<0||s>=u||e.push({order:s,filters:i})}return e}};return e([l()],w.prototype,"attached",void 0),e([l({type:H,set(e){const t=i(e,this._get("clips"),H);this._set("clips",t)}})],w.prototype,"clips",void 0),e([l()],w.prototype,"container",void 0),e([l({type:_})],w.prototype,"highlightOptions",null),e([l({type:t.ofType(_)})],w.prototype,"highlights",void 0),e([l()],w.prototype,"_effectiveHighlightOptions",null),e([l()],w.prototype,"moving",void 0),e([l({readOnly:!0})],w.prototype,"spatialReferenceSupported",null),e([l({readOnly:!0})],w.prototype,"updateParameters",void 0),e([l()],w.prototype,"updateRequested",void 0),e([l()],w.prototype,"updating",null),e([l()],w.prototype,"view",void 0),e([l()],w.prototype,"_visibleAtCurrentScale",void 0),e([l({readOnly:!0})],w.prototype,"visibleAtCurrentScale",null),w=e([p("esri.views.2d.layers.LayerView2D")],w),w};export{j as LayerView2D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{rad2deg as e}from"../../../../../core/mathUtils.js";import t from"../../../../../geometry/Point.js";import{normalizeTransform as r,quantizeY as n,quantizeX as i}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import a from"../../../../../layers/graphics/OptimizedGeometry.js";import{project as m}from"../../../../../layers/graphics/data/projectionSupport.js";import{DimensionRealFieldName as s,projectLinearDimensionPoints as u,normalizeExtensionAngle as y,angleFromXAxis as
|
|
2
|
+
import{rad2deg as e}from"../../../../../core/mathUtils.js";import t from"../../../../../geometry/Point.js";import{normalizeTransform as r,quantizeY as n,quantizeX as i}from"../../../../../geometry/support/quantizationUtils.js";import{convertToGeometry as o}from"../../../../../layers/graphics/featureConversionUtils.js";import a from"../../../../../layers/graphics/OptimizedGeometry.js";import{project as m}from"../../../../../layers/graphics/data/projectionSupport.js";import{DimensionRealFieldName as s,projectLinearDimensionPoints as u,normalizeExtensionAngle as y,angleFromXAxis as p}from"./dimensionUtils.js";import{getAttributeValue as l,parseElement as f,reprojectAndQuantize as c,quantizeYf as g,quantizeXf as d}from"./utils.js";import{featureFields as b}from"./virtualFields.js";function N(e){const t=e.readAttribute("element");if(!t)return null;const n=e.getInTransform()??e.getDisplayTransform();if(!n)throw new Error("Quantization transform is required to read annotation features.");if(!e.geometryType)return null;const i=e.metadata.outSpatialReference,o=e.metadata.attributeSpatialReference??e.metadata.spatialReference??i,a=r(n),m=f(t),{geometry:s}=m;if(!s)return null;const u=c(s,o,i,a);if(!u)return null;const y=x(m,o,i,a),p=j(m),l={annotationGeometryType:p,annotationGraphic:m,attributes:{},geometryOverride:{geometry:u,geometryType:g(p),absoluteCalloutAnchor:y}};for(const r of b)r.setOnFeature(l,m);function g(e){switch(e){case"line":return"esriGeometryPolyline";case"multipoint":return"esriGeometryMultipoint";case"point":return"esriGeometryPoint"}}return l}function x(e,r,n,i){const[o,a]=e.anchorPoint,s=a?{x:Number(o),y:Number(a)}:h(o);if(!s||!Number.isFinite(s.x)||!Number.isFinite(s.y))return;const u=m(new t({...s,spatialReference:r}),r,n);return{x:d(i,u.x),y:g(i,u.y)}}function h(e){if(e?.trim())try{const t=JSON.parse(e);return"number"==typeof t?.x&&"number"==typeof t?.y?t:void 0}catch{return}}function w(o){const f=o.getInTransform()??o.getDisplayTransform();if(!f)throw new Error("Quantization transform is required to read dimension features.");const c=o.geometryType;if(!c)return null;const g={...o.readAttributes()},d=o.metadata.outSpatialReference,b=o.metadata.attributeSpatialReference??o.metadata.spatialReference??d,N=r(f),x={x:Number(l(s.beginX,g)),y:Number(l(s.beginY,g)),spatialReference:b},h={x:Number(l(s.endX,g)),y:Number(l(s.endY,g)),spatialReference:b},w={x:Number(l(s.dimX,g)),y:Number(l(s.dimY,g)),spatialReference:b};if(isNaN(x.x)||isNaN(x.y)||isNaN(h.x)||isNaN(h.y))return console.error(`Feature with ${s.objectId}=${l(s.objectId,g)} is missing valid begin, end, or dimension points and will be skipped.`),null;(isNaN(w.x)||isNaN(w.y))&&(w.x=x.x,w.y=x.y);const T=m(new t(x),b,d),j=m(new t(h),b,d),R=m(new t(w),b,d),P=[T,j,R],_=j.x-T.x,E=j.y-T.y;let M=Math.PI/2;0!==_?M=Math.atan2(E,_):E<0&&(M=-Math.PI/2);let S=Math.sqrt(_*_+E*E);if(1===Number(l(s.dimType,g))){const e=u([T.x,T.y],[j.x,j.y],[R.x,R.y],y(l(s.extAngle,g)));if(e){const t=e.endDimensionPoint[0]-e.beginDimensionPoint[0],r=e.endDimensionPoint[1]-e.beginDimensionPoint[1];S=Math.sqrt(t*t+r*r),M=p([t,r])}}const G=l(s.textX,g),I=l(s.textY,g);if(null!=G&&null!=I){const e=new t({x:Number(G),y:Number(I),spatialReference:b}),r=m(e,b,d);P.push(r)}const v=P.map(e=>({x:i(N,e.x),y:n(N,e.y)})).flatMap(e=>[e.x,e.y]);return g.__SYSTEM_LENGTH__=S,g.__DIMENSION_ANGLE__=360-e(M),{attributes:g,geometryOverride:{geometry:new a([v.length],v),geometryType:c}}}function T(e,t){const{geometry:r,geometryType:n}=t.geometryOverride,i=o(r,n,!1,!1);return i?{attributes:{...e.readAttributes(),...t.attributes},centroid:null,geometry:i}:null}function j(e){if(e.geometry){if("custom-two-point"===e.geometry.type)return"line";if("custom-multipoint"===e.geometry.type)return"multipoint";if("geometry-bag"===e.geometry.type){if("custom-multipoint"===e.geometry.geometries[0].type)return"multipoint";throw new Error("Unable to determine geometry type from annotation graphic")}if("custom-point"===e.geometry.type)return"point";if("polyline"===e.geometry.type)return"line";if("point"===e.geometry.type)return"point";throw new Error("Unable to determine geometry type from annotation graphic")}throw new Error("Unable to determine geometry type from annotation graphic")}export{N as createAnnotationMatcherFeatureInfo,w as createDimensionMatcherFeatureInfo,j as getAnnotationGeometryType,T as mixFeature};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{GeometryCursor as t}from"../../../../../geometry/GeometryCursor.js";import{createTileObjectId as e}from"./TileObjectId.js";class r{static{this.instance=null}static local(){return null===r.instance&&(r.instance=new r),r.instance}execute(t,e,r){return new n(t,r)}}class n{constructor(t,e){this._cursor=t,this._context=e}next(){const r=this._cursor.next();if(!r||0===r.totalSize)return null;if(this._context.
|
|
2
|
+
import{GeometryCursor as t}from"../../../../../geometry/GeometryCursor.js";import{createTileObjectId as e}from"./TileObjectId.js";class r{static{this.instance=null}static local(){return null===r.instance&&(r.instance=new r),r.instance}execute(t,e,r){return new n(t,r)}}class n{constructor(t,e){this._cursor=t,this._context=e}next(){const r=this._cursor.next();if(!r||0===r.totalSize)return null;if(this._context.callout?.preserveInputGeometry)return r;const{matcher:n,target:o,tileKey:c}=this._context,s=n&&o&&null!=c?n.getMatcherGeometryOverride(e(c,o.getObjectId())):null;if(!s)return r;const i=t.fromOptimizedCIM(s.geometry.clone(),s.geometryType);return i.invertY(),i}}export{r as PrivateMatcherGeometryOverrideEffect};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import n from"../../../../analysis/LineOfSightAnalysisObserver.js";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{length as o,normalize as t,scaleAndAdd as
|
|
2
|
+
import n from"../../../../analysis/LineOfSightAnalysisObserver.js";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{length as o,normalize as t,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getConvertedElevation as s,absoluteHeightElevationInfo as u}from"../../../../support/elevationInfoUtils.js";import c from"../../../../symbols/support/ElevationInfo.js";function a({view:n,point:e,sourceElevationInfo:o,mode:t,preserveZ:l=!1}){const r=o?.clone()??new c;r.mode=t;const i=e.clone();return l||(i.z=s(n,e,o??u,r)),{position:i,elevationInfo:r}}function f(n){return n?.clone()??null}function p(n){return n?.clone()??null}function m(e,o=null){return d(e,o,()=>new n)}function v(n,o=null){return d(n,o,()=>new e)}function d(n,e,o){if(null==n)return null;const t=e??o();return t.position=n.position?.clone()??null,t.elevationInfo=n.elevationInfo?.clone()??null,t.feature=n.feature??null,t}function I(n,e,o=null){const t=e.clone();return t.z=s(n,e,o??u,u),t}function g(n,e,o,t=null){const l=I(e,o,t);try{return n.getMapPointIntersection(l)}catch{return null}}function y(n,e,o,t,{elevationInfo:l=null,preservedIntersection:r=null}={}){const i=r??g(o,n,t,l);return null!=i&&(z(n,e,i,{snappedMapPoint:t,elevationInfo:l}),!0)}function z(n,e,o,{snappedMapPoint:t=o.mapPoint,elevationInfo:l=null}={}){if(null==t)return e.position=null,e.elevationInfo=null,void(e.feature=null);const r=o.context,i=l?.clone()??null;if(e.elevationInfo=i,e.feature="graphic"===r?.type?r.graphic:null,"gaussian-splat"===r?.type){const r=I(n,t,l);e.position=h(n,r,i,o.normal)}else e.position=t.clone()}function h(n,e,c,a){const f=e.clone(),p=r(e.x,e.y,e.z??0);if(!n.renderCoordsHelper.toRenderCoords(p,e.spatialReference,p)||0===o(a))return f.z=s(n,f,u,c),f;const m=4,v=n.state.camera.computeScreenPixelSizeAt(p)*m,d=t(i(),a);l(p,p,d,v);const I=n.renderCoordsHelper.fromRenderCoords(p,f);return null==I?(f.z=s(n,f,u,c),f):(I.z=s(n,I,u,c),I)}export{a as convertLineOfSightElevationMode,h as getGaussianSplatOffsetPosition,m as restoreLineOfSightObserverState,v as restoreLineOfSightTargetState,f as snapshotLineOfSightObserverState,p as snapshotLineOfSightTargetState,y as updateLineOfSightItemFromAuthoredPoint,z as updateLineOfSightItemFromIntersection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as o,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as s,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as a}from"../../../../support/elevationInfoUtils.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import{EventedAccessor as e}from"../../../../core/Evented.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as o,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as s,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as a}from"../../../../support/elevationInfoUtils.js";import{convertLineOfSightElevationMode as l,snapshotLineOfSightObserverState as c,snapshotLineOfSightTargetState as h,restoreLineOfSightObserverState as p,restoreLineOfSightTargetState as m,updateLineOfSightItemFromAuthoredPoint as d}from"./LineOfSightAuthoringUtils.js";import{EditGeometryOperations as u}from"../../../interactive/editGeometry/EditGeometryOperations.js";const y=Symbol("line-of-sight-item-operations");let f=class extends e{constructor(t){super(t),this._operations=null,this._dragIntersectionContext=null,this._syncSource=null}initialize(){this.addHandles([o(()=>{const{elevationInfo:t,feature:e,position:i}=this.item;return{elevationInfo:t,elevationMode:t?.mode,elevationOffset:t?.offset,elevationUnit:t?.unit,feature:e,position:i,positionCoordinates:i?.toArray(),spatialReference:i?.spatialReference}},()=>this._syncOperationsFromItem(),n),o(()=>{const{origin:t}=this;return{origin:t,originCoordinates:t?.toArray(),spatialReference:t?.spatialReference}},()=>this.emit("committed"),n)])}destroy(){this.removeHandles(y),this._operations=i(this._operations),this._dragIntersectionContext=null}get operations(){return this._operations}get elevationInfo(){return this.item.elevationInfo??a}get visible(){return this.analysisViewData.visible&&null!=this.origin}get isDraped(){return"on-the-ground"===this.elevationInfo.mode}get origin(){return"observer"===this.itemType?this.analysisViewData.elevationAlignedObserver:this.analysisViewData.computations.find(t=>t.target===this.item)?.elevationAlignedTargetLocation??null}get updating(){return!1}toMap(t){return this.intersector.getScreenPointIntersection(t)?.mapPoint}createUndoRecord(){let t=this._snapshotState(),e=null;return{undo:()=>{e=this._snapshotState(),this._restoreSnapshot(t)},redo:()=>{null!=e&&(t=this._snapshotState(),this._restoreSnapshot(e))}}}setElevationMode(t){const{position:e,elevationInfo:i}=this.item;if(null==e||t===this.elevationInfo.mode)return null;const o=l({view:this.view,point:e,sourceElevationInfo:i,mode:t,preserveZ:!0}),n=this.createUndoRecord();this._syncSource="operations";try{this.item.elevationInfo=o.elevationInfo,this.item.position=o.position}finally{this._syncSource=null}return this._syncOperationsFromItem(!1),n}updateDragIntersection(t){"cancel"!==t.action?this._dragIntersectionContext={dragging:"end"!==t.action,intersection:this.intersector.getScreenPointIntersection(t.screenPoint)}:this._dragIntersectionContext=null}_snapshotState(){return"observer"===this.itemType?c(this.item):h(this.item)}_restoreSnapshot(t){"observer"===this.itemType?p(t,this.item):m(t,this.item),this.destroyed||(this._syncOperationsFromItem(),this.emit("committed"))}_replaceOperations(t){this.removeHandles(y),this._operations=i(this._operations),this._operations=t,null!=t&&this.addHandles(t.data.on("change",()=>this._operationsGeometryChanged()),y)}_syncOperationsFromItem(t=!0){const{position:e}=this.item,i=this._operations;if("operations"!==this._syncSource){this._syncSource="item";try{if(null==e){if(null==i)return;this._replaceOperations(null)}else i?.data.geometry?.equals(e)||i?.trySetGeometry(e)||this._replaceOperations(u.fromGeometry(e,this.view.state.viewingMode));t?this._emitModifiedExternally():this.emit("committed")}finally{this._syncSource=null}}}_operationsGeometryChanged(){const t=this._operations?.data.geometry;if("item"===this._syncSource||"point"!==t?.type)return;const e=this._dragIntersectionContext;this._syncSource="operations";try{null==e?this.item.position=t:d(this.view,this.item,this.intersector,t,{elevationInfo:this.item.elevationInfo,preservedIntersection:e.intersection})}finally{this._syncSource=null}null==e||e.dragging||(this._dragIntersectionContext=null),this.emit("committed")}_emitModifiedExternally(){this.emit("modified-externally"),this.emit("committed")}};t([s({constructOnly:!0})],f.prototype,"analysisViewData",void 0),t([s({constructOnly:!0})],f.prototype,"intersector",void 0),t([s({constructOnly:!0})],f.prototype,"item",void 0),t([s({constructOnly:!0})],f.prototype,"itemType",void 0),t([s({constructOnly:!0})],f.prototype,"view",void 0),t([s()],f.prototype,"_operations",void 0),f=t([r("esri.views.3d.analysis.LineOfSight.LineOfSightItemManipulatedObject3D")],f);export{f as LineOfSightItemManipulatedObject3D};
|