@arcgis/core 4.34.0-next.65 → 4.34.0-next.66
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/Graphic.js +1 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/05016b0713ef760fc57d.js +1 -0
- package/assets/esri/core/workers/chunks/{eadac757f74470b89a36.js → 0952aeddddc16705b7a3.js} +1 -1
- package/assets/esri/core/workers/chunks/09dd8613bc03e7a3a4cb.js +1 -0
- package/assets/esri/core/workers/chunks/0c4f07eb3f3dd5cd2c6c.js +1 -0
- package/assets/esri/core/workers/chunks/117eb1422e9795d37ea3.js +1 -0
- package/assets/esri/core/workers/chunks/{79933271a76a1756584f.js → 12d30c2367652e2c688b.js} +1 -1
- package/assets/esri/core/workers/chunks/16fe21ca9b24eaee3069.js +1 -0
- package/assets/esri/core/workers/chunks/18c7b1e1fbf7eb6c3c33.js +1 -0
- package/assets/esri/core/workers/chunks/{e72aee3f857aa473822c.js → 1c7b5ca80e80c314f78d.js} +1 -1
- package/assets/esri/core/workers/chunks/{426232091caf8608e5f1.js → 26b791291689434dde09.js} +1 -1
- package/assets/esri/core/workers/chunks/2a938096a42613425c7b.js +1 -0
- package/assets/esri/core/workers/chunks/31e7358fe802abb3f8db.js +1 -0
- package/assets/esri/core/workers/chunks/3212a476184be25d17f8.js +1 -0
- package/assets/esri/core/workers/chunks/3bc50ee639a4d16c4f80.js +1 -0
- package/assets/esri/core/workers/chunks/4102ed32b8dbdc32cb3b.js +1 -0
- package/assets/esri/core/workers/chunks/{6ab435423acb0ed0b1c7.js → 44031bef6d500167ef0b.js} +1 -1
- package/assets/esri/core/workers/chunks/{a29fb90226bd08157bd1.js → 481aea82501d04667ba2.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c3a1958990de095d3a1.js → 48316d91c06928f69f61.js} +1 -1
- package/assets/esri/core/workers/chunks/{897f9775f06ddbf6486f.js → 4be2bab8ff3bd14ffdfb.js} +1 -1
- package/assets/esri/core/workers/chunks/4f0f6653b8e92c633d14.js +1 -0
- package/assets/esri/core/workers/chunks/548818df658b607a364e.js +1 -0
- package/assets/esri/core/workers/chunks/5c053d197935c65792ce.js +1 -0
- package/assets/esri/core/workers/chunks/60920d4856a011ace7e2.js +1 -0
- package/assets/esri/core/workers/chunks/66cb5b294d7f251c2cc8.js +1 -0
- package/assets/esri/core/workers/chunks/66ffefd46fe6175c2af4.js +1 -0
- package/assets/esri/core/workers/chunks/6a5b5b80917a5375b9f6.js +1 -0
- package/assets/esri/core/workers/chunks/{d1e8220dcae1d01d3c35.js → 707311e24b2f458d9209.js} +1 -1
- package/assets/esri/core/workers/chunks/7a17e78c76076ed4476f.js +1 -0
- package/assets/esri/core/workers/chunks/7e95896ac41c7e2ca26a.js +1 -0
- package/assets/esri/core/workers/chunks/{5d12862042b6bf9f9d54.js → 82cb5defb0593e3017ff.js} +1 -1
- package/assets/esri/core/workers/chunks/8f60804c7ba445f25df8.js +1 -0
- package/assets/esri/core/workers/chunks/9a6d359ead62a8eadd3c.js +1 -0
- package/assets/esri/core/workers/chunks/{657b01a6df8dc46c5209.js → 9e3f8c06b4e090a35710.js} +1 -1
- package/assets/esri/core/workers/chunks/9eb1bfcb9b05f2a36748.js +1 -0
- package/assets/esri/core/workers/chunks/{0a36df6fdab95785d1ce.js → a2963ffc9a8c90822d2d.js} +1 -1
- package/assets/esri/core/workers/chunks/ad7aa7d09bfceb12609e.js +1 -0
- package/assets/esri/core/workers/chunks/{9f93513037a6e87433c4.js → adfb018f510e19a520fb.js} +1 -1
- package/assets/esri/core/workers/chunks/af1030e4c4437d4eb600.js +1 -0
- package/assets/esri/core/workers/chunks/{a1bd4eecca1e3272bffb.js → aff553c3d6544e20f188.js} +1 -1
- package/assets/esri/core/workers/chunks/b482132638f3b351724c.js +1 -0
- package/assets/esri/core/workers/chunks/{e1b25b1ce3bd4f0f2cda.js → bc5fa33afec5354601a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b53bc76d38e85902748.js → c20aead85cdea91c4b74.js} +1 -1
- package/assets/esri/core/workers/chunks/{904c116c6b093e0e970c.js → d1b361b8adf1c719a10a.js} +1 -1
- package/assets/esri/core/workers/chunks/dcad3dcbd4ea2f5a6a04.js +1 -0
- package/assets/esri/core/workers/chunks/e0fe6bb51ecc9b2faf69.js +1 -0
- package/assets/esri/core/workers/chunks/e4e224983c3ee24fc51d.js +1 -0
- package/assets/esri/core/workers/chunks/ee391a41144855fc625d.js +1 -0
- package/assets/esri/core/workers/chunks/f054557e23978e174686.js +1 -0
- package/assets/esri/core/workers/chunks/f5101f5f93f776a6456f.js +1 -0
- package/chunks/GlowComposition.glsl.js +4 -4
- package/config.js +1 -1
- package/core/AsyncUpdate.js +1 -1
- package/core/mapCollectionUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtPolygonCentroid.js +1 -1
- package/geometry/Polygon.js +1 -1
- package/geometry/support/centroid.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/graphic/AggregateGraphicOrigin.js +1 -1
- package/graphic/BuildingGraphicOrigin.js +1 -1
- package/graphic/CSVGraphicOrigin.js +1 -1
- package/graphic/CatalogGraphicOrigin.js +1 -1
- package/graphic/FeatureGraphicOrigin.js +1 -1
- package/graphic/GeoJSONGraphicOrigin.js +1 -1
- package/graphic/GeoRSSGraphicOrigin.js +1 -1
- package/graphic/ImageryGraphicOrigin.js +1 -1
- package/graphic/ImageryTileGraphicOrigin.js +1 -1
- package/graphic/KMLGraphicOrigin.js +1 -1
- package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
- package/graphic/LinkChartGraphicOrigin.js +1 -1
- package/graphic/MapImageGraphicOrigin.js +1 -1
- package/graphic/MapNotesGraphicOrigin.js +1 -1
- package/graphic/OGCFeatureGraphicOrigin.js +1 -1
- package/graphic/OrientedImageryGraphicOrigin.js +1 -1
- package/graphic/ParquetGraphicOrigin.js +1 -1
- package/graphic/PointCloudGraphicOrigin.js +1 -1
- package/graphic/SceneGraphicOrigin.js +1 -1
- package/graphic/StreamGraphicOrigin.js +1 -1
- package/graphic/SubtypeGroupGraphicOrigin.js +1 -1
- package/graphic/TileGraphicOrigin.js +1 -1
- package/graphic/TrackGraphicOrigin.js +1 -1
- package/graphic/VectorTileGraphicOrigin.js +1 -1
- package/graphic/VoxelGraphicOrigin.js +1 -1
- package/graphic/WCSGraphicOrigin.js +1 -1
- package/graphic/WFSGraphicOrigin.js +1 -1
- package/graphic/getIdFieldsProvider.js +5 -0
- package/graphic/getSliceableContainer.js +5 -0
- package/graphic/graphicOrigins.d.ts +0 -2
- package/graphic/graphicOrigins.js +1 -1
- package/interfaces.d.ts +115 -60
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/support/rasterDatasets/multidimensionalUtils.js +1 -1
- package/package.json +1 -1
- package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/previewCIMSymbol.js +1 -1
- package/symbols/support/previewSymbol2D.js +1 -1
- package/symbols/support/renderUtils.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileInputVisualization2D.js +5 -0
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +5 -0
- package/views/2d/analysis/ElevationProfile/ElevationProfileVisualization2D.js +5 -0
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization3D.js +5 -0
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +5 -0
- package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization3D.js +5 -0
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/Intersector.js +1 -1
- package/views/3d/layers/support/SublayerPopupHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/Intersector.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +4 -4
- package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/View2D.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/constants.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js +5 -0
- package/views/draw/support/createUtils.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/Legend/styles/card/CardView.js +1 -1
- package/widgets/Legend/styles/card/ColorRamp.js +1 -1
- package/widgets/Legend/styles/card/LegendElement.js +1 -1
- package/widgets/Legend/styles/card/UnivariateAboveAndBelowRamp.js +1 -1
- package/widgets/Legend/styles/card/UnivariateColorSizeRamp.js +1 -1
- package/widgets/Legend/styles/classic/ClassicView.js +1 -1
- package/widgets/Legend/styles/classic/LegendElement.js +1 -1
- package/widgets/Legend/styles/classic/UnivariateAboveAndBelowRamp.js +1 -1
- package/widgets/Legend/styles/classic/UnivariateColorSizeRamp.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
- package/widgets/UtilityNetworkTrace/support/GraphicHandler.js +1 -1
- package/assets/esri/core/workers/chunks/0264905da9fa56166538.js +0 -1
- package/assets/esri/core/workers/chunks/070b29cba896f46537f9.js +0 -1
- package/assets/esri/core/workers/chunks/0cdf6b51f2a63f348530.js +0 -1
- package/assets/esri/core/workers/chunks/0d82cc6905b105b3568a.js +0 -1
- package/assets/esri/core/workers/chunks/1143313f2f6f34deaad7.js +0 -1
- package/assets/esri/core/workers/chunks/14c6461ffd36319e1d74.js +0 -1
- package/assets/esri/core/workers/chunks/2394ac65d64e50399d76.js +0 -1
- package/assets/esri/core/workers/chunks/47febd4de836a33b51b1.js +0 -1
- package/assets/esri/core/workers/chunks/487afbf352d12c745430.js +0 -1
- package/assets/esri/core/workers/chunks/56b4dcd04c844eaacd60.js +0 -1
- package/assets/esri/core/workers/chunks/5d65987f2c1b5c56a799.js +0 -1
- package/assets/esri/core/workers/chunks/77e27f318b5863dd0f5c.js +0 -1
- package/assets/esri/core/workers/chunks/7b7f5028a488bb9c10f4.js +0 -1
- package/assets/esri/core/workers/chunks/808cfed7022e3846d5b2.js +0 -1
- package/assets/esri/core/workers/chunks/8bd5a0ff7dcf1067bf53.js +0 -1
- package/assets/esri/core/workers/chunks/99b20eef2893047fac10.js +0 -1
- package/assets/esri/core/workers/chunks/9f4e23bae621ff3ecea3.js +0 -1
- package/assets/esri/core/workers/chunks/a596d6ccb6103e594031.js +0 -1
- package/assets/esri/core/workers/chunks/a5e6359fadbd699b1c8e.js +0 -1
- package/assets/esri/core/workers/chunks/a7f3cdd9a249ef4572ce.js +0 -1
- package/assets/esri/core/workers/chunks/a80d769b0ed025f0df64.js +0 -1
- package/assets/esri/core/workers/chunks/af83dddddbfe25194527.js +0 -1
- package/assets/esri/core/workers/chunks/b057e6d593c1607cae61.js +0 -1
- package/assets/esri/core/workers/chunks/b1f1a26e7a2ef5b783ee.js +0 -1
- package/assets/esri/core/workers/chunks/b605dfdfed8ff8eda4f3.js +0 -1
- package/assets/esri/core/workers/chunks/c337c1a2dbc452780dd7.js +0 -1
- package/assets/esri/core/workers/chunks/c601bbdafdee5074b04f.js +0 -1
- package/assets/esri/core/workers/chunks/c8694a27e2cf28b010e8.js +0 -1
- package/assets/esri/core/workers/chunks/e6457ac25c0829ee039c.js +0 -1
- package/assets/esri/core/workers/chunks/f4167fc895d4009df1c7.js +0 -1
- package/assets/esri/core/workers/chunks/f76774781865cb1411b0.js +0 -1
- package/assets/esri/core/workers/chunks/fd04df45cdcc6ff52554.js +0 -1
- package/graphic/IntegratedMesh3DTilesGraphicOrigin.d.ts +0 -4
- package/graphic/IntegratedMesh3DTilesGraphicOrigin.js +0 -5
- package/graphic/IntegratedMeshGraphicOrigin.d.ts +0 -4
- package/graphic/IntegratedMeshGraphicOrigin.js +0 -5
- package/graphic/isIntegratedMesh3DTilesGraphicOrigin.js +0 -5
- package/graphic/isIntegratedMeshGraphicOrigin.js +0 -5
- package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +0 -5
- package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +0 -5
- package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +0 -5
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization.js +0 -5
- package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.js +0 -5
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const c="
|
|
5
|
+
const c="20250823",d="8f8477d46495ccebfe2cdc31d31b693f0de7b196";export{c as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{pt2px as e,px2pt as t}from"../../core/screenUtils.js";import{CIMSymbolHelper as i}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as o}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as l}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as
|
|
5
|
+
import{pt2px as e,px2pt as t}from"../../core/screenUtils.js";import{CIMSymbolHelper as i}from"../cim/CIMSymbolHelper.js";import{CIMSymbolRasterizer as o}from"../cim/CIMSymbolRasterizer.js";import{OverrideHelper as l}from"../cim/OverrideHelper.js";import{mapCIMSymbolToGeometryType as r}from"../cim/utils.js";import{renderSymbol as n}from"./renderUtils.js";const a=new o(null),s=t(22),m=t(120),h=t(50),c=1;async function y(e,t,i){const o=t?.size;let l=null!=o&&"object"==typeof o&&"width"in o?o.width:o,r=null!=o&&"object"==typeof o&&"height"in o?o.height:o;if(!l||!r)if("esriGeometryPolygon"===i)l=r=t.maxSize?Math.min(t.maxSize,s):s;else{const o=await g(e,t,i);o&&(l=o.width,r=o.height),"esriGeometryPolyline"===i&&(l=t.maxSize?Math.min(t.maxSize,h):h),l=null!=l&&isFinite(l)?Math.min(l,m):s,r=null!=r&&isFinite(r)?Math.max(Math.min(r,m),c):s}return"legend"===t.style&&"esriGeometryPolyline"===i&&(l=h),{width:l,height:r}}async function g(e,t={},o){const n=t.cimOptions||t;o??=n.geometryType||r(e?.data?.symbol);const{feature:s,fieldMap:m,viewParams:h}=n,c=await l.resolveSymbolOverrides(e.data,s,null,m,o,null,h);if(!c)return null;(e=e.clone()).data={type:"CIMSymbolReference",symbol:c},e.data.primitiveOverrides=void 0;const y=[];return i.fetchResources(c,a.resourceManager,y),i.fetchFonts(c,a.resourceManager,y),y.length>0&&await Promise.all(y),i.getEnvelope(c,null,a.resourceManager)}async function u(i,o={}){const{node:l,opacity:s,symbolConfig:m}=o,h=null!=m&&"object"==typeof m&&"isSquareFill"in m&&m.isSquareFill,c=o.cimOptions||o,g=c.geometryType||r(i?.data?.symbol),u=await y(i,o,g),{feature:d,fieldMap:f}=c,p=o?.geometry||h||"esriGeometryPolygon"!==g?"preview":"legend";let w=u;const b=u;if(o?.geometry&&("esriGeometryPolygon"===g||"esriGeometryPolyline"===g)){const i=200;if(e(u.width)<i||e(u.height)<i){const e=u.width>u.height?t(i)*u.height/u.width:t(i);w={width:u.width>u.height?t(i):t(i)*u.width/u.height,height:e}}}const M=await a.rasterizeCIMSymbolAsync(i,d,w,p,f,g,null,c.viewParams,c.allowScalingUp,o?.geometry?.toJSON());if(!M)return null;const{width:S,height:v}=M,j=document.createElement("canvas");j.width=S,j.height=v;j.getContext("2d").putImageData(M,0,0);const P=e(b.width),x=e(b.height),z=new Image(P,x);z.src=j.toDataURL(),z.ariaLabel=o.ariaLabel??null,z.alt=o.ariaLabel??"",null!=s&&(z.style.opacity=`${s}`);let C=z;if(o.cssEffectFilter){const e={shape:{type:"image",x:0,y:0,width:P,height:x,src:z.src},fill:null,stroke:null,offset:[0,0]};C=n([[e]],[P,x],o)}return l&&C&&l.appendChild(C),C}export{g as getCIMSymbolPreviewSize,u as previewCIMSymbol};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../Color.js";import{getColorLuminance as e}from"../../core/colorUtils.js";import o from"../../core/Error.js";import{loadFont as i}from"../../core/fontUtils.js";import{pt2px as n}from"../../core/screenUtils.js";import{quantizePolygon as
|
|
5
|
+
import t from"../../Color.js";import{getColorLuminance as e}from"../../core/colorUtils.js";import o from"../../core/Error.js";import{loadFont as i}from"../../core/fontUtils.js";import{pt2px as n}from"../../core/screenUtils.js";import{quantizePolygon as l,quantizePolyline as a}from"../../geometry/support/quantizationUtils.js";import{getFill as s,getStroke as r,getDashArray as h,getPatternUrlWithColor as c}from"./gfxUtils.js";import{shapes as m,adjustColorBrightness as p}from"./previewUtils.js";import{renderSymbol as u}from"./renderUtils.js";import{backgroundPadding as d}from"./textUtils.js";const f="picture-fill",g="picture-marker",y="simple-fill",w="simple-line",x="simple-marker",b="text",v="Aa",M=22,S=120,k=80,z=50,L=225,C=document.createElement("canvas");function $(t,e,o){if("polygon"===t.type){const i=t.extent,n=0===i.width?1:i.width,a=0===i.height?1:i.height;t=l({originPosition:"upperLeft",scale:[n/e,a/o],translate:[i.xmin,i.ymax]},{},t);let s="";for(let e=0;e<t.rings.length;e++){const o=t.rings[e];for(let t=0;t<o.length;t++){const e=o[t][0],i=o[t][1];let n="";0===t?(n=`M${e.toString()} ${i.toString()}`,""!==s&&(n=` ${n}`),s+=n):t===o.length-1?(n=`l${e.toString()} ${i.toString()} Z`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${i.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}if("polyline"===t.type){const i=t.extent,n=0===i.width?1:i.width,l=0===i.height?1:i.height;t=a({originPosition:"upperLeft",scale:[n/e,l/o],translate:[i.xmin,i.ymax]},{},t);let s="";for(let e=0;e<t.paths.length;e++){const o=t.paths[e];for(let t=0;t<o.length;t++){const e=o[t][0],i=o[t][1];let n="";0===t?(n=`M${e.toString()} ${i.toString()}`,""!==s&&(n=` ${n}`),s+=n):(n=`l${e.toString()} ${i.toString()}`,""!==s&&(n=` ${n}`),s+=n)}}return s}return""}function j(t,e){const o=C.getContext("2d"),i=[];e&&(e.weight&&i.push(e.weight),e.size&&i.push(e.size+"px"),e.family&&i.push(e.family)),o.font=i.join(" ");const{width:n,actualBoundingBoxLeft:l,actualBoundingBoxRight:a,actualBoundingBoxAscent:s,actualBoundingBoxDescent:r}=o.measureText(t);return{width:Math.ceil(Math.max(n,l+a)),height:Math.ceil(s+r),x:Math.floor(l),y:Math.floor((s-r)/2)}}function B(t){const e=t?.size;return{width:null!=e&&"object"==typeof e&&"width"in e?n(e.width):null,height:null!=e&&"object"==typeof e&&"height"in e?n(e.height):null}}async function E(t,e){const o=e.fill,i=t.color;if("pattern"===o?.type&&i&&t.type!==f){const t=await c(o.src,i.toCss(!0));o.src=t,e.fill=o}}async function P(t,e,o,n){if(!("font"in t)||!t.font||"text"!==e.shape.type)return;try{await i(t.font)}catch{}const{width:l,height:a}=B(n);if(!/[\uE600-\uE6FF]/.test(e.shape.text)){const{width:i,height:s,x:r,y:h}=j(e.shape.text,{weight:e.font?.weight,size:e.font?.size,family:e.font?.family});o[0]=l??i,o[1]=a??s,e.shape.x=r,e.shape.y=h;let c="angle"in t?t.angle:null;if(null!=n?.rotation&&(c=(c??0)+n.rotation),c){const t=c*(Math.PI/180),e=Math.abs(Math.sin(t)),i=Math.abs(Math.cos(t));o[1]=o[0]*e+o[1]*i}}}function U(t,e,o,i,l){if(null!=t.haloColor&&null!=t.haloSize){l.masking??=o.map(()=>[]);const a=n(t.haloSize);i[0]+=a,i[1]+=a,o.unshift([{...e,fill:null,stroke:{color:t.haloColor,width:2*a,join:"round",cap:"round"}}]),l.masking.unshift([{shape:{type:"rect",x:0,y:0,width:i[0]+2*d,height:i[1]+2*d},fill:[255,255,255],stroke:null},{...e,fill:[0,0,0,0],stroke:null}])}null==t.backgroundColor&&null==t.borderLineColor||(i[0]+=2*d,i[1]+=2*d,o.unshift([{shape:{type:"rect",x:0,y:0,width:i[0],height:i[1]},fill:t.backgroundColor,stroke:{color:t.borderLineColor,width:n(t.borderLineSize)}}]),l.masking?.unshift([]))}function F(t,e){return t>e?"dark":"light"}function A(t,e){const o="number"==typeof e?.size?e?.size:null,i=null!=o?n(o):null,l=null!=e?.maxSize?n(e.maxSize):null;let a="angle"in t?t.angle:null;null!=e?.rotation&&(a=(a??0)+e.rotation);const c=s(t);let p=r(t);"dark"!==D(t,245)||e?.ignoreWhiteSymbols||(p={width:.75,...p,color:"#bdc3c7"});let u=null;const d={shape:null,fill:c,stroke:p,offset:[0,0]};p?.width&&(p.width=Math.min(p.width,k));const L=p?.width||0;let C=null!=e?.size&&(null==e?.scale||e?.scale),E=0,P=0,U=!1;switch(t.type){case x:{const o=t.style,{width:s,height:r}=B(e);let h=s===r&&null!=s?s:null!=i?i:Math.min(n(t.size),l||S);if(!0===e?.useMarkerSymbolSize&&null!==s&&null!==r){const e=Math.min(n(t.size),l||S);h=e>s&&e>r?Math.min(s,r):e}switch(E=h,P=h,o){case"circle":d.shape={type:"circle",cx:0,cy:0,r:.5*h},C||(E+=L,P+=L);break;case"cross":d.shape={type:"path",path:[{command:"M",values:[0,.5*P]},{command:"L",values:[E,.5*P]},{command:"M",values:[.5*E,0]},{command:"L",values:[.5*E,P]}]};break;case"diamond":d.shape={type:"path",path:[{command:"M",values:[0,.5*P]},{command:"L",values:[.5*E,0]},{command:"L",values:[E,.5*P]},{command:"L",values:[.5*E,P]},{command:"Z",values:[]}]},C||(E+=L,P+=L);break;case"square":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[E,0]},{command:"L",values:[E,P]},{command:"L",values:[0,P]},{command:"Z",values:[]}]},C||(E+=L,P+=L),a&&(U=!0);break;case"triangle":d.shape={type:"path",path:[{command:"M",values:[.5*E,0]},{command:"L",values:[E,P]},{command:"L",values:[0,P]},{command:"Z",values:[]}]},C||(E+=L,P+=L),a&&(U=!0);break;case"x":d.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[E,P]},{command:"M",values:[E,0]},{command:"L",values:[0,P]}]},a&&(U=!0);break;case"path":d.shape={type:"path",path:t.path||""},C||(E+=L,P+=L),a&&(U=!0),C=!0}break}case w:{const{width:t,height:o}=B(e),n=h(p).reduce((t,e)=>t+e,0),l=n&&Math.ceil(z/n),a=o??i??L,s=t??(n*l||z);if(C=!0,"polyline"===e?.geometry?.type&&e?.geometry?.extent){E=s,P=o??E;const t=1e3,i=.15*t;u=[E,P],P=u[0]>u[1]?t*u[1]/u[0]:t,E=u[0]>u[1]?t:t*u[0]/u[1],p?.width&&(p.width=p.width*t/(u[1]>u[0]?u[1]:u[0]),p.width>i&&(p.width=i)),d.shape={type:"path",path:$(e.geometry,E,P)}}else E=null!=e?.maxSize?Math.min(s,e.maxSize):s,P=a,p&&(p.width=a),d.shape={type:"path",path:[{command:"M",values:[a/2,P/2]},{command:"L",values:[E-a/2,P/2]}]};break}case f:case y:{const t="object"==typeof e?.symbolConfig&&!!e?.symbolConfig?.isSquareFill,{width:o,height:n}=B(e);E=!t&&o!==n||null==o?null!=i?i:M:o,P=!t&&o!==n||null==n?E:n,C||(E+=L,P+=L),C=!0,e?.geometry?.extent&&"polygon"===e?.geometry?.type?(u=[E,P],P=u[0]>u[1]?1e3*u[1]/u[0]:1e3,E=u[0]>u[1]?1e3:1e3*u[0]/u[1],d.shape={type:"path",path:$(e.geometry,E,P)}):d.shape=t?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[E,0]},{command:"L",values:[E,P]},{command:"L",values:[0,P]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:m.fill[0];break}case g:{const o=Math.min(n(t.width),l||S),s=Math.min(n(t.height),l||S),{width:r,height:h}=B(e),c=r===h&&null!=r?r:null!=i?i:Math.max(o,s),m=t.width/t.height;E=m<=1?Math.ceil(c*m):c,P=m<=1?c:Math.ceil(c/m),d.shape={type:"image",x:-Math.round(E/2),y:-Math.round(P/2),width:E,height:P,src:t.url||""},a&&(U=!0);break}case b:{const o=t,a=e?.overrideText||o.text||v,s=o.font,{width:r,height:h}=B(e),c=null!=h?h:null!=i?i:Math.min(n(s.size),l||S),{width:m,height:p}=j(a,{weight:s.weight,size:c,family:s.family}),u=/[\uE600-\uE6FF]/.test(a);E=r??(u?c:m),P=u?c:p;let f=.5*(u?c:p);u&&(f+=5),d.shape={type:"text",text:a,x:o.xoffset||0,y:o.yoffset||f,align:"middle",alignBaseline:o.verticalAlignment,decoration:s&&s.decoration,rotated:o.rotated,kerning:o.kerning},d.font=s&&{size:c,style:s.style,decoration:s.decoration,weight:s.weight,family:s.family};break}}return{shapeDescriptor:d,size:[E,P],outputSize:u,renderOptions:{node:e?.node,scale:C,opacity:e?.opacity,rotations:[a],useRotationSize:U,cssEffectFilter:e?.cssEffectFilter,ariaLabel:e?.ariaLabel,clipBloomEffect:e?.clipBloomEffect}}}async function Z(t,e){const{shapeDescriptor:i,size:n,renderOptions:l,outputSize:a}=A(t,e);if(!i.shape)throw new o("symbolPreview: renderPreviewHTML2D","symbol not supported.");await E(t,i),await P(t,i,n,e);const s=[[i]];if("object"==typeof e?.symbolConfig&&e?.symbolConfig?.applyColorModulation){const t=.6*n[0];s.unshift([{...i,offset:[-t,0],fill:p(i.fill,-.3)}]),s.push([{...i,offset:[t,0],fill:p(i.fill,.3)}]),n[0]+=2*t,l.scale=!1}"text"===t.type&&U(t,i,s,n,l);const r=u(s,n,l);if(a&&r){const t="img"===r.nodeName.toLowerCase()?r:r.firstChild;"svg"===t.nodeName.toLowerCase()&&t.setAttribute("viewBox",`0 0 ${n[0].toString()} ${n[1].toString()}`),t.setAttribute("width",a[0].toString()),t.setAttribute("height",a[1].toString()),a.length>2&&(t.style.setProperty("padding-left",a[2]?.toString()+"px"),t.style.setProperty("padding-right",a[2]?.toString()+"px"),t.style.setProperty("padding-top",a[3]?.toString()+"px"),t.style.setProperty("padding-bottom",a[3]?.toString()+"px"),t.style.setProperty("box-sizing","border-box"))}return r}function D(o,i=L){const n=s(o),l=r(o),a=!n||"type"in n?null:new t(n),h=l?.color?new t(l?.color):null,c=a?F(e(a),i):null,m=h?F(e(h),i):null;return m?c?c===m?c:i>=L?"light":"dark":m:c}export{D as getContrastingBackgroundTheme,A as getRenderSymbolParameters,Z as previewSymbol2D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as t}from"../../kernel.js";import e from"../../request.js";import{toHSV as i,toRGB as r}from"../../core/colorUtils.js";import n from"../../core/Error.js";import has from"../../core/has.js";import"../../libs/maquette/projection.js";import{createProjector as o}from"../../libs/maquette/projector.js";import{renderSVG as a}from"./svgUtils.js";
|
|
5
|
+
import{id as t}from"../../kernel.js";import e from"../../request.js";import{toHSV as i,toRGB as r}from"../../core/colorUtils.js";import n from"../../core/Error.js";import has from"../../core/has.js";import"../../libs/maquette/projection.js";import{createProjector as o}from"../../libs/maquette/projector.js";import{renderSVG as a}from"./svgUtils.js";const c=o();function s(t,e){c.append(t,e),c.detach(e)}function l(t,e,i){const r=Math.ceil(e[0]),n=Math.ceil(e[1]);if(!t.some(t=>!!t.length))return null;const o=i?.node||document.createElement("div");null!=i.opacity&&(o.style.opacity=i.opacity.toString()),null!=i.cssEffectFilter&&(o.style.filter=i.cssEffectFilter);return s(o,()=>a(t,r,n,i)),o}function h(t,e){t=Math.ceil(t),e=Math.ceil(e);const i=document.createElement("canvas");i.width=t,i.height=e,i.style.width=t+"px",i.style.height=e+"px";const r=i.getContext("2d");return r.clearRect(0,0,t,e),r}function m(t,i,r){return t?e(t,{responseType:"image"}).then(t=>{const e=t.data,n=e.width,o=e.height,a=n/o;let c=i;if(r){const t=Math.max(n,o);c=Math.min(c,t)}return{image:e,width:a<=1?Math.ceil(c*a):c,height:a<=1?c:Math.ceil(c/a)}}):Promise.reject(new n("renderUtils: imageDataSize","href not provided."))}function g(t,e){return!(!t||"ignore"===e)&&("multiply"!==e||255!==t.r||255!==t.g||255!==t.b||1!==t.a)}function u(t,e,n,o,a){switch(a){case"multiply":t[e]*=n[0],t[e+1]*=n[1],t[e+2]*=n[2],t[e+3]*=n[3];break;default:{const a=i({r:t[e],g:t[e+1],b:t[e+2]});a.h=o.h,a.s=o.s,a.v=a.v/100*o.v;const c=r(a);t[e]=c.r,t[e+1]=c.g,t[e+2]=c.b,t[e+3]*=n[3];break}}}function d(e,r,n,o,a){return m(e,r,a).then(a=>{const c=a.width??r,s=a.height??r;if(a.image&&g(n,o)){let t=a.image.width,r=a.image.height;has("edge")&&/\.svg$/i.test(e)&&(t-=1,r-=1);const l=h(c,s);l.drawImage(a.image,0,0,t,r,0,0,c,s);const m=l.getImageData(0,0,c,s),g=[n.r/255,n.g/255,n.b/255,n.a],d=i(n);for(let e=0;e<m.data.length;e+=4)u(m.data,e,g,d,o);l.putImageData(m,0,0),e=l.canvas.toDataURL("image/png")}else{const i=t?.findCredential(e);if(i?.token){const t=e.includes("?")?"&":"?";e=`${e}${t}token=${i.token}`}}return{url:e,width:c,height:s}}).catch(()=>({url:e,width:r,height:r}))}export{s as renderOnce,l as renderSymbol,d as tintImageWithColor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as r,scale as n,identity as o,translate as a,rotate as s}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as l}from"./gfxUtils.js";import{nextBloomId as h,nextPatternId as f,nextLinearGradientId as c}from"./svgGlobalState.js";import"../../widgets/support/widgetUtils.js";import{tsx as u}from"../../widgets/support/jsxFactory.js";const d="http://www.w3.org/2000/svg",y=has("android"),p=has("chrome")||y&&y>=4?"auto":"optimizeLegibility",g={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},m=/([A-DF-Za-df-z])|([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/g;let x={},w={};const k=Math.PI;function b(t,e){const i=t*(k/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function j(t){return t.map(t=>`${t.command} ${t.values.join(" ")}`).join(" ").trim()}function M(t,i,r,n,o){if(t){if("circle"===t.type)return u("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return u("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return u("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return u("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?j(t.path):t.path;return u("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),u("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":p,x:t.x,y:t.y},t.text)}return null}function v(e){if(!e)return{fill:"none",pattern:null,linearGradient:null};if(!("type"in e))return{fill:new t(e).toString(),pattern:null,linearGradient:null};if("pattern"===e.type){const t=`patternId-${f()}`;return{fill:`url(#${t})`,pattern:{id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}},linearGradient:null}}const i=`linearGradientId-${c()}`;return{fill:`url(#${i})`,pattern:null,linearGradient:{id:i,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map(e=>({offset:e.offset,color:e.color&&new t(e.color).toString()}))}}}function S(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=l(e).join(",")||"none")),i}function $(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function A(t){const{pattern:e,linearGradient:i}=t;if(e)return u("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},u("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map((t,e)=>u("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color}));return u("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function G(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,a=v(e),s=S(n),l="text"===t.type?$(t,o):null,h=M(t,a.fill,s,l);h&&i.push(h)}return u("mask",{id:e,maskUnits:"userSpaceOnUse"},u("g",null,i))}function N(t,e,i){return a(t,o(t),[e,i])}function z(t,e,i,r,a){return n(t,o(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-a*i+a,t}function B(t,e,i,r){const n=e%360*Math.PI/180;s(t,o(t),n);const a=Math.cos(n),l=Math.sin(n),h=t[4],f=t[5];return t[4]=h*a-f*l+r*l-i*a+i,t[5]=f*a+h*l-i*l-r*a+r,t}function I(t,e){x&&"left"in x?(null!=x.left&&x.left>t&&(x.left=t),(null==x.right||x.right<t)&&(x.right=t),(null==x.top||x.top>e)&&(x.top=e),(null==x.bottom||x.bottom<e)&&(x.bottom=e)):x={left:t,bottom:e,right:t,top:e}}function U(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)I(e[r],e[r+1]);w.x=e[i-2],w.y=e[i-1];break;case"H":for(r=0;r<i;++r)I(e[r],w.y);w.x=e[i-1];break;case"V":for(r=0;r<i;++r)I(w.x,e[r]);w.y=e[i-1];break;case"m":{let t=0;"x"in w||(I(w.x=e[0],w.y=e[1]),t=2);for(r=t;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)I(w.x+=e[r],w.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)I(w.x+=e[r],w.y);break;case"v":for(r=0;r<i;++r)I(w.x,w.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)I(w.x+e[r],w.y+e[r+1]),I(w.x+e[r+2],w.y+e[r+3]),I(w.x+=e[r+4],w.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)I(w.x+e[r],w.y+e[r+1]),I(w.x+=e[r+2],w.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)I(e[r+5],e[r+6]);w.x=e[i-2],w.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)I(w.x+=e[r+5],w.y+=e[r+6])}}function F(t,e,i){const r=g[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),U(n)):(n={action:t,args:[]},i.push(n),U(n)))}function O(t){const e=("string"!=typeof t.path?j(t.path):t.path).match(m),i=[];if(x={},w={},!e)return null;let r="",n=[];const o=e.length;for(let s=0;s<o;++s){const t=e[s],o=parseFloat(t);isNaN(o)?(r&&F(r,n,i),n=[],r=t):n.push(o)}F(r,n,i);const a={x:0,y:0,width:0,height:0};return x&&"left"in x&&(a.x=x.left,a.y=x.top,a.width=x.right-x.left,a.height=x.bottom-x.top),a}function E(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=O(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function T(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function L(t,e,n,o,a,s,l,h,f){let c=(l&&s?b(s,e):e)/2,u=(l&&s?b(s,n):n)/2;if(f){const t=f[0],e=f[1];c=(l&&s?b(s,t):t)/2,u=(l&&s?b(s,e):e)/2}const d=t.width+o,y=t.height+o,p=i(),g=i();let m=!1;if(a&&0!==d&&0!==y){const t=e!==n?e/n:d/y,i=e>n?e:n;let o=1,a=1;isNaN(i)||(t>1?(o=i/d,a=i/t/y):(a=i/y,o=i*t/d)),r(g,g,z(p,o,a,c,u)),m=!0}const x=t.x+(d-o)/2,w=t.y+(y-o)/2;if(r(g,g,N(p,c-x,u-w)),!m&&(d>e||y>n)){const t=d/e>y/n,i=(t?e:n)/(t?d:y);r(g,g,z(p,i,i,x,w))}return h&&r(g,g,N(p,h[0],h[1])),s&&r(g,g,B(p,s,x,w)),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function R(t,e,i){const r=t?.effects.find(t=>"bloom"===t.type);if(!r)return null;const{strength:n,radius:o}=r,a=n>0?o:0,s=(n+a)*e,l=4*n+1;return u("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},u("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*a)*(5**(e/100)*(.4+e/100)),result:"dilate"}),u("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:s/25}),u("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:s/50}),u("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},u("feFuncR",{slope:l,type:"linear"}),u("feFuncG",{slope:l,type:"linear"}),u("feFuncB",{slope:l,type:"linear"})),u("feMerge",null,u("feMergeNode",{in:"intensityBlur"}),u("feMergeNode",{in:"intensityBrightness"}),u("feGaussianBlur",{stdDeviation:n/10})))}function V(t,i,r,n={}){const o=[],a=[],s=h(),l=R(n.effectView,i,s);let f=null;if(l){const t=n.effectView?.effects.find(t=>"bloom"===t.type),e=n.clipBloomEffect||!t.strength?0:(t.strength+t.radius/2)/3,o=i+i*e,a=r+r*e;f=[Math.max(o,10),Math.max(a,10)]}let c=i,y=r;if(n.useRotationSize)for(let e=0;e<t.length;e++){const t=n.rotations?.[e]??0;c=Math.max(b(t,i),c),y=Math.max(b(t,r),y)}for(let e=0;e<t.length;e++){const s=t[e],l=[],h=[];let d=0,p=0,g=0;for(const t of s){const{shape:e,fill:i,stroke:r,font:a,offset:s}=t;n.ignoreStrokeWidth||"text"===e.type||(d+=r?.width||0);const f=v(i),c=S(r),u="text"===e.type?$(e,a):null;o.push(A(f)),l.push(M(e,f.fill,c,u,n.ariaLabel)),h.push(E(e)),s&&(p+=s[0],g+=s[1])}const m=n.rotations?.[e]??0;n.useRotationSize&&(p+=(c-b(m,i))/2,g+=(y-b(m,r))/2);const x=L(T(h),i,r,d,n.scale??!1,m,n.useRotationSize??!1,[p,g],f);let w=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(G(i,t)),w=`url(#${t})`}a.push(w?u("g",{mask:w},u("g",{transform:x},l)):u("g",{transform:x},l))}l&&(e(f),c=f[0],y=f[1]);const p="display: block;";return u("svg",{"aria-label":n.ariaLabel,focusable:!1,height:y,role:"img",style:p,width:c,xmlns:d},l,u("defs",null,o),l?u("g",{filter:`url(#bloom${s})`},a):a)}export{T as computeBBox,v as generateFillAttributes,S as generateStrokeAttributes,$ as generateTextAttributes,E as getBoundingBox,L as getTransformMatrix,A as renderDef,V as renderSVG,M as renderShape};
|
|
5
|
+
import t from"../../Color.js";import has from"../../core/has.js";import{assertIsSome as e}from"../../core/maybe.js";import{pt2px as i,toPt as r}from"../../core/screenUtils.js";import{create as n}from"../../core/libs/gl-matrix-2/factories/mat2df32.js";import{multiply as o,scale as s,identity as a,translate as l,rotate as h}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{getDashArray as c}from"./gfxUtils.js";import{nextBloomId as f,nextPatternId as u,nextLinearGradientId as d}from"./svgGlobalState.js";import"../../widgets/support/widgetUtils.js";import{tsx as y}from"../../widgets/support/jsxFactory.js";const p="http://www.w3.org/2000/svg",g=has("android"),m=has("chrome")||g&&g>=4?"auto":"optimizeLegibility",x={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7,z:0},w=/([A-DF-Za-df-z])|([-+]?\d*\.?\d+(?:[eE][-+]?\d+)?)/g;let k={},b={};const j=Math.PI;function M(t,e){const i=t*(j/180);return Math.abs(e*Math.sin(i))+Math.abs(e*Math.cos(i))}function v(t){return t.map(t=>`${t.command} ${t.values.join(" ")}`).join(" ").trim()}function S(t,i,r,n,o){if(t){if("circle"===t.type)return y("circle",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",r:t.r,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-dashoffset":r.dashOffset,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("ellipse"===t.type)return y("ellipse",{cx:t.cx,cy:t.cy,fill:i,"fill-rule":"evenodd",rx:t.rx,ry:t.ry,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width});if("rect"===t.type)return y("rect",{fill:i,"fill-rule":"evenodd",height:t.height,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,width:t.width,x:t.x,y:t.y});if("image"===t.type)return y("image",{alt:o||"image",height:t.height,href:t.src,preserveAspectRatio:"none",width:t.width,x:t.x,y:t.y});if("path"===t.type){const e="string"!=typeof t.path?v(t.path):t.path;return y("path",{d:e,fill:i,"fill-rule":"evenodd",stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width})}if("text"===t.type)return e(n),y("text",{"dominant-baseline":n.dominantBaseline,fill:i,"fill-rule":"evenodd","font-family":n.font.family,"font-size":n.font.size,"font-style":n.font.style,"font-variant":n.font.variant,"font-weight":n.font.weight,kerning:n.kerning,rotate:n.rotate,stroke:r.color,"stroke-dasharray":r.dashArray,"stroke-linecap":r.cap,"stroke-linejoin":r.join,"stroke-miterlimit":"4","stroke-width":r.width,"text-anchor":n.align,"text-decoration":n.decoration,"text-rendering":m,x:t.x,y:t.y},t.text)}return null}function $(e){if(!e)return{fill:"none",pattern:null,linearGradient:null};if(!("type"in e))return{fill:new t(e).toString(),pattern:null,linearGradient:null};if("pattern"===e.type){const t=`patternId-${u()}`;return{fill:`url(#${t})`,pattern:{id:t,x:e.x,y:e.y,width:e.width,height:e.height,image:{x:0,y:0,width:e.width,height:e.height,href:e.src}},linearGradient:null}}const i=`linearGradientId-${d()}`;return{fill:`url(#${i})`,pattern:null,linearGradient:{id:i,x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stops:e.colors.map(e=>({offset:e.offset,color:e.color&&new t(e.color).toString()}))}}}function A(e){const i={color:"none",width:1,cap:"butt",join:"4",dashArray:"none",dashOffset:"0"};return e&&(null!=e.width&&(i.width=e.width),e.cap&&(i.cap=e.cap),e.join&&(i.join=e.join.toString()),e.color&&(i.color=new t(e.color).toString()),e.dashArray&&(i.dashArray=e.dashArray),e.dashoffset&&(i.dashOffset=e.dashoffset),e.style&&!e.dashArray&&(i.dashArray=c(e).join(",")||"none")),i}function G(t,i){const r={align:null,decoration:null,kerning:null,rotate:null,font:{style:null,variant:null,weight:null,size:null,family:null}};if(t){const n=t.alignBaseline,o="baseline"===n?"auto":"top"===n?"text-top":"bottom"===n?"hanging":n;r.align=t.align,r.dominantBaseline=o,r.decoration=t.decoration,r.kerning=t.kerning?"auto":"0",r.rotate=t.rotated?"90":"0",e(i),r.font.style=i.style||"normal",r.font.variant=i.variant||"normal",r.font.weight=i.weight||"normal",r.font.size=i.size&&i.size.toString()||"10pt",r.font.family=i.family||"serif"}return r}function N(t){const{pattern:e,linearGradient:i}=t;if(e)return y("pattern",{height:e.height,id:e.id,patternUnits:"userSpaceOnUse",width:e.width,x:e.x,y:e.y},y("image",{height:e.image.height,href:e.image.href,width:e.image.width,x:e.image.x,y:e.image.y}));if(i){const t=i.stops.map((t,e)=>y("stop",{key:`${e}-stop`,offset:t.offset,"stop-color":t.color}));return y("linearGradient",{gradientUnits:"userSpaceOnUse",id:i.id,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2},t)}return null}function z(t,e){if(!t||0===t.length)return null;const i=[];for(const r of t){const{shape:t,fill:e,stroke:n,font:o}=r,s=$(e),a=A(n),l="text"===t.type?G(t,o):null,h=S(t,s.fill,a,l);h&&i.push(h)}return y("mask",{id:e,maskUnits:"userSpaceOnUse"},y("g",null,i))}function B(t,e,i){return l(t,a(t),[e,i])}function I(t,e,i,r,n){return s(t,a(t),[e,i]),t[4]=t[4]*e-r*e+r,t[5]=t[5]*i-n*i+n,t}function U(t,e,i,r){const n=e%360*Math.PI/180;h(t,a(t),n);const o=Math.cos(n),s=Math.sin(n),l=t[4],c=t[5];return t[4]=l*o-c*s+r*s-i*o+i,t[5]=c*o+l*s-i*s-r*o+r,t}function F(t,e){k&&"left"in k?(null!=k.left&&k.left>t&&(k.left=t),(null==k.right||k.right<t)&&(k.right=t),(null==k.top||k.top>e)&&(k.top=e),(null==k.bottom||k.bottom<e)&&(k.bottom=e)):k={left:t,bottom:e,right:t,top:e}}function E(t){const e=t.args,i=e.length;let r;switch(t.action){case"M":case"L":case"C":case"S":case"Q":case"T":for(r=0;r<i;r+=2)F(e[r],e[r+1]);b.x=e[i-2],b.y=e[i-1];break;case"H":for(r=0;r<i;++r)F(e[r],b.y);b.x=e[i-1];break;case"V":for(r=0;r<i;++r)F(b.x,e[r]);b.y=e[i-1];break;case"m":{let t=0;"x"in b||(F(b.x=e[0],b.y=e[1]),t=2);for(r=t;r<i;r+=2)F(b.x+=e[r],b.y+=e[r+1]);break}case"l":case"t":for(r=0;r<i;r+=2)F(b.x+=e[r],b.y+=e[r+1]);break;case"h":for(r=0;r<i;++r)F(b.x+=e[r],b.y);break;case"v":for(r=0;r<i;++r)F(b.x,b.y+=e[r]);break;case"c":for(r=0;r<i;r+=6)F(b.x+e[r],b.y+e[r+1]),F(b.x+e[r+2],b.y+e[r+3]),F(b.x+=e[r+4],b.y+=e[r+5]);break;case"s":case"q":for(r=0;r<i;r+=4)F(b.x+e[r],b.y+e[r+1]),F(b.x+=e[r+2],b.y+=e[r+3]);break;case"A":for(r=0;r<i;r+=7)F(e[r+5],e[r+6]);b.x=e[i-2],b.y=e[i-1];break;case"a":for(r=0;r<i;r+=7)F(b.x+=e[r+5],b.y+=e[r+6])}}function O(t,e,i){const r=x[t.toLowerCase()];let n;"number"==typeof r&&(r?e.length>=r&&(n={action:t,args:e.slice(0,e.length-e.length%r)},i.push(n),E(n)):(n={action:t,args:[]},i.push(n),E(n)))}function T(t){const e=("string"!=typeof t.path?v(t.path):t.path).match(w),i=[];if(k={},b={},!e)return null;let r="",n=[];const o=e.length;for(let a=0;a<o;++a){const t=e[a],o=parseFloat(t);isNaN(o)?(r&&O(r,n,i),n=[],r=t):n.push(o)}O(r,n,i);const s={x:0,y:0,width:0,height:0};return k&&"left"in k&&(s.x=k.left,s.y=k.top,s.width=k.right-k.left,s.height=k.bottom-k.top),s}function L(t){const e={x:0,y:0,width:0,height:0};if("circle"===t.type)e.x=t.cx-t.r,e.y=t.cy-t.r,e.width=2*t.r,e.height=2*t.r;else if("ellipse"===t.type)e.x=t.cx-t.rx,e.y=t.cy-t.ry,e.width=2*t.rx,e.height=2*t.ry;else if("image"===t.type||"rect"===t.type)e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height;else if("path"===t.type){const i=T(t);e.x=i.x,e.y=i.y,e.width=i.width,e.height=i.height}return e}function R(t){const e={x:0,y:0,width:0,height:0};let i=null,r=Number.NEGATIVE_INFINITY,n=Number.NEGATIVE_INFINITY;for(const o of t)i?(i.x=Math.min(i.x,o.x),i.y=Math.min(i.y,o.y),r=Math.max(r,o.x+o.width),n=Math.max(n,o.y+o.height)):(i=e,i.x=o.x,i.y=o.y,r=o.x+o.width,n=o.y+o.height);return i&&(i.width=r-i.x,i.height=n-i.y),i}function C(t,e,i,r,s,a,l,h,c){let f=(l&&a?M(a,e):e)/2,u=(l&&a?M(a,i):i)/2;if(c){const t=c[0],e=c[1];f=(l&&a?M(a,t):t)/2,u=(l&&a?M(a,e):e)/2}const d=t.width+r,y=t.height+r,p=n(),g=n();let m=!1;if(s&&0!==d&&0!==y){const t=e!==i?e/i:d/y,r=e>i?e:i;let n=1,s=1;isNaN(r)||(t>1?(n=r/d,s=r/t/y):(s=r/y,n=r*t/d)),o(g,g,I(p,n,s,f,u)),m=!0}const x=t.x+(d-r)/2,w=t.y+(y-r)/2;if(o(g,g,B(p,f-x,u-w)),!m&&(d>e||y>i)){const t=d/e>y/i,r=(t?e:i)/(t?d:y);o(g,g,I(p,r,r,x,w))}return h&&o(g,g,B(p,h[0],h[1])),a&&o(g,g,U(p,a,x,w)),`matrix(${g[0]},${g[1]},${g[2]},${g[3]},${g[4]},${g[5]})`}function D(t){const e=t?.match(/bloom\(\s*([^\s]+)\s+([^\s]+)\s+([^\s]+)\s*\)/i);if(!e)return null;const[,n,o,s]=e;return{strength:Number(n),radius:i(r(o)),threshold:Number(s)}}function V(t,e,i){const r=D(t);if(!r)return null;const{strength:n,radius:o}=r,s=n>0?o:0,a=(n+s)*e,l=4*n+1;return y("filter",{filterUnits:"userSpaceOnUse",height:"300%",id:`bloom${i}`,width:"300%",x:"-100%",y:"-100%"},y("feMorphology",{in:"SourceGraphic",operator:"dilate",radius:(n+.5*s)*(5**(e/100)*(.4+e/100)),result:"dilate"}),y("feGaussianBlur",{in:"dilate",result:"blur",stdDeviation:a/25}),y("feGaussianBlur",{in:"blur",result:"intensityBlur",stdDeviation:a/50}),y("feComponentTransfer",{in:"SourceGraphic",result:"intensityBrightness"},y("feFuncR",{slope:l,type:"linear"}),y("feFuncG",{slope:l,type:"linear"}),y("feFuncB",{slope:l,type:"linear"})),y("feMerge",null,y("feMergeNode",{in:"intensityBlur"}),y("feMergeNode",{in:"intensityBrightness"}),y("feGaussianBlur",{stdDeviation:n/10})))}function q(t,i,r,n={}){const o=[],s=[],a=f(),l=V(n.cssEffectFilter,i,a);let h=null;if(l){const t=D(n.cssEffectFilter),e=n.clipBloomEffect||!t?.strength?0:(t.strength+t.radius/2)/3,o=i+i*e,s=r+r*e;h=[Math.max(o,10),Math.max(s,10)]}let c=i,u=r;if(n.useRotationSize)for(let e=0;e<t.length;e++){const t=n.rotations?.[e]??0;c=Math.max(M(t,i),c),u=Math.max(M(t,r),u)}for(let e=0;e<t.length;e++){const a=t[e],l=[],f=[];let d=0,p=0,g=0;for(const t of a){const{shape:e,fill:i,stroke:r,font:s,offset:a}=t;n.ignoreStrokeWidth||"text"===e.type||(d+=r?.width||0);const h=$(i),c=A(r),u="text"===e.type?G(e,s):null;o.push(N(h)),l.push(S(e,h.fill,c,u,n.ariaLabel)),f.push(L(e)),a&&(p+=a[0],g+=a[1])}const m=n.rotations?.[e]??0;n.useRotationSize&&(p+=(c-M(m,i))/2,g+=(u-M(m,r))/2);const x=C(R(f),i,r,d,n.scale??!1,m,n.useRotationSize??!1,[p,g],h);let w=null;if(n.masking){const t=`mask-${e}`,i=n.masking[e];o.push(z(i,t)),w=`url(#${t})`}s.push(w?y("g",{mask:w},y("g",{transform:x},l)):y("g",{transform:x},l))}l&&(e(h),c=h[0],u=h[1]);const d="display: block;";return y("svg",{"aria-label":n.ariaLabel,focusable:!1,height:u,role:"img",style:d,width:c,xmlns:p},l,y("defs",null,o),l?y("g",{filter:`url(#bloom${a})`},s):s)}export{R as computeBBox,$ as generateFillAttributes,A as generateStrokeAttributes,G as generateTextAttributes,L as getBoundingBox,C as getTransformMatrix,N as renderDef,q as renderSVG,S as renderShape};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{px2pt as
|
|
5
|
+
import"../../core/has.js";import{pt2px as e,toPt as t,px2pt as l}from"../../core/screenUtils.js";import{isSubtypeGroupLayer as a}from"../../layers/support/layerUtils.js";import{loadArcade as i}from"../../support/loadArcade.js";import{getStroke as r}from"./gfxUtils.js";import{renderSymbol as s,renderOnce as o}from"./renderUtils.js";import{isSymbol3D as n}from"./typeUtils.js";import{applyColorToSymbol as c,applySizesToSymbol as u,applyRotationToSymbol as p,getColorFromSymbol as f,applyOpacityToColor as y}from"./utils.js";import{renderRelationshipRamp as h}from"../../widgets/Legend/styles/support/relationshipUtils.js";import{getRelationshipRampElement as d}from"../../widgets/Legend/support/relationshipRampUtils.js";let m=null;const b=[255,255,255];function g(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function w(e,t,l){const{backgroundColor:a,outline:i,dotSize:r}=e,s=l?.swatchSize||22,o=.8,n=Math.round(s*s/Math.max(r,.5)**2*o),c=window.devicePixelRatio,u=document.createElement("canvas"),p=s*c;u.width=p,u.height=p,u.style.width=u.width/c+"px",u.style.height=u.height/c+"px";const f=u.getContext("2d");if(a&&(f.fillStyle=a.toCss(!0),f.fillRect(0,0,p,p),f.fill()),f.fillStyle=t?.toCss(!0)??"",m&&m.length/2===n)for(let h=0;h<2*n;h+=2){const e=m[h],t=m[h+1];f.fillRect(e,t,r*c,r*c),f.fill()}else{m=[];for(let e=0;e<2*n;e+=2){const e=g(0,p),t=g(0,p);m.push(e,t),f.fillRect(e,t,r*c,r*c),f.fill()}}i&&(i.color&&(f.strokeStyle=i.color.toCss(!0)),f.lineWidth=i.width,f.strokeRect(0,0,p,p));const y=new Image(s,s);return y.src=u.toDataURL(),y.ariaLabel=l?.ariaLabel??null,y.alt=l?.ariaLabel??"",y}function S(e,t={}){const l=t.radius||40,a=2*Math.PI*l,i=e.length,o=a/i,n=[],c=r(t.outline);null!=c?.width&&(c.width*=2),(c||t.backgroundColor)&&n.push({shape:{type:"circle",cx:l,cy:l,r:l},fill:t.backgroundColor,stroke:c,offset:[0,0]});const u=t.values,p=u&&u.length===i&&100===u.reduce((e,t)=>e+t,0),f=[0];for(let r=0;r<i;r++){let t=null;p&&(t=u[r]*a/100,f.push(t+f[r])),n.push({shape:{type:"circle",cx:l,cy:l,r:l/2},fill:[0,0,0,0],stroke:{width:l,dashArray:`${(t??o)/2} ${a}`,dashoffset:"-"+(p?f[r]/2:r*(o/2)),color:e[r]},offset:[0,0]})}let y=null;const h=2*l+(c?.width||0),d=t.holePercentage;if(d){c&&n.push({shape:{type:"circle",cx:l,cy:l,r:l*d},fill:null,stroke:c,offset:[0,0]});const e=h/2;y=[[{shape:{type:"circle",cx:e,cy:e,r:e},fill:b,stroke:c?{...c,color:b}:null,offset:[0,0]},{shape:{type:"circle",cx:e,cy:e,r:l*d},fill:[0,0,0],stroke:null,offset:[0,0]}]]}return s([n],[h,h],{cssEffectFilter:t.cssEffectFilter,ignoreStrokeWidth:!0,masking:y,rotations:[-90],ariaLabel:t.ariaLabel})}function v(e,t={}){const l=e?.authoringInfo;if(!("relationship"===l?.type)||!l?.numClasses||!e.uniqueValueInfos)return null;const{focus:a,numClasses:i}=l,r=d({focus:a,numClasses:i,infos:e.uniqueValueInfos}),s=t?.node||document.createElement("div");return o(s,()=>h(r,t.id||"relationship",{opacity:t.opacity||1,cssEffectFilter:t.cssEffectFilter,ariaLabel:t.ariaLabel})),s}function V(e,t={}){const l=24,a=75,i="horizontal"===t.align,r=i?a:l,s=i?l:a,o=t.width??r,n=t.height??s,c=t.gradient??!0,u=window.devicePixelRatio,p=o*u,f=n*u,y=document.createElement("canvas");y.width=p,y.height=f,y.ariaLabel=t.ariaLabel??null,y.style.width=`${o}px`,y.style.height=`${n}px`;const h=y.getContext("2d"),d=i?p:0,m=i?0:f;if(c){const t=h.createLinearGradient(0,0,d,m),l=e.length,a=1===l?0:1/(l-1);e.forEach((e,l)=>t.addColorStop(l*a,e.toString())),h.fillStyle=t,h.fillRect(0,0,p,f)}else{const t=i?p/e.length:p,l=i?f:f/e.length;let a=0,r=0;for(const s of e)h.fillStyle=s.toString(),h.fillRect(a,r,t,l),a=i?a+t:0,r=i?0:r+l}const b=document.createElement("div");return b.style.width=`${o}px`,b.style.height=`${n}px`,x(b,t?.cssEffectFilter),b.appendChild(y),b}function k(e){const t=e.match(/drop-shadow\(\s*([^\s]+)\s+[^\s]+\s+[^\s]+\s+.+?\)/);return t?t[1]:null}function x(l,a){if(!a)return;l.style.filter=a;const i=k(a);if(i){const a=e(t(i));a<0?l.style.marginLeft=`${Math.abs(a)}px`:l.style.marginRight=`${a}px`}}async function L(e,t){switch(e.type){case"web-style":{const{previewWebStyleSymbol:l}=await import("./previewWebStyleSymbol.js");return l(e,L,t)}case"label-3d":case"line-3d":case"mesh-3d":case"point-3d":case"polygon-3d":{const{previewSymbol3D:l}=await import("./previewSymbol3D.js");return l(e,t)}case"simple-marker":case"simple-line":case"simple-fill":case"picture-marker":case"picture-fill":case"text":{const{previewSymbol2D:l}=await import("./previewSymbol2D.js");return l(e,t)}case"cim":{const{previewCIMSymbol:l}=await import("./previewCIMSymbol.js");return l(e,t)}default:return}}function R(e){return e&&"opacity"in e?e.opacity*R(e.parent):1}async function C(e,t){if(!e)return;const l=e.sourceLayer,a=(null!=t&&t.useSourceLayer?l:e.layer)??l,r=t?.ignoreOpacity?1:R(a);if(null!=e.symbol&&(null==t||!0!==t.ignoreGraphicSymbol)){const l="web-style"===e.symbol.type?await e.symbol.fetchSymbol({...t,acceptedFormats:t?.webStyleAcceptedFormats,cache:t?.webStyleCache}):e.symbol.clone();return c(l,null,{add:r}),l}const s=t?.renderer??I(a);let o=s&&"getSymbolAsync"in s?await s.getSymbolAsync(e,t):null;if(!o)return;if(o="web-style"===o.type?await o.fetchSymbol({...t,acceptedFormats:t?.webStyleAcceptedFormats,cache:t?.webStyleCache}):o.clone(),!(s&&"visualVariables"in s&&s.visualVariables?.length&&j(o)))return c(o,null,{add:r}),o;if("arcadeRequiredForVisualVariables"in s&&s.arcadeRequiredForVisualVariables&&null==t?.arcade){const e={...t};e.arcade=await i(),t=e}const{getColor:n,getOpacity:f,getAllSizes:y,getRotationAngle:h}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),d=[],m=[],b=[],g=[];for(const i of s.visualVariables)switch(i.type){case"color":d.push(i);break;case"opacity":m.push(i);break;case"rotation":g.push(i);break;case"size":i.target||b.push(i)}const w=!!d.length&&d[d.length-1],S=w?n(w,e,t):null,v=!!t?.ignoreOpacity,V=!!m.length&&m[m.length-1],k=V?f(V,e,t):null;if(c(o,S,v?void 0:{override:k,add:r}),b.length&&!0!==t?.ignoreSizeVariables){const l=y(b,e,t);await u(o,l)}if(!0!==t?.ignoreRotationVariables)for(const i of g)p(o,h(i,e,t),i.axis);return o}async function F(e,t){if(!e)return;const{layer:l,sourceLayer:a}=e,r=R(l??a);if(null!=e.symbol&&(null==t||!0!==t.ignoreGraphicSymbol)){const l="web-style"===e.symbol.type?await e.symbol.fetchSymbol({...t,acceptedFormats:t?.webStyleAcceptedFormats}):e.symbol.clone();return f(l,r)}const s=t?.renderer??I(l)??I(a);let o=s&&"getSymbolAsync"in s?await s.getSymbolAsync(e,t):void 0;if(!o)return;o="web-style"===o.type?await o.fetchSymbol({...t,acceptedFormats:t?.webStyleAcceptedFormats}):o.clone();const n=f(o,void 0);if(!s||!("visualVariables"in s)||"visualVariables"in s&&!s.visualVariables||"visualVariables"in s&&!s.visualVariables?.length||!j(o))return n?y(n,r):void 0;if("arcadeRequiredForVisualVariables"in s&&s.arcadeRequiredForVisualVariables&&null==t?.arcade){const e={...t};e.arcade=await i(),t=e}const{getColor:c,getOpacity:u}=await import("../../renderers/visualVariables/support/visualVariableUtils.js"),p=[],h=[];if(s.visualVariables)for(const i of s.visualVariables)switch(i.type){case"color":p.push(i);break;case"opacity":h.push(i)}const d=p.length>0?p[p.length-1]:null,m=(d?c(d,e,t):void 0)??n,b=h.length>0?h[h.length-1]:null,g=b?u(b,e,t):null;return null!=m&&null!=g&&(m.a=g),m?y(m,r):null}function j(e){return!n(e)||"water"!==e.symbolLayers.at(0)?.type}function I(e){if(e)return"renderer"in e?e.renderer:void 0}async function U(e,t,l){if(!e)return;const{layer:a,sourceLayer:i}=e,r=l?.renderer??I(a)??I(i);if(!r)return null;if("visualVariables"in r&&r.visualVariables?.length){const{getRampStops:i}=await import("../../widgets/Legend/support/colorRampUtils.js"),{getRampStops:s}=await import("../../widgets/Legend/support/sizeRampUtils.js"),{getDateFormatOptions:o}=await import("../../widgets/Legend/support/utils.js");let n=null;for(const c of r.visualVariables){const u=t?o(a,c,t.timeZone):null;let p=null;switch(c.type){case"color":p=await i(c,null,u);break;case"opacity":p=await i(c);break;case"size":c.target||(p=await s(r,c,null,l?.scale||t?.scale,t,u))}if(p?.length){const t=p.find((t,l)=>{const a=e.attributes[c.field];return 0===l?a>=t.value:l===p?.length-1?a<=t.value:t.value===a});if(t){n=t.label;break}}}if(n)return n}switch(r.type){case"class-breaks":{const t="getClassBreakInfo"in r?await r.getClassBreakInfo(e,l):null;return t?.label??(t&&r.classBreakInfos?.length>1)?`${t.minValue} - ${t.maxValue}`:null}case"unique-value":{const t="getUniqueValueInfo"in r?await r.getUniqueValueInfo(e,l):null;return t?.label}}return null}async function z(e,t){e?.layer&&a(e.layer)&&((e=e.cloneShallow()).layer=e.layer.findSublayerForFeature(e)??null);const i=null===e?t?.fallbackSymbol??null:await C(e,{ignoreGraphicSymbol:!!e.layer,ignoreOpacity:t?.ignoreOpacity??!0,ignoreRotationVariables:t?.ignoreRotationVariables??!0,ignoreSizeVariables:t?.ignoreSizeVariables??!0})??t?.fallbackSymbol??null;if(!i)return null;const r=await L(i,{geometry:t.useGeometryForShape?e?.geometry??null:null,useMarkerSymbolSize:!1!==t.useMarkerSymbolSize,size:{width:l(t.widthInPixels??16),height:l(t.heightInPixels??16)},..."cim"===i?.type?{cimOptions:{feature:{attributes:e?.attributes??{}}}}:{}});if(!r)return null;return"element"===(t?.format??"element")?r:r.outerHTML}export{F as getDisplayedColor,C as getDisplayedSymbol,U as getLegendLabel,z as previewGraphic,V as renderColorRampPreviewHTML,w as renderDotDensityPreviewHTML,S as renderPieChartPreviewHTML,L as renderPreviewHTML,v as renderRelationshipRampPreviewHTML};
|
package/symbols/support/utils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import{forEach as t}from"../../core/asyncUtils.js";import"../../core/has.js";import{px2pt as r}from"../../core/screenUtils.js";import{ONES as o}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{effectFunctionsFromJSON as n}from"../../layers/effects/jsonUtils.js";import{getCIMSymbolColor as l}from"./cimSymbolUtils.js";import{getStroke as i}from"./gfxUtils.js";import{Symbol3DMaterial as c}from"./Symbol3DMaterial.js";import{isSymbol3D as u,isSymbol2D as s}from"./typeUtils.js";function a(e){const t=e.symbolLayers?.at(-1);if(t&&"outline"in t)return t?.outline?.size}function f(e){if(!e)return 0;if(u(e)){const t=a(e);return null!=t?t:0}return r(i(e)?.width)}function m(e){const t=e.symbolLayers?.at(-1);if(t&&"outline"in t)return t?.outline?.color}function y(t){if(!t)return null;if(u(t))return m(t);const r=i(t)?.color;return r?new e(r):null}function p(e){if(null==e||!("symbolLayers"in e)||null==e.symbolLayers)return!1;switch(e.type){case"point-3d":return e.symbolLayers.some(e=>"object"===e.type);case"line-3d":return e.symbolLayers.some(e=>"path"===e.type);case"polygon-3d":return e.symbolLayers.some(e=>"object"===e.type||"extrude"===e.type);default:return!1}}function h(e){return e.resource?.href??""}function d(t,r){if(!t)return null;let o=null;return u(t)?o=b(t):s(t)&&(o="cim"===t.type?l(t):t.color?new e(t.color):null),o?w(o,r):null}function b(t){const r=t.symbolLayers;if(!r)return null;let o=null;return r.forEach(e=>{"object"===e.type&&e.resource?.href||(o="water"===e.type?e.color:e.material?e.material.color:null)}),o?new e(o):null}function w(t,r){if(null==r||null==t)return t;const o=t.toRgba();return o[3]=o[3]*r,new e(o)}function j(t,r,o){const n=t.symbolLayers;if(!n)return;const l=(t,n=!1)=>{let l=r??t??null;return null!=o?.override&&(!l&&n&&(l=new e([255,255,255])),l&&(l.a=o.override)),w(l,o?.add)};n.forEach(e=>{if("water"===e.type)return void(e.color=w(e.color,o?.add));const t=null!=e.material?e.material.color:null,r=l(t,"icon"===e.type&&null!=e.resource?.href);null==e.material?e.material=new c({color:r}):e.material.color=r,"outline"in e&&e.outline?.color&&null!=o?.add&&(e.outline.color=w(e.outline.color,o.add)),"marker"in e&&null!=e.marker&&(e.marker.color=l(e.marker.color))})}function k(e,t,r){t=t??e.color,null!=r?.override&&t&&(t.a=r.override),t&&(e.color=w(t,r?.add)),"outline"in e&&e.outline?.color&&(e.outline.color=w(e.outline.color,r?.add))}function g(t,r,o){t&&(r||null!=o)&&(r&&(r=new e(r)),u(t)?j(t,r,o):s(t)&&k(t,r,o))}async function L(e,r){const o=e.symbolLayers;o&&await t(o,async e=>v(e,r))}async function v(e,t){switch(e.type){case"extrude":S(e,t);break;case"icon":case"line":case"text":z(e,t);break;case"path":E(e,t);break;case"object":await U(e,t)}}function z(e,t){const r=x(t);null!=r&&(e.size=r)}function x(e){for(const t of e)if("number"==typeof t)return t;return null}function S(e,t){const r=t[2];"number"==typeof r&&(e.size=r)}async function U(e,t){const{resourceSize:r,symbolSize:o}=await R(e),n=O(t,r,o);null!=n&&(e.width=C(t[0],o[0],r[0],n),e.depth=C(t[1],o[1],r[1],n),e.height=C(t[2],o[2],r[2],n))}function E(e,t){const r=O(t,o,[e.width,void 0,e.height]);null!=r&&(e.width=C(t[0],e.width,1,r),e.height=C(t[2],e.height,1,r))}function O(e,t,r){for(let o=0;o<3;o++){const n=e[o];switch(n){case"symbol-value":{const e=r[o];return null!=e?e/t[o]:1}case"proportional":break;default:if(n&&t[o])return n/t[o]}}return null}async function R(e){const{computeObjectLayerResourceSize:t}=await import("./symbolLayerUtils.js"),r=await t(e,10),{width:o,height:n,depth:l}=e,i=[o,l,n];let c=1;for(let u=0;u<3;u++){const e=i[u];if(null!=e){c=e/r[u];break}}for(let u=0;u<3;u++)null==i[u]&&(i[u]=r[u]*c);return{resourceSize:r,symbolSize:i}}function C(e,t,r,o){switch(e){case"proportional":return r*o;case"symbol-value":return null!=t?t:r;default:return e}}function D(e,t){const r=x(t);if(null!=r)switch(e.type){case"simple-marker":e.size=r;break;case"picture-marker":{const t=e.width/e.height;t>1?(e.width=r,e.height=r*t):(e.width=r*t,e.height=r);break}case"simple-line":e.width=r;break;case"text":e.font.size=r}}async function J(e,t){if(e&&t)return u(e)?L(e,t):void(s(e)&&D(e,t))}function M(e,t,r){if(e&&null!=t)if(u(e)){const o=e.symbolLayers;o&&o.forEach(e=>{if("object"===e.type)switch(r){case"tilt":e.tilt=(e.tilt??0)+t;break;case"roll":e.roll=(e.roll??0)+t;break;default:e.heading=(e.heading??0)+t}"icon"===e.type&&(e.angle+=t)})}else s(e)&&("simple-marker"!==e.type&&"picture-marker"!==e.type&&"text"!==e.type||(e.angle+=t))}function N(e){if(!e)return null;const t
|
|
5
|
+
import e from"../../Color.js";import{forEach as t}from"../../core/asyncUtils.js";import"../../core/has.js";import{px2pt as r}from"../../core/screenUtils.js";import{ONES as o}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{effectFunctionsFromJSON as n}from"../../layers/effects/jsonUtils.js";import{getCIMSymbolColor as l}from"./cimSymbolUtils.js";import{getStroke as i}from"./gfxUtils.js";import{Symbol3DMaterial as c}from"./Symbol3DMaterial.js";import{isSymbol3D as u,isSymbol2D as s}from"./typeUtils.js";function a(e){const t=e.symbolLayers?.at(-1);if(t&&"outline"in t)return t?.outline?.size}function f(e){if(!e)return 0;if(u(e)){const t=a(e);return null!=t?t:0}return r(i(e)?.width)}function m(e){const t=e.symbolLayers?.at(-1);if(t&&"outline"in t)return t?.outline?.color}function y(t){if(!t)return null;if(u(t))return m(t);const r=i(t)?.color;return r?new e(r):null}function p(e){if(null==e||!("symbolLayers"in e)||null==e.symbolLayers)return!1;switch(e.type){case"point-3d":return e.symbolLayers.some(e=>"object"===e.type);case"line-3d":return e.symbolLayers.some(e=>"path"===e.type);case"polygon-3d":return e.symbolLayers.some(e=>"object"===e.type||"extrude"===e.type);default:return!1}}function h(e){return e.resource?.href??""}function d(t,r){if(!t)return null;let o=null;return u(t)?o=b(t):s(t)&&(o="cim"===t.type?l(t):t.color?new e(t.color):null),o?w(o,r):null}function b(t){const r=t.symbolLayers;if(!r)return null;let o=null;return r.forEach(e=>{"object"===e.type&&e.resource?.href||(o="water"===e.type?e.color:e.material?e.material.color:null)}),o?new e(o):null}function w(t,r){if(null==r||null==t)return t;const o=t.toRgba();return o[3]=o[3]*r,new e(o)}function j(t,r,o){const n=t.symbolLayers;if(!n)return;const l=(t,n=!1)=>{let l=r??t??null;return null!=o?.override&&(!l&&n&&(l=new e([255,255,255])),l&&(l.a=o.override)),w(l,o?.add)};n.forEach(e=>{if("water"===e.type)return void(e.color=w(e.color,o?.add));const t=null!=e.material?e.material.color:null,r=l(t,"icon"===e.type&&null!=e.resource?.href);null==e.material?e.material=new c({color:r}):e.material.color=r,"outline"in e&&e.outline?.color&&null!=o?.add&&(e.outline.color=w(e.outline.color,o.add)),"marker"in e&&null!=e.marker&&(e.marker.color=l(e.marker.color))})}function k(e,t,r){t=t??e.color,null!=r?.override&&t&&(t.a=r.override),t&&(e.color=w(t,r?.add)),"outline"in e&&e.outline?.color&&(e.outline.color=w(e.outline.color,r?.add))}function g(t,r,o){t&&(r||null!=o)&&(r&&(r=new e(r)),u(t)?j(t,r,o):s(t)&&k(t,r,o))}async function L(e,r){const o=e.symbolLayers;o&&await t(o,async e=>v(e,r))}async function v(e,t){switch(e.type){case"extrude":S(e,t);break;case"icon":case"line":case"text":z(e,t);break;case"path":E(e,t);break;case"object":await U(e,t)}}function z(e,t){const r=x(t);null!=r&&(e.size=r)}function x(e){for(const t of e)if("number"==typeof t)return t;return null}function S(e,t){const r=t[2];"number"==typeof r&&(e.size=r)}async function U(e,t){const{resourceSize:r,symbolSize:o}=await R(e),n=O(t,r,o);null!=n&&(e.width=C(t[0],o[0],r[0],n),e.depth=C(t[1],o[1],r[1],n),e.height=C(t[2],o[2],r[2],n))}function E(e,t){const r=O(t,o,[e.width,void 0,e.height]);null!=r&&(e.width=C(t[0],e.width,1,r),e.height=C(t[2],e.height,1,r))}function O(e,t,r){for(let o=0;o<3;o++){const n=e[o];switch(n){case"symbol-value":{const e=r[o];return null!=e?e/t[o]:1}case"proportional":break;default:if(n&&t[o])return n/t[o]}}return null}async function R(e){const{computeObjectLayerResourceSize:t}=await import("./symbolLayerUtils.js"),r=await t(e,10),{width:o,height:n,depth:l}=e,i=[o,l,n];let c=1;for(let u=0;u<3;u++){const e=i[u];if(null!=e){c=e/r[u];break}}for(let u=0;u<3;u++)null==i[u]&&(i[u]=r[u]*c);return{resourceSize:r,symbolSize:i}}function C(e,t,r,o){switch(e){case"proportional":return r*o;case"symbol-value":return null!=t?t:r;default:return e}}function D(e,t){const r=x(t);if(null!=r)switch(e.type){case"simple-marker":e.size=r;break;case"picture-marker":{const t=e.width/e.height;t>1?(e.width=r,e.height=r*t):(e.width=r*t,e.height=r);break}case"simple-line":e.width=r;break;case"text":e.font.size=r}}async function J(e,t){if(e&&t)return u(e)?L(e,t):void(s(e)&&D(e,t))}function M(e,t,r){if(e&&null!=t)if(u(e)){const o=e.symbolLayers;o&&o.forEach(e=>{if("object"===e.type)switch(r){case"tilt":e.tilt=(e.tilt??0)+t;break;case"roll":e.roll=(e.roll??0)+t;break;default:e.heading=(e.heading??0)+t}"icon"===e.type&&(e.angle+=t)})}else s(e)&&("simple-marker"!==e.type&&"picture-marker"!==e.type&&"text"!==e.type||(e.angle+=t))}function N(e,t){if(!e)return null;const r=(t?e.effects:e.effects.filter(e=>"bloom"!==e.type)).map(e=>e.toJSON());return n(r)}function q(e){return null!=e&&"polygon-3d"===e.type&&e.symbolLayers.some(e=>"extrude"===e.type)}export{g as applyColorToSymbol,w as applyOpacityToColor,M as applyRotationToSymbol,J as applySizesToSymbol,N as getCSSFilterFromEffectList,d as getColorFromSymbol,h as getIconHref,y as getSymbolOutlineColor,f as getSymbolOutlineSize,p as isVolumetricSymbol,q as symbolHasExtrudeSymbolLayer};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as s}from"../../../../core/asyncUtils.js";import{abortMaybe as o,removeMaybe as e}from"../../../../core/maybe.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{connectVisualization as l}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";import{highlightsSupported as n}from"../../../support/layerViewUtils.js";let p=class extends t{constructor(i){super(i),this._highlightTask=null,this._highlightHandle=null}initialize(){this.addHandles(l({analysisViewData:this.analysisViewData,onRemove:()=>this._remove(),onShowSketchedGraphic:()=>this._remove(),onHighlight:(i,t)=>this._highlight(i,t)}))}destroy(){this._remove()}get updating(){return null!=this._highlightTask&&!this._highlightTask.finished}_remove(){this._highlightTask=o(this._highlightTask),this._highlightHandle=e(this._highlightHandle)}_highlight(i,t){this._remove(),t&&"building-component"!==t.type&&"subtype-sublayer"!==t.type&&(this._highlightTask=s(async s=>{const o=await this.view.whenLayerView(t);r(s),n(o)&&(this._highlightHandle=o.highlight(i))}))}};i([h({constructOnly:!0})],p.prototype,"view",void 0),i([h({constructOnly:!0})],p.prototype,"analysisViewData",void 0),i([h()],p.prototype,"updating",null),p=i([a("esri.views.2d.analysis.ElevationProfile.ElevationProfileInputVisualization2D")],p);export{p as ElevationProfileInputVisualization2D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import r from"../../../../core/Accessor.js";import{getContrast as o}from"../../../../core/colorUtils.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{throttle as a}from"../../../../core/throttle.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../layers/GraphicsLayer.js";import c from"../../../../symbols/CIMSymbol.js";import{getConfig as m}from"../../../analysis/ElevationProfile/constants.js";import{getInputGeometry as y}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{createLineGeometry as d}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let h=class extends r{constructor(e){super(e),this._graphic=new t,this._layer=new n({listMode:"hide",internal:!0}),this._updateGeometryThrottled=a(e=>{if(!e)return void(this._layer.visible=!1);const t=this.view.map?.layers;t&&!t.includes(this._layer)&&t.add(this._layer),this._layer.visible=!0,this._graphic.geometry=d(e.samples,e.spatialReference)},m().profileLinesUpdateThrottleMillis)}initialize(){this._layer.add(this._graphic),this.addHandles([i(()=>y(this.analysisViewData.analysis.input),()=>{this._layer.visible=!1},s),i(()=>this._colorUpdateParameters,e=>this._updateColor(e),s),i(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),s),this._updateGeometryThrottled])}destroy(){this.view.map?.remove(this._layer),this._layer.destroy(),this._graphic.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){const{results:e,visible:t}=this.analysisViewData;return t?e.find(e=>e.available&&e.computation.profileLine.viewOptions.lineVisible):null}get _geometryUpdateParameters(){const e=this._result;return 1!==e?.progress?null:{samples:e.samples,spatialReference:this.view.spatialReference}}get _colorUpdateParameters(){const e=this._result?.computation.profileLine.color;return e?{color:e.toArray(),contrastColor:o(e).toArray()}:null}_updateColor(e){e&&(this._graphic.symbol=new c({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,10],lineDashEnding:"HalfPattern",controlPointEnding:"HalfPattern"}],capStyle:"Butt",width:1.5,color:e.color},{type:"CIMSolidStroke",capStyle:"Butt",width:2,color:e.contrastColor}]}}}))}};e([l({constructOnly:!0})],h.prototype,"view",void 0),e([l({constructOnly:!0})],h.prototype,"analysisViewData",void 0),e([l()],h.prototype,"updating",null),e([l()],h.prototype,"_result",null),e([l()],h.prototype,"_geometryUpdateParameters",null),e([l()],h.prototype,"_colorUpdateParameters",null),h=e([p("esri.views.2d.analysis.ElevationProfile.ElevationProfileLineVisualization2D")],h);export{h as ElevationProfileLineVisualization2D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as i}from"tslib";import o from"../../../../core/Accessor.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import{ElevationProfileInputVisualization2D as a}from"./ElevationProfileInputVisualization2D.js";import{ElevationProfileLineVisualization2D as e}from"./ElevationProfileLineVisualization2D.js";import{ElevationProfileHoveredPointsVisualization as r}from"../../../analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js";let n=class extends o{constructor(i){super(i)}initialize(){const{view:i,analysisViewData:o}=this;this._hoveredPointsVisualization=new r({view:i,analysisViewData:o}),this._inputVisualization=new a({view:i,analysisViewData:o}),this._lineVisualization=new e({view:i,analysisViewData:o})}destroy(){this._inputVisualization.destroy(),this._hoveredPointsVisualization.destroy(),this._lineVisualization.destroy()}get updating(){return this._hoveredPointsVisualization.updating||this._inputVisualization.updating||this._lineVisualization.updating}};i([t()],n.prototype,"view",void 0),i([t()],n.prototype,"analysisViewData",void 0),i([t()],n.prototype,"updating",null),n=i([s("esri.views.2d.analysis.ElevationProfile.ElevationProfileVisualization2D")],n);export{n as ElevationProfileVisualization2D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Error.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView2D as r}from"./AnalysisView2D.js";import{ElevationProfileVisualization2D as s}from"./ElevationProfile/ElevationProfileVisualization2D.js";import{ElevationProfileController as l}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileGroundLineComputation as n}from"../../analysis/ElevationProfile/ElevationProfileGroundLineComputation.js";import{ElevationProfileInputLineComputation as a}from"../../analysis/ElevationProfile/ElevationProfileInputLineComputation.js";import{ElevationProfileQueryLineComputation as p}from"../../analysis/ElevationProfile/ElevationProfileQueryLineComputation.js";import{ElevationProfileTool as c}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let u=class extends r{constructor(t){super(t),this.type="elevation-profile-view-2d",this.analysis=null,this.hoveredPosition=null}initialize(){const{analysis:t,view:o}=this;this._controller=new l({analysis:t,analysisViewData:this,view:o,computationFactory:{create:t=>{switch(t.profileLine.type){case"ground":return new n(t);case"input":return new a(t);case"query":return new p(t);case"scene":throw new e("elevation-profile-analysis-view-2d:unsupported","The scene profile line type is not supported in 2D views.")}}}}),this._visualization=new s({view:o,analysisViewData:this}),this._sketchTool=new c({view:o,analysisViewData:this})}destroy(){this._controller.destroy(),this._visualization.destroy(),this._sketchTool?.destroy()}get units(){return this._controller.units}get hoveredPoints(){return this._controller.hoveredPoints}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get progress(){return this._controller.progress}get results(){return this._controller.results}get statistics(){return this._controller.statistics}get updating(){return!0===this._controller.updating||!0===this._visualization.updating||!0===this._sketchTool?.updating}get visible(){return super.visible}set visible(t){super.visible=t}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??"idle"}place(t){return this._sketchTool.place(t)}pickGraphic(t){return this._sketchTool.pickGraphic(t)}};t([o({readOnly:!0})],u.prototype,"type",void 0),t([o({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),t([o({readOnly:!0})],u.prototype,"units",null),t([o()],u.prototype,"hoveredPosition",void 0),t([o()],u.prototype,"hoveredPoints",null),t([o({readOnly:!0})],u.prototype,"progress",null),t([o({readOnly:!0})],u.prototype,"results",null),t([o({readOnly:!0})],u.prototype,"statistics",null),t([o({readOnly:!0})],u.prototype,"updating",null),t([o()],u.prototype,"sketchGraphic",null),t([o()],u.prototype,"toolState",null),t([o()],u.prototype,"_controller",void 0),t([o()],u.prototype,"_visualization",void 0),t([o()],u.prototype,"_sketchTool",void 0),u=t([i("esri.views.2d.analysis.ElevationProfileAnalysisView2D")],u);const h=u;export{h as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as i}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as e}from"../../../../core/asyncUtils.js";import{destroyHandle as s,handlesGroup as o}from"../../../../core/handleUtils.js";import{abortMaybe as r,removeMaybe as l}from"../../../../core/maybe.js";import{throwIfAborted as a}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as n}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{getGraphicEffectiveElevationInfo as m}from"../../../../support/elevationInfoUtils.js";import{Settings as p}from"../../interactive/editingTools/settings.js";import{OutlineVisualElement as g}from"../../interactive/visualElements/OutlineVisualElement.js";import{GraphicState as u}from"../../layers/graphics/GraphicState.js";import{getInputGeometry as d,isValidInputPath as v}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{connectVisualization as f}from"../../../analysis/ElevationProfile/elevationProfileInputVisualizationUtils.js";import{highlightsSupported as y}from"../../../support/layerViewUtils.js";let _=class extends t{constructor(i){super(i),this._highlightTask=null,this._highlightHandle=null,this._visualElementHandle=null}initialize(){this._settings=new p({getTheme:()=>this.view.effectiveTheme}),this.addHandles(f({analysisViewData:this.analysisViewData,onRemove:()=>this._remove(),onShowSketchedGraphic:i=>this._showSketchedGraphic(i),onHighlight:(i,t)=>this._highlight(i,t)}))}destroy(){this._remove()}get updating(){return null!=this._highlightTask&&!this._highlightTask.finished}_remove(){this._highlightTask=r(this._highlightTask),this._highlightHandle=l(this._highlightHandle),this._visualElementHandle=l(this._visualElementHandle)}_highlight(i,t){this._remove(),t&&"building-component"!==t.type&&"subtype-sublayer"!==t.type&&(this._highlightTask=e(async e=>{const s=await this.view.whenLayerView(t);a(e),y(s)&&(this._highlightHandle=s.highlight(i))}))}_showSketchedGraphic(i){this._remove();const{view:t}=this,e=new g({view:t,geometry:j(i),attached:!1,elevationInfo:m(i),renderOccluded:8,isDecoration:!0}),r=new u({graphic:i}),l=[h(()=>r.isDraped,i=>{e.isDraped=i}),r.on("changed",()=>{e.geometry=j(i)}),t.trackGraphicState(r),t.maskOccludee(i),s(e)];this._settings.visualElements.lineObjects.outline.apply(e),e.attached=!0,this._visualElementHandle=o(l)}};function j(i){const t=d(i);return v(t)?t:null}i([n({constructOnly:!0})],_.prototype,"view",void 0),i([n({constructOnly:!0})],_.prototype,"analysisViewData",void 0),i([n()],_.prototype,"updating",null),_=i([c("esri.views.3d.analysis.ElevationProfile.ElevationProfileInputVisualization3D")],_);export{_ as ElevationProfileInputVisualization3D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../core/Accessor.js";import{watch as s,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{throttle as r}from"../../../../core/throttle.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as n,fromArray as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{OutlineVisualElement as m}from"../../interactive/visualElements/OutlineVisualElement.js";import{getConfig as u}from"../../../analysis/ElevationProfile/constants.js";import{getInputGeometry as c}from"../../../analysis/ElevationProfile/elevationProfileGeometryUtils.js";import{createLineGeometry as f}from"../../../analysis/ElevationProfile/elevationProfileVisualizationUtils.js";let v=class extends i{constructor(e){super(e),this._updateGeometryThrottled=r(e=>{e&&(this._visualElement.visible=!0,this._visualElement.geometry=f(e.samples,e.spatialReference))},u().profileLinesUpdateThrottleMillis)}initialize(){this._visualElement=new m({view:this.view,elevationInfo:{mode:"absolute-height",offset:0},innerWidth:0,innerColor:n(0,0,0,0),width:3,falloff:0,renderOccluded:16,isDecoration:!0}),this.addHandles([s(()=>({color:this.getResult()?.computation.profileLine.color,visible:this._effectiveVisible}),({color:e,visible:i})=>{e&&(this._visualElement.color=p(t.toUnitRGBA(e))),this._visualElement.visible=i,i||(this._visualElement.geometry=null)},o),s(()=>c(this.analysisViewData.analysis.input),()=>{this._visualElement.visible=!1,this._visualElement.geometry=null},o),s(()=>this._geometryUpdateParameters,e=>this._updateGeometryThrottled(e),o),this._updateGeometryThrottled])}destroy(){this._visualElement.destroy()}get updating(){return this._updateGeometryThrottled.hasPendingUpdates()}get _result(){return this.getResult()}get _effectiveVisible(){const{analysisViewData:e,_result:t}=this;return e.visible&&null!=t&&t.available&&t.computation.profileLine.viewOptions.lineVisible}get _geometryUpdateParameters(){if(!this._effectiveVisible)return null;const e=this._result;return 1!==e?.progress?null:{samples:e.samples,spatialReference:this.view.spatialReference}}};e([l()],v.prototype,"view",void 0),e([l()],v.prototype,"analysisViewData",void 0),e([l()],v.prototype,"getResult",void 0),e([l()],v.prototype,"updating",null),e([l()],v.prototype,"_result",null),e([l()],v.prototype,"_effectiveVisible",null),e([l()],v.prototype,"_geometryUpdateParameters",null),v=e([a("esri.views.3d.analysis.ElevationProfile.ElevationProfileLineVisualization3D")],v);export{v as ElevationProfileLineVisualization3D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as i}from"tslib";import o from"../../../../core/Accessor.js";import{mapCollection as t}from"../../../../core/mapCollectionUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{ElevationProfileInputVisualization3D as e}from"./ElevationProfileInputVisualization3D.js";import{ElevationProfileLineVisualization3D as r}from"./ElevationProfileLineVisualization3D.js";import{ElevationProfileHoveredPointsVisualization as n}from"../../../analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js";let l=class extends o{constructor(i){super(i)}initialize(){const{view:i,analysisViewData:o}=this;this._hoveredPointsVisualization=new n({view:i,analysisViewData:o}),this._inputVisualization=new e({view:i,analysisViewData:o}),this._lineVisualizations=t(()=>this.analysisViewData.analysis.profiles,t=>new r({view:i,analysisViewData:o,getResult:()=>o.results.find(i=>i.computation.profileLine===t)}))}destroy(){this._inputVisualization.destroy(),this._hoveredPointsVisualization.destroy(),this._lineVisualizations.destroy()}get updating(){return this._inputVisualization.updating||this._lineVisualizations.some(i=>i.updating)}};i([s()],l.prototype,"view",void 0),i([s()],l.prototype,"analysisViewData",void 0),i([s()],l.prototype,"updating",null),l=i([a("esri.views.3d.analysis.ElevationProfile.ElevationProfileVisualization3D")],l);export{l as ElevationProfileVisualization3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as i}from"./AnalysisView3D.js";import{ElevationProfileSceneLineComputation as r}from"./ElevationProfile/ElevationProfileSceneLineComputation.js";import{
|
|
5
|
+
import{__decorate as t}from"tslib";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{AnalysisView3D as i}from"./AnalysisView3D.js";import{ElevationProfileSceneLineComputation as r}from"./ElevationProfile/ElevationProfileSceneLineComputation.js";import{ElevationProfileVisualization3D as s}from"./ElevationProfile/ElevationProfileVisualization3D.js";import{ElevationProfileController as l}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileGroundLineComputation as n}from"../../analysis/ElevationProfile/ElevationProfileGroundLineComputation.js";import{ElevationProfileInputLineComputation as a}from"../../analysis/ElevationProfile/ElevationProfileInputLineComputation.js";import{ElevationProfileQueryLineComputation as p}from"../../analysis/ElevationProfile/ElevationProfileQueryLineComputation.js";import{ElevationProfileTool as c}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let u=class extends i{constructor(t){super(t),this.type="elevation-profile-view-3d",this.analysis=null,this.hoveredPosition=null}initialize(){const{analysis:t,view:e}=this;this._controller=new l({analysis:t,analysisViewData:this,view:e,computationFactory:{create:t=>{switch(t.profileLine.type){case"ground":return new n(t);case"input":return new a(t);case"query":return new p(t);case"scene":return new r(t)}}}}),this._visualization=new s({view:e,analysisViewData:this}),this._sketchTool=new c({view:e,analysisViewData:this})}destroy(){this._controller.destroy(),this._visualization.destroy(),this._sketchTool?.destroy()}get units(){return this._controller.units}get hoveredPoints(){return this._controller.hoveredPoints}get interactive(){return super.interactive}set interactive(t){super.interactive=t}get progress(){return this._controller.progress}get results(){return this._controller.results}get statistics(){return this._controller.statistics}get updating(){return!0===this._controller.updating||!0===this._visualization.updating||!0===this._sketchTool?.updating}get visible(){return super.visible}set visible(t){super.visible=t}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??"idle"}place(t){return this._sketchTool.place(t)}pickGraphic(t){return this._sketchTool.pickGraphic(t)}};t([e({readOnly:!0})],u.prototype,"type",void 0),t([e({constructOnly:!0,nonNullable:!0})],u.prototype,"analysis",void 0),t([e({readOnly:!0})],u.prototype,"units",null),t([e()],u.prototype,"hoveredPosition",void 0),t([e()],u.prototype,"hoveredPoints",null),t([e({readOnly:!0})],u.prototype,"progress",null),t([e({readOnly:!0})],u.prototype,"results",null),t([e({readOnly:!0})],u.prototype,"statistics",null),t([e({readOnly:!0})],u.prototype,"updating",null),t([e()],u.prototype,"sketchGraphic",null),t([e()],u.prototype,"toolState",null),t([e()],u.prototype,"_controller",void 0),t([e()],u.prototype,"_visualization",void 0),t([e()],u.prototype,"_sketchTool",void 0),u=t([o("esri.views.3d.analysis.ElevationProfileAnalysisView3D")],u);const h=u;export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as
|
|
5
|
+
import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{equals as r}from"../../../../core/arrayUtils.js";import{equalsMaybe as s}from"../../../../core/maybe.js";import{property as e}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{G as c}from"../../../../chunks/vec32.js";import{equals as n}from"../../../../geometry/support/ray.js";let p=class extends o{constructor(t){super(t)}clone(){return this}equals(t){return this.context?.type===t.context?.type&&(!this.context||!t.context||this.context.equals(t.context))&&this.id===t.id&&s(this.mapPoint,t.mapPoint)&&c(this.renderPoint,t.renderPoint)&&r(this.normal,t.normal)&&n(this.ray,t.ray)}};t([e({constructOnly:!0})],p.prototype,"context",void 0),t([e({constructOnly:!0})],p.prototype,"id",void 0),t([e({constructOnly:!0})],p.prototype,"mapPoint",void 0),t([e({constructOnly:!0})],p.prototype,"renderPoint",void 0),t([e({constructOnly:!0})],p.prototype,"normal",void 0),t([e({constructOnly:!0})],p.prototype,"ray",void 0),p=t([i("esri.views.3d.analysis.LineOfSight.LineOfSightIntersectionResult")],p);class a{constructor(t){this.graphic=t,this.type="graphic"}equals(t){return t.type===this.type&&this.graphic===t.graphic}}class y{constructor(){this.type="ground"}equals(t){return t.type===this.type}}const u=new y;export{a as LineOfSightIntersectionContextGraphic,p as LineOfSightIntersectionResult,u as lineOfSightIntersectionContextGround};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{screenPointObjectToArray as r}from"../../../../core/screenUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as i,n as s,g as a,f as c}from"../../../../chunks/vec32.js";import{create as l,clone as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import p from"../../../../geometry/Point.js";import{create as u,copy as d,fromPoints as f}from"../../../../geometry/support/ray.js";import{sv2d as g}from"../../../../geometry/support/vectorStacks.js";import{LineOfSightIntersectionResult as y,lineOfSightIntersectionContextGround as w,LineOfSightIntersectionContextGraphic as h}from"./LineOfSightIntersectionResult.js";import{fromScreen as j}from"../../support/geometryUtils/ray.js";import{isTerrainIntersectorResult as v,isIntegratedMeshIntersectorResult as I}from"../../terrain/Intersector.js";import{Intersector as P}from"../../webgl-engine/lib/Intersector.js";import{toGraphic as b}from"../../webgl-engine/lib/intersectorUtilsConversions.js";let x=class extends t{constructor(e){super(e),this._terrainIntersectionOptionsLayerUids=new Set(["terrain"])}initialize(){this.intersector=new P(this.view.state.viewingMode),this.intersector.options.hud=!1,this.intersector.options.store=0}getScreenPointIntersection(e){const t=r(e,g.get()),o=j(this.view.state.camera,t,O);return this._getRayIntersection(o)}_getRayIntersection(e,t){const{view:r,intersector:o}=this;if(null==e||null==r.sceneIntersectionHelper)return null;o.options.store=0,r.sceneIntersectionHelper.intersectToolIntersectorRay(e,o,t);const n=o.results.min;if(null==n.target)return null;const i=l();if(!n.getIntersectionPoint(i))return null;if(null!=t?.maxDistance&&!n.withinDistance(t.maxDistance))return null;const s=r.renderCoordsHelper.fromRenderCoords(i,new p({spatialReference:r.spatialReference})),a=m(n.normal);if(v(n))return new y({context:w,id:n.target.lij.slice(),mapPoint:s,renderPoint:i,normal:a,ray:d(e)});if(I(r,n))return new y({context:w,id:`${n.target.layerViewUid}`,mapPoint:s,renderPoint:i,normal:a,ray:d(e)});const c=b(n,r);if(null!=c){const{layer:t}=c,r=c.getObjectId()??c.uid;return new y({context:new h(c),id:`${t?.uid}/${r}`,mapPoint:s,renderPoint:i,normal:a,ray:d(e)})}const u="layerViewUid"in n.target?`${n.target.layerViewUid}`:"";return new y({context:null,id:u,mapPoint:s,renderPoint:i,normal:a,ray:d(e)})}updateFromGroundIntersection(e,t,r){const o=R,n=U,l=S,p=L;i(n,e),this.view.renderCoordsHelper.worldUpAtPosition(n,l),s(l,l);const u=this.view.basemapTerrain.visibleElevationBounds,d=(t>=0?1:-1)*((u?Math.abs(u.max-u.min):100)+Math.abs(t));a(p,l,d),c(o,n,p),f(o,n,O);const g=this._getRayIntersection(O,{include:this._terrainIntersectionOptionsLayerUids,maxDistance:d});if(null!=g){const e=L;return a(e,l,t),c(r,g.renderPoint,e),m(g.normal)}return i(r,e),null}};e([o()],x.prototype,"view",void 0),e([o()],x.prototype,"intersector",void 0),x=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightRayIntersector")],x);const R=l(),U=l(),S=l(),L=l(),O=u();export{x as LineOfSightRayIntersector};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../analysis/LineOfSightAnalysisObserver.js";import a from"../../../../analysis/LineOfSightAnalysisTarget.js";import n from"../../../../core/Handles.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{when as o,syncAndInitial as l,initial as u}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as p,fromPoints as g}from"../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as _,getConvertedElevation as m}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{getLaserLineColors as b,laserLineConfiguration as y}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as f,LineOfSightObserverManipulator as T}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{LaserlineVisualElement as M}from"../../interactive/visualElements/LaserlineVisualElement.js";import{MouseButton as w}from"../../../input/IViewEvents.js";import{AnalysisToolBase as C}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as H}from"../../../support/screenUtils.js";let V=class extends C{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new n,this._updatingHandles=new d,this._manipulatorHandles=new n,this._targetTrackerManipulator=null}initialize(){this._intersector=new L({view:this.view}),this.addHandles(o(()=>"created"===this.state,()=>this.finishToolCreation(),l)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),u),this._updatingHandles.add(()=>b(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),u),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),u),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},u)])}destroy(){this._updatingHandles=s(this._updatingHandles),this._manipulatorHandles=s(this._manipulatorHandles),this._analysisHandles=s(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return null!=this.analysisViewData&&this.analysisViewData.updating||this._updatingHandles.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const i of t)this._disconnectComputation(i);for(const i of e)this._connectComputation(i)}_connectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&i.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>I(e),()=>O(i,e),u),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,i),u)],e)}_disconnectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this.analysisViewData.cursorTarget=s(this.analysisViewData.cursorTarget)}_createTargetManipulator(e){const t={target:e,type:"target"},i=new f(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(i),i.events.on("grab-changed",e=>this._manipulatorGrabChanged(i,e)),i.events.on("immediate-click",e=>this._manipulatorClick(i,e))],i),this.manipulators.add(i),null!=e.position?i.elevationAlignedLocation=e.position:i.available=!1,i}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(i=>{const a=i.manipulator;null==t&&"target"===a.metadata.type&&a.metadata.target===e&&(t=a)}),t}_createObserverManipulator(){const e=new T(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return null==t?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return k(e,(t,i,a)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),a.next(P(e.metadata.target)).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return k(e,(e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),i.next(this._cancelObserverDragStep()).next(()=>this._updateLaserLineRenderer())})}_updateObserverDragStep(){return e=>(null!=e.intersection.mapPoint?(null==this.analysis.observer&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.mapPoint;return null!=i&&(e.elevationAlignedLocation=i),t}}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:i,shouldRenderTracker:a,observerPosition:n,visible:r}=e;if(null==t)return;const s=null!=i?i:a&&null!=n?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=g(this._observerManipulator.renderLocation,s.renderLocation,D):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=y;this._laserlineVisualElement=new M({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,i,a){const n=this._laserlineVisualElement;if(null==n)return;const r=n.style;n.style={...r,glowColor:t.toUnitRGB(e),innerColor:t.toUnitRGB(i),globalAlpha:a}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(null!=t?.mapPoint)if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new a;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&e.button!==w.Right&&(this._addPointFromClickEvent(H(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==w.Right&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||null==this.analysis.observer?.position)return;const t=H(e),i=this._intersector.getScreenPointIntersection(t);null!=i?.mapPoint&&(null==this.analysisViewData.cursorTarget&&(this.analysisViewData.cursorTarget=new a),this._updateFromIntersection(this.analysisViewData.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(null==t.mapPoint)return e.position=null,e.elevationInfo=null,void(e.feature=null);switch(t.type){case 0:if(null!=t.graphic){const i=t.graphic,a=_(i);"on-the-ground"===a.mode&&(a.mode="relative-to-ground",a.offset=0),e.elevationInfo=new v(a),e.feature=i}else e.elevationInfo=null,e.feature=null;break;case 2:e.elevationInfo=new v({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}const i=t.mapPoint.clone();i.z=m(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||t.button!==w.Right||this.analysis.targets.length<=1)return;const{target:i}=e.metadata;this.analysis.targets.remove(i),t.stopPropagation()}get testInfo(){}};function P(e){const t=e.position?.clone();return i=>(e.position=t,i)}function O(e,t){const{isValid:i,isTargetVisible:a}=t.computationResult;e.state=i?a?16:32:64}function I(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}e([h({constructOnly:!0})],V.prototype,"view",void 0),e([h({constructOnly:!0})],V.prototype,"analysis",void 0),e([h()],V.prototype,"_creationMode",void 0),e([h({readOnly:!0})],V.prototype,"state",null),e([h({readOnly:!0})],V.prototype,"cursor",null),e([h()],V.prototype,"removeIncompleteOnCancel",void 0),e([h({readOnly:!0})],V.prototype,"updating",null),e([h({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([h({readOnly:!0})],V.prototype,"_showTracker",null),e([h()],V.prototype,"_latestPointerMovePointerType",void 0),e([h()],V.prototype,"_shouldRenderTracker",null),e([h()],V.prototype,"_laserlineVisualElement",void 0),e([h()],V.prototype,"_grabbedManipulator",void 0),V=e([c("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],V);const D=p();export{V as LineOfSightTool};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Color.js";import i from"../../../../analysis/LineOfSightAnalysisObserver.js";import a from"../../../../analysis/LineOfSightAnalysisTarget.js";import n from"../../../../core/Handles.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{when as o,syncAndInitial as l,initial as u}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../../../core/support/UpdatingHandles.js";import{create as p,fromPoints as g}from"../../../../geometry/support/lineSegment.js";import{getGraphicEffectiveElevationInfo as _,getConvertedElevation as m}from"../../../../support/elevationInfoUtils.js";import v from"../../../../symbols/support/ElevationInfo.js";import{getLaserLineColors as b,laserLineConfiguration as y}from"./LineOfSightConfiguration.js";import{LineOfSightTargetManipulator as f,LineOfSightObserverManipulator as T}from"./LineOfSightManipulators.js";import{LineOfSightRayIntersector as L}from"./LineOfSightRayIntersector.js";import{LaserlineVisualElement as M}from"../../interactive/visualElements/LaserlineVisualElement.js";import{MouseButton as w}from"../../../input/IViewEvents.js";import{AnalysisToolBase as C}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as H}from"../../../support/screenUtils.js";let V=class extends C{constructor(e){super(e),this._creationMode=!1,this.removeIncompleteOnCancel=!1,this.analysisViewData=null,this._latestPointerMovePointerType=null,this._laserlineVisualElement=null,this._grabbedManipulator=null,this._analysisHandles=new n,this._updatingHandles=new d,this._manipulatorHandles=new n,this._targetTrackerManipulator=null}initialize(){this._intersector=new L({view:this.view}),this.addHandles(o(()=>"created"===this.state,()=>this.finishToolCreation(),l)),this._observerManipulator=this._createObserverManipulator(),this._createLaserLine(),this.addHandles([this._updatingHandles.add(()=>this.analysisViewData?.elevationAlignedObserver,e=>this._onObserverLocationChange(e),u),this._updatingHandles.add(()=>b(this.view.effectiveTheme),({glowColor:e,innerColor:t,globalAlpha:i})=>this._updateLaserLineStyle(e,t,i),u),this._updatingHandles.add(()=>this._laserLineRendererDependencies(),e=>this._updateLaserLineRenderer(e)),this._connectComputations(),this._updatingHandles.addWhen(()=>!this._shouldRenderTracker,()=>this._clearCursorTracker(),u),this._updatingHandles.add(()=>({active:this.active,hasGrabbedManipulators:this.hasGrabbedManipulators}),({active:e,hasGrabbedManipulators:t})=>{this._creationMode=!!e&&(this._creationMode||!t)},u)])}destroy(){this._updatingHandles=s(this._updatingHandles),this._manipulatorHandles=s(this._manipulatorHandles),this._analysisHandles=s(this._analysisHandles),this._observerManipulator=null,this._clearCursorTracker(),this._removeLaserLine(),this._intersector=null,this._set("analysis",null)}get state(){return this.active?!this.hasGrabbedManipulators||this._creationMode?"creating":"created":null!=this.analysis.observer?.position?"created":"ready"}get cursor(){return this.active&&this._showTracker?"crosshair":null}get updating(){return null!=this.analysisViewData&&this.analysisViewData.updating||this._updatingHandles.updating}get _showTracker(){return this.active&&"mouse"===this._latestPointerMovePointerType}get _shouldRenderTracker(){return this._showTracker&&null!=this.analysis.observer?.position&&!this.hasGrabbedManipulators}continue(){this.view.activeTool=this}stop(){this.view.activeTool=null}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}onInputEvent(e){switch(e.type){case"immediate-double-click":this._doubleClickHandler(e);break;case"pointer-move":this._pointerMoveHandler(e)}}onInputEventAfter(e){if("immediate-click"===e.type)this._clickHandler(e)}onShow(){}onHide(){}onDeactivate(){this._clearCursorTracker()}_connectComputations(){return this._updatingHandles.addOnCollectionChange(()=>this.analysisViewData.computations,e=>this._onComputationsCollectionChange(e),{initial:!0,final:!0})}_onComputationsCollectionChange({added:e,removed:t}){for(const i of t)this._disconnectComputation(i);for(const i of e)this._connectComputation(i)}_connectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to connect an analysis to a destroyed LineOfSight tool. Ignoring.");const t=this._analysisHandles;if(t.has(e))return;const i=this._createTargetManipulator(e.target);null==this._targetTrackerManipulator&&i.metadata.target===this.analysisViewData.cursorTarget&&(this._targetTrackerManipulator=i,this._targetTrackerManipulator.available=!1,this._targetTrackerManipulator.interactive=!1,this._updateLaserLineRenderer()),t.add([this._updatingHandles.add(()=>D(e),()=>O(i,e),u),this._updatingHandles.add(()=>e.elevationAlignedTargetLocation,e=>this._onTargetLocationChange(e,i),u)],e)}_disconnectComputation(e){if(this.destroyed)return void r.getLogger(this).warn("Attempting to disconnect an analysis from a destroyed LineOfSight tool. Ignoring.");this._analysisHandles.remove(e);const t=this._getTargetManipulator(e.target);null!=t&&(this.manipulators.remove(t),this._manipulatorHandles.remove(t),null!=this._targetTrackerManipulator&&this._targetTrackerManipulator===t&&(this._targetTrackerManipulator=null))}_clearCursorTracker(){this.analysisViewData.cursorTarget=s(this.analysisViewData.cursorTarget)}_createTargetManipulator(e){const t={target:e,type:"target"},i=new f(this.view,t);return this._manipulatorHandles.add([this._createTargetManipulatorDragPipeline(i),i.events.on("grab-changed",e=>this._manipulatorGrabChanged(i,e)),i.events.on("immediate-click",e=>this._manipulatorClick(i,e))],i),this.manipulators.add(i),null!=e.position?i.elevationAlignedLocation=e.position:i.available=!1,i}_getTargetManipulator(e){let t=null;return this.manipulators.forEach(i=>{const a=i.manipulator;null==t&&"target"===a.metadata.type&&a.metadata.target===e&&(t=a)}),t}_createObserverManipulator(){const e=new T(this.view,{type:"observer",intersection:null});return this._manipulatorHandles.add([this._createObserverManipulatorDragPipeline(e),e.events.on("grab-changed",t=>this._manipulatorGrabChanged(e,t)),e.events.on("immediate-click",t=>this._manipulatorClick(e,t))],e),this.manipulators.add(e),e}_screenToIntersection(){return e=>{const t=this._intersector.getScreenPointIntersection(e.screenEnd);return null==t?null:{...e,intersection:t}}}_createTargetManipulatorDragPipeline(e){return k(e,(t,i,a)=>{i.next(this._screenToIntersection()).next(this._updateTargetDragStep(e)).next(()=>this._updateLaserLineRenderer()),a.next(P(e.metadata.target)).next(()=>this._updateLaserLineRenderer())})}_createObserverManipulatorDragPipeline(e){return k(e,(e,t,i)=>{t.next(this._screenToIntersection()).next(this._updateObserverDragStep()).next(()=>this._updateLaserLineRenderer()),i.next(this._cancelObserverDragStep()).next(()=>this._updateLaserLineRenderer())})}_updateObserverDragStep(){return e=>(null!=e.intersection.mapPoint?(null==this.analysis.observer&&(this.analysis.observer=new i),this._updateFromIntersection(this.analysis.observer,e.intersection)):this.analysis.observer=null,e)}_cancelObserverDragStep(){const e=null!=this.analysis.observer?.position?this.analysis.observer.clone():null;return t=>(this.analysis.observer=e,t)}_updateTargetDragStep(e){return t=>{this._updateFromIntersection(e.metadata.target,t.intersection);const i=t.intersection.mapPoint;return null!=i&&(e.elevationAlignedLocation=i),t}}_manipulatorGrabChanged(e,t){switch(t.action){case"start":this._grabbedManipulator=e;break;case"end":this._grabbedManipulator===e&&(this._grabbedManipulator=null)}}_laserLineRendererDependencies(){return{laserlineVisualElement:this._laserlineVisualElement,grabbedManipulator:this._grabbedManipulator,shouldRenderTracker:this._shouldRenderTracker,observerPosition:null!=this.analysis.observer?this.analysis.observer.position:null,visible:this.visible}}_updateLaserLineRenderer(e=this._laserLineRendererDependencies()){const{laserlineVisualElement:t,grabbedManipulator:i,shouldRenderTracker:a,observerPosition:n,visible:r}=e;if(null==t)return;const s=null!=i?i:a&&null!=n?this._targetTrackerManipulator:null;null!=s&&r?(t.visible=!0,t.heightManifoldTarget=s.renderLocation,s!==this._observerManipulator?t.lineVerticalPlaneSegment=g(this._observerManipulator.renderLocation,s.renderLocation,I):t.lineVerticalPlaneSegment=null):(t.visible=!1,t.heightManifoldTarget=null,t.lineVerticalPlaneSegment=null)}_createLaserLine(){this._removeLaserLine();const{glowWidth:e,innerWidth:t}=y;this._laserlineVisualElement=new M({view:this.view,attached:!0,visible:this.visible,style:{glowWidth:e,innerWidth:t},isDecoration:!0})}_removeLaserLine(){null!=this._laserlineVisualElement&&(this._laserlineVisualElement.destroy(),this._laserlineVisualElement=null)}_updateLaserLineStyle(e,i,a){const n=this._laserlineVisualElement;if(null==n)return;const r=n.style;n.style={...r,glowColor:t.toUnitRGB(e),innerColor:t.toUnitRGB(i),globalAlpha:a}}_onObserverLocationChange(e){null!=e?(this._observerManipulator.metadata.intersection=null,this._observerManipulator.available=!0,this._observerManipulator.elevationAlignedLocation=e):this._observerManipulator.available=!1}_onTargetLocationChange(e,t){null!=e?(t.elevationAlignedLocation=e,t!==this._targetTrackerManipulator&&(t.available=!0)):t.available=!1}_addPointFromClickEvent(e){const t=this._intersector.getScreenPointIntersection(e);if(null!=t?.mapPoint)if(null!=this.analysis.observer?.position){this._clearCursorTracker();const e=new a;this._updateFromIntersection(e,t),this.analysis.targets.add(e)}else{const e=new i;this._updateFromIntersection(e,t),this.analysis.observer=e}}_clickHandler(e){this.active&&e.button!==w.Right&&(this._addPointFromClickEvent(H(e)),e.stopPropagation())}_doubleClickHandler(e){this.active&&e.button!==w.Right&&(this.stop(),e.stopPropagation())}_pointerMoveHandler(e){if(this.hasGrabbedManipulators)return;if(this._latestPointerMovePointerType=e.pointerType,this._updateLaserLineRenderer(),!this._showTracker||null==this.analysis.observer?.position)return;const t=H(e),i=this._intersector.getScreenPointIntersection(t);null!=i?.mapPoint&&(null==this.analysisViewData.cursorTarget&&(this.analysisViewData.cursorTarget=new a),this._updateFromIntersection(this.analysisViewData.cursorTarget,i),this._updateLaserLineRenderer())}_updateFromIntersection(e,t){if(null==t.mapPoint)return e.position=null,e.elevationInfo=null,void(e.feature=null);switch(t.context?.type){case"graphic":{const i=t.context.graphic,a=_(i);"on-the-ground"===a.mode&&(a.mode="relative-to-ground",a.offset=0),e.elevationInfo=new v(a),e.feature=i}break;case"ground":e.elevationInfo=new v({mode:"on-the-ground"}),e.feature=null;break;default:e.elevationInfo=null,e.feature=null}const i=t.mapPoint.clone();i.z=m(this.view,i,{mode:"absolute-height",offset:0},e.elevationInfo),e.position=i}_manipulatorClick(e,t){if("observer"===e.metadata.type||e.grabbing||e.dragging||t.button!==w.Right||this.analysis.targets.length<=1)return;const{target:i}=e.metadata;this.analysis.targets.remove(i),t.stopPropagation()}get testInfo(){}};function P(e){const t=e.position?.clone();return i=>(e.position=t,i)}function O(e,t){const{isValid:i,isTargetVisible:a}=t.computationResult;e.state=i?a?16:32:64}function D(e){const{isValid:t,isTargetVisible:i}=e.computationResult;return{isValid:t,isTargetVisible:i}}e([c({constructOnly:!0})],V.prototype,"view",void 0),e([c({constructOnly:!0})],V.prototype,"analysis",void 0),e([c()],V.prototype,"_creationMode",void 0),e([c({readOnly:!0})],V.prototype,"state",null),e([c({readOnly:!0})],V.prototype,"cursor",null),e([c()],V.prototype,"removeIncompleteOnCancel",void 0),e([c({readOnly:!0})],V.prototype,"updating",null),e([c({constructOnly:!0})],V.prototype,"analysisViewData",void 0),e([c({readOnly:!0})],V.prototype,"_showTracker",null),e([c()],V.prototype,"_latestPointerMovePointerType",void 0),e([c()],V.prototype,"_shouldRenderTracker",null),e([c()],V.prototype,"_laserlineVisualElement",void 0),e([c()],V.prototype,"_grabbedManipulator",void 0),V=e([h("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],V);const I=p();export{V as LineOfSightTool};
|