@arcgis/core 5.2.0-next.153 → 5.2.0-next.154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcade/containerUtils.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/portal.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcgisGlobal.d.ts +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/05b34302da58e8244da3.js +1 -0
- package/assets/esri/core/workers/chunks/47e250d471d0e55fa6be.js +1 -0
- package/assets/esri/core/workers/chunks/{a07cb6a2f5b66d4e9f15.js → 53e2f2b922116a45fe8f.js} +1 -1
- package/assets/esri/core/workers/chunks/{dc486a3595b6d57018bb.js → 5bfea0c55aca826de536.js} +1 -1
- package/assets/esri/core/workers/chunks/67ebc5a3d46b254b725c.js +1 -0
- package/assets/esri/core/workers/chunks/{6e62581d933e7298d1f6.js → 6f4e6022a52de0c54aab.js} +1 -1
- package/assets/esri/core/workers/chunks/{8c4e0a7384e40979cb42.js → 7e0cf70c0eb5a2ddfcec.js} +1 -1
- package/assets/esri/core/workers/chunks/{3cc43ae56779a9f97f77.js → 917f53833b853898facc.js} +1 -1
- package/assets/esri/core/workers/chunks/{9232f57623e1fa3ccabc.js → be5f92e98d09d6e6e38e.js} +1 -1
- package/assets/esri/core/workers/chunks/{a7f3576208f295b670d6.js → c19cd5a03b6d480fe53b.js} +1 -1
- package/assets/esri/core/workers/chunks/d33360c4f85203edafff.js +1 -0
- package/assets/esri/core/workers/chunks/{dca35dbe427605ef6fcc.js → e01aeac34474540f61ee.js} +1 -1
- package/assets/esri/core/workers/chunks/{b19b6102ed2d6f67b43b.js → e15ba90af0faf873b42d.js} +1 -1
- package/assets/esri/core/workers/chunks/eb815148ae65388dd733.js +1 -0
- package/assets/esri/core/workers/chunks/ee6679ef9efa1504e7eb.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +2 -2
- package/chunks/portal.js +1 -1
- package/config.js +1 -1
- package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
- package/geometry/support/meshUtils.d.ts +5 -6
- package/interfaces.d.ts +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/GeospatialPDFLayer.d.ts +154 -4
- package/layers/Layer.d.ts +2 -0
- package/layers/SketchLayer.d.ts +4 -2
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/geospatialPDF/projectionToWKTUtils.js +2 -2
- package/layers/support/LabelClass.d.ts +3 -2
- package/layers/support/PortalItemData.d.ts +31 -8
- package/layers/support/{TimeSeriesCalculation.d.ts → TimeSeriesCalculationMethod.d.ts} +6 -6
- package/layers/support/{TimeSeriesCalculation.js → TimeSeriesCalculationMethod.js} +1 -1
- package/layers/support/TimeSeriesInfo.d.ts +5 -5
- package/layers/support/TimeSeriesInfo.js +1 -1
- package/layers/support/timeSeriesUtils.d.ts +6 -2
- package/layers/support/timeSeriesUtils.js +1 -1
- package/layers/support/types.d.ts +4 -1
- package/package.json +2 -2
- package/smartMapping/renderers/support/timeSeriesUtils.js +1 -1
- package/smartMapping/statistics/support/timeSeriesUtils.js +1 -1
- package/views/2d/engine/webgl/GlyphWorker.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/projection.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/raster/Projection.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/draw/plugins/MultipointPlugin.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/assets/esri/core/workers/chunks/21f45a47708e6e43147f.js +0 -1
- package/assets/esri/core/workers/chunks/2ecfaa715863216f0faf.js +0 -1
- package/assets/esri/core/workers/chunks/3e8eb158320f0e4ce1b6.js +0 -1
- package/assets/esri/core/workers/chunks/7320a4913b6cad7cc5d7.js +0 -1
- package/assets/esri/core/workers/chunks/9e142551163acf752618.js +0 -1
- package/assets/esri/core/workers/chunks/f095cf98940e3f95d51e.js +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type Extent from "../geometry/Extent.js";
|
|
1
2
|
import type SpatialReference from "../geometry/SpatialReference.js";
|
|
2
3
|
import type Layer from "./Layer.js";
|
|
3
4
|
import type TileInfo from "./support/TileInfo.js";
|
|
@@ -7,21 +8,170 @@ import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleR
|
|
|
7
8
|
import type { GeospatialPDFDataUnion } from "./support/types.js";
|
|
8
9
|
import type { LayerProperties } from "./Layer.js";
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Properties used to construct a [GeospatialPDFLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/).
|
|
13
|
+
*
|
|
14
|
+
* @since 5.2
|
|
15
|
+
*/
|
|
10
16
|
export interface GeospatialPDFLayerProperties extends LayerProperties, ScaleRangeLayerProperties, BlendLayerProperties, Partial<Pick<GeospatialPDFLayer, "clippedToNeatline" | "data">> {}
|
|
11
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Displays a geospatial PDF document as georeferenced raster imagery.
|
|
20
|
+
* A geospatial PDF contains information that relates locations on a PDF page to real-world coordinates.
|
|
21
|
+
* This allows a map distributed as a PDF, such as a topographic map, to be displayed alongside other geographic data
|
|
22
|
+
* without manually specifying its location.
|
|
23
|
+
*
|
|
24
|
+
* To create a GeospatialPDFLayer, set the [data](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/#data) property to a PDF URL, a browser [File](https://developer.mozilla.org/en-US/docs/Web/API/File), or a [PortalItemData](https://developers.arcgis.com/javascript/latest/references/core/layers/support/PortalItemData/).
|
|
25
|
+
* Remote PDF URLs must be accessible to the application and comply with the browser's [cross-origin request restrictions](https://developers.arcgis.com/javascript/latest/cors/).
|
|
26
|
+
* The document is downloaded and rendered on the client; publishing an image service is not required.
|
|
27
|
+
* The first page of the PDF is used for georeferencing and rendering.
|
|
28
|
+
* The entire document is downloaded before rendering; large or complex PDFs can increase load time and memory usage.
|
|
29
|
+
* The layer derives its [spatial reference](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/#spatialReference) and
|
|
30
|
+
* [extent](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/#fullExtent) from the embedded georeferencing information.
|
|
31
|
+
* The rendered imagery can be reprojected to the spatial reference of the view. In an scene, it is draped on the ground.
|
|
32
|
+
*
|
|
33
|
+
* Additionally the PDF defines the boundary of the georeferenced map within the page, called a *neatline*.
|
|
34
|
+
* Set [clippedToNeatline](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/#clippedToNeatline) to `true` to hide content outside this boundary, such as page margins, legends, and titles.
|
|
35
|
+
*
|
|
36
|
+
* The [arcgis-print](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-print/) component can generate geospatial PDFs.
|
|
37
|
+
* When creating PDFs in ArcGIS Pro, enable "Export georeference information".
|
|
38
|
+
* Merely exporting a map to PDF does not guarantee that the resulting document contains georeferencing.
|
|
39
|
+
* See [Export to PDF](https://pro.arcgis.com/en/pro-app/latest/help/sharing/overview/pdf-export.htm) for export settings.
|
|
40
|
+
*
|
|
41
|
+
* > [!WARNING]
|
|
42
|
+
* >
|
|
43
|
+
* > **Known Limitations**
|
|
44
|
+
* >
|
|
45
|
+
* > - Documents that require a password to open are not supported.
|
|
46
|
+
* > - Tile reprojection is limited: grid-based transformations are not supported. As a result, the layer may still display but appear shifted. See the [project operator's known limitations](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/).
|
|
47
|
+
* > - To decode certain image types from PDF files, GeospatialPDFLayer is using WebAssembly features not available yet in Safari. As a result it uses a slower JavaScript fallback which impact the initial load of the layer.
|
|
48
|
+
* > - Not supported by the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/).
|
|
49
|
+
*
|
|
50
|
+
* @beta
|
|
51
|
+
* @since 5.2
|
|
52
|
+
* @see [PortalItemData](https://developers.arcgis.com/javascript/latest/references/core/layers/support/PortalItemData/)
|
|
53
|
+
* @see [GeospatialPDFDataUnion](https://developers.arcgis.com/javascript/latest/references/core/layers/support/types/#GeospatialPDFDataUnion)
|
|
54
|
+
* @see [GeospatialPDFLayer with a local file](https://developers.arcgis.com/javascript/latest/sample-code/layers-geospatialpdf/) sample
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import GeospatialPDFLayer from "@arcgis/core/layers/GeospatialPDFLayer.js";
|
|
58
|
+
*
|
|
59
|
+
* // Replace this URL with a georeferenced PDF.
|
|
60
|
+
* const layer = new GeospatialPDFLayer({
|
|
61
|
+
* data: "https://jsapi.maps.arcgis.com/sharing/rest/content/items/0d8613492b1e4598a5edb111f05be7fd/data",
|
|
62
|
+
* clippedToNeatline: true
|
|
63
|
+
* });
|
|
64
|
+
* // viewElement is an existing arcgis-map or arcgis-scene component.
|
|
65
|
+
* await viewElement.viewOnReady();
|
|
66
|
+
* viewElement.map.add(layer);
|
|
67
|
+
* ```
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import GeospatialPDFLayer from "@arcgis/core/layers/GeospatialPDFLayer.js";
|
|
71
|
+
* import PortalItemData from "@arcgis/core/layers/support/PortalItemData.js";
|
|
72
|
+
*
|
|
73
|
+
* const layer = new GeospatialPDFLayer({
|
|
74
|
+
* data: new PortalItemData({
|
|
75
|
+
* portalItem: {
|
|
76
|
+
* id: "0d8613492b1e4598a5edb111f05be7fd"
|
|
77
|
+
* }
|
|
78
|
+
* })
|
|
79
|
+
* });
|
|
80
|
+
* // viewElement is an existing arcgis-map or arcgis-scene component.
|
|
81
|
+
* await viewElement.viewOnReady();
|
|
82
|
+
* viewElement.map.add(layer);
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
12
85
|
export default class GeospatialPDFLayer extends GeospatialPDFLayerSuperclass {
|
|
13
86
|
constructor(properties?: GeospatialPDFLayerProperties);
|
|
14
87
|
/**
|
|
15
|
-
*
|
|
88
|
+
* Indicates whether to hide PDF content outside the georeferenced map's neatline.
|
|
89
|
+
* A neatline is the boundary of the map within the PDF page. When `true`, content outside that boundary
|
|
90
|
+
* is masked out. When `false`, the entire page is displayed, including margins and other layout elements.
|
|
16
91
|
*
|
|
17
92
|
* @default false
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* layer.clippedToNeatline = true;
|
|
96
|
+
* ```
|
|
18
97
|
*/
|
|
19
98
|
accessor clippedToNeatline: boolean;
|
|
20
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* The data source of the `GeospatialPDFLayer`.
|
|
101
|
+
*
|
|
102
|
+
* Specify one of the following before loading the layer:
|
|
103
|
+
* - A string containing the URL of a geospatial PDF.
|
|
104
|
+
* - A browser [File](https://developer.mozilla.org/en-US/docs/Web/API/File), for example from a file input.
|
|
105
|
+
* - A [PortalItemData](https://developers.arcgis.com/javascript/latest/references/core/layers/support/PortalItemData/) instance referencing a portal item whose
|
|
106
|
+
* [url](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/#url) resolves to a geospatial PDF.
|
|
107
|
+
*
|
|
108
|
+
* @see [GeospatialPDFDataUnion](https://developers.arcgis.com/javascript/latest/references/core/layers/support/types/#GeospatialPDFDataUnion)
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* import GeospatialPDFLayer from "@arcgis/core/layers/GeospatialPDFLayer.js";
|
|
112
|
+
*
|
|
113
|
+
* // Replace this URL with an accessible georeferenced PDF.
|
|
114
|
+
* const layer = new GeospatialPDFLayer({
|
|
115
|
+
* data: "https://jsapi.maps.arcgis.com/sharing/rest/content/items/0d8613492b1e4598a5edb111f05be7fd/data",
|
|
116
|
+
* clippedToNeatline: true
|
|
117
|
+
* });
|
|
118
|
+
* // viewElement is an existing arcgis-map or arcgis-scene component.
|
|
119
|
+
* await viewElement.viewOnReady();
|
|
120
|
+
* viewElement.map.add(layer);
|
|
121
|
+
* ```
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* import GeospatialPDFLayer from "@arcgis/core/layers/GeospatialPDFLayer.js";
|
|
125
|
+
* import PortalItemData from "@arcgis/core/layers/support/PortalItemData.js";
|
|
126
|
+
*
|
|
127
|
+
* const layer = new GeospatialPDFLayer({
|
|
128
|
+
* data: new PortalItemData({
|
|
129
|
+
* portalItem: {
|
|
130
|
+
* id: "0d8613492b1e4598a5edb111f05be7fd"
|
|
131
|
+
* }
|
|
132
|
+
* }),
|
|
133
|
+
* clippedToNeatline: true
|
|
134
|
+
* });
|
|
135
|
+
* // viewElement is an existing arcgis-map or arcgis-scene component.
|
|
136
|
+
* await viewElement.viewOnReady();
|
|
137
|
+
* viewElement.map.add(layer);
|
|
138
|
+
* ```
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* import GeospatialPDFLayer from "@arcgis/core/layers/GeospatialPDFLayer.js";
|
|
142
|
+
*
|
|
143
|
+
* // file is a File obtained from a file input or drag-and-drop.
|
|
144
|
+
* const layer = new GeospatialPDFLayer({
|
|
145
|
+
* data: file,
|
|
146
|
+
* clippedToNeatline: true
|
|
147
|
+
* });
|
|
148
|
+
* // viewElement is an existing arcgis-map or arcgis-scene component.
|
|
149
|
+
* await viewElement.viewOnReady();
|
|
150
|
+
* viewElement.map.add(layer);
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
21
153
|
accessor data: GeospatialPDFDataUnion | null | undefined;
|
|
22
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* The full extent of the layer.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* await viewElement.viewOnReady();
|
|
160
|
+
* await layer.load();
|
|
161
|
+
* if (layer.fullExtent) {
|
|
162
|
+
* await viewElement.goTo(layer.fullExtent);
|
|
163
|
+
* }
|
|
164
|
+
* ```
|
|
165
|
+
* @example
|
|
166
|
+
* // Once the layer loads, set the view's extent to the layer's full extent
|
|
167
|
+
* layer.when(function(){
|
|
168
|
+
* view.extent = layer.fullExtent;
|
|
169
|
+
* });
|
|
170
|
+
*/
|
|
171
|
+
get fullExtent(): Extent | null | undefined;
|
|
172
|
+
/** The spatial reference of the layer derived from the georeferencing information found in the PDF. */
|
|
23
173
|
get spatialReference(): SpatialReference;
|
|
24
|
-
/**
|
|
174
|
+
/** Contains information about the tiling scheme for the layer used to render the PDF as raster tiles. */
|
|
25
175
|
get tileInfo(): TileInfo | null | undefined;
|
|
26
176
|
/** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
|
|
27
177
|
get type(): "geospatial-pdf";
|
package/layers/Layer.d.ts
CHANGED
|
@@ -142,6 +142,7 @@ export interface FromArcGISServerUrlParameters {
|
|
|
142
142
|
* [WMTSLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WMTSLayer/) | WMTS tile services, ArcGIS portal item | Image tiles | OGC specification | N/A
|
|
143
143
|
* [WebTileLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/WebTileLayer/) | non-ArcGIS, non-OGC, and non-OSM tile services | Image tiles | N/A | No editing, client-side rendering, or popup templates.
|
|
144
144
|
* [BingMapsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/BingMapsLayer/) | Bing Spatial Data Service data | Image tiles | Displays Microsoft's Bing tiled content | Bing Maps key is required; three map styles are supported: `road`, `aerial`, and `hybrid`
|
|
145
|
+
* [GeospatialPDFLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/) | PDF File, ArcGIS portal item | PDF documents | Displays a geospatial PDF document as georeferenced raster imagery | Documents that require a password to open are not supported
|
|
145
146
|
* [MediaLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/MediaLayer/) | HTMLVideoElement, HTMLImageElement, or HTMLCanvasElement | Image/video element | Displays image and video elements in the map at specified geographic locations | GIF/APNG not currently
|
|
146
147
|
* [VideoLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/VideoLayer/) | ArcGIS VideoServer, ArcGIS portal item | Video | Displays a georeferenced video in the map | No 3D support
|
|
147
148
|
*
|
|
@@ -263,6 +264,7 @@ export default abstract class Layer extends LayerSuperclass {
|
|
|
263
264
|
* > **Known Limitations**
|
|
264
265
|
* >
|
|
265
266
|
* > - This method does not currently work with [OGCFeatureServer portal items](https://developers.arcgis.com/rest/users-groups-and-items/items-and-item-types/#layers).
|
|
267
|
+
* > - This method does not currently work with [GeospatialPDFLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/)
|
|
266
268
|
*
|
|
267
269
|
* @param params - The parameters for loading the portal item.
|
|
268
270
|
* @returns Returns a promise which resolves to the new layer instance.
|
package/layers/SketchLayer.d.ts
CHANGED
|
@@ -37,8 +37,9 @@ export interface SketchLayerProperties extends LayerProperties, PortalLayerPrope
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* The SketchLayer lets you display and modify sketches (features sketched on a web map) from the
|
|
40
|
-
* [Map Viewer](https://www.arcgis.com/apps/mapviewer/index.html). A new SketchLayer can also be
|
|
41
|
-
*
|
|
40
|
+
* [Map Viewer](https://www.arcgis.com/apps/mapviewer/index.html). A new SketchLayer can also be used with the
|
|
41
|
+
* [Sketch component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-sketch/)
|
|
42
|
+
* or the [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/) in a 2D [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/).
|
|
42
43
|
*
|
|
43
44
|
* Sketches belong to the [graphics](https://developers.arcgis.com/javascript/latest/references/core/layers/SketchLayer/#graphics) collection. Each graphic can have its own
|
|
44
45
|
* popup template, geometry, and symbol.
|
|
@@ -104,6 +105,7 @@ export interface SketchLayerProperties extends LayerProperties, PortalLayerPrope
|
|
|
104
105
|
* ```
|
|
105
106
|
*
|
|
106
107
|
* @since 5.2
|
|
108
|
+
* @beta
|
|
107
109
|
* @see [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/)
|
|
108
110
|
* @see [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/)
|
|
109
111
|
* @see [SketchViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/Sketch/SketchViewModel/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this.inputValidation(e);this._bbox=t,this._bounds=n,this._gpts=r,this._lpts=i,this._gcs=c,this.outerExtentMediaBox=a(l),this.geoControlPoints=this._getProjectedGeoControlPoints().map(e=>[e[0],e[1]]);let u=this._getBoundsPolygonPage()??this._getPageControlPoints();this.pairedNeatline=u.map(e=>[e[0],e[1]]),this.neatLine=this.pairedNeatline.flat(),this._georeference=this._createControlPointsGeoreference();let d=o(this._georeference);this.ctm=s(d),this.outputValidation()}toSpatialReference(){return new r({wkt:
|
|
2
|
+
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this.inputValidation(e);this._bbox=t,this._bounds=n,this._gpts=r,this._lpts=i,this._gcs=c,this.outerExtentMediaBox=a(l),this.geoControlPoints=this._getProjectedGeoControlPoints().map(e=>[e[0],e[1]]);let u=this._getBoundsPolygonPage()??this._getPageControlPoints();this.pairedNeatline=u.map(e=>[e[0],e[1]]),this.neatLine=this.pairedNeatline.flat(),this._georeference=this._createControlPointsGeoreference();let d=o(this._georeference);this.ctm=s(d),this.outputValidation()}toSpatialReference(){let t=this._gcs;if(t?.WKT)return new r({wkt:t.WKT});if(t?.EPSG!=null)return new r({wkid:t.EPSG});throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame missing WKT or EPSG.`)}inputValidation(t){let{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}=t;if(!n||n.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid BBox.`);if(!s||s.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid MediaBox.`);if(!i||i.length<6||i.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid GPTS.`);if(!a||a.length<6||a.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid LPTS.`);if(a.length!==i.length)throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame LPTS and GPTS must be same length`);if(!o?.WKT&&!o?.EPSG)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing a WKT or EPSG code.`);return{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}}outputValidation(){if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outer extent from mediaBox.`);if(this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints.`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points.`);if(!this.ctm||this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`Missing or invalid Map Frame CTM`)}_createControlPointsGeoreference(){let e=this._getPageControlPoints(),t=this._getProjectedGeoControlPoints(),n=this._getViewportRect();return c(e,t,this.toSpatialReference(),n)}_getBoundsPolygonLocal(){if(!this._bounds||this._bounds.length<8||this._bounds.length%2!=0)return null;let e=[];for(let t=0;t<this._bounds.length;t+=2)e.push({u:this._bounds[t],v:this._bounds[t+1]});return e}_getBoundsPolygonPage(){return this._getBoundsPolygonLocal()?.map(e=>this._localToPage(e.u,e.v))??null}_getPageControlPoints(){let e=[];for(let t=0;t<this._lpts.length;t+=2){let n=this._lpts[t],r=this._lpts[t+1];e.push(this._localToPage(n,r))}return e}_getProjectedGeoControlPoints(){let e=this.toSpatialReference(),r=[];for(let a=0;a<this._gpts.length;a+=2){let o=this._gpts[a],s=this._gpts[a+1],c=new n({x:s,y:o}),l=i(c,e);r.push(t(l.x,l.y))}return r}_getViewportRect(){let[e,t,n,r]=this._bbox;return{xmin:Math.min(e,n),ymin:Math.min(t,r),xmax:Math.max(e,n),ymax:Math.max(t,r)}}_localToPage(e,n){let[r,i,a,o]=this._bbox;return t(r+e*(a-r),i+n*(o-i))}}export{l as ViewportMeasureFrame};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as n}from"./projectionToWKTUtils.js";import{ViewportMeasureFrame as r}from"./ViewportMeasureFrame.js";function i(i,s=0){let c={mediaBox:_(i.MediaBox),rotate:x(i.Rotate),hasLGIDict:i.LGIDict!=null,hasVP:i.VP!=null},
|
|
2
|
+
import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as n}from"./projectionToWKTUtils.js";import{ViewportMeasureFrame as r}from"./ViewportMeasureFrame.js";function i(i,s=0){let c={mediaBox:_(i.MediaBox),rotate:x(i.Rotate),hasLGIDict:i.LGIDict!=null,hasVP:i.VP!=null};if(c.hasVP){let t=o(i.VP,s);if(!t)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse VP frame at index ${s}`);return{result:c,vpFrame:new r({bbox:t.BBox,bounds:t.Measure?.Bounds,gpts:t.Measure?.GPTS,lpts:t.Measure?.LPTS,gcs:t.Measure?.GCS,mediaBox:_(i.MediaBox)})}}if(c.hasLGIDict){let r=a(i.LGIDict,s);if(!r)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse LGI Dict frame at index ${s}`);if(!r.Projection)throw new e(`geospatial-pdf-layer:parse`,`LGIDict map frame missing Projection.`);let o=n(r.Projection),l;try{l=r.Display?n(r.Display):void 0}catch{l=o}return{result:c,lgiDictFrame:new t({ctm:r.CTM,registration:r.Registration,projection:o,display:l,neatline:r.Neatline,mediaBox:_(i.MediaBox)})}}return{result:c}}function a(e,t){return s(e)[t]}function o(e,t){return c(e)[t]}function s(e){return e==null?[]:Array.isArray(e)?e.map(e=>l(e)):[l(e)]}function c(e){return e==null?[]:Array.isArray(e)?e.map(e=>u(e)):[u(e)]}function l(e){let t=C(e,`LGIDict map frame must be an object.`);return{CTM:_(t.CTM),Registration:v(t.Registration),Neatline:_(t.Neatline),Projection:p(t.Projection),Display:p(t.Display)}}function u(e){let t=C(e,`Viewport frame must be an object.`),n=d(t.Measure);return{BBox:_(t.BBox),Measure_Raw:t.Measure,Measure:n,Raw:t}}function d(e){if(S(e))return{Bounds:_(e.Bounds),GPTS:_(e.GPTS),LPTS:_(e.LPTS),GCS:f(e.GCS)}}function f(e){if(S(e))return{WKT:y(e.WKT),EPSG:x(e.EPSG)}}function p(e){if(S(e))return{Type:b(e.Type),Units:b(e.Units),Datum:m(e.Datum),Projection_Type:b(e.ProjectionType),Central_Meridian:x(e.CentralMeridian),False_Easting:x(e.FalseEasting),False_Northing:x(e.FalseNorthing),Height:x(e.Height),Hemisphere:b(e.Hemisphere),Latitude_One:x(e.LatitudeOne),Latitude_Two:x(e.LatitudeTwo),Latitude_Of_True_Scale:x(e.LatitudeOfTrueScale),Longitude_One:x(e.LongitudeOne),Longitude_Two:x(e.LongitudeTwo),Longitude_Down_From_Pole:x(e.LongitudeDownFromPole),Orientation:b(e.Orientation),Origin_Height:x(e.OriginHeight),Origin_Latitude:x(e.OriginLatitude),Origin_Longitude:x(e.OriginLongitude),Scale_Factor:x(e.ScaleFactor),Standard_Parallel:x(e.StandardParallel),Standard_Parallel_One:x(e.StandardParallelOne),Standard_Parallel_Two:x(e.StandardParallelTwo),Zone:x(e.Zone),Description:b(e.Description),raw:e}}function m(e){return e==null?null:typeof e==`string`?{kind:`name`,name:b(e),ellipsoid:null,to_WGS84:null,raw:e}:S(e)?{kind:`definition`,name:b(e.Description),ellipsoid:h(e.Ellipsoid),to_WGS84:g(e.ToWGS84),raw:e}:{kind:`unknown`,name:b(e),ellipsoid:null,to_WGS84:null,raw:e}}function h(e){if(S(e))return{semi_Major_Axis:x(e.SemiMajorAxis),inverse_Flattening:x(e.InvFlattening),semi_Minor_Axis:x(e.SemiMinorAxis),description:b(e.Description)}}function g(e){if(S(e))return{dx:x(e.dx)??0,dy:x(e.dy)??0,dz:x(e.dz)??0,rx:x(e.rx)??0,ry:x(e.ry)??0,rz:x(e.rz)??0,sf:x(e.sf)??0}}function _(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=x(n);if(e===void 0)return;t.push(e)}return t}function v(e){if(Array.isArray(e))return e.filter(e=>Array.isArray(e)).map(e=>e.map(e=>x(e)).filter(e=>e!==void 0))}function y(e){if(e!=null)return typeof e==`string`?e:String(e)}function b(e){let t=y(e);if(t!==void 0)return t.trim()}function x(e){if(e==null)return;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=e.trim();if(t===``)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function C(t,n){if(!S(t))throw new e(`geospatial-pdf-layer:parse`,n);return t}export{i as parse};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import t from"../../geometry/SpatialReference.js";const n={OriginLatitude:`Origin_Latitude`,CentralMeridian:`Central_Meridian`,ScaleFactor:`Scale_Factor`,FalseEasting:`False_Easting`,FalseNorthing:`False_Northing`,Zone:`Zone`,Hemisphere:`Hemisphere`,StandardParallelOne:`Standard_Parallel_One`,StandardParallelTwo:`Standard_Parallel_Two`},r=/^(?:NAD83|NORTH AMERICAN 1983|NAR(?:-[A-Z])?)$/i,i=/^(?:NAD27|NORTH AMERICAN 1927|NAS(?:-[A-Z])?)$/i,a=/^(?:WGS84|WGS 84|WGE)$/i;function o(e){let n=s(e);if(n.kind===`projected`){let{projectionType:r,datum:i}=n;return r===`SPCS`?O(e,i):new t({wkt:p(e,r,i)})}}function s(e){return c(e)}function c(t){let n=l(t.Type)
|
|
3
|
-
`)},${o}]`}function m(e){switch(e){case`TC`:case`UT`:return`Transverse_Mercator`;case`PH`:return`Polyconic`;case`AC`:return`Albers`;case`LE`:return`Lambert_Conformal_Conic`}}function h(e,t,n){let r=g(n);switch(t){case`TC`:return`${r}_GeospatialPDF_Transverse_Mercator`;case`PH`:return`${r}_GeospatialPDF_Polyconic`;case`UT`:return`${r}_GeospatialPDF_UTM_Zone_${e.Zone}_${e.Hemisphere}`;case`AC`:return`${r}_GeospatialPDF_Albers_Equal_Area`;case`LE`:return`${r}_GeospatialPDF_Lambert_Conformal_Conic`}}function g(e){let t=C(e);return t?T(t)?`NAD_1983`:E(t)?`NAD_1927`:D(t)?`WGS_1984`:`geospatialPDF`:`geospatialPDF`}function _(t){if(t.kind===`definition`){let n=t.ellipsoid;if(!
|
|
2
|
+
import e from"../../core/Error.js";import t from"../../geometry/SpatialReference.js";const n={OriginLatitude:`Origin_Latitude`,CentralMeridian:`Central_Meridian`,ScaleFactor:`Scale_Factor`,FalseEasting:`False_Easting`,FalseNorthing:`False_Northing`,Zone:`Zone`,Hemisphere:`Hemisphere`,StandardParallelOne:`Standard_Parallel_One`,StandardParallelTwo:`Standard_Parallel_Two`},r=/^(?:NAD83|NORTH AMERICAN 1983|NAR(?:-[A-Z])?)$/i,i=/^(?:NAD27|NORTH AMERICAN 1927|NAS(?:-[A-Z])?)$/i,a=/^(?:WGS84|WGS 84|WGE)$/i;function o(e){let n=s(e);if(n.kind===`projected`){let{projectionType:r,datum:i}=n;return r===`SPCS`?O(e,i):new t({wkt:p(e,r,i)})}}function s(e){return c(e)}function c(t){let n=l(t.Type);if(!n)throw new e(`geospatial-pdf-layer:invalid-projection`,`Projection dictionary is missing or has invalid Type`,`Expected Projection or Display`);let r=t.Projection_Type;if(!r)throw new e(`geospatial-pdf-layer:invalid-projection`,`Missing projection code`);let i=u(t.Projection_Type);if(!i)throw new e(`geospatial-pdf-layer:unsupported-projection`,`Unsupported projection code: ${r}`);let a=t.Datum;if(!a)throw new e(`geospatial-pdf-layer:invalid-datum`,`Missing datum definition or code in LGI Dict frame`);if(a.kind===`unknown`)throw new e(`geospatial-pdf-layer:invalid-datum`,`Invalid datum: ${a.name??`unknown`}`);return d(t,i),{kind:`projected`,dictionaryType:n,projectionType:i,datum:t.Datum}}function l(e){switch(e){case`Projection`:case`Display`:return e;default:return}}function u(e){switch(e){case`TC`:case`PH`:case`UT`:case`AC`:case`LE`:case`SPCS`:return e;default:return}}function d(t,r){let i=f(r);for(let a of i){let i=t[n[a]];if(i===void 0||i===``)throw new e(`geospatial-pdf-layer:invalid-projection`,`Projection ${r} missing required parameter ${a}`)}}function f(e){switch(e){case`TC`:return[`OriginLatitude`,`CentralMeridian`,`ScaleFactor`,`FalseEasting`,`FalseNorthing`];case`PH`:return[`OriginLatitude`,`CentralMeridian`,`FalseEasting`,`FalseNorthing`];case`UT`:return[`Zone`,`Hemisphere`];case`AC`:case`LE`:return[`OriginLatitude`,`CentralMeridian`,`StandardParallelOne`,`StandardParallelTwo`,`FalseEasting`,`FalseNorthing`];case`SPCS`:return[`Zone`]}}function p(e,t,n){let r=h(e,t,n),i=m(t),a=_(n),o=v(e.Units??`M`),s=y(e,t);return`PROJCS["${r}",GEOGCS["${S(n)}",${a},PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]],PROJECTION["${i}"],${s.join(`,
|
|
3
|
+
`)},${o}]`}function m(e){switch(e){case`TC`:case`UT`:return`Transverse_Mercator`;case`PH`:return`Polyconic`;case`AC`:return`Albers`;case`LE`:return`Lambert_Conformal_Conic`}}function h(e,t,n){let r=g(n);switch(t){case`TC`:return`${r}_GeospatialPDF_Transverse_Mercator`;case`PH`:return`${r}_GeospatialPDF_Polyconic`;case`UT`:return`${r}_GeospatialPDF_UTM_Zone_${e.Zone}_${e.Hemisphere}`;case`AC`:return`${r}_GeospatialPDF_Albers_Equal_Area`;case`LE`:return`${r}_GeospatialPDF_Lambert_Conformal_Conic`}}function g(e){let t=C(e);return t?T(t)?`NAD_1983`:E(t)?`NAD_1927`:D(t)?`WGS_1984`:`geospatialPDF`:`geospatialPDF`}function _(t){if(t.kind===`definition`){let n=t.raw.Ellipsoid;if(typeof n==`string`)throw new e(`geospatial-pdf-layer:unsupported-ellipsoid`,`Only ellipsoid definitions are supported but found predefined code`,{code:n});let r=t.raw.ToWGS84;if(typeof r==`string`)throw new e(`geospatial-pdf-layer:unsupported-datum-shift`,`Only shift definitions are supported but found predefined code`,{code:r});let i=t.ellipsoid;if(!i?.semi_Major_Axis)throw new e(`geospatial-pdf-layer:invalid-Datum`,`Datum definition requires semi-major axis`);let a=x(i),o=t.name??`GeospatialPDF_Datum`,s=`SPHEROID["${i.description??`GeospatialPDF_Spheroid`}",${i.semi_Major_Axis},${a}]`,c=t.to_WGS84;return`DATUM["${o}",${s}${c?`,TOWGS84[${c.dx??0},${c.dy??0},${c.dz??0},${c.rx??0},${c.ry??0},${c.rz??0},${c.sf??0}]`:``}]`}if(t.name){let e=t.name.toUpperCase();if(T(e))return`DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137,298.257222101]]`;if(E(e))return`DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]]`;if(D(e))return`DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]]`}throw new e(`geospatial-pdf-layer:unsupported-datum`,`Unsupported datum code: ${t.name??`unknown`}`)}function v(e){let t=e.toLowerCase();return[`m`,`meter`,`meters`,`metre`,`metres`].includes(t)?`UNIT["Meter",1.0]`:[`ft`,`foot`,`feet`].includes(t)?`UNIT["Foot",0.3048]`:`UNIT["${e}",1.0]`}function y(e,t){switch(t){case`TC`:return[`PARAMETER["False_Easting",${e.False_Easting}]`,`PARAMETER["False_Northing",${e.False_Northing}]`,`PARAMETER["Central_Meridian",${e.Central_Meridian}]`,`PARAMETER["Latitude_Of_Origin",${e.Origin_Latitude}]`,`PARAMETER["Scale_Factor",${e.Scale_Factor}]`];case`PH`:return[`PARAMETER["False_Easting",${e.False_Easting}]`,`PARAMETER["False_Northing",${e.False_Northing}]`,`PARAMETER["Central_Meridian",${e.Central_Meridian}]`,`PARAMETER["Latitude_Of_Origin",${e.Origin_Latitude}]`];case`AC`:case`LE`:return[`PARAMETER["False_Easting",${e.False_Easting}]`,`PARAMETER["False_Northing",${e.False_Northing}]`,`PARAMETER["Central_Meridian",${e.Central_Meridian}]`,`PARAMETER["Latitude_Of_Origin",${e.Origin_Latitude}]`,`PARAMETER["Standard_Parallel_1",${e.Standard_Parallel_One}]`,`PARAMETER["Standard_Parallel_2",${e.Standard_Parallel_Two}]`];case`UT`:return b(e)}}function b(t){if(!t.Zone)throw new e(`geospatial-pdf-layer:invalid-projection`,`No zone found for projection code UT`);let n=t.Zone*6-183;return[`PARAMETER["False_Easting",500000]`,`PARAMETER["False_Northing",${/^s/i.test(t.Hemisphere??``)?1e7:0}]`,`PARAMETER["Central_Meridian",${n}]`,`PARAMETER["Latitude_Of_Origin",0]`,`PARAMETER["Scale_Factor",0.9996]`]}function x(t){if(t.inverse_Flattening!=null)return t.inverse_Flattening;let n=t.semi_Major_Axis,r=t.semi_Minor_Axis;if(n==null||r==null)throw new e(`geospatial-pdf-layer:invalid-Datum`,`Ellipsoid definition missing InvFlattening or SemiMinorAxis`);return n===r?0:n/(n-r)}function S(e){let t=C(e);return t?T(t)?`GCS_North_American_1983`:E(t)?`GCS_North_American_1927`:D(t)?`GCS_WGS_1984`:`GCS_GeospatialPDF`:`GCS_GeospatialPDF`}function C(e){return e.name?w(e.name):null}function w(e){return e.trim().toUpperCase().replace(/_/g,` `).replace(/\s+/g,` `)}function T(e){return r.test(e)}function E(e){return i.test(e)}function D(e){return a.test(e)}function O(n,r){let i=C(r);if(n.Zone===2800&&i&&T(i))return new t({wkid:32110});throw new e(`geospatial-pdf-layer:invalid-projection`,`Unsupported State Plane projection: datum ${r.name}, zone ${n.Zone}`)}export{o as projectionToSpatialReference};
|
|
@@ -308,10 +308,11 @@ export default class LabelClass extends JSONSupport {
|
|
|
308
308
|
*/
|
|
309
309
|
accessor name: string | null | undefined;
|
|
310
310
|
/**
|
|
311
|
-
*
|
|
311
|
+
* The offset distance of the label from its default position.
|
|
312
|
+
* Will be applied to the label's position relative to the [label placement](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/#labelPlacement).
|
|
312
313
|
*
|
|
313
314
|
* @default 0
|
|
314
|
-
* @
|
|
315
|
+
* @since 5.2
|
|
315
316
|
*/
|
|
316
317
|
accessor offsetDistance: number;
|
|
317
318
|
/**
|
|
@@ -3,39 +3,62 @@ import type { Clonable } from "../../core/Clonable.js";
|
|
|
3
3
|
import type { JSONSupportMixin } from "../../core/JSONSupport.js";
|
|
4
4
|
import type { PortalItemProperties } from "../../portal/PortalItem.js";
|
|
5
5
|
|
|
6
|
+
/** Properties used to construct a [PortalItemData](https://developers.arcgis.com/javascript/latest/references/core/layers/support/PortalItemData/). */
|
|
6
7
|
export interface PortalItemDataProperties {
|
|
7
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The portal item that provides the layer's data source. The item's content must be compatible
|
|
10
|
+
* with the consuming layer, such as Parquet data for [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/) or a geospatial PDF
|
|
11
|
+
* for [GeospatialPDFLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/). Set this to a [PortalItem](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/) instance or its properties;
|
|
12
|
+
* a plain object such as `{ id: "item-id" }` is autocast to a PortalItem.
|
|
13
|
+
* Set the item's [portal](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/#portal) when referencing content outside the default portal.
|
|
14
|
+
*/
|
|
8
15
|
portalItem?: PortalItemProperties;
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
19
|
+
* Provides an ArcGIS [portal item](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/) as the data source for a
|
|
20
|
+
* [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/) or a [GeospatialPDFLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/).
|
|
14
21
|
*
|
|
15
22
|
* @since 5.2
|
|
16
23
|
* @beta
|
|
17
24
|
* @example
|
|
18
|
-
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import ParquetLayer from "@arcgis/core/layers/ParquetLayer.js";
|
|
27
|
+
* import PortalItemData from "@arcgis/core/layers/support/PortalItemData.js";
|
|
28
|
+
*
|
|
29
|
+
* // Replace the placeholder ID with a portal item containing Parquet data.
|
|
19
30
|
* const layer = new ParquetLayer({
|
|
20
31
|
* data: new PortalItemData({
|
|
21
32
|
* portalItem: {
|
|
22
|
-
* id: "
|
|
33
|
+
* id: "6ab6f959c1684eb5a54db91644a89747",
|
|
23
34
|
* },
|
|
24
35
|
* }),
|
|
25
36
|
* });
|
|
37
|
+
* ```
|
|
26
38
|
* @example
|
|
27
|
-
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* import GeospatialPDFLayer from "@arcgis/core/layers/GeospatialPDFLayer.js";
|
|
41
|
+
* import PortalItemData from "@arcgis/core/layers/support/PortalItemData.js";
|
|
42
|
+
*
|
|
43
|
+
* // Replace the placeholder ID with a portal item whose URL resolves to a geospatial PDF.
|
|
28
44
|
* const layer = new GeospatialPDFLayer({
|
|
29
45
|
* data: new PortalItemData({
|
|
30
46
|
* portalItem: {
|
|
31
|
-
* id: "
|
|
47
|
+
* id: "0d8613492b1e4598a5edb111f05be7fd",
|
|
32
48
|
* },
|
|
33
49
|
* }),
|
|
34
50
|
* });
|
|
51
|
+
* ```
|
|
35
52
|
*/
|
|
36
53
|
export default class PortalItemData extends PortalItemDataSuperclass {
|
|
37
54
|
constructor(properties?: PortalItemDataProperties);
|
|
38
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* The portal item that provides the layer's data source. The item's content must be compatible
|
|
57
|
+
* with the consuming layer, such as Parquet data for [ParquetLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/ParquetLayer/) or a geospatial PDF
|
|
58
|
+
* for [GeospatialPDFLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/). Set this to a [PortalItem](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/) instance or its properties;
|
|
59
|
+
* a plain object such as `{ id: "item-id" }` is autocast to a PortalItem.
|
|
60
|
+
* Set the item's [portal](https://developers.arcgis.com/javascript/latest/references/core/portal/PortalItem/#portal) when referencing content outside the default portal.
|
|
61
|
+
*/
|
|
39
62
|
get portalItem(): PortalItem;
|
|
40
63
|
set portalItem(value: PortalItemProperties);
|
|
41
64
|
/** The type of data source. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ClonableMixin } from "../../core/Clonable.js";
|
|
2
2
|
import type { JSONSupport } from "../../core/JSONSupport.js";
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface TimeSeriesCalculationMethodProperties extends Partial<Pick<TimeSeriesCalculationMethod, "name" | "title" | "type">> {}
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The calculation method by which to derive a data value for a time series. By default,
|
|
@@ -9,15 +9,15 @@ export interface TimeSeriesCalculationProperties extends Partial<Pick<TimeSeries
|
|
|
9
9
|
*
|
|
10
10
|
* @since 5.2
|
|
11
11
|
*/
|
|
12
|
-
export type
|
|
12
|
+
export type TimeSeriesCalculationMethodType = "change-from-average" | "change-from-first" | "change-from-previous" | "percent-change-from-average" | "percent-change-from-first" | "percent-change-from-previous";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Defines a calculation method that can be used to derive data values for a time series.
|
|
16
16
|
*
|
|
17
17
|
* @since 5.2
|
|
18
18
|
*/
|
|
19
|
-
export default class
|
|
20
|
-
constructor(properties?:
|
|
19
|
+
export default class TimeSeriesCalculationMethod extends TimeSeriesCalculationMethodSuperclass {
|
|
20
|
+
constructor(properties?: TimeSeriesCalculationMethodProperties);
|
|
21
21
|
/**
|
|
22
22
|
* A unique identifier for the calculation method within the time series.
|
|
23
23
|
*
|
|
@@ -27,6 +27,6 @@ export default class TimeSeriesCalculation extends TimeSeriesCalculationSupercla
|
|
|
27
27
|
/** A user-friendly name for the calculation method. */
|
|
28
28
|
accessor title: string | null | undefined;
|
|
29
29
|
/** The method by which to calculate a time series data value. */
|
|
30
|
-
accessor type:
|
|
30
|
+
accessor type: TimeSeriesCalculationMethodType | null | undefined;
|
|
31
31
|
}
|
|
32
|
-
declare const
|
|
32
|
+
declare const TimeSeriesCalculationMethodSuperclass: typeof JSONSupport & typeof ClonableMixin
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../core/Clonable.js";import{JSONSupport as n}from"../../core/JSONSupport.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";let a=class extends t(n){constructor(e){super(e),this.name=null,this.type=null,this.title=null}};e([r({type:String,json:{write:{isRequired:!0}}})],a.prototype,`name`,void 0),e([r({type:[`change-from-average`,`change-from-first`,`change-from-previous`,`percent-change-from-average`,`percent-change-from-first`,`percent-change-from-previous`],json:{write:{isRequired:!0}}})],a.prototype,`type`,void 0),e([r({type:String,json:{write:!0}})],a.prototype,`title`,void 0),a=e([i(`esri.layers.support.
|
|
2
|
+
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../core/Clonable.js";import{JSONSupport as n}from"../../core/JSONSupport.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";let a=class extends t(n){constructor(e){super(e),this.name=null,this.type=null,this.title=null}};e([r({type:String,json:{write:{isRequired:!0}}})],a.prototype,`name`,void 0),e([r({type:[`change-from-average`,`change-from-first`,`change-from-previous`,`percent-change-from-average`,`percent-change-from-first`,`percent-change-from-previous`],json:{write:{isRequired:!0}}})],a.prototype,`type`,void 0),e([r({type:String,json:{write:!0}})],a.prototype,`title`,void 0),a=e([i(`esri.layers.support.TimeSeriesCalculationMethod`)],a);const o=a;export{o as default};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type TimeSeriesCalculationMethod from "./TimeSeriesCalculationMethod.js";
|
|
2
2
|
import type TimeSeriesFieldTimeMapping from "./TimeSeriesFieldTimeMapping.js";
|
|
3
3
|
import type TimeExtent from "../../time/TimeExtent.js";
|
|
4
4
|
import type { ClonableMixin } from "../../core/Clonable.js";
|
|
5
5
|
import type { JSONSupport } from "../../core/JSONSupport.js";
|
|
6
6
|
import type { TimeSeriesFieldTimeMappingProperties } from "./TimeSeriesFieldTimeMapping.js";
|
|
7
7
|
import type { TimeExtentProperties } from "../../time/TimeExtent.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { TimeSeriesCalculationMethodProperties } from "./TimeSeriesCalculationMethod.js";
|
|
9
9
|
|
|
10
10
|
/** @since 5.1 */
|
|
11
11
|
export interface TimeSeriesInfoProperties extends Partial<Pick<TimeSeriesInfo, "name" | "timeInterval" | "timeIntervalUnits" | "timeValueUnits" | "title">> {
|
|
@@ -16,7 +16,7 @@ export interface TimeSeriesInfoProperties extends Partial<Pick<TimeSeriesInfo, "
|
|
|
16
16
|
* @default null
|
|
17
17
|
* @since 5.2
|
|
18
18
|
*/
|
|
19
|
-
calculationMethods?:
|
|
19
|
+
calculationMethods?: TimeSeriesCalculationMethodProperties[] | null;
|
|
20
20
|
/** The mapping between field names and time values for the time series configuration. */
|
|
21
21
|
fieldTimeMappings?: TimeSeriesFieldTimeMappingProperties[] | null;
|
|
22
22
|
/**
|
|
@@ -113,8 +113,8 @@ export default class TimeSeriesInfo extends TimeSeriesInfoSuperclass {
|
|
|
113
113
|
* @default null
|
|
114
114
|
* @since 5.2
|
|
115
115
|
*/
|
|
116
|
-
get calculationMethods():
|
|
117
|
-
set calculationMethods(value:
|
|
116
|
+
get calculationMethods(): TimeSeriesCalculationMethod[] | null | undefined;
|
|
117
|
+
set calculationMethods(value: TimeSeriesCalculationMethodProperties[] | null | undefined);
|
|
118
118
|
/** The mapping between field names and time values for the time series configuration. */
|
|
119
119
|
get fieldTimeMappings(): TimeSeriesFieldTimeMapping[] | null | undefined;
|
|
120
120
|
set fieldTimeMappings(value: TimeSeriesFieldTimeMappingProperties[] | null | undefined);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../core/Clonable.js";import{JSONSupport as n}from"../../core/JSONSupport.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./
|
|
2
|
+
import{__decorate as e}from"tslib";import{ClonableMixin as t}from"../../core/Clonable.js";import{JSONSupport as n}from"../../core/JSONSupport.js";import{property as r,subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./TimeSeriesCalculationMethod.js";import o from"./TimeSeriesFieldTimeMapping.js";import s from"../../time/TimeExtent.js";let c=class extends t(n){constructor(e){super(e),this.name=null,this.fieldTimeMappings=null,this.timeExtent=null,this.timeInterval=null,this.timeIntervalUnits=null,this.timeValueUnits=null,this.title=null,this.calculationMethods=null,this.type=`time-series-fields`}};e([r({type:String,json:{write:{isRequired:!0}}})],c.prototype,`name`,void 0),e([r({type:[o],json:{write:{isRequired:!0}}})],c.prototype,`fieldTimeMappings`,void 0),e([r({type:s,json:{write:!0}})],c.prototype,`timeExtent`,void 0),e([r({type:Number,json:{write:{isRequired:!0}}})],c.prototype,`timeInterval`,void 0),e([r({type:String,json:{write:{isRequired:!0}}})],c.prototype,`timeIntervalUnits`,void 0),e([r({type:String,json:{write:{isRequired:!0}}})],c.prototype,`timeValueUnits`,void 0),e([r({type:String,json:{write:!0}})],c.prototype,`title`,void 0),e([r({type:[a],json:{write:!0}})],c.prototype,`calculationMethods`,void 0),e([r({type:String,readOnly:!0,json:{write:{isRequired:!0}}})],c.prototype,`type`,void 0),c=e([i(`esri.layers.support.TimeSeriesInfo`)],c);export{c as default};
|
|
@@ -5,13 +5,17 @@
|
|
|
5
5
|
* @since 5.1
|
|
6
6
|
*/
|
|
7
7
|
import type TimeSeriesInfo from "./TimeSeriesInfo.js";
|
|
8
|
+
import type { TimeSeriesCalculationMethodType } from "./TimeSeriesCalculationMethod.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Options for creating a time series Arcade expression.
|
|
11
12
|
*
|
|
12
13
|
* @since 5.2
|
|
13
14
|
*/
|
|
14
|
-
export interface CreateTimeSeriesExpressionOptions {
|
|
15
|
+
export interface CreateTimeSeriesExpressionOptions {
|
|
16
|
+
/** The calculation method used to derive a time series data value. */
|
|
17
|
+
calculationMethodType?: TimeSeriesCalculationMethodType;
|
|
18
|
+
}
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* Creates an [Arcade expression](https://developers.arcgis.com/javascript/latest/arcade/) that resolves values from a time series data series using the
|
|
@@ -35,7 +39,7 @@ export interface CreateTimeSeriesExpressionOptions {}
|
|
|
35
39
|
* timeValueUnits: "years",
|
|
36
40
|
* });
|
|
37
41
|
*
|
|
38
|
-
* const expression = createTimeSeriesExpression(info, {
|
|
42
|
+
* const expression = createTimeSeriesExpression(info, { calculationMethodType: "change-from-previous" });
|
|
39
43
|
* ```
|
|
40
44
|
*/
|
|
41
45
|
export function createTimeSeriesExpression(dataSeriesInfo: TimeSeriesInfo, options?: CreateTimeSeriesExpressionOptions): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
function e(e,n){let{
|
|
2
|
+
function e(e,n){let{calculationMethodType:r}=n??{},i=e.fieldTimeMappings??[];if(!i.length)return`return null;`;let a=t(e.timeValueUnits??`years`);if(!r){let e=i.map(({fieldName:e,timeValue:t})=>` "${t}", $feature.${e},`);return`var timeFormat = "${a}";
|
|
3
3
|
|
|
4
4
|
var hasCurrentStart = HasValue($view, ["timeProperties", "currentStart"]);
|
|
5
5
|
var hasCurrentEnd = HasValue($view, ["timeProperties", "currentEnd"]);
|
|
@@ -648,7 +648,10 @@ export type ParquetGeometryEncodingUnion = GeometryEncodingWkb | GeometryEncodin
|
|
|
648
648
|
export type ParquetDataUnion = ParquetFilesData | ParquetPortalItemData | PortalItemData;
|
|
649
649
|
|
|
650
650
|
/**
|
|
651
|
-
* Supported
|
|
651
|
+
* Supported data sources for [GeospatialPDFLayer.data](https://developers.arcgis.com/javascript/latest/references/core/layers/GeospatialPDFLayer/#data).
|
|
652
|
+
* A string specifies a PDF URL, a browser [File](https://developer.mozilla.org/en-US/docs/Web/API/File)
|
|
653
|
+
* provides a local PDF, and a [PortalItemData](https://developers.arcgis.com/javascript/latest/references/core/layers/support/PortalItemData/) references a portal item whose URL resolves to a PDF.
|
|
654
|
+
* Each source must contain supported georeferencing information.
|
|
652
655
|
*
|
|
653
656
|
* @since 5.2
|
|
654
657
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.154",
|
|
4
4
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@amcharts/amcharts5": "~5.20.8",
|
|
23
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
23
|
+
"@arcgis/toolkit": "5.2.0-next.154",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
|
|
25
25
|
"@esri/calcite-components": "^5.2.0-next.89",
|
|
26
26
|
"@vaadin/grid": "~25.3.2",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Error.js";import{getSourceLayer as t,getDataSeriesInfo as n}from"../../../layers/support/dataSeriesUtils.js";import{createTimeSeriesExpression as r}from"../../../layers/support/timeSeriesUtils.js";import{
|
|
2
|
+
import e from"../../../core/Error.js";import{getSourceLayer as t,getDataSeriesInfo as n}from"../../../layers/support/dataSeriesUtils.js";import{createTimeSeriesExpression as r}from"../../../layers/support/timeSeriesUtils.js";import{getTimeSeriesCalculationMethod as i}from"../../statistics/support/timeSeriesUtils.js";function a(e,t,n){let r=e.dataSeriesInfos?.indexOf(t)??-1,i=t.title||`${t.name} ${r}`;return n?.title||(n?.type?`${i} ${n.type}`:i)}function o(o){if(!o.dataSeriesName||!o.layer){if(o.dataSeriesCalculationName!=null)throw new e(`resolve-data-series-info:invalid-parameters`,`'dataSeriesCalculationName' requires a valid 'dataSeriesName' and 'layer'`);return o}let s=t(o.layer);if(!s)throw new e(`resolve-data-series-info:invalid-parameters`,`'layer' must support dataSeriesInfos`);let c=n(s,o.dataSeriesName);if(!c)throw new e(`resolve-data-series-info:invalid-parameters`,`'dataSeriesName' is not valid`);if(c.type!==`time-series-fields`)throw new e(`resolve-data-series-info:invalid-parameters`,`'dataSeriesName' has unsupported type`);let l=i(c,o.dataSeriesCalculationName,`resolve-data-series-info`);return o.valueExpression=r(c,{calculationMethodType:l?.type??void 0}),o.valueExpressionTitle=a(s,c,l),`field`in o&&(o.field=null),o}export{o as resolveDataSeriesInfo};
|
|
@@ -21,4 +21,4 @@ var comparisonValue = $feature.${c};
|
|
|
21
21
|
if (IsEmpty(currentValue) || IsEmpty(comparisonValue)${s?` || comparisonValue == 0`:``}) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
return ${s?`Round(100 * (currentValue - comparisonValue) / comparisonValue, 2)`:`currentValue - comparisonValue`};`,sqlExpression:s?`CASE WHEN ${c} IS NULL OR ${c} = 0 OR ${n} IS NULL THEN NULL ELSE ROUND(100.0 * (${u} - ${l}) / ${l}, 2) END`:`CASE WHEN ${c} IS NULL OR ${n} IS NULL THEN NULL ELSE ${u} - ${l} END`}})}function p(e){let t=e.filter(e=>e.count),n=t.reduce((e,t)=>e+(t.count??0),0);if(!n)return{count:0};let r=Math.min(...t.map(e=>e.min)),i=Math.max(...t.map(e=>e.max)),a=t.reduce((e,t)=>e+(t.sum??0),0),o=a/n,s=t.reduce((e,t)=>e+(t.variance??0)*Math.max((t.count??0)-1,0),0),c=t.reduce((e,t)=>e+(t.count??0)*((t.avg??0)-o)**2,0),l=n>1?(s+c)/(n-1):0;return{min:r,max:i,sum:a,avg:o,count:n,variance:l,stddev:Math.sqrt(l)}}function m(e){let t=e[0];return t?{minValue:t.minValue,maxValue:t.maxValue,bins:t.bins.map((t,n)=>({...t,count:e.reduce((e,t)=>e+t.bins[n].count,0)}))}:{bins:[]}}export{m as combineHistograms,p as combineSummaryStatistics,u as
|
|
24
|
+
return ${s?`Round(100 * (currentValue - comparisonValue) / comparisonValue, 2)`:`currentValue - comparisonValue`};`,sqlExpression:s?`CASE WHEN ${c} IS NULL OR ${c} = 0 OR ${n} IS NULL THEN NULL ELSE ROUND(100.0 * (${u} - ${l}) / ${l}, 2) END`:`CASE WHEN ${c} IS NULL OR ${n} IS NULL THEN NULL ELSE ${u} - ${l} END`}})}function p(e){let t=e.filter(e=>e.count),n=t.reduce((e,t)=>e+(t.count??0),0);if(!n)return{count:0};let r=Math.min(...t.map(e=>e.min)),i=Math.max(...t.map(e=>e.max)),a=t.reduce((e,t)=>e+(t.sum??0),0),o=a/n,s=t.reduce((e,t)=>e+(t.variance??0)*Math.max((t.count??0)-1,0),0),c=t.reduce((e,t)=>e+(t.count??0)*((t.avg??0)-o)**2,0),l=n>1?(s+c)/(n-1):0;return{min:r,max:i,sum:a,avg:o,count:n,variance:l,stddev:Math.sqrt(l)}}function m(e){let t=e[0];return t?{minValue:t.minValue,maxValue:t.maxValue,bins:t.bins.map((t,n)=>({...t,count:e.reduce((e,t)=>e+t.bins[n].count,0)}))}:{bins:[]}}export{m as combineHistograms,p as combineSummaryStatistics,u as getTimeSeriesCalculationMethod,d as getTimeSeriesStatisticInputs,l as processTimeSeriesParams};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as n}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{throwIfNotAbortError as
|
|
2
|
+
import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as n}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{ignoreAbortErrors as i,throwIfNotAbortError as a}from"../../../../core/promiseUtils.js";import{loadTextModule as o}from"../../../../libs/librust-text/loadTextModule.js";import{parseRichTextRuns as s}from"../../../../symbols/cim/richTextUtils.js";import{decorGlyphRect as c}from"./decorGlyphRect.js";import{sdfRadiusComplex as l,sdfBufferGlyphSDFCreator as u,sdfSizeComplex as d,sdfBufferServer as f,sdfRadiusSimple as p,sdfSizeSimple as m}from"./definitions.js";import{GlyphSDFCreator as h}from"./GlyphSDFCreator.js";import g from"./GlyphSource.js";import{hashMosaic as _}from"./hashMosaic.js";import v from"./Rect.js";import y from"./RectangleBinPack.js";const b=`arial-unicode-ms-regular`,x=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,S=new Set([`Noto Sans Khmer`,`Noto Sans Lao`,`Noto Sans Myanmar`,`Noto Sans Thai`]),C=()=>r.getLogger(`esri.views.MapView`),w=(e,t=``)=>C().warnOnce(e,t);class T{constructor(){this._glyphSources=new Map,this._snapCoords=!0,this._currentPage=0,this._faces=new Map,this._facePromises=new Map,this._pbfRangePromises=new Map,this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._invalidFonts=new Set,this._preloadCache={},this._glyphSDFCreator=new h({sdfSizePx:d,sdfBufferPx:u,radius:l,cutoff:.25})}set remoteClient(e){this._client=e.createInvokeProxy();let t=i(this._client.getOptions());this._inited=this._init(t)}async rasterizeText(e,t,n){await this._inited;let r=t.symbol?s(t):null;return r?{type:`rich-glyphs`,runs:(await Promise.all(r.map(async t=>({fontSize:t.fontSize,characterSpacing:t.characterSpacing,decoration:t.font.decoration,color:t.color,glyphs:await this._rasterizeTextRun(e,t.font,t.text,n)})))).filter(e=>e.glyphs!=null)}:this._rasterizeTextRun(e,t.font,t.textString,n)}async _rasterizeTextRun(e,t,r,i){let a=n(t),o=this._invalidFonts.has(a),s=!!has(`esri-2d-force-complex-shaping`),c=!!has(`esri-2d-complex-shaping`)&&x.test(r),l=S.has(t.family),u=s||c||l,d=o?b:a,f=await this.getGlyphItems(r,u,e,d,!1,i);return f||=(w(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),await this.getGlyphItems(r,u,e,b,!1,i)),f}async getGlyphItems(e,n,r,i,a,o){await this._inited;let s=this._getSource(r),c=n?d:m,h=n?l:p,g=n?u:f,_,v,y;if(has(`esri-2d-stabilize-glyphs`)&&await this.preloadASCIIGlyphCache(s,i).catch(()=>{}),n){let t=await this._getFace(s,i);if(!t)return null;let n=this._glyphCache.get(i);n||(n=new Map,this._glyphCache.set(i,n));let{shaping:r,isRTL:a}=this._shape(t,e);y=a,_=r.map(e=>this._getShapedGlyph(t,n,e)),v={baseline:t.baseline()/c,midline:t.midline()/c}}else{let n=this._pbfGlyphCache.get(i);n||(n=new Map,this._pbfGlyphCache.set(i,n));let[r,c,l]=t(e),u=k(r);try{await this._fetchRanges(s,i,u,o)}catch{return null}y=c,_=u.map(e=>this._getPBFGlyph(n,s,i,e,a)).filter(e=>!!e)}let b=_.filter(e=>e.needsRecord);return b.length>0&&await this._client.recordGlyphs(b),{type:`glyphs`,glyphs:_,faceInfo:v,isRightToLeft:y,sdfSize:c,sdfRadius:h,sdfPadding:g}}async _init(e){let t=await e;if(!t)return;let{width:n,height:r,snapCoords:i}=t;this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._binPack=new y(n,r),this._snapCoords=i,this._currentPage=0,this._initDecorationGlyphs()}_getShapedGlyph(e,t,n){let r,i,a=t.get(n.glyphId);if(!a){r=this._glyphSDFCreator.draw(e,n.glyphId);let o=this._glyphSDFCreator.sdfBufferPx;a={mosaicItem:{rect:this._recordGlyph(r?.rect,o),page:this._currentPage,sdf:!0,textureBinding:_(1,this._currentPage,!0)},glyphRect:r?.rect??{width:0,height:0,top:0,left:0}},t.set(n.glyphId,a),i=!0}return{mosaicItem:a.mosaicItem,rect:a.glyphRect,shaping:{xAdvance:n.xAdvance,yAdvance:n.yAdvance,xOffset:n.xOffset,yOffset:n.yOffset},code:n.isNewline?10:n.isWhitespace?32:NaN,sdf:r,needsRecord:i}}_getPBFGlyph(e,t,n,r,i=!1){let a,o,s=e.get(r);if(!s){let c=t.getRange(n,r),l=c?.getRect(r),d=c?.getShaping(r),f=c?.getBitmap(r);if(i&&(!l||!d))return;if(!l||!d)return O(r);let p={rect:f?this._recordGlyph(l,u):new v(0,0,0,0),sdf:!0,page:this._currentPage,textureBinding:_(1,this._currentPage,!0)};a=f&&{buffer:f,rect:l},s={mosaicItem:p,rect:l,shaping:d,code:r},o=!0,e.set(r,s)}let{mosaicItem:c,rect:l,shaping:d}=s;return{mosaicItem:c,rect:l,shaping:d,code:r,sdf:a,needsRecord:o}}_shape(e,n){let r=this._glyphSDFCreator.sdfSizePx,[i,a,o]=t(n,!1),s=new Uint32Array(Array.from(i).map((e,t)=>o.levels[o.targetToSource[t]]));return{shaping:e.shape(i,s,r),isRTL:a}}async _getFace(t,n,r){if(this._faces.has(n))return this._faces.get(n);let i=t.woffURL(n);return await D(this._facePromises,n,async()=>{let t=await e(i,{responseType:`array-buffer`,...r}),a=(await o()).Face.parseWoff2(new Uint8Array(t.data));this._faces.set(n,a)}),this._faces.get(n)}_getSource(e){return this._glyphSources.has(e)||this._glyphSources.set(e,new g(e)),this._glyphSources.get(e)}async _fetchRanges(e,t,n,r){let i=E(n),a=[];i.forEach(n=>{a.push(this._fetchRange(e,t,n,r))}),await Promise.all(a)}async _fetchRange(e,t,n,r){if(n>256)return;let i=t+n;return D(this._pbfRangePromises,i,()=>e.fetchRange(t,n,r))}_allocNewPage(){this._currentPage++,this._binPack=new y(this._binPack.width,this._binPack.height),this._initDecorationGlyphs()}_recordGlyph(e,t){let n=this._binPack;if(!e||e.width===0)return new v;let r=e.width+t*2,i=e.height+t*2,a=r,o=i;if(this._snapCoords){let e=r%4?4-r%4:4,t=i%4?4-i%4:4;a+=e,o+=t}let s=n.allocate(a,o);return s.isEmpty?(this._allocNewPage(),n.allocate(a,o)):s}_initDecorationGlyphs(){this._recordGlyph(c,f),this._recordGlyph(c,f)}preloadASCIIGlyphCache(e,t){let n=this._preloadCache[t];if(n!=null)return n;let r=e.preloadASCIIRange(t).then(async()=>{let n=this._pbfGlyphCache.get(t);n||(n=new Map,this._pbfGlyphCache.set(t,n));let r=[];for(let i=0;i<256;i++){let a=this._getPBFGlyph(n,e,t,i);a?.needsRecord&&r.push(a)}await this._client.recordGlyphs(r)},e=>{throw delete this._preloadCache[t],e});return this._preloadCache[t]=r,r}}function E(e){let t=new Set;for(let n of e)t.add(Math.floor(n/256));return t}function D(e,t,n){return e.has(t)||e.set(t,n().finally(()=>{e.delete(t)}).catch(e=>{a(e)})),e.get(t)}const O=e=>({mosaicItem:{rect:new v(0,0,0,0),sdf:!0,page:0},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:e});function k(e){let t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}export{T as default};
|