@arcgis/core 5.2.0-next.114 → 5.2.0-next.115

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.
Files changed (85) hide show
  1. package/Graphic.d.ts +5 -3
  2. package/applications/Urban/LineImagePattern3D.js +1 -1
  3. package/arcgisGlobal.d.ts +1 -0
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/02f94f9d704f03ddb5c6.js +1 -0
  6. package/assets/esri/core/workers/chunks/{c517e732cab41093b2e0.js → 0312c40d94b248ad71e3.js} +1 -1
  7. package/assets/esri/core/workers/chunks/0463c807b37f01bbc35c.js +1 -0
  8. package/assets/esri/core/workers/chunks/0ff13f7a18b0123d253e.js +1 -0
  9. package/assets/esri/core/workers/chunks/2e0fd0536408053ac6f5.js +1 -0
  10. package/assets/esri/core/workers/chunks/{6b264006b96cbf93d8ed.js → 48d3da636be15581fd7d.js} +1 -1
  11. package/assets/esri/core/workers/chunks/515fe302743c0b46f7e0.js +1 -0
  12. package/assets/esri/core/workers/chunks/{982a396bd4fffa62e911.js → 526cc64ae46dec3fbeda.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{d13cf2e8b24e978ea77c.js → 7243d5721bb6a7329055.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{785206da3962ba23de16.js → 84b89c523d3e16a5ee46.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{484b3e2a220c440ccbb4.js → 9b92c41907e2da80c288.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{4d2553219ffd223b0e90.js → a774006be107e449bc29.js} +1 -1
  17. package/assets/esri/core/workers/chunks/b45ebb1b64ee7314375e.js +1 -0
  18. package/assets/esri/core/workers/chunks/{e0f417992889a6c41095.js → baa8bce361a2677533ec.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{96ebf76661b12128ddd5.js → be4de7111bc21bc69de1.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{e164acd876bbd42ed658.js → f18ee2eaa96d103627a6.js} +1 -1
  21. package/chunks/RibbonLine.glsl.js +63 -58
  22. package/config.js +1 -1
  23. package/core/screenUtils.js +1 -1
  24. package/core/units.js +1 -1
  25. package/graphic/getGraphicOriginTitle.d.ts +10 -0
  26. package/graphic/getGraphicOriginTitle.js +2 -0
  27. package/kernel.js +1 -1
  28. package/layers/MapNotesLayer.js +1 -1
  29. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  30. package/layers/support/Field.js +1 -1
  31. package/layers/support/TimeSeriesInfo.d.ts +1 -1
  32. package/layers/support/featurePopupQueryUtils.js +1 -1
  33. package/layers/support/timeSeriesUtils.js +1 -1
  34. package/layers/support/types.d.ts +1 -1
  35. package/layers/types.d.ts +1 -2
  36. package/package.json +2 -2
  37. package/portal/schemas/definitions.js +1 -1
  38. package/rest/support/OutDistance.d.ts +19 -18
  39. package/rest/support/Query.d.ts +48 -18
  40. package/smartMapping/renderers/support/utils.js +1 -1
  41. package/support/revision.js +1 -1
  42. package/symbols/patterns/LinePattern3D.js +1 -1
  43. package/symbols/patterns/LineStylePattern3D.js +1 -1
  44. package/symbols/patterns/LineTemplatePattern3D.js +1 -1
  45. package/symbols/patterns/utils.js +1 -1
  46. package/views/2d/engine/webgl/util/DimensionMatcher.js +1 -1
  47. package/views/2d/layers/graphics/GraphicStore.js +1 -1
  48. package/views/2d/layers/support/annodime/DimensionInfo.js +1 -1
  49. package/views/2d/support/clippingUtils.js +1 -1
  50. package/views/2d/support/hitTestUtils.js +1 -1
  51. package/views/3d/support/buffer/InterleavedLayout.js +1 -1
  52. package/views/3d/webgl-engine/lib/AttributeView.js +2 -0
  53. package/views/3d/webgl-engine/lib/attributeViewUtils.js +2 -0
  54. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  55. package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
  56. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  57. package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
  58. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  59. package/views/PopupView.d.ts +64 -2
  60. package/views/View2D.js +1 -1
  61. package/views/layers/FeatureLikeLayerView.js +1 -1
  62. package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
  63. package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
  64. package/widgets/BasemapLayerList.js +1 -1
  65. package/widgets/CatalogLayerList/CatalogLayerListViewModel.d.ts +2 -1
  66. package/widgets/CatalogLayerList/CatalogLayerListViewModel.js +1 -1
  67. package/widgets/CatalogLayerList/CatalogLayerListVisibleElements.d.ts +5 -1
  68. package/widgets/CatalogLayerList/types.d.ts +12 -1
  69. package/widgets/CatalogLayerList.d.ts +2 -1
  70. package/widgets/CatalogLayerList.js +1 -1
  71. package/widgets/LayerList.js +1 -1
  72. package/widgets/TableList/ListItem.d.ts +2 -0
  73. package/widgets/TableList/ListItemPanel.d.ts +4 -0
  74. package/widgets/TableList/TableListViewModel.d.ts +4 -0
  75. package/widgets/TableList/TableListViewModel.js +1 -1
  76. package/widgets/TableList/TableListVisibleElements.d.ts +6 -1
  77. package/widgets/TableList/types.d.ts +12 -1
  78. package/widgets/TableList.d.ts +3 -0
  79. package/widgets/TableList.js +1 -1
  80. package/assets/esri/core/workers/chunks/078ed48eb055dd213ee6.js +0 -1
  81. package/assets/esri/core/workers/chunks/1004e77593dfa506cd5d.js +0 -1
  82. package/assets/esri/core/workers/chunks/510a190a6f0a60ae38c3.js +0 -1
  83. package/assets/esri/core/workers/chunks/cd0f5cd0fefe7f49e3d8.js +0 -1
  84. package/assets/esri/core/workers/chunks/e6fb7b93cf73b05b1079.js +0 -1
  85. package/assets/esri/core/workers/chunks/f86ea5cf4814b458d50b.js +0 -1
@@ -7,14 +7,11 @@ import type { PointProperties } from "../../geometry/Point.js";
7
7
  import type { MultipointProperties } from "../../geometry/Multipoint.js";
8
8
  import type { ExtentProperties } from "../../geometry/Extent.js";
9
9
 
10
- /**
11
- * @internal
12
- * @since 5.1
13
- */
10
+ /** @since 5.2 */
14
11
  export interface OutDistanceProperties extends Partial<Pick<OutDistance, "order" | "outDistanceUnit" | "returnDistance">> {
15
12
  /**
16
- * Geometry used as the distance origin; distances are measured from each feature
17
- * to the referenceGeometry. If omitted, the query geometry is used.
13
+ * Geometry used as the reference for measuring distance. Distances are measured from each feature to this geometry.
14
+ * If not specified, distances are measured from the [Query.geometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#geometry).
18
15
  *
19
16
  * @since 5.2
20
17
  */
@@ -23,12 +20,12 @@ export interface OutDistanceProperties extends Partial<Pick<OutDistance, "order"
23
20
 
24
21
  /**
25
22
  * Defines the [outDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outDistance) parameter on a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) and specifies whether to return the distance
26
- * of each feature from the input geometry's buffer in a query result. It also optionally controls the sort order of results based on distances of features
27
- * from the input geometry's buffer.
28
- * Distance values are returned only when the following conditions are met:
29
- * - The [Query.distance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#distance) is greater than 0
30
- * - [Query.units](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#units) is specified
31
- * - [Query.outDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outDistance) is specified and its [OutDistance.returnDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#returnDistance) property is `true`
23
+ * of each feature in the query result. It can also specify the [order](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#order) in which features are returned based on distance.
24
+ * Distance values are returned only when the `outDistance` is specified and its [OutDistance.returnDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#returnDistance) property is `true`.
25
+ * The distance values are included in the [Graphic.distance](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#distance) property of each feature.
26
+ *
27
+ * Distance values are measured from [referenceGeometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#referenceGeometry) when specified; otherwise, they are measured
28
+ * from [Query.geometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#geometry).
32
29
  *
33
30
  * > [!WARNING]
34
31
  * >
@@ -37,29 +34,33 @@ export interface OutDistanceProperties extends Partial<Pick<OutDistance, "order"
37
34
  * > Supported only on a service-backed [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where the [supportsOutDistance](https://developers.arcgis.com/javascript/latest/references/core/layers/types/#QueryCapabilities) capability
38
35
  * > is `true`.
39
36
  *
40
- * @internal
41
- * @since 5.1
37
+ * @since 5.2
38
+ * @see [Query.outDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outDistance)
39
+ * @see [Graphic.distance](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#distance)
42
40
  */
43
41
  export default class OutDistance extends OutDistanceSuperclass {
44
42
  constructor(properties?: OutDistanceProperties);
45
43
  /**
46
44
  * Indicates whether to return features sorted by distance.
47
- * "ascending" returns the nearest features first while "descending" returns farthest
45
+ * The `"ascending"` option returns the nearest features first while the `"descending"` option returns farthest
48
46
  * features first, and null indicates there should be no distance-based ordering.
47
+ * A `null` value indicates that there should be no distance-based ordering.
49
48
  *
50
49
  * @since 5.2
51
50
  */
52
51
  order?: "ascending" | "descending" | null;
53
52
  /**
54
- * The distance unit of the returned distance values. This property is only applicable when
53
+ * The distance unit used for the returned distance values. This property applies only when
55
54
  * [returnDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#returnDistance) is `true`.
55
+ * If omitted, the unit is determined from the [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference).
56
+ * If no output spatial reference is specified, the service's spatial reference unit is used.
56
57
  *
57
58
  * @since 5.2
58
59
  */
59
60
  outDistanceUnit?: "feet" | "miles" | "nautical-miles" | "us-nautical-miles" | "meters" | "kilometers" | null;
60
61
  /**
61
- * Geometry used as the distance origin; distances are measured from each feature
62
- * to the referenceGeometry. If omitted, the query geometry is used.
62
+ * Geometry used as the reference for measuring distance. Distances are measured from each feature to this geometry.
63
+ * If not specified, distances are measured from the [Query.geometry](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#geometry).
63
64
  *
64
65
  * @since 5.2
65
66
  */
@@ -39,12 +39,27 @@ export interface QueryProperties extends Partial<Pick<Query, "aggregateIds" | "c
39
39
  */
40
40
  historicMoment?: (Date | number | string) | null;
41
41
  /**
42
- * Specifies whether to return the distance of each feature from the input geometry's buffer in a query result. It also optionally controls the sort
43
- * order of results based on distances of features from the input geometry's buffer.
44
- * Distance values are returned only when the following conditions are met:
45
- * - The [Query.distance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#distance) is greater than 0
46
- * - [Query.units](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#units) is specified
47
- * - The `outDistance` is specified and its [OutDistance.returnDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#returnDistance) property is `true`
42
+ * Specifies whether to return the distance of each feature in the query result. It can also specify the order in which features are
43
+ * returned based on distance. Distance values are returned only when the `outDistance` is specified and its
44
+ * [OutDistance.returnDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#returnDistance) property is `true`. The distance values are included
45
+ * in the [Graphic.distance](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#distance) property of each feature.
46
+ *
47
+ * @example
48
+ * ```js
49
+ * // Find hotels within 10 miles of the airport and order them by
50
+ * // their distance from the convention center.
51
+ * const query = new Query({
52
+ * geometry: airportLocation,
53
+ * distance: 10,
54
+ * units: "miles",
55
+ * outDistance: new OutDistance({
56
+ * returnDistance: true,
57
+ * order: "ascending",
58
+ * referenceGeometry: conventionCenterLocation,
59
+ * outDistanceUnit: "miles"
60
+ * })
61
+ * });
62
+ * ```
48
63
  *
49
64
  * > [!WARNING]
50
65
  * >
@@ -52,9 +67,9 @@ export interface QueryProperties extends Partial<Pick<Query, "aggregateIds" | "c
52
67
  * >
53
68
  * > Supported only on a service-backed [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where the [supportsOutDistance](https://developers.arcgis.com/javascript/latest/references/core/layers/types/#QueryCapabilities) capability
54
69
  * > is `true`.
55
- *
56
- * @internal
57
- * @since 5.1
70
+ * @since 5.2
71
+ * @see [OutDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/)
72
+ * @see [Graphic.distance](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#distance)
58
73
  */
59
74
  outDistance?: OutDistanceProperties | null;
60
75
  /**
@@ -608,12 +623,27 @@ export default class Query extends JSONSupport {
608
623
  */
609
624
  accessor orderByFields: string[] | null | undefined;
610
625
  /**
611
- * Specifies whether to return the distance of each feature from the input geometry's buffer in a query result. It also optionally controls the sort
612
- * order of results based on distances of features from the input geometry's buffer.
613
- * Distance values are returned only when the following conditions are met:
614
- * - The [Query.distance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#distance) is greater than 0
615
- * - [Query.units](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#units) is specified
616
- * - The `outDistance` is specified and its [OutDistance.returnDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#returnDistance) property is `true`
626
+ * Specifies whether to return the distance of each feature in the query result. It can also specify the order in which features are
627
+ * returned based on distance. Distance values are returned only when the `outDistance` is specified and its
628
+ * [OutDistance.returnDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/#returnDistance) property is `true`. The distance values are included
629
+ * in the [Graphic.distance](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#distance) property of each feature.
630
+ *
631
+ * @example
632
+ * ```js
633
+ * // Find hotels within 10 miles of the airport and order them by
634
+ * // their distance from the convention center.
635
+ * const query = new Query({
636
+ * geometry: airportLocation,
637
+ * distance: 10,
638
+ * units: "miles",
639
+ * outDistance: new OutDistance({
640
+ * returnDistance: true,
641
+ * order: "ascending",
642
+ * referenceGeometry: conventionCenterLocation,
643
+ * outDistanceUnit: "miles"
644
+ * })
645
+ * });
646
+ * ```
617
647
  *
618
648
  * > [!WARNING]
619
649
  * >
@@ -621,9 +651,9 @@ export default class Query extends JSONSupport {
621
651
  * >
622
652
  * > Supported only on a service-backed [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/) where the [supportsOutDistance](https://developers.arcgis.com/javascript/latest/references/core/layers/types/#QueryCapabilities) capability
623
653
  * > is `true`.
624
- *
625
- * @internal
626
- * @since 5.1
654
+ * @since 5.2
655
+ * @see [OutDistance](https://developers.arcgis.com/javascript/latest/references/core/rest/support/OutDistance/)
656
+ * @see [Graphic.distance](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#distance)
627
657
  */
628
658
  get outDistance(): OutDistance | null | undefined;
629
659
  set outDistance(value: OutDistanceProperties | null | undefined);
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../Color.js";import{fetchMessageBundle as t,substitute as n}from"../../../intl.js";import o from"../../../core/Collection.js";import i from"../../../core/Error.js";import{formatDate as r,convertDateFormatToIntlOptions as l}from"../../../intl/date.js";import{round as s}from"../../../renderers/support/numberUtils.js";import a from"../../../renderers/support/pointCloud/PointSizeSplatAlgorithm.js";import m from"../../heuristics/outline.js";import u from"../../statistics/classBreaks.js";import c from"../../statistics/summaryStatistics.js";import{getAgeExpressions as f}from"../../statistics/support/ageUtils.js";import{isAnyDateField as d,getBasemapId as p,defaultBasemapGroups as y,getBasemapGroup as w,defaultStatisticTypes as h}from"../../support/utils.js";import b from"../../../symbols/ExtrudeSymbol3DLayer.js";import g from"../../../symbols/FillSymbol3DLayer.js";import D from"../../../symbols/IconSymbol3DLayer.js";import j from"../../../symbols/LineSymbol3D.js";import S from"../../../symbols/LineSymbol3DLayer.js";import v from"../../../symbols/MeshSymbol3D.js";import x from"../../../symbols/ObjectSymbol3DLayer.js";import z from"../../../symbols/PathSymbol3DLayer.js";import T from"../../../symbols/PointSymbol3D.js";import U from"../../../symbols/PolygonSymbol3D.js";import L from"../../../symbols/SimpleFillSymbol.js";import V from"../../../symbols/SimpleLineSymbol.js";import k from"../../../symbols/SimpleMarkerSymbol.js";import F from"../../../symbols/edges/SketchEdges3D.js";import I from"../../../symbols/edges/SolidEdges3D.js";import{getTimeZoneFormattingOptions as M,shortTimeZoneName as C}from"../../../time/timeZoneUtils.js";import{getBackgroundColorTheme as Z}from"../../../views/support/colorUtils.js";const B=/^(\d+(\.\d+)?)\s*(%)$/i,E=new e([0,0,0,.4]),P=new Set(["hours","minutes","seconds"]),A=[...y.light,...y.dark];function R(e,t,n,o){if("string"==typeof e){const t=n.getField(e);if(t&&d(t))return t.alias||t.name}else if("number"==typeof e||e instanceof Date){const i=null!=t&&P.has(t),s=l(i?"short-date-short-time":"short-date");if(o&&i){const t=n.layer,{timeZone:i}=M("preferredTimeZone"in t?t.preferredTimeZone:null,"datesInUnknownTimezone"in t&&t.datesInUnknownTimezone,o.timeZone,s,"date");return r(e,{...s,timeZone:i,timeZoneName:C})}return r(e,s)}return e}function Y(e,t,n){return e+t>0&&0>e-t&&n<0?0:e}function N(e,t,n,o){const{avg:i,stddev:r,min:l,max:s}=e,a=W(e,!!n,o??!0);let m=a?a[0]:l,u=a?a[1]:s;return a?{minDataValue:m,maxDataValue:u,defaultValuesUsed:!0}:("above"===t?m=Y(i,r,l):"below"===t&&(u=Y(i,r,l)),{minDataValue:m,maxDataValue:u,defaultValuesUsed:!1})}function W(e,t,n){let o,i;const r=$({statistics:e,isDate:t});return r.defaultValuesUsed?(o=r.min,i=r.max):!n||null!=e.avg&&e.stddev||(o=e.min,i=e.max),null!=o&&null!=i?[o,i]:null}function $(e){let t,n,o=e&&e.statistics;if(o||(o={}),null==o.min)if(e.isDate){const e=q();t=e[0],n=e[1]}else t=0,n=100;else if(o.min===o.max)if(e.isDate){const e=q(o.min);t=e[0],n=e[1]}else o.min<0?(t=2*o.min,n=0):o.min>0?(t=0,n=2*o.min):(t=0,n=100);return{min:null!=t?t:o.min,max:null!=n?n:o.max,defaultValuesUsed:null!=t||null!=n}}function q(e){const t=("number"==typeof e?new Date(e):new Date).getUTCFullYear();let n=Date.UTC(t,0,1,12,0,0,0),o=Date.UTC(t,11,31,12,0,0,0);return"number"==typeof e&&(e<n&&(n=e),e>o&&(o=e)),[n,o]}function O({minDataValue:e,maxDataValue:t,defaultValuesUsed:n},o,i,r=!0){return n||"above"===i||"below"===i?H(e,t,5):J(o,r)}function _(e,t){const{avg:n,stddev:o}=e,i=e.min,r=e.max;if(null==n||null==o){const[n,o]=W(e,t,!0);return H(n,o,5)}const l=Y(n,o,i),a=r-l,m=l-i,u=Math.max(a,m);return s([l-u,l-u/2,l,u/2+l,l+u],{strictBounds:!0})}function G(e,t){const{min:n,max:o}=t,[i,r,l,a,m]=e,u=null!=n&&i<n,c=null!=o&&m>o;if(null==n||null==o||!u&&!c)return e;const f=u?n:i,d=c?o:m;return s([f,u?f+(l-f)/2:r,l,c?l+(d-l)/2:a,d],{strictBounds:!0})}function H(e,t,n){const o=(t-e)/(n-1),i=[e];for(let r=1;r<=n-2;r++)i.push(e+r*o);return i.push(t),s(i,{strictBounds:!0})}function J({min:e,max:t,avg:n,stddev:o},i=!0){if(null==e||null==t||null==n||null==o)return[];let r=n-o,l=n+o;r<e&&(r=e),l>t&&(l=t),i&&(n=r+(l-r)/2);let a=s([r,l],{strictBounds:!0});return r=a[0],l=a[1],a=[r,r+(n-r)/2,n,n+(l-n)/2,l],s(a,{strictBounds:!0})}function K(e,t,n){switch(t){case"point":case"multipoint":return n?"noDataSize"in e?e.noDataSize:null:"size"in e?e.size:null;case"polyline":return n?"noDataWidth"in e?e.noDataWidth:null:"width"in e?e.width:null;case"polygon":return"size"in e?e.size:null;default:return}}function Q(e,t,n){switch(t){case"point":case"multipoint":case"polygon":{if(!("outline"in e))return null;const t={color:e.outline.color,width:e.outline.width};if(null!=n&&t.color){const e=t.color.clone();e.a=n,t.color=e}return t}default:return}}function X(e,t){const{type:n,size:i,color:r,outline:l}=t;let s;switch(e){case"point":case"multipoint":if("2d"===n)s=new k({color:r,size:i,outline:{color:l.color,width:l.width}});else if("3d-flat"===n)s=new T({symbolLayers:new o([new D({size:i,resource:{primitive:"circle"},material:{color:r},outline:{color:l.color,size:l.width}})])});else if(n?.includes("3d-volumetric")){const e="3d-volumetric-uniform"===n,l=new x({height:i,resource:{primitive:e?"sphere":"cylinder"},material:{color:r}});e||(l.width=t.widthAndDepth,l.depth=t.widthAndDepth),s=new T({symbolLayers:new o([l])})}break;case"polyline":"2d"===n?s=new V({color:r,width:i}):"3d-flat"===n?s=new j({symbolLayers:new o([new S({size:i,material:{color:r}})])}):"3d-volumetric"===n&&(s=new j({symbolLayers:new o([new z({width:"number"==typeof i?i:parseFloat(i),height:"number"==typeof i?i:parseFloat(i),material:{color:r}})])}));break;case"polygon":"2d"===n?s=new L({color:r,outline:{color:l.color,width:l.width}}):"3d-flat"===n?s=new U({symbolLayers:new o([new g({material:{color:r},outline:{color:l.color,size:l.width}})])}):"3d-volumetric"===n&&(s=new U({symbolLayers:new o([new b({size:i,material:{color:r}})])}));break;case"mesh":{const e=t.meshInfo?.colorMixMode,n=t.meshInfo?.edgesType;s=new v({symbolLayers:new o([new g({material:{color:r,colorMixMode:e||null},edges:"solid"===n?new I({color:E}):"sketch"===n?new F({color:E}):null})])});break}}return s}function ee(e,t,n){const o=te({layer:e,fields:t});if(o.length)return new i(n,"Unknown fields: "+o.join(", ")+". You can only use fields defined in the layer schema");const r=ne({layer:e,fields:t});return r.length?new i(n,"Unsupported fields: "+r.join(", ")+". You can only use fields that are accessible to the renderer i.e. FieldUsageInfo.supportsRenderer must be true"):void 0}function te(e){const t=e.layer;return e.fields.filter(e=>!t.getField(e))}function ne(e){const t=e.layer;return e.fields.filter(e=>{const n=t.getFieldUsageInfo(e);return!n||!n.supportsRenderer})}async function oe(e,t){const n={layer:e.layer,view:e.view,filter:e.filter,signal:e.signal},[o,i]=await Promise.all([u(e).catch(ue),t?m(n).catch(ue):null]),r=W({min:o?.minValue,max:o?.maxValue,avg:null,stddev:null},!1,!1);return{result:r?await u({...e,classificationMethod:"equal-interval",numClasses:1,analyzeData:!1,minValue:r[0],maxValue:r[1],normalizationTotal:r[0]+r[1]}):o,defaultValuesUsed:!!r,outlineResult:i}}function ie(e){return c({outStatisticTypes:h,...e})}function re(e,t){let{minSize:n,maxSize:o}=e;if("height"===t){n=((o-n)/2+n)/(2*2.3),o*=2}return{minSize:n,maxSize:o}}function le(e){return B.test(e)}function se(e){if(null==e)return;const t=e.match(B),n=Number(t[1]);return"%"===t[3]?new a({scaleFactor:n/100}):void 0}function ae(e,t,n,o){e.startTime=t instanceof Date?t.getTime():t,e.endTime=n instanceof Date?n.getTime():n,e.units=o,e.field="string"==typeof t?t:"string"==typeof n?n:null}async function me(e,t){let n=null,o=null;if(!e&&!t)return{basemapId:n,basemapTheme:o};if(t&&(o=await Z(t),e||(e=t.map?.basemap)),e&&(n=p(e,A,!1),n&&!o)){const e=w(n);null!=e&&(o=e)}return!n&&o&&(n="dark"===o?"dark-gray":"gray"),{basemapId:n,basemapTheme:o}}function ue(e){const t=e.name?.toLowerCase();if(!t||t?.includes(":insufficient-info")||t?.includes(":insufficient-data"))return null;throw e}async function ce(e,o){const{layer:i,startTime:r,endTime:l,view:s}=e,a=f({layer:i,startTime:r,endTime:l,unit:o}).valueExpression,m=await t("esri/smartMapping/t9n/smartMapping");return{valueExpression:a,title:n(m[`ageInfo_${o}`],{unit:o,startTime:R(r,o,i,s),endTime:R(l,o,i,s)})}}export{G as clampAboveAndBelowStopValues,O as createDataValues,H as createDefaultStopValues,J as createStopValues,_ as createStopValuesForAboveBelow,X as createSymbol,ue as errorCallback,R as formatDate,Y as getBaseValueForAboveBelow,me as getBasemapInfo,oe as getClassBreaks,N as getDataRange,W as getDefaultDataRange,se as getPointSizeAlgorithm,re as getSizeRangeForAxis,ie as getSummaryStatistics,Q as getSymbolOutlineFromScheme,K as getSymbolSizeFromScheme,ce as getTitleAndExpressionForAgeRenderer,le as isValidPointSize,ae as updateAgeRendererAuthoringInfoVV,ee as verifyBasicFieldValidity};
2
+ import e from"../../../Color.js";import{fetchMessageBundle as t,substitute as n}from"../../../intl.js";import o from"../../../core/Collection.js";import i from"../../../core/Error.js";import{formatDate as r,convertDateFormatToIntlOptions as l}from"../../../intl/date.js";import{round as s}from"../../../renderers/support/numberUtils.js";import a from"../../../renderers/support/pointCloud/PointSizeSplatAlgorithm.js";import m from"../../heuristics/outline.js";import u from"../../statistics/classBreaks.js";import c from"../../statistics/summaryStatistics.js";import{getAgeExpressions as f}from"../../statistics/support/ageUtils.js";import{isAnyDateField as d,getBasemapId as p,defaultBasemapGroups as y,getBasemapGroup as w,getNormalizationType as h,defaultStatisticTypes as b}from"../../support/utils.js";import g from"../../../symbols/ExtrudeSymbol3DLayer.js";import D from"../../../symbols/FillSymbol3DLayer.js";import j from"../../../symbols/IconSymbol3DLayer.js";import S from"../../../symbols/LineSymbol3D.js";import v from"../../../symbols/LineSymbol3DLayer.js";import x from"../../../symbols/MeshSymbol3D.js";import z from"../../../symbols/ObjectSymbol3DLayer.js";import T from"../../../symbols/PathSymbol3DLayer.js";import U from"../../../symbols/PointSymbol3D.js";import L from"../../../symbols/PolygonSymbol3D.js";import V from"../../../symbols/SimpleFillSymbol.js";import k from"../../../symbols/SimpleLineSymbol.js";import F from"../../../symbols/SimpleMarkerSymbol.js";import I from"../../../symbols/edges/SketchEdges3D.js";import M from"../../../symbols/edges/SolidEdges3D.js";import{getTimeZoneFormattingOptions as C,shortTimeZoneName as Z}from"../../../time/timeZoneUtils.js";import{getBackgroundColorTheme as B}from"../../../views/support/colorUtils.js";const E=/^(\d+(\.\d+)?)\s*(%)$/i,P=new e([0,0,0,.4]),A=new Set(["hours","minutes","seconds"]),R=[...y.light,...y.dark];function Y(e,t,n,o){if("string"==typeof e){const t=n.getField(e);if(t&&d(t))return t.alias||t.name}else if("number"==typeof e||e instanceof Date){const i=null!=t&&A.has(t),s=l(i?"short-date-short-time":"short-date");if(o&&i){const t=n.layer,{timeZone:i}=C("preferredTimeZone"in t?t.preferredTimeZone:null,"datesInUnknownTimezone"in t&&t.datesInUnknownTimezone,o.timeZone,s,"date");return r(e,{...s,timeZone:i,timeZoneName:Z})}return r(e,s)}return e}function N(e,t,n){return e+t>0&&0>e-t&&n<0?0:e}function W(e,t,n,o){const{avg:i,stddev:r,min:l,max:s}=e,a=$(e,!!n,o??!0);let m=a?a[0]:l,u=a?a[1]:s;return a?{minDataValue:m,maxDataValue:u,defaultValuesUsed:!0}:("above"===t?m=N(i,r,l):"below"===t&&(u=N(i,r,l)),{minDataValue:m,maxDataValue:u,defaultValuesUsed:!1})}function $(e,t,n){let o,i;const r=q({statistics:e,isDate:t});return r.defaultValuesUsed?(o=r.min,i=r.max):!n||null!=e.avg&&e.stddev||(o=e.min,i=e.max),null!=o&&null!=i?[o,i]:null}function q(e){let t,n,o=e&&e.statistics;if(o||(o={}),null==o.min)if(e.isDate){const e=O();t=e[0],n=e[1]}else t=0,n=100;else if(o.min===o.max)if(e.isDate){const e=O(o.min);t=e[0],n=e[1]}else o.min<0?(t=2*o.min,n=0):o.min>0?(t=0,n=2*o.min):(t=0,n=100);return{min:null!=t?t:o.min,max:null!=n?n:o.max,defaultValuesUsed:null!=t||null!=n}}function O(e){const t=("number"==typeof e?new Date(e):new Date).getUTCFullYear();let n=Date.UTC(t,0,1,12,0,0,0),o=Date.UTC(t,11,31,12,0,0,0);return"number"==typeof e&&(e<n&&(n=e),e>o&&(o=e)),[n,o]}function _({minDataValue:e,maxDataValue:t,defaultValuesUsed:n},o,i,r=!0){return n||"above"===i||"below"===i?J(e,t,5):K(o,r)}function G(e,t){const{avg:n,stddev:o}=e,i=e.min,r=e.max;if(null==n||null==o){const[n,o]=$(e,t,!0);return J(n,o,5)}const l=N(n,o,i),a=r-l,m=l-i,u=Math.max(a,m);return s([l-u,l-u/2,l,u/2+l,l+u],{strictBounds:!0})}function H(e,t){const{min:n,max:o}=t,[i,r,l,a,m]=e,u=null!=n&&i<n,c=null!=o&&m>o;if(null==n||null==o||!u&&!c)return e;const f=u?n:i,d=c?o:m;return s([f,u?f+(l-f)/2:r,l,c?l+(d-l)/2:a,d],{strictBounds:!0})}function J(e,t,n){const o=(t-e)/(n-1),i=[e];for(let r=1;r<=n-2;r++)i.push(e+r*o);return i.push(t),s(i,{strictBounds:!0})}function K({min:e,max:t,avg:n,stddev:o},i=!0){if(null==e||null==t||null==n||null==o)return[];let r=n-o,l=n+o;r<e&&(r=e),l>t&&(l=t),i&&(n=r+(l-r)/2);let a=s([r,l],{strictBounds:!0});return r=a[0],l=a[1],a=[r,r+(n-r)/2,n,n+(l-n)/2,l],s(a,{strictBounds:!0})}function Q(e,t,n){switch(t){case"point":case"multipoint":return n?"noDataSize"in e?e.noDataSize:null:"size"in e?e.size:null;case"polyline":return n?"noDataWidth"in e?e.noDataWidth:null:"width"in e?e.width:null;case"polygon":return"size"in e?e.size:null;default:return}}function X(e,t,n){switch(t){case"point":case"multipoint":case"polygon":{if(!("outline"in e))return null;const t={color:e.outline.color,width:e.outline.width};if(null!=n&&t.color){const e=t.color.clone();e.a=n,t.color=e}return t}default:return}}function ee(e,t){const{type:n,size:i,color:r,outline:l}=t;let s;switch(e){case"point":case"multipoint":if("2d"===n)s=new F({color:r,size:i,outline:{color:l.color,width:l.width}});else if("3d-flat"===n)s=new U({symbolLayers:new o([new j({size:i,resource:{primitive:"circle"},material:{color:r},outline:{color:l.color,size:l.width}})])});else if(n?.includes("3d-volumetric")){const e="3d-volumetric-uniform"===n,l=new z({height:i,resource:{primitive:e?"sphere":"cylinder"},material:{color:r}});e||(l.width=t.widthAndDepth,l.depth=t.widthAndDepth),s=new U({symbolLayers:new o([l])})}break;case"polyline":"2d"===n?s=new k({color:r,width:i}):"3d-flat"===n?s=new S({symbolLayers:new o([new v({size:i,material:{color:r}})])}):"3d-volumetric"===n&&(s=new S({symbolLayers:new o([new T({width:"number"==typeof i?i:parseFloat(i),height:"number"==typeof i?i:parseFloat(i),material:{color:r}})])}));break;case"polygon":"2d"===n?s=new V({color:r,outline:{color:l.color,width:l.width}}):"3d-flat"===n?s=new L({symbolLayers:new o([new D({material:{color:r},outline:{color:l.color,size:l.width}})])}):"3d-volumetric"===n&&(s=new L({symbolLayers:new o([new g({size:i,material:{color:r}})])}));break;case"mesh":{const e=t.meshInfo?.colorMixMode,n=t.meshInfo?.edgesType;s=new x({symbolLayers:new o([new D({material:{color:r,colorMixMode:e||null},edges:"solid"===n?new M({color:P}):"sketch"===n?new I({color:P}):null})])});break}}return s}function te(e,t,n){const o=ne({layer:e,fields:t});if(o.length)return new i(n,"Unknown fields: "+o.join(", ")+". You can only use fields defined in the layer schema");const r=oe({layer:e,fields:t});return r.length?new i(n,"Unsupported fields: "+r.join(", ")+". You can only use fields that are accessible to the renderer i.e. FieldUsageInfo.supportsRenderer must be true"):void 0}function ne(e){const t=e.layer;return e.fields.filter(e=>!t.getField(e))}function oe(e){const t=e.layer;return e.fields.filter(e=>{const n=t.getFieldUsageInfo(e);return!n||!n.supportsRenderer})}async function ie(e,t){const n={layer:e.layer,view:e.view,filter:e.filter,signal:e.signal},[o,i]=await Promise.all([u(e).catch(ce),t?m(n).catch(ce):null]),r=$({min:o?.minValue,max:o?.maxValue,avg:null,stddev:null},!1,!1),l=h(e);return{result:r?await u({...e,normalizationType:l,classificationMethod:"equal-interval",numClasses:1,analyzeData:!1,minValue:r[0],maxValue:r[1],normalizationTotal:"percent-of-total"===l?e.normalizationTotal??r[0]+r[1]:void 0}):o,defaultValuesUsed:!!r,outlineResult:i}}function re(e){return c({outStatisticTypes:b,...e})}function le(e,t){let{minSize:n,maxSize:o}=e;if("height"===t){n=((o-n)/2+n)/(2*2.3),o*=2}return{minSize:n,maxSize:o}}function se(e){return E.test(e)}function ae(e){if(null==e)return;const t=e.match(E),n=Number(t[1]);return"%"===t[3]?new a({scaleFactor:n/100}):void 0}function me(e,t,n,o){e.startTime=t instanceof Date?t.getTime():t,e.endTime=n instanceof Date?n.getTime():n,e.units=o,e.field="string"==typeof t?t:"string"==typeof n?n:null}async function ue(e,t){let n=null,o=null;if(!e&&!t)return{basemapId:n,basemapTheme:o};if(t&&(o=await B(t),e||(e=t.map?.basemap)),e&&(n=p(e,R,!1),n&&!o)){const e=w(n);null!=e&&(o=e)}return!n&&o&&(n="dark"===o?"dark-gray":"gray"),{basemapId:n,basemapTheme:o}}function ce(e){const t=e.name?.toLowerCase();if(!t||t?.includes(":insufficient-info")||t?.includes(":insufficient-data"))return null;throw e}async function fe(e,o){const{layer:i,startTime:r,endTime:l,view:s}=e,a=f({layer:i,startTime:r,endTime:l,unit:o}).valueExpression,m=await t("esri/smartMapping/t9n/smartMapping");return{valueExpression:a,title:n(m[`ageInfo_${o}`],{unit:o,startTime:Y(r,o,i,s),endTime:Y(l,o,i,s)})}}export{H as clampAboveAndBelowStopValues,_ as createDataValues,J as createDefaultStopValues,K as createStopValues,G as createStopValuesForAboveBelow,ee as createSymbol,ce as errorCallback,Y as formatDate,N as getBaseValueForAboveBelow,ue as getBasemapInfo,ie as getClassBreaks,W as getDataRange,$ as getDefaultDataRange,ae as getPointSizeAlgorithm,le as getSizeRangeForAxis,re as getSummaryStatistics,X as getSymbolOutlineFromScheme,Q as getSymbolSizeFromScheme,fe as getTitleAndExpressionForAgeRenderer,se as isValidPointSize,me as updateAgeRendererAuthoringInfoVV,te as verifyBasicFieldValidity};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const c="20260917",b="1aa1293cf91e731cdb058c9b99fcddd0033810bb";export{c as buildDate,b as revision};
2
+ const a="20260918",c="e24c3d27d1f54209f4a92566c14af7742b9e7a5a";export{a as buildDate,c as revision};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as r}from"tslib";import{ClonableMixin as e}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as t,subclass as s}from"../../core/accessorSupport/decorators.js";let p=class extends(e(o)){constructor(r){super(r)}};r([t({type:["style","template","image"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0}}})],p.prototype,"type",void 0),p=r([s("esri.symbols.patterns.LinePattern3D")],p);export{p as default};
2
+ import{__decorate as r}from"tslib";import{ClonableMixin as e}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as t,subclass as s}from"../../core/accessorSupport/decorators.js";let p=class extends(e(o)){constructor(r){super(r)}};r([t({type:["style","template","image"],readOnly:!0,json:{read:!0,write:{ignoreOrigin:!0,isRequired:!0}}})],p.prototype,"type",void 0),p=r([s("esri.symbols.patterns.LinePattern3D")],p);export{p as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{strict as t}from"../../core/jsonMap.js";import{property as s,subclass as r}from"../../core/accessorSupport/decorators.js";import d from"./LinePattern3D.js";import{lineStyles as e}from"./lineStyles.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";const h=t()({dash:"dash","dash-dot":"dash-dot","dash-dot-dot":"long-dash-dot-dot",dot:"dot","long-dash":"long-dash","long-dash-dot":"long-dash-dot",null:"none","short-dash":"short-dash","short-dash-dot":"short-dash-dot","short-dash-dot-dot":"short-dash-dot-dot","short-dot":"short-dot",solid:"solid"});let i=class extends d{constructor(o){super(o),this.type="style",this.style="solid"}};o([s({type:["style"],json:{write:{isRequired:!0}}})],i.prototype,"type",void 0),o([a(h),s({type:e,json:{write:{isRequired:!0}}})],i.prototype,"style",void 0),i=o([r("esri.symbols.patterns.LineStylePattern3D")],i);export{i as default};
2
+ import{__decorate as o}from"tslib";import{strict as t}from"../../core/jsonMap.js";import{property as s,subclass as d}from"../../core/accessorSupport/decorators.js";import r from"./LinePattern3D.js";import{lineStyles as e}from"./lineStyles.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";const h=t()({dash:"dash","dash-dot":"dash-dot","dash-dot-dot":"long-dash-dot-dot",dot:"dot","long-dash":"long-dash","long-dash-dot":"long-dash-dot",null:"none","short-dash":"short-dash","short-dash-dot":"short-dash-dot","short-dash-dot-dot":"short-dash-dot-dot","short-dot":"short-dot",solid:"solid"});let i=class extends r{constructor(o){super(o),this.type="style",this.style="solid"}};o([s({type:["style"]})],i.prototype,"type",void 0),o([a(h),s({type:e,json:{write:{isRequired:!0}}})],i.prototype,"style",void 0),i=o([d("esri.symbols.patterns.LineStylePattern3D")],i);export{i as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../core/accessorSupport/decorators.js";import{normalizeDashPatternTemplate as a}from"../cim/dashUtils.js";import o from"./LinePattern3D.js";let p=class extends o{constructor(e){super(e),this.type="template",this.dashTemplate=[]}get normalizedDashTemplate(){const{dashTemplate:e,hidesLine:t}=a(this.dashTemplate);return{dashTemplate:e.map(e=>Math.abs(e)),hidesLine:t}}};e([t({type:["template"]})],p.prototype,"type",void 0),e([t({type:[Number],nonNullable:!0})],p.prototype,"dashTemplate",void 0),e([t()],p.prototype,"normalizedDashTemplate",null),p=e([s("esri.symbols.patterns.LineTemplatePattern3D")],p);const r=p;export{r as default};
2
+ import{__decorate as e}from"tslib";import{property as t,subclass as s}from"../../core/accessorSupport/decorators.js";import{normalizeDashPatternTemplate as a}from"../cim/dashUtils.js";import o from"./LinePattern3D.js";let r=class extends o{constructor(e){super(e),this.type="template",this.dashTemplate=[]}get normalizedDashTemplate(){const{dashTemplate:e,hidesLine:t}=a(this.dashTemplate);return{dashTemplate:e.map(e=>Math.abs(e)),hidesLine:t}}};e([t({type:["template"]})],r.prototype,"type",void 0),e([t({type:[Number],nonNullable:!0,json:{write:{isRequired:!0}}})],r.prototype,"dashTemplate",void 0),e([t()],r.prototype,"normalizedDashTemplate",null),r=e([s("esri.symbols.patterns.LineTemplatePattern3D")],r);const p=r;export{p as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"./LinePattern3D.js";import t from"./LineStylePattern3D.js";import p from"./LineTemplatePattern3D.js";import r from"./Pattern3D.js";import y from"./StylePattern3D.js";const s={key:"type",base:e,typeMap:{style:t}},o={types:{key:"type",base:r,typeMap:{style:y}},json:{write:!0}},a={types:{key:"type",base:e,typeMap:{style:t,template:p}},json:{types:s,write:{overridePolicy:e=>({enabled:"template"!==e?.type})}}},i={types:s,json:{write:!0}};export{a as symbol3dLinePatternProperty,i as symbol3dOutlineLinePatternProperty,o as symbol3dPatternProperty};
2
+ import t from"./LinePattern3D.js";import e from"./LineStylePattern3D.js";import p from"./LineTemplatePattern3D.js";import r from"./Pattern3D.js";import s from"./StylePattern3D.js";const y={types:{key:"type",base:r,typeMap:{style:s}},json:{write:!0}},o={types:{key:"type",base:t,typeMap:{style:e,template:p}},json:{write:!0}},a={types:{key:"type",base:t,typeMap:{style:e}},json:{write:!0}};export{o as symbol3dLinePatternProperty,a as symbol3dOutlineLinePatternProperty,y as symbol3dPatternProperty};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../../core/has.js";import{OverrideHelper as e}from"../../../../../symbols/cim/OverrideHelper.js";import{hasRichTextFormattingTags as t}from"../../../../../symbols/cim/richTextUtils.js";import{FeatureMatcher as r}from"./Matcher.js";import{createDebugWriters as s}from"../../../layers/support/annodime/debugUtils.js";import i from"../../../layers/support/annodime/DimensionInfo.js";import{dimensionSymbols as o}from"../../../layers/support/annodime/dimensionSymbols.js";import{getFontForCIMTextSymbol as n}from"../../../layers/support/annodime/dimensionUtils.js";import{createDimensionMatcherFeatureInfo as m,mixFeature as a}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as c}from"../../../layers/support/annodime/TileObjectId.js";class h extends r{constructor(e,t){super(),this._context=e,this._schema=t,this._meshWriters=new Map,this._dimensionInfos=new Map,this._matcherGeometryOverrides=new Map}static async fromDimensionSchema(e,t){return new h(e,t)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(c(r,e.getObjectId()))}async fetchResources(e,t,r,i){this._meshWriters.clear(),this._dimensionInfos.clear(),this._matcherGeometryOverrides.clear();const o=t.metadata.outSpatialReference,n=t.getCursor();for(;n.next();){const r=m(n);if(!r)continue;const h=a(n,r);if(!h)continue;const l=c(i,n.getObjectId()),y=this._readStyleId(n),p=this._getStyle(y);if(!p){let r=this._meshWriters.get(l);r||(r=await s(this._context,e,t.geometryType),this._meshWriters.set(l,r));continue}const d=await this._createDimensionInfo(p,h,o);await this._cacheGlyphs(d,h,e),this._dimensionInfos.set(l,d),this._matcherGeometryOverrides.set(l,r.geometryOverride);let u=this._meshWriters.get(l);u||(u=await this._createGroup(p,n,h,e,t.geometryType),this._meshWriters.set(l,u))}}async _createDimensionInfo(e,t,r){return await i.create(e,t,r)}async _createGroup(e,t,r,i,n){const m=o.processDimensionStyle(e),[a,c,h,l,y]=await Promise.all([this._createMeshesForSymbol(m.beginDimensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.endDimensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.beginExtensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.endExtensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.textSymbol,m.primitiveOverrides,t,r,i)]),p=await this._context.createMeshWriters([...a,...c,...h,...l,...y]);if(has("esri-2d-annotation-dimension-debug")){const e=await s(this._context,i,n);return e.length?[...p,...e]:p}return p}async _createMeshesForSymbol(t,r,s,i,o){if(!t)return[];const n=await e.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:r,symbol:t},i,s.metadata.outSpatialReference,null,s.geometryType);if(!n)return[];const m=await o.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:{type:"CIMSymbolReference",symbol:n}});return m?.meshes??[]}_readStyleId(e){return parseInt(`${e.readAttribute("STYLEID")}`,10)}_getStyle(e){return this._schema.styleCollection.find(t=>(t.iD??0)===e)}async _cacheGlyphs(e,r,s){const i=e.getTextString(r);if(!i)return;const o=await s.fetchResourceImmediate({type:"cim-rasterization-info",resource:{type:"text",textString:i||"",font:n(e.textSymbol),symbol:e.textSymbol,supportsRichText:t(i)}});"glyphs"!==o?.type&&"rich-glyphs"!==o?.type||e.setTextResource(o)}cleanup(e,t,r){const s=t.getObjectId(),i=c(r,s);this._meshWriters.delete(i),this._dimensionInfos.delete(i),this._matcherGeometryOverrides.delete(i)}getAnalyzedGraphic(e){return this._dimensionInfos.get(e)||null}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}export{h as DimensionMatcher};
2
+ import has from"../../../../../core/has.js";import{OverrideHelper as e}from"../../../../../symbols/cim/OverrideHelper.js";import{hasRichTextFormattingTags as t}from"../../../../../symbols/cim/richTextUtils.js";import{FeatureMatcher as r}from"./Matcher.js";import{createDebugWriters as s}from"../../../layers/support/annodime/debugUtils.js";import i from"../../../layers/support/annodime/DimensionInfo.js";import{dimensionSymbols as o}from"../../../layers/support/annodime/dimensionSymbols.js";import{getFontForCIMTextSymbol as n}from"../../../layers/support/annodime/dimensionUtils.js";import{createDimensionMatcherFeatureInfo as m,mixFeature as a}from"../../../layers/support/annodime/MatcherGeometryOverride.js";import{createTileObjectId as c}from"../../../layers/support/annodime/TileObjectId.js";class h extends r{constructor(e,t){super(),this._context=e,this._schema=t,this._meshWriters=new Map,this._dimensionInfos=new Map,this._matcherGeometryOverrides=new Map}static async fromDimensionSchema(e,t){return new h(e,t)}hasArcadeDependency(){return!1}doMatch(e,t,r){return this._meshWriters.get(c(r,e.getObjectId()))}async fetchResources(e,t,r,o){this._meshWriters.clear(),this._dimensionInfos.clear(),this._matcherGeometryOverrides.clear();const n=t.metadata.outSpatialReference,h=t.metadata.attributeSpatialReference??t.metadata.spatialReference??n,l=t.getCursor();for(;l.next();){const r=m(l);if(!r)continue;const y=a(l,r);if(!y)continue;const p=c(o,l.getObjectId()),d=this._readStyleId(l),u=this._getStyle(d);if(!u){let r=this._meshWriters.get(p);r||(r=await s(this._context,e,t.geometryType),this._meshWriters.set(p,r));continue}const f=await i.create(u,y,n,h);await this._cacheGlyphs(f,y,e),this._dimensionInfos.set(p,f),this._matcherGeometryOverrides.set(p,r.geometryOverride);let _=this._meshWriters.get(p);_||(_=await this._createGroup(u,l,y,e,t.geometryType),this._meshWriters.set(p,_))}}async _createGroup(e,t,r,i,n){const m=o.processDimensionStyle(e),[a,c,h,l,y]=await Promise.all([this._createMeshesForSymbol(m.beginDimensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.endDimensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.beginExtensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.endExtensionLineSymbol,m.primitiveOverrides,t,r,i),this._createMeshesForSymbol(m.textSymbol,m.primitiveOverrides,t,r,i)]),p=await this._context.createMeshWriters([...a,...c,...h,...l,...y]);if(has("esri-2d-annotation-dimension-debug")){const e=await s(this._context,i,n);return e.length?[...p,...e]:p}return p}async _createMeshesForSymbol(t,r,s,i,o){if(!t)return[];const n=await e.resolveSymbolOverrides({type:"CIMSymbolReference",primitiveOverrides:r,symbol:t},i,s.metadata.outSpatialReference,null,s.geometryType);if(!n)return[];const m=await o.fetchMeshResourceImmediate({type:"mesh-request",symbolReference:{type:"CIMSymbolReference",symbol:n}});return m?.meshes??[]}_readStyleId(e){return parseInt(`${e.readAttribute("STYLEID")}`,10)}_getStyle(e){return this._schema.styleCollection.find(t=>(t.iD??0)===e)}async _cacheGlyphs(e,r,s){const i=e.getTextString(r);if(!i)return;const o=await s.fetchResourceImmediate({type:"cim-rasterization-info",resource:{type:"text",textString:i||"",font:n(e.textSymbol),symbol:e.textSymbol,supportsRichText:t(i)}});"glyphs"!==o?.type&&"rich-glyphs"!==o?.type||e.setTextResource(o)}cleanup(e,t,r){const s=t.getObjectId(),i=c(r,s);this._meshWriters.delete(i),this._dimensionInfos.delete(i),this._matcherGeometryOverrides.delete(i)}getAnalyzedGraphic(e){return this._dimensionInfos.get(e)||null}getMatcherGeometryOverride(e){return this._matcherGeometryOverrides.get(e)??null}}export{h as DimensionMatcher};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{r as e}from"../../../../chunks/rbush.js";import s from"../../../../geometry/Point.js";import{create as i,intersects as o,copy as n}from"../../../../geometry/support/aaBoundingRect.js";import{normalizeMapX as r}from"../../../../geometry/support/normalizeUtils.js";import{getInfo as m}from"../../../../geometry/support/spatialReferenceUtils.js";import{HittestDrawHelper as a}from"../../../../symbols/cim/CIMSymbolDrawHelper.js";import{CIMSymbolInflatedSizeHelper as l}from"../../../../symbols/cim/CIMSymbolHelper.js";import{hittestToleranceSmallSymbol as h,hittestToleranceMobile as c,hittestToleranceDesktop as u}from"../../engine/webgl/definitions.js";import{GraphicStoreItem as p}from"./GraphicStoreItem.js";import{pixelBuffer as d}from"./graphicsUtils.js";import{GraphicUpdateMessage as f}from"./GraphicUpdateMessage.js";import{getMapPointsFromScreen as y,createHittestQuery as _}from"../../support/hitTestUtils.js";const b=1e-5;function I(t,e){return e.zOrder-t.zOrder}class g{constructor(t,e,s,i,o){this._items=new Map,this._boundsDirty=!1,this._outSpatialReference=t,this._cimResourceManager=e,this._hittestDrawHelper=new a(e),this._tileInfoView=s,this._store=o;const n=s.getClosestInfoForScale(i);this._resolution=this._tileInfoView.getTileResolution(n.level)}destroy(){this._hittestDrawHelper.destroy()}items(){return this._items.values()}getItem(t){return this._items.get(t)}async update(t,e,s){const i=[],o=[],n=[],r=new Set,m=[];let a=0;const l=new Set;for(const h of t.items){const t=h.uid;if(l.has(t))continue;l.add(t),a++;const n=this._items.get(t),c=e(h);if(r.add(t),n){const t=n.update(h,c,a),e=n.updateDensificationResolution(this._resolution);t&&m.push(this._updateItem(n,s)),(t||e)&&o.push(n);continue}const u=this._store.createDisplayIdForObjectId(t),d=p.fromGraphic(h,c,a,u);d.updateDensificationResolution(this._resolution),m.push(this._updateItem(d,s)),this._items.set(d.objectId,d),i.push(d)}for(const[h,c]of this._items.entries())r.has(h)||(this._store.releaseDisplayIdForObjectId(h),this._items.delete(h),n.push(c));return await Promise.all(m),this._index=null,new f(i,o,n)}updateLevel(t){if(this._resolution===t)return!1;this._index=null,this._boundsDirty=!0,this._resolution=t;for(const e of this.items())if(e.hasCurvedGeoemtry)return!0;return!1}hitTest(t,e,n,m){const a=i();let l=i();const p=_(e,null);if(!p)return console.warn("Unexpected hittest input:",e),[];let f=0,b=y(t,p.input);if(b=b.map(t=>new s(r(t.x,this._tileInfoView.spatialReference),t.y,this._tileInfoView.spatialReference)),"rect"===p.hittestType||"polygon"===p.hittestType){const t=Math.min(...b.map(t=>t.x)),e=Math.min(...b.map(t=>t.y)),s=Math.max(...b.map(t=>t.x)),i=Math.max(...b.map(t=>t.y));a[0]=t,a[1]=e,a[2]=s,a[3]=i,l=a}else if("point"===p.hittestType){const t=has("esri-mobile"),e=t?c:u,s=e+(t?0:h),o=b[0].x,r=b[0].y,m=n*window.devicePixelRatio*s;a[0]=o-m,a[1]=r-m,a[2]=o+m,a[3]=r+m;const p=n*window.devicePixelRatio*e,y=i();y[0]=o-p,y[1]=r-p,y[2]=o+p,y[3]=r+p;const _=.5*n*(s+d);l[0]=o-_,l[1]=r-_,l[2]=o+_,l[3]=r+_,f=y[2]-y[0]}const g=this._searchIndex(l[0],l[1],l[2],l[3]);if(!g||0===g.length)return[];const x=[],w=i(),j=i();for(const s of g){if(!s.visible)continue;const{geometryBounds:t,symbolResource:e}=s;this._getSymbolBounds(w,e,t,j,m),j[3]=j[2]=j[1]=j[0]=0,o(w,a)&&x.push(s)}if(0===x.length)return[];const R=this._hittestDrawHelper,S=[];for(const s of x){const{projectedGeometry:t,symbolResource:e}=s;if(!e)continue;const{textInfo:i,symbolInfo:o}=e,r=o.cimSymbol,a=o.linearCIM.some(t=>"alignment"in t&&0===t.alignment),l={hittestType:p.hittestType,textInfo:i,mapRotation:m,resolution:n,searchDist:f,isScreenAligned:a};R.hitTest(b,r.symbol,t,l)&&S.push(s)}return S.sort(I),S.map(t=>t.objectId)}queryItems(t){return 0===this._items.size?[]:this._searchForItems(t)}clear(){this._items.clear(),this._index=null}async _updateItem(t,e){await t.projectAndNormalize(this._outSpatialReference),await e(t);const{size:s}=t;s[0]=s[1]=s[2]=s[3]=0,this._getSymbolBounds(t.symbolBounds,t.symbolResource,t.geometryBounds,t.size,0)}_searchIndex(t,s,i,o){return this._boundsDirty&&(this._items.forEach(t=>this._getSymbolBounds(t.symbolBounds,t.symbolResource,t.geometryBounds,t.size,0)),this._boundsDirty=!1),this._index||(this._index=e(9,t=>({minX:t.symbolBounds[0],minY:t.symbolBounds[1],maxX:t.symbolBounds[2],maxY:t.symbolBounds[3]})),this._index.load(Array.from(this._items.values()))),this._index.search({minX:t,minY:s,maxX:i,maxY:o})}_searchForItems(t){const e=this._tileInfoView.spatialReference,s=t.bounds,o=m(e);if(o&&e.isWrappable){const[e,n]=o.valid,r=Math.abs(s[2]-n)<b,m=Math.abs(s[0]-e)<b;if((!r||!m)&&(r||m)){const o=t.resolution;let m;m=i(r?[e,s[1],e+o*d,s[3]]:[n-o*d,s[1],n,s[3]]);const a=this._searchIndex(s[0],s[1],s[2],s[3]),l=this._searchIndex(m[0],m[1],m[2],m[3]);return[...new Set([...a,...l])]}}return this._searchIndex(s[0],s[1],s[2],s[3])}_getSymbolBounds(e,s,o,r,m){if(!s||!s.symbolInfo.linearCIM)return null;if(e||(e=i()),n(e,o),!r||0===r[0]&&0===r[1]&&0===r[2]&&0===r[3]){const{textInfo:e,symbolInfo:i}=s,o=i.cimSymbol;r||(r=[0,0,0,0]);const n=l.getSymbolInflateSize(r,o.symbol,this._cimResourceManager,m,e);r[0]=t(n[0]),r[1]=t(n[1]),r[2]=t(n[2]),r[3]=t(n[3])}const a=this._resolution,h=l.safeSize(r);return e[0]-=h*a,e[1]-=h*a,e[2]+=h*a,e[3]+=h*a,e}}export{g as default};
2
+ import has from"../../../../core/has.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{r as e}from"../../../../chunks/rbush.js";import s from"../../../../geometry/Point.js";import{create as i,fromValues as o,intersects as n,copy as r}from"../../../../geometry/support/aaBoundingRect.js";import{normalizeMapX as m}from"../../../../geometry/support/normalizeUtils.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";import{HittestDrawHelper as a}from"../../../../symbols/cim/CIMSymbolDrawHelper.js";import{CIMSymbolInflatedSizeHelper as h}from"../../../../symbols/cim/CIMSymbolHelper.js";import{hittestToleranceSmallSymbol as c,hittestToleranceMobile as u,hittestToleranceDesktop as p}from"../../engine/webgl/definitions.js";import{GraphicStoreItem as d}from"./GraphicStoreItem.js";import{pixelBuffer as f}from"./graphicsUtils.js";import{GraphicUpdateMessage as y}from"./GraphicUpdateMessage.js";import{getMapPointsFromScreen as _,getBbox as b,createHittestQuery as I}from"../../support/hitTestUtils.js";const g=1e-5;function x(t,e){return e.zOrder-t.zOrder}class w{constructor(t,e,s,i,o){this._items=new Map,this._boundsDirty=!1,this._outSpatialReference=t,this._cimResourceManager=e,this._hittestDrawHelper=new a(e),this._tileInfoView=s,this._store=o;const n=s.getClosestInfoForScale(i);this._resolution=this._tileInfoView.getTileResolution(n.level)}destroy(){this._hittestDrawHelper.destroy()}items(){return this._items.values()}getItem(t){return this._items.get(t)}async update(t,e,s){const i=[],o=[],n=[],r=new Set,m=[];let l=0;const a=new Set;for(const h of t.items){const t=h.uid;if(a.has(t))continue;a.add(t),l++;const n=this._items.get(t),c=e(h);if(r.add(t),n){const t=n.update(h,c,l),e=n.updateDensificationResolution(this._resolution);t&&m.push(this._updateItem(n,s)),(t||e)&&o.push(n);continue}const u=this._store.createDisplayIdForObjectId(t),p=d.fromGraphic(h,c,l,u);p.updateDensificationResolution(this._resolution),m.push(this._updateItem(p,s)),this._items.set(p.objectId,p),i.push(p)}for(const[h,c]of this._items.entries())r.has(h)||(this._store.releaseDisplayIdForObjectId(h),this._items.delete(h),n.push(c));return await Promise.all(m),this._index=null,new y(i,o,n)}updateLevel(t){if(this._resolution===t)return!1;this._index=null,this._boundsDirty=!0,this._resolution=t;for(const e of this.items())if(e.hasCurvedGeoemtry)return!0;return!1}hitTest(t,e,r,l){let a=i(),h=i();const d=I(e,null);if(!d)return console.warn("Unexpected hittest input:",e),[];let y=0,g=_(t,d.input);if(g=g.map(t=>new s(m(t.x,this._tileInfoView.spatialReference),t.y,this._tileInfoView.spatialReference)),"rect"===d.hittestType||"polygon"===d.hittestType){const{xmin:t,ymin:e,xmax:s,ymax:i}=b([g.map(t=>[t.x,t.y])]);a=o(t,e,s,i),h=a}else if("point"===d.hittestType){const t=has("esri-mobile"),e=t?u:p,s=e+(t?0:c),i=g[0].x,n=g[0].y,m=r*window.devicePixelRatio*s;a=o(i-m,n-m,i+m,n+m);const l=r*window.devicePixelRatio*e,d=o(i-l,n-l,i+l,n+l),_=.5*r*(s+f);h=o(i-_,n-_,i+_,n+_),y=d[2]-d[0]}const w=this._searchIndex(h[0],h[1],h[2],h[3]);if(!w||0===w.length)return[];const j=[],R=i(),S=i();for(const s of w){if(!s.visible)continue;const{geometryBounds:t,symbolResource:e}=s;this._getSymbolBounds(R,e,t,S,l),S[3]=S[2]=S[1]=S[0]=0,n(R,a)&&j.push(s)}if(0===j.length)return[];const B=this._hittestDrawHelper,D=[];for(const s of j){const{projectedGeometry:t,symbolResource:e}=s;if(!e)continue;const{textInfo:i,symbolInfo:o}=e,n=o.cimSymbol,m=o.linearCIM.some(t=>"alignment"in t&&0===t.alignment),a={hittestType:d.hittestType,textInfo:i,mapRotation:l,resolution:r,searchDist:y,isScreenAligned:m};B.hitTest(g,n.symbol,t,a)&&D.push(s)}return D.sort(x),D.map(t=>t.objectId)}queryItems(t){return 0===this._items.size?[]:this._searchForItems(t)}clear(){this._items.clear(),this._index=null}async _updateItem(t,e){await t.projectAndNormalize(this._outSpatialReference),await e(t);const{size:s}=t;s[0]=s[1]=s[2]=s[3]=0,this._getSymbolBounds(t.symbolBounds,t.symbolResource,t.geometryBounds,t.size,0)}_searchIndex(t,s,i,o){return this._boundsDirty&&(this._items.forEach(t=>this._getSymbolBounds(t.symbolBounds,t.symbolResource,t.geometryBounds,t.size,0)),this._boundsDirty=!1),this._index||(this._index=e(9,t=>({minX:t.symbolBounds[0],minY:t.symbolBounds[1],maxX:t.symbolBounds[2],maxY:t.symbolBounds[3]})),this._index.load(Array.from(this._items.values()))),this._index.search({minX:t,minY:s,maxX:i,maxY:o})}_searchForItems(t){const e=this._tileInfoView.spatialReference,s=t.bounds,o=l(e);if(o&&e.isWrappable){const[e,n]=o.valid,r=Math.abs(s[2]-n)<g,m=Math.abs(s[0]-e)<g;if((!r||!m)&&(r||m)){const o=t.resolution;let m;m=i(r?[e,s[1],e+o*f,s[3]]:[n-o*f,s[1],n,s[3]]);const l=this._searchIndex(s[0],s[1],s[2],s[3]),a=this._searchIndex(m[0],m[1],m[2],m[3]);return[...new Set([...l,...a])]}}return this._searchIndex(s[0],s[1],s[2],s[3])}_getSymbolBounds(e,s,o,n,m){if(!s||!s.symbolInfo.linearCIM)return null;if(e||(e=i()),r(e,o),!n||0===n[0]&&0===n[1]&&0===n[2]&&0===n[3]){const{textInfo:e,symbolInfo:i}=s,o=i.cimSymbol;n||(n=[0,0,0,0]);const r=h.getSymbolInflateSize(n,o.symbol,this._cimResourceManager,m,e);n[0]=t(r[0]),n[1]=t(r[1]),n[2]=t(r[2]),n[3]=t(r[3])}const l=this._resolution,a=h.safeSize(n);return e[0]-=a*l,e[1]-=a*l,e[2]+=a*l,e[3]+=a*l,e}}export{w as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"../../../../../core/Error.js";import n from"../../../../../core/Logger.js";import{convertUnit as e,unitFromUnitWkid as t,getUnitString as s}from"../../../../../core/units.js";import{dist as o,set as h,subtract as r,len as l,scale as m,equals as _}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as d,create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as g}from"../../../../../geometry/support/jsonTypeUtils.js";import u from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as x}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as c,fromCIMVerticalAlignment as P,fromCIMFontDecoration as p}from"../../../../../symbols/cim/utils.js";import b from"../../../arcade/callExpressionWithFeature.js";import{magicLabelLineHeight as f}from"../../../engine/webgl/definitions.js";import y from"../../../engine/webgl/Rect.js";import{shapeTextResource as D}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as L,getLineWidth as S}from"../../graphics/graphicsUtils.js";import{initializeDimensionStyleDefaults as M}from"./dimensionStyleDefaults.js";import{normalizeExtensionAngle as T,DimensionRealFieldName as w,queryPointOnLine as k,angleFromXAxis as E,capDimensionExtensionAngle as R,intersectLinesByPointsAndAngles as A,projectLinearDimensionPoints as v,measureMarkerSymbolSize as F,translateRect as N,scaleRect as B,rotatePoint as j,rectsOverlap as I,rectsOverlapOnAxis as O}from"./dimensionUtils.js";import{getAttributeValue as z}from"./utils.js";class U{static async create(i,n,e){const t=new U(i,e);return await t.initialize(n,e),t}constructor(i,n){if(this._dimensionStyle=i,this._spatialReference=n,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._textLength=null,this._extAngleRad=Math.PI/2,this._dimensionType=0,this._compiledExpression=null,this._fieldsIndex=null,this._textResource=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerLength=0,this._endMarkerLength=0,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!");M(i)}async initialize(e,t){if(!this._dimensionStyle)return;const{attributes:s}=e;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:s,expressionParserName:o}=this._dimensionStyle;s&&o&&"arcade"===o.toLowerCase()?(this._compiledExpression=await x(s,t),this._fieldsIndex=X(e)):n.getLogger("esri.layers.DimensionFeatureLayer").warn(new i("dimension-layer:unsupported-expression","Only Arcade expressions are supported",{expressionType:o,expression:s}))}this._extAngleRad=T(z(w.extAngle,s)),this._dimensionType=1===Number(z(w.dimType,s))?1:0,this._systemLength=Number(z("__SYSTEM_LENGTH__",s));const{geometry:o}=e;if(o&&!g(o))throw new i("dimension-layer","processed geometry must be a valid 'polygon'.");const h=o?.rings[0];if(!h||h.length<3)throw new i("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=null!=h[3]&&0!==h[3][0]&&0!==h[3][1]&&void 0!==h[3][0]&&void 0!==h[3][1],this._hasTextPoint&&(this._textPoint=h[3]);const r=this._dimensionStyle.textSymbol;s.__DIMENSION_ANGLE__+=r?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}setTextResource(i){this._textResource=i??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,n){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,n),this._evaluateDefaultPlacement(n),this._updateExtensionLines(n),this._updateTextPoint(n),this._offsetTextPoint(n),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:n}=this._dimensionStyle;if(!this._doMarkersFit){if("None"===n||null==this._textLength)return;if(this._textLength>this._dimensionLength){const i=this._textLength/2;"MoveBegin"===n?(this._textPoint=k(this._beginDimensionPoint,this._endDimensionPoint,-(i+this._beginMarkerLength/2)),this._extendDimensionLineForMovedText("begin",this._beginMarkerLength/2+this._textLength)):"MoveEnd"===n&&(this._textPoint=k(this._endDimensionPoint,this._beginDimensionPoint,-(i+this._endMarkerLength/2)),this._extendDimensionLineForMovedText("end",this._endMarkerLength/2+this._textLength))}}}_extendDimensionLineForMovedText(i,n){if(this._dimensionPolyline?.length)if("begin"===i){const i=k(this._beginDimensionPoint,this._endDimensionPoint,-n);this._dimensionPolyline[0]=[i,this._beginDimensionPoint]}else{const i=k(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+n);this._dimensionPolyline[1]=[i,this._endDimensionPoint]}}_offsetTextPoint(i){if(this._hasTextPoint)return;const n=this._textPoint;if(!n)return;const e=.5*this._textSize*i,t=-e*this._dimensionDirection[1],s=e*this._dimensionDirection[0];n[0]+=t,n[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:n,extensionLineOffset:e}=this._dimensionStyle;let t=this._dimensionLinePoint,s=this._endDimensionPoint;null==n||isNaN(n)||0===n||(t=k(this._dimensionLinePoint,this._beginBaselinePoint,-n*i),s=k(this._endDimensionPoint,this._endBaselinePoint,-n*i));let h=this._beginBaselinePoint,r=this._endBaselinePoint;if(null!=e&&!isNaN(e)&&0!==e){const i=o(t,this._beginBaselinePoint),n=o(s,this._endBaselinePoint);h=k(t,this._beginBaselinePoint,i-e),r=k(s,this._endBaselinePoint,n-e)}this._dimensionExtensionLines=[[t,h],[s,r]]}_computeDimensionLineInfo(n,e){if(!n||!g(n)||n.rings[0].length<3)throw new i("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const t=n.rings[0],s=d(t[0][0],t[0][1]),o=d(t[1][0],t[1][1]),_=d(t[2][0],t[2][1]);this._beginBaselinePoint=h(a(),s[0],s[1]),this._endBaselinePoint=h(a(),o[0],o[1]),this._dimensionLinePoint=_,1===this._dimensionType?this._computeLinearDimensionPoints(s,o,_):this._computeAlignedDimensionPoints(s,o,_);const u=this._beginDimensionPoint,x=this._endDimensionPoint;if(!u||!x)throw new i("DimensionLayerView: bad geometry","Failed to construct the dimension line!");this._dimensionDirection=r(a(),x,u),this._dimensionAngleRad=E(this._dimensionDirection),this._dimensionLength=l(this._dimensionDirection),this._dimensionDirection=m(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=k(u,x,this._dimensionLength/2))}_computeAlignedDimensionPoints(n,e,t){const s=R(this._extAngleRad);if(_(n,t))return this._beginDimensionPoint=h(a(),n[0],n[1]),this._endDimensionPoint=h(a(),e[0],e[1]),void(this._displayExtLines=!1);const o=E([e[0]-n[0],e[1]-n[1]]),r=A(t,o,e,o+s);if(!r)throw new i("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=h(a(),t[0],t[1]),this._endDimensionPoint=h(a(),r[0],r[1])}_computeLinearDimensionPoints(i,n,e){const t=v(i,n,e,this._extAngleRad);if(!t)return this._beginDimensionPoint=h(a(),i[0],i[1]),this._endDimensionPoint=h(a(),n[0],n[1]),void(this._displayExtLines=!1);this._beginDimensionPoint=t.beginDimensionPoint,this._endDimensionPoint=t.endDimensionPoint}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:n,endMarkerSymbol:e}=this._dimensionStyle,t=F(n,this._dimensionAngleRad),s=F(e,this._dimensionAngleRad+Math.PI),o=F(n,0),h=F(e,Math.PI);this._measureDimensionText(this._textString||"",this._textPoint,i),this._beginMarkerLength=i*(o?.width??0),this._endMarkerLength=i*(h?.width??0);const r=t&&this._beginDimensionPoint?N(B(t,i),this._beginDimensionPoint[0],this._beginDimensionPoint[1]):null,l=s&&this._endDimensionPoint?N(B(s,i),this._endDimensionPoint[0],this._endDimensionPoint[1]):null;if(this._doMarkersFit=this._checkMarkerFit(r,l,i),this._doMarkersFit){const i=k(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=k(this._beginDimensionPoint,this._endDimensionPoint,-2*this._beginMarkerLength),n=k(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+2*this._endMarkerLength);this._dimensionPolyline=[[i,this._beginDimensionPoint],[n,this._endDimensionPoint]]}}_checkMarkerFit(i,n,e){if(!i||!n)return!1;const{markerFit:t,markerOption:s,markerFitTolerance:o}=this._dimensionStyle;if("None"===t)return!0;let h=!0;const r=(i,n)=>I(i,n)||O(i,n,this._dimensionDirection);if("Tolerance"===t)o*e>=this._dimensionLength&&(h=!1);else{if(this._hasTextPoint&&"Both"!==s)return!0;if(this._hasTextPoint&&"Both"===s)r(i,n)&&(h=!1);else{h=this._beginMarkerLength+this._endMarkerLength+(this._textLength??0)<=this._dimensionLength}}return h}_measureDimensionText(i,n,e){if(null==this._textString||null==n||null==this._textResource)return null;const t=this._dimensionStyle.textSymbol;if(!t)return null;const s=c(t.horizontalAlignment),o=P(t.verticalAlignment),h=p(t),r=L(t.height||10);this._textSize="glyphs"===this._textResource.type?r:Math.max(r,...this._textResource.runs.map(i=>L(i.fontSize||0)));const l=!0,m=t.angle||0,_="glyphs"===this._textResource.type?this._textResource.sdfSize:this._textResource.runs[0]?.glyphs.sdfSize;if(!_)return null;const d=r/_,a=S(t.lineWidth),g=Math.max(.25,Math.min(r||1,4)),u=f*g,x=D(this._textResource,{scale:d,angle:m,xOffset:0,yOffset:0,horizontalAlignment:s,verticalAlignment:o,decoration:h,lineHeight:u,lineHeightRatio:g,useCIMAngleBehavior:l,maxLineWidth:a,hasBackground:!1}),b=n;if(!b)return null;const M=e,T=[x.bounds.blX,x.bounds.trY],w=[x.bounds.trX,x.bounds.trY],k=[x.bounds.blX,x.bounds.blY],E=[x.bounds.trX,x.bounds.blY];T[0]-=x.bounds.x,T[1]-=x.bounds.y,w[0]-=x.bounds.x,w[1]-=x.bounds.y,k[0]-=x.bounds.x,k[1]-=x.bounds.y,E[0]-=x.bounds.x,E[1]-=x.bounds.y,T[0]*=M,T[1]*=M,w[0]*=M,w[1]*=M,k[0]*=M,k[1]*=M,E[0]*=M,E[1]*=M,this._textLength=1.1*(Math.max(T[0],w[0],k[0],E[0])-Math.min(T[0],w[0],k[0],E[0])),this._dimensionAngleRad&&(j(T,this._dimensionAngleRad),j(w,this._dimensionAngleRad),j(k,this._dimensionAngleRad),j(E,this._dimensionAngleRad)),T[0]+=b[0],T[1]+=b[1],w[0]+=b[0],w[1]+=b[1],k[0]+=b[0],k[1]+=b[1],E[0]+=b[0],E[1]+=b[1];const R=Math.min(T[0],w[0],k[0],E[0]),A=Math.min(T[1],w[1],k[1],E[1]),v=Math.max(T[0],w[0],k[0],E[0]),F=Math.max(T[1],w[1],k[1],E[1]);return new y(R,A,1.1*(v-R),1.1*(F-A))}_getDimensionText(i){const{attributes:n}=i;let e=null;const t=1===Number(z(w.useCustomLength,n));e=Number(z(t?w.customLength:w.dimLength,n)),(0===e||isNaN(e)||null==e)&&(e=this._systemLength);let s=this._getDimensionString(e,i);return"number"==typeof s&&(s=s.toString()),n.__COMPUTED_TEXT_STRING__=s,s||""}_getDimensionString(i,n){const{displayUnits:t,displayPrecision:s,prefix:o,suffix:h,textOption:r}=this._dimensionStyle;if("None"===r)return null;if("Expression"===r&&this._compiledExpression&&n)return b(this._compiledExpression,n,{},"esriGeometryPolyline",this._fieldsIndex);if(t){const n=G(this._spatialReference),s=G(t);n&&s&&(i=e(i,n,s))}let l=(i=null==s||isNaN(s)?parseFloat(i.toString()):parseFloat(i.toFixed(s))).toString();return"Suffix"===r&&(o&&(l=`${o} ${l}`),h&&(l=`${l} ${h}`)),l}}function G(i){return"object"!=typeof i||null==i?null:"uwkid"in i&&"number"==typeof i.uwkid?t(i.uwkid):s(i)}function X(i){const{attributes:n}=i,e=Object.keys(w).map(i=>({name:i,alias:i,type:"string"==typeof n[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new u(e)}export{U as default};
2
+ import{convert as i,toLengthUnit as n,getSpatialReferenceUnit as e}from"../../../../../arcade/geometry/unitConversion.js";import t from"../../../../../core/Error.js";import s from"../../../../../core/Logger.js";import{dist as o,set as r,subtract as h,len as l,scale as m,equals as _}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as d,create as a}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isPolygon as u}from"../../../../../geometry/support/jsonTypeUtils.js";import g from"../../../../../layers/support/FieldsIndex.js";import{createRendererExpression as c}from"../../../../../support/ArcadeExpression.js";import{fromCIMHorizontalAlignment as x,fromCIMVerticalAlignment as P,fromCIMFontDecoration as p}from"../../../../../symbols/cim/utils.js";import f from"../../../arcade/callExpressionWithFeature.js";import{magicLabelLineHeight as b}from"../../../engine/webgl/definitions.js";import y from"../../../engine/webgl/Rect.js";import{shapeTextResource as D}from"../../../engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as L,getLineWidth as S}from"../../graphics/graphicsUtils.js";import{initializeDimensionStyleDefaults as M}from"./dimensionStyleDefaults.js";import{normalizeExtensionAngle as T,DimensionRealFieldName as w,queryPointOnLine as k,angleFromXAxis as E,capDimensionExtensionAngle as R,intersectLinesByPointsAndAngles as v,projectLinearDimensionPoints as A,measureMarkerSymbolSize as F,translateRect as N,scaleRect as B,rotatePoint as j,rectsOverlap as I,rectsOverlapOnAxis as O}from"./dimensionUtils.js";import{getAttributeValue as z}from"./utils.js";class U{static async create(i,n,e,t=e){const s=new U(i,e,t);return await s.initialize(n,e),s}constructor(i,n,e){if(this._dimensionStyle=i,this._viewSpatialReference=n,this._sourceSpatialReference=e,this._textString=null,this._displayExtLines=!0,this._systemLength=0,this._dimensionAngleRad=0,this._dimensionLength=0,this._dimensionDirection=null,this._textSize=null,this._textLength=null,this._extAngleRad=Math.PI/2,this._dimensionType=0,this._compiledExpression=null,this._fieldsIndex=null,this._textResource=null,this._beginBaselinePoint=null,this._endBaselinePoint=null,this._dimensionLinePoint=null,this._beginDimensionPoint=null,this._endDimensionPoint=null,this._beginMarkerLength=0,this._endMarkerLength=0,this._textPoint=null,this._dimensionPolyline=null,this._dimensionExtensionLines=null,this._hasTextPoint=!1,this._doMarkersFit=!0,this._dimensionIsEvaluated=!1,null==i)throw new Error("dimension syle must be defined!");M(i)}async initialize(i,n){if(!this._dimensionStyle)return;const{attributes:e}=i;if("Expression"===(this._dimensionStyle.textOption??"None")){const{expression:e,expressionParserName:o}=this._dimensionStyle;e&&o&&"arcade"===o.toLowerCase()?(this._compiledExpression=await c(e,n),this._fieldsIndex=Y(i)):s.getLogger("esri.layers.DimensionFeatureLayer").warn(new t("dimension-layer:unsupported-expression","Only Arcade expressions are supported",{expressionType:o,expression:e}))}this._extAngleRad=T(z(w.extAngle,e)),this._dimensionType=1===Number(z(w.dimType,e))?1:0,this._systemLength=Number(z("__SYSTEM_LENGTH__",e));const{geometry:o}=i;if(o&&!u(o))throw new t("dimension-layer","processed geometry must be a valid 'polygon'.");const r=o?.rings[0];if(!r||r.length<3)throw new t("dimension-layer","processed geometry must have at least 3 points.");this._hasTextPoint=null!=r[3]&&0!==r[3][0]&&0!==r[3][1]&&void 0!==r[3][0]&&void 0!==r[3][1],this._hasTextPoint&&(this._textPoint=r[3]);const h=this._dimensionStyle.textSymbol;e.__DIMENSION_ANGLE__+=h?.angle??0}getTextString(i){return null==this._textString&&(this._textString=this._getDimensionText(i)),this._textString}get textSymbol(){return this._dimensionStyle.textSymbol??null}setTextResource(i){this._textResource=i??null}get beginBaselinePoint(){return this._beginBaselinePoint}get endBaselinePoint(){return this._endBaselinePoint}get beginDimensionPoint(){return this._beginDimensionPoint}get endDimensionPoint(){return this._endDimensionPoint}get textPoint(){return this._textPoint}get dimensionLine(){return this._dimensionPolyline}get extensionLines(){return this._displayExtLines?this._dimensionExtensionLines:null}evaluateWithGeometry(i,n){this._dimensionIsEvaluated||(this._computeDimensionLineInfo(i,n),this._evaluateDefaultPlacement(n),this._updateExtensionLines(n),this._updateTextPoint(n),this._offsetTextPoint(n),this._dimensionIsEvaluated=!0)}_updateTextPoint(i){if(this._hasTextPoint)return;const{textFit:n}=this._dimensionStyle;if(!this._doMarkersFit){if("None"===n||null==this._textLength)return;if(this._textLength>this._dimensionLength){const i=this._textLength/2;"MoveBegin"===n?(this._textPoint=k(this._beginDimensionPoint,this._endDimensionPoint,-(i+this._beginMarkerLength/2)),this._extendDimensionLineForMovedText("begin",this._beginMarkerLength/2+this._textLength)):"MoveEnd"===n&&(this._textPoint=k(this._endDimensionPoint,this._beginDimensionPoint,-(i+this._endMarkerLength/2)),this._extendDimensionLineForMovedText("end",this._endMarkerLength/2+this._textLength))}}}_extendDimensionLineForMovedText(i,n){if(this._dimensionPolyline?.length)if("begin"===i){const i=k(this._beginDimensionPoint,this._endDimensionPoint,-n);this._dimensionPolyline[0]=[i,this._beginDimensionPoint]}else{const i=k(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+n);this._dimensionPolyline[1]=[i,this._endDimensionPoint]}}_offsetTextPoint(i){if(this._hasTextPoint)return;const n=this._textPoint;if(!n)return;const e=.5*this._textSize*i,t=-e*this._dimensionDirection[1],s=e*this._dimensionDirection[0];n[0]+=t,n[1]+=s}_updateExtensionLines(i){if(!(this._displayExtLines&&this._beginDimensionPoint&&this._dimensionLinePoint&&this._endDimensionPoint))return;const{extensionLineOvershot:n,extensionLineOffset:e}=this._dimensionStyle;let t=this._dimensionLinePoint,s=this._endDimensionPoint;null==n||isNaN(n)||0===n||(t=k(this._dimensionLinePoint,this._beginBaselinePoint,-n*i),s=k(this._endDimensionPoint,this._endBaselinePoint,-n*i));let r=this._beginBaselinePoint,h=this._endBaselinePoint;if(null!=e&&!isNaN(e)&&0!==e){const i=o(t,this._beginBaselinePoint),n=o(s,this._endBaselinePoint);r=k(t,this._beginBaselinePoint,i-e),h=k(s,this._endBaselinePoint,n-e)}this._dimensionExtensionLines=[[t,r],[s,h]]}_computeDimensionLineInfo(i,n){if(!i||!u(i)||i.rings[0].length<3)throw new t("DimensionLayerView: bad geometry","Dimension cann't be applied to an empty geometry!");const e=i.rings[0],s=d(e[0][0],e[0][1]),o=d(e[1][0],e[1][1]),_=d(e[2][0],e[2][1]);this._beginBaselinePoint=r(a(),s[0],s[1]),this._endBaselinePoint=r(a(),o[0],o[1]),this._dimensionLinePoint=_,1===this._dimensionType?this._computeLinearDimensionPoints(s,o,_):this._computeAlignedDimensionPoints(s,o,_);const g=this._beginDimensionPoint,c=this._endDimensionPoint;if(!g||!c)throw new t("DimensionLayerView: bad geometry","Failed to construct the dimension line!");this._dimensionDirection=h(a(),c,g),this._dimensionAngleRad=E(this._dimensionDirection),this._dimensionLength=l(this._dimensionDirection),this._dimensionDirection=m(this._dimensionDirection,this._dimensionDirection,1/this._dimensionLength),this._hasTextPoint||(this._textPoint=k(g,c,this._dimensionLength/2))}_computeAlignedDimensionPoints(i,n,e){const s=R(this._extAngleRad);if(_(i,e))return this._beginDimensionPoint=r(a(),i[0],i[1]),this._endDimensionPoint=r(a(),n[0],n[1]),void(this._displayExtLines=!1);const o=E([n[0]-i[0],n[1]-i[1]]),h=v(e,o,n,o+s);if(!h)throw new t("DimensionLayerView: bad geometry","Failed to construct dimension extension lines!");this._beginDimensionPoint=r(a(),e[0],e[1]),this._endDimensionPoint=r(a(),h[0],h[1])}_computeLinearDimensionPoints(i,n,e){const t=A(i,n,e,this._extAngleRad);if(!t)return this._beginDimensionPoint=r(a(),i[0],i[1]),this._endDimensionPoint=r(a(),n[0],n[1]),void(this._displayExtLines=!1);this._beginDimensionPoint=t.beginDimensionPoint,this._endDimensionPoint=t.endDimensionPoint}_evaluateDefaultPlacement(i){const{beginMarkerSymbol:n,endMarkerSymbol:e}=this._dimensionStyle,t=F(n,this._dimensionAngleRad),s=F(e,this._dimensionAngleRad+Math.PI),o=F(n,0),r=F(e,Math.PI);this._measureDimensionText(this._textString||"",this._textPoint,i),this._beginMarkerLength=i*(o?.width??0),this._endMarkerLength=i*(r?.width??0);const h=t&&this._beginDimensionPoint?N(B(t,i),this._beginDimensionPoint[0],this._beginDimensionPoint[1]):null,l=s&&this._endDimensionPoint?N(B(s,i),this._endDimensionPoint[0],this._endDimensionPoint[1]):null;if(this._doMarkersFit=this._checkMarkerFit(h,l,i),this._doMarkersFit){const i=k(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength/2);this._dimensionPolyline=[[i,this._beginDimensionPoint],[i,this._endDimensionPoint]]}else{const i=k(this._beginDimensionPoint,this._endDimensionPoint,-2*this._beginMarkerLength),n=k(this._beginDimensionPoint,this._endDimensionPoint,this._dimensionLength+2*this._endMarkerLength);this._dimensionPolyline=[[i,this._beginDimensionPoint],[n,this._endDimensionPoint]]}}_checkMarkerFit(i,n,e){if(!i||!n)return!1;const{markerFit:t,markerOption:s,markerFitTolerance:o}=this._dimensionStyle;if("None"===t)return!0;let r=!0;const h=(i,n)=>I(i,n)||O(i,n,this._dimensionDirection);if("Tolerance"===t)o*e>=this._dimensionLength&&(r=!1);else{if(this._hasTextPoint&&"Both"!==s)return!0;if(this._hasTextPoint&&"Both"===s)h(i,n)&&(r=!1);else{r=this._beginMarkerLength+this._endMarkerLength+(this._textLength??0)<=this._dimensionLength}}return r}_measureDimensionText(i,n,e){if(null==this._textString||null==n||null==this._textResource)return null;const t=this._dimensionStyle.textSymbol;if(!t)return null;const s=x(t.horizontalAlignment),o=P(t.verticalAlignment),r=p(t),h=L(t.height||10);this._textSize="glyphs"===this._textResource.type?h:Math.max(h,...this._textResource.runs.map(i=>L(i.fontSize||0)));const l=!0,m=t.angle||0,_="glyphs"===this._textResource.type?this._textResource.sdfSize:this._textResource.runs[0]?.glyphs.sdfSize;if(!_)return null;const d=h/_,a=S(t.lineWidth),u=Math.max(.25,Math.min(h||1,4)),g=b*u,c=D(this._textResource,{scale:d,angle:m,xOffset:0,yOffset:0,horizontalAlignment:s,verticalAlignment:o,decoration:r,lineHeight:g,lineHeightRatio:u,useCIMAngleBehavior:l,maxLineWidth:a,hasBackground:!1}),f=n;if(!f)return null;const M=e,T=[c.bounds.blX,c.bounds.trY],w=[c.bounds.trX,c.bounds.trY],k=[c.bounds.blX,c.bounds.blY],E=[c.bounds.trX,c.bounds.blY];T[0]-=c.bounds.x,T[1]-=c.bounds.y,w[0]-=c.bounds.x,w[1]-=c.bounds.y,k[0]-=c.bounds.x,k[1]-=c.bounds.y,E[0]-=c.bounds.x,E[1]-=c.bounds.y,T[0]*=M,T[1]*=M,w[0]*=M,w[1]*=M,k[0]*=M,k[1]*=M,E[0]*=M,E[1]*=M,this._textLength=1.1*(Math.max(T[0],w[0],k[0],E[0])-Math.min(T[0],w[0],k[0],E[0])),this._dimensionAngleRad&&(j(T,this._dimensionAngleRad),j(w,this._dimensionAngleRad),j(k,this._dimensionAngleRad),j(E,this._dimensionAngleRad)),T[0]+=f[0],T[1]+=f[1],w[0]+=f[0],w[1]+=f[1],k[0]+=f[0],k[1]+=f[1],E[0]+=f[0],E[1]+=f[1];const R=Math.min(T[0],w[0],k[0],E[0]),v=Math.min(T[1],w[1],k[1],E[1]),A=Math.max(T[0],w[0],k[0],E[0]),F=Math.max(T[1],w[1],k[1],E[1]);return new y(R,v,1.1*(A-R),1.1*(F-v))}_getDimensionText(i){const{attributes:n}=i;let e=null,t=this._sourceSpatialReference;const s=1===Number(z(w.useCustomLength,n));e=Number(z(s?w.customLength:w.dimLength,n)),(0===e||isNaN(e)||null==e)&&(e=this._systemLength,t=this._viewSpatialReference);let o=this._getDimensionString(e,t,i);return"number"==typeof o&&(o=o.toString()),n.__COMPUTED_TEXT_STRING__=o,o||""}_getDimensionString(n,e,t){const{displayUnits:s,displayPrecision:o,prefix:r,suffix:h,textOption:l}=this._dimensionStyle;if("None"===l)return null;if("Expression"===l&&this._compiledExpression&&t)return f(this._compiledExpression,t,{},"esriGeometryPolyline",this._fieldsIndex);if(s){const t=C(e),o=C(s);t&&o&&(n=i(t,o,n))}let m=(n=null==o||isNaN(o)?parseFloat(n.toString()):parseFloat(n.toFixed(o))).toString();return"Suffix"===l&&(r&&(m=`${r} ${m}`),h&&(m=`${m} ${h}`)),m}}function C(i){return"object"!=typeof i||null==i?null:G(i)?X(n(i.uwkid)):X(e(i))}function G(i){return"uwkid"in i&&"number"==typeof i.uwkid}function X(i){return"linear"===i?.type?{...i,type:"linear"}:null}function Y(i){const{attributes:n}=i,e=Object.keys(w).map(i=>({name:i,alias:i,type:"string"==typeof n[i]?"esriFieldTypeString":"esriFieldTypeDouble"}));return new g(e)}export{U as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{createScreenRect as t,screenRectIntersects as e}from"../../../core/screenUtils.js";import{polygonContainsPoint as r,extentContainsPoint as n,ringsContainsCoords as o}from"../../../geometry/support/contains.js";const i=t=>parseFloat(t)/100;function a(t,e,r){const n="string"==typeof t.left?i(t.left)*e:t.left??0,o="string"==typeof t.right?i(t.right)*e:t.right??0,a="string"==typeof t.top?i(t.top)*r:t.top??0,m="string"==typeof t.bottom?i(t.bottom)*r:t.bottom??0,h=a;return{xmin:n,xmax:Math.max(e-o,n),ymin:h,ymax:Math.max(r-m,a)}}function m(t,e,r){const{xmin:n,xmax:o,ymin:i,ymax:m}=a(t,e,r);return{x:n,y:i,width:o-n,height:m-i}}function h(t,e,i,m){switch(e.type){case"rect":{const{width:r,height:n}=t,{xmin:o,xmax:m,ymin:h,ymax:y}=a(e,r,n),{x:s,y:c}=i;return s>o&&s<m&&c>h&&c<y}case"path":return 0===e.path.length||!Array.isArray(e.path[0][0])||o(e.path,[i.x,i.y]);case"geometry":return null==e.geometry||("polygon"===e.geometry.type?r(e.geometry,m):n(e.geometry,m))}}function y(t,r,n){switch(r.type){case"rect":return e(m(r,t.width,t.height),n);case"path":case"geometry":return!0}}function s(e,r,n){switch(r.type){case"rect":{const{width:o,height:i}=e,{xmin:m,xmax:h,ymin:y,ymax:s}=a(r,o,i),c=n.x,x=n.y,p=c+n.width,g=x+n.height,u=Math.max(m,c),f=Math.min(h,p);if(u>=f)return null;const l=Math.max(y,x),w=Math.min(s,g);return l>=w?null:t(u,l,f-u,w-l)}case"path":case"geometry":return n}}export{h as clipContainsPoint,y as clipIntersectsScreenRect,s as computeClippedScreenRect,a as createScreenExtent};
2
+ import{polygonContainsPoint as t,extentContainsPoint as e,ringsContainsCoords as o}from"../../../geometry/support/contains.js";const r=t=>parseFloat(t)/100;function n(t,e,o){const n="string"==typeof t.left?r(t.left)*e:t.left??0,m="string"==typeof t.right?r(t.right)*e:t.right??0,y="string"==typeof t.top?r(t.top)*o:t.top??0,a="string"==typeof t.bottom?r(t.bottom)*o:t.bottom??0,i=y;return{xmin:n,xmax:Math.max(e-m,n),ymin:i,ymax:Math.max(o-a,y)}}function m(r,m,y,a){switch(m.type){case"rect":{const{width:t,height:e}=r,{xmin:o,xmax:a,ymin:i,ymax:p}=n(m,t,e),{x:g,y:s}=y;return g>o&&g<a&&s>i&&s<p}case"path":return 0===m.path.length||!Array.isArray(m.path[0][0])||o(m.path,[y.x,y.y]);case"geometry":return null==m.geometry||("polygon"===m.geometry.type?t(m.geometry,a):e(m.geometry,a))}}export{m as clipContainsPoint,n as createScreenExtent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../Graphic.js";import{isSome as t}from"../../../core/arrayUtils.js";import{isIterable as r}from"../../../core/iteratorUtils.js";import{isScreenPolygon as i,isScreenRect as n,isScreenPoint as l,createScreenPoint as o,clipRectToView as s}from"../../../core/screenUtils.js";import a from"../../../geometry/Point.js";import{computeClippedScreenRect as p,clipContainsPoint as c,clipIntersectsScreenRect as u}from"./clippingUtils.js";import{isSupportedScreenPointEvent as f,createScreenPointFromSupportedEvent as y}from"../../support/screenUtils.js";function h(e,t){if(i(e))return{hittestType:"polygon",polygonMesh:null,input:e,options:t};if(n(e)){return{hittestType:"rect",input:e,options:t}}return l(e)?{hittestType:"point",input:e,options:t}:null}async function d(e,r,l){const o=!f(r)&&n(r),p=!f(r)&&i(r),c=o||p,u=o?s(r,e.width,e.height):f(r)?y(e,r):r,h=i(u)?u:null,d=i(u)?u.length<3||u.some(({x:e,y:t})=>isNaN(e)||isNaN(t)):isNaN(u.x)||isNaN(u.y);let N=new a;if(c||(N=e.toMap(u)),!e.ready||d)return{screenPoint:null,results:[]};let V=new Set;const T=new Set;let b=!1,L=null,S=null;l?.include?m(l.include,g(e,e=>{V.add(e),M(e,e=>T.add(e))},(e,t)=>{T.add(e),V.add(t)},e=>{L||(L=new Set),L.add(e)},e=>V.add(e),()=>b=!0)):(b=!0,V=new Set(e.allLayerViews),V.forEach(e=>{M(e,e=>T.add(e))})),l?.exclude&&m(l.exclude,g(e,e=>{V.delete(e),M(e,e=>T.delete(e))},e=>T.delete(e),e=>{S||(S=new Set),S.add(e)}));const P=x(e,u).filter(e=>V.has(e)),U=b?e.graphicsView.hitTest(e,u).map(e=>({type:"graphic",graphic:e,layer:null,mapPoint:c?null:N})):[],$=Array.from(P).flatMap(t=>{if(h)return[t.hitTest(N,h,l)];if(o){const r=j(e,t,u);return null==r?[]:r.map(e=>t.hitTest(N,e,l))}return[t.hitTest(N,u,l)]});let E=[...U,...await Promise.all($)].filter(t).flat().filter(t);E=E.filter(e=>"graphic"!==e.type||"subtype-group"!==e.layer?.type||T.has(e.graphic.layer));const v=new Set;return E=E.filter(e=>{if("graphic"!==e.type||!e.graphic)return!0;const t=w(e.graphic);return!v.has(t)&&(v.add(t),!0)}),L&&(E=E.filter(e=>!("graphic"in e)||!e.graphic||L?.has(w(e.graphic)))),S&&(E=E.filter(e=>!("graphic"in e)||!e.graphic||!S?.has(w(e.graphic)))),{screenPoint:c?null:u,results:E}}function g(t,r,i,n,l,o){return s=>{if(s instanceof e){if(s.layer===t)o?.();else{const e=t.allLayerViews.find(e=>e.layer===s.layer);e&&l?.(e)}n(w(s))}else if("layer"in s&&"element"in s);else if("subtype-sublayer"===s.type){const e=t.allLayerViews.find(e=>e.layer===s.parent);e&&i(s,e)}else{const e=t.allLayerViews.find(e=>e.layer===s);e&&r(e)}}}function m(e,t){if(e)if(r(e))for(const i of e)if(r(i))for(const e of i)t(e);else t(i);else t(e)}function w(e){const t=e.getObjectId();return t?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${t}`:`"MapView/${e.uid}`}function M(e,t){const r=e.layer;"subtype-group"===r?.type&&r.sublayers.forEach(e=>{t(e)})}function x(e,t){const r=l(t)?r=>{const i=e.toMap(t);return c(e,r,t,i)}:n(t)?r=>u(e,r,t):null;return e.allLayerViews.filter(e=>!e.suspended&&(null==r||!e.clips.length||e.clips.some(r))).reverse()}function j(e,t,r){if(!t.clips.length)return[r];const i=[];for(const n of t.clips){if("rect"!==n.type){i.push(r);continue}const t=p(e,n,r);t&&i.push(t)}return i}function N(e,t){if(i(t))return t.map(t=>e.toMap(t));if(n(t)){const r=t;return[e.toMap(o(r.x,r.y)),e.toMap(o(r.x,r.y+r.height)),e.toMap(o(r.x+r.width,r.y+r.height)),e.toMap(o(r.x+r.width,r.y))]}return[e.toMap(t)]}function V(e){return i(e)?"polygon":n(e)?"rect":l(e)?"point":null}export{h as createHittestQuery,x as getHitTestLayerViews,V as getHittestType,N as getMapPointsFromScreen,d as hitTest};
2
+ import e from"../../../Graphic.js";import{isSome as t}from"../../../core/arrayUtils.js";import{isIterable as r}from"../../../core/iteratorUtils.js";import{isScreenPolygon as i,isScreenRect as n,isScreenPoint as o,createScreenPoint as a,clipRectToView as s,createScreenRect as l}from"../../../core/screenUtils.js";import p from"../../../geometry/Point.js";import{fromValues as c}from"../../../geometry/support/aaBoundingRect.js";import{targetIntersectsPolygon as f}from"../../../geometry/support/intersectsBase.js";import{clipPolygonToExtent as u}from"../../../geometry/support/polygonExtentClipping.js";import{calculateArea2D as y}from"../../../layers/raster/functions/rasterProjectionHelper.js";import{clipContainsPoint as m,createScreenExtent as h}from"./clippingUtils.js";import{isSupportedScreenPointEvent as d,createScreenPointFromSupportedEvent as g}from"../../support/screenUtils.js";function x(e,t){if(i(e))return{hittestType:"polygon",polygonMesh:null,input:e,options:t};if(n(e)){return{hittestType:"rect",input:e,options:t}}return o(e)?{hittestType:"point",input:e,options:t}:null}async function w(e,r,o){const a=!d(r)&&n(r),l=!d(r)&&i(r),c=a||l,f=a?s(r,e.width,e.height):d(r)?g(e,r):r,u=i(f)?f.length<3||f.some(({x:e,y:t})=>isNaN(e)||isNaN(t)):isNaN(f.x)||isNaN(f.y);let y=new p;if(c||(y=e.toMap(f)),!e.ready||u)return{screenPoint:null,results:[]};let m=new Set;const h=new Set;let x=!1,w=null,L=null;o?.include?j(o.include,M(e,e=>{m.add(e),V(e,e=>h.add(e))},(e,t)=>{h.add(e),m.add(t)},e=>{w||(w=new Set),w.add(e)},e=>m.add(e),()=>x=!0)):(x=!0,m=new Set(e.allLayerViews),m.forEach(e=>{V(e,e=>h.add(e))})),o?.exclude&&j(o.exclude,M(e,e=>{m.delete(e),V(e,e=>h.delete(e))},e=>h.delete(e),e=>{L||(L=new Set),L.add(e)}));const P=e.allLayerViews.filter(e=>!e.suspended&&m.has(e)).reverse(),S=x?e.graphicsView.hitTest(e,f).map(e=>({type:"graphic",graphic:e,layer:null,mapPoint:c?null:y})):[],T=Array.from(P).flatMap(t=>b(e,t,f).map(e=>t.hitTest(y,e,o)));let U=[...S,...await Promise.all(T)].filter(t).flat().filter(t);U=U.filter(e=>"graphic"!==e.type||"subtype-group"!==e.layer?.type||h.has(e.graphic.layer));const E=new Set;return U=U.filter(e=>{if("graphic"!==e.type||!e.graphic)return!0;const t=N(e.graphic);return!E.has(t)&&(E.add(t),!0)}),w&&(U=U.filter(e=>!("graphic"in e)||!e.graphic||w?.has(N(e.graphic)))),L&&(U=U.filter(e=>!("graphic"in e)||!e.graphic||!L?.has(N(e.graphic)))),{screenPoint:c?null:f,results:U}}function M(t,r,i,n,o,a){return s=>{if(s instanceof e){if(s.layer===t)a?.();else{const e=t.allLayerViews.find(e=>e.layer===s.layer);e&&o?.(e)}n(N(s))}else if("layer"in s&&"element"in s);else if("subtype-sublayer"===s.type){const e=t.allLayerViews.find(e=>e.layer===s.parent);e&&i(s,e)}else{const e=t.allLayerViews.find(e=>e.layer===s);e&&r(e)}}}function j(e,t){if(e)if(r(e))for(const i of e)if(r(i))for(const e of i)t(e);else t(i);else t(e)}function N(e){const t=e.getObjectId();return t?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${t}`:`"MapView/${e.uid}`}function V(e,t){const r=e.layer;"subtype-group"===r?.type&&r.sublayers.forEach(e=>{t(e)})}function b(e,t,r){const{clips:s}=t;if(!s.length)return[r];if(o(r)){const t=e.toMap(r);return s.some(i=>m(e,i,r,t))?[r]:[]}if(s.some(e=>"rect"!==e.type))return[r];const p=s.filter(e=>"rect"===e.type),d=T(r),g=[];for(const o of p){const{xmin:t,xmax:s,ymin:p,ymax:m}=h(o,e.width,e.height);if(f(d,[[[t,p],[t,m],[s,m],[s,p],[t,p]]])){const e=u(d,c(t,p,s,m));if(!(y([e.map(e=>[e[0],e[1]])])>0))continue;if(n(r)){const t=S(e.map(e=>[e]));g.push(l(t.xmin,t.ymin,t.xmax-t.xmin,t.ymax-t.ymin))}else i(r)&&g.push(e.map(e=>a(e[0],e[1])))}}return g}function L(e,t){if(i(t))return t.map(t=>e.toMap(t));if(n(t)){const r=t;return[e.toMap(a(r.x,r.y)),e.toMap(a(r.x,r.y+r.height)),e.toMap(a(r.x+r.width,r.y+r.height)),e.toMap(a(r.x+r.width,r.y))]}return[e.toMap(t)]}function P(e){return i(e)?"polygon":n(e)?"rect":o(e)?"point":null}function S(e){let t=1/0,r=1/0,i=-1/0,n=-1/0;for(const o of e)for(const[e,a]of o)t=Math.min(t,e),r=Math.min(r,a),i=Math.max(i,e),n=Math.max(n,a);return{xmin:t,ymin:r,xmax:i,ymax:n}}function T(e){let t=[];if(n(e)){const{x:r,y:i,width:n,height:o}=e;t=[[r,i],[r+n,i],[r+n,i+o],[r,i+o]]}else i(e)?t=e.map(e=>[e.x,e.y]):o(e)&&(t=[[e.x,e.y]]);return t}export{x as createHittestQuery,S as getBbox,P as getHittestType,b as getLayerViewHitTargets,L as getMapPointsFromScreen,w as hitTest,T as screenTargetToPointArray};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{BufferViewVec2f16 as t,BufferViewVec2f as e,BufferViewVec2f64 as i,BufferViewVec3f16 as s,BufferViewVec3f as r,BufferViewVec3f64 as n,BufferViewVec4f16 as h,BufferViewVec4f as d,BufferViewVec4f64 as u,BufferViewMat3f as f,BufferViewMat3f64 as o,BufferViewMat4f as l,BufferViewMat4f64 as p,BufferViewVec4u8 as c,BufferViewFloat16 as a,BufferViewFloat as _,BufferViewFloat64 as F,BufferViewUint8 as m,BufferViewUint16 as y,BufferViewInt8 as b,BufferViewVec2i8 as g,BufferViewVec2i16 as w,BufferViewVec2u8 as v,BufferViewVec2u16 as E,BufferViewVec4u16 as A,BufferViewVec4i16 as M,BufferViewUint32 as U,BufferViewVec3u8 as j,BufferViewVec3u16 as L,BufferViewVec2u32 as T,BufferViewVec3u32 as x,BufferViewVec4u32 as C,BufferViewVec3i8 as z,BufferViewVec4i8 as B,BufferViewInt16 as V,BufferViewVec3i16 as $,BufferViewInt32 as O,BufferViewVec2i32 as k,BufferViewVec3i32 as q,BufferViewVec4i32 as D}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as G}from"../../../../geometry/support/buffer/types.js";import{glLayout as H}from"./glUtil.js";import{assert as I}from"../../webgl-engine/lib/Util.js";import{fromLayout as J}from"../../../webgl/VertexAttributeLocations.js";class K{constructor(t,e,i=0){this.layout=t,this.byteOffset=i,this.buffer="number"==typeof e?new ArrayBuffer(e*t.stride):e;for(const s of t.fields.keys()){const e=t.fields.get(s);this[s]=new e.constructor(this.buffer,i+e.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(t,e){const i=this[t];return i&&i.elementCount===e.ElementCount&&i.elementType===e.ElementType?i:null}slice(t,e){return new K(this.layout,this.buffer.slice(t*this.stride,e*this.stride))}copyFrom(t,e=0,i=0,s=t.count){const r=this.stride;if(r%4==0){const n=new Uint32Array(t.buffer,e*r,s*r/4);new Uint32Array(this.buffer,i*r,s*r/4).set(n)}else{const n=new Uint8Array(t.buffer,e*r,s*r);new Uint8Array(this.buffer,i*r,s*r).set(n)}return this}get usedMemory(){return this.byteLength}dispose(){}}class N{constructor(t){this._stride=0,this._fields=new Map,t&&(this._stride=t.stride,t.fields.forEach(t=>this._fields.set(t[0],{...t[1],constructor:W(t[1].constructor)})))}freeze(){return this}get locations(){return J(H(this))}vec2f16(e,i){return this._appendField(e,t,i),this}vec2f(t,i){return this._appendField(t,e,i),this}vec2f64(t,e){return this._appendField(t,i,e),this}vec3f16(t,e){return this._appendField(t,s,e),this}vec3f(t,e){return this._appendField(t,r,e),this}vec3f64(t,e){return this._appendField(t,n,e),this}vec4f16(t,e){return this._appendField(t,h,e),this}vec4f(t,e){return this._appendField(t,d,e),this}vec4f64(t,e){return this._appendField(t,u,e),this}mat3f(t,e){return this._appendField(t,f,e),this}mat3f64(t,e){return this._appendField(t,o,e),this}mat4f(t,e){return this._appendField(t,l,e),this}mat4f64(t,e){return this._appendField(t,p,e),this}vec4u8(t,e){return this._appendField(t,c,e),this}f16(t,e){return this._appendField(t,a,e),this}f32(t,e){return this._appendField(t,_,e),this}f64(t,e){return this._appendField(t,F,e),this}u8(t,e){return this._appendField(t,m,e),this}u16(t,e){return this._appendField(t,y,e),this}i8(t,e){return this._appendField(t,b,e),this}vec2i8(t,e){return this._appendField(t,g,e),this}vec2i16(t,e){return this._appendField(t,w,e),this}vec2u8(t,e){return this._appendField(t,v,e),this}vec2u16(t,e){return this._appendField(t,E,e),this}vec4u16(t,e){return this._appendField(t,A,e),this}vec4i16(t,e){return this._appendField(t,M,e),this}u32(t,e){return this._appendField(t,U,e),this}_appendField(t,e,i){this._fields.has(t)&&I(!1,`${t} already added to vertex buffer layout`);const s=e.ElementCount*G(e.ElementType),r=this._stride;this._fields.set(t,{constructor:e,size:s,offset:r,optional:i}),this._alignFields()}_alignFields(){let t=0,e=1;this._fields.forEach(i=>{const s=G(i.constructor.ElementType);t=Math.floor((t+s-1)/s)*s,i.offset=t,t+=i.size,e=Math.max(e,s)}),t=Math.floor((t+e-1)/e)*e,this._stride=t}createBuffer(t){return new K(this,t)}createView(t,e){return new K(this,t,e)}clone(){const t=new N;return t._stride=this._stride,t._fields=new Map,this._fields.forEach((e,i)=>t._fields.set(i,e)),t}get stride(){return this._stride}get fields(){return this._fields}}function P(){return new N}class Q{constructor(t){this.fields=new Array,t.fields.forEach((t,e)=>{const i={...t,constructor:S(t.constructor)};this.fields.push([e,i])}),this.stride=t.stride}}const R=[_,e,r,d,f,l,F,i,n,u,o,p,m,v,j,c,y,E,L,A,U,T,x,C,b,g,z,B,V,w,$,M,O,k,q,D];function S(t){return`${t.ElementType}_${t.ElementCount}`}function W(t){return X.get(t)}const X=new Map;R.forEach(t=>X.set(S(t),t));export{K as InterleavedBuffer,N as InterleavedLayout,Q as PackedLayout,P as newLayout};
2
+ import{BufferViewVec2f16 as t,BufferViewVec2f as e,BufferViewVec2f64 as i,BufferViewVec3f16 as s,BufferViewVec3f as r,BufferViewVec3f64 as n,BufferViewVec4f16 as h,BufferViewVec4f as d,BufferViewVec4f64 as u,BufferViewMat3f as f,BufferViewMat3f64 as o,BufferViewMat4f as l,BufferViewMat4f64 as p,BufferViewVec4u8 as c,BufferViewFloat16 as a,BufferViewFloat as _,BufferViewFloat64 as F,BufferViewUint8 as y,BufferViewUint16 as m,BufferViewInt8 as b,BufferViewVec2i8 as g,BufferViewVec2i16 as w,BufferViewVec2u8 as v,BufferViewVec2u16 as E,BufferViewVec4u16 as A,BufferViewVec4i16 as M,BufferViewUint32 as U,BufferViewVec3u8 as j,BufferViewVec3u16 as L,BufferViewVec2u32 as T,BufferViewVec3u32 as x,BufferViewVec4u32 as C,BufferViewVec3i8 as O,BufferViewVec4i8 as z,BufferViewInt16 as B,BufferViewVec3i16 as V,BufferViewInt32 as $,BufferViewVec2i32 as k,BufferViewVec3i32 as q,BufferViewVec4i32 as D}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as G}from"../../../../geometry/support/buffer/types.js";import{glLayout as H}from"./glUtil.js";import{assert as I}from"../../webgl-engine/lib/Util.js";import{fromLayout as J}from"../../../webgl/VertexAttributeLocations.js";class K{constructor(t,e,i=0){this.layout=t,this.byteOffset=i,this.buffer="number"==typeof e?new ArrayBuffer(e*t.stride):e;for(const s of t.fields.keys()){const e=t.fields.get(s);this[s]=new e.constructor(this.buffer,i+e.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.byteLength/this.stride}get byteLength(){return this.buffer.byteLength-this.byteOffset}getField(t,e){const i=this[t];return i&&i.elementCount===e.ElementCount&&i.elementType===e.ElementType?i:null}slice(t,e){return new K(this.layout,this.buffer.slice(t*this.stride,e*this.stride))}copyFrom(t,e=0,i=0,s=t.count){const r=this.stride,n=t.byteOffset+e*r,h=this.byteOffset+i*r,d=s*r;if(r%4==0&&n%4==0&&h%4==0){const e=new Uint32Array(t.buffer,n,d/4);new Uint32Array(this.buffer,h,d/4).set(e)}else{const e=new Uint8Array(t.buffer,n,d);new Uint8Array(this.buffer,h,d).set(e)}return this}get usedMemory(){return this.byteLength}dispose(){}}class N{constructor(t){this._stride=0,this._fields=new Map,t&&(this._stride=t.stride,t.fields.forEach(t=>this._fields.set(t[0],{...t[1],constructor:W(t[1].constructor)})))}freeze(){return this}get locations(){return J(H(this))}vec2f16(e,i){return this._appendField(e,t,i),this}vec2f(t,i){return this._appendField(t,e,i),this}vec2f64(t,e){return this._appendField(t,i,e),this}vec3f16(t,e){return this._appendField(t,s,e),this}vec3f(t,e){return this._appendField(t,r,e),this}vec3f64(t,e){return this._appendField(t,n,e),this}vec4f16(t,e){return this._appendField(t,h,e),this}vec4f(t,e){return this._appendField(t,d,e),this}vec4f64(t,e){return this._appendField(t,u,e),this}mat3f(t,e){return this._appendField(t,f,e),this}mat3f64(t,e){return this._appendField(t,o,e),this}mat4f(t,e){return this._appendField(t,l,e),this}mat4f64(t,e){return this._appendField(t,p,e),this}vec4u8(t,e){return this._appendField(t,c,e),this}f16(t,e){return this._appendField(t,a,e),this}f32(t,e){return this._appendField(t,_,e),this}f64(t,e){return this._appendField(t,F,e),this}u8(t,e){return this._appendField(t,y,e),this}u16(t,e){return this._appendField(t,m,e),this}i8(t,e){return this._appendField(t,b,e),this}vec2i8(t,e){return this._appendField(t,g,e),this}vec2i16(t,e){return this._appendField(t,w,e),this}vec2u8(t,e){return this._appendField(t,v,e),this}vec2u16(t,e){return this._appendField(t,E,e),this}vec4u16(t,e){return this._appendField(t,A,e),this}vec4i16(t,e){return this._appendField(t,M,e),this}u32(t,e){return this._appendField(t,U,e),this}_appendField(t,e,i){this._fields.has(t)&&I(!1,`${t} already added to vertex buffer layout`);const s=e.ElementCount*G(e.ElementType),r=this._stride;this._fields.set(t,{constructor:e,size:s,offset:r,optional:i}),this._alignFields()}_alignFields(){let t=0,e=1;this._fields.forEach(i=>{const s=G(i.constructor.ElementType);t=Math.floor((t+s-1)/s)*s,i.offset=t,t+=i.size,e=Math.max(e,s)}),t=Math.floor((t+e-1)/e)*e,this._stride=t}createBuffer(t){return new K(this,t)}createView(t,e){return new K(this,t,e)}clone(){const t=new N;return t._stride=this._stride,t._fields=new Map,this._fields.forEach((e,i)=>t._fields.set(i,e)),t}get stride(){return this._stride}get fields(){return this._fields}}function P(){return new N}class Q{constructor(t){this.fields=new Array,t.fields.forEach((t,e)=>{const i={...t,constructor:S(t.constructor)};this.fields.push([e,i])}),this.stride=t.stride}}const R=[_,e,r,d,f,l,F,i,n,u,o,p,y,v,j,c,m,E,L,A,U,T,x,C,b,g,O,z,B,w,V,M,$,k,q,D];function S(t){return`${t.ElementType}_${t.ElementCount}`}function W(t){return X.get(t)}const X=new Map;R.forEach(t=>X.set(S(t),t));export{K as InterleavedBuffer,N as InterleavedLayout,Q as PackedLayout,P as newLayout};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function t(t,i){return t.size===i?new e(t):null}class e{constructor(t){this._attribute=t}get count(){return this._attribute.indices.length}get(t,e=0){const{data:i,indices:r,stride:n}=this._attribute;return i[r[t]*n+e]}getVec(t,e){const{data:i,indices:r,size:n,stride:s}=this._attribute,u=r[t]*s;for(let c=0;c<n;c++)e[c]=i[u+c];return e}}export{e as AttributeView,t as createAttributeView};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{createAttributeView as t}from"./AttributeView.js";function n(n,r){return o(n,r,1,t)}function r(n,r){return o(n,r,2,t)}function u(n,r){return o(n,r,3,t)}function e(n,r){return o(n,r,4,t)}function o(t,n,r,u){if(1===t.type){const{vertex:u}=t.buffers,e=u.layout.fields.get(n);return null==e||e.constructor.ElementCount!==r?null:u.getField(n,e.constructor)}const e=t.attributes.get(n);return null!=e?u(e,r):null}export{n as getScalarAttributeView,r as getVec2AttributeView,u as getVec3AttributeView,e as getVec4AttributeView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as s}from"../../../../core/screenUtils.js";import{fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as a,set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as f,length as p,scale as u,distance as d,transformMat4 as m,set as g,normalize as S,subtract as x,transformMat3 as b,scaleAndAdd as v,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as V,ONES as D,create as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as R,empty as w,expandPointInPlace as A}from"../../../../geometry/support/aaBoundingRect.js";import{evaluateModelTransformScale as j}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as U}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as _,isOIT as T}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as L}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as E}from"../lib/GLTextureMaterial.js";import{PointMaterial as F}from"../lib/PointMaterial.js";import{screenPolygonIntersectsBounds as B,screenPolygonIntersectsTriangle as H}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as N,Hit as G}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as q}from"../lib/screenSizePerspectiveUtils.js";import{assert as W}from"../lib/Util.js";import{writePosition as X,writeNormal as Y,writeColor as k,writeBufferVec2 as J,writeBufferFloat as K,writeBufferVec3 as Q,writeBufferZeros as Z,writeBufferVec4 as $}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as ee}from"./internal/MaterialUtil.js";import{a as te}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as se,getInstanceLayout as re,HUDMaterialTechnique as ie}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ae}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ne}from"../../../../webscene/support/AlphaCutoff.js";class oe extends F{constructor(e,t,s=!1){super(e,He),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ae(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e.output)&&(s.debugDrawLabelBorder=!!U.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&T(e.output)}intersectRay(e,t,s,r,i,a){const{options:{selectionMode:n,hud:o,excludeLabels:l},point:c,camera:h}=s,{parameters:g}=this;if(n&&o&&(!l||!g.isLabel)&&e.visible&&c&&h)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:b,halfOutlineSize:v,rotationAngle:O,anchor:z,centerView:P}of this._forEachScreenSpaceHUDInstance(_e,e,t,h))if(fe(c,S[0],S[1],x,b,v,O,g,z)){const e=s.ray;if(xe[0]=c[0],xe[1]=c[1],xe[2]=S[2],h.unprojectFromRenderScreen(xe,me)){const t=y();f(t,e.direction);const s=1/p(t);u(t,t,s);const r=d(e.origin,me)*s,i=y();m(i,P,h.inverseViewMatrix),a(r,r,t,-1,i)}}}*_forEachScreenSpaceHUDInstance(e,t,s,i){const{parameters:n}=this,o=t.attributes.get("featureAttribute"),l=null==o?null:V(o.data,Ve),{scaleX:c,scaleY:h}=Ge(l,n,i.pixelRatio),p=t.attributes.get("position"),d=t.attributes.get("size"),O=t.attributes.get("normal"),z=t.attributes.get("rotation"),y=t.attributes.get("centerOffset"),P=n.size,D=r(ze,s);W(p.size>=3);const C="screen"===n.centerOffsetUnits;for(let r=0;r<p.data.length/p.size;r++){const t=r*p.size;if(g(me,p.data[t],p.data[t+1],p.data[t+2]),m(me,me,s),m(me,me,i.viewMatrix),y){const e=r*y.size;g(ye,y.data[e],y.data[e+1],y.data[e+2])}else g(ye,0,0,0);if(!C&&(me[0]+=ye[0],me[1]+=ye[1],0!==ye[2])){const e=ye[2];S(ye,me),x(me,me,u(ye,ye,e))}const o=r*O.size;g(ge,O.data[o],O.data[o+1],O.data[o+2]),b(ge,ge,D);const{normal:l,cosAngle:V}=he(ge,i,Le),R=We(n,me,V,i,de);if(v(me,me,l,R),i.applyProjection(me,Se),Se[0]>-1){if(C&&(ye[0]||ye[1])&&(Se[0]+=ye[0]*i.pixelRatio,0!==ye[1]&&(Se[1]+=de.alignmentEvaluator.apply(ye[1])*i.pixelRatio),i.unapplyProjection(Se,me)),Se[0]+=n.screenOffset[0]*i.pixelRatio,Se[1]+=n.screenOffset[1]*i.pixelRatio,Se[0]=Math.floor(Se[0]),Se[1]=Math.floor(Se[1]),Fe[0]=P[0],Fe[1]=P[1],null!=d){const e=r*d.size;Fe[0]*=d.data[e],Fe[1]*=d.data[e+1]}de.evaluator.applyVec2(Fe,Fe);let t=0;if(n.textureIsSignedDistanceField){t=Math.min(n.outlineSize,.5*Fe[0])*i.pixelRatio/2}Fe[0]*=c,Fe[1]*=h,f(e.centerView,me),g(e.renderScreenPosition,Se[0],Se[1],Se[2]),a(e.screenSize,Fe),e.pixelRatioTolerance=Ie*i.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=n.rotation+(null!=z?z.data[r*z.size]:0),e.anchor=te(n),yield e}}}*_forEachDrapedHUDInstance(e,t,s){const r=t.attributes.get("position"),i=t.attributes.get("size"),n=t.attributes.get("rotation"),o=this.parameters,l=o.size,c=t.attributes.get("featureAttribute"),h=null==c?null:V(c.data,Ve),{scaleX:f,scaleY:p}=Ge(h,o,s);e.pixelRatioTolerance=Ee*s,e.anchor=te(o);for(let u=0;u<r.data.length/r.size;u++){const t=u*r.size;if(e.x=r.data[t],e.y=r.data[t+1],Fe[0]=l[0],Fe[1]=l[1],null!=i){const e=u*i.size;Fe[0]*=i.data[e],Fe[1]*=i.data[e+1]}if(e.halfOutlineSize=0,o.textureIsSignedDistanceField){const t=Math.min(o.outlineSize,.5*Fe[0]);e.halfOutlineSize=t*s/2}Fe[0]*=f,Fe[1]*=p,a(e.screenSize,Fe),e.rotationAngle=o.rotation+(null!=n?n.data[u*n.size]:0),yield e}}intersectRayDraped(e,t,s,r,i,a){const n=this.parameters;for(const{x:o,y:l,screenSize:c,pixelRatioTolerance:h,halfOutlineSize:f,rotationAngle:p,anchor:u}of this._forEachDrapedHUDInstance(Te,e,a))fe(s,o,l,c,h,f,p,n,u)&&r(i.distance,i.renderDistance,i.normal,-1)}intersectScreenPolygonDraped(e,t,s,r,i){if(!s.options.selectionMode||s.options.excludeLabels&&this.parameters.isLabel)return null;const a=this.parameters;for(const{x:n,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:h,rotationAngle:f,anchor:p}of this._forEachDrapedHUDInstance(Te,e,i))if(pe(r,n+t[0],o+t[1],l,c,h,f,a,p,!1))return new N(-1);return null}intersectScreenPolygon(e,t,s,r){const{options:{selectionMode:i,hud:a,excludeLabels:n},camera:o}=s,{parameters:l}=this;if(!i||!a||n&&l.isLabel||!e.visible||null==t)return null;const c=new G(1),h=1/o.pixelRatio;for(const{renderScreenPosition:f,screenSize:p,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:b}of this._forEachScreenSpaceHUDInstance(_e,e,t,o)){const e=m(me,b,o.inverseViewMatrix);if(!s.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=f[0]*h,i=(o.fullHeight-f[1])*h;if(je[0]=p[0]*h,je[1]=p[1]*h,pe(r,t,i,je,u*h,g*h,S,l,x,!0)){const t=d(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new Ne(this.parameters)}applyShaderOffsets(e,t,s,i,a,n,o,l){b(be,s,r(ze,i));const c=he(be,o,Le),h=qe(p(t),o),f=We(this.parameters,t,c.cosAngle,o,l);v(t,t,c.normal,f+h),v(e,e,be,f+h);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&f(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return f(a,t);const c=e(Math.abs(s.cosAngle),.01,1),h=1-Math.sqrt(1-c*c)/c/i.viewport[2];return u(a,t,l>0?h:1/h),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&f(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(S(ge,s),O(s,s,u(ge,ge,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&f(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&f(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=ne||t>=ne&&s[3]>=ne;return this._visible&&r}createGLMaterial(e){return new le(e)}calculateRelativeScreenBounds(e,t,s=R()){return ce(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class le extends E{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ie,e)}}function ce(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function he(e,t,s){return m(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Be),s}function fe(e,s,r,i,a,l,c,h,f){const p=ue(s,r,i,a,l,h,f,De);return n(Oe,s,r),o(ve,e,Oe,t(c)),ve[0]>p[0]&&ve[0]<p[2]&&ve[1]>p[1]&&ve[1]<p[3]}function pe(e,s,r,i,a,l,c,h,f,p){const u=ue(s,r,i,a,l,h,f,De,p);if(n(Ce,u[0],u[1]),n(Re,u[2],u[1]),n(we,u[2],u[3]),n(Ae,u[0],u[3]),0!==c){const e=t(c);n(Oe,s,r),o(Ce,Ce,Oe,e),o(Re,Re,Oe,e),o(we,we,Oe,e),o(Ae,Ae,Oe,e),w(u),A(u,Ce),A(u,Re),A(u,we),A(u,Ae)}return!!B(e,u)&&(H(e,Ce,Re,we)||H(e,Ce,we,Ae))}function ue(e,t,s,r,i,a,n,o,l=!1){let c=e-r-s[0]*n[0],h=c+s[0]+2*r;const f=l?1-n[1]:n[1];let p=t-r-s[1]*f,u=p+s[1]+2*r;const d=a.distanceFieldBoundingBox;return a.textureIsSignedDistanceField&&null!=d&&(c+=s[0]*d[0],p+=s[1]*(l?1-d[3]:d[1]),h-=s[0]*(1-d[2]),u-=s[1]*(l?d[1]:1-d[3]),c-=i,h+=i,p-=i,u+=i),o[0]=c,o[1]=p,o[2]=h,o[3]=u,o}const de=new q,me=y(),ge=y(),Se=C(),xe=s(),be=y(),ve=h(),Oe=h(),ze=i(),ye=y(),Pe=y(),Ve=C(),De=R(),Ce=h(),Re=h(),we=h(),Ae=h(),je=h();class Ue{constructor(){this.renderScreenPosition=y(),this.screenSize=h(),this.centerView=y(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}class Me{constructor(){this.x=0,this.y=0,this.screenSize=h(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=h()}}const _e=new Ue,Te=new Me,Le={normal:y(),cosAngle:0},Ie=1,Ee=2,Fe=c(0,0),Be=P(0,0,1);class He extends I{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=D,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=D,this.outlineSize=0,this.distanceFieldBoundingBox=C(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ne{constructor(e){this.baseInstanceLayout=se,this.layout=re(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r){if(null==r)return;const{buffer:i,offset:a}=r,{position:n,normal:o,color:l,size:c,rotation:h,centerOffset:f,groundDistance:p,featureAttribute:u,uvi:d,olidColor:m}=i;X(s.get("position"),e,n,a),Y(s.get("normal"),t,o,a);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const n=a+e;d.setValues(n,t,s,r,i)}}}if(l&&k(s.get("color"),4,l,a),c&&J(s.get("size"),c,a),h&&K(s.get("rotation"),h,a),f&&(s.get("centerOffset")?Q(s.get("centerOffset"),f,a):Z(f,a,g)),s.get("groundDistance")?K(s.get("groundDistance"),p,a):Z(p,a,g),u&&(s.get("featureAttribute")?$(s.get("featureAttribute"),u,a):Z(u,a,g)),null!=m){const e=s.get("olidColor");null!=e?k(e,4,m,a):Z(m,a,g)}}writeBaseInstance(e,t){const{uv0:s}=t;J(e.get("uv0"),s,0)}}function Ge(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(j(Pe,t,e),{scaleX:Pe[0]*s,scaleY:Pe[1]*s})}function qe(e,t){const s=t.computeRenderPixelSizeAtDist(e)*L;return(t.aboveGround?1:-1)*s}function We(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=p(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=p(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=ee(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{oe as HUDMaterial,He as Parameters};
2
+ import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{copy as n,set as a,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as p,length as h,scale as u,distance as m,transformMat4 as d,set as g,normalize as S,subtract as x,transformMat3 as v,scaleAndAdd as b,sub as O,dot as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as z,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as P,create as D}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as C,empty as R,expandPointInPlace as w}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec3f as A}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as j}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as U}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as _,isOIT as T}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{getVec3AttributeView as L,getVec2AttributeView as I,getScalarAttributeView as E,getVec4AttributeView as B}from"../lib/attributeViewUtils.js";import{GLTextureMaterialBindParameters as H,GLTextureMaterial as N}from"../lib/GLTextureMaterial.js";import{PointMaterial as q}from"../lib/PointMaterial.js";import{screenPolygonIntersectsBounds as G,screenPolygonIntersectsTriangle as W}from"../lib/screenPolygonOverlapUtils.js";import{DrapedHit as X,Hit as Y}from"../lib/screenPolygonTriangleIntersections.js";import{SeparateScreenSizePerspectiveEvaluators as k}from"../lib/screenSizePerspectiveUtils.js";import{assert as J}from"../lib/Util.js";import{writePosition as K,writeNormal as Q,writeColor as Z,writeBufferVec2 as $,writeBufferFloat as ee,writeBufferVec3 as te,writeBufferZeros as re,writeBufferVec4 as ie}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as se}from"./internal/MaterialUtil.js";import{a as ne}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as ae,getInstanceLayout as oe,HUDMaterialTechnique as le}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ce}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as fe}from"../../../../webscene/support/AlphaCutoff.js";class pe extends q{constructor(e,t,r=!1){super(e,We),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ce(t,r)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this,i=t.draped;r.enableOITOffset=e.enableOITOffset,r.hasSlicePlane=this.parameters.hasSlicePlane,r.hasVerticalOffset=!!this.parameters.verticalOffset,r.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,r.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,r.polygonOffset=this.parameters.polygonOffset,r.draped=i,r.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,r.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,r.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,r.hasRotation=this.parameters.hasRotation,r.hasVVSize=!!this.parameters.vvSize,r.hasVVColor=!!this.parameters.vvColor,r.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,r.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,r.depthTestEnabled=this.parameters.depthEnabled,r.hasVertexColor=this.parameters.hasVertexColor,r.hasVertexSize=this.parameters.hasVertexSize,r.hasVertexRotation=this.parameters.hasVertexRotation,r.hasVertexUVi=this.parameters.hasVertexUVi,r.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e.output)&&(r.debugDrawLabelBorder=!!U.LABELS_SHOW_BORDER),r.hasOcclusionTexture=!t.drawAsLabel&&r.transparentOccluded&&T(e.output)}intersectRay(e,t,r,i,s,n){const{options:{selectionMode:a,hud:o,excludeLabels:l},point:c,camera:f}=r,{parameters:g}=this;if(a&&o&&(!l||!g.isLabel)&&e.visible&&c&&f)for(const{renderScreenPosition:S,screenSize:x,pixelRatioTolerance:v,halfOutlineSize:b,rotationAngle:O,anchor:y,centerView:V}of this._forEachScreenSpaceHUDInstance(Ie,e,t,f))if(de(c,S[0],S[1],x,v,b,O,g,y)){const e=r.ray;if(ye[0]=c[0],ye[1]=c[1],ye[2]=S[2],f.unprojectFromRenderScreen(ye,ve)){const t=z();p(t,e.direction);const r=1/h(t);u(t,t,r);const i=m(e.origin,ve)*r,s=z();d(s,V,f.inverseViewMatrix),n(i,i,t,-1,s)}}}*_forEachScreenSpaceHUDInstance(e,t,r,s){const{parameters:a}=this,o=L(t,"position"),l=I(t,"size"),c=L(t,"normal"),f=E(t,"rotation"),h=L(t,"centerOffset"),m=B(t,"featureAttribute"),O=a.size,y=i(De,r),z="screen"===a.centerOffsetUnits;for(let i=0;i<o.count;i++){const t=m?.getVec(i,we)??null,{scaleX:V,scaleY:P}=Ye(t,a,s.pixelRatio);if(o.getVec(i,ve),d(ve,ve,r),d(ve,ve,s.viewMatrix),h?h.getVec(i,Ce):g(Ce,0,0,0),!z&&(ve[0]+=Ce[0],ve[1]+=Ce[1],0!==Ce[2])){const e=Ce[2];S(Ce,ve),x(ve,ve,u(Ce,Ce,e))}c.getVec(i,be),v(be,be,y);const{normal:D,cosAngle:C}=me(be,s,Be),R=Je(a,ve,C,s,xe);if(b(ve,ve,D,R),s.applyProjection(ve,Oe),Oe[0]>-1){z&&(Ce[0]||Ce[1])&&(Oe[0]+=Ce[0]*s.pixelRatio,0!==Ce[1]&&(Oe[1]+=xe.alignmentEvaluator.apply(Ce[1])*s.pixelRatio),s.unapplyProjection(Oe,ve)),Oe[0]+=a.screenOffset[0]*s.pixelRatio,Oe[1]+=a.screenOffset[1]*s.pixelRatio,Oe[0]=Math.floor(Oe[0]),Oe[1]=Math.floor(Oe[1]),qe[0]=O[0],qe[1]=O[1],null!=l&&(qe[0]*=l.get(i,0),qe[1]*=l.get(i,1)),xe.evaluator.applyVec2(qe,qe);let t=0;if(a.textureIsSignedDistanceField){t=Math.min(a.outlineSize,.5*qe[0])*s.pixelRatio/2}qe[0]*=V,qe[1]*=P,p(e.centerView,ve),g(e.renderScreenPosition,Oe[0],Oe[1],Oe[2]),n(e.screenSize,qe),e.pixelRatioTolerance=He*s.pixelRatio,e.halfOutlineSize=t,e.rotationAngle=a.rotation+(f?.get(i)??0),e.anchor=ne(a),yield e}}}*_forEachDrapedHUDInstance(e,t,r){const i=L(t,"position"),s=I(t,"size"),a=E(t,"rotation"),o=B(t,"featureAttribute"),l=this.parameters,c=l.size;e.pixelRatioTolerance=Ne*r,e.anchor=ne(l);for(let f=0;f<i.count;f++){const t=o?.getVec(f,we)??null,{scaleX:p,scaleY:h}=Ye(t,l,r);if(e.x=i.get(f,0),e.y=i.get(f,1),qe[0]=c[0],qe[1]=c[1],null!=s&&(qe[0]*=s.get(f,0),qe[1]*=s.get(f,1)),e.halfOutlineSize=0,l.textureIsSignedDistanceField){const t=Math.min(l.outlineSize,.5*qe[0]);e.halfOutlineSize=t*r/2}qe[0]*=p,qe[1]*=h,n(e.screenSize,qe),e.rotationAngle=l.rotation+(a?.get(f)??0),yield e}}intersectRayDraped(e,t,r,i,s,n){const a=this.parameters;for(const{x:o,y:l,screenSize:c,pixelRatioTolerance:f,halfOutlineSize:p,rotationAngle:h,anchor:u}of this._forEachDrapedHUDInstance(Ee,e,n))de(r,o,l,c,f,p,h,a,u)&&i(s.distance,s.renderDistance,s.normal,-1)}intersectScreenPolygonDraped(e,t,r,i,s){if(!r.options.selectionMode||r.options.excludeLabels&&this.parameters.isLabel)return null;const n=this.parameters;for(const{x:a,y:o,screenSize:l,pixelRatioTolerance:c,halfOutlineSize:f,rotationAngle:p,anchor:h}of this._forEachDrapedHUDInstance(Ee,e,s))if(ge(i,a+t[0],o+t[1],l,c,f,p,n,h,!1))return new X(-1);return null}intersectScreenPolygon(e,t,r,i){const{options:{selectionMode:s,hud:n,excludeLabels:a},camera:o}=r,{parameters:l}=this;if(!s||!n||a&&l.isLabel||!e.visible||null==t)return null;const c=new Y(1),f=1/o.pixelRatio;for(const{renderScreenPosition:p,screenSize:h,pixelRatioTolerance:u,halfOutlineSize:g,rotationAngle:S,anchor:x,centerView:v}of this._forEachScreenSpaceHUDInstance(Ie,e,t,o)){const e=d(ve,v,o.inverseViewMatrix);if(!r.screenPolygonPrimitiveProcessor?.validatePoint(e))continue;const t=p[0]*f,s=(o.fullHeight-p[1])*f;if(Te[0]=h[0]*f,Te[1]=h[1]*f,ge(i,t,s,Te,u*f,g*f,S,l,x,!0)){const t=m(o.eye,e);c.updateIfCloserFromValues(t,-1,e,null)}}return c.valid?c:null}createBufferWriter(){return new Xe(this.parameters)}createPrimitivePositionReader(e,t){J(null!=t,"HUD geometry requires instancing");const r=e.vertex.getField("position",A);return e=>r.getVec(0,e)}applyShaderOffsets(e,t,r,s,n,a,o,l){v(ze,r,i(De,s));const c=me(ze,o,Be),f=ke(h(t),o),p=Je(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,p+f),b(e,e,ze,p+f);const u=a+p;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,n,t)}applyShaderOffsetsNDC(e,t,r,i,s,n){return this._applyCenterOffsetNDC(e,t,i,s),null!=n&&p(n,s),this._applyPolygonOffsetNDC(s,r,i,s),s}_applyPolygonOffsetView(t,r,i,s,n){const a=s.aboveGround?1:-1;let o=Math.sign(i);0===o&&(o=a);const l=a*o;if(this.parameters.shaderPolygonOffset<=0)return p(n,t);const c=e(Math.abs(r.cosAngle),.01,1),f=1-Math.sqrt(1-c*c)/c/s.viewport[2];return u(n,t,l>0?f:1/f),n}_applyCenterOffsetView(e,t,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&p(r,e),i&&(r[0]+=t[0],r[1]+=t[1],t[2]&&(S(be,r),O(r,r,u(be,be,t[2])))),r}_applyCenterOffsetNDC(e,t,r,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&p(i,e),s||(i[0]+=t[0]/r.fullWidth*2,i[1]+=t[1]/r.fullHeight*2),i}_applyPolygonOffsetNDC(e,t,r,i){const s=this.parameters.shaderPolygonOffset;if(e!==i&&p(i,e),s){const e=r.aboveGround?1:-1,n=e*Math.sign(t);i[2]-=(n||e)*s}return i}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:r}=this.parameters,i=e[3]>=fe||t>=fe&&r[3]>=fe;return this._visible&&i}createGLMaterial(e){return new he(e)}calculateRelativeScreenBounds(e,t,r=C()){return ue(this.parameters,e,t,r),r[2]=r[0]+e[0],r[3]=r[1]+e[1],r}}class he extends N{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(le,e)}}function ue(e,t,r,i){i[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*r,i[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*r}function me(e,t,r){return d(r.normal,e,t.viewInverseTransposeMatrix),r.cosAngle=y(r.normal,Ge),r}function de(e,r,i,s,n,l,c,f,p){const h=Se(r,i,s,n,l,f,p,Ae);return a(Pe,r,i),o(Ve,e,Pe,t(c)),Ve[0]>h[0]&&Ve[0]<h[2]&&Ve[1]>h[1]&&Ve[1]<h[3]}function ge(e,r,i,s,n,l,c,f,p,h){const u=Se(r,i,s,n,l,f,p,Ae,h);if(a(je,u[0],u[1]),a(Ue,u[2],u[1]),a(Me,u[2],u[3]),a(_e,u[0],u[3]),0!==c){const e=t(c);a(Pe,r,i),o(je,je,Pe,e),o(Ue,Ue,Pe,e),o(Me,Me,Pe,e),o(_e,_e,Pe,e),R(u),w(u,je),w(u,Ue),w(u,Me),w(u,_e)}return!!G(e,u)&&(W(e,je,Ue,Me)||W(e,je,Me,_e))}function Se(e,t,r,i,s,n,a,o,l=!1){let c=e-i-r[0]*a[0],f=c+r[0]+2*i;const p=l?1-a[1]:a[1];let h=t-i-r[1]*p,u=h+r[1]+2*i;const m=n.distanceFieldBoundingBox;return n.textureIsSignedDistanceField&&null!=m&&(c+=r[0]*m[0],h+=r[1]*(l?1-m[3]:m[1]),f-=r[0]*(1-m[2]),u-=r[1]*(l?m[1]:1-m[3]),c-=s,f+=s,h-=s,u+=s),o[0]=c,o[1]=h,o[2]=f,o[3]=u,o}const xe=new k,ve=z(),be=z(),Oe=D(),ye=r(),ze=z(),Ve=f(),Pe=f(),De=s(),Ce=z(),Re=z(),we=D(),Ae=C(),je=f(),Ue=f(),Me=f(),_e=f(),Te=f();class Fe{constructor(){this.renderScreenPosition=z(),this.screenSize=f(),this.centerView=z(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}class Le{constructor(){this.x=0,this.y=0,this.screenSize=f(),this.pixelRatioTolerance=0,this.halfOutlineSize=0,this.rotationAngle=0,this.anchor=f()}}const Ie=new Fe,Ee=new Le,Be={normal:z(),cosAngle:0},He=1,Ne=2,qe=c(0,0),Ge=V(0,0,1);class We extends H{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=P,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=P,this.outlineSize=0,this.distanceFieldBoundingBox=D(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Xe{constructor(e){this.baseInstanceLayout=ae,this.layout=oe(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,r,i){if(null==i)return;const{buffer:s,offset:n}=i,{position:a,normal:o,color:l,size:c,rotation:f,centerOffset:p,groundDistance:h,featureAttribute:u,uvi:m,olidColor:d}=s;K(r.get("position"),e,a,n),Q(r.get("normal"),t,o,n);const g=r.get("position").indices.length;if(m){const e=r.get("uvi")?.data;if(e&&e.length>=4){const[t,r,i,s]=e;for(let e=0;e<g;++e){const a=n+e;m.setValues(a,t,r,i,s)}}}if(l&&Z(r.get("color"),4,l,n),c&&$(r.get("size"),c,n),f&&ee(r.get("rotation"),f,n),p&&(r.get("centerOffset")?te(r.get("centerOffset"),p,n):re(p,n,g)),r.get("groundDistance")?ee(r.get("groundDistance"),h,n):re(h,n,g),u&&(r.get("featureAttribute")?ie(r.get("featureAttribute"),u,n):re(u,n,g)),null!=d){const e=r.get("olidColor");null!=e?Z(e,4,d,n):re(d,n,g)}}writeBaseInstance(e,t){const{uv0:r}=t;$(e.get("uv0"),r,0)}rebaseBuffers(e,t){if(null==t)return;const{buffer:r,offset:i}=t;r.copyFrom(e.vertex,0,i)}}function Ye(e,t,r){return null==e||null==t.vvSize?{scaleX:r,scaleY:r}:(j(Re,t,e),{scaleX:Re[0]*r,scaleY:Re[1]*r})}function ke(e,t){const r=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*r}function Je(e,t,r,i,s){if(!e.verticalOffset?.screenLength){const i=h(t);return s.update(r,i,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const n=h(t),a=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=se(i,n,e.verticalOffset,r,a,e.screenSizePerspectiveMinPixelReferenceSize);return s.update(r,n,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{pe as HUDMaterial,We as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Attribute as t}from"../lib/Attribute.js";import{GeometryBaseInstance as n}from"../lib/GeometryBaseInstance.js";function e(){return o??=r(),o}function r(){const e=0,r=255,o=new t([e,e,e,r,r,e,r,r],[0,1,2,3],2,!0);return new n([["uv0",o]])}let o=null;export{e as getHUDMaterialBaseInstance};
2
+ import{Attribute as e}from"../lib/Attribute.js";import{BufferGeometryBaseInstance as t}from"../lib/BufferGeometryBaseInstance.js";import{Buffers as r}from"../lib/Buffers.js";import{GeometryBaseInstance as n}from"../lib/GeometryBaseInstance.js";import{baseLayout as u}from"../shaders/HUDMaterialTechnique.js";function s(){return l??=i(),l}function o(){return a??=f(),a}function i(){const t=0,r=255,u=new e([t,t,t,r,r,t,r,r],[0,1,2,3],2,!0);return new n([["uv0",u]])}function f(){const e=0,n=255,s=u.createBuffer(4);return s.uv0.setValues(0,e,e),s.uv0.setValues(1,e,n),s.uv0.setValues(2,n,e),s.uv0.setValues(3,n,n),new t(new r(s))}let l=null,a=null;export{s as getHUDMaterialBaseInstance,o as getHUDMaterialBufferBaseInstance};