@arcgis/core 5.2.0-next.82 → 5.2.0-next.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/components/assets/icon/deleteAndReplaceFeatures16.json +1 -0
- package/assets/components/assets/icon/deleteAndReplaceFeatures24.json +1 -0
- package/assets/components/assets/icon/deleteAndReplaceFeatures32.json +1 -0
- package/assets/components/assets/icon/moveAndRotate16.json +1 -0
- package/assets/components/assets/icon/moveAndRotate24.json +1 -0
- package/assets/components/assets/icon/moveAndRotate32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/028bee58f7bc19e5e39e.js +1 -0
- package/assets/esri/core/workers/chunks/{a2fd945659ce052f99d2.js → 03895d49fbd34ccb3ead.js} +1 -1
- package/assets/esri/core/workers/chunks/0775d1e3034d5e7ef7bc.js +1 -0
- package/assets/esri/core/workers/chunks/{95ff342e5c29bf91a765.js → 13a43c87d7952facbed4.js} +1 -1
- package/assets/esri/core/workers/chunks/{e59101f1d060d0a30a65.js → 14def8f47ae7265dd71b.js} +1 -1
- package/assets/esri/core/workers/chunks/1b00789511c9b27da4a7.js +1 -0
- package/assets/esri/core/workers/chunks/1b277311a4beb4243bf8.js +2 -0
- package/assets/esri/core/workers/chunks/1d03db4df18524cf391c.js +1 -0
- package/assets/esri/core/workers/chunks/24bfe759c8848143361e.js +1 -0
- package/assets/esri/core/workers/chunks/30dade7bf6032be32599.js +2 -0
- package/assets/esri/core/workers/chunks/{865f9adc591056458b6b.js → 33dc93d82407052fafe1.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d982abff7c9496f7890.js → 3a6990058f1003bd2812.js} +1 -1
- package/assets/esri/core/workers/chunks/{0fd7590e545864f5fff4.js → 3ca0d503ce733088a6c2.js} +1 -1
- package/assets/esri/core/workers/chunks/46b3d6814ba4c0a71111.js +1 -0
- package/assets/esri/core/workers/chunks/49784f8e8e5fac0cc5a9.js +1 -0
- package/assets/esri/core/workers/chunks/{563a4d6788ad66b676e4.js → 5156d94f01b4fbbf8cde.js} +1 -1
- package/assets/esri/core/workers/chunks/{cdd4aeaa3f30bc4ea93a.js → 5568448e7f51508ffdf5.js} +1 -1
- package/assets/esri/core/workers/chunks/58e4aecabca047f1d229.js +1 -0
- package/assets/esri/core/workers/chunks/{218ddad849745d652a28.js → 5a3c1fe24814a345ab39.js} +1 -1
- package/assets/esri/core/workers/chunks/5b292831127bf981c1c5.js +1 -0
- package/assets/esri/core/workers/chunks/{bd1c870694edd25bf8aa.js → 5f13ade03500b39c1720.js} +1 -1
- package/assets/esri/core/workers/chunks/6154f4d39f9e53fe56cc.js +1 -0
- package/assets/esri/core/workers/chunks/62b116307483d5f0e37d.js +2 -0
- package/assets/esri/core/workers/chunks/6433a623af765b7e53ab.js +1 -0
- package/assets/esri/core/workers/chunks/65eff0ae773505495f21.js +1 -0
- package/assets/esri/core/workers/chunks/6d11b922898a8039dbe7.js +1 -0
- package/assets/esri/core/workers/chunks/7188559a685e0ba30c4f.js +1 -0
- package/assets/esri/core/workers/chunks/{faf14281a74a06fa1f30.js → 724b2631c9ced80a1661.js} +1 -1
- package/assets/esri/core/workers/chunks/7493ce5d02224c07a6d5.js +1 -0
- package/assets/esri/core/workers/chunks/7ad70c8a56f2481adc82.js +1 -0
- package/assets/esri/core/workers/chunks/7ca188f824956a5cac35.js +2 -0
- package/assets/esri/core/workers/chunks/852649460d664b0a1a1d.js +1 -0
- package/assets/esri/core/workers/chunks/{ab10388dcc17a665ac3b.js → 8e1b913067b8e88ff365.js} +2 -2
- package/assets/esri/core/workers/chunks/{e3eab61815ef1c521a6c.js → 9568932bafe689c38f63.js} +1 -1
- package/assets/esri/core/workers/chunks/{c8d83f71326222b98608.js → 996ac351e2322298a17d.js} +1 -1
- package/assets/esri/core/workers/chunks/{34f6093d2c00e3584037.js → 9be05d32528b395a7d34.js} +1 -1
- package/assets/esri/core/workers/chunks/{552d6aecc7d88d16227b.js → 9d41c02601d0bb75b525.js} +1 -1
- package/assets/esri/core/workers/chunks/{64a1ffc221e5b63b43fb.js → a4bb0951e1389e7b803c.js} +1 -1
- package/assets/esri/core/workers/chunks/{b09e9ac5fd928e69b053.js → aabffe53508730e504ec.js} +1 -1
- package/assets/esri/core/workers/chunks/b61c30cdf698b4d1573a.js +1 -0
- package/assets/esri/core/workers/chunks/bbb97c38d8670329d07e.js +2 -0
- package/assets/esri/core/workers/chunks/bd8b483e70acf0fc601e.js +1 -0
- package/assets/esri/core/workers/chunks/bef32acf368b4d5aba37.js +1 -0
- package/assets/esri/core/workers/chunks/c90dfdf2302b7db1f6f7.js +1 -0
- package/assets/esri/core/workers/chunks/{8a36b999cbd65dd2f16c.js → d8c3bdc3c6be8ba7c5e6.js} +1 -1
- package/assets/esri/core/workers/chunks/{40b842d055b87e442156.js → f20b88f5a6d3b988a055.js} +1 -1
- package/assets/esri/core/workers/chunks/{f248131df4eaa5291623.js → f6ae0c483579e227a2f2.js} +1 -1
- package/config.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/kernel.js +1 -1
- package/package.json +2 -2
- package/renderers/UniqueValueRenderer.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/vectorTiles/style/GeoJSONLabelUtils.js +2 -0
- package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementLeafPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/GroundAndIMSurface.js +2 -0
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/support/PluginContext.js +1 -1
- package/views/draw/support/types.d.ts +6 -0
- package/views/interactive/interactiveToolUtils.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/jsxWidgetSupport.js +1 -1
- package/assets/esri/core/workers/chunks/0dcfd82a2669df6eb5a0.js +0 -1
- package/assets/esri/core/workers/chunks/1352b5c6767e5421bc02.js +0 -1
- package/assets/esri/core/workers/chunks/14469f664fd5ede469fc.js +0 -1
- package/assets/esri/core/workers/chunks/177c3b23c1cbd4737049.js +0 -1
- package/assets/esri/core/workers/chunks/21f763694a41968ac21a.js +0 -1
- package/assets/esri/core/workers/chunks/230925079cee040a8d77.js +0 -1
- package/assets/esri/core/workers/chunks/25696c194457e42b3bdc.js +0 -1
- package/assets/esri/core/workers/chunks/469e72ab6cd44272f474.js +0 -1
- package/assets/esri/core/workers/chunks/4f36596280142be1c666.js +0 -1
- package/assets/esri/core/workers/chunks/53d80202b5f43542d45b.js +0 -1
- package/assets/esri/core/workers/chunks/6c389e9646a48c26da20.js +0 -2
- package/assets/esri/core/workers/chunks/6f08c8a1e8e3ffd0a96a.js +0 -1
- package/assets/esri/core/workers/chunks/71ee7c51d2c60a180f1e.js +0 -1
- package/assets/esri/core/workers/chunks/927582ec15bff2acbb49.js +0 -1
- package/assets/esri/core/workers/chunks/98739b6e7904045edbab.js +0 -1
- package/assets/esri/core/workers/chunks/a69c10bfd632a5546b34.js +0 -1
- package/assets/esri/core/workers/chunks/ac9a3dfd02160e43fc8a.js +0 -2
- package/assets/esri/core/workers/chunks/c456abf5ee2a1ad5cc5b.js +0 -1
- package/assets/esri/core/workers/chunks/c61e94806b37ca3dd549.js +0 -2
- package/assets/esri/core/workers/chunks/c899457f19b749516275.js +0 -1
- package/assets/esri/core/workers/chunks/d0c8630177d3a4e316f1.js +0 -2
- package/assets/esri/core/workers/chunks/da0ef984509057ec8507.js +0 -1
- package/assets/esri/core/workers/chunks/ead4143d811aab610e00.js +0 -2
- package/assets/esri/core/workers/chunks/ffe2cbfea38b92a231d6.js +0 -1
- /package/assets/esri/core/workers/chunks/{d0c8630177d3a4e316f1.js.LICENSE.txt → 1b277311a4beb4243bf8.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ead4143d811aab610e00.js.LICENSE.txt → 30dade7bf6032be32599.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ac9a3dfd02160e43fc8a.js.LICENSE.txt → 62b116307483d5f0e37d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{6c389e9646a48c26da20.js.LICENSE.txt → 7ca188f824956a5cac35.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ab10388dcc17a665ac3b.js.LICENSE.txt → 8e1b913067b8e88ff365.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{c61e94806b37ca3dd549.js.LICENSE.txt → bbb97c38d8670329d07e.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2186],{2272(e,t,n){n.d(t,{Dl:()=>f,gf:()=>l,jV:()=>a,lF:()=>c});var i=n(92602),r=n(70333),s=n(4718),o=n(84952),u=n(926);function a(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function f(e){return"string"==typeof e?(0,o.An)(e):(0,s.o8)(e)}function c(e,t,n){const i={};for(const r in e){if("declaredClass"===r)continue;const s=e[r];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))i[r]=s.map(e=>c(e));else if("object"==typeof s)if(s.toJSON){const e=s.toJSON(n?.[r]);i[r]=t?e:JSON.stringify(e)}else i[r]=t?s:JSON.stringify(s);else i[r]=s}return i}async function l(e,t,s){const o=function(e,t){return e?t&&(0,u.Qc)(e)?t:(0,u.getApiKey)(e)??r.id?.findCredential(e)?.token:null}(e,t);if(o)return o;!r.id&&i.A.request.useIdentity&&await Promise.all([n.e(7632),n.e(
|
|
1
|
+
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2186],{2272(e,t,n){n.d(t,{Dl:()=>f,gf:()=>l,jV:()=>a,lF:()=>c});var i=n(92602),r=n(70333),s=n(4718),o=n(84952),u=n(926);function a(e,t){return t?{...t,query:{...e,...t.query}}:{query:e}}function f(e){return"string"==typeof e?(0,o.An)(e):(0,s.o8)(e)}function c(e,t,n){const i={};for(const r in e){if("declaredClass"===r)continue;const s=e[r];if(null!=s&&"function"!=typeof s)if(Array.isArray(s))i[r]=s.map(e=>c(e));else if("object"==typeof s)if(s.toJSON){const e=s.toJSON(n?.[r]);i[r]=t?e:JSON.stringify(e)}else i[r]=t?s:JSON.stringify(s);else i[r]=s}return i}async function l(e,t,s){const o=function(e,t){return e?t&&(0,u.Qc)(e)?t:(0,u.getApiKey)(e)??r.id?.findCredential(e)?.token:null}(e,t);if(o)return o;!r.id&&i.A.request.useIdentity&&await Promise.all([n.e(7632),n.e(7510),n.e(148)]).then(n.bind(n,50148));const a=await r.id.getCredential(e,s);return a?.token}},32186(e,t,n){n.r(t),n.d(t,{deleteForwardEdits:()=>o});var i=n(11254),r=n(49186),s=n(2272);async function o(e,t,n,o){if(!t)throw new r.A("post:missing-guid","guid for version is missing");const u=(0,s.Dl)(e),a=n.toJSON(),f=(0,s.jV)(u.query,{query:(0,s.lF)({...a,f:"json"}),...o,method:"post"});t.startsWith("{")&&(t=t.slice(1,-1));const c=`${u.path}/versions/${t}/deleteForwardEdits`,{data:l}=await(0,i.A)(c,f);return l}}}]);
|
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.
|
|
2
|
+
import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.83";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{replace as e}from"../../core/string.js";import{i as r,l as n,P as t,a as i}from"../../chunks/pe.js";import l from"./WKIDUnitConversion.js";const a=[102100,102113,3857,3785,900913],_=[104905,104971],E=[104903],o=[4326,...a,..._,...E],R=[-20037508.342788905,20037508.342788905],
|
|
2
|
+
import{replace as e}from"../../core/string.js";import{i as r,l as n,P as t,a as i}from"../../chunks/pe.js";import l from"./WKIDUnitConversion.js";const a=[102100,102113,3857,3785,900913],_=[104905,104971],E=[104903],o=[4326,...a,..._,...E],R=[-20037508.342788905,20037508.342788905],u=[-20037508.342787,20037508.342787],M={wkTemplate:'PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]',valid:R,origin:u,dx:1e-5},s={102113:{wkTemplate:'PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]',valid:R,origin:u,dx:1e-5},102100:M,3785:{wkTemplate:'PROJCS["WGS_1984_Web_Mercator",GEOGCS["GCS_WGS_1984_Major_Auxiliary_Sphere",DATUM["D_WGS_1984_Major_Auxiliary_Sphere",SPHEROID["WGS_1984_Major_Auxiliary_Sphere",6378137.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]',valid:R,origin:u,dx:1e-5},3857:M,4326:{wkTemplate:'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",{Central_Meridian}],UNIT["Degree",0.0174532925199433]]',altTemplate:'PROJCS["WGS_1984_Plate_Carree",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Plate_Carree"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",{Central_Meridian}],UNIT["Degrees",111319.491]]',valid:[-180,180],origin:[-180,90],dx:1e-5},104971:{wkTemplate:'GEOGCS["Mars_2000_(Sphere)",DATUM["Mars_2000_(Sphere)",SPHEROID["Mars_2000_(Sphere)",3396190.0,0.0]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]',valid:[-180,180],origin:[-180,90],dx:1e-5},104905:{wkTemplate:'GEOGCS["GCS_Mars_2000",DATUM["D_Mars_2000",SPHEROID["Mars_2000_IAU_IAG",3396190.0,169.8944472236118]],PRIMEM["Reference_Meridian",0.0],UNIT["Degree",0.0174532925199433]]',valid:[-180,180],origin:[-180,90],dx:1e-5},900913:M,104903:{wkTemplate:'GEOGCS["GCS_Moon_2000",DATUM["D_Moon_2000",SPHEROID["Moon_2000_IAU_IAG",1737400,0,AUTHORITY["ESRI","107903"]],AUTHORITY["ESRI","106903"]],PRIMEM["Reference_Meridian",0,AUTHORITY["ESRI","108900"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["ESRI","104903"]]',valid:[-180,180],origin:[-180,90],dx:1e-5}};function T(e,r){if(e===r)return!0;if(null==e||null==r)return!1;const n=e.wkid,t=r.wkid;if(null!=n||null!=t){if(n===t)return!0;if(f(e)&&f(r))return!0;const i=e.latestWkid;if(null!=i&&t===i)return!0;const l=r.latestWkid;if(null!=l&&n===l)return!0;if(null!=n&&null!=t)return!1}let i,l;return e.wkt2&&r.wkt2?(i=e.wkt2,l=r.wkt2):e.wkt&&r.wkt&&(i=e.wkt,l=r.wkt),!(!i||!l)&&i.toUpperCase()===l.toUpperCase()}async function S(e,l){if(e===l)return!0;r()||await n();const a=e=>{const r=e.wkt2||e.wkt;if(r)return t.fromString(i.PE_TYPE_COORDSYS,r);const n=e.wkid??e.latestWkid;return n?t.coordsys(n):null},_=e?a(e):null,E=l?a(l):null;return null!=_&&null!=E&&_.isEqual(E)}function G(e){const r=e?.wkid;return null!=r&&r>=2e3&&s[r]||null}async function c(e,l){if(1===l&&!I(e)||2===l&&I(e))return e;r()||await n();const a=t.fromString(i.PE_TYPE_NONE,e);return a?.toString(1===l?i.PE_STR_FMT_WKT:i.PE_STR_FMT_WKT2)??null}function A(e){if(!e)return;const{wkid:r,vcsWkid:n,falseM:t,falseX:i,falseY:l,falseZ:a,mTolerance:_,mUnits:E,xyTolerance:o,xyUnits:R,zTolerance:u,zUnits:M}=e;if(r&&[n,t,i,l,a,_,E,o,R,u,M].every(e=>null==e))return String(r);const s={wkid:r,wkt:r?void 0:e.wkt||e.wkt2,vcsWkid:n,falseM:t,falseX:i,falseY:l,falseZ:a,mTolerance:_,mUnits:E,xyTolerance:o,xyUnits:R,zTolerance:u,zUnits:M};for(const[T,S]of Object.entries(s))null===S&&delete s[T];return JSON.stringify(s)}function d(e){if(!U(e))return!1;const{wkid:r}=e;if(r)return null==l[r];const n=e.wkt2||e.wkt;return!!n&&/^\s*(?:GEOGCS|GEOGCRS|GEOGRAPHICCRS)/i.test(n)}function P(e){return 4326===e?.wkid}function I(e){return/^\s*(?:GEOD|GEODETIC|GEOG|GEOGRAPHIC|PROJ|PROJECTED|VERT|VERTICAL|ENG|ENGINEERING|PARAMETRIC|TIME|DERIVEDPROJ|COMPOUND|BOUND)CRS/i.test(e)}function O(e){return 4490===e?.wkid}function f(e){const r=e?.wkid;return null!=r&&r>=2e3&&a.includes(r)}function C(e){return 32662===e?.wkid}function k(e){return 104971===e||104905===e}function w(e){return 104903===e}function D(e){const r=e?.wkid;return null!=r&&r>=2e3&&o.includes(r)}function U(e){if(null==e)return!1;const r=e.wkid;return null!=r&&r>=2e3||(null!=e.wkt2||null!=e.wkt)}const p={wkid:4326,wkt:e(s[4326].wkTemplate,{Central_Meridian:"0.0"})},W={wkid:102100,latestWkid:3857},g={wkid:32662};export{T as equals,S as equalsWithProjectionEngine,G as getInfo,c as getWktFromWkt,O as isCGCS2000,d as isGeographic,C as isPlateCarree,U as isValid,P as isWGS84,k as isWKIDFromMars,w as isWKIDFromMoon,I as isWKT2,f as isWebMercator,D as isWrappable,g as plateCarree,A as srToRESTValue,W as webMercator,u as webMercatorOrigin,R as webMercatorValid,p as wgs84};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.
|
|
2
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.83",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.83",
|
|
4
4
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@amcharts/amcharts5": "~5.20.2",
|
|
23
23
|
"@arcgis/toolkit": "^5.2.0-next.77",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
25
|
-
"@esri/calcite-components": "^5.2.0-next.
|
|
25
|
+
"@esri/calcite-components": "^5.2.0-next.52",
|
|
26
26
|
"@vaadin/grid": "~25.2.8",
|
|
27
27
|
"@zip.js/zip.js": "~2.8.51",
|
|
28
28
|
"luxon": "~3.7.2",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{clone as t}from"../core/lang.js";import s from"../core/Logger.js";import{deepMerge as i}from"../core/object.js";import{watch as l}from"../core/reactiveUtils.js";import{property as o,cast as r,subclass as u}from"../core/accessorSupport/decorators.js";import{diff as n}from"../core/accessorSupport/diffUtils.js";import{ensureString as a,ensureType as p}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as f,collectField as d}from"../layers/support/fieldUtils.js";import c from"../portal/Portal.js";import h from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import{rendererBackgroundFillSymbolProperty as y,rendererSymbolProperty as b}from"./support/commonProperties.js";import v from"./support/RendererLegendOptions.js";import{getScaleDependentSymbol as _}from"./support/scaleDependentSymbolUtils.js";import g from"./support/UniqueValue.js";import V from"./support/UniqueValueClass.js";import q from"./support/UniqueValueGroup.js";import I from"./support/UniqueValueInfo.js";import{loadArcade as S}from"../support/loadArcade.js";import{f as w,t as U}from"../chunks/persistableUrlUtils.js";import j from"../symbols/WebStyleSymbol.js";import{fetchStyle as F}from"../symbols/support/styleUtils.js";import{ensureType as O}from"../symbols/support/typeUtils.js";import{addPropertyUnsupportedError as G}from"../webdoc/support/unsupportedErrors.js";import{enumeration as D}from"../core/accessorSupport/decorators/enumeration.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";import{reader as E}from"../core/accessorSupport/decorators/reader.js";var M;const R="uvInfos-watcher",L="uvGroups-watcher",N=",",P=p(I);function C(e){const{field1:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueInfos:o,valueExpression:r}=e,u=!(!t||!s);return[{classes:(o??[]).map(e=>{const{alternateSymbols:o,symbol:n,label:a,value:p,description:f}=e,[d,c,h]=u?p?.toString()?.split(l||"")||[]:[p],m=[];return(t||r)&&m.push(d),s&&m.push(c),i&&m.push(h),{alternateSymbols:o,symbol:n,label:a,values:[m],description:f}})}]}function z(e){return null!=e&&""!==e&&("string"!=typeof e||""!==e.trim()&&"<null>"!==e.toLowerCase())||(e=null),e+""}let A=M=class extends(m(h)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,t){if(!e&&!t)return;if(!e||!t)return{type:"complete",oldValue:e,newValue:t};let s=!1;const i={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let l=0;l<t.length;l++){const o=e.find(e=>e.value===t[l].value);o?n(o,t[l])?(i.changed.push({type:"complete",oldValue:o,newValue:t[l]}),s=!0):i.unchanged.push({oldValue:o,newValue:t[l]}):(i.added.push(t[l]),s=!0)}for(let l=0;l<e.length;l++){t.find(t=>t.value===e[l].value)||(i.removed.push(e[l]),s=!0)}return s?i:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(e){this._set("field",e),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(e){return null==e||"function"==typeof e?e:a(e)}writeField(e,t,i,l){"string"==typeof e?t[i]=e:l?.messages?G(l,"UniqueValueRenderer.field","set to a function cannot be written to JSON"):s.getLogger(this).error(".field: cannot write field to JSON since it's not a string value")}set field2(e){this._set("field2",e),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(e){this._set("field3",e),this._updateUniqueValues()}set valueExpression(e){this._set("valueExpression",e),this._updateUniqueValues()}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}set fieldDelimiter(e){this._set("fieldDelimiter",e),this._updateUniqueValues()}readPortal(e,t,s){return s.portal||c.getDefault()}readStyleOrigin(e,t,s){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=w(t.styleUrl,s);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,s,i){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=U(e.styleUrl,i))}set uniqueValueGroups(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",e),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(e,t){if(this.styleOrigin)return void s.getLogger(this).error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i="object"==typeof e?P(e):new I({value:e,symbol:O(t)}),this.uniqueValueInfos?.push(i),this._valueInfoMap[z(i.value)]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(e){if(this.styleOrigin)return void s.getLogger(this).error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const t=this.uniqueValueInfos;if(t)for(let s=0;s<t.length;s++){const i=t[s];if(String(i.value)===String(e)){delete this._valueInfoMap[z(e)],t.splice(s,1);break}}this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}async getUniqueValueInfo(e,t){let s=t;return this.valueExpression&&null==t?.arcade&&(s={...s,arcade:await S()}),this._getUniqueValueInfo(e,s)}getSymbol(e,t){if(this.valueExpression&&null==t?.arcade)return void s.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return _(i,t?.scale)??this.defaultSymbol}async getSymbolAsync(e,t){let s=t;if(this.valueExpression&&null==s?.arcade){const e=await S(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),s={...s,arcade:e}}const i=this._getUniqueValueInfo(e,s);return _(i,s?.scale)??this.defaultSymbol}get symbols(){const e=[];if(this._isInfosSource)for(const t of this.uniqueValueInfos??[])t.symbol&&e.push(t.symbol),e.push(...t.alternateSymbols??[]);else for(const t of this.uniqueValueGroups??[])for(const s of t.classes??[])s.symbol&&e.push(s.symbol),e.push(...s.alternateSymbols??[]);return this.defaultSymbol&&e.push(this.defaultSymbol),e}clone(){const e=new M({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:t(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo),backgroundFillSymbol:t(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const s=t(this.uniqueValueInfos),i=t(this.uniqueValueGroups);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(t(this.styleOrigin))),Object.freeze(s),Object.freeze(i)),e._set("uniqueValueInfos",s),e._updateValueInfoMap(),e._set("uniqueValueGroups",i),e._isInfosSource=this._isInfosSource,e._watchUniqueValueInfosAndGroups(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const s=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(s)}async collectSymbolFields(e,t){const s=[...this.symbols.map(s=>s.collectRequiredFields(e,t)),f(e,t,null,this.valueExpression)];d(e,t,this.field),d(e,t,this.field2),d(e,t,this.field3),await Promise.all(s)}populateFromStyle(){return F(this.styleOrigin,{portal:this.portal}).then(e=>{const t=[];return this._valueInfoMap={},e?.data&&Array.isArray(e.data.items)&&e.data.items.forEach(s=>{const i=new j({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:s.name});this.defaultSymbol||s.name!==e.data.defaultItem||(this.defaultSymbol=i,this._isDefaultSymbolDerived=!0);const l=new I({value:s.name,symbol:i});t.push(l),this._valueInfoMap[z(s.name)]=l}),this._set("uniqueValueInfos",Object.freeze(t)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&this.uniqueValueInfos?.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",N)}_updateUniqueValues(){null!=this._isInfosSource&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:e}=this;if(e)for(const t of e)this._valueInfoMap[z(t.value)]=t}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(R);const{uniqueValueInfos:e}=this;if(e){const t=[];for(const s of e)t.push(l(()=>({symbol:s.symbol,alternateSymbols:s.alternateSymbols,value:s.value,label:s.label,description:s.description}),(e,t)=>{e!==t&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(t,R)}}_watchUniqueValueGroups(){this.removeHandles(L);const{uniqueValueGroups:e}=this;if(e){const t=[];for(const s of e){t.push(l(()=>({classes:s.classes}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const e of s.classes??[])t.push(l(()=>({symbol:e.symbol,alternateSymbols:e.alternateSymbols,values:e.values,label:e.label,description:e.description}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(t,L)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const e=[],{field:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueGroups:o,valueExpression:r}=this;if(!t&&!r)return this._set("uniqueValueInfos",e),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const u=!(!t||!s);for(const n of o)for(const t of n.classes??[]){const{alternateSymbols:o,symbol:r,label:n,values:a,description:p}=t;for(const t of a??[]){const{value:a,value2:f,value3:d}=t,c=[a];s&&c.push(f),i&&c.push(d);const h=u?c.join(l||""):c[0]??void 0;e.push(new I({alternateSymbols:o,symbol:r,label:n,value:h,description:p}))}}this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(e=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:t,field2:s,valueExpression:i,fieldDelimiter:l,uniqueValueInfos:o}=this;if(!t&&!i||!o.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const r=!(!t||!s),u=o.map(e=>{const{alternateSymbols:t,symbol:s,label:i,value:o,description:u}=e,[n,a,p]=r?o?.toString()?.split(l||"")||[]:[o];return new V({alternateSymbols:t,symbol:s,label:i,description:u,values:[new g({value:n,value2:a,value3:p})]})}),n=[new q({classes:u})];e&&Object.freeze(n),this._set("uniqueValueGroups",n),this._watchUniqueValueGroups()}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:s,scale:i,spatialReference:l,arcade:o,timeZone:r}=t??{};let u=this._cache.compiledFunc;const n=o.arcadeUtils;if(!u){const e=n.createSyntaxTree(this.valueExpression);u=n.createFunction(e),this._cache.compiledFunc=u}const a=n.executeFunction(u,n.createExecContext(e,n.getViewInfo({viewingMode:s,scale:i,spatialReference:l}),r));return this._valueInfoMap[z(a)]}_getUnqiueValueInfoForFields(e){const t=this.field,s=e.attributes;let i;if(this.field2){const e=this.field2,l=this.field3,o=[];t&&o.push(s[t]),e&&o.push(s[e]),l&&o.push(s[l]),i=o.join(this.fieldDelimiter||"")}else t&&(i=s[t]);return this._valueInfoMap[z(i)]}static fromPortalStyle(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t?.portal||c.getDefault());const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)}),l}static fromStyleUrl(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)}),l}};e([o({readOnly:!0})],A.prototype,"_cache",null),e([D({uniqueValue:"unique-value"})],A.prototype,"type",void 0),e([o(y)],A.prototype,"backgroundFillSymbol",void 0),e([o({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],A.prototype,"field",null),e([r("field")],A.prototype,"castField",null),e([x("field")],A.prototype,"writeField",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"field2",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"field3",null),e([o({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],A.prototype,"orderByClassesEnabled",void 0),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"valueExpression",null),e([o({type:String,json:{write:!0}})],A.prototype,"valueExpressionTitle",void 0),e([o({type:v,json:{write:!0}})],A.prototype,"legendOptions",void 0),e([o({type:String,json:{write:!0}})],A.prototype,"defaultLabel",void 0),e([o(i({...b},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],A.prototype,"defaultSymbol",null),e([o({type:String,value:null,json:{write:!0}})],A.prototype,"fieldDelimiter",null),e([o({type:c,readOnly:!0})],A.prototype,"portal",void 0),e([E("portal",["styleName"])],A.prototype,"readPortal",null),e([o({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],A.prototype,"styleOrigin",void 0),e([E("styleOrigin",["styleName","styleUrl"])],A.prototype,"readStyleOrigin",null),e([x("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],A.prototype,"writeStyleOrigin",null),e([o({type:[q],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(e,t,s)=>(t.uniqueValueGroups||C(t)).map(e=>q.fromJSON(e,s))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],A.prototype,"uniqueValueGroups",null),e([o({type:[I],json:{read:!1,write:{isRequired:!0,overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0,isRequired:!0}}}}})],A.prototype,"uniqueValueInfos",null),A=M=e([u("esri.renderers.UniqueValueRenderer")],A);export{A as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{clone as t}from"../core/lang.js";import s from"../core/Logger.js";import{deepMerge as i}from"../core/object.js";import{watch as l}from"../core/reactiveUtils.js";import{property as o,cast as r,subclass as u}from"../core/accessorSupport/decorators.js";import{diff as n}from"../core/accessorSupport/diffUtils.js";import{ensureString as a,ensureType as p}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as f,collectField as d}from"../layers/support/fieldUtils.js";import c from"../portal/Portal.js";import h from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import{rendererBackgroundFillSymbolProperty as y,rendererSymbolProperty as b}from"./support/commonProperties.js";import v from"./support/RendererLegendOptions.js";import{getScaleDependentSymbol as _}from"./support/scaleDependentSymbolUtils.js";import g from"./support/UniqueValue.js";import V from"./support/UniqueValueClass.js";import q from"./support/UniqueValueGroup.js";import I from"./support/UniqueValueInfo.js";import{loadArcade as S}from"../support/loadArcade.js";import{f as w,t as U}from"../chunks/persistableUrlUtils.js";import j from"../symbols/WebStyleSymbol.js";import{fetchStyle as F}from"../symbols/support/styleUtils.js";import{ensureType as O}from"../symbols/support/typeUtils.js";import{addPropertyUnsupportedError as G}from"../webdoc/support/unsupportedErrors.js";import{enumeration as D}from"../core/accessorSupport/decorators/enumeration.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";import{reader as E}from"../core/accessorSupport/decorators/reader.js";var M;const R="uvInfos-watcher",L="uvGroups-watcher",N=",",P=p(I);function C(e){const{field1:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueInfos:o,valueExpression:r}=e,u=!(!t||!s);return[{classes:(o??[]).map(e=>{const{alternateSymbols:o,symbol:n,label:a,value:p,description:f}=e,[d,c,h]=u?p?.toString()?.split(l||"")||[]:[p],m=[];return(t||r)&&m.push(d),s&&m.push(c),i&&m.push(h),{alternateSymbols:o,symbol:n,label:a,values:[m],description:f}})}]}function z(e){return null==e||""===e||"string"==typeof e&&(""===e.trim()||"<null>"===e.toLowerCase())?null:e}function A(e,t){return t&&"string"==typeof e?e.split(t).map(e=>z(e)??"").join(t):`${z(e)}`}let T=M=class extends(m(h)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,t){if(!e&&!t)return;if(!e||!t)return{type:"complete",oldValue:e,newValue:t};let s=!1;const i={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let l=0;l<t.length;l++){const o=e.find(e=>e.value===t[l].value);o?n(o,t[l])?(i.changed.push({type:"complete",oldValue:o,newValue:t[l]}),s=!0):i.unchanged.push({oldValue:o,newValue:t[l]}):(i.added.push(t[l]),s=!0)}for(let l=0;l<e.length;l++){t.find(t=>t.value===e[l].value)||(i.removed.push(e[l]),s=!0)}return s?i:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(e){this._set("field",e),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(e){return null==e||"function"==typeof e?e:a(e)}writeField(e,t,i,l){"string"==typeof e?t[i]=e:l?.messages?G(l,"UniqueValueRenderer.field","set to a function cannot be written to JSON"):s.getLogger(this).error(".field: cannot write field to JSON since it's not a string value")}set field2(e){this._set("field2",e),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(e){this._set("field3",e),this._updateUniqueValues()}set valueExpression(e){this._set("valueExpression",e),this._updateUniqueValues()}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}set fieldDelimiter(e){this._set("fieldDelimiter",e),this._updateUniqueValues()}readPortal(e,t,s){return s.portal||c.getDefault()}readStyleOrigin(e,t,s){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=w(t.styleUrl,s);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,s,i){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=U(e.styleUrl,i))}set uniqueValueGroups(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",e),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(e,t){if(this.styleOrigin)return void s.getLogger(this).error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i="object"==typeof e?P(e):new I({value:e,symbol:O(t)}),this.uniqueValueInfos?.push(i),this._valueInfoMap[A(i.value,this.fieldDelimiter)]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(e){if(this.styleOrigin)return void s.getLogger(this).error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const t=this.uniqueValueInfos;if(t)for(let s=0;s<t.length;s++){const i=t[s];if(String(i.value)===String(e)){delete this._valueInfoMap[A(e,this.fieldDelimiter)],t.splice(s,1);break}}this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}async getUniqueValueInfo(e,t){let s=t;return this.valueExpression&&null==t?.arcade&&(s={...s,arcade:await S()}),this._getUniqueValueInfo(e,s)}getSymbol(e,t){if(this.valueExpression&&null==t?.arcade)return void s.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return _(i,t?.scale)??this.defaultSymbol}async getSymbolAsync(e,t){let s=t;if(this.valueExpression&&null==s?.arcade){const e=await S(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),s={...s,arcade:e}}const i=this._getUniqueValueInfo(e,s);return _(i,s?.scale)??this.defaultSymbol}get symbols(){const e=[];if(this._isInfosSource)for(const t of this.uniqueValueInfos??[])t.symbol&&e.push(t.symbol),e.push(...t.alternateSymbols??[]);else for(const t of this.uniqueValueGroups??[])for(const s of t.classes??[])s.symbol&&e.push(s.symbol),e.push(...s.alternateSymbols??[]);return this.defaultSymbol&&e.push(this.defaultSymbol),e}clone(){const e=new M({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:t(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo),backgroundFillSymbol:t(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const s=t(this.uniqueValueInfos),i=t(this.uniqueValueGroups);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(t(this.styleOrigin))),Object.freeze(s),Object.freeze(i)),e._set("uniqueValueInfos",s),e._updateValueInfoMap(),e._set("uniqueValueGroups",i),e._isInfosSource=this._isInfosSource,e._watchUniqueValueInfosAndGroups(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const s=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(s)}async collectSymbolFields(e,t){const s=[...this.symbols.map(s=>s.collectRequiredFields(e,t)),f(e,t,null,this.valueExpression)];d(e,t,this.field),d(e,t,this.field2),d(e,t,this.field3),await Promise.all(s)}populateFromStyle(){return F(this.styleOrigin,{portal:this.portal}).then(e=>{const t=[];return this._valueInfoMap={},e?.data&&Array.isArray(e.data.items)&&e.data.items.forEach(s=>{const i=new j({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:s.name});this.defaultSymbol||s.name!==e.data.defaultItem||(this.defaultSymbol=i,this._isDefaultSymbolDerived=!0);const l=new I({value:s.name,symbol:i});t.push(l),this._valueInfoMap[A(s.name)]=l}),this._set("uniqueValueInfos",Object.freeze(t)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&this.uniqueValueInfos?.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",N)}_updateUniqueValues(){null!=this._isInfosSource&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:e}=this;if(e)for(const t of e)this._valueInfoMap[A(t.value,this.fieldDelimiter)]=t}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(R);const{uniqueValueInfos:e}=this;if(e){const t=[];for(const s of e)t.push(l(()=>({symbol:s.symbol,alternateSymbols:s.alternateSymbols,value:s.value,label:s.label,description:s.description}),(e,t)=>{e!==t&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(t,R)}}_watchUniqueValueGroups(){this.removeHandles(L);const{uniqueValueGroups:e}=this;if(e){const t=[];for(const s of e){t.push(l(()=>({classes:s.classes}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const e of s.classes??[])t.push(l(()=>({symbol:e.symbol,alternateSymbols:e.alternateSymbols,values:e.values,label:e.label,description:e.description}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(t,L)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const e=[],{field:t,field2:s,field3:i,fieldDelimiter:l,uniqueValueGroups:o,valueExpression:r}=this;if(!t&&!r)return this._set("uniqueValueInfos",e),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const u=!(!t||!s);for(const n of o)for(const t of n.classes??[]){const{alternateSymbols:o,symbol:r,label:n,values:a,description:p}=t;for(const t of a??[]){const{value:a,value2:f,value3:d}=t,c=[a];s&&c.push(f),i&&c.push(d);const h=u?c.join(l||""):c[0]??void 0;e.push(new I({alternateSymbols:o,symbol:r,label:n,value:h,description:p}))}}this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(e=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:t,field2:s,valueExpression:i,fieldDelimiter:l,uniqueValueInfos:o}=this;if(!t&&!i||!o.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const r=!(!t||!s),u=o.map(e=>{const{alternateSymbols:t,symbol:s,label:i,value:o,description:u}=e,[n,a,p]=r?o?.toString()?.split(l||"")||[]:[o];return new V({alternateSymbols:t,symbol:s,label:i,description:u,values:[new g({value:n,value2:a,value3:p})]})}),n=[new q({classes:u})];e&&Object.freeze(n),this._set("uniqueValueGroups",n),this._watchUniqueValueGroups()}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:s,scale:i,spatialReference:l,arcade:o,timeZone:r}=t??{};let u=this._cache.compiledFunc;const n=o.arcadeUtils;if(!u){const e=n.createSyntaxTree(this.valueExpression);u=n.createFunction(e),this._cache.compiledFunc=u}const a=n.executeFunction(u,n.createExecContext(e,n.getViewInfo({viewingMode:s,scale:i,spatialReference:l}),r));return this._valueInfoMap[A(a)]}_getUnqiueValueInfoForFields(e){const t=this.field,s=e.attributes;let i;if(this.field2){const e=this.field2,l=this.field3,o=[];t&&o.push(s[t]),e&&o.push(s[e]),l&&o.push(s[l]),i=o.join(this.fieldDelimiter||"")}else t&&(i=s[t]);return this._valueInfoMap[A(i,this.fieldDelimiter)]}static fromPortalStyle(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t?.portal||c.getDefault());const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)}),l}static fromStyleUrl(e,t){const i=new M(t?.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const l=i.populateFromStyle();return l.catch(t=>{s.getLogger(this.prototype).error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)}),l}};e([o({readOnly:!0})],T.prototype,"_cache",null),e([D({uniqueValue:"unique-value"})],T.prototype,"type",void 0),e([o(y)],T.prototype,"backgroundFillSymbol",void 0),e([o({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],T.prototype,"field",null),e([r("field")],T.prototype,"castField",null),e([x("field")],T.prototype,"writeField",null),e([o({type:String,value:null,json:{write:!0}})],T.prototype,"field2",null),e([o({type:String,value:null,json:{write:!0}})],T.prototype,"field3",null),e([o({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],T.prototype,"orderByClassesEnabled",void 0),e([o({type:String,value:null,json:{write:!0}})],T.prototype,"valueExpression",null),e([o({type:String,json:{write:!0}})],T.prototype,"valueExpressionTitle",void 0),e([o({type:v,json:{write:!0}})],T.prototype,"legendOptions",void 0),e([o({type:String,json:{write:!0}})],T.prototype,"defaultLabel",void 0),e([o(i({...b},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],T.prototype,"defaultSymbol",null),e([o({type:String,value:null,json:{write:!0}})],T.prototype,"fieldDelimiter",null),e([o({type:c,readOnly:!0})],T.prototype,"portal",void 0),e([E("portal",["styleName"])],T.prototype,"readPortal",null),e([o({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],T.prototype,"styleOrigin",void 0),e([E("styleOrigin",["styleName","styleUrl"])],T.prototype,"readStyleOrigin",null),e([x("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],T.prototype,"writeStyleOrigin",null),e([o({type:[q],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(e,t,s)=>(t.uniqueValueGroups||C(t)).map(e=>q.fromJSON(e,s))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],T.prototype,"uniqueValueGroups",null),e([o({type:[I],json:{read:!1,write:{isRequired:!0,overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0,isRequired:!0}}}}})],T.prototype,"uniqueValueInfos",null),T=M=e([u("esri.renderers.UniqueValueRenderer")],T);export{T as default};
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const d="20260821",a="d471aa3ff020a33156d5d46063d08a7391dbd78d";export{d as buildDate,a as commitHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../core/BidiEngine.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{numericHash as n}from"../../../../../core/string.js";import{Point as s}from"../../../../../geometry/support/TileClipper.js";import{tilePixelRatio as i,tileSizeInTileUnits as a}from"../constants.js";import{cDegToRad as o,log2 as r,interpolate as l}from"../GeometryUtils.js";import{Anchor as h}from"../Placement.js";import{sdfGlyphSize as x,TextShaping as c}from"../TextShaping.js";import d from"./BaseBucket.js";import{IconLayout as f,TextLayout as g}from"../style/StyleLayer.js";const y=10;function m(e,t){return e.iconMosaicItem&&t.iconMosaicItem?e.iconMosaicItem.page===t.iconMosaicItem.page?0:e.iconMosaicItem.page-t.iconMosaicItem.page:e.iconMosaicItem&&!t.iconMosaicItem?1:!e.iconMosaicItem&&t.iconMosaicItem?-1:0}class u extends d{constructor(e,t,n,s,i,a,o,r,l){super(t,n,l.getSpriteItems()),this.type=3,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._sourceTileKey=e,this._iconVertexBuffer=s,this._iconIndexBuffer=i,this._textVertexBuffer=a,this._textIndexBuffer=o,this._placementEngine=r,this._workerTileHandler=l}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}static{this._bidiEngine=new e}getResources(e,t,s){const i=this.layer,a=this.zoom;e&&e.setExtent(this.layerExtent);const o=i.getLayoutProperty("icon-image"),r=i.getLayoutProperty("text-field");let l=i.getLayoutProperty("text-transform"),h=i.getLayoutProperty("text-font");const x=[];let c,d,f,g;o&&!o.isDataDriven&&(c=o.getValue(a)),r&&!r.isDataDriven&&(d=r.getValue(a)),l&&l.isDataDriven||(f=i.getLayoutValue("text-transform",a),l=null),h&&h.isDataDriven||(g=i.getLayoutValue("text-font",a),h=null);for(const y of this._features){const m=y.getGeometry(e);if(!m||0===m.length)continue;let p,_;o&&(p=o.isDataDriven?o.getValue(a,y):this._replaceKeys(c,y.values),p&&t(p));let M=!1;if(r&&(_=r.isDataDriven?r.getValue(a,y):this._replaceKeys(d,y.values),_)){switch(_=_.replaceAll("\\n","\n"),l&&(f=l.getValue(a,y)),f){case 2:_=_.toLowerCase();break;case 1:_=_.toUpperCase()}if(u._bidiEngine.hasBidiChar(_)){let e;e="rtl"===u._bidiEngine.checkContextual(_)?"IDNNN":"ICNNN",_=u._bidiEngine.bidiTransform(_,e,"VLYSN"),M=!0}if(_.length>0){h&&(g=h.getValue(a,y));for(const e of g){let t=s[e];t||(t=s[e]=new Set);for(const e of _){const n=e.codePointAt(0);null!=n&&t.add(n)}}}}if(!p&&!_)continue;const b=i.getLayoutValue("symbol-sort-key",a,y),P={feature:y,sprite:p,label:_,rtl:M,geometry:m,hash:(_?n(_):0)^(p?n(p):0),priority:b,textFont:g};x.push(P)}this._symbolFeatures=x}processFeatures(e){e&&e.setExtent(this.layerExtent);const n=this.layer,s=this.zoom,r=n.getLayoutValue("symbol-placement",s),l=0!==r,d=n.getLayoutValue("symbol-spacing",s)*i,y=n.getLayoutProperty("icon-image"),p=n.getLayoutProperty("text-field"),_=y?new f(n,s,l):null,M=p?new g(n,s,l):null,b=this._workerTileHandler;let P;y&&(P=b.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const I=[];let A=1;M?.size&&(A=M.size/x);const V=M?M.maxAngle*o:0,w=M?M.size*i:0;for(const o of this._symbolFeatures){let e;_&&P&&o.sprite&&(e=P[o.sprite],e&&e.sdf&&(this._isIconSDF=!0));let n;!!e&&_.update(s,o.feature);let f=0;const g=o.label;if(g){t(M),M.update(s,o.feature);const e=l&&0===M.rotationAlignment?M.keepUpright:M.writingMode&&M.writingMode.includes(1);let a=.5;switch(M.anchor){case 5:case 1:case 7:a=0;break;case 6:case 2:case 8:a=1}let r=.5;switch(M.anchor){case 5:case 3:case 6:r=0;break;case 7:case 4:case 8:r=1}let h=.5;switch(M.justify){case 0:h=a;break;case 1:h=0;break;case 3:h=1}const d=M.letterSpacing*x,y=l?0:M.maxWidth*x,m=M.lineHeight*x,u=o.textFont.map(e=>b.getGlyphItems(e));if(n=new c(u,y,m,d,a,r,h).getShaping(g,o.rtl,e),n&&n.length>0){let e=1e30,t=-1e30;for(const s of n)e=Math.min(e,s.x),t=Math.max(t,s.x);f=(t-e+2*x)*A*i}}for(let t of o.geometry){const s=[];if(1===r){if(n?.length&&M?.size){const e=M.size*i*(2+Math.min(2,4*Math.abs(M.offset[1])));t=u._smoothVertices(t,e)}u._pushAnchors(s,t,d,f)}else 2===r?u._pushCenterAnchor(s,t):3===o.feature.type?u._pushCentroid(s,t):s.push(new h(t[0].x,t[0].y));for(const i of s){if(i.x<0||i.x>a||i.y<0||i.y>a)continue;if(l&&f>0&&0===M?.rotationAlignment&&!u._honorsTextMaxAngle(t,i,f,V,w))continue;const s={shaping:n,line:t,iconMosaicItem:e,anchor:i,symbolFeature:o,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};I.push(s),this._processFeature(s,_,M)}}}I.sort(m),this._addPlacedGlyphs(),this._symbolInstances=I}serialize(){let e=14;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=u._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),n=new Int32Array(t.buffer),s=new Float32Array(t.buffer),[i,a,o]=this._sourceTileKey.split("/");let r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let l=0;l<this.layerUIDs.length;l++)t[r++]=this.layerUIDs[l];t[r++]=this._isIconSDF?1:0,t[r++]=parseFloat(i),t[r++]=parseFloat(a),t[r++]=parseFloat(o),t[r++]=this.markerPageMap.size;for(const[l,[h,x]]of this.markerPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this.glyphsPageMap.size;for(const[l,[h,x]]of this.glyphsPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this._iconVertexBuffer.index/4,t[r++]=this._textVertexBuffer.index/4,r=u.serializeSymbols(t,n,s,r,this._symbolInstances),t[r++]=this._iconVertexBuffer.array.length;for(let l=0;l<this._iconVertexBuffer.array.length;l++)n[r++]=this._iconVertexBuffer.array[l];t[r++]=this._iconIndexBuffer.array.length;for(let l=0;l<this._iconIndexBuffer.array.length;l++)t[r++]=this._iconIndexBuffer.array[l];t[r++]=this._textVertexBuffer.array.length;for(let l=0;l<this._textVertexBuffer.array.length;l++)n[r++]=this._textVertexBuffer.array[l];t[r++]=this._textIndexBuffer.array.length;for(let l=0;l<this._textIndexBuffer.array.length;l++)t[r++]=this._textIndexBuffer.array[l];return t.buffer}static _symbolsSerializationLength(e){let t=0;t+=1;for(const n of e||[]){t+=5,t+=1;for(const e of n.textColliders)t+=y;for(const e of n.iconColliders)t+=y;t+=1,t+=2*n.textVertexRanges.length,t+=1,t+=2*n.iconVertexRanges.length}return t}static serializeSymbols(e,t,n,s,i){i=i||[],t[s++]=i.length;for(const a of i){t[s++]=a.anchor.x,t[s++]=a.anchor.y,t[s++]=a.symbolFeature.hash,t[s++]=a.symbolFeature.priority,t[s++]=a.symbolFeature.feature.featureIndex,t[s++]=a.textColliders.length+a.iconColliders.length;for(const e of a.textColliders)t[s++]=e.xTile,t[s++]=e.yTile,t[s++]=e.dxPixels,t[s++]=e.dyPixels,t[s++]=e.hard?1:0,t[s++]=e.partIndex,n[s++]=e.minLod,n[s++]=e.maxLod,t[s++]=e.width,t[s++]=e.height;for(const e of a.iconColliders)t[s++]=e.xTile,t[s++]=e.yTile,t[s++]=e.dxPixels,t[s++]=e.dyPixels,t[s++]=e.hard?1:0,t[s++]=e.partIndex,n[s++]=e.minLod,n[s++]=e.maxLod,t[s++]=e.width,t[s++]=e.height;t[s++]=a.textVertexRanges.length;for(const[e,n]of a.textVertexRanges)t[s++]=e,t[s++]=n;t[s++]=a.iconVertexRanges.length;for(const[e,n]of a.iconVertexRanges)t[s++]=e,t[s++]=n}return s}_replaceKeys(e,t){return e.replaceAll(/{([^{}]+)}/g,(e,n)=>n in t?t[n]:"")}_processFeature(e,t,n){const{line:s,iconMosaicItem:i,shaping:a,anchor:o}=e,l=this.zoom,h=this.layer,x=!!i;let c=!0;x&&(c=t?.optional||!i);const d=a&&a.length>0,f=!d||n?.optional;let g,y;if(x&&(g=this._placementEngine.getIconPlacement(o,i,t)),(g||c)&&(d&&(y=this._placementEngine.getTextPlacement(o,a,s,n)),y||f)){if(g&&y||(f||c?f||y?c||g||(y=null):g=null:(g=null,y=null)),y){const t=h.hasDataDrivenText?h.textMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._storePlacedGlyphs(e,y.shapes,l,n.rotationAlignment,t),y.textColliders){e.textColliders=y.textColliders;for(const e of y.textColliders){e.minLod=Math.max(l+r(e.minLod),0),e.maxLod=Math.min(l+r(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),s=Math.sin(t),i=e.dxPixels*n-e.dyPixels*s,a=e.dxPixels*s+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*s,r=(e.dxPixels+e.width)*s+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*s,h=e.dxPixels*s+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*s,c=(e.dxPixels+e.width)*s+(e.dyPixels+e.height)*n,d=Math.min(i,o,l,x),f=Math.max(i,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}if(g){const n=h.hasDataDrivenIcon?h.iconMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._addPlacedIcons(e,g.shapes,l,i.page,1===t.rotationAlignment,n),g.iconColliders){e.iconColliders=g.iconColliders;for(const e of g.iconColliders){e.minLod=Math.max(l+r(e.minLod),0),e.maxLod=Math.min(l+r(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),s=Math.sin(t),i=e.dxPixels*n-e.dyPixels*s,a=e.dxPixels*s+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*s,r=(e.dxPixels+e.width)*s+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*s,h=e.dxPixels*s+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*s,c=(e.dxPixels+e.width)*s+(e.dyPixels+e.height)*n,d=Math.min(i,o,l,x),f=Math.max(i,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}}}_addPlacedIcons(e,t,n,s,i,a){const o=Math.max(n-1,0),l=this._iconVertexBuffer,h=this._iconIndexBuffer,x=this._markerMap;for(const c of t){const t=i?0:Math.max(n+r(c.minzoom),o),d=i?25:Math.min(n+r(c.maxzoom),25);if(d<=t)continue;const f=c.tl,g=c.tr,y=c.bl,m=c.br,u=c.mosaicRect,p=c.labelAngle,_=c.minAngle,M=c.maxAngle,b=c.anchor,P=l.index,I=u.x,A=u.y,V=I+u.width,w=A+u.height,L=l.index;l.add(b.x,b.y,f.x,f.y,I,A,p,_,M,t,d,a),l.add(b.x,b.y,g.x,g.y,V,A,p,_,M,t,d,a),l.add(b.x,b.y,y.x,y.y,I,w,p,_,M,t,d,a),l.add(b.x,b.y,m.x,m.y,V,w,p,_,M,t,d,a),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===L?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([L,4]),h.add(P,P+1,P+2),h.add(P+1,P+2,P+3),x.has(s)?x.get(s)[1]+=6:x.set(s,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,n=this._glyphMap;for(const[s,i]of this._glyphBufferDataStorage)for(const a of i){const i=e.index,o=a.symbolInstance,r=a.ddAttributes,l=e.index;e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tl[0],a.tl[1],a.xmin,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tr[0],a.tr[1],a.xmax,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.bl[0],a.bl[1],a.xmin,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.br[0],a.br[1],a.xmax,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===l?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([l,4]),t.add(i,i+1,i+2),t.add(i+1,i+2,i+3),n.has(s)?n.get(s)[1]+=6:n.set(s,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,n,s,i){const a=Math.max(n-1,0),o=1===s;let l,h,x,c,d,f,g,y,m,u,p;for(const _ of t){if(l=o?0:Math.max(n+r(_.minzoom),a),h=o?25:Math.min(n+r(_.maxzoom),25),h<=l)continue;x=_.tl,c=_.tr,d=_.bl,f=_.br,g=_.labelAngle,y=_.minAngle,m=_.maxAngle,u=_.anchor,p=_.mosaicRect,this._glyphBufferDataStorage.has(_.page)||this._glyphBufferDataStorage.set(_.page,[]);this._glyphBufferDataStorage.get(_.page).push({glyphAnchor:[u.x,u.y],tl:[x.x,x.y],tr:[c.x,c.y],bl:[d.x,d.y],br:[f.x,f.y],xmin:p.x,ymin:p.y,xmax:p.x+p.width,ymax:p.y+p.height,labelAngle:g,minAngle:y,maxAngle:m,minLod:l,maxLod:h,placementLod:a,symbolInstance:e,ddAttributes:i})}}static _pushAnchors(e,t,n,i){n+=i;let a=0;const o=t.length-1;for(let l=0;l<o;l++)a+=s.distance(t[l],t[l+1]);let r=i||n;if(r*=.5,a<=r)return;const x=r/a;let c=0,d=-(n=a/Math.max(Math.round(a/n),1))/2;const f=t.length-1;for(let s=0;s<f;s++){const i=t[s],a=t[s+1],o=a.x-i.x,r=a.y-i.y,f=Math.sqrt(o*o+r*r);let g;for(;d+n<c+f;){d+=n;const t=(d-c)/f,y=l(i.x,a.x,t),m=l(i.y,a.y,t);void 0===g&&(g=Math.atan2(r,o)),e.push(new h(y,m,g,s,x))}c+=f}}static _pushCenterAnchor(e,t){let n=0;const i=t.length-1;for(let l=0;l<i;l++)n+=s.distance(t[l],t[l+1]);const a=n/2;let o=0;const r=t.length-1;for(let s=0;s<r;s++){const n=t[s],i=t[s+1],r=i.x-n.x,x=i.y-n.y,c=Math.sqrt(r*r+x*x);if(a<o+c){const t=(a-o)/c,d=l(n.x,i.x,t),f=l(n.y,i.y,t),g=Math.atan2(x,r);return void e.push(new h(d,f,g,s,0))}o+=c}}static _deviation(e,t,n){const s=(t.x-e.x)*(n.x-t.x)+(t.y-e.y)*(n.y-t.y),i=(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x);return Math.atan2(i,s)}static _honorsTextMaxAngle(e,t,n,i,a){let o=0;const r=n/2;let l=new s(t.x,t.y),h=t.segment+1;for(;o>-r;){if(--h,h<0)return!1;o-=s.distance(e[h],l),l=e[h]}o+=s.distance(e[h],e[h+1]);const x=[];let c=0;const d=e.length;for(;o<r;){const t=e[h];let n,r=h;do{if(++r,r===d)return!1;n=e[r]}while(n.isEqual(t));let l,f=r;do{if(++f,f===d)return!1;l=e[f]}while(l.isEqual(n));const g=this._deviation(t,n,l);for(x.push({deviation:g,distToAnchor:o}),c+=g;o-x[0].distToAnchor>a;)c-=x.shift().deviation;if(Math.abs(c)>i)return!1;o+=s.distance(n,l),h=r}return!0}static _smoothVertices(e,t){if(t<=0)return e;let n=e.length;if(n<3)return e;const i=[];let a=0,o=0;i.push(0);for(let y=1;y<n;y++){const t=s.distance(e[y],e[y-1]);t>0&&(a+=t,i.push(a),o++,o!==y&&(e[o]=e[y]))}if(n=o+1,n<3)return e;t=Math.min(t,.2*a);const r=e[0].x,l=e[0].y,h=e[n-1].x,x=e[n-1].y,c=s.sub(e[0],e[1]);c.normalize(),e[0].x+=t*c.x,e[0].y+=t*c.y,c.assignSub(e[n-1],e[n-2]),c.normalize(),e[n-1].x+=t*c.x,e[n-1].y+=t*c.y,i[0]-=t,i[n-1]+=t;const d=[];d.push(new s(r,l));const f=1e-6,g=.5*t;for(let y=1;y<n-1;y++){let a=0,o=0,r=0;for(let n=y-1;n>=0;n--){const s=g+i[n+1]-i[y];if(s<0)break;const l=i[n+1]-i[n],h=i[y]-i[n]<g?1:s/l;if(h<f)break;const x=h*h,c=h*s-.5*x*l,d=h*l/t,m=e[n+1],u=e[n].x-m.x,p=e[n].y-m.y;a+=d/c*(m.x*h*s+.5*x*(s*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*s+.5*x*(s*p-l*m.y)-x*h*l*p/3),r+=d}for(let s=y+1;s<n;s++){const n=g-i[s-1]+i[y];if(n<0)break;const l=i[s]-i[s-1],h=i[s]-i[y]<g?1:n/l;if(h<f)break;const x=h*h,c=h*n-.5*x*l,d=h*l/t,m=e[s-1],u=e[s].x-m.x,p=e[s].y-m.y;a+=d/c*(m.x*h*n+.5*x*(n*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*n+.5*x*(n*p-l*m.y)-x*h*l*p/3),r+=d}d.push(new s(a/r,o/r))}return d.push(new s(h,x)),e[0].x=r,e[0].y=l,e[n-1].x=h,e[n-1].y=x,d}static _pushCentroid(e,t){const n=0,s=0,i=a,o=a,r=t.length-1;let l=0,x=0,c=0,d=t[0].x,f=t[0].y;d>i&&(d=i),d<n&&(d=n),f>o&&(f=o),f<s&&(f=s);for(let a=1;a<r;a++){let e=t[a].x,r=t[a].y,h=t[a+1].x,g=t[a+1].y;e>i&&(e=i),e<n&&(e=n),r>o&&(r=o),r<s&&(r=s),h>i&&(h=i),h<n&&(h=n),g>o&&(g=o),g<s&&(g=s);const y=(e-d)*(g-f)-(h-d)*(r-f);l+=y*(d+e+h),x+=y*(f+r+g),c+=y}l/=3*c,x/=3*c,isNaN(l)||isNaN(x)||e.push(new h(l,x))}}export{u as default};
|
|
2
|
+
import e from"../../../../../core/BidiEngine.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{numericHash as n}from"../../../../../core/string.js";import{Point as s}from"../../../../../geometry/support/TileClipper.js";import{tilePixelRatio as i,tileSizeInTileUnits as a}from"../constants.js";import{cDegToRad as o,log2 as r,interpolate as l}from"../GeometryUtils.js";import{Anchor as h}from"../Placement.js";import{sdfGlyphSize as x,TextShaping as c}from"../TextShaping.js";import d from"./BaseBucket.js";import{getPolygonLabelPlacement as f}from"../style/GeoJSONLabelUtils.js";import{IconLayout as g,TextLayout as y}from"../style/StyleLayer.js";const m=10;function u(e,t){return e.iconMosaicItem&&t.iconMosaicItem?e.iconMosaicItem.page===t.iconMosaicItem.page?0:e.iconMosaicItem.page-t.iconMosaicItem.page:e.iconMosaicItem&&!t.iconMosaicItem?1:!e.iconMosaicItem&&t.iconMosaicItem?-1:0}class p extends d{constructor(e,t,n,s,i,a,o,r,l){super(t,n,l.getSpriteItems()),this.type=3,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._sourceTileKey=e,this._iconVertexBuffer=s,this._iconIndexBuffer=i,this._textVertexBuffer=a,this._textIndexBuffer=o,this._placementEngine=r,this._workerTileHandler=l}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}static{this._bidiEngine=new e}getResources(e,t,s){const i=this.layer,a=this.zoom;e&&e.setExtent(this.layerExtent);const o=i.getLayoutProperty("icon-image"),r=i.getLayoutProperty("text-field");let l=i.getLayoutProperty("text-transform"),h=i.getLayoutProperty("text-font");const x=[];let c,d,f,g;o&&!o.isDataDriven&&(c=o.getValue(a)),r&&!r.isDataDriven&&(d=r.getValue(a)),l&&l.isDataDriven||(f=i.getLayoutValue("text-transform",a),l=null),h&&h.isDataDriven||(g=i.getLayoutValue("text-font",a),h=null);for(const y of this._features){const m=y.getGeometry(e);if(!m||0===m.length)continue;let u,_;o&&(u=o.isDataDriven?o.getValue(a,y):this._replaceKeys(c,y.values),u&&t(u));let M=!1;if(r&&(_=r.isDataDriven?r.getValue(a,y):this._replaceKeys(d,y.values),_)){switch(_=_.replaceAll("\\n","\n"),l&&(f=l.getValue(a,y)),f){case 2:_=_.toLowerCase();break;case 1:_=_.toUpperCase()}if(p._bidiEngine.hasBidiChar(_)){let e;e="rtl"===p._bidiEngine.checkContextual(_)?"IDNNN":"ICNNN",_=p._bidiEngine.bidiTransform(_,e,"VLYSN"),M=!0}if(_.length>0){h&&(g=h.getValue(a,y));for(const e of g){let t=s[e];t||(t=s[e]=new Set);for(const e of _){const n=e.codePointAt(0);null!=n&&t.add(n)}}}}if(!u&&!_)continue;const b=i.getLayoutValue("symbol-sort-key",a,y),P={feature:y,sprite:u,label:_,rtl:M,geometry:m,hash:(_?n(_):0)^(u?n(u):0),priority:b,textFont:g};x.push(P)}this._symbolFeatures=x}processFeatures(e){e&&e.setExtent(this.layerExtent);const n=this.layer,s=this.zoom,r=n.getLayoutValue("symbol-placement",s),l=0!==r,d=n.getLayoutValue("symbol-spacing",s)*i,f=n.getLayoutProperty("icon-image"),m=n.getLayoutProperty("text-field"),_=f?new g(n,s,l):null,M=m?new y(n,s,l):null,b=this._workerTileHandler;let P;f&&(P=b.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const I=[];let A=1;M?.size&&(A=M.size/x);const V=M?M.maxAngle*o:0,w=M?M.size*i:0;for(const o of this._symbolFeatures){let e;_&&P&&o.sprite&&(e=P[o.sprite],e&&e.sdf&&(this._isIconSDF=!0));let f;!!e&&_.update(s,o.feature);let g=0;const y=o.label;if(y){t(M),M.update(s,o.feature);const e=l&&0===M.rotationAlignment?M.keepUpright:M.writingMode&&M.writingMode.includes(1);let n=.5;switch(M.anchor){case 5:case 1:case 7:n=0;break;case 6:case 2:case 8:n=1}let a=.5;switch(M.anchor){case 5:case 3:case 6:a=0;break;case 7:case 4:case 8:a=1}let r=.5;switch(M.justify){case 0:r=n;break;case 1:r=0;break;case 3:r=1}const h=M.letterSpacing*x,d=l?0:M.maxWidth*x,m=M.lineHeight*x,u=o.textFont.map(e=>b.getGlyphItems(e));if(f=new c(u,d,m,h,n,a,r).getShaping(y,o.rtl,e),f&&f.length>0){let e=1e30,t=-1e30;for(const n of f)e=Math.min(e,n.x),t=Math.max(t,n.x);g=(t-e+2*x)*A*i}}const m=p._getPlacementCandidates(n,r,o.feature,o.geometry);for(const t of m){let{vertices:n}=t;const s=[];if(1===r){if(f?.length&&M?.size){const e=M.size*i*(2+Math.min(2,4*Math.abs(M.offset[1])));n=p._smoothVertices(n,e)}p._pushAnchors(s,n,d,g)}else 2===r?p._pushCenterAnchor(s,n):3===o.feature.type?t.anchor?s.push(t.anchor):p._pushCentroid(s,n):s.push(new h(n[0].x,n[0].y));for(const t of s){if(t.x<0||t.x>a||t.y<0||t.y>a)continue;if(l&&g>0&&0===M?.rotationAlignment&&!p._honorsTextMaxAngle(n,t,g,V,w))continue;const s={shaping:f,line:n,iconMosaicItem:e,anchor:t,symbolFeature:o,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};I.push(s),this._processFeature(s,_,M)}}}I.sort(u),this._addPlacedGlyphs(),this._symbolInstances=I}serialize(){let e=14;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=p._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),n=new Int32Array(t.buffer),s=new Float32Array(t.buffer),[i,a,o]=this._sourceTileKey.split("/");let r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let l=0;l<this.layerUIDs.length;l++)t[r++]=this.layerUIDs[l];t[r++]=this._isIconSDF?1:0,t[r++]=parseFloat(i),t[r++]=parseFloat(a),t[r++]=parseFloat(o),t[r++]=this.markerPageMap.size;for(const[l,[h,x]]of this.markerPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this.glyphsPageMap.size;for(const[l,[h,x]]of this.glyphsPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this._iconVertexBuffer.index/4,t[r++]=this._textVertexBuffer.index/4,r=p.serializeSymbols(t,n,s,r,this._symbolInstances),t[r++]=this._iconVertexBuffer.array.length;for(let l=0;l<this._iconVertexBuffer.array.length;l++)n[r++]=this._iconVertexBuffer.array[l];t[r++]=this._iconIndexBuffer.array.length;for(let l=0;l<this._iconIndexBuffer.array.length;l++)t[r++]=this._iconIndexBuffer.array[l];t[r++]=this._textVertexBuffer.array.length;for(let l=0;l<this._textVertexBuffer.array.length;l++)n[r++]=this._textVertexBuffer.array[l];t[r++]=this._textIndexBuffer.array.length;for(let l=0;l<this._textIndexBuffer.array.length;l++)t[r++]=this._textIndexBuffer.array[l];return t.buffer}static _symbolsSerializationLength(e){let t=0;t+=1;for(const n of e||[]){t+=5,t+=1;for(const e of n.textColliders)t+=m;for(const e of n.iconColliders)t+=m;t+=1,t+=2*n.textVertexRanges.length,t+=1,t+=2*n.iconVertexRanges.length}return t}static serializeSymbols(e,t,n,s,i){i=i||[],t[s++]=i.length;for(const a of i){t[s++]=a.anchor.x,t[s++]=a.anchor.y,t[s++]=a.symbolFeature.hash,t[s++]=a.symbolFeature.priority,t[s++]=a.symbolFeature.feature.featureIndex,t[s++]=a.textColliders.length+a.iconColliders.length;for(const e of a.textColliders)t[s++]=e.xTile,t[s++]=e.yTile,t[s++]=e.dxPixels,t[s++]=e.dyPixels,t[s++]=e.hard?1:0,t[s++]=e.partIndex,n[s++]=e.minLod,n[s++]=e.maxLod,t[s++]=e.width,t[s++]=e.height;for(const e of a.iconColliders)t[s++]=e.xTile,t[s++]=e.yTile,t[s++]=e.dxPixels,t[s++]=e.dyPixels,t[s++]=e.hard?1:0,t[s++]=e.partIndex,n[s++]=e.minLod,n[s++]=e.maxLod,t[s++]=e.width,t[s++]=e.height;t[s++]=a.textVertexRanges.length;for(const[e,n]of a.textVertexRanges)t[s++]=e,t[s++]=n;t[s++]=a.iconVertexRanges.length;for(const[e,n]of a.iconVertexRanges)t[s++]=e,t[s++]=n}return s}_replaceKeys(e,t){return e.replaceAll(/{([^{}]+)}/g,(e,n)=>n in t?t[n]:"")}_processFeature(e,t,n){const{line:s,iconMosaicItem:i,shaping:a,anchor:o}=e,l=this.zoom,h=this.layer,x=!!i;let c=!0;x&&(c=t?.optional||!i);const d=a&&a.length>0,f=!d||n?.optional;let g,y;if(x&&(g=this._placementEngine.getIconPlacement(o,i,t)),(g||c)&&(d&&(y=this._placementEngine.getTextPlacement(o,a,s,n)),y||f)){if(g&&y||(f||c?f||y?c||g||(y=null):g=null:(g=null,y=null)),y){const t=h.hasDataDrivenText?h.textMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._storePlacedGlyphs(e,y.shapes,l,n.rotationAlignment,t),y.textColliders){e.textColliders=y.textColliders;for(const e of y.textColliders){e.minLod=Math.max(l+r(e.minLod),0),e.maxLod=Math.min(l+r(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),s=Math.sin(t),i=e.dxPixels*n-e.dyPixels*s,a=e.dxPixels*s+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*s,r=(e.dxPixels+e.width)*s+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*s,h=e.dxPixels*s+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*s,c=(e.dxPixels+e.width)*s+(e.dyPixels+e.height)*n,d=Math.min(i,o,l,x),f=Math.max(i,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}if(g){const n=h.hasDataDrivenIcon?h.iconMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._addPlacedIcons(e,g.shapes,l,i.page,1===t.rotationAlignment,n),g.iconColliders){e.iconColliders=g.iconColliders;for(const e of g.iconColliders){e.minLod=Math.max(l+r(e.minLod),0),e.maxLod=Math.min(l+r(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),s=Math.sin(t),i=e.dxPixels*n-e.dyPixels*s,a=e.dxPixels*s+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*s,r=(e.dxPixels+e.width)*s+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*s,h=e.dxPixels*s+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*s,c=(e.dxPixels+e.width)*s+(e.dyPixels+e.height)*n,d=Math.min(i,o,l,x),f=Math.max(i,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}}}_addPlacedIcons(e,t,n,s,i,a){const o=Math.max(n-1,0),l=this._iconVertexBuffer,h=this._iconIndexBuffer,x=this._markerMap;for(const c of t){const t=i?0:Math.max(n+r(c.minzoom),o),d=i?25:Math.min(n+r(c.maxzoom),25);if(d<=t)continue;const f=c.tl,g=c.tr,y=c.bl,m=c.br,u=c.mosaicRect,p=c.labelAngle,_=c.minAngle,M=c.maxAngle,b=c.anchor,P=l.index,I=u.x,A=u.y,V=I+u.width,w=A+u.height,L=l.index;l.add(b.x,b.y,f.x,f.y,I,A,p,_,M,t,d,a),l.add(b.x,b.y,g.x,g.y,V,A,p,_,M,t,d,a),l.add(b.x,b.y,y.x,y.y,I,w,p,_,M,t,d,a),l.add(b.x,b.y,m.x,m.y,V,w,p,_,M,t,d,a),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===L?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([L,4]),h.add(P,P+1,P+2),h.add(P+1,P+2,P+3),x.has(s)?x.get(s)[1]+=6:x.set(s,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,n=this._glyphMap;for(const[s,i]of this._glyphBufferDataStorage)for(const a of i){const i=e.index,o=a.symbolInstance,r=a.ddAttributes,l=e.index;e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tl[0],a.tl[1],a.xmin,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tr[0],a.tr[1],a.xmax,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.bl[0],a.bl[1],a.xmin,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.br[0],a.br[1],a.xmax,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===l?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([l,4]),t.add(i,i+1,i+2),t.add(i+1,i+2,i+3),n.has(s)?n.get(s)[1]+=6:n.set(s,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,n,s,i){const a=Math.max(n-1,0),o=1===s;let l,h,x,c,d,f,g,y,m,u,p;for(const _ of t){if(l=o?0:Math.max(n+r(_.minzoom),a),h=o?25:Math.min(n+r(_.maxzoom),25),h<=l)continue;x=_.tl,c=_.tr,d=_.bl,f=_.br,g=_.labelAngle,y=_.minAngle,m=_.maxAngle,u=_.anchor,p=_.mosaicRect,this._glyphBufferDataStorage.has(_.page)||this._glyphBufferDataStorage.set(_.page,[]);this._glyphBufferDataStorage.get(_.page).push({glyphAnchor:[u.x,u.y],tl:[x.x,x.y],tr:[c.x,c.y],bl:[d.x,d.y],br:[f.x,f.y],xmin:p.x,ymin:p.y,xmax:p.x+p.width,ymax:p.y+p.height,labelAngle:g,minAngle:y,maxAngle:m,minLod:l,maxLod:h,placementLod:a,symbolInstance:e,ddAttributes:i})}}static _pushAnchors(e,t,n,i){n+=i;let a=0;const o=t.length-1;for(let l=0;l<o;l++)a+=s.distance(t[l],t[l+1]);let r=i||n;if(r*=.5,a<=r)return;const x=r/a;let c=0,d=-(n=a/Math.max(Math.round(a/n),1))/2;const f=t.length-1;for(let s=0;s<f;s++){const i=t[s],a=t[s+1],o=a.x-i.x,r=a.y-i.y,f=Math.sqrt(o*o+r*r);let g;for(;d+n<c+f;){d+=n;const t=(d-c)/f,y=l(i.x,a.x,t),m=l(i.y,a.y,t);void 0===g&&(g=Math.atan2(r,o)),e.push(new h(y,m,g,s,x))}c+=f}}static _pushCenterAnchor(e,t){let n=0;const i=t.length-1;for(let l=0;l<i;l++)n+=s.distance(t[l],t[l+1]);const a=n/2;let o=0;const r=t.length-1;for(let s=0;s<r;s++){const n=t[s],i=t[s+1],r=i.x-n.x,x=i.y-n.y,c=Math.sqrt(r*r+x*x);if(a<o+c){const t=(a-o)/c,d=l(n.x,i.x,t),f=l(n.y,i.y,t),g=Math.atan2(x,r);return void e.push(new h(d,f,g,s,0))}o+=c}}static _deviation(e,t,n){const s=(t.x-e.x)*(n.x-t.x)+(t.y-e.y)*(n.y-t.y),i=(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x);return Math.atan2(i,s)}static _honorsTextMaxAngle(e,t,n,i,a){let o=0;const r=n/2;let l=new s(t.x,t.y),h=t.segment+1;for(;o>-r;){if(--h,h<0)return!1;o-=s.distance(e[h],l),l=e[h]}o+=s.distance(e[h],e[h+1]);const x=[];let c=0;const d=e.length;for(;o<r;){const t=e[h];let n,r=h;do{if(++r,r===d)return!1;n=e[r]}while(n.isEqual(t));let l,f=r;do{if(++f,f===d)return!1;l=e[f]}while(l.isEqual(n));const g=this._deviation(t,n,l);for(x.push({deviation:g,distToAnchor:o}),c+=g;o-x[0].distToAnchor>a;)c-=x.shift().deviation;if(Math.abs(c)>i)return!1;o+=s.distance(n,l),h=r}return!0}static _smoothVertices(e,t){if(t<=0)return e;let n=e.length;if(n<3)return e;const i=[];let a=0,o=0;i.push(0);for(let y=1;y<n;y++){const t=s.distance(e[y],e[y-1]);t>0&&(a+=t,i.push(a),o++,o!==y&&(e[o]=e[y]))}if(n=o+1,n<3)return e;t=Math.min(t,.2*a);const r=e[0].x,l=e[0].y,h=e[n-1].x,x=e[n-1].y,c=s.sub(e[0],e[1]);c.normalize(),e[0].x+=t*c.x,e[0].y+=t*c.y,c.assignSub(e[n-1],e[n-2]),c.normalize(),e[n-1].x+=t*c.x,e[n-1].y+=t*c.y,i[0]-=t,i[n-1]+=t;const d=[];d.push(new s(r,l));const f=1e-6,g=.5*t;for(let y=1;y<n-1;y++){let a=0,o=0,r=0;for(let n=y-1;n>=0;n--){const s=g+i[n+1]-i[y];if(s<0)break;const l=i[n+1]-i[n],h=i[y]-i[n]<g?1:s/l;if(h<f)break;const x=h*h,c=h*s-.5*x*l,d=h*l/t,m=e[n+1],u=e[n].x-m.x,p=e[n].y-m.y;a+=d/c*(m.x*h*s+.5*x*(s*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*s+.5*x*(s*p-l*m.y)-x*h*l*p/3),r+=d}for(let s=y+1;s<n;s++){const n=g-i[s-1]+i[y];if(n<0)break;const l=i[s]-i[s-1],h=i[s]-i[y]<g?1:n/l;if(h<f)break;const x=h*h,c=h*n-.5*x*l,d=h*l/t,m=e[s-1],u=e[s].x-m.x,p=e[s].y-m.y;a+=d/c*(m.x*h*n+.5*x*(n*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*n+.5*x*(n*p-l*m.y)-x*h*l*p/3),r+=d}d.push(new s(a/r,o/r))}return d.push(new s(h,x)),e[0].x=r,e[0].y=l,e[n-1].x=h,e[n-1].y=x,d}static _getPlacementCandidates(e,t,n,s){if(0!==t||3!==n.type||"geojson"!==e.sourceType)return s.map(e=>({anchor:null,vertices:e}));const i=f(s);return i?[{anchor:new h(i.x,i.y),vertices:i.vertices}]:[]}static _pushCentroid(e,t){const n=0,s=0,i=a,o=a,r=t.length-1;let l=0,x=0,c=0,d=t[0].x,f=t[0].y;d>i&&(d=i),d<n&&(d=n),f>o&&(f=o),f<s&&(f=s);for(let a=1;a<r;a++){let e=t[a].x,r=t[a].y,h=t[a+1].x,g=t[a+1].y;e>i&&(e=i),e<n&&(e=n),r>o&&(r=o),r<s&&(r=s),h>i&&(h=i),h<n&&(h=n),g>o&&(g=o),g<s&&(g=s);const y=(e-d)*(g-f)-(h-d)*(r-f);l+=y*(d+e+h),x+=y*(f+r+g),c+=y}l/=3*c,x/=3*c,isNaN(l)||isNaN(x)||e.push(new h(l,x))}}export{p as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{GeometryCursor as o}from"../../../../../geometry/GeometryCursor.js";import{getPolylabelPoint as t}from"../../../../../geometry/support/labelPoint.js";import r from"../../../../../layers/graphics/OptimizedGeometry.js";function e(e){let l=null,s=0,m=[],f=0;for(const o of e){const t=n(o);t>0?(f>s&&(s=f,l=m),m=[o],f=t):t<0&&m.length>0&&(m.push(o),f+=t)}if(f>s&&(l=m),!l)return null;const i=l.map(o=>o.length),p=[];for(const o of l)for(const t of o)p.push(t.x,t.y);const u=o.fromOptimized(new r(i,p),"esriGeometryPolygon"),y=t(u);return y?{x:y[0],y:y[1],vertices:l[0]}:null}function n(o){let t=0;for(let r=0,e=o.length-1;r<o.length;e=r++)t+=(o[e].x-o[r].x)*(o[r].y+o[e].y);return.5*t}export{e as getPolygonLabelPlacement};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{fromValues as t}from"../../../../../geometry/support/aaBoundingRect.js";import{tilePixelRatio as i}from"../constants.js";import{translateAnchor as e,offsetLine as a,distanceFromToPolylineWithinThreshold as o,pointInPolygon as r}from"../GeometryUtils.js";import{VTLBackgroundMaterial as n}from"../shaders/VTLBackgroundMaterial.js";import{VTLCircleMaterial as s}from"../shaders/VTLCircleMaterial.js";import{VTLFillMaterial as l,VTLOutlineMaterial as h}from"../shaders/VTLFillMaterial.js";import{VTLLineMaterial as u}from"../shaders/VTLLineMaterial.js";import{VTLIconMaterial as p,VTLTextMaterial as g}from"../shaders/VTLSymbolMaterial.js";import c from"./Filter.js";import{StyleDefinition as y}from"./StyleDefinition.js";import P from"./StyleProperty.js";import{thinLineHalfWidthThreshold as f}from"../../webgl/definitions.js";class D{constructor(t,i,e,a,o,r){this.layer=t,this.feature=i,this.bounds=e,this.normalizationRatio=a,this.normalizationOffsetX=o,this.normalizationOffsetY=r}}class m{constructor(t,i,e,a){switch(this.type=t,this.typeName=i.type,this.id=i.id,this.source=i.source,this.sourceLayer=i["source-layer"]??i.source,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,this.filter=i.filter,this.layout=i.layout,this.paint=i.paint,this.z=e,this.uid=a,t){case 0:this._layoutDefinition=y.backgroundLayoutDefinition,this._paintDefinition=y.backgroundPaintDefinition;break;case 1:this._layoutDefinition=y.fillLayoutDefinition,this._paintDefinition=y.fillPaintDefinition;break;case 2:this._layoutDefinition=y.lineLayoutDefinition,this._paintDefinition=y.linePaintDefinition;break;case 3:this._layoutDefinition=y.symbolLayoutDefinition,this._paintDefinition=y.symbolPaintDefinition;break;case 4:this._layoutDefinition=y.circleLayoutDefinition,this._paintDefinition=y.circlePaintDefinition}this._layoutProperties=this._parseLayout(this.layout),this._paintProperties=this._parsePaint(this.paint)}getFeatureFilter(){return void 0!==this._featureFilter?this._featureFilter:this._featureFilter=c.createFilter(this.filter)}getLayoutProperty(t){return this._layoutProperties[t]}getPaintProperty(t){return this._paintProperties[t]}getLayoutValue(t,i,e){let a;const o=this._layoutProperties[t];return o&&(a=o.getValue(i,e)),void 0===a&&(a=this._layoutDefinition[t].default),a}getPaintValue(t,i,e){let a;const o=this._paintProperties[t];return o&&(a=o.getValue(i,e)),void 0===a&&(a=this._paintDefinition[t].default),a}isPainterDataDriven(){const t=this._paintProperties;if(t)for(const i in t)if(t[i].isDataDriven)return!0;return!1}isIntersectingFeature(t,i,e,a,o,r,n,s){return!1}getFeatureInflatedBounds(t,i,e,a){return null}_parseLayout(t){const i={};for(const e in t){const a=this._layoutDefinition[e];a&&(i[e]=new P(a,t[e]))}return i}_parsePaint(t){const i={};for(const e in t){const a=this._paintDefinition[e];a&&(i[e]=new P(a,t[e]))}return i}computeAttributesKey(t,i,e,a){let o=0,r=0;for(const n of i){let t=3;if(n&&n!==a){const i=e[n],{isLayout:a,isOptional:o}=i,r=a?this.getLayoutProperty(n):this.getPaintProperty(n);t=r?.interpolator?2:r?.isDataDriven?1:o&&!r?3:0}r|=t<<o,o+=2}return r<<3|t}}class d extends m{constructor(t,i,e,a){super(t,i,e,a),this.backgroundMaterial=new n(this.computeAttributesKey(0,n.ATTRIBUTES,n.ATTRIBUTES_INFO))}}class _ extends m{constructor(t,i,e,a){super(t,i,e,a);const o=this.getPaintProperty("fill-color"),r=this.getPaintProperty("fill-opacity"),n=this.getPaintProperty("fill-pattern");this.hasDataDrivenColor=o?.isDataDriven,this.hasDataDrivenOpacity=r?.isDataDriven,this.hasDataDrivenFill=this.hasDataDrivenColor||this.hasDataDrivenOpacity||n?.isDataDriven;const s=this.getPaintProperty("fill-outline-color");this.outlineUsesFillColor=!s,this.hasDataDrivenOutlineColor=s?.isDataDriven,this.hasDataDrivenOutline=s?s.isDataDriven:!!o&&o.isDataDriven,this.hasDataDrivenOutline=(s?this.hasDataDrivenOutlineColor:this.hasDataDrivenColor)||this.hasDataDrivenOpacity,this.fillMaterial=new l(this.computeAttributesKey(1,l.ATTRIBUTES,l.ATTRIBUTES_INFO)),this.outlineMaterial=new h(this.computeAttributesKey(2,this.outlineUsesFillColor?h.ATTRIBUTES_FILL:h.ATTRIBUTES_OUTLINE,this.outlineUsesFillColor?h.ATTRIBUTES_INFO_FILL:h.ATTRIBUTES_INFO_OUTLINE),this.outlineUsesFillColor)}getFeatureInflatedBounds(t,i,e,a){const o=z(t);if(!o)return null;const r=this.getPaintValue("fill-translate",i,t),n=a*Math.max(r[0],r[1]);return o[0]-=n,o[2]-=n,o[1]+=n,o[3]+=n,o}isIntersectingFeature(t,a,n,s,l,h,u,p){const g=s.getGeometry();if(!g)return!1;const c=i/p.normalizationRatio,y=c/u;t=t/p.normalizationRatio+p.normalizationOffsetX,a=a/p.normalizationRatio+p.normalizationOffsetY;const P=e(this.getPaintValue("fill-translate",l,s),this.getPaintValue("fill-translate-anchor",l,s),h,y);t-=c*P.x,a-=c*P.y;return!!r(t,a,g)||o(t,a,g,n)}}class L extends m{constructor(t,i,e,a){super(t,i,e,a);const o=this.getPaintProperty("line-pattern");if(this.lineMaterial=new u(this.computeAttributesKey(3,u.ATTRIBUTES,u.ATTRIBUTES_INFO,o?"line-dasharray":"")),this.hasDataDrivenLine=this.getPaintProperty("line-blur")?.isDataDriven||this.getPaintProperty("line-color")?.isDataDriven||this.getPaintProperty("line-gap-width")?.isDataDriven||this.getPaintProperty("line-offset")?.isDataDriven||this.getPaintProperty("line-opacity")?.isDataDriven||this.getPaintProperty("line-pattern")?.isDataDriven||this.getPaintProperty("line-dasharray")?.isDataDriven||this.getLayoutProperty("line-cap")?.isDataDriven||this.getPaintProperty("line-width")?.isDataDriven,this.canUseThinTessellation=!1,!this.hasDataDrivenLine){const t=this.getPaintProperty("line-width");if(!t||"number"==typeof t&&.5*t<f){const t=this.getPaintProperty("line-offset");(!t||"number"==typeof t&&0===t)&&(this.canUseThinTessellation=!0)}}}getDashKey(t,i){let e;switch(i){case 0:default:e="Butt";break;case 1:e="Round";break;case 2:e="Square"}return`dasharray-[${t.toString()}]-${e}`}getFeatureInflatedBounds(t,i,e,a){const o=z(t);if(!o)return null;const r=this.getPaintValue("line-translate",i,t),n=a*Math.max(r[0],r[1]);o[0]-=n,o[2]-=n,o[1]+=n,o[3]+=n;const s=a*Math.abs(this.getPaintValue("line-offset",i,t)||0),l=a*(this.getPaintValue("line-width",i,t)/2);return o[0]-=s+l,o[1]-=s+l,o[2]+=s+l,o[3]+=s+l,o}isIntersectingFeature(t,r,n,s,l,h,u,p){let g=s.getGeometry();if(!g)return!1;const c=i/p.normalizationRatio,y=c/u;t=t/p.normalizationRatio+p.normalizationOffsetX,r=r/p.normalizationRatio+p.normalizationOffsetY;const P=e(this.getPaintValue("line-translate",l,s),this.getPaintValue("line-translate-anchor",l,s),h,y);t-=c*P.x,r-=c*P.y;const f=y*this.getPaintValue("line-offset",l,s)||0;0!==f&&(g=a(g,-f));const D=this.getPaintValue("line-width",l,s);return o(t,r,g,y*(D/2)+n)}}class v extends m{constructor(t,i,e,a){super(t,i,e,a),this.iconMaterial=new p(this.computeAttributesKey(4,p.ATTRIBUTES,p.ATTRIBUTES_INFO)),this.textMaterial=new g(this.computeAttributesKey(6,g.ATTRIBUTES,g.ATTRIBUTES_INFO)),this.hasDataDrivenIcon=this.getPaintProperty("icon-color")?.isDataDriven||this.getPaintProperty("icon-halo-blur")?.isDataDriven||this.getPaintProperty("icon-halo-color")?.isDataDriven||this.getPaintProperty("icon-halo-width")?.isDataDriven||this.getPaintProperty("icon-opacity")?.isDataDriven||this.getLayoutProperty("icon-size")?.isDataDriven,this.hasDataDrivenText=this.getPaintProperty("text-color")?.isDataDriven||this.getPaintProperty("text-halo-blur")?.isDataDriven||this.getPaintProperty("text-halo-color")?.isDataDriven||this.getPaintProperty("text-halo-width")?.isDataDriven||this.getPaintProperty("text-opacity")?.isDataDriven||this.getLayoutProperty("text-size")?.isDataDriven}}class x extends m{constructor(t,i,e,a){super(t,i,e,a),this.circleMaterial=new s(this.computeAttributesKey(5,s.ATTRIBUTES,s.ATTRIBUTES_INFO))}getFeatureInflatedBounds(t,e,a,o){const r=z(t);if(!r)return null;const n=this.getPaintValue("circle-translate",e,t),s=Math.max(n[0],n[1]);r[0]-=s,r[2]-=s,r[1]+=s,r[3]+=s;const l=o*(i*(this.getPaintValue("circle-radius",e,t)+this.getPaintValue("circle-stroke-width",e,t))/2);return r[0]-=l,r[1]-=l,r[2]+=l,r[3]+=l,r}isIntersectingFeature(t,a,o,r,n,s,l,h){const u=r.getGeometry();if(!u)return!1;const p=i/h.normalizationRatio/l;t=t/h.normalizationRatio+h.normalizationOffsetX,a=a/h.normalizationRatio+h.normalizationOffsetY;const g=e(this.getPaintValue("circle-translate",n,r),this.getPaintValue("circle-translate-anchor",n,r),s,p),c=p*(this.getPaintValue("circle-radius",n,r)+this.getPaintValue("circle-stroke-width",n,r));let y,P;for(const i of u)if(i)for(const e of i){y=e.x+g.x,P=e.y+g.y;if(Math.sqrt((t-y)*(t-y)+(a-P)*(a-P))-o<=c)return!0}return!1}}class V{constructor(t,i,e){let a;this.allowOverlap=t.getLayoutValue("icon-allow-overlap",i),this.ignorePlacement=t.getLayoutValue("icon-ignore-placement",i),this.keepUpright=t.getLayoutValue("icon-keep-upright",i),this.optional=t.getLayoutValue("icon-optional",i),this.rotationAlignment=t.getLayoutValue("icon-rotation-alignment",i),2===this.rotationAlignment&&(this.rotationAlignment=e?0:1),a=t.getLayoutProperty("icon-anchor"),a?.isDataDriven?this._anchorProp=a:this.anchor=t.getLayoutValue("icon-anchor",i),a=t.getLayoutProperty("icon-offset"),a?.isDataDriven?this._offsetProp=a:this.offset=t.getLayoutValue("icon-offset",i),a=t.getLayoutProperty("icon-padding"),a?.isDataDriven?this._paddingProp=a:this.padding=t.getLayoutValue("icon-padding",i),a=t.getLayoutProperty("icon-rotate"),a?.isDataDriven?this._rotateProp=a:this.rotate=t.getLayoutValue("icon-rotate",i),a=t.getLayoutProperty("icon-size"),a?.isDataDriven?this._sizeProp=a:this.size=t.getLayoutValue("icon-size",i)}update(t,i){this._anchorProp&&(this.anchor=this._anchorProp.getValue(t,i)),this._offsetProp&&(this.offset=this._offsetProp.getValue(t,i)),this._paddingProp&&(this.padding=this._paddingProp.getValue(t,i)),this._rotateProp&&(this.rotate=this._rotateProp.getValue(t,i)),this._sizeProp&&(this.size=this._sizeProp.getValue(t,i))}}class T{constructor(t,i,e){let a;this.allowOverlap=t.getLayoutValue("text-allow-overlap",i),this.ignorePlacement=t.getLayoutValue("text-ignore-placement",i),this.keepUpright=t.getLayoutValue("text-keep-upright",i),this.optional=t.getLayoutValue("text-optional",i),this.rotationAlignment=t.getLayoutValue("text-rotation-alignment",i),2===this.rotationAlignment&&(this.rotationAlignment=e?0:1),a=t.getLayoutProperty("text-anchor"),a?.isDataDriven?this._anchorProp=a:this.anchor=t.getLayoutValue("text-anchor",i),a=t.getLayoutProperty("text-justify"),a?.isDataDriven?this._justifyProp=a:this.justify=t.getLayoutValue("text-justify",i),a=t.getLayoutProperty("text-letter-spacing"),a?.isDataDriven?this._letterSpacingProp=a:this.letterSpacing=t.getLayoutValue("text-letter-spacing",i),a=t.getLayoutProperty("text-line-height"),a?.isDataDriven?this._lineHeightProp=a:this.lineHeight=t.getLayoutValue("text-line-height",i),a=t.getLayoutProperty("text-max-angle"),a?.isDataDriven?this._maxAngleProp=a:this.maxAngle=t.getLayoutValue("text-max-angle",i),a=t.getLayoutProperty("text-max-width"),a?.isDataDriven?this._maxWidthProp=a:this.maxWidth=t.getLayoutValue("text-max-width",i),a=t.getLayoutProperty("text-offset"),a?.isDataDriven?this._offsetProp=a:this.offset=t.getLayoutValue("text-offset",i),a=t.getLayoutProperty("text-padding"),a?.isDataDriven?this._paddingProp=a:this.padding=t.getLayoutValue("text-padding",i),a=t.getLayoutProperty("text-rotate"),a?.isDataDriven?this._rotateProp=a:this.rotate=t.getLayoutValue("text-rotate",i),a=t.getLayoutProperty("text-size"),a?.isDataDriven?this._sizeProp=a:this.size=t.getLayoutValue("text-size",i),a=t.getLayoutProperty("text-writing-mode"),a?.isDataDriven?this._writingModeProp=a:this.writingMode=t.getLayoutValue("text-writing-mode",i)}update(t,i){this._anchorProp&&(this.anchor=this._anchorProp.getValue(t,i)),this._justifyProp&&(this.justify=this._justifyProp.getValue(t,i)),this._letterSpacingProp&&(this.letterSpacing=this._letterSpacingProp.getValue(t,i)),this._lineHeightProp&&(this.lineHeight=this._lineHeightProp.getValue(t,i)),this._maxAngleProp&&(this.maxAngle=this._maxAngleProp.getValue(t,i)),this._maxWidthProp&&(this.maxWidth=this._maxWidthProp.getValue(t,i)),this._offsetProp&&(this.offset=this._offsetProp.getValue(t,i)),this._paddingProp&&(this.padding=this._paddingProp.getValue(t,i)),this._rotateProp&&(this.rotate=this._rotateProp.getValue(t,i)),this._sizeProp&&(this.size=this._sizeProp.getValue(t,i)),this._writingModeProp&&(this.writingMode=this._writingModeProp.getValue(t,i))}}function z(i){const e=i?.getGeometry();if(null==e)return null;let a=1/0,o=1/0,r=-1/0,n=-1/0;for(const t of e)if(t)for(const i of t)a=Math.min(a,i.x),o=Math.min(o,i.y),r=Math.max(r,i.x),n=Math.max(n,i.y);return t(a,o,r,n)}export{d as BackgroundStyleLayer,x as CircleStyleLayer,_ as FillStyleLayer,V as IconLayout,D as IndexItem,L as LineStyleLayer,m as StyleLayer,v as SymbolStyleLayer,T as TextLayout};
|
|
2
|
+
import{fromValues as t}from"../../../../../geometry/support/aaBoundingRect.js";import{tilePixelRatio as i}from"../constants.js";import{translateAnchor as e,offsetLine as a,distanceFromToPolylineWithinThreshold as o,pointInPolygon as r}from"../GeometryUtils.js";import{VTLBackgroundMaterial as n}from"../shaders/VTLBackgroundMaterial.js";import{VTLCircleMaterial as s}from"../shaders/VTLCircleMaterial.js";import{VTLFillMaterial as l,VTLOutlineMaterial as h}from"../shaders/VTLFillMaterial.js";import{VTLLineMaterial as u}from"../shaders/VTLLineMaterial.js";import{VTLIconMaterial as p,VTLTextMaterial as c}from"../shaders/VTLSymbolMaterial.js";import g from"./Filter.js";import{StyleDefinition as y}from"./StyleDefinition.js";import P from"./StyleProperty.js";import{thinLineHalfWidthThreshold as f}from"../../webgl/definitions.js";class D{constructor(t,i,e,a,o,r){this.layer=t,this.feature=i,this.bounds=e,this.normalizationRatio=a,this.normalizationOffsetX=o,this.normalizationOffsetY=r}}class m{constructor(t,i,e,a,o=null){switch(this.type=t,this.typeName=i.type,this.id=i.id,this.source=i.source,this.sourceLayer=i["source-layer"]??i.source,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,this.filter=i.filter,this.layout=i.layout,this.paint=i.paint,this.z=e,this.uid=a,this.sourceType=o,t){case 0:this._layoutDefinition=y.backgroundLayoutDefinition,this._paintDefinition=y.backgroundPaintDefinition;break;case 1:this._layoutDefinition=y.fillLayoutDefinition,this._paintDefinition=y.fillPaintDefinition;break;case 2:this._layoutDefinition=y.lineLayoutDefinition,this._paintDefinition=y.linePaintDefinition;break;case 3:this._layoutDefinition=y.symbolLayoutDefinition,this._paintDefinition=y.symbolPaintDefinition;break;case 4:this._layoutDefinition=y.circleLayoutDefinition,this._paintDefinition=y.circlePaintDefinition}this._layoutProperties=this._parseLayout(this.layout),this._paintProperties=this._parsePaint(this.paint)}getFeatureFilter(){return void 0!==this._featureFilter?this._featureFilter:this._featureFilter=g.createFilter(this.filter)}getLayoutProperty(t){return this._layoutProperties[t]}getPaintProperty(t){return this._paintProperties[t]}getLayoutValue(t,i,e){let a;const o=this._layoutProperties[t];return o&&(a=o.getValue(i,e)),void 0===a&&(a=this._layoutDefinition[t].default),a}getPaintValue(t,i,e){let a;const o=this._paintProperties[t];return o&&(a=o.getValue(i,e)),void 0===a&&(a=this._paintDefinition[t].default),a}isPainterDataDriven(){const t=this._paintProperties;if(t)for(const i in t)if(t[i].isDataDriven)return!0;return!1}isIntersectingFeature(t,i,e,a,o,r,n,s){return!1}getFeatureInflatedBounds(t,i,e,a){return null}_parseLayout(t){const i={};for(const e in t){const a=this._layoutDefinition[e];a&&(i[e]=new P(a,t[e]))}return i}_parsePaint(t){const i={};for(const e in t){const a=this._paintDefinition[e];a&&(i[e]=new P(a,t[e]))}return i}computeAttributesKey(t,i,e,a){let o=0,r=0;for(const n of i){let t=3;if(n&&n!==a){const i=e[n],{isLayout:a,isOptional:o}=i,r=a?this.getLayoutProperty(n):this.getPaintProperty(n);t=r?.interpolator?2:r?.isDataDriven?1:o&&!r?3:0}r|=t<<o,o+=2}return r<<3|t}}class d extends m{constructor(t,i,e,a,o=null){super(t,i,e,a,o),this.backgroundMaterial=new n(this.computeAttributesKey(0,n.ATTRIBUTES,n.ATTRIBUTES_INFO))}}class _ extends m{constructor(t,i,e,a,o=null){super(t,i,e,a,o);const r=this.getPaintProperty("fill-color"),n=this.getPaintProperty("fill-opacity"),s=this.getPaintProperty("fill-pattern");this.hasDataDrivenColor=r?.isDataDriven,this.hasDataDrivenOpacity=n?.isDataDriven,this.hasDataDrivenFill=this.hasDataDrivenColor||this.hasDataDrivenOpacity||s?.isDataDriven;const u=this.getPaintProperty("fill-outline-color");this.outlineUsesFillColor=!u,this.hasDataDrivenOutlineColor=u?.isDataDriven,this.hasDataDrivenOutline=u?u.isDataDriven:!!r&&r.isDataDriven,this.hasDataDrivenOutline=(u?this.hasDataDrivenOutlineColor:this.hasDataDrivenColor)||this.hasDataDrivenOpacity,this.fillMaterial=new l(this.computeAttributesKey(1,l.ATTRIBUTES,l.ATTRIBUTES_INFO)),this.outlineMaterial=new h(this.computeAttributesKey(2,this.outlineUsesFillColor?h.ATTRIBUTES_FILL:h.ATTRIBUTES_OUTLINE,this.outlineUsesFillColor?h.ATTRIBUTES_INFO_FILL:h.ATTRIBUTES_INFO_OUTLINE),this.outlineUsesFillColor)}getFeatureInflatedBounds(t,i,e,a){const o=z(t);if(!o)return null;const r=this.getPaintValue("fill-translate",i,t),n=a*Math.max(r[0],r[1]);return o[0]-=n,o[2]-=n,o[1]+=n,o[3]+=n,o}isIntersectingFeature(t,a,n,s,l,h,u,p){const c=s.getGeometry();if(!c)return!1;const g=i/p.normalizationRatio,y=g/u;t=t/p.normalizationRatio+p.normalizationOffsetX,a=a/p.normalizationRatio+p.normalizationOffsetY;const P=e(this.getPaintValue("fill-translate",l,s),this.getPaintValue("fill-translate-anchor",l,s),h,y);t-=g*P.x,a-=g*P.y;return!!r(t,a,c)||o(t,a,c,n)}}class L extends m{constructor(t,i,e,a,o=null){super(t,i,e,a,o);const r=this.getPaintProperty("line-pattern");if(this.lineMaterial=new u(this.computeAttributesKey(3,u.ATTRIBUTES,u.ATTRIBUTES_INFO,r?"line-dasharray":"")),this.hasDataDrivenLine=this.getPaintProperty("line-blur")?.isDataDriven||this.getPaintProperty("line-color")?.isDataDriven||this.getPaintProperty("line-gap-width")?.isDataDriven||this.getPaintProperty("line-offset")?.isDataDriven||this.getPaintProperty("line-opacity")?.isDataDriven||this.getPaintProperty("line-pattern")?.isDataDriven||this.getPaintProperty("line-dasharray")?.isDataDriven||this.getLayoutProperty("line-cap")?.isDataDriven||this.getPaintProperty("line-width")?.isDataDriven,this.canUseThinTessellation=!1,!this.hasDataDrivenLine){const t=this.getPaintProperty("line-width");if(!t||"number"==typeof t&&.5*t<f){const t=this.getPaintProperty("line-offset");(!t||"number"==typeof t&&0===t)&&(this.canUseThinTessellation=!0)}}}getDashKey(t,i){let e;switch(i){case 0:default:e="Butt";break;case 1:e="Round";break;case 2:e="Square"}return`dasharray-[${t.toString()}]-${e}`}getFeatureInflatedBounds(t,i,e,a){const o=z(t);if(!o)return null;const r=this.getPaintValue("line-translate",i,t),n=a*Math.max(r[0],r[1]);o[0]-=n,o[2]-=n,o[1]+=n,o[3]+=n;const s=a*Math.abs(this.getPaintValue("line-offset",i,t)||0),l=a*(this.getPaintValue("line-width",i,t)/2);return o[0]-=s+l,o[1]-=s+l,o[2]+=s+l,o[3]+=s+l,o}isIntersectingFeature(t,r,n,s,l,h,u,p){let c=s.getGeometry();if(!c)return!1;const g=i/p.normalizationRatio,y=g/u;t=t/p.normalizationRatio+p.normalizationOffsetX,r=r/p.normalizationRatio+p.normalizationOffsetY;const P=e(this.getPaintValue("line-translate",l,s),this.getPaintValue("line-translate-anchor",l,s),h,y);t-=g*P.x,r-=g*P.y;const f=y*this.getPaintValue("line-offset",l,s)||0;0!==f&&(c=a(c,-f));const D=this.getPaintValue("line-width",l,s);return o(t,r,c,y*(D/2)+n)}}class v extends m{constructor(t,i,e,a,o=null){super(t,i,e,a,o),this.iconMaterial=new p(this.computeAttributesKey(4,p.ATTRIBUTES,p.ATTRIBUTES_INFO)),this.textMaterial=new c(this.computeAttributesKey(6,c.ATTRIBUTES,c.ATTRIBUTES_INFO)),this.hasDataDrivenIcon=this.getPaintProperty("icon-color")?.isDataDriven||this.getPaintProperty("icon-halo-blur")?.isDataDriven||this.getPaintProperty("icon-halo-color")?.isDataDriven||this.getPaintProperty("icon-halo-width")?.isDataDriven||this.getPaintProperty("icon-opacity")?.isDataDriven||this.getLayoutProperty("icon-size")?.isDataDriven,this.hasDataDrivenText=this.getPaintProperty("text-color")?.isDataDriven||this.getPaintProperty("text-halo-blur")?.isDataDriven||this.getPaintProperty("text-halo-color")?.isDataDriven||this.getPaintProperty("text-halo-width")?.isDataDriven||this.getPaintProperty("text-opacity")?.isDataDriven||this.getLayoutProperty("text-size")?.isDataDriven}}class x extends m{constructor(t,i,e,a,o=null){super(t,i,e,a,o),this.circleMaterial=new s(this.computeAttributesKey(5,s.ATTRIBUTES,s.ATTRIBUTES_INFO))}getFeatureInflatedBounds(t,e,a,o){const r=z(t);if(!r)return null;const n=this.getPaintValue("circle-translate",e,t),s=Math.max(n[0],n[1]);r[0]-=s,r[2]-=s,r[1]+=s,r[3]+=s;const l=o*(i*(this.getPaintValue("circle-radius",e,t)+this.getPaintValue("circle-stroke-width",e,t))/2);return r[0]-=l,r[1]-=l,r[2]+=l,r[3]+=l,r}isIntersectingFeature(t,a,o,r,n,s,l,h){const u=r.getGeometry();if(!u)return!1;const p=i/h.normalizationRatio/l;t=t/h.normalizationRatio+h.normalizationOffsetX,a=a/h.normalizationRatio+h.normalizationOffsetY;const c=e(this.getPaintValue("circle-translate",n,r),this.getPaintValue("circle-translate-anchor",n,r),s,p),g=p*(this.getPaintValue("circle-radius",n,r)+this.getPaintValue("circle-stroke-width",n,r));let y,P;for(const i of u)if(i)for(const e of i){y=e.x+c.x,P=e.y+c.y;if(Math.sqrt((t-y)*(t-y)+(a-P)*(a-P))-o<=g)return!0}return!1}}class V{constructor(t,i,e){let a;this.allowOverlap=t.getLayoutValue("icon-allow-overlap",i),this.ignorePlacement=t.getLayoutValue("icon-ignore-placement",i),this.keepUpright=t.getLayoutValue("icon-keep-upright",i),this.optional=t.getLayoutValue("icon-optional",i),this.rotationAlignment=t.getLayoutValue("icon-rotation-alignment",i),2===this.rotationAlignment&&(this.rotationAlignment=e?0:1),a=t.getLayoutProperty("icon-anchor"),a?.isDataDriven?this._anchorProp=a:this.anchor=t.getLayoutValue("icon-anchor",i),a=t.getLayoutProperty("icon-offset"),a?.isDataDriven?this._offsetProp=a:this.offset=t.getLayoutValue("icon-offset",i),a=t.getLayoutProperty("icon-padding"),a?.isDataDriven?this._paddingProp=a:this.padding=t.getLayoutValue("icon-padding",i),a=t.getLayoutProperty("icon-rotate"),a?.isDataDriven?this._rotateProp=a:this.rotate=t.getLayoutValue("icon-rotate",i),a=t.getLayoutProperty("icon-size"),a?.isDataDriven?this._sizeProp=a:this.size=t.getLayoutValue("icon-size",i)}update(t,i){this._anchorProp&&(this.anchor=this._anchorProp.getValue(t,i)),this._offsetProp&&(this.offset=this._offsetProp.getValue(t,i)),this._paddingProp&&(this.padding=this._paddingProp.getValue(t,i)),this._rotateProp&&(this.rotate=this._rotateProp.getValue(t,i)),this._sizeProp&&(this.size=this._sizeProp.getValue(t,i))}}class T{constructor(t,i,e){let a;this.allowOverlap=t.getLayoutValue("text-allow-overlap",i),this.ignorePlacement=t.getLayoutValue("text-ignore-placement",i),this.keepUpright=t.getLayoutValue("text-keep-upright",i),this.optional=t.getLayoutValue("text-optional",i),this.rotationAlignment=t.getLayoutValue("text-rotation-alignment",i),2===this.rotationAlignment&&(this.rotationAlignment=e?0:1),a=t.getLayoutProperty("text-anchor"),a?.isDataDriven?this._anchorProp=a:this.anchor=t.getLayoutValue("text-anchor",i),a=t.getLayoutProperty("text-justify"),a?.isDataDriven?this._justifyProp=a:this.justify=t.getLayoutValue("text-justify",i),a=t.getLayoutProperty("text-letter-spacing"),a?.isDataDriven?this._letterSpacingProp=a:this.letterSpacing=t.getLayoutValue("text-letter-spacing",i),a=t.getLayoutProperty("text-line-height"),a?.isDataDriven?this._lineHeightProp=a:this.lineHeight=t.getLayoutValue("text-line-height",i),a=t.getLayoutProperty("text-max-angle"),a?.isDataDriven?this._maxAngleProp=a:this.maxAngle=t.getLayoutValue("text-max-angle",i),a=t.getLayoutProperty("text-max-width"),a?.isDataDriven?this._maxWidthProp=a:this.maxWidth=t.getLayoutValue("text-max-width",i),a=t.getLayoutProperty("text-offset"),a?.isDataDriven?this._offsetProp=a:this.offset=t.getLayoutValue("text-offset",i),a=t.getLayoutProperty("text-padding"),a?.isDataDriven?this._paddingProp=a:this.padding=t.getLayoutValue("text-padding",i),a=t.getLayoutProperty("text-rotate"),a?.isDataDriven?this._rotateProp=a:this.rotate=t.getLayoutValue("text-rotate",i),a=t.getLayoutProperty("text-size"),a?.isDataDriven?this._sizeProp=a:this.size=t.getLayoutValue("text-size",i),a=t.getLayoutProperty("text-writing-mode"),a?.isDataDriven?this._writingModeProp=a:this.writingMode=t.getLayoutValue("text-writing-mode",i)}update(t,i){this._anchorProp&&(this.anchor=this._anchorProp.getValue(t,i)),this._justifyProp&&(this.justify=this._justifyProp.getValue(t,i)),this._letterSpacingProp&&(this.letterSpacing=this._letterSpacingProp.getValue(t,i)),this._lineHeightProp&&(this.lineHeight=this._lineHeightProp.getValue(t,i)),this._maxAngleProp&&(this.maxAngle=this._maxAngleProp.getValue(t,i)),this._maxWidthProp&&(this.maxWidth=this._maxWidthProp.getValue(t,i)),this._offsetProp&&(this.offset=this._offsetProp.getValue(t,i)),this._paddingProp&&(this.padding=this._paddingProp.getValue(t,i)),this._rotateProp&&(this.rotate=this._rotateProp.getValue(t,i)),this._sizeProp&&(this.size=this._sizeProp.getValue(t,i)),this._writingModeProp&&(this.writingMode=this._writingModeProp.getValue(t,i))}}function z(i){const e=i?.getGeometry();if(null==e)return null;let a=1/0,o=1/0,r=-1/0,n=-1/0;for(const t of e)if(t)for(const i of t)a=Math.min(a,i.x),o=Math.min(o,i.y),r=Math.max(r,i.x),n=Math.max(n,i.y);return t(a,o,r,n)}export{d as BackgroundStyleLayer,x as CircleStyleLayer,_ as FillStyleLayer,V as IconLayout,D as IndexItem,L as LineStyleLayer,m as StyleLayer,v as SymbolStyleLayer,T as TextLayout};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clone as e}from"../../../../../core/lang.js";import{CircleStyleLayer as t,SymbolStyleLayer as r,LineStyleLayer as a,FillStyleLayer as
|
|
2
|
+
import{clone as e}from"../../../../../core/lang.js";import{CircleStyleLayer as t,SymbolStyleLayer as r,LineStyleLayer as a,FillStyleLayer as s,BackgroundStyleLayer as i}from"./StyleLayer.js";class l{constructor(t,r=!0){if(this.backgroundBucketIds=[],this._uidToLayer=new Map,this._layerByName={},this._runningId=0,this._style=r?e(t):t,this._style.layers||(this._style.layers=[]),this.version=parseFloat(this._style.version),this.layers=this._style.layers.map((e,t,r)=>this._create(e,t,r)).filter(e=>!!e),this.layers)for(let e=0;e<this.layers.length;e++){const t=this.layers[e];this._layerByName[t.id]=t,this._uidToLayer.set(t.uid,t),0===t.type&&this.backgroundBucketIds.push(t.id)}this._identifyRefLayers()}getLayerStyleProperties(e,t){const r=this.getStyleLayerByUID(e),a=0!==r?.getLayoutValue("symbol-placement",t);let s=r?.getLayoutValue("icon-rotation-alignment",t);2===s&&(s=a?0:1);let i=r?.getLayoutValue("text-rotation-alignment",t);2===i&&(i=a?0:1);const l=r?.getPaintValue("icon-translate",t),n=r?.getPaintValue("icon-translate-anchor",t),y=r?.getPaintValue("text-translate",t),o=r?.getPaintValue("text-translate-anchor",t);return{geometryType:null,iconAllowOverlap:r?.getLayoutValue("icon-allow-overlap",t),iconIgnorePlacement:r?.getLayoutValue("icon-ignore-placement",t),textAllowOverlap:r?.getLayoutValue("text-allow-overlap",t),textIgnorePlacement:r?.getLayoutValue("text-ignore-placement",t),iconRotationAlignment:s,textRotationAlignment:i,iconTranslateAnchor:n,iconTranslate:l,textTranslateAnchor:o,textTranslate:y}}isPainterDataDriven(e){const t=this._layerByName[e];return!!t&&t.isPainterDataDriven()}getStyleLayerId(e){return e>=this.layers.length?null:this.layers[e].id}getStyleLayerByUID(e){return this._uidToLayer.get(e)??null}getStyleLayerIndex(e){const t=this._layerByName[e];return t?this.layers.indexOf(t):-1}setStyleLayer(e,t){if(!e?.id)return;const r=this._style;null!=t&&t>=this.layers.length&&(t=this.layers.length-1);let a,s=!0;const i=this._layerByName[e.id];if(i){const n=this.layers.indexOf(i);t||(t=n),t===n?(s=!1,a=l._recreateLayer(e,i,this._getSourceType(e.source)),this.layers[t]=a,r.layers[t]=e):(this.layers.splice(n,1),r.layers.splice(n,1),a=this._create(e,t,this.layers),this.layers.splice(t,0,a),r.layers.splice(t,0,e))}else a=this._create(e,t,this.layers),!t||t>=this.layers.length?(this.layers.push(a),r.layers.push(e)):(this.layers.splice(t,0,a),r.layers.splice(t,0,e));this._layerByName[e.id]=a,this._uidToLayer.set(a.uid,a),s&&this._recomputeZValues(),this._identifyRefLayers()}getStyleLayer(e){const t=this._layerByName[e];return t?{type:t.typeName,id:t.id,source:t.source,"source-layer":t.sourceLayer,minzoom:t.minzoom,maxzoom:t.maxzoom,filter:t.filter,layout:t.layout,paint:t.paint}:null}deleteStyleLayer(e){const t=this._layerByName[e];if(t){delete this._layerByName[e],this._uidToLayer.delete(t.uid);const r=this.layers.indexOf(t);this.layers.splice(r,1),this._style.layers.splice(r,1),this._recomputeZValues(),this._identifyRefLayers()}}getLayerById(e){return this._layerByName[e]}getLayoutProperties(e){const t=this._layerByName[e];return t?t.layout:null}getPaintProperties(e){const t=this._layerByName[e];return t?t.paint:null}setPaintProperties(e,t){const r=this._layerByName[e];if(!r)return;const a={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:r.layout,paint:t},s=l._recreateLayer(a,r,r.sourceType),i=this.layers.indexOf(r);this.layers[i]=s,this._style.layers[i].paint=t,this._layerByName[r.id]=s,this._uidToLayer.set(r.uid,s)}setLayoutProperties(e,t){const r=this._layerByName[e];if(!r)return;const a={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:t,paint:r.paint},s=l._recreateLayer(a,r,r.sourceType),i=this.layers.indexOf(r);this.layers[i]=s,this._style.layers[i].layout=t,this._layerByName[r.id]=s,this._uidToLayer.set(r.uid,s)}setStyleLayerVisibility(e,t){const r=this._layerByName[e];if(!r)return;const a=r.layout||{};a.visibility=t;const s={type:r.typeName,id:r.id,source:r.source,"source-layer":r.sourceLayer,minzoom:r.minzoom,maxzoom:r.maxzoom,filter:r.filter,layout:a,paint:r.paint},i=l._recreateLayer(s,r,r.sourceType),n=this.layers.indexOf(r);this.layers[n]=i,this._style.layers[n].layout=a,this._layerByName[r.id]=i,this._uidToLayer.set(r.uid,i)}getStyleLayerVisibility(e){const t="string"==typeof e?this._layerByName[e]:this._uidToLayer.get(e);if(!t)return!1;const r=t.getLayoutProperty("visibility");return!r||1!==r.getValue()}_recomputeZValues(){const e=this.layers,t=1/(e.length+1);for(let r=0;r<e.length;r++)e[r].z=1-(1+r)*t}_identifyRefLayers(){const e=[],t=[];let r=0;for(const a of this.layers){const s=a.layout;if(1===a.type){const t=a;let i=a.source+"|"+a.sourceLayer;i+="|"+(s?.visibility??""),i+="|"+a.minzoom,i+="|"+a.maxzoom,i+="|"+JSON.stringify(a.filter),(t.hasDataDrivenFill||t.hasDataDrivenOutline)&&(i+="|"+r),e.push({key:i,layer:a})}else if(2===a.type){const e=a,i=a.paint,l=null!=i&&(null!=i["line-pattern"]||null!=i["line-dasharray"]);let n=a.source+"|"+a.sourceLayer;n+="|"+(s?.visibility??""),n+="|"+a.minzoom,n+="|"+a.maxzoom,n+="|"+JSON.stringify(a.filter),n+="|"+(void 0!==s?s["line-cap"]:""),n+="|"+(void 0!==s?s["line-join"]:""),(e.hasDataDrivenLine||l)&&(n+="|"+r),t.push({key:n,layer:a})}++r}this._assignRefLayers(e),this._assignRefLayers(t)}_assignRefLayers(e){let t,r;e.sort((e,t)=>e.key<t.key?-1:e.key>t.key?1:0);const a=e.length;for(let s=0;s<a;s++){const i=e[s];if(i.key===t)i.layer.refLayerId=r;else if(t=i.key,r=i.layer.id,1===i.layer.type){if(!i.layer.getPaintProperty("fill-outline-color"))for(let l=s+1;l<a;l++){const a=e[l];if(a.key!==t)break;if(a.layer.getPaintProperty("fill-outline-color")){e[s]=a,e[l]=i,r=a.layer.id;break}}}else if(2===i.layer.type){let l=i.layer;for(let n=s+1;n<a;n++){const a=e[n];if(a.key!==t)break;const y=a.layer;(l.canUseThinTessellation&&!y.canUseThinTessellation||!l.canUseThinTessellation&&(y.getPaintProperty("line-pattern")||y.getPaintProperty("line-dasharray")))&&(l=y,e[s]=a,e[n]=i,r=a.layer.id)}}}}_create(e,l,n){const y=1-(1+l)*(1/(n.length+1)),o=this._runningId++,u=this._getSourceType(e.source);switch(e.type){case"background":return new i(0,e,y,o,u);case"fill":return new s(1,e,y,o,u);case"line":return new a(2,e,y,o,u);case"symbol":return new r(3,e,y,o,u);case"raster":return console.warn(`Unsupported vector tile raster layer ${e.id}`),null;case"circle":return new t(4,e,y,o,u)}return null}_getSourceType(e){return this._style.sources?.[e]?.type??null}static _recreateLayer(e,l,n){switch(e.type){case"background":return new i(0,e,l.z,l.uid,n);case"fill":return new s(1,e,l.z,l.uid,n);case"line":return new a(2,e,l.z,l.uid,n);case"symbol":return new r(3,e,l.z,l.uid,n);case"raster":return console.warn(`Unsupported vector tile raster layer ${e.id}`),null;case"circle":return new t(4,e,l.z,l.uid,n)}return null}}export{l as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as i}from"tslib";import{animationDebugFlags as t}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{generateVirtualMachineSource as e}from"../../../animations/instructions.js";import{location as o,uniform as a,texture as s,option as r}from"../../GraphShaderModule.js";import{Vec2 as l,Vec4 as n,Float as
|
|
2
|
+
import{__decorate as i}from"tslib";import{animationDebugFlags as t}from"../../../../../../../symbols/cim/animationDebugFlags.js";import{generateVirtualMachineSource as e}from"../../../animations/instructions.js";import{location as o,uniform as a,texture as s,option as r}from"../../GraphShaderModule.js";import{Vec2 as l,Vec4 as n,Float as m,Sampler2D as p,cond as u,equal as d,negate as c,step as y,sin as v,cos as f,Mat3 as h,Vec3 as b,lessThanEqual as S,ifElse as w,texture2D as g,clamp as V,abs as x,block as z}from"../../graph/glsl.js";import{AnimationUniformInfo as T}from"./AnimationUniformInfo.js";import{MarkerConstants as P}from"../markers/markerConstants.js";import{FeatureVertexInput as j,AFeatureShader as _,FeatureFragmentInput as C}from"../shaders/AFeatureShader.js";import{softEdgeRatio as M}from"../shaders/constants.js";import{LocalTileOffset as O}from"../shaders/LocalTileOffset.js";import{MosaicInfo as D}from"../shaders/MosaicInfo.js";import{getBit as F,rgba2float as A}from"../shaders/utils.js";import{VisualVariableColor as I}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as L}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as R}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as k}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as U}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as E}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as B}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as G,getVisualVariableAngle as q}from"../shaders/vvUtils.js";class N extends j{}i([o(3,l)],N.prototype,"offset",void 0),i([o(4,n)],N.prototype,"sizing",void 0),i([o(5,n)],N.prototype,"value1Position2Value2",void 0),i([o(6,n)],N.prototype,"animationPointerAndBaseSizeAndReferenceSize",void 0),i([o(7,l)],N.prototype,"zoomRange",void 0),i([o(8,m)],N.prototype,"lineLength",void 0);class W extends C{}class Z extends _{_vertexPreamble(i,t,e){const{id:o,offset:a,animationPointerAndBaseSizeAndReferenceSize:s,sizing:r}=i,l=s.xy,n=s.z,p=s.w,v=r.xy,f=u([d(F(i.bitset,P.bitset.isMapAligned),new m(1)),this.view.rotation.divide(180).multiply(Math.PI)],[!0,new m(0)]),h=c(f.add(t)),b=this._getEvalParams(i,v,e,h);let S,w;if(i.value1Position2Value2){let t;t=this.hittestRequest?new m(0):H(l,6,b).a.multiply(this.tile.getDisplayZoomFactor(this.tileContainer));const e=i.pos,o=i.value1Position2Value2.yz,a=i.value1Position2Value2.x,s=i.value1Position2Value2.w,r=t.subtract(a).divide(s.subtract(a));w=e.add(o.subtract(e).multiply(r)),S=y(new m(1),r).add(y(new m(0),c(r)))}else w=i.pos,S=new m(0);const g=r.z,V=F(i.bitset,P.bitset.isStroke),x=r.w,z=F(i.bitset,P.bitset.scaleSymbolsProportionally),T=H(l,0,b),j=T.xy,_=T.z,C=T.w,M=F(i.bitset,P.bitset.isSDF),O=G(this,o,new m(p)).divide(new m(p));return{baseSize:n,animationPointer:l,strokeWidth:g,isOutline:V,unscaledDistanceToPx:x,scaleSymbolsProportionally:z,isSDF:M,position:this._getScreenPosition({id:o,pos:w,offset:a,referenceSize:p,translation:j,rotation:_,scale:C,vvScale:O}),evalParams:b,vvScale:O,scale:C,clip:S}}_getScreenPosition(i){const{pos:t,translation:e,rotation:o,scale:a,offset:s,id:r,vvScale:l}=i,n=q(this,r).multiply(Math.PI/180),p=e.x.multiply(4/3),u=e.y.multiply(-1).multiply(4/3),d=v(n),y=f(n),S=y.multiply(p).add(c(d).multiply(u)),w=d.multiply(p).add(y.multiply(u)),g=v(o.subtract(n)),V=f(o.subtract(n)),x=new m(0),z=new m(1),T=new h(z,x,x,x,z,x,S,w,z),P=new h(V,g.multiply(-1),x,g,V,x,0,0,z),j=a.multiply(l).multiply(4/3),_=P.multiply(j),C=this.tile.getViewScreenMat3(this.view,this.tileContainer).multiply(new b(t,1)),M=T.multiply(C).xy,O=_.multiply(new b(s,0)).xy;return M.add(O)}_clip(i,e){let o=super.clip(i,e);const a=S(this._getLocalTimeOrigin(i),new m(0));return t.forceGlobalTimeOrigin||(o=o.add(u([a,()=>new m(2)],[!0,()=>new m(0)]))),o}_getLocalTimeOrigin(i){return this.getLocalTimeOrigin(i)}_toNdc(i){return this.view.displayMat3.multiply(new b(i,1)).xy}_getEvalParams(i,t,e,o){const{globalTime:a,animationTextureSize:s}=this.animationInfo;return{globalTime:a,localTimeOrigin:this._getLocalTimeOrigin(i.id),animationTextureSize:s,animationTexture:this.animationTexture,pixelDimensions:t,lineLength:e,globalRotation:o}}_getColor(i,t){return w(d(t.isSDF,new m(1)),this._getSDFColor(i,t),this._getSpriteColor(i,t))}_getSpriteColor(i,t){return g(this.mosaicTexture,i).multiply(t.color)}_getSDFColor(i,t){const e=g(this.mosaicTexture,i),o=new m(.5).subtract(A(e)).multiply(t.distanceToPx).multiply(M),a=V(new m(.5).subtract(o),new m(0),new m(1)),s=t.color.multiply(a),r=t.outlineSize.multiply(.5),l=x(o).subtract(r),n=V(new m(.5).subtract(l),new m(0),new m(1)),p=t.outlineColor.multiply(n);return new m(1).subtract(p.a).multiply(s).add(p)}}function H(i,t,o){const a=i.add(new l(t,0)),s=g(o.animationTexture,a.add(.5).divide(o.animationTextureSize)).xy;return i=i.add(s),z({animationPointer:i,...o},n,null,i=>{const{out:t}=i;if(!t)throw new Error("out is null");return e({...i,out:t})})}i([a(D)],Z.prototype,"mosaicInfo",void 0),i([a(T)],Z.prototype,"animationInfo",void 0),i([a(O)],Z.prototype,"localTileOffset",void 0),i([s(p)],Z.prototype,"mosaicTexture",void 0),i([r(I)],Z.prototype,"visualVariableColor",void 0),i([r(L)],Z.prototype,"visualVariableOpacity",void 0),i([r(k)],Z.prototype,"visualVariableSizeMinMaxValue",void 0),i([r(U)],Z.prototype,"visualVariableSizeScaleStops",void 0),i([r(E)],Z.prototype,"visualVariableSizeStops",void 0),i([r(B)],Z.prototype,"visualVariableSizeUnitValue",void 0),i([r(R)],Z.prototype,"visualVariableRotation",void 0),i([s(p)],Z.prototype,"animationTexture",void 0);export{W as AAnimatedFragmentInput,Z as AAnimatedShader,N as AAnimatedVertexInput,H as getValue};
|
package/views/3d/GroundView3D.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{EventedMixin as r}from"../../core/Evented.js";import{when as n,watch as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{EventedMixin as r}from"../../core/Evented.js";import{when as n,on as i,watch as a}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{create as l,equals as u,intersection as d}from"../../geometry/support/aaBoundingRect.js";import p from"../GroundView.js";import{ElevationRange as g}from"./support/ElevationRange.js";import{toBoundingRect as h}from"./support/extentUtils.js";import{webMercatorWorldExtent as y,geographicWorldExtent as c}from"./terrain/TerrainConst.js";let v=class extends(r(p)){initialize(){super.initialize();const e=()=>{this.emit("elevation-query-change")};this.addHandles(n(()=>this._terrainSurface,e=>e.on("elevation-change",e=>this._elevationChange(e)))),this.addHandles(i(()=>this._integratedMeshGroundLayerView?.elevationProvider,"elevation-change",e=>this._elevationChange(e))),this.addHandles([a(()=>this.memoizedElevationQueryDependencies,e)])}get memoizedElevationQueryDependencies(){return(this.ground?.allLayers??[]).filter(e=>"elevation"===e.type||"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain).map(e=>e.memoizedElevationQueryDependencies)}_elevationChange(e){this.emit("elevation-change",e)}get _integratedMeshGroundLayerView(){const e=this.ground?.integratedMeshGround;if(e)return this.view.basemapView?.groundLayerViews.find(t=>t.layer===e)}get _terrainSurface(){return this.view.basemapTerrain}get _usingTerrain(){return!this._usingIntegratedMesh&&(this._terrainSurface?.enabled??!1)}get _usingIntegratedMesh(){return this.hasTerrainReplacement&&(this._integratedMeshGroundLayerView?.visible??!1)}get spatialReference(){return this._terrainSurface?.spatialReference}get userClippingExtent(){const{spatialReference:e}=this,{clippingArea:t}=this.view;if(null==t||null==e)return null;const r=l(),n=h(t,r,e)?r:null,i=this._get("userClippingExtent");return u(n,i)?i:n}get updating(){return!this.suspended&&((this._source?.updating??!1)||this.layerViews.some(({updating:e})=>e))}getElevation(e,t,r,n){return this._elevationProvider?.getElevation(e,t,r,n)}getElevations(e,t,r){const{_elevationProvider:n}=this;if(n?.getElevations)return n.getElevations(e,t,r);for(let i=0;i<t;++i)r(i,null)}intersect(e,t,r,n){if(this._usingTerrain)return void this._terrainSurface.intersect(e,t,r,n);const i=this._integratedMeshGroundLayerView;this._usingIntegratedMesh&&i&&i.intersect(e,t,r,n)}getSphereElevationRange(e,t,r){return this._elevationProvider?.getSphereElevationRange?.(e,t)}getRootElevationRange(){return this._elevationProvider?.getRootElevationRange?.()}get _elevationProvider(){return this._usingIntegratedMesh?this._integratedMeshGroundLayerView?.elevationProvider:this._terrainSurface}get elevationQueryCache(){const e=this.view?.basemapTerrain;return e?.enabled?e.elevationQueryCache:null}get elevationQueryReady(){for(const e of this.ground?.allLayers??[])if("integrated-mesh-3dtiles"===e.type&&e.replacesTerrain&&"failed"!==e.loadStatus&&null==e.queryElevationCallback)return!1;return!0}get groundExtent(){const{fullGroundExtent:e}=this;return e?this.userClippingExtent?d(e,this.userClippingExtent,l()):this.fullGroundExtent:null}get fullGroundExtent(){if(this._usingTerrain)return this._terrainSurface.fullGroundExtent;if(this._usingIntegratedMesh){const e=this.view.spatialReference;if(e.isWebMercator||e.isWGS84)return _(e);throw new t("GroundView:unsupportedSpatialReference","View spatial reference incompatible with groundLayer")}return null}get visibleElevationRange(){return this._source?.visibleElevationRange??f}get opaque(){return this._source?.opaque??!1}get invisible(){return this._source?.invisible??!1}get baseOpacity(){return this.ground?.opacity??1}get wireframe(){return!!this._usingTerrain&&(this._terrainSurface?.wireframe??!1)}get freeze(){return(this._usingTerrain?this._terrainSurface?.freeze:this._integratedMeshGroundLayerView?.freeze)??!1}set freeze(e){this._usingTerrain?this._terrainSurface.freeze=e:this._usingIntegratedMesh&&(this._integratedMeshGroundLayerView.freeze=e)}get suspended(){return this._usingIntegratedMesh?this._integratedMeshGroundLayerView?.suspended??!1:super.suspended}get ready(){return this._source?.ready??!1}updateOverlayParameters(){this._terrainSurface?.updateOverlayParameters()}get _source(){return this._usingTerrain?this._terrainSurface:this._usingIntegratedMesh?this._integratedMeshGroundLayerView:null}requestRender(e){this.view.stage.renderView?.requestRender(e)}};e([s()],v.prototype,"memoizedElevationQueryDependencies",null),e([s({readOnly:!0})],v.prototype,"_integratedMeshGroundLayerView",null),e([s({readOnly:!0})],v.prototype,"_terrainSurface",null),e([s({readOnly:!0})],v.prototype,"_usingTerrain",null),e([s({readOnly:!0})],v.prototype,"_usingIntegratedMesh",null),e([s({readOnly:!0})],v.prototype,"spatialReference",null),e([s({readOnly:!0})],v.prototype,"userClippingExtent",null),e([s({type:Boolean,readOnly:!0})],v.prototype,"updating",null),e([s({readOnly:!0})],v.prototype,"elevationQueryCache",null),e([s()],v.prototype,"elevationQueryReady",null),e([s({readOnly:!0})],v.prototype,"groundExtent",null),e([s({readOnly:!0})],v.prototype,"fullGroundExtent",null),e([s({readOnly:!0})],v.prototype,"visibleElevationRange",null),e([s({readOnly:!0})],v.prototype,"opaque",null),e([s({readOnly:!0})],v.prototype,"invisible",null),e([s({readOnly:!0})],v.prototype,"baseOpacity",null),e([s({readOnly:!0})],v.prototype,"wireframe",null),e([s()],v.prototype,"freeze",null),e([s({readOnly:!0})],v.prototype,"suspended",null),e([s({readOnly:!0})],v.prototype,"ready",null),e([s({readOnly:!0})],v.prototype,"_source",null),v=e([o("esri.views.3d.GroundView3D")],v);const f=new g(0,0);function _(e){return e.isWebMercator?y:c}export{v as GroundView3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import n from"../../../../analysis/LineOfSightAnalysisObserver.js";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{length as o,normalize as t,scaleAndAdd as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as l,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as i,getConvertedElevation as s,getGraphicEffectiveElevationInfo as c}from"../../../../support/elevationInfoUtils.js";import f from"../../../../symbols/support/ElevationInfo.js";function a(n){return n?.clone()??null}function p(n){return n?.clone()??null}function m(e,o=null){return g(e,o,()=>new n)}function d(n,o=null){return g(n,o,()=>new e)}function g(n,e,o){if(null==n)return null;const t=e??o();return t.position=n.position?.clone()??null,t.elevationInfo=n.elevationInfo?.clone()??null,t.feature=n.feature??null,t}function v(n,e,o=null){const t=e.clone();return t.z=s(n,e,o??i,i),t}function h(n,e,o,t=null){const r=v(e,o,t);try{return n.getMapPointIntersection(r)}catch{return null}}function I(n,e,o,t,{elevationInfo:r=null,sourceElevationInfo:l=i,preservedIntersection:u=null,usesAuthoredAbsoluteHeight:s=!1}={}){const c=A(r,l,s),f=u??h(o,n,t,c);return null!=f&&(y(n,e,f,{snappedMapPoint:t,elevationInfo:r,sourceElevationInfo:l,usesAuthoredAbsoluteHeight:s}),!0)}function y(n,e,o,{snappedMapPoint:t=o.mapPoint,elevationInfo:r=null,sourceElevationInfo:l=i,usesAuthoredAbsoluteHeight:u=!1}={}){if(null==t)return e.position=null,e.elevationInfo=null,void(e.feature=null);const c=o.context,f=v(n,t,A(r,l,u)),a=b(o,r,u),p="graphic"===c?.type?c.graphic:null;e.elevationInfo=a,e.feature=p,"gaussian-splat"===c?.type?e.position=x(n,f,a,o.normal):(f.z=s(n,f,i,a),e.position=f)}function A(n,e,o){return o&&null==n?i:n??e}function b(n,e,o){if(null!=e)return e.clone();if(o)return null;const t=n.context;if("ground"===t?.type)return new f({mode:"on-the-ground"});if("graphic"!==t?.type)return null;const r=c(t.graphic);return"on-the-ground"===r.mode&&(r.mode="relative-to-ground",r.offset=0),new f(r)}function x(n,e,c,f){const a=e.clone(),p=l(e.x,e.y,e.z??0);if(!n.renderCoordsHelper.toRenderCoords(p,e.spatialReference,p)||0===o(f))return a.z=s(n,a,i,c),a;const m=4,d=n.state.camera.computeScreenPixelSizeAt(p)*m,g=t(u(),f);r(p,p,g,d);const v=n.renderCoordsHelper.fromRenderCoords(p,a);return null==v?(a.z=s(n,a,i,c),a):(v.z=s(n,v,i,c),v)}export{x as getGaussianSplatOffsetPosition,h as getLineOfSightMapPointIntersection,m as restoreLineOfSightObserverState,d as restoreLineOfSightTargetState,a as snapshotLineOfSightObserverState,p as snapshotLineOfSightTargetState,I as updateLineOfSightItemFromAuthoredPoint,y as updateLineOfSightItemFromIntersection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{EventEmitter as i}from"../../../../core/Evented.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{destroyMaybe as n,removeMaybe as o}from"../../../../core/maybe.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import{EventEmitter as i}from"../../../../core/Evented.js";import{handlesGroup as e}from"../../../../core/handleUtils.js";import{destroyMaybe as n,removeMaybe as o}from"../../../../core/maybe.js";import{initial as a,watch as s}from"../../../../core/reactiveUtils.js";import{property as r,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../../core/support/UpdatingHandles.js";import p from"../../../../geometry/Point.js";import{create as u,fromPoints as d}from"../../../../geometry/support/lineSegment.js";import{clonePoint as m}from"../../../../layers/graphics/hydratedFeatures.js";import{LineOfSightInteractionVisuals as h}from"./LineOfSightInteractionVisuals.js";import{LineOfSightObserverManipulator as v,LineOfSightTargetManipulator as g,LineOfSightTargetManipulatorState as _,getInteractiveLineOfSightTargetManipulatorState as y}from"./LineOfSightManipulators.js";import{SnappingVisualizer3D as b}from"../../interactive/SnappingVisualizer3D.js";import{screenToMapAtSceneSurface as f}from"../../interactive/editingTools/dragEventPipeline3D.js";import{connectTooltipToManipulatedObject as j}from"../../interactive/editingTools/tooltipUtils3D.js";import{mouseButtons as I}from"../../../input/mouseButtons.js";import{createManipulatorDragEventPipeline as O,dragAtLocation as M,sceneSnappingAtLocation as V}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as w}from"../../../interactive/InteractiveToolBase.js";import S from"../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as T}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as B}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as R,enterInputModeIfAvailable as H}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as U}from"../../../interactive/tooltip/infos/MovePointTooltipInfo.js";const D=u();let x=class extends w{constructor(t){super(t),this.events=new i,this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this.interacting=!1,this.manipulatorsInteractive=!0,this._objectByItem=new Map,this._manipulatorByObject=new Map,this._updatingHandles=new c,this._toolOptions=new S({tooltips:{enabled:!0}}),this._interactionVisuals=null,this._grabbedManipulator=null,this._moveInteractionObject=null,this._tooltipHandle=null,this._tooltipUndoRecord=null,this._tooltipInfo=new U({toolOptions:this._toolOptions,viewType:"3d"})}initialize(){const{view:t}=this;this._tooltip=R(()=>({view:t,options:this._toolOptions.tooltips})),this._interactionVisuals=new h({view:t}),this.addHandles([this._updatingHandles.add(()=>({analysisVisible:this.analysisViewData.visible,computations:this.analysisViewData.computations.toArray().map(t=>({isTargetVisible:t.computationResult.isTargetVisible,isValid:t.computationResult.isValid,target:t.target})),interacting:this.interacting,manipulatorsInteractive:this.manipulatorsInteractive,visible:this.visible}),()=>this._syncManipulators(),a),s(()=>this._grabbedManipulator,()=>this._syncInteractionVisuals(),a)]),this.finishToolCreation()}destroy(){this._disconnectTooltip(),this._tooltip=n(this._tooltip),this._interactionVisuals=n(this._interactionVisuals),this._updatingHandles.destroy(),this._objectByItem.clear(),this._manipulatorByObject.clear(),super.destroy()}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}get verticalLineVisualElement(){return this._interactionVisuals?.verticalLineVisualElement??null}startMoveInteraction(t){this._moveInteractionObject=t,this._syncInteractionVisuals()}stopMoveInteraction(){this._moveInteractionObject=null,this._syncInteractionVisuals()}addObject(t){if(this._manipulatorByObject.has(t))return;const i="observer"===t.itemType?new v(this.view,{deleting:!1,intersection:null,type:"observer"}):new g(this.view,{deleting:!1,target:t.item,type:"target"});i.cursor="move",this._objectByItem.set(t.item,t),this._manipulatorByObject.set(t,i),this.manipulators.add(i),this.addHandles(this._connectManipulator(t,i),t),this._syncManipulator(t,i)}removeObject(t){const i=this._manipulatorByObject.get(t);null!=i&&(this._grabbedManipulator===i&&(this._grabbedManipulator=null,this._disconnectTooltip()),this.removeHandles(t),this.manipulators.remove(i),i.destroy(),this._objectByItem.delete(t.item),this._manipulatorByObject.delete(t))}getManipulator(t){const i=this._objectByItem.get(t);return null==i?null:this._manipulatorByObject.get(i)}hasManipulatorAt(t,i){for(const e of this._manipulatorByObject.values())if(e.consumesClicks&&null!=e.intersectionDistance(t,i))return!0;return!1}selectObject(t){let i=!1;for(const[e,n]of this._manipulatorByObject){const o=e===t;n.selected=o,i||=o}return i}onInputEvent(t){H(t,this._tooltip)}onManipulatorSelectionChanged(){[...this._manipulatorByObject.values()].some(t=>t.selected)||this.events.emit("selection-cleared")}_connectManipulator(t,i){const n=()=>this._syncManipulator(t,i);return e([t.on("committed",n),t.on("modified-externally",n),i.events.on("immediate-click",e=>{this.events.emit("select-item",{item:t.item}),e.button===I.Right&&"target"===i.metadata.type&&this.events.emit("delete-item",{target:i.metadata.target}),e.stopPropagation()}),i.events.on("grab-changed",({action:e})=>{"start"===e?(this.events.emit("select-item",{item:t.item}),this._grabbedManipulator=i,this._connectTooltip(t)):this._grabbedManipulator===i&&(this._grabbedManipulator=null,this._disconnectTooltip())}),i.events.on("drag",i=>t.updateDragIntersection(i)),i.events.on("location-update",()=>this._syncInteractionVisuals()),this._createDragHandle(t,i)])}_createDragHandle(t,i){return O(i,(e,n,o,a)=>{const s=t.operations;if(null==s)return;let r=null;const{cancelSnapping:l,snappingStep:c}=B({snappingContext:new T({editGeometryOperations:s,elevationInfo:t.elevationInfo,pointer:a,visualizer:new b}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!0});o.next(t=>(r?.undo(null),r=null,t)).next(l);const u=s.data.allVerticesUnordered.at(0);n.next(i=>("start"===i.action&&(r=t.createUndoRecord()),{...i,snapOrigin:u?.pos})).next(M(this.view,i.elevationAlignedLocation)).next(f(this.view,s.data.geometry,t.elevationInfo,s.data.spatialReference)).next(V(this.view,t.elevationInfo)).next(...c).next(t=>(s.trySetGeometry(m(t.mapEnd,new p),"start"===t.action?0:1),"end"===t.action&&null!=r&&(this.events.emit("record-undo",{record:r}),r=null),t))})}_connectTooltip(t){this._disconnectTooltip(),this._tooltipHandle=j(this._tooltip,t,()=>({activeTooltipInfo:this._tooltipInfo,callbacks:{onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._tooltipUndoRecord=t.createUndoRecord()},onMove:()=>{},onMoveStop:()=>{null!=this._tooltipUndoRecord&&(this.events.emit("record-undo",{record:this._tooltipUndoRecord}),this._tooltipUndoRecord=null)},onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}},toolOptions:this._toolOptions}))}_disconnectTooltip(){this._tooltipHandle=o(this._tooltipHandle),this._tooltipUndoRecord=null,this._tooltip.clear()}_syncManipulators(){for(const[t,i]of this._manipulatorByObject)this._syncManipulator(t,i);this._syncInteractionVisuals()}_syncManipulator(t,i){const e=t.origin;if(i.available=this.visible&&t.visible&&null!=e,i.interactive=this.manipulatorsInteractive,null!=e&&(i.elevationAlignedLocation=e),"target"!==t.itemType)return;const n=this.analysisViewData.computations.find(i=>i.target===t.item),o=null!=n&&n.computationResult.isValid?n.computationResult.isTargetVisible?_.visible:_.occluded:_.undefined;i.state=this.interacting?y(o):o}_syncInteractionVisuals(){const t=this._grabbedManipulator??(null==this._moveInteractionObject?null:this._manipulatorByObject.get(this._moveInteractionObject)),i=[...this._manipulatorByObject.entries()].find(([t])=>"observer"===t.itemType)?.[1];null!=this._interactionVisuals&&null!=t&&null!=i&&(this.active||null!=this._moveInteractionObject)&&this.visible&&this.analysisViewData.visible?this._interactionVisuals.update({target:t.renderLocation,lineVerticalPlaneSegment:t===i?null:d(i.renderLocation,t.renderLocation,D),visible:!0}):this._interactionVisuals?.hide()}};t([r({constructOnly:!0})],x.prototype,"analysisViewData",void 0),t([r({constructOnly:!0})],x.prototype,"snappingManager",void 0),t([r({constructOnly:!0})],x.prototype,"view",void 0),t([r()],x.prototype,"automaticManipulatorSelection",void 0),t([r()],x.prototype,"removeIncompleteOnCancel",void 0),t([r()],x.prototype,"interacting",void 0),t([r()],x.prototype,"manipulatorsInteractive",void 0),t([r()],x.prototype,"_grabbedManipulator",void 0),t([r()],x.prototype,"updating",null),x=t([l("esri.views.3d.analysis.LineOfSight.LineOfSightItemTool")],x);export{x as LineOfSightItemTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t,sync as i}from"../../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{lineOfSightPlacementLeafPluginMarker as r}from"./LineOfSightPlacementLeafPlugin.js";import{usesLineOfSightAuthoredAbsoluteHeight as s}from"./lineOfSightPlacementUtils.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var p,l;const u=Symbol("line-of-sight-observer-vertex"),d=Symbol("line-of-sight-observer-plugin-marker");let c=class extends a{constructor(){super(...arguments),this[p]=!0,this[l]=!0,this.observer=null,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null}static{p=d,l=r}get usesAuthoredAbsoluteHeight(){return s(this._context,this._interactiveHandle)}start(e){super.start(e),this.preservedIntersection=null;const{session:o,positionOfLastUserInput:n}=e,r="grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??n:this.inputMapPosition??n;!r||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||o.appendOrReplacePoint(u,r),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?r??void 0:void 0}),this.addHandles(t(()=>this._interactiveHandle?.outputMapPosition,e=>{e&&!this._isComplete&&this._session?.appendOrReplacePoint(u,e)},i),this._ownHandlesKey))}};function h(e){return!!e&&d in e}function v(e={}){return{uniqueId:Symbol("line-of-sight-observer-plugin"),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new c(e)}}e([o({constructOnly:!0})],c.prototype,"observer",void 0),e([o()],c.prototype,"defaultCaptureMode",void 0),e([o()],c.prototype,"inputMapPosition",void 0),e([o()],c.prototype,"preservedIntersection",void 0),e([o()],c.prototype,"_interactiveHandle",void 0),c=e([n("esri.views.3d.analysis.LineOfSight.LineOfSightObserverPlugin")],c);export{c as LineOfSightObserverPlugin,v as createLineOfSightObserverPluginConfiguration,h as isLineOfSightObserverPlugin,d as lineOfSightObserverPluginMarker};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
|
|
2
|
+
const n=Symbol("line-of-sight-placement-leaf-plugin-marker");function e(e){return!!e&&n in e}export{e as isLineOfSightPlacementLeafPlugin,n as lineOfSightPlacementLeafPluginMarker};
|