@arcgis/core 5.1.0-next.134 → 5.1.0-next.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/073ee52705ea326fecfb.js +1 -0
- package/assets/esri/core/workers/chunks/{282930645ce525d5bc92.js → 0e81b6aa64d5491870b2.js} +1 -1
- package/assets/esri/core/workers/chunks/11d1af758e2140095b10.js +1 -0
- package/assets/esri/core/workers/chunks/{81cd819c236066dc1654.js → 2ed81f1e490cb7e73405.js} +1 -1
- package/assets/esri/core/workers/chunks/2ef80e003b4f0393ac2e.js +1 -0
- package/assets/esri/core/workers/chunks/{ef8bb03a67004dd8959a.js → 312676c9027684a08107.js} +1 -1
- package/assets/esri/core/workers/chunks/31c4128b23968575feca.js +1 -0
- package/assets/esri/core/workers/chunks/{4517630bf869205bab87.js → 38a76bc4ef5c10ab0488.js} +1 -1
- package/assets/esri/core/workers/chunks/3a526e1d18490b99332f.js +1 -0
- package/assets/esri/core/workers/chunks/3e89f487c5851c954d8b.js +1 -0
- package/assets/esri/core/workers/chunks/{268243ee64d001009f78.js → 3ebe99f512c34cc93fe9.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1851278e993b7130cd5.js → 3f454b3d6424e206755f.js} +1 -1
- package/assets/esri/core/workers/chunks/44c38c10489e11ff5d8e.js +1 -0
- package/assets/esri/core/workers/chunks/{2f5970e87e1e77f8362b.js → 45922ec95c7fb704bae1.js} +1 -1
- package/assets/esri/core/workers/chunks/5468a65698931603656d.js +1 -0
- package/assets/esri/core/workers/chunks/{8bd5abb68a546d1e0525.js → 5b83893a58529ef5f08b.js} +1 -1
- package/assets/esri/core/workers/chunks/5d710b3e50f2211a765d.js +1 -0
- package/assets/esri/core/workers/chunks/5f0bc019add4aff3130c.js +1 -0
- package/assets/esri/core/workers/chunks/6121cd0264b6841a5bac.js +1 -0
- package/assets/esri/core/workers/chunks/{dfb19701b488089874fd.js → 6649acaceab00ad30e7f.js} +1 -1
- package/assets/esri/core/workers/chunks/6849282c4a5cd733779d.js +1 -0
- package/assets/esri/core/workers/chunks/{35e9635784595b1d6635.js → 7197972041f5700c235d.js} +1 -1
- package/assets/esri/core/workers/chunks/{317bf48a4d513a9a2ff3.js → 786905f34da9cdad53f0.js} +2 -2
- package/assets/esri/core/workers/chunks/{169bfafec4d59be2beb0.js → 790462ab5f21491a4f75.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8ef7acb6d3d1f45e14c.js → 87011d2fe14c54e296af.js} +1 -1
- package/assets/esri/core/workers/chunks/{851fc5290497991ba001.js → 88df19742edb0cdc3e67.js} +1 -1
- package/assets/esri/core/workers/chunks/{7361ca78a605eda41a2f.js → 897a856c00b2b828efe9.js} +2 -2
- package/assets/esri/core/workers/chunks/8a88146de5b12fd4dcd8.js +1 -0
- package/assets/esri/core/workers/chunks/{9b914d04c228b02fde2d.js → 934cd06318b69f37d72b.js} +1 -1
- package/assets/esri/core/workers/chunks/93b40245378ced43ca08.js +1 -0
- package/assets/esri/core/workers/chunks/98dfe31e8ed9b522eaff.js +1 -0
- package/assets/esri/core/workers/chunks/{35c4037b8eea067d9638.js → 98f64d9ca6f2a76cf916.js} +7 -7
- package/assets/esri/core/workers/chunks/9ad36947bb42ed7f97d3.js +1 -0
- package/assets/esri/core/workers/chunks/{530cf0964d55410ffb56.js → 9bcebaf0d0e43db0b07f.js} +2 -2
- package/assets/esri/core/workers/chunks/{91c0de3950991d81b7f2.js → 9de673a04c70bd47047e.js} +1 -1
- package/assets/esri/core/workers/chunks/9e0ea6c34940b1acf3c6.js +1 -0
- package/assets/esri/core/workers/chunks/a195f569eada3a8736be.js +1 -0
- package/assets/esri/core/workers/chunks/{ac7ecd90330090c90005.js → a40ede4d3375184f21fe.js} +1 -1
- package/assets/esri/core/workers/chunks/a533d066cac26124c5ce.js +1 -0
- package/assets/esri/core/workers/chunks/a536904fe6f3b16fdbdc.js +1 -0
- package/assets/esri/core/workers/chunks/a8167ab9fd846d699be5.js +1 -0
- package/assets/esri/core/workers/chunks/{b4eb102f35315bfd6966.js → a856ae928273f9d6792f.js} +1 -1
- package/assets/esri/core/workers/chunks/aec46ec486912dca549d.js +1 -0
- package/assets/esri/core/workers/chunks/b0e4af49fc968b0a910f.js +1 -0
- package/assets/esri/core/workers/chunks/{77d896325dffe574d248.js → b3be96d5f3f6b4342907.js} +1 -1
- package/assets/esri/core/workers/chunks/b466af9019f10420115e.js +1 -0
- package/assets/esri/core/workers/chunks/bf9eca7dd107bdb06614.js +1 -0
- package/assets/esri/core/workers/chunks/c0528b4590e083e2c1ff.js +1 -0
- package/assets/esri/core/workers/chunks/c9b212fe844ab918127f.js +1 -0
- package/assets/esri/core/workers/chunks/cbe8adc100582e746a8c.js +1 -0
- package/assets/esri/core/workers/chunks/d2387906b52624b4f7f1.js +1 -0
- package/assets/esri/core/workers/chunks/{a1509e2e7809b6754b4f.js → d523af1db620b5381c99.js} +1 -1
- package/assets/esri/core/workers/chunks/d670e134348954ce465d.js +1 -0
- package/assets/esri/core/workers/chunks/d8329c2000c0cc597adc.js +1 -0
- package/assets/esri/core/workers/chunks/dee339774131d7274137.js +1 -0
- package/assets/esri/core/workers/chunks/e006d1c26ae234f5b086.js +1 -0
- package/assets/esri/core/workers/chunks/{e5b57c43b5e0b1d5ccdd.js → f170d80c5930db1d630e.js} +2 -2
- package/assets/esri/core/workers/chunks/{2d7a4b669804d0c5029b.js → f1ff33584680d8718400.js} +1 -1
- package/assets/esri/core/workers/chunks/{c538435216d253f7702e.js → f23351a04643c464be84.js} +1 -1
- package/assets/esri/core/workers/chunks/f3d331da3c61af5c5a2f.js +1 -0
- package/assets/esri/core/workers/chunks/{68b77b36daae2b4b4237.js → f3fe865506fd7428eb6d.js} +1 -1
- package/assets/esri/core/workers/chunks/{0418b5c9d06f3585c035.js → f6987cacbc55a68ec7ef.js} +2 -2
- package/assets/esri/core/workers/chunks/{95b34718081a71bf0681.js → feacdcf0ba9ea58f1616.js} +1 -1
- package/assets/esri/core/workers/chunks/{da7f85916ae799950317.js → fee50ab6c92ef0327255.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/OITBlendEmission.glsl.js +2 -21
- package/chunks/bundle2.js +1 -1
- package/config.js +1 -1
- package/geometry/support/geometryUtils.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +46 -3
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +39 -0
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/DimensionLayer.d.ts +1 -0
- package/layers/FeatureLayer.js +1 -1
- package/layers/GaussianSplatLayer.d.ts +1 -2
- package/layers/IntegratedMesh3DTilesLayer.d.ts +9 -1
- package/layers/ParquetLayer.d.ts +6 -10
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/graphics/data/queryValidationUtils.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/support/AnnotationFeatureSublayer.d.ts +5 -3
- package/layers/support/SymbolLayerDrawing.js +1 -1
- package/layers/support/arcgisLayers.js +1 -1
- package/layers/support/fetchService.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +2 -2
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/loadUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/portal/support/resourceUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/SimpleMarkerSymbol.d.ts +2 -2
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/views/2d/engine/transitions/FadeTransition.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/TileCpuState.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/AnnotationLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/DimensionLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlendEmission.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/oitBlendFragment.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/View2D.d.ts +2 -2
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.d.ts +6 -6
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/MergeFeaturesWorkflow.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/support/attachmentUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/OrientedImageryVideoViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/VideoEnhancementTools.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/support/panConstraint.js +2 -0
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Print/CustomTemplate.d.ts +7 -0
- package/widgets/Search/LayerSearchSource.d.ts +3 -0
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/assets/esri/core/workers/chunks/01ba5319cac3e0f14205.js +0 -1
- package/assets/esri/core/workers/chunks/05e1f1628a3726eca03d.js +0 -1
- package/assets/esri/core/workers/chunks/0c13591347d51d684561.js +0 -1
- package/assets/esri/core/workers/chunks/1d38b2fcd85ac9ebd7c6.js +0 -1
- package/assets/esri/core/workers/chunks/1effde6a39ef0d4af525.js +0 -1
- package/assets/esri/core/workers/chunks/1ff57bf19f021f5fd246.js +0 -1
- package/assets/esri/core/workers/chunks/2b781de7b467c61849b2.js +0 -1
- package/assets/esri/core/workers/chunks/3d4ad7c728e02aa90551.js +0 -1
- package/assets/esri/core/workers/chunks/3dc6e9494af16f7b8009.js +0 -1
- package/assets/esri/core/workers/chunks/3ecb906322a6a5c8c93b.js +0 -1
- package/assets/esri/core/workers/chunks/3f67162456a1f02190fa.js +0 -1
- package/assets/esri/core/workers/chunks/48a59c621477f9bac915.js +0 -1
- package/assets/esri/core/workers/chunks/53c8062f4573fa64c49d.js +0 -1
- package/assets/esri/core/workers/chunks/609edb4da427ec37bcf7.js +0 -1
- package/assets/esri/core/workers/chunks/6f5a82388a5eb5fcf1b7.js +0 -1
- package/assets/esri/core/workers/chunks/7c61b18e43c789aaecc6.js +0 -1
- package/assets/esri/core/workers/chunks/85505a8b8b0794656d06.js +0 -1
- package/assets/esri/core/workers/chunks/92b60ec8033eb8dc2b44.js +0 -1
- package/assets/esri/core/workers/chunks/93d08d82ceab19e314f8.js +0 -1
- package/assets/esri/core/workers/chunks/9802770413ad814dab29.js +0 -1
- package/assets/esri/core/workers/chunks/9da1a514e042eb642d35.js +0 -1
- package/assets/esri/core/workers/chunks/a0876a52a3c2ad849370.js +0 -1
- package/assets/esri/core/workers/chunks/a892b3be70f482bef0ba.js +0 -1
- package/assets/esri/core/workers/chunks/b0212df1fe8d9448f3d6.js +0 -1
- package/assets/esri/core/workers/chunks/b590402170ae289290d7.js +0 -1
- package/assets/esri/core/workers/chunks/bdb2077d25525853975f.js +0 -1
- package/assets/esri/core/workers/chunks/bf67e0f6064fb9d94ac8.js +0 -1
- package/assets/esri/core/workers/chunks/bfa6f4c08e7571bb1f37.js +0 -1
- package/assets/esri/core/workers/chunks/cf41a66fb97c1076fb34.js +0 -1
- package/assets/esri/core/workers/chunks/cf9a132c4c37e62de3d7.js +0 -1
- package/assets/esri/core/workers/chunks/e5471373f89fd7cb9844.js +0 -1
- package/assets/esri/core/workers/chunks/f23e995320674b32e142.js +0 -1
- package/assets/esri/core/workers/chunks/fa1336b60278017d2525.js +0 -1
- package/assets/esri/core/workers/chunks/fad4ce7392b89c606656.js +0 -1
- /package/assets/esri/core/workers/chunks/{317bf48a4d513a9a2ff3.js.LICENSE.txt → 786905f34da9cdad53f0.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{7361ca78a605eda41a2f.js.LICENSE.txt → 897a856c00b2b828efe9.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{530cf0964d55410ffb56.js.LICENSE.txt → 9bcebaf0d0e43db0b07f.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{0418b5c9d06f3585c035.js.LICENSE.txt → f170d80c5930db1d630e.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{e5b57c43b5e0b1d5ccdd.js.LICENSE.txt → f6987cacbc55a68ec7ef.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{findAssociatedFeatureService as a}from"../../layers/support/associatedFeatureServiceUtils.js";import{
|
|
2
|
+
import e from"../../core/Error.js";import{findAssociatedFeatureService as a}from"../../layers/support/associatedFeatureServiceUtils.js";import{getLayerModuleTypeStrict as r}from"../../layers/support/fetchService.js";import{LayerLoadContext as t}from"../../layers/support/LayerLoadContext.js";import{layersLoaderMap as s}from"../../layers/support/layersLoader.js";import{sceneServiceLayerTypeToClassName as n,applyPreferredHostToPortalItem as c,getPreferredHost as o}from"../../layers/support/layerUtils.js";import i from"../PortalItem.js";import{getFirstLayerOrTable as u,getNumLayersAndTables as l,preprocessFSItemData as y,getLayerOrTable as m,layerTypeToLayerModuleType as p,populateSceneServiceItemData as f}from"./loadUtils.js";import{hasTypeKeyword as d}from"./portalItemUtils.js";async function w(e){let{portalItem:a}=e;!a||a instanceof i||(a=new i(a));const r=await L(a);return new(0,r.constructor)({portalItem:a,...r.properties})}async function L(e){await e.load();const a=new t;return N(await S(e,a))}async function S(a,r){switch(a.type){case"3DTiles Service":return a.typeKeywords.includes("3DObject")?F():a.typeKeywords.includes("GaussianSplat")?b():P();case"CSV":return K();case"Feature Collection":return M(a);case"Feature Service":return v(a,r);case"Feed":return x();case"GeoJson":return G();case"Group Layer":return J();case"Image Service":return g(a,r);case"KML":return V();case"Knowledge Graph Layer":return W();case"Map Service":return h(a,r);case"Media Layer":return k();case"Scene Service":return I(a,r);case"Stream Service":return j();case"Video Service":return T(a,r);case"Vector Tile Service":return C();case"WCS":return U();case"WFS":return $();case"WMS":return D();case"WMTS":return O();default:throw new e("portal:unknown-item-type","Unknown item type '${type}'",{type:a.type})}}async function N(e){const a=e.className,r=s[a];return{constructor:await r(),properties:e.properties}}async function h(e,a){return await A(e,a)?{className:"TileLayer"}:{className:"MapImageLayer"}}async function v(e,a){const r=await E(e,a);if("object"==typeof r){const{sourceJSON:e,className:a}=r,t={sourceJSON:e};return null!=r.id&&(t.layerId=r.id),{className:a||"FeatureLayer",properties:t}}return{className:"GroupLayer"}}async function I(e,r){const t=await E(e,r,async()=>{try{if(!e.url)return[];const{serverUrl:t}=await a(e.url,{sceneLayerItem:e}),s=await r.fetchServiceMetadata(t);return s?.tables??[]}catch{return[]}});if("object"==typeof t){const a={};let s;if(null!=t.id?(a.layerId=t.id,s=`${e.url}/layers/${t.id}`):s=e.url,e.typeKeywords?.length)for(const r of Object.keys(n))if(e.typeKeywords.includes(r))return{className:n[r]};const c=await r.fetchServiceMetadata(s,{customParameters:await r.fetchCustomParameters(e,e=>u(e)?.customParameters)});return{className:n[c?.layerType]||"SceneLayer",properties:a}}if(!1===t){const a=await r.fetchServiceMetadata(e.url);if("Voxel"===a?.layerType)return{className:"VoxelLayer"}}return{className:"GroupLayer"}}async function M(e){await e.load();const a=d(e,"Map Notes"),r=d(e,"Markup");if(a||r)return{className:"MapNotesLayer"};if(d(e,"Route Layer"))return{className:"RouteLayer"};const t=await e.fetchData();return 1===l(t)?{className:"FeatureLayer"}:{className:"GroupLayer"}}async function g(e,a){await e.load();const r=e.typeKeywords?.map(e=>e.toLowerCase())??[];if(r.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(r.includes("tiled imagery"))return{className:"ImageryTileLayer"};const t=await a.fetchItemData(e),s=t?.layerType;if("ArcGISTiledImageServiceLayer"===s)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===s)return{className:"ImageryLayer"};const n=await a.fetchServiceMetadata(e.url,{customParameters:await a.fetchCustomParameters(e)}),c=n.cacheType?.toLowerCase(),o=n.capabilities?.toLowerCase().includes("tilesonly"),i=n.tileInfo?.format?.toLowerCase()??"",u=null==c&&["jpg","jpeg","png","png8","png24","png32","mixed"].includes(i);return"map"===c||u||o?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}function j(){return{className:"StreamLayer"}}async function T(e,a){return"object"==typeof await E(e,a)?{className:"VideoLayer"}:{className:"GroupLayer"}}function C(){return{className:"VectorTileLayer"}}function G(){return{className:"GeoJSONLayer"}}function P(){return{className:"IntegratedMesh3DTilesLayer"}}function b(){return{className:"GaussianSplatLayer"}}function F(){return{className:"UnsupportedLayer"}}function K(){return{className:"CSVLayer"}}function V(){return{className:"KMLLayer"}}function W(){return{className:"KnowledgeGraphLayer"}}function U(){return{className:"WCSLayer"}}function $(){return{className:"WFSLayer"}}function D(){return{className:"WMSLayer"}}function O(){return{className:"WMTSLayer"}}function x(){return{className:"StreamLayer"}}function J(){return{className:"GroupLayer"}}function k(){return{className:"MediaLayer"}}async function A(e,a){const{tileInfo:r}=await a.fetchServiceMetadata(e.url,{customParameters:await a.fetchCustomParameters(e)});return r}async function E(a,t,s){const{url:n,type:i}=a,d="Feature Service"===i;if(!n)return{};if(/\/\d+$/.test(n)){if(d){const s=await t.fetchServiceMetadata(n,{customParameters:await t.fetchCustomParameters(a,e=>u(e)?.customParameters)});c(a,o());const{id:i,type:l}=s,y=r(l);if(!y)throw new e("from-portal-item:unsupported",`'${n}' has unsupported type: '${l}'`);return{id:i,className:y,sourceJSON:s}}return{}}if("Video Service"===i){const e=await t.fetchServiceMetadata(n);return!((e.layers?.length??0)>1)&&{}}await a.load();let w=await t.fetchItemData(a);if(d){const{data:r,preferredHost:s}=await y(w,n,t);if(0===l(r))throw new e("from-portal-item:no-data",`The feature service '${n}' does not have any supported layers or tables`);c(a,s);const o=R(r);if("object"==typeof o){const e=m(r,o.id);return{id:o.id,className:p(e?.layerType)}}return o}"Scene Service"===i&&(w=await f(a,w,t));if(l(w)>0)return R(w);const L=await t.fetchServiceMetadata(n);return s&&(L.tables=await s()),R(L)}function R(e){return 1===l(e)&&{id:u(e)?.id}}export{w as fromItem,S as selectLayerClassPath};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../request.js";import t from"../../core/Error.js";import{join as r,getPathExtension as
|
|
2
|
+
import e from"../../request.js";import t from"../../core/Error.js";import{join as r,getPathExtension as o}from"../../core/urlUtils.js";async function s(e,t={},o){await e.load(o);const s=r(e.itemUrl,"resources"),{start:a=1,num:n=10,sortOrder:c="asc",sortField:i="resource"}=t,l={query:{start:a,num:n,sortOrder:c,sortField:i,token:e.apiKey},signal:o?.signal},u=await e.portal.request(s,l);return{total:u.total,nextStart:u.nextStart,resources:u.resources.map(({created:t,size:r,resource:o})=>({created:new Date(t),size:r,resource:e.resourceFromPath(o)}))}}async function a(e,o,s,a){const n=new Map;for(const{resource:r,content:u,compress:p,access:f}of o){if(!r.hasPath())throw new t(`portal-item-resource-${s}:invalid-path`,"Resource does not have a valid path");const[e,o]=i(r.path),a=`${e}/${p??""}/${f??""}`;n.has(a)||n.set(a,{prefix:e,compress:p,access:f,files:[]});n.get(a).files.push({fileName:o,content:u})}await e.load(a);const c=r(e.userItemUrl,"add"===s?"addResources":"updateResources");for(const{prefix:r,compress:i,access:u,files:p}of n.values()){const o=25;for(let s=0;s<p.length;s+=o){const n=p.slice(s,s+o),f=new FormData;r&&"."!==r&&f.append("resourcesPrefix",r),i&&f.append("compress","true"),u&&f.append("access",u);let d=0;for(const{fileName:e,content:t}of n)f.append("file"+ ++d,t,e);f.append("f","json");try{await e.portal.request(c,{method:"post",body:f,signal:a?.signal})}catch(l){if(a?.ignoreResourceCopyErrors&&l instanceof t&&"CONT_00942"===l.details?.messageCode)continue;throw l}}}}async function n(e,o,s){if(!o.hasPath())throw new t("portal-item-resources-remove:invalid-path","Resource does not have a valid path");await e.load(s);const a=r(e.userItemUrl,"removeResources");await e.portal.request(a,{method:"post",query:{resource:o.path},signal:s?.signal}),o.portalItem=null}async function c(e,t){await e.load(t);const o=r(e.userItemUrl,"removeResources");return e.portal.request(o,{method:"post",query:{deleteAll:!0},signal:t?.signal})}function i(e){const t=e.lastIndexOf("/");return-1===t?[".",e]:[e.slice(0,t),e.slice(t+1)]}function l(e){const[t,r]=u(e),[o,s]=i(t);return[o,s,r]}function u(e){const t=o(e);return null==t?[e,""]:[e.slice(0,e.length-t.length-1),`.${t}`]}async function p(t){if("blob"===t.type)return t.blob;if("json"===t.type)return new Blob([t.jsonString],{type:"application/json"});return(await e(t.url,{responseType:"blob"})).data}function f(e,t){if(!e.hasPath())return null;const[o,,s]=l(e.path);return e.portalItem.resourceFromPath(r(o,t+s))}function d(e,t){if(!e.hasPath())return null;const[o,,s]=l(e.path);return e.portalItem.resourceFromPath(r(o,t+s))}export{a as addOrUpdateResources,p as contentToBlob,s as fetchResources,f as getSiblingOfSameType,d as getSiblingOfSameTypeI,c as removeAllResources,n as removeResource,l as splitPrefixFileNameAndExtension};
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const e="20260617",f="4371f48d15da3fb1684486465044e2f5911055e2";export{e as buildDate,f as commitHash};
|
|
@@ -63,7 +63,7 @@ export interface SimpleMarkerSymbolProperties extends MarkerSymbolProperties, Pa
|
|
|
63
63
|
* >
|
|
64
64
|
* > **Known Limitations**
|
|
65
65
|
* >
|
|
66
|
-
* > [SimpleLineSymbol
|
|
66
|
+
* > [SimpleLineSymbol.style](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleLineSymbol/#style) property is not honored in a simple marker symbol's `outline` in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
|
|
67
67
|
* > Support for outline `style` was added in a 2D [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) at version 4.28.
|
|
68
68
|
*
|
|
69
69
|
* @example
|
|
@@ -188,7 +188,7 @@ export default class SimpleMarkerSymbol extends MarkerSymbol {
|
|
|
188
188
|
* >
|
|
189
189
|
* > **Known Limitations**
|
|
190
190
|
* >
|
|
191
|
-
* > [SimpleLineSymbol
|
|
191
|
+
* > [SimpleLineSymbol.style](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleLineSymbol/#style) property is not honored in a simple marker symbol's `outline` in a 3D [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/).
|
|
192
192
|
* > Support for outline `style` was added in a 2D [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) at version 4.28.
|
|
193
193
|
*
|
|
194
194
|
* @example
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import r from"../../core/Logger.js";import{deg2rad as i}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as n,pt2px as a}from"../../core/screenUtils.js";import{GeometryCursor as o}from"../../geometry/GeometryCursor.js";import{fromValues as l,empty as h,expandPointInPlace as c,center as m,width as f,height as u,diagonal as d,create as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{segmentIntersects as y}from"../../geometry/support/intersectsBase.js";import{isPolygon as P,isPolyline as S,isExtent as x,isMultipoint as w,isPoint as M}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as b}from"./CIMEffects.js";import T from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as k,getPlacementOperator as C}from"./CIMOperators.js";import{Placement as v}from"./CIMPlacements.js";import{defaultCIMValues as I}from"./defaultCIMValues.js";import{getFirstFrame as R}from"./imageUtils.js";import{rotate as z}from"./mathUtils.js";import{addColorStops as L}from"./rasterizingUtils.js";import U from"./Rect.js";import F from"./TextRasterizer.js";import{getNumericValue as A,isSVGImage as j,getRelativeGradientSize as D,getEffectsInflateSize as G,fromCIMFontDecoration as H,fromCIMFontStyle as E,fromCIMHorizontalAlignment as B,fromCIMVerticalAlignment as X,getFillColor as J,getStrokeColor as N,getStrokeWidth as O,getFontWeight as q,getFontStyle as V,isCIMFill as Y,getSize as W}from"./utils.js";import{destroyHiddenSvg as K,createHiddenSvg as $,createSvgElement as Q}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as Z,glyphSize as tt,hittestToleranceSmallSymbol as et,hittestSmallSymbolThreshold as rt}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as it}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as st,getLineWidth as nt}from"../../views/2d/layers/graphics/graphicsUtils.js";const at=Math.PI/180,ot=.5,lt=()=>r.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class ht{constructor(t){this._t=t}static createIdentity(){return new ht([1,0,0,0,1,0])}clone(){const t=this._t;return new ht(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new ht([t,0,0,0,e,0])}scale(t,e){const r=this._t;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=e,r[4]*=e,r[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new ht([0,0,t,0,0,e])}translate(t,e){const r=this._t;return r[2]+=t,r[5]+=e,this}static createRotate(t){const e=Math.cos(t),r=Math.sin(t);return new ht([e,-r,0,r,e,0])}rotate(t){return ht.multiply(this,ht.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],r=Math.sqrt(t*t+e*e);return[t/r,e/r]}static multiply(t,e,r){const i=t._t,s=e._t,n=i[0]*s[0]+i[3]*s[1],a=i[1]*s[0]+i[4]*s[1],o=i[2]*s[0]+i[5]*s[1]+s[2],l=i[0]*s[3]+i[3]*s[4],h=i[1]*s[3]+i[4]*s[4],c=i[2]*s[3]+i[5]*s[4]+s[5],m=r._t;return m[0]=n,m[1]=a,m[2]=o,m[3]=l,m[4]=h,m[5]=c,r}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new ht([0,0,0,0,0,0]);e=1/e;const r=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,n=-t[1]*e,a=-t[3]*e,o=t[0]*e;return new ht([s,n,r,a,o,i])}}class ct{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._textScaling=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new v,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||ht.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1),this._textScaling.push(1)}setTransform(t,e){this._transfos=[t||ht.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)],this._textScaling=[1]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}scaleText(t){return t*this._textScaling[this._textScaling.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}reverseScaleText(t){return t/this._textScaling[this._textScaling.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e=!1,r=1){const i=e?t.scaleRatio():1;ht.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*i),this._textScaling.push(this._textScaling[this._textScaling.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1),this._textScaling.splice(-1,1)}drawSymbol(t,e,r){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,r)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const r=t.symbolLayers;if(!r)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(r,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(r,e)}executeEffects(t,e){const r=this.geomUnitsPerPoint(),i=null,s=G(t),n=!1;let a=new b(o.fromJSONCIM(e));for(const o of t){const t=k(o);t&&(a=t.execute(a,o,{geomUnitsPerPoint:r,tileKey:i,maxInflateSize:s,scale:null,spatialReference:e.spatialReference,preventClipping:n}))}return a}drawSymbolLayers(t,e){let r=t.length;for(;r--;){const i=t[r];if(!i||!1===i.enable)continue;const s=i.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const r=dt(e,t,this.geomUnitsPerPoint());r&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,r),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const r=t.markerPlacement;if(r){const i=C(r);if(i){const s="CIMMarkerPlacementInsidePolygon"===r.type||"CIMMarkerPlacementPolygonCenter"===r.type&&r.clipAtBoundary;s&&this.pushClipPath(e);const n=i.execute(o.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null);if(n){let e=null;for(;(e=n.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(M(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(P(e)){const i=_(e);i&&([r.tx,r.ty]=i,this.drawMarker(t,r))}else if(S(e)){for(const i of e.paths)for(const e of i)if(r.tx=e[0],r.ty=e[1],this.drawMarker(t,r),this._earlyReturn)break}else for(const i of e.points)if(r.tx=i[0],r.ty=i[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=A(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,n=r.height;if(!s||!n)return;const a=s/n,o=A(t.scaleX,1),l=ht.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*a*o,r*=i),l.translate(-e,-r)}let c=A(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*at);let m=A(t.offsetX),f=A(t.offsetY);if(m||f){if(this._mapRotation){const t=at*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=m*r+f*e;m=m*e-f*r,f=i}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=A(t.size,I.CIMVectorMarker.size),s=t.frame,n=s?s.ymax-s.ymin:0,a=i&&n?i/n:1,o=ht.createIdentity();s&&o.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,r=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,r*=s.ymax-s.ymin):(e/=a,r/=a),o.translate(-e,-r)}1!==a&&o.scale(a,a);let h=A(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&o.rotate(h*at);let c=A(t.offsetX),m=A(t.offsetY);if(c||m){if(this._mapRotation){const t=at*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}o.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&o.scale(f,f);const u=e.getAngle();u&&o.rotate(u),o.translate(e.tx,e.ty);const d=t.scaleSymbolsProportionally?1:a;this.push(o,t.scaleSymbolsProportionally,d);for(const g of r){g?.symbol&&g.geometry||lt().error("Invalid marker graphic",g);let t=g.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(g.symbol,g.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!M(e))return;if(A(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity();let s=A(t.angle);s=-s,s&&i.rotate(s*at);const n=A(t.offsetX),a=A(t.offsetY);(n||a)&&i.translate(n,a);const o=this.geomUnitsPerPoint();1!==o&&i.scale(o,o),i.translate(e.x,e.y),this.push(i),this.drawText(t,r),this.pop()}}class mt extends ct{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new U(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(P(t))this._processPath(t.rings,0);else if(S(t))this._processPath(t.paths,0);else if(x(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,r){if(!t||this._clipCount>0||null==r||r<=0)return;const i=Math.max(.5*this.transformSize(A(r,I.CIMSolidStroke.width)),.5*ot);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(x(t)){const e=yt(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){P(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:r}=t,i=A(t.scaleX,1);let s=i*e,n=e;const a=this._resourceManager.getResource(r);if(null!=a){const t=a.height/a.width;s=i*(e?t>1?e:e/t:a.width),n=e?t>1?e*t:e:a.height}this._merge(this.transformPt([-s/2,-n/2]),0),this._merge(this.transformPt([-s/2,n/2]),0),this._merge(this.transformPt([s/2,-n/2]),0),this._merge(this.transformPt([s/2,n/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=St(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=n(i),s=n(s);const a=this.transformSize(1)*this.reverseTransformScalar(1);i*=a,s*=a;const o=t.horizontalAlignment??I.CIMTextSymbol.horizontalalignment,l=t.verticalAlignment??I.CIMTextSymbol.verticalalignment;let h=0;switch(o){case"Left":h=i/2;break;case"Right":h=-i/2}let c=0;switch(l){case"Bottom":c=s/2;break;case"Top":c=-s/2;break;case"Baseline":c=s/6}this._merge(this.transformPt([-i/2+h,-s/2+c]),0),this._merge(this.transformPt([-i/2+h,s/2+c]),0),this._merge(this.transformPt([i/2+h,-s/2+c]),0),this._merge(this.transformPt([i/2+h,s/2+c]),0)}_processPath(t,e){if(t)for(const r of t){const t=r?r.length:0;if(t>1){this._merge(this.transformPt(r[0]),e);for(let i=1;i<t;i++)this._merge(this.transformPt(r[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class ft extends ct{constructor(){super(...arguments),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=K(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i){const{textInfo:s,mapRotation:o,resolution:l,searchDist:h,hittestType:c,isScreenAligned:m}=i;this._resetHittest();const f=l*a(1);switch(this.setGeomUnitsPerPoint(f),c){case"point":if(1!==t.length)return lt().error("Unexpected hittest area",t),!1;this._hittestType="point",this._searchDistPoint=h/2/f,this._searchTarget=[[t[0].x,t[0].y]];break;case"rect":if(4!==t.length)return lt().error("Unexpected hittest area",t),!1;this._hittestType="rect",this._searchDistPoint=0,this._searchTarget=t.map(t=>[t.x,t.y])}if(this._textInfo=s,this._mapRotation=m?o:0,!has("esri-mobile")){const t=n(et*window.devicePixelRatio),r=n(rt);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(Y))&&"CIMMeshSymbol"!==e?.type&&(W(e)??0)<r&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,r),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,r){null!=r?this._hittestSvgPath(t,r,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,r,i,s,n,a){null!=a?this._hittestSvgPath(t,a,!1,r):this._hitTestStroke(t,r)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}drawTextSymbol(t,e,r){if(!t||!M(e))return;if(A(t.height,I.CIMTextSymbol.height)<=0)return;const i=ht.createIdentity(),s=this.geomUnitsPerPoint();1!==s&&i.scale(s,s),i.translate(e.x,e.y),this.push(i),this.drawText(t,r),this.pop()}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=A(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const n=e*this.geomUnitsPerPoint(),a=n*i*(s.width/s.height);if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),e=this._searchDistPoint;Math.abs(t[0])<a/2+e&&Math.abs(t[1])<n/2+e&&(this._earlyReturn=!0)}else{const t=a/2,e=n/2,r=[[-t,e],[t,e],[t,-e],[-t,-e],[-t,e]];bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[r])&&(this._earlyReturn=!0)}}drawText(t,e){const r=this._textInfo;if(!r)return;const i=r.get(t);if(!i)return;if(!i.glyphMosaicItems.glyphs.length)return;const s=st(A(t.height,I.CIMTextSymbol.height)),{lineGapType:n,lineGap:a}=t,o=n?Pt(n,A(a),s):0,l=t.horizontalAlignment??I.CIMTextSymbol.horizontalalignment,h=t.verticalAlignment??I.CIMTextSymbol.verticalalignment,c="CIMBackgroundCallout"===t.callout?.type,m=it(i.glyphMosaicItems,{scale:s/tt,angle:A(t.angle),xOffset:A(t.offsetX),yOffset:A(t.offsetY),horizontalAlignment:l,verticalAlignment:h,maxLineWidth:nt(t.lineWidth),lineHeight:Z*Math.max(.25,Math.min(o||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!1,hasBackground:c}),f=this.reverseScaleText(1);for(const u of m.glyphs){const t=u.offsets,e=[[t.topLeft[0]*f,-t.topLeft[1]*f],[t.topRight[0]*f,-t.topRight[1]*f],[t.bottomRight[0]*f,-t.bottomRight[1]*f],[t.bottomLeft[0]*f,-t.bottomLeft[1]*f],[t.topLeft[0]*f,-t.topLeft[1]*f]];if("point"===this._hittestType){gt(this.reverseTransformPt(this._searchTarget[0]),[e])&&(this._earlyReturn=!0)}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[e])&&(this._earlyReturn=!0)}}}_hitTestFill(t){let e=null;if(x(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(P(t))e=t.rings;else{if(!S(t))return;e=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);if(gt(t,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(t,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,e)&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=$(),this._path??=Q("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,r,i=0){const s=g();p(s,t);const n={x:s[0],y:s[1],width:s[2]-s[0],height:s[3]-s[1]},a=this._getSvgPath();a.setAttribute("d",e);const o=a.getBBox();if("point"===this._hittestType){const t=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),s=this.reverseTransformPt(this._searchTarget[0]);let a=Math.max(o.width/n.width,o.height/n.height),l=1;const h=2*t*a;h<1&&(l=2/h,a*=l,o.x*=l,o.y*=l,o.width*=l,o.height*=l);const c=1+i*a/2,m=this._getCanvasContext(o.width+2*c,o.height+2*c);m.setTransform(l,0,0,l,-o.x+c,-o.y+c);const f=new Path2D(e);r?m.fill(f):(m.lineWidth=i*(a/l),m.stroke(f));const u=(n.width*a-o.width)/2,d=(n.height*a-o.height)/2,g=Math.floor((s[0]-n.x-t)*a-u+c),p=Math.floor((n.height-(s[1]-n.y)-t)*a+d+c),_=Math.ceil(2*t*a),y=Math.ceil(2*t*a),P=m.getImageData(g,p,_,y).data;for(let e=3;e<P.length;e+=4)if(P[e]>127.5)return void(this._earlyReturn=!0)}else{const t=[[n.x,n.y],[n.x,n.y+n.height],[n.x+n.width,n.y+n.height],[n.x+n.width,n.y],[n.x,n.y]];if(bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,[t]))return void(this._earlyReturn=!0)}}_hitTestStroke(t,e){let r=null;if(x(t)){const e=t;r=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(P(t))r=t.rings;else{if(!S(t))return;r=t.paths}if("point"===this._hittestType){pt(this.reverseTransformPt(this._searchTarget[0]),r,A(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}else{bt(this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget,r)&&(this._earlyReturn=!0)}}_resetHittest(){this.setTransform(),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null}}class ut extends ct{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new T,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(x(t))this._buildPath(yt(t).rings,!0);else{if(!w(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const r=this._ctx;r.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",r.fill("evenodd")}drawSolidStroke(t,e,r,i,s,n){if(!t||!e||0===r)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!1);else{if(!x(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const a=this._ctx;a.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",a.lineWidth=Math.max(this.transformSize(r),ot),this._setCapStyle(i),this._setJoinStyle(s),a.miterLimit=n,a.stroke()}pushClipPath(t){if(this._ctx.save(),P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else{if(!x(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:r,url:i,tintColor:s}=t,n=A(t.scaleX,1),a=this._resourceManager.getResource(i);if(null==a)return;let o=e*(a.width/a.height),l=e;e||(o=a.width,l=a.height);const h=j(i)||"src"in a&&j(a.src);let c="getFrame"in a?R(a):a;r&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,r)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:n*d*f,m12:n*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-o/2,-l/2,o,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=St(t,this.transformSize(n(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:a,anchorY:o,canvas:l}=i,h=s[0]*(a+.5),c=s[1]*(o-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-g*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:r,height:i,offsetX:s,offsetY:n,rotation:a,scaleX:o,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(x(t))this._buildPath(yt(t).rings,!0);else{if(!w(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=j(h)||"src"in c&&j(c.src);let u,d="getFrame"in c?R(c):c;if(r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);a||(a=0),s?s*=t:s=0,n?n*=t:n=0,i&&(i*=t);const e=i?i/c.height:1,r=o&&i?o*i/c.width:1;if(0!==a||1!==e||1!==r||0!==s||0!==n){const t=new DOMMatrix;t.rotateSelf(0,0,-a).translateSelf(s,n).scaleSelf(r,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,r){if(!t)return;let{colorSubstitutions:i,capStyle:s,joinStyle:n,miterLimit:o,tintColor:l,url:h,width:c}=r;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(P(t))f=t.rings;else if(S(t))f=t.paths;else{if(!x(t))return w(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=j(h)||"src"in m&&j(m.src);let d="getFrame"in m?R(m):m;i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(a(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(n),void 0!==o&&(_.miterLimit=o),_.lineWidth=g;for(let a of f)if(a=e(a),wt(a),a&&!(a.length<=1)){M=this.transformPt(a[0]);for(let t=1;t<a.length;t++){b=this.transformPt(a[t]);const e=_t(M,b),r=new DOMMatrix;r.translateSelf(0,M[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(r),_.strokeStyle=y,_.beginPath(),_.moveTo(M[0],M[1]),_.lineTo(b[0],b[1]),_.stroke(),M=b}}_.restore()}drawGradientFill(t,e){if(!t)return;let r;if(P(t))r=t.rings;else if(S(t))r=t.paths;else{if(!x(t))return void lt().error("Unable to draw gradient fill");r=yt(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:n,gradientSize:o,gradientSizeUnits:l}=e,g=I.CIMGradientFill,p=e.gradientType??g.gradientType,_=-i(s??0),y=h();for(const i of r){const t=i?i.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(i[e]);"Linear"!==n&&"Rectangular"!==n||(t=z(t,-_)),c(y,t)}}const[w,M,b,T]=y,k=this._ctx;switch(k.save(),n){case"Buffered":lt().error(`Gradient method "${n}" currently unsupported.`);break;case"Linear":{const t=(M+T)/2,r="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(b-w),[i,s]="Discrete"===p?[b,b-r]:[w+r,w],n=z([i,t],_),h=z([s,t],_),c=k.createLinearGradient(n[0],n[1],h[0],h[1]);L(c,e),k.fillStyle=c,k.fill("evenodd");break}case"Circular":{const t=m(y),r=d(y)/2,i="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*r,[s,n]="Discrete"===p?[r,r-i]:[i,0],h=k.createRadialGradient(t[0],t[1],s,t[0],t[1],n);L(h,e),k.fillStyle=h,k.fill("evenodd");break}case"Rectangular":{const r=m(y),i=r[0],s=r[1],n=z(r,_),h=(r,i,s,a,o,l,h,c)=>{k.save(),this.pushClipPath(t);const m=z([o,l],_),f=z([h,c],_);k.beginPath(),k.moveTo(n[0],n[1]),k.lineTo(m[0],m[1]),k.lineTo(f[0],f[1]),k.lineTo(n[0],n[1]),k.clip();const u=z([r,i],_),d=z([s,a],_),g=k.createLinearGradient(u[0],u[1],d[0],d[1]);L(g,e),k.fillStyle=g,k.fill("evenodd"),k.restore()};let c="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(f(y)/2),[d,P]="Discrete"===p?[b,b-c]:[i+c,i];h(d,s,P,s,b,M,b,T),[d,P]="Discrete"===p?[w,w+c]:[i-c,i],h(d,s,P,s,w,T,w,M),c="Absolute"===l?this.transformSize(a(o)):D(o,g.gradientSize)*(u(y)/2);let[S,x]="Discrete"===p?[T,T-c]:[s+c,s];h(i,S,i,x,b,T,w,T),[S,x]="Discrete"===p?[M,M+c]:[s-c,s],h(i,S,i,x,w,M,b,M);break}}k.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:n,gradientSizeUnits:o,joinStyle:l,miterLimit:h,width:c}=r;if(!t||0===c)return;let m;if(P(t))m=t.rings;else if(S(t))m=t.paths;else{if(!x(t))return void lt().error("Unable to draw gradient stroke");m=yt(t).rings}const f=r.gradientType??I.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(a(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(i),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const r=p[0]-g[0],i=p[1]-g[1];t+=Math.sqrt(r*r+i*i),g=p}const i="Absolute"===o?this.transformSize(a(n)):D(n,I.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const n=p[0]-g[0],a=p[1]-g[1],o=Math.sqrt(n*n+a*a);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=z([n/o,a/o],-Math.PI/2),r=u/2,s="Discrete"===f?r:i-r;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*i,y=c-e*i;break}case"AlongLine":{const e=n/o,r=a/o;"Discrete"===f?(h=g[0]-e*l,c=g[1]-r*l,m=h+e*i,y=c+r*i):(m=g[0]+e*(t-l),y=g[1]+r*(t-l),h=m-e*i,c=y-r*i);break}default:return lt().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);L(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=o,g=p}}d.restore()}_buildPath(t,e){const r=this._ctx;if(r.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let s=this.transformPt(i[0]);r.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(i[e]),r.lineTo(s[0],s[1]);e&&r.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function dt(t,e,r){let i=A(t.separation,I.CIMHatchFill.separation)*r,s=A(t.rotation);if(0===i)return null;i<0&&(i=-i);let n=0;const a=.5*i;for(;n>a;)n-=i;for(;n<-a;)n+=i;const o=g();p(o,e),o[0]-=a,o[1]-=a,o[2]+=a,o[3]+=a;const l=[[o[0],o[1]],[o[0],o[3]],[o[2],o[3]],[o[2],o[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*at),c=Math.sin(s*at),m=-i*c,f=i*h;let u,d,_,y;n=A(t.offsetX)*r*c-A(t.offsetY)*r*h,u=_=Number.MAX_VALUE,d=y=-Number.MAX_VALUE;for(const g of l){const t=g[0],e=g[1],r=h*t+c*e,i=-c*t+h*e;u=Math.min(u,r),_=Math.min(_,i),d=Math.max(d,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=h*u-c*_-m*n/i,S=c*u+h*_-f*n/i,x=h*d-c*_-m*n/i,w=c*d+h*_-f*n/i;const M=1+Math.round((y-_)/i),b=[];for(let g=0;g<M;g++)P+=m,S+=f,x+=m,w+=f,b.push([[P,S],[x,w]]);return{paths:b}}function gt(t,e){let r=0;for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],n=i[s];if(e[1]>t[1]==n[1]>t[1])continue;(n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0])>0?r++:r--}}return 0!==r}function pt(t,e,r){for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],n=i[s];let a=(n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1]);if(0===a)continue;a=Math.sqrt(a);const o=((n[0]-e[0])*(t[1]-e[1])-(n[1]-e[1])*(t[0]-e[0]))/a;if(Math.abs(o)<r){const i=((n[0]-e[0])*(t[0]-e[0])+(n[1]-e[1])*(t[1]-e[1]))/a;if(i>-r&&i<a+r)return!0}}}return!1}function _t(t,e){const r=e[0]-t[0],i=e[1]-t[1];return 180/Math.PI*Math.atan2(i,r)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,r)=>{switch(t){case"ExtraLeading":return 1+e/r;case"Multiple":return e;case"Exact":return e/r}};function St(e,r=1){const i=H(e),s=E(e.fontStyleName),n=e.fontFamilyName??t,{weight:a,style:o}=s,l=r*(e.height||5),h=B(e.horizontalAlignment),c=X(e.verticalAlignment),m=J(e),f=J(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=N(e.symbol),g=r*(O(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=J(p),y=O(p),P=N(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:n,style:V(o),weight:q(a),decoration:i},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:o},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const xt=1e-4;function wt(t){let e,r,i,s,n,a=t[0],o=1;for(;o<t.length;)e=t[o][0]-a[0],r=t[o][1]-a[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=xt?(t.splice(o-1,1),a=n):(n=a,a=t[o],o++),i=s}function Mt(t){const e=1e-6,r=t[0],i=t[t.length-1];return Math.abs(r[0]-i[0])<=e&&Math.abs(r[1]-i[1])<=e}function bt(t,e){t.length>1&&!Mt(t)&&(t=[...t,t[0]]);for(let r=0;r<e.length;r++){const i=e[r],s=i.length;for(const e of i)if(gt(e,[t]))return!0;if(Mt(i))for(const r of t)if(gt(r,e))return!0;for(let e=1;e<s;e++){const r=i[e-1],s=i[e];for(let e=0;e<t.length;e++){const i=t[e],n=t[(e+1)%t.length];if(y(r,s,i,n))return!0}}}return!1}export{ct as CIMSymbolDrawHelper,ut as CanvasDrawHelper,mt as EnvDrawHelper,ft as HittestDrawHelper,ht as Transformation,at as cDegToRad,Pt as lineGapType2LineHeight};
|
|
2
|
+
import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import i from"../../core/Logger.js";import{deg2rad as r}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{px2pt as a,pt2px as n}from"../../core/screenUtils.js";import{GeometryCursor as o}from"../../geometry/GeometryCursor.js";import{fromValues as l,empty as h,expandPointInPlace as c,center as m,width as f,height as u,diagonal as d,create as g}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as p}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{targetIntersectsPolygon as y,pointInPolygon as P,nearLine as S}from"../../geometry/support/intersectsBase.js";import{isPolygon as x,isPolyline as w,isExtent as M,isMultipoint as b,isPoint as T}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as k}from"./CIMEffects.js";import C from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as v,getPlacementOperator as I}from"./CIMOperators.js";import{Placement as R}from"./CIMPlacements.js";import{defaultCIMValues as z}from"./defaultCIMValues.js";import{getFirstFrame as L}from"./imageUtils.js";import{rotate as U}from"./mathUtils.js";import{addColorStops as F}from"./rasterizingUtils.js";import A from"./Rect.js";import j from"./TextRasterizer.js";import{getNumericValue as D,isSVGImage as G,getRelativeGradientSize as H,getEffectsInflateSize as E,fromCIMFontDecoration as B,fromCIMFontStyle as X,fromCIMHorizontalAlignment as J,fromCIMVerticalAlignment as N,getFillColor as O,getStrokeColor as q,getStrokeWidth as V,getFontWeight as Y,getFontStyle as W,isCIMFill as K,getSize as $}from"./utils.js";import{destroyHiddenSvg as Q,createHiddenSvg as Z,createSvgElement as tt}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as et,glyphSize as it,hittestToleranceSmallSymbol as rt,hittestSmallSymbolThreshold as st}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as at}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as nt,getLineWidth as ot}from"../../views/2d/layers/graphics/graphicsUtils.js";const lt=Math.PI/180,ht=.5,ct=()=>i.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class mt{constructor(t){this._t=t}static createIdentity(){return new mt([1,0,0,0,1,0])}clone(){const t=this._t;return new mt(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new mt([t,0,0,0,e,0])}scale(t,e){const i=this._t;return i[0]*=t,i[1]*=t,i[2]*=t,i[3]*=e,i[4]*=e,i[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new mt([0,0,t,0,0,e])}translate(t,e){const i=this._t;return i[2]+=t,i[5]+=e,this}static createRotate(t){const e=Math.cos(t),i=Math.sin(t);return new mt([e,-i,0,i,e,0])}rotate(t){return mt.multiply(this,mt.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],i=Math.sqrt(t*t+e*e);return[t/i,e/i]}static multiply(t,e,i){const r=t._t,s=e._t,a=r[0]*s[0]+r[3]*s[1],n=r[1]*s[0]+r[4]*s[1],o=r[2]*s[0]+r[5]*s[1]+s[2],l=r[0]*s[3]+r[3]*s[4],h=r[1]*s[3]+r[4]*s[4],c=r[2]*s[3]+r[5]*s[4]+s[5],m=i._t;return m[0]=a,m[1]=n,m[2]=o,m[3]=l,m[4]=h,m[5]=c,i}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new mt([0,0,0,0,0,0]);e=1/e;const i=(t[1]*t[5]-t[2]*t[4])*e,r=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,a=-t[1]*e,n=-t[3]*e,o=t[0]*e;return new mt([s,a,i,n,o,r])}}class ft{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._textScaling=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new R,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||mt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1),this._textScaling.push(1)}setTransform(t,e){this._transfos=[t||mt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)],this._textScaling=[1]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}scaleText(t){return t*this._textScaling[this._textScaling.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}reverseScaleText(t){return t/this._textScaling[this._textScaling.length-1]}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e=!1,i=1){const r=e?t.scaleRatio():1;mt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r),this._textScaling.push(this._textScaling[this._textScaling.length-1]*i)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1),this._textScaling.splice(-1,1)}drawSymbol(t,e,i){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,i)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const i=t.symbolLayers;if(!i)return;const r=t.effects;if(r&&r.length>0){const t=this.executeEffects(r,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(i,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(i,e)}executeEffects(t,e){const i=this.geomUnitsPerPoint(),r=null,s=E(t),a=!1;let n=new k(o.fromJSONCIM(e));for(const o of t){const t=v(o);t&&(n=t.execute(n,o,{geomUnitsPerPoint:i,tileKey:r,maxInflateSize:s,scale:null,spatialReference:e.spatialReference,preventClipping:a}))}return n}drawSymbolLayers(t,e){let i=t.length;for(;i--;){const r=t[i];if(!r||!1===r.enable)continue;const s=r.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(r,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(r,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const i=pt(e,t,this.geomUnitsPerPoint());i&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,i),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const i=t.markerPlacement;if(i){const r=I(i);if(r){const s="CIMMarkerPlacementInsidePolygon"===i.type||"CIMMarkerPlacementPolygonCenter"===i.type&&i.clipAtBoundary;s&&this.pushClipPath(e);const a=r.execute(o.fromJSONCIM(e),i,this.geomUnitsPerPoint(),null);if(a){let e=null;for(;(e=a.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const i=this._placementPool.acquire();if(T(e))i.tx=e.x,i.ty=e.y,this.drawMarker(t,i);else if(x(e)){const r=_(e);r&&([i.tx,i.ty]=r,this.drawMarker(t,i))}else if(w(e)){for(const r of e.paths)for(const e of r)if(i.tx=e[0],i.ty=e[1],this.drawMarker(t,i),this._earlyReturn)break}else for(const r of e.points)if(i.tx=r[0],i.ty=r[1],this.drawMarker(t,i),this._earlyReturn)break;this._placementPool.release(i)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const i=this._resourceManager.getResource(t.url),r=D(t.size,z.CIMPictureMarker.size);if(null==i||r<=0)return;const s=i.width,a=i.height;if(!s||!a)return;const n=s/a,o=D(t.scaleX,1),l=mt.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,i=h.y;"Absolute"!==t.anchorPointUnits&&(e*=r*n*o,i*=r),l.translate(-e,-i)}let c=D(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*lt);let m=D(t.offsetX),f=D(t.offsetY);if(m||f){if(this._mapRotation){const t=lt*this._mapRotation,e=Math.cos(t),i=Math.sin(t),r=m*i+f*e;m=m*e-f*i,f=r}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l),this.drawImage(t,r),this.pop()}drawVectorMarker(t,e){if(!t)return;const i=t.markerGraphics;if(!i)return;const r=D(t.size,z.CIMVectorMarker.size),s=t.frame,a=s?s.ymax-s.ymin:0,n=r&&a?r/a:1,o=mt.createIdentity();s&&o.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,i=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,i*=s.ymax-s.ymin):(e/=n,i/=n),o.translate(-e,-i)}1!==n&&o.scale(n,n);let h=D(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&o.rotate(h*lt);let c=D(t.offsetX),m=D(t.offsetY);if(c||m){if(this._mapRotation){const t=lt*this._mapRotation,e=Math.cos(t),i=Math.sin(t),r=c*i+m*e;c=c*e-m*i,m=r}o.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&o.scale(f,f);const u=e.getAngle();u&&o.rotate(u),o.translate(e.tx,e.ty);const d=t.scaleSymbolsProportionally?1:n;this.push(o,t.scaleSymbolsProportionally,d);for(const g of i){g?.symbol&&g.geometry||ct().error("Invalid marker graphic",g);let t=g.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(g.symbol,g.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,i){if(!t)return;if(!T(e))return;if(D(t.height,z.CIMTextSymbol.height)<=0)return;const r=mt.createIdentity();let s=D(t.angle);s=-s,s&&r.rotate(s*lt);const a=D(t.offsetX),n=D(t.offsetY);(a||n)&&r.translate(a,n);const o=this.geomUnitsPerPoint();1!==o&&r.scale(o,o),r.translate(e.x,e.y),this.push(r),this.drawText(t,i),this.pop()}}class ut extends ft{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new A(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return l(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(x(t))this._processPath(t.rings,0);else if(w(t))this._processPath(t.paths,0);else if(M(t)){const e=yt(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,i){if(!t||this._clipCount>0||null==i||i<=0)return;const r=Math.max(.5*this.transformSize(D(i,z.CIMSolidStroke.width)),.5*ht);if(x(t))this._processPath(t.rings,r);else if(w(t))this._processPath(t.paths,r);else if(M(t)){const e=yt(t);e&&this._processPath(e.rings,r)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){x(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:i}=t,r=D(t.scaleX,1);let s=r*e,a=e;const n=this._resourceManager.getResource(i);if(null!=n){const t=n.height/n.width;s=r*(e?t>1?e:e/t:n.width),a=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-a/2]),0),this._merge(this.transformPt([-s/2,a/2]),0),this._merge(this.transformPt([s/2,-a/2]),0),this._merge(this.transformPt([s/2,a/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new j);const i=St(t);let[r,s]=this._textRasterizer.computeTextSize(e,i);r=a(r),s=a(s);const n=this.transformSize(1)*this.reverseTransformScalar(1);r*=n,s*=n;const o=t.horizontalAlignment??z.CIMTextSymbol.horizontalalignment,l=t.verticalAlignment??z.CIMTextSymbol.verticalalignment;let h=0;switch(o){case"Left":h=r/2;break;case"Right":h=-r/2}let c=0;switch(l){case"Bottom":c=s/2;break;case"Top":c=-s/2;break;case"Baseline":c=s/6}this._merge(this.transformPt([-r/2+h,-s/2+c]),0),this._merge(this.transformPt([-r/2+h,s/2+c]),0),this._merge(this.transformPt([r/2+h,-s/2+c]),0),this._merge(this.transformPt([r/2+h,s/2+c]),0)}_processPath(t,e){if(t)for(const i of t){const t=i?i.length:0;if(t>1){this._merge(this.transformPt(i[0]),e);for(let r=1;r<t;r++)this._merge(this.transformPt(i[r]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class dt extends ft{constructor(){super(...arguments),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=Q(this._svg),this._path=null,this._canvas=null}hitTest(t,e,i,r){const{textInfo:s,mapRotation:o,resolution:l,searchDist:h,hittestType:c,isScreenAligned:m}=r;this._resetHittest();const f=l*n(1);switch(this.setGeomUnitsPerPoint(f),c){case"point":if(1!==t.length)return ct().error("Unexpected hittest area",t),!1;this._hittestType="point",this._searchDistPoint=h/2/f,this._searchTarget=[[t[0].x,t[0].y]];break;case"rect":if(4!==t.length)return ct().error("Unexpected hittest area",t),!1;this._hittestType="rect",this._searchDistPoint=0,this._searchTarget=t.map(t=>[t.x,t.y])}if(this._textInfo=s,this._mapRotation=m?o:0,!has("esri-mobile")){const t=a(rt*window.devicePixelRatio),i=a(st);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(K))&&"CIMMeshSymbol"!==e?.type&&($(e)??0)<i&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,i),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,i){null!=i?this._hittestSvgPath(t,i,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,i,r,s,a,n){null!=n?this._hittestSvgPath(t,n,!1,i):this._hitTestStroke(t,i)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}drawTextSymbol(t,e,i){if(!t||!T(e))return;if(D(t.height,z.CIMTextSymbol.height)<=0)return;const r=mt.createIdentity(),s=this.geomUnitsPerPoint();1!==s&&r.scale(s,s),r.translate(e.x,e.y),this.push(r),this.drawText(t,i),this.pop()}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:i}=t,r=D(t.scaleX,1),s=this._resourceManager.getResource(i);if(null==s||0===s.height||0===e)return;const a=e*this.geomUnitsPerPoint(),n=a*r*(s.width/s.height);if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),e=this._searchDistPoint;Math.abs(t[0])<n/2+e&&Math.abs(t[1])<a/2+e&&(this._earlyReturn=!0)}else{const t=n/2,e=a/2,i=[[-t,e],[t,e],[t,-e],[-t,-e],[-t,e]],r=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(r,[i])&&(this._earlyReturn=!0)}}drawText(t,e){const i=this._textInfo;if(!i)return;const r=i.get(t);if(!r)return;if(!r.glyphMosaicItems.glyphs.length)return;const s=nt(D(t.height,z.CIMTextSymbol.height)),{lineGapType:a,lineGap:n}=t,o=a?Pt(a,D(n),s):0,l=t.horizontalAlignment??z.CIMTextSymbol.horizontalalignment,h=t.verticalAlignment??z.CIMTextSymbol.verticalalignment,c="CIMBackgroundCallout"===t.callout?.type,m=at(r.glyphMosaicItems,{scale:s/it,angle:D(t.angle),xOffset:D(t.offsetX),yOffset:D(t.offsetY),horizontalAlignment:l,verticalAlignment:h,maxLineWidth:ot(t.lineWidth),lineHeight:et*Math.max(.25,Math.min(o||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!1,hasBackground:c}),f=this.reverseScaleText(1);for(const u of m.glyphs){const t=u.offsets,e=[[t.topLeft[0]*f,-t.topLeft[1]*f],[t.topRight[0]*f,-t.topRight[1]*f],[t.bottomRight[0]*f,-t.bottomRight[1]*f],[t.bottomLeft[0]*f,-t.bottomLeft[1]*f],[t.topLeft[0]*f,-t.topLeft[1]*f]];if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);P(t,[e])&&(this._earlyReturn=!0)}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,[e])&&(this._earlyReturn=!0)}}}_hitTestFill(t){let e=null;if(M(t)){const i=t;e=[[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]}else if(x(t))e=t.rings;else{if(!w(t))return;e=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]);if(P(t,e)&&(this._earlyReturn=!0),!this._earlyReturn){const i=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint();S(t,e,i)&&(this._earlyReturn=!0)}}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,e)&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=Z(),this._path??=tt("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,i,r=0){const s=g();p(s,t);const a={x:s[0],y:s[1],width:s[2]-s[0],height:s[3]-s[1]},n=this._getSvgPath();n.setAttribute("d",e);const o=n.getBBox();if("point"===this._hittestType){const t=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),s=this.reverseTransformPt(this._searchTarget[0]);let n=Math.max(o.width/a.width,o.height/a.height),l=1;const h=2*t*n;h<1&&(l=2/h,n*=l,o.x*=l,o.y*=l,o.width*=l,o.height*=l);const c=1+r*n/2,m=this._getCanvasContext(o.width+2*c,o.height+2*c);m.setTransform(l,0,0,l,-o.x+c,-o.y+c);const f=new Path2D(e);i?m.fill(f):(m.lineWidth=r*(n/l),m.stroke(f));const u=(a.width*n-o.width)/2,d=(a.height*n-o.height)/2,g=Math.floor((s[0]-a.x-t)*n-u+c),p=Math.floor((a.height-(s[1]-a.y)-t)*n+d+c),_=Math.ceil(2*t*n),y=Math.ceil(2*t*n),P=m.getImageData(g,p,_,y).data;for(let e=3;e<P.length;e+=4)if(P[e]>127.5)return void(this._earlyReturn=!0)}else{const t=[[a.x,a.y],[a.x,a.y+a.height],[a.x+a.width,a.y+a.height],[a.x+a.width,a.y],[a.x,a.y]],e=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;if(y(e,[t]))return void(this._earlyReturn=!0)}}_hitTestStroke(t,e){let i=null;if(M(t)){const e=t;i=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(x(t))i=t.rings;else{if(!w(t))return;i=t.paths}if("point"===this._hittestType){const t=this.reverseTransformPt(this._searchTarget[0]),r=D(e,z.CIMSolidStroke.width)*this.geomUnitsPerPoint(),s=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint();S(t,i,r/2+s)&&(this._earlyReturn=!0)}else{const t=this.isEmbedded()?this._searchTarget.map(t=>this.reverseTransformPt(t)):this._searchTarget;y(t,i)&&(this._earlyReturn=!0)}}_resetHittest(){this.setTransform(),this._hittestType="point",this._searchTarget=[],this._searchDistPoint=0,this._textInfo=null}}class gt extends ft{constructor(t,e,i,r){super(e,i),this._applyAdditionalRenderProps=r,this._colorSubstitutionHelper=new C,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else if(M(t))this._buildPath(yt(t).rings,!0);else{if(!b(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const i=this._ctx;i.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",i.fill("evenodd")}drawSolidStroke(t,e,i,r,s,a){if(!t||!e||0===i)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!1);else{if(!M(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(yt(t).rings,!0)}const n=this._ctx;n.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",n.lineWidth=Math.max(this.transformSize(i),ht),this._setCapStyle(r),this._setJoinStyle(s),n.miterLimit=a,n.stroke()}pushClipPath(t){if(this._ctx.save(),x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else{if(!M(t))return;this._buildPath(yt(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:i,url:r,tintColor:s}=t,a=D(t.scaleX,1),n=this._resourceManager.getResource(r);if(null==n)return;let o=e*(n.width/n.height),l=e;e||(o=n.width,l=n.height);const h=G(r)||"src"in n&&G(n.src);let c="getFrame"in n?L(n):n;i&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,i)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),g=this._ctx;g.save(),g.setTransform({m11:a*d*f,m12:a*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),g.drawImage(c,-o/2,-l/2,o,l),g.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new j);const i=St(t,this.transformSize(a(1))),r=this._textRasterizer.rasterizeText(e,i);if(!r)return;const{size:s,anchorX:n,anchorY:o,canvas:l}=r,h=s[0]*(n+.5),c=s[1]*(o-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),g=1;m.save(),m.setTransform({m11:g*u,m12:g*d,m21:-g*d,m22:g*u,m41:f[0]-g*h,m42:f[1]+g*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:i,height:r,offsetX:s,offsetY:a,rotation:n,scaleX:o,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(x(t))this._buildPath(t.rings,!0);else if(w(t))this._buildPath(t.paths,!0);else if(M(t))this._buildPath(yt(t).rings,!0);else{if(!b(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=G(h)||"src"in c&&G(c.src);let u,d="getFrame"in c?L(c):c;if(i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);n||(n=0),s?s*=t:s=0,a?a*=t:a=0,r&&(r*=t);const e=r?r/c.height:1,i=o&&r?o*r/c.width:1;if(0!==n||1!==e||1!==i||0!==s||0!==a){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,a).scaleSelf(i,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,i){if(!t)return;let{colorSubstitutions:r,capStyle:s,joinStyle:a,miterLimit:o,tintColor:l,url:h,width:c}=i;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(x(t))f=t.rings;else if(w(t))f=t.paths;else{if(!M(t))return b(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=yt(t).rings}c||(c=m.width);const u=G(h)||"src"in m&&G(m.src);let d="getFrame"in m?L(m):m;r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const g=Math.max(this.transformSize(n(c)),.5),p=g/d.width,_=this._ctx,y=_.createPattern(d,"repeat-y");let P,S;_.save(),this._setCapStyle(s),this._setJoinStyle(a),void 0!==o&&(_.miterLimit=o),_.lineWidth=g;for(let n of f)if(n=e(n),wt(n),n&&!(n.length<=1)){P=this.transformPt(n[0]);for(let t=1;t<n.length;t++){S=this.transformPt(n[t]);const e=_t(P,S),i=new DOMMatrix;i.translateSelf(0,P[1]-g/2).scaleSelf(p,p,1).rotateSelf(0,0,90-e),y.setTransform(i),_.strokeStyle=y,_.beginPath(),_.moveTo(P[0],P[1]),_.lineTo(S[0],S[1]),_.stroke(),P=S}}_.restore()}drawGradientFill(t,e){if(!t)return;let i;if(x(t))i=t.rings;else if(w(t))i=t.paths;else{if(!M(t))return void ct().error("Unable to draw gradient fill");i=yt(t).rings}this._buildPath(i,!0);const{angle:s,gradientMethod:a,gradientSize:o,gradientSizeUnits:l}=e,g=z.CIMGradientFill,p=e.gradientType??g.gradientType,_=-r(s??0),y=h();for(const r of i){const t=r?r.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(r[e]);"Linear"!==a&&"Rectangular"!==a||(t=U(t,-_)),c(y,t)}}const[P,S,b,T]=y,k=this._ctx;switch(k.save(),a){case"Buffered":ct().error(`Gradient method "${a}" currently unsupported.`);break;case"Linear":{const t=(S+T)/2,i="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(b-P),[r,s]="Discrete"===p?[b,b-i]:[P+i,P],a=U([r,t],_),h=U([s,t],_),c=k.createLinearGradient(a[0],a[1],h[0],h[1]);F(c,e),k.fillStyle=c,k.fill("evenodd");break}case"Circular":{const t=m(y),i=d(y)/2,r="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*i,[s,a]="Discrete"===p?[i,i-r]:[r,0],h=k.createRadialGradient(t[0],t[1],s,t[0],t[1],a);F(h,e),k.fillStyle=h,k.fill("evenodd");break}case"Rectangular":{const i=m(y),r=i[0],s=i[1],a=U(i,_),h=(i,r,s,n,o,l,h,c)=>{k.save(),this.pushClipPath(t);const m=U([o,l],_),f=U([h,c],_);k.beginPath(),k.moveTo(a[0],a[1]),k.lineTo(m[0],m[1]),k.lineTo(f[0],f[1]),k.lineTo(a[0],a[1]),k.clip();const u=U([i,r],_),d=U([s,n],_),g=k.createLinearGradient(u[0],u[1],d[0],d[1]);F(g,e),k.fillStyle=g,k.fill("evenodd"),k.restore()};let c="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(f(y)/2),[d,x]="Discrete"===p?[b,b-c]:[r+c,r];h(d,s,x,s,b,S,b,T),[d,x]="Discrete"===p?[P,P+c]:[r-c,r],h(d,s,x,s,P,T,P,S),c="Absolute"===l?this.transformSize(n(o)):H(o,g.gradientSize)*(u(y)/2);let[w,M]="Discrete"===p?[T,T-c]:[s+c,s];h(r,w,r,M,b,T,P,T),[w,M]="Discrete"===p?[S,S+c]:[s-c,s],h(r,w,r,M,P,S,b,S);break}}k.restore()}drawGradientStroke(t,i){const{capStyle:r,gradientMethod:s,gradientSize:a,gradientSizeUnits:o,joinStyle:l,miterLimit:h,width:c}=i;if(!t||0===c)return;let m;if(x(t))m=t.rings;else if(w(t))m=t.paths;else{if(!M(t))return void ct().error("Unable to draw gradient stroke");m=yt(t).rings}const f=i.gradientType??z.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(n(c)),.5),d=this._ctx;let g,p;d.save(),this._setCapStyle(r),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const i=p[0]-g[0],r=p[1]-g[1];t+=Math.sqrt(i*i+r*r),g=p}const r="Absolute"===o?this.transformSize(n(a)):H(a,z.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;g=this.transformPt(_[0]);for(let e=1;e<_.length;e++){p=this.transformPt(_[e]);const a=p[0]-g[0],n=p[1]-g[1],o=Math.sqrt(a*a+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=U([a/o,n/o],-Math.PI/2),i=u/2,s="Discrete"===f?i:r-i;h=(g[0]+p[0])/2+t*s,c=(g[1]+p[1])/2+e*s,m=h-t*r,y=c-e*r;break}case"AlongLine":{const e=a/o,i=n/o;"Discrete"===f?(h=g[0]-e*l,c=g[1]-i*l,m=h+e*r,y=c+i*r):(m=g[0]+e*(t-l),y=g[1]+i*(t-l),h=m-e*r,c=y-i*r);break}default:return ct().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);F(P,i),d.strokeStyle=P,d.beginPath(),d.moveTo(g[0],g[1]),d.lineTo(p[0],p[1]),d.stroke(),l+=o,g=p}}d.restore()}_buildPath(t,e){const i=this._ctx;if(i.beginPath(),t)for(const r of t){const t=r?r.length:0;if(t>1){let s=this.transformPt(r[0]);i.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(r[e]),i.lineTo(s[0],s[1]);e&&i.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function pt(t,e,i){let r=D(t.separation,z.CIMHatchFill.separation)*i,s=D(t.rotation);if(0===r)return null;r<0&&(r=-r);let a=0;const n=.5*r;for(;a>n;)a-=r;for(;a<-n;)a+=r;const o=g();p(o,e),o[0]-=n,o[1]-=n,o[2]+=n,o[3]+=n;const l=[[o[0],o[1]],[o[0],o[3]],[o[2],o[3]],[o[2],o[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const h=Math.cos(s*lt),c=Math.sin(s*lt),m=-r*c,f=r*h;let u,d,_,y;a=D(t.offsetX)*i*c-D(t.offsetY)*i*h,u=_=Number.MAX_VALUE,d=y=-Number.MAX_VALUE;for(const g of l){const t=g[0],e=g[1],i=h*t+c*e,r=-c*t+h*e;u=Math.min(u,i),_=Math.min(_,r),d=Math.max(d,i),y=Math.max(y,r)}_=Math.floor(_/r)*r;let P=h*u-c*_-m*a/r,S=c*u+h*_-f*a/r,x=h*d-c*_-m*a/r,w=c*d+h*_-f*a/r;const M=1+Math.round((y-_)/r),b=[];for(let g=0;g<M;g++)P+=m,S+=f,x+=m,w+=f,b.push([[P,S],[x,w]]);return{paths:b}}function _t(t,e){const i=e[0]-t[0],r=e[1]-t[1];return 180/Math.PI*Math.atan2(r,i)}const yt=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,Pt=(t,e,i)=>{switch(t){case"ExtraLeading":return 1+e/i;case"Multiple":return e;case"Exact":return e/i}};function St(e,i=1){const r=B(e),s=X(e.fontStyleName),a=e.fontFamilyName??t,{weight:n,style:o}=s,l=i*(e.height||5),h=J(e.horizontalAlignment),c=N(e.verticalAlignment),m=O(e),f=O(e.haloSymbol),u=null!=f?i*(e.haloSize??0):0,d=q(e.symbol),g=i*(V(e.symbol)||0),p="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=O(p),y=V(p),P=q(p);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:a,style:W(o),weight:Y(n),decoration:r},outline:{size:g||0,color:d},halo:{size:u||0,color:f,style:o},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const xt=1e-4;function wt(t){let e,i,r,s,a,n=t[0],o=1;for(;o<t.length;)e=t[o][0]-n[0],i=t[o][1]-n[1],s=0!==e?i/e:Math.PI/2,void 0!==r&&Math.abs(s-r)<=xt?(t.splice(o-1,1),n=a):(a=n,n=t[o],o++),r=s}export{ft as CIMSymbolDrawHelper,gt as CanvasDrawHelper,ut as EnvDrawHelper,dt as HittestDrawHelper,mt as Transformation,lt as cDegToRad,Pt as lineGapType2LineHeight};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";let o=class extends t{constructor(e){super(e),this.computedOpacity=1,this.computedVisible=!0,this.opacity=1,this.visible=!0,this._fadeOutResolver=null,this._fadeInResolver=null}get transitioning(){return this.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import has from"../../../../core/has.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";let o=class extends t{constructor(e){super(e),this.computedOpacity=1,this.computedVisible=!0,this.opacity=1,this.visible=!0,this._fadeOutResolver=null,this._fadeInResolver=null}get transitioning(){return this._targetOpacity!==this.computedOpacity}get _targetOpacity(){return!this.visible||this._fadeOutResolver?0:this.opacity}endTransition(){this._fadeInResolver?.resolve(),this._fadeOutResolver?.resolve(),this._fadeInResolver=this._fadeOutResolver=null,this.computedOpacity=this._targetOpacity}fadeIn(){return this._fadeInResolver||(this.opacity=1,this.computedOpacity=0,this._fadeOutResolver?.resolve(),this._fadeOutResolver=null,this._fadeInResolver=Promise.withResolvers()),this._fadeInResolver.promise}fadeOut(){return this._fadeOutResolver||(this.opacity=0,this._fadeInResolver?.resolve(),this._fadeInResolver=null,this._fadeOutResolver=Promise.withResolvers()),this._fadeOutResolver.promise}transitionStep(e,t){const i=has("mapview-transitions-duration"),s=i?1/i:0,o=this._targetOpacity;if(0===s)this.computedOpacity=o,this.computedVisible=this.visible;else{const t=this.computedOpacity;if(t===o)this.computedVisible=this.visible;else{const i=e*s;this.computedOpacity=t>o?Math.max(o,t-i):Math.min(o,t+i),this.computedVisible=this.computedOpacity>0}}this.transitioning||(this._fadeInResolver?.resolve(),this._fadeOutResolver?.resolve(),this._fadeOutResolver=this._fadeInResolver=null)}};e([i()],o.prototype,"computedOpacity",void 0),e([i()],o.prototype,"computedVisible",void 0),e([i()],o.prototype,"opacity",void 0),e([i()],o.prototype,"visible",void 0),e([i()],o.prototype,"transitioning",null),e([i()],o.prototype,"_fadeOutResolver",void 0),e([i()],o.prototype,"_fadeInResolver",void 0),o=e([s("esri.views.2d.engine.transitions.FadeTransition")],o);export{o as FadeTransition};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as s}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as i,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as r,RESHUFFLING_EXEMPT_DRAW_CALLS as a,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as o}from"./definitions.js";import n from"./DisplayEntity.js";import{TileCpuState as h}from"./TileCpuState.js";import{TileGpuState as u}from"./TileGpuState.js";import{debugMeshDataInfo as p}from"./mesh/meshDebugUtils.js";import
|
|
2
|
+
import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{AFeatureTile as s}from"./AFeatureTile.js";import{RESHUFFLING_EXEMPT_MEMORY_BYTES as i,RESHUFFLING_TARGET_MEMORY_EFFICIENCY as r,RESHUFFLING_EXEMPT_DRAW_CALLS as a,RESHUFFLING_TARGET_DRAW_EFFICIENCY as d,tileSize as o}from"./definitions.js";import n from"./DisplayEntity.js";import{TileCpuState as h}from"./TileCpuState.js";import{TileGpuState as u}from"./TileGpuState.js";import{debugMeshDataInfo as p}from"./mesh/meshDebugUtils.js";import m from"./util/Reader.js";import{deserializeList as l}from"./util/serializationUtils.js";const g=()=>e.getLogger("esri.views.2d.engine.webgl.FeatureTile");class c extends s{constructor(e,s,i,r,a){super(e,s,i,r),this._fader=a,this._cpuState=new h,this._gpuState=new u,this._requiresRefresh=!1,this._ended=!1,this._geometryInvalidated=!1,this.decluttering=!1,this.presenting=!1,this.visible=!0,this.transforms.tileUnitsToPixels=t()}destroy(){super.destroy();const e=this._cpuState.takeMetrics();this._fader?.removeFeatureTileMetrics(this,e),this._cpuState.destroy(),this._gpuState.destroy()}beforeRender(e){super.beforeRender(e),this._needsReshuffle&&e.reshuffleManager.schedule(this)}get symbols(){const e=new Map;for(const t of this._cpuState.metrics)e.get(t.labelClassId)||e.set(t.labelClassId,[]),e.get(t.labelClassId).push(t);return e}get id(){return this.key.id}get hasData(){return!!this._cpuState.meshes.size}get requiresRefresh(){return this._requiresRefresh}get ended(){return this._ended}get hasAnimations(){return this._cpuState.hasAnimations}get hasMetrics(){return this._cpuState.metrics.length>0}get entityIds(){return this._cpuState.getEntityObjectIds()}get usedMemory(){return this._cpuState.usedMemory+this._gpuState.usedMemory}get isReady(){return this.presenting}getDisplayList(){return this._gpuState.displayList}getMesh(e){const t=this._gpuState.getMesh(e);if(null==t)throw new Error(`InternalError: Unable to find VAO for instance: ${e}`);return t}getSortKeys(e){return this._cpuState.getSortKeys(e)}clearCpuState(){const e=this._cpuState.takeMetrics();this._fader?.removeFeatureTileMetrics(this,e),this._cpuState.destroy(),this._cpuState=new h,this._geometryInvalidated=!0,this._ended=!1}update(e){switch(e.type){case"append":this._onAppendMessage(e);break;case"update":this._onUpdateMessage(e)}e.objectIdMap&&this._cpuState.mergeObjectIdMap(e.objectIdMap),this._aggregateMemoryStats(),e.end&&(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.end`),this._ended=!0),this._geometryInvalidated=!0}reshuffle(e=!1){this.destroyed||(this._geometryInvalidated=!0,this._cpuState.reshuffle(e),this._aggregateMemoryStats(),has("esri-2d-update-debug")&&g().info(`Tile ${this.key.id} was reshuffled.`))}upload(e,t){this.presenting&&(this.hasMetrics&&(this._cpuState.setMetricVisibility(),this._gpuState.uploadVisibility(this._cpuState)),this._geometryInvalidated&&(this._geometryInvalidated=!1,this._cpuState.prepareForUpload(t),this._aggregateMemoryStats(),this._gpuState.uploadGeometry(this,e,t,this._cpuState)))}copyPixelBufferedEntitesFrom(e,t,s,i){const r=s*o,a=i*o,d=this._cpuState.copyPixelBufferedEntitiesFrom(e._cpuState,t,r,a);this._geometryInvalidated||=d}_onAppendMessage(e){if(has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.append`,{append:p(e?.append)}),!e.append)return;this._requiresRefresh||=e.append.requiresRefresh;const t=l(new m(e.append.entities),n),{insertedMetrics:s}=this._cpuState.append(t,e.append.data,!1,this);this._fader?.insertFeatureTileMetrics(this,s)}_onUpdateMessage(e){has("esri-2d-update-debug")&&console.debug(`Tile[${this.key.id}] FeatureTile.update`,{isPixelBuffer:e.isPixelBuffer,modify:p(e.modify),remove:e.remove});const t=l(new m(e.modify.entities),n),s=t.map(e=>e.id),i=e.isPixelBuffer??!1,r=[...e.remove,...s];if(i){const e=this._cpuState.removeByIdsFromBuffer(r);this._fader?.removeFeatureTileMetrics(this,e)}else{const e=this._cpuState.removeByIds(r);this._fader?.removeFeatureTileMetrics(this,e)}const{insertedMetrics:a}=this._cpuState.append(t,e.modify.data,i,this);this._fader?.insertFeatureTileMetrics(this,a)}_aggregateMemoryStats(){this.debugInfo.memory.bytesUsed=0,this.debugInfo.memory.bytesReserved=0;for(const e of this._cpuState.meshes.values())this.debugInfo.memory.bytesUsed+=e.memoryStats.bytesUsed,this.debugInfo.memory.bytesReserved+=e.memoryStats.bytesReserved}get _needsReshuffle(){if(this.destroyed)return!1;const{bytesUsed:e,bytesReserved:t}=this.debugInfo.memory,s=e/t,{minOrderedLength:o,length:n}=this.debugInfo.display;return t>i&&s<r||n>a&&o/n<d}}export{c as FeatureTile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as d,textureBindingSpriteAtlas as g,textureBindingGlyphAtlas as f}from"./definitions.js";import y from"./GlyphMosaic.js";import M from"./GlyphSource.js";import _ from"./Rect.js";import I from"./SDFConverter.js";import w from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as S}from"./urlUtils.js";import{getCIMMarkerPlacementHash as z,isSVGImage as T}from"./Utils.js";import{AnimatableTextureResource as C}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as R}from"./animations/store/AnimationStore.js";const x="arial-unicode-ms-regular",b=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),$=()=>s.getLogger("esri.views.MapView"),v=(e,t,r)=>$().error(new i(e,t,r)),j=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class A{constructor(r){this._requestRender=r,this._resourceManager=new l,this._invalidFonts=new Set,this._sdfConverter=new I(d),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{a(r);try{return await t(e,{responseType:"image",signal:r})}catch(s){if(!n(s))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new R,this._spriteMosaic=new w(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return v("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new _(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return v("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t.mosaicItem);return e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0]})}getMosaicTexture(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{texture:r.texture,unit:"sprite"===r.type?g:f}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),null)}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,f),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return v("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:i,textString:s}=e,a=r(i),n=this._invalidFonts.has(a),o=!!has("esri-2d-force-complex-shaping"),c=!!has("esri-2d-complex-shaping")&&b.test(s),h=P.has(i.family),l=o||c||h,u=n?x:a;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(u).catch(()=>{});let p=await this._glyphMosaic.getGlyphItems(s,l,u,t);return p||(j(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),p=await this._glyphMosaic.getGlyphItems(s,l,x,t)),p}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${z(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(S(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=h(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t={type:"CIMPointSymbol",symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},F(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[d,d],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},F(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=F(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},h=0);const l=new C(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(N(s)||O(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(T(s))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,h);return this._addItemToMosaic(t,l,{type:"static",data:p},F(e),u,!1)}catch(v){if(!n(v))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${v.message}`);throw v}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function F(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),N=e=>e&&(e.includes(".gif")||G(e)),B=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||B(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{A as default};
|
|
2
|
+
import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as d,textureBindingSpriteAtlas as g,textureBindingGlyphAtlas as f}from"./definitions.js";import y from"./GlyphMosaic.js";import M from"./GlyphSource.js";import _ from"./Rect.js";import I from"./SDFConverter.js";import w from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as S}from"./urlUtils.js";import{getCIMMarkerPlacementHash as z,isSVGImage as T}from"./Utils.js";import{AnimatableTextureResource as C}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as R}from"./animations/store/AnimationStore.js";const x="arial-unicode-ms-regular",b=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=new Set(["Noto Sans Khmer","Noto Sans Lao","Noto Sans Myanmar","Noto Sans Thai"]),$=()=>s.getLogger("esri.views.MapView"),v=(e,t,r)=>$().error(new i(e,t,r)),j=(e,t="")=>$().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class A{constructor(r){this._requestRender=r,this._resourceManager=new l,this._invalidFonts=new Set,this._sdfConverter=new I(d),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{a(r);try{return await t(e,{responseType:"image",signal:r})}catch(s){if(!n(s))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new R,this._spriteMosaic=new w(2048,2048,500),this._glyphSource=new M(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return v("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new _(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return v("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);return e?.glyphs.forEach(e=>this._setTextureBinding(1,e.mosaicItem)),e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0]})}getMosaicTexture(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{texture:r.texture,unit:"sprite"===r.type?g:f}:(v("mapview-invalid-resource",`Unable to find resource for ${t}`),null)}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,f),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return v("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=k.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:i,textString:s}=e,a=r(i),n=this._invalidFonts.has(a),o=!!has("esri-2d-force-complex-shaping"),c=!!has("esri-2d-complex-shaping")&&b.test(s),h=P.has(i.family),l=o||c||h,u=n?x:a;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(u).catch(()=>{});let p=await this._glyphMosaic.getGlyphItems(s,l,u,t);return p||(j(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),p=await this._glyphMosaic.getGlyphItems(s,l,x,t)),p}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${z(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(S(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=h(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url&&"animated"!==e.type||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t={type:"CIMPointSymbol",symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},F(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[d,d],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},F(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=F(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},h=0);const l=new C(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(N(s)||O(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return v("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(T(s))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,h);return this._addItemToMosaic(t,l,{type:"static",data:p},F(e),u,!1)}catch(v){if(!n(v))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${v.message}`);throw v}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function F(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const G=e=>null!=e&&e.startsWith("data:image/gif"),N=e=>e&&(e.includes(".gif")||G(e)),B=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||B(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import
|
|
2
|
+
import has from"../../../../core/has.js";import e from"./DisplayEntity.js";import{ReshufflePlan as t}from"./ReshufflePlan.js";import{LabelMetric as s}from"./collisions/LabelMetric.js";import{CpuMeshData as i}from"./cpuMapped/CpuMeshData.js";import r from"./util/Reader.js";import{deserializeList as n}from"./util/serializationUtils.js";class o{constructor(){this.meshes=new Map,this.entityIndex=new Map,this.entityIds=new Set,this.entityIdsFromBuffer=new Set,this.entities=[],this.metrics=[],this.objectIdMap=null}destroy(){for(const e of this.meshes.values())e.destroy();if(this.metrics.length)throw new Error("InternalError: Leaking metrics. Was `takeMetrics` called before removal?");this.meshes.clear(),this.entityIndex.clear(),this.entityIds.clear(),this.entityIdsFromBuffer.clear(),this.entities=[],this.objectIdMap=null}get usedMemory(){let t=0;for(const e of this.meshes.values())t+=e.usedMemory;if(this.entities.length){let s=0;const i=Math.min(this.entities.length,10);for(let e=0;e<i;e++)s+=this.entities[0].records.length;const r=s/i;t+=e.estimateMemory(r)*this.entities.length,t+=4*this.entities.length}return t+=25*this.entityIndex.size,t+=18*this.entityIds.size,t+=25*this.entityIdsFromBuffer.size,this.objectIdMap&&(t+=25*this.entities.length),t}get hasAnimations(){return!!this.objectIdMap}getEntityObjectIds(){return this.objectIdMap?this.entities.map(({id:e})=>({objectId:this.objectIdMap[e],displayId:e})):[]}getMesh(e){return this.meshes.get(e)}getSortKeys(e){const t=new Map;for(const{id:s,sortKey:i}of this.entities)if(e.has(s)&&t.set(s,i),t.size===e.size)break;return t}takeMetrics(){const e=this.metrics;return this.metrics=[],e}mergeObjectIdMap(e){this.objectIdMap??={};for(const t in e)this.objectIdMap[t]=e[t]}ensureMesh(e,t,s){let r=this.meshes.get(e);return null==r&&(r=new i(t,s),this.meshes.set(e,r)),r}append(e,t,s,i){if(!e.length)return{insertedMetrics:[]};this._removeDuplicatedBufferedEntities(e);const{offsetsByInstance:r,insertedMetrics:n}=this._insertVertexData(t,i);for(const o of e){for(const e of o.records)e.updateBaseOffsets(r.get(e.instanceId));s?this._tryInsertBufferedEntity(o):this._insertEntity(o)}return{insertedMetrics:n}}removeByIds(e){if(0===e.length)return[];const t=new Set(e),s=[];for(const r of this.entities)t.has(r.id)?(this._remove(r),this.entityIndex.delete(r.id)):s.push(r);this.entities=s;const i=this.metrics.filter(e=>t.has(e.displayId));return this.metrics=this.metrics.filter(e=>!t.has(e.displayId)),i}setMetricVisibility(){if(0!==this.metrics.length)for(const e of this.metrics){const t=this.entityIndex.get(e.id);if(null==t)throw new Error("InternalError: expected to find entity for label");const s=t.records[e.recordStart];if(null==s)throw new Error("InternalError: expected to find label record");const i=this.getMesh(s.instanceId);if(!i)throw new Error("InternalError: expected to find label mesh");if(!e.uniqueSymbol)throw new Error("InternalError: expected to find uniqueSymbol");const r=e.uniqueSymbol.show&&e.selectedForRendering;i.setRecordVisibility(t.records,e,r?0:255,t.id)}}copyPixelBufferedEntitiesFrom(t,s,i,r){let n=!1;for(const o of t.entities){let h=null;for(const d of o.records){if(!(d.overlaps&s))continue;n||=!0;const c=t.getMesh(d.instanceId),f=this.ensureMesh(d.instanceId,c.layout,c.useVisibility).copyRecordFrom(c,d,i,r);null==h&&(h=new e(o.id,o.sortKey),this.entityIdsFromBuffer.add(o.id),this.entityIndex.set(h.id,h),this.entities.push(h)),h.records.push(f)}}return n}removeByIdsFromBuffer(e){return this.removeByIds(e.filter(e=>this.entityIdsFromBuffer.has(e)))}reshuffle(e=!1){const s=new Map;for(const i of this.entities)for(const r of i.records){const i=r.instanceId;let n=s.get(i);null==n&&(n=new t(e),s.set(i,n)),n.copyRecord(r)}for(const[t,i]of s)this.getMesh(t).reshuffle(i)}prepareForUpload(e){this.entities.sort((e,t)=>{const s=e.sortKey,i=t.sortKey;return s===i?e.id-t.id:s-i}),0===e&&this.reshuffle(!0)}_insertVertexData(e,t){const i=new Map,o=[];for(const h of e){const{instanceId:e,layout:d}=h,c=d.attributes.some(e=>"visibility"===e.name),f=this.ensureMesh(e,d,c).append(h);if(h.metrics){const e=n(new r(h.metrics),s)??[];o.push(...this._insertMetrics(e,t))}i.set(e,f)}return{offsetsByInstance:i,insertedMetrics:o}}_insertMetrics(e,t){for(const s of e)s.tile=t;return this.metrics.push(...e),e}_insertEntity(e){has("esri-2d-update-debug")&&this.entityIds.has(e.id)&&console.error(`insertEntity: Already have entityId ${e.id}`),this.entityIds.add(e.id),this.entityIndex.set(e.id,e),this.entities.push(e)}_tryInsertBufferedEntity(e){this.entityIds.has(e.id)?this._removeRecordsFromMesh(e.records):(this.entityIdsFromBuffer.add(e.id),this.entityIndex.set(e.id,e),this.entities.push(e))}_removeDuplicatedBufferedEntities(e){if(!this.entityIdsFromBuffer.size)return;const t=[];for(const s of e)this.entityIdsFromBuffer.has(s.id)&&t.push(s.id);this.removeByIds(t)}_remove(e){this._removeRecordsFromMesh(e.records),this.entityIds.delete(e.id),this.entityIdsFromBuffer.delete(e.id)}_removeRecordsFromMesh(e){for(const t of e){const{instanceId:e,indexStart:s,indexCount:i,vertexStart:r,vertexCount:n}=t;this.getMesh(e)?.remove(s,i,r,n)}}}export{o as TileCpuState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as i}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as s}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as r}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as n}from"../../../definitions.js";import{AAnimatedMeshWriter as o}from"./AnimatedMeshWriter.js";import{angle as a,sizing as c,animationPointerAndBaseSizeAndReferenceSize as l,uv as m,offset as d,pos as p,bitset as h,id as u,lineLength as f,value1Position2Value2 as x,zoomRange as y}from"./attributes.js";import{createComputedAnimatedMeshParams as P}from"./ComputedAnimatedParams.js";const M=64,g=64,v=2;class b extends o{get vertexSpec(){return{createComputedParams:P,optionalAttributes:{zoomRange:y,value1Position2Value2:x,lineLength:f},attributes:{id:u,bitset:h,pos:p,offset:d.marker,uv:m.marker,animationPointerAndBaseSizeAndReferenceSize:l,sizing:c,angle:a}}}_write(e,{target:i,effectGeometry:s}){const r=this.evaluatedMeshParams.sprite,{textureBinding:n}=r;e.recordStart(this.instanceId,this.attributeLayout,n);const o=i.getDisplayId();if(this.shift&&"esriGeometryPolyline"===i.geometryType){if(!s){const s=t.fromFeatureSetReaderCIM(i);s&&this._writeParticles(e,i,s)}}else if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,i);else if("esriGeometryPolygon"===i.geometryType){const t=i.readCentroidForDisplay();if(!t)return;const[s,r]=t.coords;this._writeQuad(e,o,s,r)}else if("esriGeometryPoint"===i.geometryType){const t=i.readXForDisplay(),s=i.readYForDisplay();this._writeQuad(e,o,t,s)}else{const t=i.readGeometryForDisplay();t&&t.forEachVertex((t,i)=>{this._writeQuad(e,o,t,i)})}e.recordEnd()}_writePlacedMarkers(i,n){const o=t.fromFeatureSetReaderCIM(n)?.clone();if(!o)return;const a=-1,c=r.getPlacement(o,a,this.evaluatedMeshParams.placement,e(1),i.id);if(!c)return;const l=n.getDisplayId();let m=c.next(),d=null;for(;null!=m;){const e=m.tx,t=-m.ty;if(Math.abs(e)>s||Math.abs(t)>s){m=c.next();continue}const r=-m.getAngle();i.recordBounds(e,t,M,g),this.shift?d&&this._writeQuad(i,l,d[0],d[1],void 0,r):this._writeQuad(i,l,e,t,void 0,r),d=[e,t],m=c.next()}}_writeParticles(e,t,s){const r=t.getDisplayId(),n=Math.max(this.evaluatedMeshParams.baseSize,this.evaluatedMeshParams.baseSize),o=i(s,2*n,!1);if(!o)return;const{placement:a}=this.evaluatedMeshParams,c=w(o,a?.placePerPart??!1);for(const{particles:i,distance:l}of c){const t=t=>{for(const s of i){const{a:i,b:n}=s;this._writeQuad(e,r,i.position[0],i.position[1],[i.distance-t,n.position[0],n.position[1],n.distance-t],this.evaluatedMeshParams.angleToLine?Math.atan2(i.direction[1],i.direction[0]):0,l,!0)}};if(!a||"placementTemplate"in a||"CIMMarkerPlacementOnVertices"===a.type){let e;if(a&&"CIMMarkerPlacementOnVertices"!==a.type)e=a.placementTemplate;else{e=[0];for(const t of i){const{a:i,b:s}=t,r=i.position[0]-s.position[0],n=i.position[1]-s.position[1],o=Math.sqrt(r*r+n*n);e.push(o)}}let s=-1*l;for(;s<(1+v/2)*l;)for(const i of e)s+=i,t(s)}else"CIMMarkerPlacementAtExtremities"===a.type?"JustBegin"===a.extremityPlacement?t(1):"JustEnd"===a.extremityPlacement?(t(l-1),t(-1)):"Both"===a.extremityPlacement&&(t(1),t(l-1)):"CIMMarkerPlacementOnLine"===a.type&&("LineBeginning"===a.relativeTo?t(1):"LineEnd"===a.relativeTo?(t(l-1),t(-1)):"LineMiddle"===a.relativeTo&&t(l/2))}}_writeQuad(e,t,i,s,r,o=0,a=0,c=!1){const l=this.evaluatedMeshParams.sprite,{rect:m}=l,d=m.x+n,p=m.y+n,h=m.x+m.width-n,u=m.y+m.height-n,f=e.vertexCount();c||e.recordBounds(i,s,M,M);const x={texXmin:d,texYmin:p,texXmax:h,texYmax:u,value1Position2Value2:r,angle:o,lineLength:a};for(let n=0;n<4;n++)this._writeVertex(e,t,i,s,x);e.indexEnsureSize(6),e.indexWrite(f),e.indexWrite(f+1),e.indexWrite(f+2),e.indexWrite(f+1),e.indexWrite(f+3),e.indexWrite(f+2)}}function w(e,t){const i=[];if(t)for(;e.nextPath();){const t=[];for(;e.nextPoint();)t.push([e.x,e.y]);const s=[];let r=0;for(let e=1;e<t.length;e++){const i=t[e-1],n=t[e],o=n[0]-i[0],a=n[1]-i[1],c=Math.sqrt(o*o+a*a),l=o/c,m=a/c;s.push({a:{position:i,distance:r,direction:[l,m]},b:{position:n,distance:r+c,direction:[l,m]}}),r+=c}s.length>0&&i.push({particles:s,distance:r})}else{const t=[];let s=0;for(;e.nextPath();){const i=[];for(;e.nextPoint();)i.push([e.x,e.y]);for(let e=1;e<i.length;e++){const r=i[e-1],n=i[e],o=n[0]-r[0],a=n[1]-r[1],c=Math.sqrt(o*o+a*a),l=o/c,m=a/c;t.push({a:{position:r,distance:s,direction:[l,m]},b:{position:n,distance:s+c,direction:[l,m]}}),s+=c}}t.length>0&&i.push({particles:t,distance:s})}return i}class C extends b{constructor(){super(...arguments),this.shift=!1}}class _ extends b{constructor(){super(...arguments),this.shift=!0}}export{C as AnimatedMarkerMeshWriter,_ as AnimatedMarkerShiftMeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as m,processColorInput as u,getMinMaxZoom as d,getBitMask as p}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as f}from"./markerConstants.js";import{MeshWriter as y}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const x=3.14159265359/180,P=128/Math.PI;function g(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return g(e*P,256)}function k(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*x*-n),l}const v={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:M.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=p(f.bitset.isSDF)),1===t&&(a|=p(f.bitset.isMapAligned)),r&&(a|=p(f.bitset.scaleSymbolsProportionally)),o&&(a|=p(f.bitset.overrideOutlineColor)),s&&(a|=p(f.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=k(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[m(s,128),m(r,128),m(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class _ extends y{constructor(){super(...arguments),this.vertexSpec=v}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,{target:t,effectGeometry:r}){const
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as m,processColorInput as u,getMinMaxZoom as d,getBitMask as p}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as f}from"./markerConstants.js";import{MeshWriter as y}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const x=3.14159265359/180,P=128/Math.PI;function g(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return g(e*P,256)}function k(e,a,i,n,c=!1){const l=s(),m=c?1:-1;return t(l),(a||i)&&r(l,l,[a,-i]),n&&o(l,l,m*x*-n),l}const v={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:M.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=p(f.bitset.isSDF)),1===t&&(a|=p(f.bitset.isMapAligned)),r&&(a|=p(f.bitset.scaleSymbolsProportionally)),o&&(a|=p(f.bitset.overrideOutlineColor)),s&&(a|=p(f.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const l=k(0,i,n,-e,c),m=-(.5+o)*t,u=-(.5-s)*r,d=[m,u],p=[m+t,u],h=[m,u+r],f=[m+t,u+r];return a(d,d,l),a(p,p,l),a(h,h,l),a(f,f,l),[d,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[m(s,128),m(r,128),m(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class _ extends y{constructor(){super(...arguments),this.vertexSpec=v}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,{target:t,effectGeometry:r,scaleFactor:o}){const s=this.evaluatedMeshParams.sprite?.textureBinding,a=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,s);const i=this.evaluatedMeshParams.minPixelBuffer,l=Math.max(this.evaluatedMeshParams.computedWidth,i),m=Math.max(this.evaluatedMeshParams.computedHeight,i),u=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,d=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,p=this.evaluatedMeshParams.offsetX+u,h=-this.evaluatedMeshParams.offsetY+d;if(null!=this.evaluatedMeshParams.placement){let s=null;if(null!=r){const e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight);if(s=n(r,2*(e*(o??1)),!1),null===s)return}this._writePlacedMarkers(e,t,s,l,m)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+p,o+h,l,m),this._writeQuad(e,a,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,s]=r.coords;e.recordBounds(o+p,s+h,l,m),this._writeQuad(e,a,o,s)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+p,o+h,l,m),this._writeQuad(e,a,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex((t,r)=>{e.recordBounds(t+p,r+h,l,m),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,a,t,r)})}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,u=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id);if(!u)return;const d=r.getDisplayId();let p=u.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=u.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,d,e,r,o),p=u.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{_ as MarkerMeshWriter,v as MarkerVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t,__param as e}from"tslib";import{location as i,option as o,uniform as s,texture as l,input as r,ComputeVertexInput as a}from"../../GraphShaderModule.js";import{Vec4 as p,Vec2 as n,Float as u,Sampler2D as d,Vec3 as m,min as y,max as h,Mat3 as c,ifElse as x,lessThan as v,equal as w,texture2D as V,clamp as f,abs as S,mix as b,distance as g,greaterThan as C,negate as M}from"../../graph/glsl.js";import{MarkerConstants as z}from"./markerConstants.js";import{FeatureVertexInput as _,AFeatureShader as R,FeatureFragmentInput as j}from"../shaders/AFeatureShader.js";import{c256ToRad as U,softEdgeRatio as
|
|
2
|
+
import{__decorate as t,__param as e}from"tslib";import{location as i,option as o,uniform as s,texture as l,input as r,ComputeVertexInput as a}from"../../GraphShaderModule.js";import{Vec4 as p,Vec2 as n,Float as u,Sampler2D as d,Vec3 as m,min as y,max as h,Mat3 as c,ifElse as x,lessThan as v,equal as w,texture2D as V,clamp as f,abs as S,mix as b,distance as g,greaterThan as C,negate as M}from"../../graph/glsl.js";import{MarkerConstants as z}from"./markerConstants.js";import{FeatureVertexInput as _,AFeatureShader as R,FeatureFragmentInput as j}from"../shaders/AFeatureShader.js";import{c256ToRad as U,softEdgeRatio as F,trueHit as N,noHit as T}from"../shaders/constants.js";import{isRectHittest as D,hittestMarkerScreenRect as q,distPointTriangle as O,xyToBarycentric as k,inTriangle as A}from"../shaders/hittestUtils.js";import{MosaicInfo as P}from"../shaders/MosaicInfo.js";import{getBit as I,getBitBool as H,rgba2float as G}from"../shaders/utils.js";import{VisualVariableColor as L}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as B}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as J}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as K}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as Q}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as W}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableOpacity as X,getVisualVariableColor as Y,getVisualVariableSize as Z,getVisualVariableRotation as $}from"../shaders/vvUtils.js";class tt extends _{}t([i(3,p)],tt.prototype,"color",void 0),t([i(4,p)],tt.prototype,"outlineColor",void 0),t([i(5,n)],tt.prototype,"offset",void 0),t([i(6,n)],tt.prototype,"textureUV",void 0),t([i(7,p)],tt.prototype,"sizing",void 0),t([i(8,u)],tt.prototype,"placementAngle",void 0),t([i(9,u)],tt.prototype,"sdfDecodeCoeff",void 0),t([i(10,n)],tt.prototype,"zoomRange",void 0);class et extends a{}t([i(11,n)],et.prototype,"offsetNextVertex1",void 0),t([i(12,n)],et.prototype,"offsetNextVertex2",void 0),t([i(13,n)],et.prototype,"textureUVNextVertex1",void 0),t([i(14,n)],et.prototype,"textureUVNextVertex2",void 0);class it extends j{}function ot(t,e,i,o){return e.multiply(t.x).add(i.multiply(t.y)).add(o.multiply(t.z))}function st(t){return t.multiply(t).divide(128)}class lt extends R{constructor(){super(...arguments),this.type="MarkerShader",this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"],textureUV:["textureUVNextVertex1","textureUVNextVertex2"]}}vertex(t,e){const i=st(t.sizing.x),o=st(t.sizing.y),s=st(t.sizing.z),l=t.placementAngle,r=I(t.bitset,z.bitset.isSDF),a=I(t.bitset,z.bitset.isMapAligned),n=I(t.bitset,z.bitset.scaleSymbolsProportionally),d=H(t.bitset,z.bitset.colorLocked),x=X(this,t.id),v=Y(this,t.id,t.color,d).multiply(x),w=this.view.displayViewScreenMat3.multiply(new m(t.pos.xy,1)),V=Z(this,t.id,s).divide(s),f=i.multiply(V),S=t.offset.xy.multiply(V);let b=o.multiply(n.multiply(V.subtract(1)).add(1));b=y(b,h(f.subtract(.99),new u(0)));const g=h(b,new u(1)),C=y(b,new u(1)),M=c.fromRotation(l.multiply(U)),_=$(this,t.id),R=this._getViewRotationMatrix(a).multiply(_).multiply(M).multiply(new m(S.xy,0)).multiply(this.view.scaleFactor),j=this.clip(t.id,t.zoomRange),F=new p(w.xy.add(R.xy),j,1),N=t.textureUV.divide(this.mosaicInfo.size),T=t.outlineColor.multiply(C),D=I(t.bitset,z.bitset.overrideOutlineColor),q=t.sdfDecodeCoeff.multiply(f);return{glPosition:F,color:v,textureUV:N,outlineColor:T,outlineSize:g,distanceToPx:q,isSDF:r,overrideOutlineColor:D,...this.maybeRunHittest(t,e,{pos:t.pos,size:f,sizeCorrection:V,scaleFactor:this.view.scaleFactor,isMapAligned:a,vvRotationMat3:_,placementMat3:M,outlineSize:g,distanceToPx:q,isSDF:r})}}fragment(t){const e=this._getColor(t.textureUV,t);return this.getFragmentOutput(e,t)}hittest(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=D(this.hittestRequest);return x(r,()=>{const{tlbr:t}=this.hittestRequest;return q(o,s,l,t)},()=>x(v(i.size,this.hittestRequest.smallSymbolSizeThreshold),this._hittestSmallMarker(t,e,i),this._hittestMarker(t,e,i)))}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getViewScreenMatrix(t){const e=this.view.viewMat3.multiply(this.view.tileMat3),i=this.view.tileMat3,o=new u(1).subtract(t);return e.multiply(t).add(i.multiply(o))}_getColor(t,e){return x(w(e.isSDF,new u(1)),this._getSDFColor(t,e),this._getSpriteColor(t,e))}_getSpriteColor(t,e){return V(this.mosaicTexture,t).multiply(e.color)}_getSDFColor(t,e){const i=V(this.mosaicTexture,t),o=new u(.5).subtract(G(i)).multiply(e.distanceToPx).multiply(F),s=f(new u(.5).subtract(o),new u(0),new u(1)),l=e.color.multiply(s);let r=e.outlineSize;this.highlight&&(r=h(r,e.overrideOutlineColor.multiply(4)));const a=r.multiply(.5),p=S(o).subtract(a),n=f(new u(.5).subtract(p),new u(0),new u(1)),d=b(e.outlineColor,e.color,e.overrideOutlineColor).multiply(n);return new u(1).subtract(d.a).multiply(l).add(d)}_hittestSmallMarker(t,e,i){const{position:o,distance:s,smallSymbolDistance:l}=this.hittestRequest,r=s.subtract(l),{viewMat3:a,tileMat3:p}=this.view,n=a.multiply(p).multiply(new m(i.pos,1)).xy,d=i.size.multiply(.5),y=g(n,o).subtract(d).add(r);return x(C(y,this.hittestRequest.distance),new u(T),new u(N))}_hittestMarker(t,e,i){const{pos0:o,pos1:s,pos2:l}=this.computeHittestTriangle(t,e,i),r=this.hittestRequest.position,a=this.hittestRequest.distance,p=O(r,o,s,l);return x(C(p,a),new u(T),this._hittestSamples(o,s,l,t,e,i))}computeHittestTriangle(t,e,i){const{pos:o,sizeCorrection:s,scaleFactor:l,isMapAligned:r}=i,a=new m(t.offset.multiply(s).multiply(l),0),p=new m(e.offsetNextVertex1.multiply(s).multiply(l),0),n=new m(e.offsetNextVertex2.multiply(s).multiply(l),0),{viewMat3:u,tileMat3:d}=this.view,y=u.multiply(d).multiply(new m(o,1)),h=this._getViewScreenMatrix(r).multiply(i.vvRotationMat3).multiply(i.placementMat3);return{pos0:y.add(h.multiply(a)).xy,pos1:y.add(h.multiply(p)).xy,pos2:y.add(h.multiply(n)).xy}}_hittestSamples(t,e,i,o,s,l){const{outlineSize:r,isSDF:a,distanceToPx:d}=l,m=this.hittestRequest.position,y=this.hittestRequest.distance,h=k(m.add(new n(M(y),M(y))),t,e,i),c=k(m.add(new n(0,M(y))),t,e,i),v=k(m.add(new n(y,M(y))),t,e,i),w=k(m.add(new n(M(y),0)),t,e,i),V=k(m,t,e,i),f=k(m.add(new n(y,0)),t,e,i),S=k(m.add(new n(M(y),y)),t,e,i),b=k(m.add(new n(0,y)),t,e,i),g=k(m.add(new n(y,y)),t,e,i),z=o.textureUV.divide(this.mosaicInfo.size),_=s.textureUVNextVertex1.divide(this.mosaicInfo.size),R=s.textureUVNextVertex2.divide(this.mosaicInfo.size),j={color:new p(1),outlineColor:new p(1),overrideOutlineColor:new u(1),outlineSize:r,distanceToPx:d,isSDF:a};let U=new u(0);return U=U.add(A(h).multiply(this._getColor(ot(h,z,_,R),j).a)),U=U.add(A(c).multiply(this._getColor(ot(c,z,_,R),j).a)),U=U.add(A(v).multiply(this._getColor(ot(v,z,_,R),j).a)),U=U.add(A(w).multiply(this._getColor(ot(w,z,_,R),j).a)),U=U.add(A(V).multiply(this._getColor(ot(V,z,_,R),j).a)),U=U.add(A(f).multiply(this._getColor(ot(f,z,_,R),j).a)),U=U.add(A(S).multiply(this._getColor(ot(S,z,_,R),j).a)),U=U.add(A(b).multiply(this._getColor(ot(b,z,_,R),j).a)),U=U.add(A(g).multiply(this._getColor(ot(g,z,_,R),j).a)),x(C(U,new u(.05)),new u(N),new u(T))}}t([o(L)],lt.prototype,"visualVariableColor",void 0),t([o(B)],lt.prototype,"visualVariableOpacity",void 0),t([o(E)],lt.prototype,"visualVariableRotation",void 0),t([o(J)],lt.prototype,"visualVariableSizeMinMaxValue",void 0),t([o(K)],lt.prototype,"visualVariableSizeScaleStops",void 0),t([o(Q)],lt.prototype,"visualVariableSizeStops",void 0),t([o(W)],lt.prototype,"visualVariableSizeUnitValue",void 0),t([s(P)],lt.prototype,"mosaicInfo",void 0),t([l(d)],lt.prototype,"mosaicTexture",void 0),t([e(0,r(tt)),e(1,r(et))],lt.prototype,"vertex",null),t([e(0,r(it))],lt.prototype,"fragment",null);export{it as MarkerFragmentInput,lt as MarkerShader,tt as MarkerVertexInput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as a}from"../../../../../../../symbols/cim/CIMEffects.js";import{getEffectsInflateSize as r}from"../../../../../../../symbols/cim/utils.js";import{EffectHelper as s}from"../../../../../../../symbols/cim/effects/EffectHelper.js";import{MeshWriterVertexPack as i}from"./MeshWriterVertexPack.js";const
|
|
2
|
+
import{GeometryCursor as e}from"../../../../../../../geometry/GeometryCursor.js";import{loadGeometryOperatorsForEffect as t,loadGeometryOperatorsForPlacement as a}from"../../../../../../../symbols/cim/CIMEffects.js";import{getEffectsInflateSize as r}from"../../../../../../../symbols/cim/utils.js";import{EffectHelper as s}from"../../../../../../../symbols/cim/effects/EffectHelper.js";import{MeshWriterVertexPack as i}from"./MeshWriterVertexPack.js";const c=96/72;class n{constructor(e,t,a,r){this._instanceId=e,this._evaluator=t,this._enabledOptionalAttributes=a,this._viewParams=r,this._evaluator.evaluator=e=>this.vertexSpec.createComputedParams(e)}get _vertexPack(){if(!this._cachedVertexPack){const e=i.fromVertexSpec(this.vertexSpec,this._enabledOptionalAttributes);this._evaluator.hasDynamicProperties||e.pack(this._evaluator.evaluatedMeshParams,this._viewParams),this._cachedVertexPack=e}return this._cachedVertexPack}get evaluatedMeshParams(){return this._evaluator.evaluatedMeshParams}get hasEffects(){return!!this.evaluatedMeshParams.effects}get effectInfos(){return this._evaluator.inputMeshParams.effects?.effectInfos}get placementInfo(){return this._evaluator.inputMeshParams.placement}get instanceId(){return this._instanceId}get attributeLayout(){return this._vertexPack.attributeLayout}get _preventEffectClipping(){return!1}setReferences(e){this._references=e}getBoundsInfo(){return null}getTileInfo(){return this._viewParams.tileInfo}async loadDependencies(){for(const{effect:e}of this.effectInfos||[])await t(e);this.placementInfo&&await a(this.placementInfo.placement)}enqueueRequest(e,t,a){this._evaluator.hasDynamicProperties&&this._evaluator.enqueueRequest(e,t,a)}write(e,t,a,r,s,i,c,n){this.ensurePacked(t,a,r);const o=e.id||"",f=this.evaluatedMeshParams.effects,u=this._createEffectExecutionContext(a,r,o,c,n),h={target:a,options:r,level:s,viewExtent:i};if(!f||0===f.length)return void this._write(e,h);const l=this.getEffectCursor(a,f,u);if(!l)return;let m;for(;m=l.next();)m.invertY(),this._write(e,{...h,effectGeometry:m,scaleFactor:c})}ensurePacked(e,t,a){if(!this._evaluator.hasDynamicProperties)return;const r=this._evaluator.evaluateMeshParams(e,t,a);this._vertexPack.pack(r,this._viewParams)}hasArcadeDependency(e){return this._evaluator.hasArcadeDependency(e)}_writeVertex(e,t,a,r,s){const i=this.evaluatedMeshParams;this._vertexPack.writeVertex(e,t,a,r,i,s)}_createEffectExecutionContext(e,t,a,s,i){return{geomUnitsPerPoint:c,maxInflateSize:r(this.evaluatedMeshParams.effects),scale:t.$view.scale,spatialReference:e.metadata.outSpatialReference??e.metadata.spatialReference,preventClipping:this._preventEffectClipping,tileKey:a,scaleFactor:s,matcher:i,target:e}}getEffectCursor(t,a,r){null==r.scaleFactor&&(r={...r,scaleFactor:1});const i=t.readGeometryForDisplay()?.clone();if(!i)return;const c=e.fromOptimizedCIM(i,t.geometryType);return c.invertY(),s.executeEffects(a,c,r)}}export{n as MeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as r,UniformGroup as a}from"../../GraphShaderModule.js";import{Vec4 as s,Vec2 as n,Float as p,step as u,min as m,ifElse as d,greaterThan as y,max as c,Vec3 as f,length as h,clamp as v}from"../../graph/glsl.js";import{BaseHittestVertexInput as w,FeatureVertexInput as b,AFeatureShader as V,FeatureFragmentInput as S}from"./AFeatureShader.js";import{noHit as g,trueHit as x,epsilon as j,thinLineWidthFactor as z,thinLineHalfWidth as W}from"./constants.js";import{isRectHittest as M,distPointSegment as R,hittestScreenRect as C}from"./hittestUtils.js";import{VisualVariableColor as H}from"./VisualVariableColor.js";import{VisualVariableOpacity as O}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as U}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as A,getVisualVariableOpacity as T,hasVisualVariableSize as D,getVisualVariableSize as G}from"./vvUtils.js";class L extends b{}t([e(3,s)],L.prototype,"color",void 0),t([e(4,n)],L.prototype,"offset",void 0),t([e(5,n)],L.prototype,"normal",void 0),t([e(6,p)],L.prototype,"halfWidth",void 0),t([e(7,p)],L.prototype,"referenceHalfWidth",void 0),t([e(8,n)],L.prototype,"zoomRange",void 0);class k extends S{}class B extends a{}function E(t){return c(new p(z).multiply(u(t,new p(W))),new p(1))}function I(t,i){const{halfWidth:e,normal:o}=t,l=E(e),r=h(o).multiply(e);return v(l.multiply(e.subtract(r)).divide(i.add(l).subtract(new p(1))),new p(0),new p(1))}function J(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(D(t)){const i=new p(2).multiply(l),r=G(t,e,i)
|
|
2
|
+
import{__decorate as t,__param as i}from"tslib";import{location as e,uniform as o,option as l,input as r,UniformGroup as a}from"../../GraphShaderModule.js";import{Vec4 as s,Vec2 as n,Float as p,step as u,min as m,ifElse as d,greaterThan as y,max as c,Vec3 as f,length as h,clamp as v}from"../../graph/glsl.js";import{BaseHittestVertexInput as w,FeatureVertexInput as b,AFeatureShader as V,FeatureFragmentInput as S}from"./AFeatureShader.js";import{noHit as g,trueHit as x,epsilon as j,thinLineWidthFactor as z,thinLineHalfWidth as W}from"./constants.js";import{isRectHittest as M,distPointSegment as R,hittestScreenRect as C}from"./hittestUtils.js";import{VisualVariableColor as H}from"./VisualVariableColor.js";import{VisualVariableOpacity as O}from"./VisualVariableOpacity.js";import{VisualVariableSizeMinMaxValue as U}from"./VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as q}from"./VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as F}from"./VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as P}from"./VisualVariableSizeUnitValue.js";import{getVisualVariableColor as A,getVisualVariableOpacity as T,hasVisualVariableSize as D,getVisualVariableSize as G}from"./vvUtils.js";class L extends b{}t([e(3,s)],L.prototype,"color",void 0),t([e(4,n)],L.prototype,"offset",void 0),t([e(5,n)],L.prototype,"normal",void 0),t([e(6,p)],L.prototype,"halfWidth",void 0),t([e(7,p)],L.prototype,"referenceHalfWidth",void 0),t([e(8,n)],L.prototype,"zoomRange",void 0);class k extends S{}class B extends a{}function E(t){return c(new p(z).multiply(u(t,new p(W))),new p(1))}function I(t,i){const{halfWidth:e,normal:o}=t,l=E(e),r=h(o).multiply(e);return v(l.multiply(e.subtract(r)).divide(i.add(l).subtract(new p(1))),new p(0),new p(1))}function J(t,i){const{id:e,halfWidth:o,referenceHalfWidth:l}=i;if(D(t)){const i=new p(2).multiply(l),r=G(t,e,i),a=new p(j),s=d(y(o,a),o.divide(c(l,a)),new p(1));return new p(.5).multiply(s).multiply(r)}return o}function K(t,i){const{id:e,offset:o,pos:l,normal:r,zoomRange:a}=i,{displayViewScreenMat3:n,displayViewMat3:m}=t.view,d=A(t,e,i.color),y=T(t,e),h=J(t,i),v=new p(.5).multiply(t.antialiasingControls.antialiasing),w=c(h.add(v),new p(.45)).add(new p(.1).multiply(v)),b=E(w).multiply(w).multiply(o).multiply(t.view.scaleFactor),V=m.multiply(new f(b,new p(0))),S=n.multiply(new f(l,new p(1))).add(V),g=new p(2).multiply(u(h,new p(0))).add(t.clip(e,a)),x=new s(S.xy,g,1);return{color:d,opacity:y,halfWidth:w,normal:r,scaledOffset:b,scaledHalfWidth:h,glPosition:new s(x.xy,g,1)}}function N(t,i){const{opacity:e,color:o}=t,l=I(t,i);return e.multiply(o).multiply(l)}t([o(p)],B.prototype,"antialiasing",void 0),t([o(p)],B.prototype,"blur",void 0);class Q extends V{constructor(){super(...arguments),this.type="LineShader",this.computeAttributes={pos:["nextPos1","nextPos2"]}}vertex(t,i){const e=K(this,t);return{...e,...this.maybeRunHittest(t,i,e.halfWidth)}}fragment(t){const i=N(t,this.antialiasingControls.blur);return this.getFragmentOutput(i,t)}hittest(t,i,e){const{pos0:o,pos1:l,pos2:r}=this.computeHittestTriangle(t,i,null),a=M(this.hittestRequest),{distance:s,smallSymbolDistance:n,smallSymbolSizeThreshold:c,tlbr:f}=this.hittestRequest,h=u(e,c.multiply(.5)).multiply(s.subtract(n)),v=this.hittestRequest.position,w=m(R(v,o,l),R(v,o,r)).subtract(e).add(h);return d(a,C(o,l,r,f),d(y(w,s),new p(g),new p(x)))}}t([o(B)],Q.prototype,"antialiasingControls",void 0),t([l(H)],Q.prototype,"visualVariableColor",void 0),t([l(O)],Q.prototype,"visualVariableOpacity",void 0),t([l(U)],Q.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(q)],Q.prototype,"visualVariableSizeScaleStops",void 0),t([l(F)],Q.prototype,"visualVariableSizeStops",void 0),t([l(P)],Q.prototype,"visualVariableSizeUnitValue",void 0),t([i(0,r(L)),i(1,r(w))],Q.prototype,"vertex",null),t([i(0,r(k))],Q.prototype,"fragment",null);export{B as AntialiasingControls,k as LineFragmentInput,Q as LineShader,L as LineVertexInput,I as getLineAntialiasing,N as getLineFragmentColor,E as getLineThinFactor,K as getLineVertexData};
|