@arcgis/core 5.2.0-next.74 → 5.2.0-next.75
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/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0502641d9a214b37ff29.js +1 -0
- package/assets/esri/core/workers/chunks/0d3b2d9a19383bb63f0a.js +1 -0
- package/assets/esri/core/workers/chunks/0d9fe49812554e7d7ba7.js +1 -0
- package/assets/esri/core/workers/chunks/0daaa89de339e8ea4b81.js +1 -0
- package/assets/esri/core/workers/chunks/{1ca04ecf010e68863014.js → 0eb35e09765fd74eb698.js} +1 -1
- package/assets/esri/core/workers/chunks/12234a63d3fa4bc25e7e.js +1 -0
- package/assets/esri/core/workers/chunks/18e0e993c0c39c962e61.js +1 -0
- package/assets/esri/core/workers/chunks/{859dd86c921053bf03a1.js → 1c49c9472167a2e0c923.js} +1 -1
- package/assets/esri/core/workers/chunks/{cf360767310fb45660a8.js → 1cf8fb704c48ac3d3b15.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e44978ee677aa23163d.js → 2435ef7d11f8dbb920b7.js} +1 -1
- package/assets/esri/core/workers/chunks/2501d9459f6d14c797e5.js +1 -0
- package/assets/esri/core/workers/chunks/2740f755c3a322cbd477.js +1 -0
- package/assets/esri/core/workers/chunks/27f574acf52f2c8bc2c9.js +1 -0
- package/assets/esri/core/workers/chunks/2b93888e61ca638490cf.js +1 -0
- package/assets/esri/core/workers/chunks/2f4ed8a63d57636a4ebe.js +1 -0
- package/assets/esri/core/workers/chunks/{31d19bb72a9e79b30070.js → 30818b5ff0ce51b25d6f.js} +1 -1
- package/assets/esri/core/workers/chunks/3235e14fedb19dd94807.js +1 -0
- package/assets/esri/core/workers/chunks/36ec5b84e551ab08b24a.js +1 -0
- package/assets/esri/core/workers/chunks/3c28e2040cb4fb716eaa.js +1 -0
- package/assets/esri/core/workers/chunks/3c32471785bc8570e41c.js +1 -0
- package/assets/esri/core/workers/chunks/4046bd65d7d0677f4600.js +1 -0
- package/assets/esri/core/workers/chunks/4295822fa6ef743c76f1.js +1 -0
- package/assets/esri/core/workers/chunks/{35fd2f765d2cb3f59a22.js → 42d5ed44111bea77ec71.js} +115 -115
- package/assets/esri/core/workers/chunks/43713bc6f7eea07259d0.js +1 -0
- package/assets/esri/core/workers/chunks/{a0a1f0bd3648738354a6.js → 43a65cab888d43954564.js} +1 -1
- package/assets/esri/core/workers/chunks/44a786aba84918f2b247.js +1 -0
- package/assets/esri/core/workers/chunks/46873badbd6ce8ff4e1e.js +1 -0
- package/assets/esri/core/workers/chunks/4d7a3b3aaf876da0891b.js +1 -0
- package/assets/esri/core/workers/chunks/{509aecafbc629bee1c15.js → 4fe2cca405180af23364.js} +1 -1
- package/assets/esri/core/workers/chunks/50b08415e072a49bc572.js +1 -0
- package/assets/esri/core/workers/chunks/519af918050b47f93516.js +1 -0
- package/assets/esri/core/workers/chunks/{bd311c85437743cf7d2f.js → 53d165b4f30fd64e5d8a.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a3afee3ecd806b4aa81.js → 552d6aecc7d88d16227b.js} +1 -1
- package/assets/esri/core/workers/chunks/{bff75cc7413bf0d319db.js → 5627f562dea8bae2f346.js} +1 -1
- package/assets/esri/core/workers/chunks/5ba3a30b7cbfa9e3aa62.js +1 -0
- package/assets/esri/core/workers/chunks/{0e81c6d4f1c81f9b0a1b.js → 5e1d84e97de0e662aaa9.js} +1 -1
- package/assets/esri/core/workers/chunks/{2baa16ec8559e77c226f.js → 64a1ffc221e5b63b43fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ca59077712e45ef4d56.js → 6743d726e45e7b660505.js} +1 -1
- package/assets/esri/core/workers/chunks/69b0dcd7bcd8ec42e2c3.js +1 -0
- package/assets/esri/core/workers/chunks/6b783f440c4a5d36e879.js +1 -0
- package/assets/esri/core/workers/chunks/6dddd3df31961b9fda12.js +1 -0
- package/assets/esri/core/workers/chunks/6fc3553c52af6ace926d.js +1 -0
- package/assets/esri/core/workers/chunks/702b2381acf4d1f90094.js +1 -0
- package/assets/esri/core/workers/chunks/{9e25f715cda59c686a4c.js → 792303e4090c0c70c4ff.js} +1 -1
- package/assets/esri/core/workers/chunks/7a24cc0f3b4eff2bdb8e.js +1 -0
- package/assets/esri/core/workers/chunks/7dc5aedc964eacd1be5a.js +1 -0
- package/assets/esri/core/workers/chunks/841c81c280114412c95b.js +1 -0
- package/assets/esri/core/workers/chunks/8a36b999cbd65dd2f16c.js +1 -0
- package/assets/esri/core/workers/chunks/8ae3a6ddc87bf8315583.js +1 -0
- package/assets/esri/core/workers/chunks/9cff18e6f751d1b3085e.js +1 -0
- package/assets/esri/core/workers/chunks/{b6d26d9738c0787acc38.js → a6a2a4a2bae0d327d7ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1a4d499a30f3d80567b.js → a7a7d3289d4ca95f545f.js} +1 -1
- package/assets/esri/core/workers/chunks/abb6c76d5dba3559a68e.js +1 -0
- package/assets/esri/core/workers/chunks/b14961a9f1f40028f141.js +1 -0
- package/assets/esri/core/workers/chunks/b6cd165d0e58598f28a5.js +1 -0
- package/assets/esri/core/workers/chunks/{f1727b4a32cb6f36a5e6.js → b78f509fd8e95f728178.js} +1 -1
- package/assets/esri/core/workers/chunks/b9d1bb106737a05290e1.js +1 -0
- package/assets/esri/core/workers/chunks/{faa55265020591fd2224.js → bc0395777c5c1adb1ddb.js} +1 -1
- package/assets/esri/core/workers/chunks/{94368a097e6190ce3c7a.js → c37b28f200b704ae6002.js} +1 -1
- package/assets/esri/core/workers/chunks/cff6390b863361eaeeed.js +1 -0
- package/assets/esri/core/workers/chunks/d1c7c877edc6948f3801.js +1 -0
- package/assets/esri/core/workers/chunks/d2172583ee6e481a66aa.js +1 -0
- package/assets/esri/core/workers/chunks/{193aed69de2dec4f36b6.js → d633e98b0dfa0490e4de.js} +1 -1
- package/assets/esri/core/workers/chunks/d8eca13c127b443141b7.js +1 -0
- package/assets/esri/core/workers/chunks/ddd8f6154e265dbb6f9f.js +1 -0
- package/assets/esri/core/workers/chunks/de601f0d5a2a282d2efd.js +1 -0
- package/assets/esri/core/workers/chunks/{fdca9873914b9dbd9244.js → e59101f1d060d0a30a65.js} +1 -1
- package/assets/esri/core/workers/chunks/eb1a86159dbc098f06fe.js +1 -0
- package/assets/esri/core/workers/chunks/{b3b53cf0a3a30164d337.js → ee9eb381e675d2d01260.js} +1 -1
- package/assets/esri/core/workers/chunks/{264fd750691d517ab1f3.js → f43a0edf58941e2ac78e.js} +1 -1
- package/assets/esri/core/workers/chunks/{4abd54518e35050feb90.js → f78acff510ca615d42e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{01c92e68fb17cf2d0e08.js → f7a5c4d22a24e1ac433c.js} +1 -1
- package/chunks/GaussianSplat.glsl.js +8 -8
- package/chunks/GaussianSplatShadow.glsl.js +4 -5
- package/chunks/OccludedGeometryDepth.glsl.js +5 -0
- package/chunks/ShadowCastVisualize.glsl.js +2 -2
- package/config.js +1 -1
- package/core/importUtils.js +2 -0
- package/geometry/operators/importUtils.js +2 -0
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/geometry/support/normalizeUtils.d.ts +17 -15
- package/geometry/support/normalizeUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/queryUtils.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/geoprocessor/utils.js +1 -1
- package/rest/identify.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryPivot.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js +8 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +8 -2
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClear.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClearTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastMaskTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualize.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +28 -21
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepth.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepthTechnique.js +2 -0
- package/views/selection/SelectionOperation.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/LayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +29 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/assets/esri/core/workers/chunks/0dbf31a663b5220a3136.js +0 -1
- package/assets/esri/core/workers/chunks/0df660dfd941cff3ea1d.js +0 -1
- package/assets/esri/core/workers/chunks/1418c03c4ab87f7ab5f4.js +0 -1
- package/assets/esri/core/workers/chunks/160b204cbf5bda2a29e9.js +0 -1
- package/assets/esri/core/workers/chunks/1cc063aa2ddf44bbd515.js +0 -1
- package/assets/esri/core/workers/chunks/2a2ed7bd44010f24c2dd.js +0 -1
- package/assets/esri/core/workers/chunks/2bdb9b5365869081c936.js +0 -1
- package/assets/esri/core/workers/chunks/3d6b2d5ae647e140abaf.js +0 -1
- package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +0 -1
- package/assets/esri/core/workers/chunks/45ccca01db0027b9dc16.js +0 -1
- package/assets/esri/core/workers/chunks/4cf2b0558a4acc141429.js +0 -1
- package/assets/esri/core/workers/chunks/4e129b9f5772a06e580c.js +0 -1
- package/assets/esri/core/workers/chunks/5441f96cdd0660229efe.js +0 -1
- package/assets/esri/core/workers/chunks/553be2bd69bd311477ea.js +0 -1
- package/assets/esri/core/workers/chunks/56bbde1dff96b423fbb9.js +0 -1
- package/assets/esri/core/workers/chunks/613e799377bdb767c955.js +0 -1
- package/assets/esri/core/workers/chunks/623d5518bca227f643bd.js +0 -1
- package/assets/esri/core/workers/chunks/62811bca7ad2100c023c.js +0 -1
- package/assets/esri/core/workers/chunks/64176f7ae719289a2f79.js +0 -1
- package/assets/esri/core/workers/chunks/73f77f5a6907cb8d9a35.js +0 -1
- package/assets/esri/core/workers/chunks/76b573143d1a65fdbcb6.js +0 -1
- package/assets/esri/core/workers/chunks/7b5b66ae79e0287e3ade.js +0 -1
- package/assets/esri/core/workers/chunks/7e373d9c98ce910db9d2.js +0 -1
- package/assets/esri/core/workers/chunks/86a4057572755b403548.js +0 -1
- package/assets/esri/core/workers/chunks/877594b6db08da98acd7.js +0 -1
- package/assets/esri/core/workers/chunks/98e6c1d035755a074d24.js +0 -1
- package/assets/esri/core/workers/chunks/a27cdf4c29dd50a6dab1.js +0 -1
- package/assets/esri/core/workers/chunks/a294dd12b5c708ce04af.js +0 -1
- package/assets/esri/core/workers/chunks/a9053ad0f4e8c4705665.js +0 -1
- package/assets/esri/core/workers/chunks/b33d870cbfa238762c5e.js +0 -1
- package/assets/esri/core/workers/chunks/b599b7dadce8b8bc88f6.js +0 -1
- package/assets/esri/core/workers/chunks/b984b808d383974ca3d8.js +0 -1
- package/assets/esri/core/workers/chunks/c25dc9073e73d6b44d88.js +0 -1
- package/assets/esri/core/workers/chunks/c45a5bcf26659daf02a1.js +0 -1
- package/assets/esri/core/workers/chunks/c46f79d5b7712adbbd1c.js +0 -1
- package/assets/esri/core/workers/chunks/c866b66ba72d96453899.js +0 -1
- package/assets/esri/core/workers/chunks/c873383e7dae35dc1a61.js +0 -1
- package/assets/esri/core/workers/chunks/d08f81d545930a79fb2e.js +0 -1
- package/assets/esri/core/workers/chunks/d607cf154218d20e4114.js +0 -1
- package/assets/esri/core/workers/chunks/da6134c7883531f21afe.js +0 -1
- package/assets/esri/core/workers/chunks/e4a2eefffe16cd5bb20f.js +0 -1
- package/assets/esri/core/workers/chunks/e602b91d8fdc36a92530.js +0 -1
- package/assets/esri/core/workers/chunks/ebfb3cdc0df15eb05d75.js +0 -1
- package/assets/esri/core/workers/chunks/f721756a6c1593f96409.js +0 -1
- package/assets/esri/core/workers/chunks/fb51f823b25c827c6b29.js +0 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +0 -2
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../request.js";import r from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as t}from"../../geometry/support/normalizeUtils.js";import a from"../../layers/support/Field.js";import o from"../../layers/support/MapImage.js";import{parseUrl as n,encode as
|
|
2
|
+
import e from"../../request.js";import r from"../../geometry/SpatialReference.js";import{normalizeCentralMeridian as t}from"../../geometry/support/normalizeUtils.js";import a from"../../layers/support/Field.js";import o from"../../layers/support/MapImage.js";import{parseUrl as n,encode as i}from"../utils.js";import s from"../support/ArealUnit.js";import u from"../support/DataFile.js";import m from"../support/FeatureSet.js";import p from"../support/LinearUnit.js";import c from"../support/ParameterValue.js";import{dataTypeJsonMap as f,multiValuePrefix as l}from"../support/parameterValueUtils.js";import S from"../support/RasterData.js";import y from"../support/TimeUnit.js";async function d(r,a,o,i,s){const u={},m={},p=[];N(i,p,u);const c=await t(p),{outSpatialReference:f,processExtent:l,processSpatialReference:S,returnColumnName:y,returnFeatureCollection:d,returnM:j,returnZ:J}=o,{path:O}=n(r);for(const e in u){const[r,t]=u[e];m[e]=c.slice(r,t)}const g=f?f.wkid||f:null,R=S?S.wkid||S:null,w="execute"===a?{returnColumnName:y||void 0,returnFeatureCollection:d||void 0,returnM:j||void 0,returnZ:J||void 0}:null,h={...s,query:v({...l?{context:{extent:l,outSR:g,processSR:R}}:{"env:outSR":g,"env:processSR":R},...i,...w,f:"json"},null,m)};return e(`${O}/${a}`,h)}function N(e,r,t){for(const a in e){const o=e[a];if(o&&"object"==typeof o&&o instanceof m){const{features:e}=o;t[a]=[r.length,r.length+e.length],e.forEach(e=>{r.push(e.geometry)})}}}async function j(e,t){switch(e){case"time-unit":return y.fromJSON(t);case"areal-unit":return s.fromJSON(t);case"boolean":case"double":case"long":case"string":case"value-table":return t;case"date":return new Date(t);case"data-file":return u.fromJSON(t);case"linear-unit":return p.fromJSON(t);case"feature-record-set-layer":if("url"in t)return u.fromJSON(t);if("layerDefinition"in t){const e=new(0,(await(import("../../layers/FeatureLayer.js"))).default),{layerDefinition:a,featureSet:o}=t;return e.read({layerDefinition:a,featureSet:o},{origin:"portal-item"}),e.spatialReference=r.fromJSON(o.spatialReference??a.spatialReference??a.extent.spatialReference),e}return m.fromJSON(t);case"record-set":return"url"in t?u.fromJSON(t):m.fromJSON(t);case"raster-data":case"raster-data-layer":return"mapImage"in t?o.fromJSON(t.mapImage):S.fromJSON(t);case"field":return a.fromJSON(t)}}function J(e){return e.startsWith(l)}function O(e){return e.replace(l,"")}async function g(e,r){const t=O(e),a="composite"===t?r.map(e=>j(f.fromJSON(e.dataType),e.value)):r.map(e=>j(t,e));return Promise.all(a)}async function R(e){const r=f.fromJSON(e.dataType),{paramName:t}=e,a=J(r)?await g(r,e.value):await j(r,e.value);return new c({dataType:r,paramName:t,value:a})}function v(e,r,t){for(const a in e){const r=e[a];Array.isArray(r)?e[a]=JSON.stringify(r.map(e=>v({item:e},!0).item)):r instanceof Date&&(e[a]=r.getTime())}return i(e,r,t)}export{N as collectGeometries,d as constructRequest,R as decode,v as gpEncode};
|
package/rest/identify.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import r from"../request.js";import{normalizeCentralMeridian as e}from"../geometry/support/normalizeUtils.js";import{parseUrl as t,encode as o,asValidOptions as s}from"./utils.js";import{identifyToIdentifyRESTParameters as n}from"./operations/identify.js";import
|
|
2
|
+
import r from"../request.js";import{normalizeCentralMeridian as e}from"../geometry/support/normalizeUtils.js";import{parseUrl as t,encode as o,asValidOptions as s}from"./utils.js";import{identifyToIdentifyRESTParameters as n}from"./operations/identify.js";import i from"./support/IdentifyParameters.js";import u from"./support/IdentifyResult.js";async function f(i,u,f){const c=(u=m(u)).geometry?[u.geometry]:[],l=t(i);l.path+="/identify";const y=await e(c),d=n(u,{geometry:y?.[0]}),h=o({...l.query,f:"json",...d}),j=s(h,f);return r(l.path,j).then(a).then(r=>p(r,u.sublayers))}function a(r){const e=r.data;return e.results=e.results||[],e.exceededTransferLimit=Boolean(e.exceededTransferLimit),e.results=e.results.map(r=>u.fromJSON(r)),e}function m(r){return r=i.from(r)}function p(r,e){if(!e?.length)return r;const t=new Map;function o(r){t.set(r.id,r),r.sublayers&&r.sublayers.forEach(o)}e.forEach(o);for(const s of r.results)s.feature.sourceLayer=t.get(s.layerId);return r}export{f as identify};
|
package/rest/imageService.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../request.js";import{ensureClass as e}from"../core/accessorSupport/ensureType.js";import
|
|
2
|
+
import t from"../request.js";import{ensureClass as e}from"../core/accessorSupport/ensureType.js";import o from"../geometry/SpatialReference.js";import{fromJSON as r}from"../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as a}from"../geometry/support/normalizeUtils.js";import{srToRESTValue as s}from"../geometry/support/spatialReferenceUtils.js";import{parseUrl as n,encode as m,asValidOptions as i}from"./utils.js";import p from"./support/FindImagesParameters.js";import u from"./support/FindImagesResult.js";import c from"./support/ImageAngleParameters.js";import f from"./support/ImageAngleResult.js";import l from"./support/ImageAreaParameters.js";import g from"./support/ImageAreaResult.js";import y from"./support/ImageBoundaryParameters.js";import j from"./support/ImageBoundaryResult.js";import d from"./support/ImageDistanceParameters.js";import S from"./support/ImageDistanceResult.js";import I from"./support/ImageGPSInfoParameters.js";import N from"./support/ImageGPSInfoResult.js";import R from"./support/ImageHeightParameters.js";import O from"./support/ImageHeightResult.js";import w from"./support/ImageHistogramParameters.js";import h from"./support/ImageIdentifyParameters.js";import J from"./support/ImageIdentifyResult.js";import P from"./support/ImagePixelLocationParameters.js";import q from"./support/ImagePixelLocationResult.js";import G from"./support/ImagePointParameters.js";import $ from"./support/ImagePointResult.js";import C from"./support/ImageSampleParameters.js";import M from"./support/ImageSampleResult.js";import b from"./support/ImageToMapMultirayParameters.js";import v from"./support/ImageToMapParameters.js";import F from"./support/ImageUrlParameters.js";import T from"./support/ImageUrlResult.js";import A from"./support/ImageVolumeParameters.js";import L from"./support/ImageVolumeResult.js";import U from"./support/MapToImageParameters.js";import x from"./support/MeasureAreaFromImageResult.js";import H from"./support/MeasureFromImageParameters.js";import V from"./support/MeasureLengthFromImageResult.js";function B(t){const e=t?.time;if(e&&(null!=e.start||null!=e.end)){const o=[];null!=e.start&&o.push(e.start),null==e.end||o.includes(e.end)||o.push(e.end),t.time=o.join(",")}}async function D(t,o,r){const s=e(w,o),p=n(t),u=s.geometry?[s.geometry]:[],c=await a(u),f=s.toJSON();B(f);const l=c?.[0];null!=l&&(f.geometry=st(l));const g=m({...p.query,f:"json",...f});return i(g,r)}async function k(o,r,a){const s=e(A,r).toJSON();s.geometries=JSON.stringify(s.geometries);const p=n(o),u=m({...p.query,f:"json",...s}),c=i(u,a),{data:f}=await t(`${p.path}/calculateVolume`,c);return L.fromJSON({volumes:f.results})}async function z(r,a,s){const p=e(c,a),u=p.toJSON();null!=u.angleName&&(u.angleName=u.angleName.join(",")),p?.point?.spatialReference?.imageCoordinateSystem&&(u.point.spatialReference=nt(p.point.spatialReference)),p?.spatialReference?.imageCoordinateSystem&&(u.spatialReference=mt(p.spatialReference));const l=n(r),g=m({...l.query,f:"json",...u}),y=i(g,s),{data:j}=await t(`${l.path}/computeAngles`,y);return j.spatialReference=j.spatialReference?null!=j.spatialReference.geodataXform?new o({wkid:0,imageCoordinateSystem:j.spatialReference}):o.fromJSON(j.spatialReference):null,"NaN"===j.north&&(j.north=null),"NaN"===j.up&&(j.up=null),new f(j)}async function E(o,r,a){const s=e(P,r),p=s.toJSON(),{geometries:u}=s;if(u)for(let t=0;t<u.length;t++)u[t].spatialReference?.imageCoordinateSystem&&(p.geometries.geometries[t].spatialReference=nt(u[t].spatialReference));const c=n(o),f=m({...c.query,f:"json",...p}),l=i(f,a),{data:g}=await t(`${c.path}/computePixelLocation`,l);return q.fromJSON(g)}async function X(e,o,r){const a=await D(e,o,r),s=n(e),{data:m}=await t(`${s.path}/computeStatisticsHistograms`,a),{statistics:i}=m;return i?.length&&i.forEach(t=>{t.avg=t.mean,t.stddev=t.standardDeviation}),{statistics:i,histograms:m.histograms}}async function K(e,o,r){const a=await D(e,o,r),s=n(e),{data:m}=await t(`${s.path}/computeHistograms`,a);return{histograms:m.histograms}}async function Q(o,r,s){const p=e(C,r),u=p.toJSON();B(u),u.outFields?.length&&(u.outFields=u.outFields.join(","));const c=await a(p.geometry),f=c?.[0];null!=f&&(u.geometry=st(f));const l=n(o),g=m({...l.query,f:"json",...u}),y=i(g,s),{data:j}=await t(`${l.path}/getSamples`,y),d=j.samples.map(t=>{const e="NaN"===t.value||""===t.value?null:t.value.split(" ").map(t=>Number(t));return{...t,pixelValue:e}});return M.fromJSON({samples:d})}async function W(o,r,s){const p=e(h,r),u=n(o),c=p.geometry?[p.geometry]:[],f=await a(c),l=p.toJSON(),g=f?.[0];null!=g&&(l.geometry=JSON.stringify(st(g)));const y=m({...u.query,f:"json",...l}),j=i(y,s),d=await t(u.path+"/identify",j);return J.fromJSON(d.data)}async function Y(t,o,r){const a=e(R,o),s=await et(t,a,[a.fromGeometry,a.toGeometry],r);return O.fromJSON(s)}async function Z(t,o,r){const a=e(l,o),s=await et(t,a,[a.geometry],r);return g.fromJSON(s)}async function _(t,o,r){const a=e(G,o),s=await et(t,a,[a.geometry],r);return $.fromJSON(s)}async function tt(t,o,r){const a=e(d,o),s=await et(t,a,[a.fromGeometry,a.toGeometry],r);return S.fromJSON(s)}async function et(e,o,r,s){const p=n(e),u=await a(r),c=o.toJSON();null!=u[0]&&(c.fromGeometry=JSON.stringify(st(u[0]))),null!=u[1]&&(c.toGeometry=JSON.stringify(st(u[1])));const f=m({...p.query,f:"json",...c}),l=i(f,s),{data:g}=await t(p.path+"/measure",l);return g}async function ot(t,o,r){const a=e(H,o),s=await at(t,a,r);return V.fromJSON(s)}async function rt(t,o,r){const a=e(H,o),s=await at(t,a,r);return x.fromJSON(s)}async function at(o,r,a){r=e(H,r);const s=n(o),p=r.toJSON(),u=m({...s.query,f:"json",...p}),c=i(u,a),{data:f}=await t(s.path+"/measureFromImage",c);return f}function st(t){const e=t.toJSON();return t.spatialReference?.imageCoordinateSystem&&(e.spatialReference=nt(t.spatialReference)),e}function nt(t){const{imageCoordinateSystem:e}=t;if(e){const{id:t,referenceServiceName:o}=e;return null!=t?o?{icsid:t,icsns:o}:{icsid:t}:{ics:e}}return t.toJSON()}function mt(t,e){if(!t.imageCoordinateSystem)return s(t);const o=nt(t),{icsid:r,icsns:a}=o;return null==r||null!=a&&!e?.toLowerCase().includes("/"+a.toLowerCase()+"/")?JSON.stringify(o):`0:${r}`}async function it(o,r,a){const s=e(y,r),p=n(o),u=s.toJSON();s.outSpatialReference&&(u.outSR=mt(s.outSpatialReference));const c=m({...p.query,f:"json",...u}),f=i(c,a),{data:l}=await t(p.path+"/queryBoundary",f);return j.fromJSON(l)}async function pt(o,r,s){const p=e(I,r),u=p.toJSON();B(u),u.objectIds?.length&&(u.objectIds=u.objectIds.join(",")),u.geometry||u.objectIds||u.time||u.where||(u.where="1=1");const c=await a(p.geometry),f=c?.[0];null!=f&&(u.geometry=st(f));const l=f?.spatialReference??p.geometry?.spatialReference;l&&(u.inSR=mt(l));const g=n(o),y=m({...g.query,f:"json",...u}),j=i(y,s),{data:d}=await t(`${g.path}/queryGPSInfo`,j);return N.fromJSON(d)}async function ut(o,a,s){const p=e(v,a),u=p.toJSON();p.geometry.spatialReference.imageCoordinateSystem&&(u.geometry=st(p.geometry)),p.depthOffset&&p.adjust||delete u.options;const c=n(o),f=m({...c.query,f:"json",...u}),l=i(f,s),{data:g}=await t(`${c.path}/imageToMap`,l);return r(g)}async function ct(o,a,s){const p=e(b,a),u=p.toJSON();p.rasterIds?.length&&(u.rasterIds=p.rasterIds.join(","));const c=n(o),f=m({...c.query,f:"json",...u}),l=i(f,s),{data:g}=await t(`${c.path}/imageToMapMultiray`,l);return r(g)}async function ft(o,s,p){const u=e(U,s),c=u.toJSON(),f=await a(u.geometry),l=f?.[0];null!=l&&(c.geometry=st(l)),u.visibleOnly||delete c.options;const g=l?.spatialReference??u.geometry?.spatialReference;g&&(c.inSR=mt(g));const y=n(o),j=m({...y.query,f:"json",...c}),d=i(j,p),{data:S}=await t(`${y.path}/mapToImage`,d);return r(S)}async function lt(o,r,a){const s=e(F,r).toJSON(),p=n(o),u=m({...p.query,f:"json",...s}),c=i(u,a),{data:f}=await t(`${p.path}/getImageUrl`,c);return T.fromJSON(f)}async function gt(o,r,s){const c=e(p,r),f=c.toJSON(),l=await a([c.fromGeometry,c.toGeometry]);null!=l[0]&&(f.fromGeometry=st(l[0]),l[0].spatialReference&&(f.inSR=mt(l[0].spatialReference))),null!=l[1]&&(f.toGeometry=st(l[1])),c.objectIds?.length&&(f.objectIds=f.objectIds.join(","));const g=n(o),y=m({...g.query,f:"json",...f}),j=i(y,s),{data:d}=await t(`${g.path}/find`,j);return u.fromJSON(d)}export{k as calculateVolume,z as computeAngles,K as computeHistograms,E as computePixelSpaceLocations,X as computeStatisticsHistograms,gt as findImages,nt as getImageSpatialReferenceJSON,mt as getImageSpatialReferenceQueryParameter,lt as getImageUrl,Q as getSamples,W as identify,ut as imageToMap,ct as imageToMapMultiray,ft as mapToImage,Z as measureAreaAndPerimeter,rt as measureAreaFromImage,tt as measureDistanceAndAngle,Y as measureHeight,ot as measureLengthFromImage,_ as measurePointOrCentroid,it as queryBoundary,pt as queryGPSInfo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../request.js";import{urlToObject as n,join as r}from"../../../core/urlUtils.js";import{normalizeCentralMeridian as e}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as o}from"../../operations/urlUtils.js";import{parsePBFFeatureQuery as u}from"./pbfQueryUtils.js";import{safeExtentResultFormat as s,queryLikeToQueryStringParameters as i}from"./queryUtils.js";import{applyFeatureSetZUnitScaling as c}from"./queryZScale.js";const a="Layer does not support extent calculation.";function y(t,n,r){return i(t,n,r)}async function
|
|
2
|
+
import t from"../../../request.js";import{urlToObject as n,join as r}from"../../../core/urlUtils.js";import{normalizeCentralMeridian as e}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as o}from"../../operations/urlUtils.js";import{parsePBFFeatureQuery as u}from"./pbfQueryUtils.js";import{safeExtentResultFormat as s,queryLikeToQueryStringParameters as i}from"./queryUtils.js";import{applyFeatureSetZUnitScaling as c}from"./queryZScale.js";const a="Layer does not support extent calculation.";function y(t,n,r){return i(t,n,r)}async function f(t,n,r,e,o){const u=n.timeExtent?.isEmpty?{features:[]}:await d(t,n,"json",e,void 0,o);return u.features??=[],c(n,r,u),u}async function l(t,n,r,e,o){if(n.timeExtent?.isEmpty)return r.featureSet;const s=await m(t,n,e,o);return u(s,r)}function m(t,n,r,e){return d(t,n,"pbf",r,void 0,e)}function p(t,n,r,e){return n.timeExtent?.isEmpty?Promise.resolve({objectIds:[]}):d(t,n,"json",r,{returnIdsOnly:!0},e)}async function O(t,n,r,e){return n.timeExtent?.isEmpty?0:(await d(t,n,"json",r,{returnCountOnly:!0},e)).count}async function w(t,n,r){if(n.timeExtent?.isEmpty)return{count:0,extent:null};const e=await d(t,n,s,r,{returnExtentOnly:!0,returnCountOnly:!0});if(e.hasOwnProperty("extent"))return e;const o="string"==typeof t?t:t.path;if(/\/imageserver\/?$/i.test(o)&&e.hasOwnProperty("count")){const o=await d(t,n,s,r,{returnExtentOnly:!0});return{count:e.count,extent:o.extent}}if(e.features)throw new Error(a);if(e.hasOwnProperty("count"))throw new Error(a);return e}function E(t,n){if(!t.returnIdsOnly||!n.uniqueIdFields)return t;const r={...t,returnUniqueIdsOnly:!0};return delete r.returnIdsOnly,r}async function d(n,r,e,o={},u={},s={}){const i=await j(n,r,e,o,u,s),c="json"===e?"json":"array-buffer";return t(i.url,{responseType:c,...i.options}).then(({data:t})=>t)}async function j(t,u,s,i,c={},a={}){const f="string"==typeof t?n(t):t,[l]=await e([u.geometry],i);if(null!=l){const t=u.clone();t.geometry=l.clone(),u=t}const m=o({...f.query,f:s,...E(c,a),...y(u,c,a)});return i={...i,query:{...m,...i.query}},new x(r(f.path,h(u,c)?"query3d":"query"),i)}class x{constructor(t,n){this.url=t,this.options=n}}function h(t,n){return null!=t.formatOf3DObjects&&!(n.returnCountOnly||n.returnExtentOnly||n.returnIdsOnly)}export{x as RunQueryParameters,f as executeQuery,O as executeQueryForCount,w as executeQueryForExtent,p as executeQueryForIds,l as executeQueryPBF,m as executeQueryPBFBuffer,j as getQueryParameters,y as queryToQueryStringParameters,d as runQuery};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../request.js";import{urlToObject as e,join as i}from"../../../core/urlUtils.js";import{getJsonType as
|
|
2
|
+
import t from"../../../request.js";import{urlToObject as e,join as i}from"../../../core/urlUtils.js";import{getJsonType as r}from"../../../geometry/support/jsonTypeUtils.js";import{normalizeCentralMeridian as n}from"../../../geometry/support/normalizeUtils.js";import{srToRESTValue as o,equals as s}from"../../../geometry/support/spatialReferenceUtils.js";import{mapParameters as u}from"../../operations/urlUtils.js";function a(t){const e=t.geometry,i=t.toJSON(),n=i;let u,a,l;if(null!=e&&(a=e.spatialReference,l=o(a),n.geometryType=r(e),n.geometry=JSON.stringify(e),n.inSR=l),i.outSR?(n.outSR=o(i.outSR),u=t.outSpatialReference):e&&(n.outSR=n.inSR,u=a),n.bin&&=JSON.stringify(n.bin),n.quantizationParameters&&=JSON.stringify(n.quantizationParameters),n.outStatistics&&=JSON.stringify(n.outStatistics),n.outTimeReference&&=JSON.stringify(n.outTimeReference),i.timeExtent){const t=i.timeExtent,{start:e,end:r}=t;null==e&&null==r||(n.time=e===r?e:`${e??"null"},${r??"null"}`),delete i.timeExtent}return t.defaultSpatialReference&&s(a,u)&&(n.defaultSR=n.inSR,delete n.inSR,delete n.outSR),n}async function l(t,e,i){return null!=e.timeExtent&&e.timeExtent.isEmpty?{data:{features:[]}}:await m(t,e,i)}async function m(r,o,s={}){const l="string"==typeof r?e(r):r,[m]=await n([o.geometry],s);null!=m&&((o=o.clone()).geometry=m);const f=u({...l.query,f:"json",...a(o)});return t(i(l.path,"queryBins"),{...s,query:{...f,...s.query}})}export{l as executeAttributeBinsQuery,a as queryToQueryStringParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../request.js";import{urlToObject as o,join as r}from"../../../core/urlUtils.js";import{normalizeCentralMeridian as i}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as e}from"../../operations/urlUtils.js";import{queryLikeToQueryStringParameters as s}from"./queryUtils.js";function n(t){const o=s(t),r=o.outPivots;if(r?.length){for(const t of r)"Pivot"===t.pivotType&&t.pivotParameters.outStatistic?t.pivotParameters.outStatistic=JSON.stringify(t.pivotParameters.outStatistic):"Unpivot"===t.pivotType&&(t.unPivotParameters.sourceFields=t.unPivotParameters.sourceFields.join(","));o.outPivots=JSON.stringify(r)}return o}async function u(t,o,r){return await a(t,o,r)}async function a(s,u,a={}){const m="string"==typeof s?o(s):s,p=
|
|
2
|
+
import t from"../../../request.js";import{urlToObject as o,join as r}from"../../../core/urlUtils.js";import{normalizeCentralMeridian as i}from"../../../geometry/support/normalizeUtils.js";import{mapParameters as e}from"../../operations/urlUtils.js";import{queryLikeToQueryStringParameters as s}from"./queryUtils.js";function n(t){const o=s(t),r=o.outPivots;if(r?.length){for(const t of r)"Pivot"===t.pivotType&&t.pivotParameters.outStatistic?t.pivotParameters.outStatistic=JSON.stringify(t.pivotParameters.outStatistic):"Unpivot"===t.pivotType&&(t.unPivotParameters.sourceFields=t.unPivotParameters.sourceFields.join(","));o.outPivots=JSON.stringify(r)}return o}async function u(t,o,r){return await a(t,o,r)}async function a(s,u,a={}){const m="string"==typeof s?o(s):s,[p]=await i([u.geometry],a);null!=p&&((u=u.clone()).geometry=p);const c=e({...m.query,f:"json",...n(u)});return t(r(m.path,"queryPivot"),{...a,query:{...c,...a.query}})}export{u as executePivotQuery,n as queryToQueryStringParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../request.js";import{urlToObject as e,join as r}from"../../../core/urlUtils.js";import{getJsonType as o}from"../../../geometry/support/jsonTypeUtils.js";import{normalizeCentralMeridian as n}from"../../../geometry/support/normalizeUtils.js";import{srToRESTValue as i}from"../../../geometry/support/spatialReferenceUtils.js";import{mapParameters as s}from"../../operations/urlUtils.js";import{safeExtentResultFormat as l}from"./queryUtils.js";import{applyFeatureSetZUnitScaling as u}from"./queryZScale.js";const y="Layer does not support extent calculation.";function p(t,e){const r=t.geometry,n=t.toJSON(),s=n;if(null!=r&&(s.geometry=JSON.stringify(r),s.geometryType=o(r),s.inSR=i(r.spatialReference)),n.topFilter?.groupByFields&&(s.topFilter.groupByFields=n.topFilter.groupByFields.join(",")),n.topFilter?.orderByFields&&(s.topFilter.orderByFields=n.topFilter.orderByFields.join(",")),n.topFilter&&(s.topFilter=JSON.stringify(s.topFilter)),n.objectIds&&(s.objectIds=n.objectIds.join(",")),n.orderByFields&&(s.orderByFields=n.orderByFields.join(",")),n.outFields&&!(e?.returnCountOnly||e?.returnExtentOnly||e?.returnIdsOnly)?n.outFields.includes("*")?s.outFields="*":s.outFields=n.outFields.join(","):delete s.outFields,n.outSR?s.outSR=i(n.outSR):r&&n.returnGeometry&&(s.outSR=s.inSR),n.returnGeometry&&delete n.returnGeometry,n.timeExtent){const t=n.timeExtent,{start:e,end:r}=t;null==e&&null==r||(s.time=e===r?e:`${e??"null"},${r??"null"}`),delete n.timeExtent}return s}async function m(t,e,r,o){const n=await f(t,e,"json",o);return u(e,r,n.data),n}async function d(t,e,r){return null!=e.timeExtent&&e.timeExtent.isEmpty?{data:{objectIds:[]}}:f(t,e,"json",r,{returnIdsOnly:!0})}async function
|
|
2
|
+
import t from"../../../request.js";import{urlToObject as e,join as r}from"../../../core/urlUtils.js";import{getJsonType as o}from"../../../geometry/support/jsonTypeUtils.js";import{normalizeCentralMeridian as n}from"../../../geometry/support/normalizeUtils.js";import{srToRESTValue as i}from"../../../geometry/support/spatialReferenceUtils.js";import{mapParameters as s}from"../../operations/urlUtils.js";import{safeExtentResultFormat as l}from"./queryUtils.js";import{applyFeatureSetZUnitScaling as u}from"./queryZScale.js";const y="Layer does not support extent calculation.";function p(t,e){const r=t.geometry,n=t.toJSON(),s=n;if(null!=r&&(s.geometry=JSON.stringify(r),s.geometryType=o(r),s.inSR=i(r.spatialReference)),n.topFilter?.groupByFields&&(s.topFilter.groupByFields=n.topFilter.groupByFields.join(",")),n.topFilter?.orderByFields&&(s.topFilter.orderByFields=n.topFilter.orderByFields.join(",")),n.topFilter&&(s.topFilter=JSON.stringify(s.topFilter)),n.objectIds&&(s.objectIds=n.objectIds.join(",")),n.orderByFields&&(s.orderByFields=n.orderByFields.join(",")),n.outFields&&!(e?.returnCountOnly||e?.returnExtentOnly||e?.returnIdsOnly)?n.outFields.includes("*")?s.outFields="*":s.outFields=n.outFields.join(","):delete s.outFields,n.outSR?s.outSR=i(n.outSR):r&&n.returnGeometry&&(s.outSR=s.inSR),n.returnGeometry&&delete n.returnGeometry,n.timeExtent){const t=n.timeExtent,{start:e,end:r}=t;null==e&&null==r||(s.time=e===r?e:`${e??"null"},${r??"null"}`),delete n.timeExtent}return s}async function m(t,e,r,o){const n=await f(t,e,"json",o);return u(e,r,n.data),n}async function d(t,e,r){return null!=e.timeExtent&&e.timeExtent.isEmpty?{data:{objectIds:[]}}:f(t,e,"json",r,{returnIdsOnly:!0})}async function a(t,e,r){return null!=e.timeExtent&&e.timeExtent.isEmpty?{data:{count:0,extent:null}}:f(t,e,l,r,{returnExtentOnly:!0,returnCountOnly:!0}).then(t=>{const e=t.data;if(e.hasOwnProperty("extent"))return t;if(e.features)throw new Error(y);if(e.hasOwnProperty("count"))throw new Error(y);return t})}function c(t,e,r){return null!=e.timeExtent&&e.timeExtent.isEmpty?Promise.resolve({data:{count:0}}):f(t,e,"json",r,{returnIdsOnly:!0,returnCountOnly:!0})}async function f(o,i,l,u={},y={}){const m="string"==typeof o?e(o):o,d=i.geometry?[i.geometry]:[];u.responseType="json";const[a]=await n(d,u);null!=a&&((i=i.clone()).geometry=a);const c=s({...m.query,f:l,...y,...p(i,y)});return t(r(m.path,"queryTopFeatures"),{...u,query:{...c,...u.query}})}export{c as executeQueryForTopCount,a as executeQueryForTopExtents,d as executeQueryForTopIds,m as executeTopFeaturesQuery,p as queryToQueryStringParameters};
|
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 b="20260813",c="579b956c1ba8ef9d4cf0841aec1430942f67bb7a";export{b as buildDate,c as commitHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{GeometryCursor as e}from"../../geometry/GeometryCursor.js";import{
|
|
2
|
+
import{GeometryCursor as e}from"../../geometry/GeometryCursor.js";import{importLazily as r}from"../../geometry/operators/importUtils.js";import{TileClipper as t}from"../../geometry/support/TileClipper.js";const o=r(()=>import("../../geometry/operators/json/bufferOperator.js")),s=r(()=>import("../../geometry/operators/json/convexHullOperator.js")),m=r(()=>import("../../geometry/operators/json/lengthOperator.js")),i=r(()=>import("../../geometry/operators/json/generalizeOperator.js")),n=r(()=>import("../../geometry/operators/json/graphicBufferOperator.js")),p=r(()=>import("../../geometry/operators/json/offsetOperator.js")),a=r(()=>import("../../geometry/operators/json/simplifyOperator.js")),f=r(()=>import("../../geometry/operators/json/simplifyOperatorOGC.js")),c=r(()=>import("../../geometry/operators/support/jsonConverter.js")),g=512;let l;function y(e){switch(e.type){case"CIMGeometricEffectDonut":case"CIMGeometricEffectBuffer":return o.getImportPromise();case"CIMGeometricEffectEnclosingPolygon":return s.getImportPromise();case"CIMGeometricEffectOffset":return Promise.all([f.getImportPromise(),p.getImportPromise(),n.getImportPromise()]);case"CIMGeometricEffectControlMeasureLine":return p.getImportPromise();case"CIMGeometricEffectTaperedPolygon":return Promise.all([a.getImportPromise(),m.getImportPromise(),i.getImportPromise()]);default:return Promise.resolve()}}function u(e){return"CIMMarkerPlacementAtMeasuredUnits"===e.type?c.getImportPromise():Promise.resolve()}class P{constructor(e){this._geometry=e}next(){const e=this._geometry;return this._geometry=null,e}}function j(r,o,s){if(!r)return null;l||(l=new t(0,0,0,1));const m=s?-1:1,i="esriGeometryPolygon"===r.geometryType,n=i?3:2,p=i?3:2;let a,f;for(l.reset(n),l.setPixelMargin(o+1),l.setExtent(g);r.nextPath();)if(!(r.pathSize<p)){for(r.nextPoint(),a=r.x,f=m*r.y,l.moveTo(a,f);r.nextPoint();)a=r.x,f=m*r.y,l.lineTo(a,f);i&&l.close()}const c=l.result(!1);if(c){const t=e.createEmptyOptimizedCIM(r.geometryType);for(const e of c){t.startPath();for(const r of e)t.pushXY(r.x,m*r.y)}return t.reset(),t}return null}export{P as SimpleEffectCursor,j as clipCursorToTileExtent,o as lazyBufferOperator,s as lazyConvexHullOperator,i as lazyGeneralizeOperator,n as lazyGraphicBufferOperator,c as lazyJsonConversion,m as lazyLengthOperator,p as lazyOffsetOperator,f as lazySimplifyOGCOperator,a as lazySimplifyOperator,y as loadGeometryOperatorsForEffect,u as loadGeometryOperatorsForPlacement};
|
package/symbols/cim/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{defaultCIMValues as e,defaultCIMColor as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const i=" /-,\n";function a(e){let t=e.length;for(;t--;)if(!i.includes(e.charAt(t)))return!1;return!0}function l(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.slice(n,o);r.push([t,null,a(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const i=t[e.slice(n,o)];i&&r.push([null,i,!1])}n=o+1}}}while(-1!==o);if(n<e.length){const t=e.slice(n);r.push([t,null,a(t)])}return r}function c(e,t,r){let n="",o=null;for(const i of t){const[t,r,a]=i;if(null!=t&&""!==t)a?o=t:(null!=o&&(n+=o,o=null),n+=t);else{const t=e.readAttribute(r);null!=t&&""!==t&&(null!==o&&(n+=o,o=null),n+=t)}}return u(n,r)}function s(e,t,r,n){let o="",i=null;for(const a of t){const[t,n,l]=a;if(null!=t&&""!==t)l?i=t:(null!=i&&(o+=i,i=null),o+=t);else{let t=n;null!=r&&(t=Y(n,r));const a=e.attributes[t];null!=a&&""!==a&&(null!=i&&(o+=i,i=null),o+=a)}}return u(o,n)}function u(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function f(e,t,r,n,o,i,a=!0){const l=t/o,c=r/i,s=Math.ceil(l/2),u=Math.ceil(c/2);for(let f=0;f<i;f++)for(let r=0;r<o;r++){const M=4*(r+(a?i-f-1:f)*o);let m=0,y=0,C=0,h=0,I=0,b=0,p=0;const d=(f+.5)*c;for(let n=Math.floor(f*c);n<(f+1)*c;n++){const o=Math.abs(d-(n+.5))/u,i=(r+.5)*l,a=o*o;for(let c=Math.floor(r*l);c<(r+1)*l;c++){let r=Math.abs(i-(c+.5))/s;const o=Math.sqrt(a+r*r);o>=-1&&o<=1&&(m=2*o*o*o-3*o*o+1,m>0&&(r=4*(c+n*t),p+=m*e[r+3],C+=m,e[r+3]<255&&(m=m*e[r+3]/250),h+=m*e[r],I+=m*e[r+1],b+=m*e[r+2],y+=m))}}n[M]=h/y,n[M+1]=I/y,n[M+2]=b/y,n[M+3]=p/C}}function M(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function m(e){return e.data?.symbol??null}function y(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function C(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function h(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function I(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const b=(e,t=0)=>null==e||isNaN(e)?t:e,p=(e,t)=>null!=e?e:t,d=(e,t)=>e??t,k=e=>e.tintColor?M(e.tintColor):[255,255,255,1];class g{constructor(e){this._import=e}getImportPromise(){return null==this._promise&&(this._promise=this._import().then(e=>this.module=e)),this._promise}}function P(e){return new g(e)}function S(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function w(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function L(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function G(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function E(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=E(t);if(null!=e)return e}break;case"CIMTextSymbol":return E(e.symbol);case"CIMSolidFill":return e.color}return null}function A(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=A(e);if(null!=t)return t}break}case"CIMTextSymbol":return A(e.symbol);case"CIMSolidStroke":return e.color}}function T(e){for(const t of e)if(t.enable)switch(t.type){case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return!0}return!1}function x(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=x(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return x(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function v(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":return"center";case"Justify":return"justify"}}function N(e){switch(e){default:case"Bottom":return"bottom";case"Top":return"top";case"Center":return"middle";case"Baseline":return"baseline"}}function F(e){return(e?Object.keys(e):[]).map(t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"}))}const z=e=>e.includes("data:image/svg+xml");function V(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function O(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function R(e,t,r,n,o,i,a=!0){const{infos:l}=i;let c=1,s=0,u=0,f=0,M=1;for(const{absoluteAnchorPoint:C,offsetX:h,offsetY:I,rotation:b,size:p,frameHeight:d,rotateClockWise:k,scaleSymbolsProportionally:g}of l){M=C?1:c;u=Q(h,I,s,M,u),f=K(h,I,s,M,f),d&&(g||a)&&(c*=p/d),s=Z(b,k,s)}const m=Q(n,o,s,M,u),y=K(n,o,s,M,f);return{size:e*c,rotation:Z(t,r,s),offsetX:m,offsetY:y}}function D(e){if(null==e)return!1;if(Array.isArray(e))return e.every(e=>D(e));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function W(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderlinecolor"===n||"tintcolor"===n)return[...t[n]];const o=e[r];if(!o)throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function j(e){return e.split(" ").map(e=>Number(e))}function q(e){return"string"==typeof e?j(e):e}function B(e){return e?.dashTemplate&&(e.dashTemplate=q(e.dashTemplate)),e}function _(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return _(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return _(e.symbol)}}return"Normal"}function X(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&I(n.markerPlacement)){const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function Y(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function H(e){return e.map(e=>({...e,propertyName:O(e.propertyName)}))}function J(e){const t={};for(const r in e){const n=e[r];t[O(r)]=n}return t}function U(e){if(!e)return 0;let t=0;for(const r of e)t+=$(r);return t}function $(e){if(!e)return 0;if(ne(e))return e.inflateSize??256;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectCircularSector":return Math.abs(e.radius??25);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(b(e.offsetX)),Math.abs(b(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRadial":return Math.abs(e.length??5);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return Math.abs(e.width)}}function K(e,t,r,n,o){const i=r*Math.PI/180;if(i){const r=Math.cos(i);return(Math.sin(i)*e+r*t)*n+o}return t*n+o}function Q(e,t,r,n,o){const i=r*Math.PI/180;if(i){return(Math.cos(i)*e-Math.sin(i)*t)*n+o}return e*n+o}function Z(e,t,r){return t?r-e:r+e}function ee(e,t,r){const n="Color"===r||"TintColor"===r||"ToColor"===r,o="Rotation"===r||"Angle"===r||"ToRotation"===r;let i=t[O(r)];if(null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180)),null==i&&(i=W(t.type,r.toLowerCase()),null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]]:o&&(i*=Math.PI/180))),null!=t.primitiveName){const a=e[t.primitiveName];if(null!=a){const e=a[r];null==e||("string"==typeof e||"number"==typeof e||Array.isArray(e)?(i=e,null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180))):(i={valueExpressionInfo:e,defaultValue:i},null!=i&&(n?i={type:"Process",op:"ArcadeColor",value:i}:o&&(i={type:"Process",op:"Divide",left:i,right:180/Math.PI}))))}}if(null==i)throw new Error(`Failed to derive a value or an expression for "${r}".`);return i}function te(e,t,r){if(null!=t[O(r)])return!0;if(null!=t.primitiveName){const n=e[t.primitiveName];if(null!=n){if(null!=n[r])return!0}}return!1}function re(e,t){return Math.max(Math.min((e??t)/100,1),0)}function ne(e){return e.type.startsWith("Private")}function oe(e){return null!=e&&ie(e)?e:void 0}function ie(e){return"setControlPoint"in e&&"getControlPoint"in e&&"setControlPointAt"in e&&"getControlPointAt"in e}export{u as adjustTextCase,l as analyzeTextParts,R as applyParentTransform,oe as asCIMGeometryCursor,s as assignTextValuesFromFeature,F as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,G as fromCIMFontDecoration,L as fromCIMFontStyle,v as fromCIMHorizontalAlignment,N as fromCIMVerticalAlignment,W as getDefaultCIMValue,U as getEffectsInflateSize,d as getEnum,Y as getFieldName,E as getFillColor,S as getFontStyle,w as getFontWeight,b as getNumericValue,ee as getProcessParam,re as getRelativeGradientSize,X as getSize,A as getStrokeColor,x as getStrokeWidth,_ as getTextCasing,c as getTextValuesFromFeatureHandle,k as getTintColor,p as getValue,te as hasProcessParam,T as hasStrokeLayer,P as importLazily,h as isCIMFill,y as isCIMMarker,I as isCIMMarkerStrokePlacement,C as isCIMStroke,r as isFeatureValueFn,ne as isPrivateGeometricEffect,z as isSVGImage,D as isValidCIMValue,V as mapCIMSymbolToGeometryType,M as normalizeAlpha,B as normalizeDashEffectTemplate,q as normalizeDashTemplate,H as normalizePrimitiveOverrideProps,j as parseDashTemplate,f as resampleHermite,m as toCIMSymbolJSON,J as toLowerCaseProps,O as uncapitalize};
|
|
2
|
+
import{defaultCIMValues as e,defaultCIMColor as t}from"./defaultCIMValues.js";function r(e){return"function"==typeof e}function n(e,t,n,o){return r(e)?e(t,n,o):e}function o(e){return[e.r,e.g,e.b,e.a]}const i=" /-,\n";function a(e){let t=e.length;for(;t--;)if(!i.includes(e.charAt(t)))return!1;return!0}function l(e,t){const r=[];let n=0,o=-1;do{if(o=e.indexOf("[",n),o>=n){if(o>n){const t=e.slice(n,o);r.push([t,null,a(t)])}if(n=o+1,o=e.indexOf("]",n),o>=n){if(o>n){const i=t[e.slice(n,o)];i&&r.push([null,i,!1])}n=o+1}}}while(-1!==o);if(n<e.length){const t=e.slice(n);r.push([t,null,a(t)])}return r}function c(e,t,r){let n="",o=null;for(const i of t){const[t,r,a]=i;if(null!=t&&""!==t)a?o=t:(null!=o&&(n+=o,o=null),n+=t);else{const t=e.readAttribute(r);null!=t&&""!==t&&(null!==o&&(n+=o,o=null),n+=t)}}return u(n,r)}function s(e,t,r,n){let o="",i=null;for(const a of t){const[t,n,l]=a;if(null!=t&&""!==t)l?i=t:(null!=i&&(o+=i,i=null),o+=t);else{let t=n;null!=r&&(t=X(n,r));const a=e.attributes[t];null!=a&&""!==a&&(null!=i&&(o+=i,i=null),o+=a)}}return u(o,n)}function u(e,t){switch("string"!=typeof e&&(e=String(e)),t){case"LowerCase":return e.toLowerCase();case"Allcaps":return e.toUpperCase();default:return e}}function f(e,t,r,n,o,i,a=!0){const l=t/o,c=r/i,s=Math.ceil(l/2),u=Math.ceil(c/2);for(let f=0;f<i;f++)for(let r=0;r<o;r++){const M=4*(r+(a?i-f-1:f)*o);let y=0,m=0,C=0,h=0,I=0,b=0,p=0;const d=(f+.5)*c;for(let n=Math.floor(f*c);n<(f+1)*c;n++){const o=Math.abs(d-(n+.5))/u,i=(r+.5)*l,a=o*o;for(let c=Math.floor(r*l);c<(r+1)*l;c++){let r=Math.abs(i-(c+.5))/s;const o=Math.sqrt(a+r*r);o>=-1&&o<=1&&(y=2*o*o*o-3*o*o+1,y>0&&(r=4*(c+n*t),p+=y*e[r+3],C+=y,e[r+3]<255&&(y=y*e[r+3]/250),h+=y*e[r],I+=y*e[r+1],b+=y*e[r+2],m+=y))}}n[M]=h/m,n[M+1]=I/m,n[M+2]=b/m,n[M+3]=p/C}}function M(e){return e?[e[0],e[1],e[2],e[3]/255]:[0,0,0,0]}function y(e){return e.data?.symbol??null}function m(e){return"CIMVectorMarker"===e.type||"CIMPictureMarker"===e.type||"CIMBarChartMarker"===e.type||"CIMCharacterMarker"===e.type||"CIMPieChartMarker"===e.type||"CIMStackedBarChartMarker"===e.type}function C(e){return"CIMGradientStroke"===e.type||"CIMPictureStroke"===e.type||"CIMSolidStroke"===e.type}function h(e){return null!=e&&("CIMGradientFill"===e.type||"CIMHatchFill"===e.type||"CIMPictureFill"===e.type||"CIMSolidFill"===e.type||"CIMWaterFill"===e.type)}function I(e){return null!=e&&("CIMMarkerPlacementAlongLineRandomSize"===e.type||"CIMMarkerPlacementAlongLineSameSize"===e.type||"CIMMarkerPlacementAlongLineVariableSize"===e.type||"CIMMarkerPlacementAtExtremities"===e.type||"CIMMarkerPlacementAtMeasuredUnits"===e.type||"CIMMarkerPlacementAtRatioPositions"===e.type||"CIMMarkerPlacementOnLine"===e.type||"CIMMarkerPlacementOnVertices"===e.type)}const b=(e,t=0)=>null==e||isNaN(e)?t:e,p=(e,t)=>null!=e?e:t,d=(e,t)=>e??t,k=e=>e.tintColor?M(e.tintColor):[255,255,255,1];function S(e){if(!e)return"normal";switch(e.toLowerCase()){case"italic":return"italic";case"oblique":return"oblique";default:return"normal"}}function g(e){if(!e)return"normal";switch(e.toLowerCase()){case"bold":return"bold";case"bolder":return"bolder";case"lighter":return"lighter";default:return"normal"}}function P(e){let t="normal",r="normal";if(e){const n=e.toLowerCase();n.includes("italic")?t="italic":n.includes("oblique")&&(t="oblique"),n.includes("bold")?r="bold":n.includes("light")&&(r="lighter")}return{style:t,weight:r}}function w(e){return e.underline?"underline":e.strikethrough?"line-through":"none"}function L(e){if(!e)return null;switch(e.type){case"CIMPolygonSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=L(t);if(null!=e)return e}break;case"CIMTextSymbol":return L(e.symbol);case"CIMSolidFill":return e.color}return null}function G(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":{const t=e.symbolLayers;if(t)for(const e of t){const t=G(e);if(null!=t)return t}break}case"CIMTextSymbol":return G(e.symbol);case"CIMSolidStroke":return e.color}}function E(e){for(const t of e)if(t.enable)switch(t.type){case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return!0}return!1}function A(e){if(e)switch(e.type){case"CIMPolygonSymbol":case"CIMLineSymbol":if(e.symbolLayers)for(const t of e.symbolLayers){const e=A(t);if(void 0!==e)return e}break;case"CIMTextSymbol":return A(e.symbol);case"CIMSolidStroke":case"CIMGradientStroke":case"CIMPictureStroke":return e.width}}function T(e){switch(e){case"Left":default:return"left";case"Right":return"right";case"Center":return"center";case"Justify":return"justify"}}function x(e){switch(e){default:case"Bottom":return"bottom";case"Top":return"top";case"Center":return"middle";case"Baseline":return"baseline"}}function v(e){return(e?Object.keys(e):[]).map(t=>({name:t,alias:t,type:"string"==typeof e[t]?"esriFieldTypeString":"esriFieldTypeDouble"}))}const N=e=>e.includes("data:image/svg+xml");function F(e){if(!e)return null;switch(e.type){case"CIMPointSymbol":case"CIMTextSymbol":return"esriGeometryPoint";case"CIMLineSymbol":return"esriGeometryPolyline";case"CIMPolygonSymbol":return"esriGeometryPolygon";default:return null}}function z(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function V(e,t,r,n,o,i,a=!0){const{infos:l}=i;let c=1,s=0,u=0,f=0,M=1;for(const{absoluteAnchorPoint:C,offsetX:h,offsetY:I,rotation:b,size:p,frameHeight:d,rotateClockWise:k,scaleSymbolsProportionally:S}of l){M=C?1:c;u=K(h,I,s,M,u),f=$(h,I,s,M,f),d&&(S||a)&&(c*=p/d),s=Q(b,k,s)}const y=K(n,o,s,M,u),m=$(n,o,s,M,f);return{size:e*c,rotation:Q(t,r,s),offsetX:y,offsetY:m}}function O(e){if(null==e)return!1;if(Array.isArray(e))return e.every(e=>O(e));switch(typeof e){case"string":return!!e;case"number":return!isNaN(e)}}function R(r,n){if("color"===n||"outlinecolor"===n||"backgroundcolor"===n||"borderlinecolor"===n||"tintcolor"===n)return[...t[n]];const o=e[r];if(!o)throw new Error(`InternalError: default value for type ${r}.`);return o[n]}function D(e){return e.split(" ").map(e=>Number(e))}function W(e){return"string"==typeof e?D(e):e}function j(e){return e?.dashTemplate&&(e.dashTemplate=W(e.dashTemplate)),e}function q(e){if(null==e)return"Normal";switch(e.type){case"CIMTextSymbol":return e.textCase??"Normal";case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const t=e.symbolLayers;if(!t)return"Normal";for(const e of t)if("CIMVectorMarker"===e.type)return q(e)}break;case"CIMVectorMarker":{const t=e.markerGraphics;if(!t)return"Normal";for(const e of t)if(e.symbol)return q(e.symbol)}}return"Normal"}function B(t){if(t)switch(t.type){case"CIMTextSymbol":return t.height;case"CIMPointSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t);break}}return r}case"CIMLineSymbol":case"CIMPolygonSymbol":{let r=0;if(t.symbolLayers)for(const n of t.symbolLayers)if(n)switch(n.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=n.width;null!=e&&e>r&&(r=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(n.markerPlacement&&I(n.markerPlacement)){const t=n.size??e.CIMVectorMarker.size;t>r&&(r=t)}break;case"CIMPictureFill":{const e=n.height;null!=e&&e>r&&(r=e)}}return r}}}function X(e,t){if(null!==t){const r=t.get(e);return r?r.name:e}return e}function Y(e){return e.map(e=>({...e,propertyName:z(e.propertyName)}))}function H(e){const t={};for(const r in e){const n=e[r];t[z(r)]=n}return t}function J(e){if(!e)return 0;let t=0;for(const r of e)t+=U(r);return t}function U(e){if(!e)return 0;if(te(e))return e.inflateSize??256;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectCircularSector":return Math.abs(e.radius??25);case"CIMGeometricEffectControlMeasureLine":return 500;case"CIMGeometricEffectExtension":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(b(e.offsetX)),Math.abs(b(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRadial":return Math.abs(e.length??5);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return Math.abs(e.width)}}function $(e,t,r,n,o){const i=r*Math.PI/180;if(i){const r=Math.cos(i);return(Math.sin(i)*e+r*t)*n+o}return t*n+o}function K(e,t,r,n,o){const i=r*Math.PI/180;if(i){return(Math.cos(i)*e-Math.sin(i)*t)*n+o}return e*n+o}function Q(e,t,r){return t?r-e:r+e}function Z(e,t,r){const n="Color"===r||"TintColor"===r||"ToColor"===r,o="Rotation"===r||"Angle"===r||"ToRotation"===r;let i=t[z(r)];if(null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180)),null==i&&(i=R(t.type,r.toLowerCase()),null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]]:o&&(i*=Math.PI/180))),null!=t.primitiveName){const a=e[t.primitiveName];if(null!=a){const e=a[r];null==e||("string"==typeof e||"number"==typeof e||Array.isArray(e)?(i=e,null!=i&&(n?i=[i[0]/255,i[1]/255,i[2]/255,i[3]/255]:o&&(i*=Math.PI/180))):(i={valueExpressionInfo:e,defaultValue:i},null!=i&&(n?i={type:"Process",op:"ArcadeColor",value:i}:o&&(i={type:"Process",op:"Divide",left:i,right:180/Math.PI}))))}}if(null==i)throw new Error(`Failed to derive a value or an expression for "${r}".`);return i}function _(e,t,r){if(null!=t[z(r)])return!0;if(null!=t.primitiveName){const n=e[t.primitiveName];if(null!=n){if(null!=n[r])return!0}}return!1}function ee(e,t){return Math.max(Math.min((e??t)/100,1),0)}function te(e){return e.type.startsWith("Private")}function re(e){return null!=e&&ne(e)?e:void 0}function ne(e){return"setControlPoint"in e&&"getControlPoint"in e&&"setControlPointAt"in e&&"getControlPointAt"in e}export{u as adjustTextCase,l as analyzeTextParts,V as applyParentTransform,re as asCIMGeometryCursor,s as assignTextValuesFromFeature,v as attributesToFields,o as colorToArray,n as evaluateValueOrFunction,w as fromCIMFontDecoration,P as fromCIMFontStyle,T as fromCIMHorizontalAlignment,x as fromCIMVerticalAlignment,R as getDefaultCIMValue,J as getEffectsInflateSize,d as getEnum,X as getFieldName,L as getFillColor,S as getFontStyle,g as getFontWeight,b as getNumericValue,Z as getProcessParam,ee as getRelativeGradientSize,B as getSize,G as getStrokeColor,A as getStrokeWidth,q as getTextCasing,c as getTextValuesFromFeatureHandle,k as getTintColor,p as getValue,_ as hasProcessParam,E as hasStrokeLayer,h as isCIMFill,m as isCIMMarker,I as isCIMMarkerStrokePlacement,C as isCIMStroke,r as isFeatureValueFn,te as isPrivateGeometricEffect,N as isSVGImage,O as isValidCIMValue,F as mapCIMSymbolToGeometryType,M as normalizeAlpha,j as normalizeDashEffectTemplate,W as normalizeDashTemplate,Y as normalizePrimitiveOverrideProps,D as parseDashTemplate,f as resampleHermite,y as toCIMSymbolJSON,H as toLowerCaseProps,z as uncapitalize};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as f,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as p,FlatGeometry as _}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as x}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as P,convertToGeometry as v}from"../../../../../../../layers/graphics/featureConversionUtils.js";import b from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{importLazily as M}from"../../../../../../../symbols/cim/utils.js";import{tileSize as w}from"../../../definitions.js";import L from"../../../collisions/BoundingBox.js";import{LabelMetric as I}from"../../../collisions/LabelMetric.js";import{smoothPaths as B,pathDivide as S}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as z,processColorInput as G}from"../fill/meshWriterUtils.js";import{TextMeshWriter as j,maxLabelZoom as D}from"../text/TextMeshWriter.js";const A=1,F=0,R=128,$=w*w/16,k=M(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),C=M(()=>import("../../../../../../../chunks/FlatGeometry.js"));function E(e,t,r){return i(`${e}${t}${r}`)}function O(e,t,r,s,o){return i(`${e}${t}${r}${s*2**(D-o)}`)}function T(e,t,r){return i(`${e}${t}${r}`)}function X(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(D-s)}`)}const Y=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class W extends j{constructor(){super(...arguments),this._zoomLevel=0}async loadDependencies(){await Promise.all([super.loadDependencies(),k.getImportPromise(),C.getImportPromise()])}_write(e,{target:t,effectGeometry:i,level:r,viewExtent:s}){if(this._zoomLevel=r,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new I(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=k.module,s=C.module.constructFromFlatGeometry,o=t.readGeometryForDisplay()?.justXY(),n=t.readCentroidForDisplay()?.coords,a=o?.area()||0;if(!n)return;const l=a>=$;e.requiresRefresh||=l;const c=s(f(i)),h=s(f({x:n[0],y:n[1]})),m=!!r.execute(h,c,null);if(!o||!l||!m)return void this._writePoint(e,n[0],n[1],0,t);const u=s(g("polygon",o,null)),d=r.execute(u,c,null);if(!d)return void this._writePoint(e,n[0],n[1],0,t);const P=p(new _(d.toFlatGeometry())),v=y.fromOptimized(P,"esriGeometryPolygon",1),b=x(v)??n;this._writePoint(e,b[0],b[1],0,t)}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=E(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=T(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new I(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<A);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:z(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay()?.justXY();if(!n)return;const a=P(n,"esriGeometryPolyline",1)??new b,l=Z(a,o),c=Z(a,-o),h=v(c,"esriGeometryPolyline",!1,!1),m=v(l,"esriGeometryPolyline",!1,!1),u=B(m.paths,s.bounds.width),d=B(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,S(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,S(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=B(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,S(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:m}=this._current,u=this._current.zoomRange[0],d=Y(t),f=this._current.shaping.bounds.width/(1<<A),g=Math.sqrt(n||R)/(1<<A),p=Math.min(i,r-i),_=h.isMultiline?D:Math.log2(p/(g+f/2)),y=0===t?_:Math.min(d,_),x=Math.max(u,this._zoomLevel+A-y),P=this._zoomLevel-x,v=h.bounds.width/2*2**P,b=O(a,c,m,t,this._zoomLevel),M=X(c,m,t,this._zoomLevel,l);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,b,M):s&&P<0?this._placeStraightAlong(e,u,b,M):"parallel"===o?this._placeStraightAlong(e,x,b,M):"curved"===o&&this._placeCurved(e,x,v,b,M)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,p=e.clone(),_=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(D,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:_,mapAligned:!0,isLineLabel:!0},p=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(p,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(p,x),[i,r]=h.shapeBackground(s(o(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(p,i,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(p,i,0,y,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+F;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+F}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+F;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+F}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,m=this._getBoundsOffset(e.angle);for(const u of h){const h=u.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(u.x+u.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+F))),p=Math.max(t,s?0:g);u.angle=e.angle+(1-i)*Math.PI;const _=[Math.max(l[0],p),Math.min(l[1],D)];this._writeLineGlyph(o,n,e.x,e.y,u,_,r,c),this._writeLineGlyphBox(o,u,i,_,m)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,m=c.glyphs,u=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*u,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const p of m){const t=p.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const m=Math.abs(p.x+p.width/2-c.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(m/(i+e.length+F)));if(0===u)continue;p.angle=e.angle+(1-o)*Math.PI;const _=[d,u];this._writeLineGlyph(a,l,f.x,f.y,p,_,n,h),this._writeLineGlyphBox(a,p,o,_,g)}}_getBoundsOffset(e){const i=t(this.evaluatedMeshParams.offsetX),s=t(this.evaluatedMeshParams.offsetY),a=u(i,s),l=r(o(),-e);return n(a,a,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>w||r<0||r>w)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps,d=this._getDefaultGlyphMetrics(this.evaluatedMeshParams.glyphs),f=s.fontSize??h;this._writeQuad(e,t,i,r,{sdfSize:d.sdfSize,sdfRadius:d.sdfRadius,texcoords:l,offsets:c,fontSize:f,haloSize:m,outlineSize:u,color:s.color?G(s.color):G(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new L(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=i}}function Z(e,t){const i=new b,{coords:r,lengths:s}=e,o=d(),n=d(),u=d(),f=d(),g=d(),p=d(),_=2;let y=0;for(let d=0;d<s.length;d++){const e=s[d];for(let s=0;s<e;s++){const d=_*(s+y-1),x=_*(s+y),P=_*(s+y+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<e-1?a(u,r[P],r[P+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===e-1?a(g,0,0):(l(g,u,n),c(g,g),a(g,g[1],-g[0])),h(p,f,g),c(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&m(p,p,v),m(p,p,t),i.coords.push(n[0]+p[0],n[1]+p[1])}i.lengths.push(e),y+=e}return i}export{W as LabelMeshWriter,E as labelIdHash,T as labelMetricHash,O as lineLabelIdHash,X as lineLabelMetricHash};
|
|
2
|
+
import{memoize as e}from"../../../../../../../core/MapUtils.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{numericHash as i}from"../../../../../../../core/string.js";import{fromRotation as r,translate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as n,set as a,sub as l,normalize as c,add as h,scale as m}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as u}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as d}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as f,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as p,FlatGeometry as _}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{importLazily as x}from"../../../../../../../geometry/operators/importUtils.js";import{getLabelPoint as P}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as v,convertToGeometry as b}from"../../../../../../../layers/graphics/featureConversionUtils.js";import M from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as w}from"../../../definitions.js";import L from"../../../collisions/BoundingBox.js";import{LabelMetric as I}from"../../../collisions/LabelMetric.js";import{smoothPaths as B,pathDivide as S}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as z,processColorInput as G}from"../fill/meshWriterUtils.js";import{TextMeshWriter as j,maxLabelZoom as D}from"../text/TextMeshWriter.js";const A=1,F=0,R=128,$=w*w/16,k=x(()=>import("../../../../../../../geometry/operators/gx/operatorIntersection.js")),C=x(()=>import("../../../../../../../chunks/FlatGeometry.js"));function E(e,t,r){return i(`${e}${t}${r}`)}function O(e,t,r,s,o){return i(`${e}${t}${r}${s*2**(D-o)}`)}function T(e,t,r){return i(`${e}${t}${r}`)}function X(e,t,r,s,o){return i(`${e}${o}${t}${r*2**(D-s)}`)}const Y=e(e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t});class U extends j{constructor(){super(...arguments),this._zoomLevel=0}async loadDependencies(){await Promise.all([super.loadDependencies(),k.getImportPromise(),C.getImportPromise()])}_write(e,{target:t,effectGeometry:i,level:r,viewExtent:s}){if(this._zoomLevel=r,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,i,r,0,t);break}case"esriGeometryEnvelope":case"esriGeometryPolygon":this._writePolygon(e,t,s);break;case"esriGeometryMultipoint":{let i=0;const r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,i++,t);break}case"esriGeometryPolyline":this._writeLines(e,t)}}_getMetricDir(){const{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return["center"===e?0:"right"===e?-1:1,"middle"===t?0:"bottom"===t?-1:1]}_createLineLabelMetric(e,t,i,r,s,o){const[n,a]=this._getMetricDir(),l=this.evaluatedMeshParams.scaleInfo?.maxScale??0,c=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this.evaluatedMeshParams.labelClassId;return new I(e,h,t,i,r,s,n,a,l,c,o)}_writePolygon(e,t,i){const r=k.module,s=C.module.constructFromFlatGeometry,o=t.readGeometryForDisplay()?.justXY(),n=t.readCentroidForDisplay()?.coords,a=o?.area()||0;if(!n)return;const l=a>=$;e.requiresRefresh||=l;const c=s(f(i)),h=s(f({x:n[0],y:n[1]})),m=!!r.execute(h,c,null);if(!o||!l||!m)return void this._writePoint(e,n[0],n[1],0,t);const u=s(g("polygon",o,null)),d=r.execute(u,c,null);if(!d)return void this._writePoint(e,n[0],n[1],0,t);const x=p(new _(d.toFlatGeometry())),v=y.fromOptimized(x,"esriGeometryPolygon",1),b=P(v)??n;this._writePoint(e,b[0],b[1],0,t)}_writePoint(e,t,i,r,s){if(t<0||t>w||i<0||i>w)return;const o=this._getShaping();if(!o)return;const n=s.getDisplayId(),a=this.evaluatedMeshParams.labelClassId,l=E(this.evaluatedMeshParams.layerId,s.getObjectId(),r),c=T(s.getObjectId(),a,r),[h,m]=this._getMetricDir(),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0,f=this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0};e.metricStart(new I(n,a,l,c,t,i,h,m,u,d,f)),this._writeGlyphs(e,n,t,i,o,0,f,void 0,!1),e.metricBoxWrite(o.boundsT),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t){const{scaleInfo:i,verticalAlignment:r}=this.evaluatedMeshParams,s=this.evaluatedMeshParams.repeatLabelDistance||128,o=this._getShaping("middle");if(!o)return;const n=(e,t,i,r)=>this._placeSubdivGlyphs(e,t,i,r),a=(o.bounds.width+s)/(1<<A);this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:o,zoomRange:z(i,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},offsetDirection:null,pathIndex:0},this._verticalPlacement="bottom"===r?"above":"top"===r?"below":null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,n,a):this._writeCenterAlong(t,n,a)}_writeAboveAndBelowAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=s.bounds.halfHeight,n=e.readGeometryForDisplay()?.justXY();if(!n)return;const a=v(n,"esriGeometryPolyline",1)??new M,l=W(a,o),c=W(a,-o),h=b(c,"esriGeometryPolyline",!1,!1),m=b(l,"esriGeometryPolyline",!1,!1),u=B(m.paths,s.bounds.width),d=B(h.paths,s.bounds.width);this._current.offsetDirection="above";for(let f=0;f<u.length;f++)this._current.pathIndex=f,S(u[f],i,t,!!r);this._current.offsetDirection="below";for(let f=0;f<d.length;f++)this._current.pathIndex=f,S(d[f],i,t,!!r)}_writeCenterAlong(e,t,i){const{repeatLabel:r}=this.evaluatedMeshParams,{shaping:s}=this._current,o=B(e.readLegacyGeometryForDisplay().paths,s.bounds.width);for(let n=0;n<o.length;n++)this._current.pathIndex=n,S(o[n],i,t,!!r)}_placeSubdivGlyphs(e,t,i,r){const{allowOverrun:s,labelPosition:o,repeatLabelDistance:n,layerId:a,labelClassId:l}=this.evaluatedMeshParams,{objId:c,shaping:h,pathIndex:m}=this._current,u=this._current.zoomRange[0],d=Y(t),f=this._current.shaping.bounds.width/(1<<A),g=Math.sqrt(n||R)/(1<<A),p=Math.min(i,r-i),_=h.isMultiline?D:Math.log2(p/(g+f/2)),y=0===t?_:Math.min(d,_),x=Math.max(u,this._zoomLevel+A-y),P=this._zoomLevel-x,v=h.bounds.width/2*2**P,b=O(a,c,m,t,this._zoomLevel),M=X(c,m,t,this._zoomLevel,l);this._current.shaping.isMultiline?0===t&&this._placeStraight(e,x,b,M):s&&P<0?this._placeStraightAlong(e,u,b,M):"parallel"===o?this._placeStraightAlong(e,x,b,M):"curved"===o&&this._placeCurved(e,x,v,b,M)}_placeStraight(e,t,i,r){const{out:s,id:o,shaping:n,referenceBounds:a}=this._current,{x:l,y:c}=e;s.metricStart(this._createLineLabelMetric(o,i,r,l,c)),s.metricBoxWrite(n.boundsT);const h=e.angle*(180/Math.PI)%360,m=(e.angle*(180/Math.PI)+180)%360;if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const e={clipAngle:h,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const e={clipAngle:m,mapAligned:!0,isLineLabel:!0,minZoom:t};this._writeGlyphs(s,o,l,c,n,0,a,e,!1)}s.metricEnd()}_placeCurved(e,t,i,r,s){const{out:o,id:n}=this._current;o.metricStart(this._createLineLabelMetric(n,r,s,e.x,e.y));const a=e.clone(),l=e.angle*(180/Math.PI)%360,c=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(a,t,1,l),this._placeBack(e,a,t,i,1,l),this._placeForward(e,a,t,i,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(a,t,0,c),this._placeBack(e,a,t,i,0,c),this._placeForward(e,a,t,i,0,c)),o.metricEnd()}_placeStraightAlong(e,i,n,a){const{out:l,id:c,shaping:h,zoomRange:m,referenceBounds:d}=this._current,{boxBorderLineColor:f,boxBackgroundColor:g}=this.evaluatedMeshParams,p=e.clone(),_=e.angle*(180/Math.PI)%360,y=(e.angle*(180/Math.PI)+180)%360,x=h.glyphs.length>0&&!(!f&&!g);if(l.metricStart(this._createLineLabelMetric(c,n,a,e.x,e.y)),x){const n=Math.max(i,m[0],0),a=Math.min(D,m[1]),f=r(o(),-e.angle),g={minZoom:n,maxZoom:a,clipAngle:_,mapAligned:!0,isLineLabel:!0},p=t(this.evaluatedMeshParams.offsetX),x=t(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){const t=u(p,-1*x),[i,r]=h.shapeBackground(s(o(),f,t));l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){const t=u(p,x),[i,r]=h.shapeBackground(s(o(),f,t));g.clipAngle=y,l.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(l,c,e.x,e.y,r,d,g),l.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(p,i,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(p,i,0,y,!0),l.metricEnd()}_placeBack(e,t,i,r,s,o){const n=e.clone();let a=e.backwardLength+F;for(;n.prev()&&!(a>=r);)this._placeOnSegment(n,t,a,i,-1,s,o),a+=n.length+F}_placeForward(e,t,i,r,s,o){const n=e.clone();let a=e.remainingLength+F;for(;n.next()&&!(a>=r);)this._placeOnSegment(n,t,a,i,1,s,o),a+=n.length+F}_placeFirst(e,t,i,r,s=!1){const{out:o,id:n,shaping:a,zoomRange:l,referenceBounds:c}=this._current,h=a.glyphs,m=this._getBoundsOffset(e.angle);for(const u of h){const h=u.x>a.bounds.x?i:1-i,d=h*e.remainingLength+(1-h)*e.backwardLength,f=Math.abs(u.x+u.width/2-a.bounds.x),g=Math.max(0,this._zoomLevel+Math.log2(f/(d+F))),p=Math.max(t,s?0:g);u.angle=e.angle+(1-i)*Math.PI;const _=[Math.max(l[0],p),Math.min(l[1],D)];this._writeLineGlyph(o,n,e.x,e.y,u,_,r,c),this._writeLineGlyphBox(o,u,i,_,m)}}_placeOnSegment(e,t,i,r,s,o,n){const{out:a,id:l,shaping:c,referenceBounds:h}=this._current,m=c.glyphs,u=e.dx/e.length,d=e.dy/e.length,f={x:e.x+i*-s*u,y:e.y+i*-s*d},g=this._getBoundsOffset(e.angle);for(const p of m){const t=p.x>c.bounds.x?o:1-o;if(!(t&&1===s||!t&&-1===s))continue;const m=Math.abs(p.x+p.width/2-c.bounds.x),u=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),d=Math.max(r,this._zoomLevel+Math.log2(m/(i+e.length+F)));if(0===u)continue;p.angle=e.angle+(1-o)*Math.PI;const _=[d,u];this._writeLineGlyph(a,l,f.x,f.y,p,_,n,h),this._writeLineGlyphBox(a,p,o,_,g)}}_getBoundsOffset(e){const i=t(this.evaluatedMeshParams.offsetX),s=t(this.evaluatedMeshParams.offsetY),a=u(i,s),l=r(o(),-e);return n(a,a,l)}_writeLineGlyph(e,t,i,r,s,o,n,a){if(i<0||i>w||r<0||r>w)return;e.recordStart(this.instanceId,this.attributeLayout,s.textureBinding);const{texcoords:l,offsets:c}=s,{fontSize:h,haloSize:m,outlineSize:u}=this._textMeshTransformProps,d=this._getDefaultGlyphMetrics(this.evaluatedMeshParams.glyphs),f=s.fontSize??h;this._writeQuad(e,t,i,r,{sdfSize:d.sdfSize,sdfRadius:d.sdfRadius,texcoords:l,offsets:c,fontSize:f,haloSize:m,outlineSize:u,color:s.color?G(s.color):G(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],o[0]),maxZoom:Math.min(this._current.zoomRange[1],o[1]),clipAngle:n,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,i,r,s){if((i||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){const i=t.bounds,r=new L(i.x+s[0],i.y+s[1],i.width,i.height);e.metricBoxWrite(r)}}_isVisible(e){const t=Math.max(this._current.zoomRange[0],e[0]),i=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=i}}function W(e,t){const i=new M,{coords:r,lengths:s}=e,o=d(),n=d(),u=d(),f=d(),g=d(),p=d(),_=2;let y=0;for(let d=0;d<s.length;d++){const e=s[d];for(let s=0;s<e;s++){const d=_*(s+y-1),x=_*(s+y),P=_*(s+y+1);s>0?a(o,r[d],r[d+1]):a(o,0,0),a(n,r[x],r[x+1]),s<e-1?a(u,r[P],r[P+1]):a(u,0,0),0===s?a(f,0,0):(l(f,n,o),c(f,f),a(f,f[1],-f[0])),s===e-1?a(g,0,0):(l(g,u,n),c(g,g),a(g,g[1],-g[0])),h(p,f,g),c(p,p);const v=p[0]*g[0]+p[1]*g[1];0!==v&&m(p,p,v),m(p,p,t),i.coords.push(n[0]+p[0],n[1]+p[1])}i.lengths.push(e),y+=e}return i}export{U as LabelMeshWriter,E as labelIdHash,T as labelMetricHash,O as lineLabelIdHash,X as lineLabelMetricHash};
|
|
@@ -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/Accessor.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{normalizeCentralMeridian as l}from"../../../../geometry/support/normalizeUtils.js";import n from"../../../../layers/GraphicsLayer.js";import p from"../../../../rest/support/PointBarrier.js";import c from"../../../../rest/support/PolygonBarrier.js";import h from"../../../../rest/support/PolylineBarrier.js";import y from"../../../../rest/support/Stop.js";import{RouteLayerWaypointVisualization as d}from"./RouteLayerWaypointVisualization.js";import u from"../../../../widgets/Sketch/SketchViewModel.js";function m(e,t){e.networkFeature=t}function g(e){const t=b(e.graphic);return{...e,networkFeature:t}}function w(e){const t=e.graphics.map(e=>b(e));return{...e,networkFeatures:t}}function b(e){return e.networkFeature}function k(e){return"point"===e?.type||"polyline"===e?.type||"polygon"===e?.type}let _=class extends t{constructor(e){super(e),this._createMode=null,this._graphicsLayer=new n({internal:!0,listMode:"hide"}),this._sketchViewModel=new u({layer:this._graphicsLayer}),this._updatingHandles=new a,this.enabled=!0,this._handleSketchViewModelEvents=async e=>{switch(e.type){case"update":switch(e.state){case"active":case"complete":for(const t of e.graphics){b(t).geometry=k(t.geometry)?t.geometry.clone():null}}break;case"undo":case"redo":break;case"delete":for(const t of e.graphics){const e=b(t);this._removeNetworkFeature(e)}break;case"create":if(e.graphic&&"complete"===e.state&&this._createMode){const
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as a}from"../../../../core/support/UpdatingHandles.js";import{normalizeCentralMeridian as l}from"../../../../geometry/support/normalizeUtils.js";import n from"../../../../layers/GraphicsLayer.js";import p from"../../../../rest/support/PointBarrier.js";import c from"../../../../rest/support/PolygonBarrier.js";import h from"../../../../rest/support/PolylineBarrier.js";import y from"../../../../rest/support/Stop.js";import{RouteLayerWaypointVisualization as d}from"./RouteLayerWaypointVisualization.js";import u from"../../../../widgets/Sketch/SketchViewModel.js";function m(e,t){e.networkFeature=t}function g(e){const t=b(e.graphic);return{...e,networkFeature:t}}function w(e){const t=e.graphics.map(e=>b(e));return{...e,networkFeatures:t}}function b(e){return e.networkFeature}function k(e){return"point"===e?.type||"polyline"===e?.type||"polygon"===e?.type}let _=class extends t{constructor(e){super(e),this._createMode=null,this._graphicsLayer=new n({internal:!0,listMode:"hide"}),this._sketchViewModel=new u({layer:this._graphicsLayer}),this._updatingHandles=new a,this.enabled=!0,this._handleSketchViewModelEvents=async e=>{switch(e.type){case"update":switch(e.state){case"active":case"complete":for(const t of e.graphics){b(t).geometry=k(t.geometry)?t.geometry.clone():null}}break;case"undo":case"redo":break;case"delete":for(const t of e.graphics){const e=b(t);this._removeNetworkFeature(e)}break;case"create":if(e.graphic&&"complete"===e.state&&this._createMode){const[t]=await l(e.graphic.geometry?.clone()),r=e.graphic.symbol?.clone();if(!t)break;switch(this._createMode){case"stop":{if("point"!==t.type)break;const{stops:r}=this.layer;if(r.length>0&&r.every(({geometry:e})=>!e)){r.at(0).geometry=t;break}if(r.length>1&&r.filter((e,t)=>0!==t).every(({geometry:e})=>!e)){r.at(1).geometry=t;break}const i=new y({geometry:t});r.add(i),m(e.graphic,i);break}case"point-barrier":{if("point"!==t.type)break;const i=new p({geometry:t,symbol:r});this.layer.pointBarriers.add(i),m(e.graphic,i);break}case"polyline-barrier":{if("polyline"!==t.type)break;const i=new h({geometry:t,symbol:r});this.layer.polylineBarriers.add(i),m(e.graphic,i);break}case"polygon-barrier":{if("polygon"!==t.type)break;const i=new c({geometry:t,symbol:r});this.layer.polygonBarriers.add(i),m(e.graphic,i);break}}}}(await this.view.whenLayerView(this.layer)).emit(e.type,"create"===e.type?g(e):w(e))}}initialize(){this._sketchViewModel.view=this.view,this.addHandles([r(()=>this.enabled,e=>{e?this._activate():this._deactivate()},i),r(()=>{const{stops:e,pointBarriers:t,polylineBarriers:r,polygonBarriers:i}=this.layer;return{stops:e,pointBarriers:t,polylineBarriers:r,polygonBarriers:i}},()=>{this.enabled&&this._loadClonedGraphics()}),this._sketchViewModel.on(["create","delete","redo","undo","update"],this._handleSketchViewModelEvents)]),this._routeLayerWaypointVisualization=new d({view:this.view,interaction:this})}destroy(){this._graphicsLayer.removeFromParent(),this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.destroy(),this._routeLayerWaypointVisualization?.destroy(),this._sketchViewModel.destroy(),this._updatingHandles.destroy()}get selectedNetworkFeatures(){return this._sketchViewModel.updateGraphics.map(e=>b(e))}get sketchActive(){return!!this._sketchViewModel.activeTool}get updating(){return(this._routeLayerWaypointVisualization?.updating??!0)||this._sketchViewModel.updating||this._updatingHandles.updating}addNetworkFeature(e){const t=e.toGraphic();this._graphicsLayer.add(t),m(t,e),this._sketchViewModel.update(t)}async create(e){if(this.enabled){switch(this._createMode=e,e){case"stop":this.layer.defaultSymbols.stops?.unlocated&&(this._sketchViewModel.pointSymbol=this.layer.defaultSymbols.stops.unlocated.clone());break;case"point-barrier":this.layer.defaultSymbols.pointBarriers&&(this._sketchViewModel.pointSymbol=this.layer.defaultSymbols.pointBarriers.clone());break;case"polyline-barrier":this.layer.defaultSymbols.polylineBarriers&&(this._sketchViewModel.polylineSymbol=this.layer.defaultSymbols.polylineBarriers.clone());break;case"polygon-barrier":this.layer.defaultSymbols.polygonBarriers&&(this._sketchViewModel.polygonSymbol=this.layer.defaultSymbols.polygonBarriers.clone())}switch(e){case"stop":case"point-barrier":return this._sketchViewModel.create("point");case"polyline-barrier":return this._sketchViewModel.create("polyline");case"polygon-barrier":return this._sketchViewModel.create("polygon")}}}delete(){for(const e of this.selectedNetworkFeatures)this.remove(e)}remove(e){const t=this._graphicsLayer.graphics.find(t=>b(t)===e);t&&(this._graphicsLayer.remove(t),this._removeNetworkFeature(e))}_activate(){this._loadClonedGraphics(),this.view.map.add(this._graphicsLayer)}_deactivate(){this._sketchViewModel.cancel(),this._graphicsLayer.removeFromParent(),this._graphicsLayer.graphics.destroyAll()}_loadClonedGraphics(){const e=[this.layer.stops,this.layer.pointBarriers,this.layer.polylineBarriers,this.layer.polygonBarriers].flatMap(e=>e.toArray().map(e=>{const t=e.toGraphic();return t.networkFeature=e,t}));this._graphicsLayer.graphics.destroyAll(),this._graphicsLayer.addMany(e)}_removeNetworkFeature(e){switch(e.type){case"stop":this.layer.stops.remove(e);break;case"point-barrier":this.layer.pointBarriers.remove(e);break;case"polyline-barrier":this.layer.polylineBarriers.remove(e);break;case"polygon-barrier":this.layer.polygonBarriers.remove(e)}}};e([o()],_.prototype,"_routeLayerWaypointVisualization",void 0),e([o()],_.prototype,"enabled",void 0),e([o({constructOnly:!0})],_.prototype,"interactiveOptions",void 0),e([o({constructOnly:!0})],_.prototype,"layer",void 0),e([o({readOnly:!0})],_.prototype,"selectedNetworkFeatures",null),e([o()],_.prototype,"sketchActive",null),e([o()],_.prototype,"updating",null),e([o({constructOnly:!0})],_.prototype,"view",void 0),_=e([s("esri.views.2d.layers.support.RouteLayerInteraction")],_);export{_ as RouteLayerInteraction};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{deg2rad as r}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as n}from"../../core/units.js";import{toRadian as o}from"../../core/libs/gl-matrix-2/math/common.js";import{fromTranslation as a,rotate as i,scale as c,translate as s,fromScaling as u,fromRotation as
|
|
2
|
+
import t from"../../Viewpoint.js";import e from"../../core/Collection.js";import{deg2rad as r}from"../../core/mathUtils.js";import{getMetersPerUnitForSR as n}from"../../core/units.js";import{toRadian as o}from"../../core/libs/gl-matrix-2/math/common.js";import{fromTranslation as a,rotate as i,scale as c,translate as s,fromScaling as u,fromRotation as f,invert as l}from"../../core/libs/gl-matrix-2/math/mat2d.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{negate as y,scale as p,set as g,copy as x,sub as h,subtract as b,normalize as d,cross as w,dot as j,length as G,transformMat2d as R,add as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{create as S,fromValues as M}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import k from"../../geometry/Extent.js";import v from"../../geometry/Geometry.js";import z from"../../geometry/Point.js";import{isLoaded as C,canProjectWithoutEngine as F,load as N,project as I}from"../../geometry/projectionUtils.js";import V from"../../geometry/SpatialReference.js";import{getClosestDenormalizedXToReference as q,getDenormalizedExtent as L}from"../../geometry/support/normalizeUtils.js";import{getInfo as P,isValid as U,equals as E}from"../../geometry/support/spatialReferenceUtils.js";const O=96,Q=39.37,T=180/Math.PI;function B(t){return t.wkid?t:t.spatialReference||V.WGS84}function D(t,e){return e.type?g(t,e.x,e.y):x(t,e)}function W(t){return n(t)}function H(t,e,n=0){let o=t.width,a=t.height;if(0!==n){const e=r(n),i=Math.abs(Math.cos(e)),c=Math.abs(Math.sin(e));o=t.width*i+t.height*c,a=t.width*c+t.height*i}const i=Math.max(1,e[0]),c=Math.max(1,e[1]);return Math.max(o/i,a/c)*ct(t.spatialReference)}async function J(t,r,n,o){let a;if(!t)return null;if(Array.isArray(t)&&!t.length)return null;if(e.isCollection(t)&&(t=t.toArray()),Array.isArray(t)&&t.length&&"object"==typeof t[0]){const e=t.every(t=>"attributes"in t),a=t.some(t=>!t.geometry);let i=t;if(e&&a&&r&&r.allLayerViews){const e=new Map;for(const r of t){const t=r.layer,n=e.get(t)||[],o=r.attributes[t.objectIdField];null!=o&&n.push(o),e.set(t,n)}const n=[];e.forEach((t,e)=>{const o=r.allLayerViews?.find(t=>t.layer.id===e.id);if(o&&"queryFeatures"in o){const r=e.createQuery();r.objectIds=t,r.returnGeometry=!0,n.push(o.queryFeatures(r))}});const o=await Promise.all(n),a=[];for(const t of o)if(t&&t.features&&t.features.length)for(const e of t.features)null!=e.geometry&&a.push(e.geometry);i=a}for(const t of i)o=await J(t,r,n,o);return o}if(Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])a=new z(t);else if("type"in t)a=t;else if("geometry"in t)if(t.geometry)a=t.geometry;else if(t.layer){const e=t.layer,n=r.allLayerViews?.find(t=>t.layer.id===e.id);if(n&&"queryFeatures"in n){const r=e.createQuery();r.objectIds=[t.attributes[e.objectIdField]],r.returnGeometry=!0;const o=await n.queryFeatures(r);a=o?.features?.[0]?.geometry}}if(null==a)return null;const i=L(a);if(!i)return null;C()||F(i.spatialReference,n)||await N();const c=I(i,n);if(!c)return null;if(o){const t=c.center,e=t.clone();e.x=q(t.x,o.center.x,n),e.x!==t.x&&c.centerAt(e),o=o.union(c)}else o=c;return o}function K(t){if(t&&(!Array.isArray(t)||"number"!=typeof t[0])&&("object"==typeof t||Array.isArray(t)&&"object"==typeof t[0])){if("layer"in t&&null!=t.layer?.minScale&&null!=t.layer.maxScale){const e=t.layer;return{min:e.minScale,max:e.maxScale}}if(Array.isArray(t)&&t.length&&t.every(t=>"layer"in t)){let e=0,r=0;for(const n of t){const t=n.layer;t?.minScale&&t.maxScale&&(e=t.minScale<e?t.minScale:e,r=t.maxScale>r?t.maxScale:r)}return e&&r?{min:e,max:r}:null}}}function X(t,e){const r=B(t);return E(r,e)||r.imageCoordinateSystem||e.imageCoordinateSystem?t:I(t,e)}async function Y(e,r){if(!e||!r)return new t({targetGeometry:new z,scale:0,rotation:0});let n=r.spatialReference;const{constraints:o,padding:a,viewpoint:i,size:c}=r,s=[a?c[0]-a.left-a.right:c[0],a?c[1]-a.top-a.bottom:c[1]];let u=null;e instanceof t?u=e:e.viewpoint?u=e.viewpoint:e.target&&"esri.Viewpoint"===e.target.declaredClass&&(u=e.target);let f=null;u?.targetGeometry?f=u.targetGeometry:e instanceof k?f=e:e instanceof v?f=await J(e,r,n):e&&(f=await J(e.center,r,n)||await J(e.target,r,n)||await J(e,r,n)),!f&&i?.targetGeometry?f=i.targetGeometry:!f&&r.extent&&(f=r.extent),n||(n=B(r.spatialReference||r.extent||f)),C()||E(f.spatialReference,n)||F(f.spatialReference,n)||await N();const l=X(f,n),m="center"in l?l.center:l;!1!==r.pickClosestTarget&&"point"===m.type&&"point"===i.targetGeometry?.type&&(m.x=q(m.x,i.targetGeometry.x,m.spatialReference));let y=0;u?y=u.rotation:e.hasOwnProperty("rotation")?y=e.rotation:i&&(y=i.rotation);let p=0;p=null!=u?.targetGeometry&&"point"===u.targetGeometry.type?u.scale:"scale"in e&&e.scale?e.scale:"zoom"in e&&-1!==e.zoom&&o&&o.effectiveLODs?o.zoomToScale(e.zoom):Array.isArray(f)||"point"===f.type||"extent"===f.type&&0===f.width&&0===f.height?i.scale:H(X(f.extent,n),s,y);const g=K(e.target??e);g&&(g.min&&g.min<p?p=g.min:g.max&&g.max>p&&(p=g.max));let x=new t({targetGeometry:m,scale:p,rotation:y});return o&&(x=o.fit(x),o.constrainByGeometry(x),o.rotationEnabled||(x.rotation=i.rotation)),x}function Z(t,e){const r=t.targetGeometry,n=e.targetGeometry;return r.x=n.x,r.y=n.y,r.spatialReference=n.spatialReference,t.scale=e.scale,t.rotation=e.rotation,t}function $(t,e,r){return r?g(t,.5*(e[0]-r.right+r.left),.5*(e[1]-r.bottom+r.top)):p(t,e,.5)}const _=function(){const t=S();return function(e,r,n){const o=r.targetGeometry;D(t,o);const a=.5*ot(r);return e.xmin=t[0]-a*n[0],e.ymin=t[1]-a*n[1],e.xmax=t[0]+a*n[0],e.ymax=t[1]+a*n[1],e.spatialReference=o.spatialReference,e}}();function tt(t,e,r,n,o){return xt(t,e,r.center),t.scale=H(r,n),o?.constraints?.constrain(t),t}function et(t,e,r,n){return ft(t,e,r,n),l(t,t)}const rt=function(){const t=S();return function(e,r,n){return h(e,st(e,r),$(t,r,n))}}(),nt=function(){const t=m(),e=S();return function(r,n,o,a){const c=ot(n),f=it(n);return g(e,c,c),u(t,e),i(t,t,f),s(t,t,rt(e,o,a)),s(t,t,[0,a.top-a.bottom]),g(r,t[4],t[5])}}();function ot(t){return t.scale*at(t.targetGeometry?.spatialReference)}function at(t){return U(t)?1/(W(t)*Q*O):1}function it(t){return o(t.rotation)||0}function ct(t){return U(t)?W(t)*Q*O:1}function st(t,e){return p(t,e,.5)}const ut=function(){const t=S(),e=S(),r=S();return function(n,o,u,f,l,m){return y(t,o),p(e,u,.5*m),g(r,1/f*m,-1/f*m),a(n,e),l&&i(n,n,l),c(n,n,r),s(n,n,t),n}}(),ft=function(){const t=S();return function(e,r,n,o){const a=ot(r),i=it(r);return D(t,r.targetGeometry),ut(e,t,n,a,i,o)}}(),lt=function(){const t=S();return function(e,r,n,o){const a=ot(r);return D(t,r.targetGeometry),ut(e,t,n,a,0,o)}}();function mt(t){const e=P(t);return e?e.valid[1]-e.valid[0]:0}function yt(t,e){return Math.round(mt(t)/e)}const pt=function(){const t=S(),e=S(),r=[0,0,0];return function(n,o,a){b(t,n,o),d(t,t),b(e,n,a),d(e,e),w(r,t,e);let i=Math.acos(j(t,e)/(G(t)*G(e)))*T;return r[2]<0&&(i=-i),isNaN(i)&&(i=0),i}}(),gt=function(){const t=S();return function(e,r,n,o){const a=e.targetGeometry;return Z(e,r),nt(t,r,n,o),a.x+=t[0],a.y+=t[1],e}}(),xt=function(t,e,r){Z(t,e);const n=t.targetGeometry;return n.x=r.x,n.y=r.y,n.spatialReference=r.spatialReference,t},ht=function(){const t=S();return function(e,r,n,o,a){a||(a="center"),h(t,n,o),p(t,t,.5);const i=t[0],c=t[1];switch(a){case"center":g(t,0,0);break;case"left":g(t,-i,0);break;case"top":g(t,0,c);break;case"right":g(t,i,0);break;case"bottom":g(t,0,-c);break;case"top-left":g(t,-i,c);break;case"bottom-left":g(t,-i,-c);break;case"top-right":g(t,i,c);break;case"bottom-right":g(t,i,-c)}return Mt(e,r,t),e}}();function bt(t,e,r){return Z(t,e),t.rotation+=r,t}function dt(t,e,r){return Z(t,e),t.rotation=r,t}const wt=function(){const t=S();return function(e,r,n,o,a){return Z(e,r),isNaN(n)||0===n||(At(t,o,r,a),e.scale=r.scale*n,St(t,t,e,a),Mt(e,e,g(t,t[0]-o[0],o[1]-t[1]))),e}}();function jt(t,e,r){return Z(t,e),t.scale=r,t}const Gt=function(){const t=S();return function(e,r,n,o,a,i){return Z(e,r),isNaN(n)||0===n||(At(t,a,r,i),e.scale=r.scale*n,e.rotation+=o,St(t,t,e,i),Mt(e,e,g(t,t[0]-a[0],a[1]-t[1]))),e}}(),Rt=function(){const t=S(),e=S();return function(r,n,o,a,i,c,s){return rt(e,c,s),A(t,i,e),a?Gt(r,n,o,a,t,c):wt(r,n,o,t,c)}}(),At=function(){const t=m();return function(e,r,n,o){return R(e,r,et(t,n,o,1))}}(),St=function(){const t=m();return function(e,r,n,o){return R(e,r,ft(t,n,o,1))}}(),Mt=function(){const t=S(),e=m();return function(r,n,o){Z(r,n);const a=ot(n),i=r.targetGeometry;return f(e,it(n)),c(e,e,M(a,a)),R(t,o,e),i.x+=t[0],i.y+=t[1],r}}();export{gt as addPadding,pt as angleBetween,xt as centerAt,Z as copy,Y as create,H as extentToScale,$ as getAnchor,_ as getExtent,ut as getMatrix,nt as getPaddingMapTranslation,rt as getPaddingScreenTranslation,ot as getResolution,ct as getResolutionToScaleFactor,at as getScaleToResolutionFactor,ft as getTransform,lt as getTransformNoRotation,yt as getWorldScreenWidth,mt as getWorldWidth,Rt as padAndScaleAndRotateBy,ht as resize,bt as rotateBy,dt as rotateTo,Gt as scaleAndRotateBy,jt as scaleTo,tt as setExtent,At as toMap,St as toScreen,Mt as translateBy};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import"../../../core/has.js";import{watch as i,sync as n,syncAndInitial as r,when as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../core/accessorSupport/decorators.js";import{length as h,equals as l,copy as c,scale as g,lerp as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as p,create as m,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEarth as v,getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{isLoadedOrLoadFor as f}from"../../../geometry/projectionUtils.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVector as y}from"../../../geometry/projection/projectPointToVector.js";import{getGCSForPlanet as b}from"../../../geometry/support/planetGCSUtils.js";import{heightLimit as P}from"./weather.js";import{positionToTimezoneInfo as T}from"../support/earthUtils.js";import{ColorAndIntensity as L,
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import"../../../core/has.js";import{watch as i,sync as n,syncAndInitial as r,when as o}from"../../../core/reactiveUtils.js";import{property as s,subclass as a}from"../../../core/accessorSupport/decorators.js";import{length as h,equals as l,copy as c,scale as g,lerp as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as p,create as m,fromValues as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isEarth as v,getReferenceEllipsoid as _}from"../../../geometry/ellipsoidUtils.js";import{isLoadedOrLoadFor as f}from"../../../geometry/projectionUtils.js";import w from"../../../geometry/SpatialReference.js";import{projectPointToVector as y}from"../../../geometry/projection/projectPointToVector.js";import{getGCSForPlanet as b}from"../../../geometry/support/planetGCSUtils.js";import{heightLimit as P}from"./weather.js";import{positionToTimezoneInfo as T}from"../support/earthUtils.js";import{ColorAndIntensity as L,computeShadowsEnabled as j,computeColorAndIntensity as S,computeVirtualLightDirection as G}from"../support/sunUtils.js";import{MainLight as U,AmbientLight as H,FillLight as C}from"../webgl-engine/lighting/Lightsources.js";let E=class extends t{constructor(e){super(e),this.view=null,this._tmpLightParameters=new L,this._defaultLightParameters=new L,this._tmpDate=new Date,this._tmpTz={hours:0,minutes:0,seconds:0},this._viewHandlesKey="viewHandles",this._trackingEnabled=!1,this._mainLight=new U,this._ambientLight=new H,this._moonLight=new C,this._disableWeather=!1,this.shadowsAvailable=!1,this._resetReferencePosition()}destroy(){this.disconnectView()}get updating(){return!this._canProjectCameraPosition}get weatherEnabled(){return null!=this.view&&null!=this.view.stage&&null!=this.view.stage.renderer&&null!=this.view.stage.renderer.weatherFader&&this.view.environment.atmosphereEnabled&&!this._disableWeather&&1===this.view.state.viewingMode&&v(this.view.spatialReference)}get _weatherAvailable(){return null!=this.view&&this.weatherEnabled&&h(this.view.state.camera.eye)-_(this.view.spatialReference).radius<=P}_modifyShadowsAvailable(){if(null==this.view)return;const e=this.referencePositionGeographic,t=null==e||j(e[2],this.view.state.viewingMode);this.shadowsAvailable=this.view.environment.lighting.directShadowsEnabled&&t}get referencePositionGeographic(){return this._referencePositionGeographic}get _canProjectCameraPosition(){const e=this.view?.stateManager?.camera?.position?.spatialReference??w.WGS84,t=b(e);return f(e,t)}connectView(e){this.view=e;const t=()=>this._modifyShadowsAvailable(),s=()=>this._cameraHandler();this.addHandles([i(()=>e.environment.lighting,e=>this._updateLightingHandler(e),n),i(()=>"virtual"!==e.environment.lighting.type?e.environment.lighting.date:null,e=>this._lightingDateHandler(e),n),i(()=>e.environment.lighting.directShadowsEnabled,t,n),i(()=>e.spatialReference,()=>this._resetReferencePosition(!0),n),i(()=>[e.environment.weather.type,this.weatherEnabled],()=>this._updateLighting(null,1),n),i(()=>e.environment,e=>e.setComputeWeatherAvailable(()=>this._weatherAvailable),r),i(()=>e.viewingMode,()=>this._resetReferencePosition(!0),r),i(()=>"virtual"!==e.environment.lighting.type&&e.environment.lighting.cameraTrackingEnabled,e=>this._updateCameraTracking(e),r),i(()=>e.state.camera,s,r),o(()=>this._canProjectCameraPosition,()=>this._resetReferencePosition(!0),n)],this._viewHandlesKey),this._modifyShadowsAvailable(),this._updateLighting(),this._cameraHandler(),this.notifyChange("updating")}disconnectView(){this.removeHandles(this._viewHandlesKey),this._resetReferencePosition()}_updateLightingHandler(e){this._updateCameraTracking("virtual"!==e.type&&e.cameraTrackingEnabled),this._lightingDateHandler("virtual"!==e.type?e.date:null),this._modifyShadowsAvailable()}_updateCameraTracking(e){if(this._trackingEnabled=e,e)this._cameraHandler();else{if(!this.view)return;const e=this.view.environment.lighting;"virtual"!==e?.type&&(e.positionTimezoneInfo.autoUpdated=!1)}}_lightingDateHandler(e){if(!this.view)return;const t=this.view.environment.lighting;if("virtual"!==t?.type){if(e){if(!t.positionTimezoneInfo.autoUpdated&&(this._preupdateTracking(e),null!=this._referencePositionGeographic)){const e=T(this._referencePositionGeographic,this._tmpTz);null!=e&&(t.autoUpdate(null,e),this._trackingEnabled&&(t.positionTimezoneInfo.autoUpdated=!0))}this._updateLighting(e)}}else this._updateLighting()}_preupdateTracking(e){this.view&&!this._trackingEnabled&&"virtual"!==this.view.environment.lighting.type&&this.view.environment.lighting.cameraTrackingEnabled&&this._cameraHandler(e)}_cameraHandler(e=null){const t=this.view;if(!t||!t.ready)return;const i=t.stateManager.camera;if(!i)return;const n=i.position,r=n.spatialReference??w.WGS84,o=b(r);if(!y(n,R,o,M)){if(null==this._referencePositionGeographic)return;return this._referencePositionGeographic=null,void this._updateLighting()}this._referencePositionGeographic?l(this._referencePositionGeographic,R)||(c(this._referencePositionGeographic,R),this.notifyChange("referencePositionGeographic")):this._referencePositionGeographic=p(R),this._autoUpdateTimezone(this._referencePositionGeographic,e)||this._updateLighting(e)}_updateLighting(e,t=0){const i=this.view;if(!i)return;const{lighting:n}=i.environment,r="virtual"===n.type,o=this._referencePositionGeographic,s=null!=o?this._tmpLightParameters:this._defaultLightParameters;if(o){e??=r?null:n.date;const t=this._weatherAvailable?i.environment.weather.type:"disabled";S(e,o,i.state.viewingMode,t,i.state.camera,s)}else r&&G(i.state.camera,i.state.viewingMode,s.direct.directionToLightSource);const a=this._mainLight,h=s.direct;g(a.intensity,h.color,h.intensity*Math.PI),c(a.direction,h.directionToLightSource),a.specularStrength=s.specularStrength,a.environmentStrength=s.environmentStrength;const l=this._ambientLight;g(l.intensity,s.ambient.color,s.ambient.intensity);const p=this._moonLight;d(p.intensity,A,k,s.globalFactor);const m=(1-.5*s.globalFactor)*(1-.4*s.noonFactor*(1-s.globalFactor));g(p.intensity,p.intensity,m),c(p.direction,h.directionToLightSource),i.stage.renderer.updateLighting([a,l,p],s.noonFactor,s.globalFactor,this._weatherAvailable?t:0),this._modifyShadowsAvailable()}_autoUpdateTimezone(e,t=null){if(!this.view||"virtual"===this.view.environment.lighting.type||!this.view.environment.lighting.cameraTrackingEnabled||null==e)return!1;const i=this._tmpDate;i.setTime((t||this.view.environment.lighting.date).getTime());const n=T(e,this._tmpTz);if(null==n)return!1;let r=this.view.environment.lighting.positionTimezoneInfo;if(r.autoUpdated){if(r.hours===n.hours&&r.minutes===n.minutes&&r.seconds===n.seconds)return!1}else r=n;const o=i.getUTCHours()-(n.hours-r.hours),s=i.getUTCMinutes()-(n.minutes-r.minutes),a=i.getUTCSeconds()-(n.seconds-r.seconds);return i.setUTCHours(o),i.setUTCMinutes(s),i.setUTCSeconds(a),!t&&this.view.environment.lighting.autoUpdate(i,n)}_resetReferencePosition(e=!1){this._referencePositionGeographic=null,e&&this._cameraHandler()}get test(){}};e([s()],E.prototype,"view",void 0),e([s({type:Boolean,readOnly:!0})],E.prototype,"updating",null),e([s()],E.prototype,"_disableWeather",void 0),e([s()],E.prototype,"weatherEnabled",null),e([s()],E.prototype,"_weatherAvailable",null),e([s()],E.prototype,"shadowsAvailable",void 0),e([s()],E.prototype,"referencePositionGeographic",null),e([s()],E.prototype,"_referencePositionGeographic",void 0),e([s()],E.prototype,"_canProjectCameraPosition",null),E=e([a("esri.views.3d.environment.EnvironmentManager")],E);const A=u(.22,.22,.33),k=u(.22,.22,.22),R=m(),M={zConversionDisabled:!0};export{E as EnvironmentManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as o,createScreenPointArray as r,screenPointObjectToArray as n,castRenderScreenPointArray as a}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,getTranslation as _,set as u,multiply as g,identity as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as p}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as b,transformMat3 as v,transformMat4 as y,scale as j,copy as L,squaredDistance as S,set as O,subtract as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R,ZEROS as T}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as A}from"../../../geometry/ellipsoidUtils.js";import E from"../../../geometry/Point.js";import{canProjectWithoutEngine as D,projectPoint as F}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as P}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as z}from"../../../geometry/projection/projectors.js";import{containsPointObject as x}from"../../../geometry/support/aaBoundingRect.js";import{distance2 as C,fromPoints as M,closestRayDistance2 as k,create as I}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as U,intersectRay as W,create as B}from"../../../geometry/support/plane.js";import{create as H}from"../../../geometry/support/ray.js";import{sv3d as q}from"../../../geometry/support/vectorStacks.js";import{clonePoint as G,hydratedSpatialReference as V}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationOffset as $}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as J}from"../support/ElevationProvider.js";import{fromScreen as K}from"../support/geometryUtils/ray.js";import N from"../webgl/RenderCamera.js";import{fromValues as Q}from"../webgl-engine/lib/LocalOriginFactory.js";import{Object3D as X}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as Y}from"../webgl-engine/lib/WebGLLayer.js";class Z{constructor(t){this.metadata=void 0,this._camera=new N,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=f(),this._worldFrame=null,this._renderLocation=R(),this._renderLocationDirty=!0,this._location=new E({x:0,y:0,z:0}),this._elevationAlignedLocation=new E,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:r(),renderScreenPointArray:o(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.view.spatialReference,Object.assign(this,t);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=fe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ee(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=f()),te(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){G(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){G(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=V(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ee(this._modelTransform)){const t=this._calculateModelTransformOffset(ge);e=b(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;const i=n(e,ie),s=this._getCollisionRadius(t),o=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(p(this.screenLocation.screenPointArray,i)<s*s)return this.screenLocation.renderScreenPointArray[2]+o;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(t,ae),n=s*this.screenLocation.pixelSize,c=K(this._camera,i,oe);if(null==c)return null;for(const i of e){if(0===i.length)continue;const e=y(le,i[0],r);for(let t=1;t<i.length;t++){const s=y(he,i[t],r),l=k(M(e,s,se),c);if(null!=l&&l<n*n){const t=b(q.get(),e,s);j(t,t,.5);const i=a(q.get());if(this._camera.projectToRenderScreen(t,i))return i[2]+o}L(e,s)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??T,r=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(r,ae),a=s*this.screenLocation.pixelSize,c=K(this._camera,i,oe);if(null==c)return null;const h=l(re,n),d=v(_e,e,h),_=y(ue,t,n);U(_,d,ce);const u=de;if(W(ce,c,u)&&S(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+o;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,r=this._getWorldToScreenObjectScale(),n=this._calculateObjectTransform(r,ae),c=s*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=K(this._camera,i,oe);if(null==h)return null;const d=l(re,n),_=v(_e,t,d),u=this._calculateModelTransformPosition(ue);U(u,_,ce);const g=de;if(!W(ce,h,g))break;for(const i of e){if(0===i.length)continue;const e=y(le,i[0],n);for(let t=1;t<i.length;t++){const s=y(he,i[t],n),r=C(M(e,s,se),g);if(null!=r&&r<c*c){const t=b(q.get(),e,s);j(t,t,.5);const i=a(q.get());if(this._camera.projectToRenderScreen(t,i))return i[2]+o}L(e,s)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new Y(t,{pickable:!1,updatePolicy:1}),i.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),D(this._location.spatialReference,this.view.spatialReference)||(this.location=new E({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,s(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){F(this.location,me,e.spatialReference)&&x(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=$(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case"on-the-ground":e=J(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(J(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(J(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ae;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?2:1)|(this.selected?8:4),o=this._noDisplayCount>0;for(const{stateMask:r,objects:n}of i){if(o){for(const e of n)e.visible=!1;continue}const e=!!!(15&r)||(s&r)===(15&r),i=!!!(65520&r)||(this.state&r)===(65520&r);if(e&&i)for(const s of n)s.visible=!0,this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(s,t):s.transformation=t;else for(const t of n)t.visible=!1}}_updateObjectTransformAndLocalOrigin(e,t){const i=_(ue,t),s=Q(i[0],i[1],i[2],`manipulator-${c()}`);for(const o of e.geometries)o.localOrigin=s;e.transformation=t}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach(({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))});const s=new Map;this._renderObjects.forEach(e=>{const t=new X({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)});const o=[];s.forEach((e,t)=>o.push({stateMask:t,objects:e})),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ne);return O(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return w(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return u(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&g(t,t,this._worldFrame),g(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){}}function ee(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function te(e,t,s){switch(e.viewingMode){case"local":return m(s),!0;case"global":{const o=A(e.renderCoordsHelper.spatialReference);return z(t,0,le,0,o.radius),P(i(le[0]),i(le[1]),s),!0}}}const ie=r(),se=I(),oe=H(),re=h(),ne=f(),ae=f(),ce=B(),le=R(),he=R(),de=R(),_e=R(),ue=R(),ge=R(),me=new E({x:0,y:0,z:0,spatialReference:null}),fe=()=>{};export{Z as Manipulator3D};
|
|
2
|
+
import{EventEmitter as e}from"../../../core/Evented.js";import{makeHandle as t}from"../../../core/handleUtils.js";import"../../../core/has.js";import{deg2rad as i}from"../../../core/mathUtils.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{createRenderScreenPointArray3 as o,createScreenPointArray as n,screenPointObjectToArray as r,castRenderScreenPointArray as a}from"../../../core/screenUtils.js";import{generateUID as c}from"../../../core/uid.js";import{fromMat4 as l}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as d,exactEquals as u,getTranslation as _,set as g,multiply as f,identity as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{squaredDistance as b}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as v,transformMat3 as y,transformMat4 as j,scale as L,copy as S,squaredDistance as O,exactEquals as R,set as T,subtract as w}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as A,ZEROS as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as D}from"../../../geometry/ellipsoidUtils.js";import P from"../../../geometry/Point.js";import{canProjectWithoutEngine as z,projectPoint as x}from"../../../geometry/projectionUtils.js";import{computeENUToPCPFLocalRotation as F}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as C}from"../../../geometry/projection/projectors.js";import{containsPointObject as M}from"../../../geometry/support/aaBoundingRect.js";import{distance2 as k,fromPoints as I,closestRayDistance2 as U,create as W}from"../../../geometry/support/lineSegment.js";import{fromPositionAndNormal as B,intersectRay as H,create as q}from"../../../geometry/support/plane.js";import{create as G}from"../../../geometry/support/ray.js";import{sv3d as V}from"../../../geometry/support/vectorStacks.js";import{clonePoint as $,hydratedSpatialReference as J}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationOffset as K}from"../../../support/elevationInfoUtils.js";import{getElevationAtPoint as N}from"../support/ElevationProvider.js";import{fromScreen as Q}from"../support/geometryUtils/ray.js";import{fromValues as X}from"../webgl-engine/lib/LocalOriginFactory.js";import{Object3D as Y}from"../webgl-engine/lib/Object3D.js";import{WebGLLayer as Z}from"../webgl-engine/lib/WebGLLayer.js";class ee{constructor(t){this.metadata=void 0,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this.usePreciseLocalOrigin=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=p(),this._worldFrame=null,this._renderLocation=A(),this._renderLocationDirty=!0,this._location=new P({x:0,y:0,z:0}),this._elevationAlignedLocation=new P,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=0,this._focused=!1,this.events=new e,this._screenLocation={screenPointArray:n(),renderScreenPointArray:o(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=t.view.spatialReference,Object.assign(this,t)}destroy(){this._applyObjectTransform=pe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null}get _stage(){return this.view?.stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),t(()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()})}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){te(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=p()),ie(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){$(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){$(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=J(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;const e=this.view.state.camera;this._screenLocation.pixelSize=e.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let t;if(te(this._modelTransform)){const e=this._calculateModelTransformOffset(fe);t=v(e,e,this.renderLocation)}else t=this.renderLocation;e.projectToRenderScreen(t,this._screenLocation.renderScreenPointArray),e.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(e,t){if(!this.available)return null;const i=this.view.state.camera,s=r(e,se),o=this._getCollisionRadius(t),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(b(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(t,ce),c=o*this.screenLocation.pixelSize,l=Q(i,s,ne);if(null==l)return null;for(const s of e){if(0===s.length)continue;const e=j(he,s[0],r);for(let t=1;t<s.length;t++){const o=j(de,s[t],r),h=U(I(e,o,oe),l);if(null!=h&&h<c*c){const t=v(V.get(),e,o);L(t,t,.5);const s=a(V.get());if(i.projectToRenderScreen(t,s))return s[2]+n}S(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??E,r=this._getWorldToScreenObjectScale(),a=this._calculateObjectTransform(r,ce),c=o*this.screenLocation.pixelSize,h=Q(i,s,ne);if(null==h)return null;const d=l(re,a),u=y(_e,e,d),_=j(ge,t,a);B(_,u,le);const g=ue;if(H(le,h,g)&&O(g,_)<c*c)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,r=this._getWorldToScreenObjectScale(),c=this._calculateObjectTransform(r,ce),h=o*i.computeScreenPixelSizeAt(this.renderLocation),d=Q(i,s,ne);if(null==d)return null;const u=l(re,c),_=y(_e,t,u),g=this._calculateModelTransformPosition(ge);B(g,_,le);const f=ue;if(!H(le,d,f))break;for(const s of e){if(0===s.length)continue;const e=j(he,s[0],c);for(let t=1;t<s.length;t++){const o=j(de,s[t],c),r=k(I(e,o,oe),f);if(null!=r&&r<h*h){const t=v(V.get(),e,o);L(t,t,.5);const s=a(V.get());if(i.projectToRenderScreen(t,s))return s[2]+n}S(e,o)}}break}default:this.collisionType}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new Z(t,{pickable:!1,updatePolicy:1}),i.engineLayerId=this._engineLayer.id):t?.getLayer&&(this._engineLayer=t.getLayer(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._attached=!0,this._updateEngineObject(),z(this._location.spatialReference,this.view.spatialReference)||(this.location=new P({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,s(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._attached=!1}onViewChange(){this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){x(this.location,me,e.spatialReference)&&M(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=K(this.elevationInfo,this.location.spatialReference??this.view.elevationProvider.spatialReference);switch(this.elevationInfo.mode){case"on-the-ground":e=N(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(N(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(N(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ce;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?2:1)|(this.selected?8:4),o=this._noDisplayCount>0;for(const{stateMask:n,objects:r}of i){if(o){for(const e of r)e.visible=!1;continue}const e=!!!(15&n)||(s&n)===(15&n),i=!!!(65520&n)||(this.state&n)===(65520&n);if(e&&i)for(const s of r)s.visible=!0,this.usePreciseLocalOrigin?this._updateObjectTransformAndLocalOrigin(s,t):u(s.transformation,t)||(s.transformation=t);else for(const t of r)t.visible=!1}}_updateObjectTransformAndLocalOrigin(e,t){const i=_(ge,t),s=e.geometries.every(({localOrigin:e})=>null!=e&&R(e.vec3,i));if(s&&u(e.transformation,t))return;const o=X(i[0],i[1],i[2],`manipulator-${c()}`);for(const n of e.geometries)n.localOrigin=o;e.transformation=t}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach(({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))});const s=new Map;this._renderObjects.forEach(e=>{const t=new Y({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)});const o=[];s.forEach((e,t)=>o.push({stateMask:t,objects:e})),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.addMany(e)),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i}=this._engineResources;t.forEach(({objects:e})=>i.removeMany(e)),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae);return T(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return w(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return g(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&f(t,t,this._worldFrame),f(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){}}function te(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function ie(e,t,s){switch(e.viewingMode){case"local":return m(s),!0;case"global":{const o=D(e.renderCoordsHelper.spatialReference);return C(t,0,he,0,o.radius),F(i(he[0]),i(he[1]),s),!0}}}const se=n(),oe=W(),ne=G(),re=h(),ae=p(),ce=p(),le=q(),he=A(),de=A(),ue=A(),_e=A(),ge=A(),fe=A(),me=new P({x:0,y:0,z:0,spatialReference:null}),pe=()=>{};export{ee as Manipulator3D};
|