@vertigis/arcgis-extensions 32.8.5 → 32.10.0
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/AppConfig.schema.json +43 -11
- package/docs/html/assets/js/search.js +1 -1
- package/docs/html/classes/mapping_grouplayerextension.grouplayerextensioncollection.html +13 -13
- package/docs/html/classes/mapping_mapextension.mapextension.html +7 -7
- package/docs/html/classes/mapping_support__layerextensioncollection.layerextensioncollectionbase.html +19 -19
- package/docs/html/enums/portal_featurelayer.featurelayermode.html +4 -4
- package/docs/html/index.html +9 -0
- package/docs/html/interfaces/data__tableextension.tableproperties.html +51 -9
- package/docs/html/interfaces/mapping_featurelayerextension.featurelayerproperties.html +76 -13
- package/docs/html/interfaces/mapping_featurelayerextensionbase.featurelayerbaseproperties.html +76 -13
- package/docs/html/interfaces/mapping_support__layerextensioncollection.layerextensioncollection.html +3 -3
- package/docs/html/interfaces/portal_applicationproperties.applicationproperties.html +32 -2
- package/docs/html/interfaces/portal_bookmark.bookmark.html +18 -3
- package/docs/html/interfaces/portal_csvlayer.csvlayer-1.html +27 -7
- package/docs/html/interfaces/portal_drawinginfo.drawinginfo-1.html +29 -8
- package/docs/html/interfaces/portal_featurelayer.featurelayer-1.html +73 -13
- package/docs/html/interfaces/portal_forminfo.formattachmentelement.html +351 -0
- package/docs/html/interfaces/portal_forminfo.formbarcodescannerinput.html +257 -0
- package/docs/html/interfaces/portal_forminfo.formcomboboxinput.html +254 -0
- package/docs/html/interfaces/portal_forminfo.formdatetimepickerinput.html +274 -0
- package/docs/html/interfaces/portal_forminfo.formexpressioninfo.html +273 -0
- package/docs/html/interfaces/portal_forminfo.formfieldelement.html +386 -0
- package/docs/html/interfaces/portal_forminfo.formgroupelement.html +315 -0
- package/docs/html/interfaces/portal_forminfo.forminfo.html +271 -0
- package/docs/html/interfaces/portal_forminfo.formradiobuttonsinput.html +253 -0
- package/docs/html/interfaces/portal_forminfo.formrelationshipelement.html +334 -0
- package/docs/html/interfaces/portal_forminfo.formswitchinput.html +252 -0
- package/docs/html/interfaces/portal_forminfo.formtextareainput.html +254 -0
- package/docs/html/interfaces/portal_forminfo.formtextboxinput.html +255 -0
- package/docs/html/interfaces/portal_grouplayer.grouplayer-1.html +7 -4
- package/docs/html/interfaces/portal_grouplayer.subtypegrouplayer.html +501 -0
- package/docs/html/interfaces/portal_imageservicelayer.imageservicelayer-1.html +33 -13
- package/docs/html/interfaces/portal_imageservicevectorlayer.imageservicevectorlayer.html +28 -8
- package/docs/html/interfaces/portal_item.item-1.html +158 -41
- package/docs/html/interfaces/portal_labelinginfo.labelinginfo-1.html +19 -10
- package/docs/html/interfaces/portal_layerdefinition.fieldoverride.html +241 -0
- package/docs/html/interfaces/portal_layerdefinition.layerdefinition-1.html +116 -31
- package/docs/html/interfaces/portal_layerdefinition.layerdefinitiondefaults.html +12 -0
- package/docs/html/interfaces/portal_layerdefinition.layertimeinfo.html +381 -0
- package/docs/html/interfaces/portal_layerdefinition.timeinfoexportoptions.html +262 -0
- package/docs/html/interfaces/portal_mapfloorinfo.facilitylayerinfo.html +254 -0
- package/docs/html/interfaces/portal_mapfloorinfo.levellayerinfo.html +315 -0
- package/docs/html/interfaces/portal_mapfloorinfo.mapfloorinfo-1.html +233 -0
- package/docs/html/interfaces/portal_mapfloorinfo.sitelayerinfo.html +231 -0
- package/docs/html/interfaces/portal_mapservicelayer.mapservicelayer-1.html +26 -6
- package/docs/html/interfaces/portal_renderer.authoringinfo.html +28 -5
- package/docs/html/interfaces/portal_renderer.colorramp.html +291 -0
- package/docs/html/interfaces/portal_renderer.rendererbase.html +3 -0
- package/docs/html/interfaces/portal_streamlayer.streamlayer-1.html +75 -12
- package/docs/html/interfaces/portal_symbol.font.html +4 -4
- package/docs/html/interfaces/portal_table.table.html +49 -9
- package/docs/html/interfaces/portal_tiledimageservicelayer.tiledimageservicelayer-1.html +23 -3
- package/docs/html/interfaces/portal_tiledmapservicelayer.tiledmapservicelayer-1.html +27 -7
- package/docs/html/interfaces/portal_utilitynetwork.traceconfiguration.html +201 -0
- package/docs/html/interfaces/portal_utilitynetwork.utilitynetwork.html +243 -0
- package/docs/html/interfaces/portal_vectortilelayer.vectortilelayer-1.html +24 -4
- package/docs/html/interfaces/portal_webmap.webmap-1.html +71 -13
- package/docs/html/interfaces/portal_webscene.webscene-1.html +34 -15
- package/docs/html/interfaces/portal_webtilelayer.webtilelayer-1.html +8 -8
- package/docs/html/interfaces/portal_widgets.floorfilter.html +310 -0
- package/docs/html/interfaces/portal_widgets.range.html +6 -3
- package/docs/html/interfaces/portal_widgets.timeslider.html +4 -1
- package/docs/html/interfaces/portal_widgets.widgets.html +22 -0
- package/docs/html/modules/mapping_mapextension.html +1 -1
- package/docs/html/modules/portal_applicationproperties.html +2 -2
- package/docs/html/modules/portal_featurelayer.featurelayer.html +8 -8
- package/docs/html/modules/portal_featurelayer.html +1 -1
- package/docs/html/modules/portal_forminfo.html +178 -0
- package/docs/html/modules/portal_grouplayer.grouplayer.html +3 -3
- package/docs/html/modules/portal_grouplayer.html +5 -1
- package/docs/html/modules/portal_labelinginfo.html +1 -1
- package/docs/html/modules/portal_labelinginfo.labelplacement.html +2 -2
- package/docs/html/modules/portal_layerdefinition.html +32 -1
- package/docs/html/modules/portal_layerdefinition.layerdefinitioncapabilities.html +6 -6
- package/docs/html/modules/portal_mapfloorinfo.html +153 -0
- package/docs/html/modules/portal_mapfloorinfo.mapfloorinfo.html +209 -0
- package/docs/html/modules/portal_renderer.html +10 -6
- package/docs/html/modules/portal_table.html +5 -5
- package/docs/html/modules/portal_tiledmapservicelayer.tiledmapservicelayer.html +1 -1
- package/docs/html/modules/portal_utilitynetwork.html +134 -0
- package/docs/html/modules/portal_webmap.webmap.html +3 -3
- package/docs/html/modules/portal_webscene.webscene.html +3 -3
- package/docs/html/modules/portal_webtilelayer.webtilelayer.html +1 -1
- package/docs/html/modules/portal_widgets.html +5 -1
- package/docs/html/modules/version.html +1 -1
- package/docs/html/modules.html +12 -0
- package/mapping/MapExtension.js +1 -1
- package/mapping/support/_LayerExtensionCollection.js +1 -1
- package/package.json +1 -1
- package/portal/ApplicationProperties.d.ts +25 -0
- package/portal/Bookmark.d.ts +8 -2
- package/portal/CSVLayer.d.ts +5 -0
- package/portal/DrawingInfo.d.ts +9 -3
- package/portal/FeatureLayer.d.ts +16 -0
- package/portal/FormInfo.d.ts +391 -0
- package/portal/FormInfo.js +1 -0
- package/portal/GroupLayer.d.ts +25 -0
- package/portal/ImageServiceLayer.d.ts +5 -0
- package/portal/ImageServiceVectorLayer.d.ts +5 -0
- package/portal/Item.d.ts +37 -10
- package/portal/LabelingInfo.d.ts +7 -2
- package/portal/LayerDefinition.d.ts +121 -0
- package/portal/MapFloorInfo.d.ts +130 -0
- package/portal/MapFloorInfo.js +1 -0
- package/portal/MapServiceLayer.d.ts +5 -0
- package/portal/MapServiceLayer.js +1 -1
- package/portal/Renderer.d.ts +32 -0
- package/portal/Symbol.d.ts +4 -4
- package/portal/Table.d.ts +11 -0
- package/portal/TiledImageServiceLayer.d.ts +5 -0
- package/portal/TiledMapServiceLayer.d.ts +5 -0
- package/portal/TiledMapServiceLayer.js +1 -1
- package/portal/UtilityNetwork.d.ts +42 -0
- package/portal/UtilityNetwork.js +1 -0
- package/portal/VectorTileLayer.d.ts +5 -0
- package/portal/WebMap.d.ts +16 -0
- package/portal/WebMap.js +1 -1
- package/portal/WebScene.d.ts +5 -0
- package/portal/WebScene.js +1 -1
- package/portal/WebTileLayer.js +1 -1
- package/portal/Widgets.d.ts +45 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
<li class="tsd-description">
|
|
94
94
|
<aside class="tsd-sources">
|
|
95
95
|
<ul>
|
|
96
|
-
<li>Defined in src/portal/WebMap.ts:
|
|
96
|
+
<li>Defined in src/portal/WebMap.ts:104</li>
|
|
97
97
|
</ul>
|
|
98
98
|
</aside>
|
|
99
99
|
<div class="tsd-comment tsd-typography">
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
<li class="tsd-description">
|
|
139
139
|
<aside class="tsd-sources">
|
|
140
140
|
<ul>
|
|
141
|
-
<li>Defined in src/portal/WebMap.ts:
|
|
141
|
+
<li>Defined in src/portal/WebMap.ts:233</li>
|
|
142
142
|
</ul>
|
|
143
143
|
</aside>
|
|
144
144
|
<div class="tsd-comment tsd-typography">
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
<li class="tsd-description">
|
|
170
170
|
<aside class="tsd-sources">
|
|
171
171
|
<ul>
|
|
172
|
-
<li>Defined in src/portal/WebMap.ts:
|
|
172
|
+
<li>Defined in src/portal/WebMap.ts:47</li>
|
|
173
173
|
</ul>
|
|
174
174
|
</aside>
|
|
175
175
|
<div class="tsd-comment tsd-typography">
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
<li class="tsd-description">
|
|
94
94
|
<aside class="tsd-sources">
|
|
95
95
|
<ul>
|
|
96
|
-
<li>Defined in src/portal/WebScene.ts:
|
|
96
|
+
<li>Defined in src/portal/WebScene.ts:99</li>
|
|
97
97
|
</ul>
|
|
98
98
|
</aside>
|
|
99
99
|
<div class="tsd-comment tsd-typography">
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
<li class="tsd-description">
|
|
139
139
|
<aside class="tsd-sources">
|
|
140
140
|
<ul>
|
|
141
|
-
<li>Defined in src/portal/WebScene.ts:
|
|
141
|
+
<li>Defined in src/portal/WebScene.ts:242</li>
|
|
142
142
|
</ul>
|
|
143
143
|
</aside>
|
|
144
144
|
<div class="tsd-comment tsd-typography">
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
<li class="tsd-description">
|
|
170
170
|
<aside class="tsd-sources">
|
|
171
171
|
<ul>
|
|
172
|
-
<li>Defined in src/portal/WebScene.ts:
|
|
172
|
+
<li>Defined in src/portal/WebScene.ts:44</li>
|
|
173
173
|
</ul>
|
|
174
174
|
</aside>
|
|
175
175
|
<div class="tsd-comment tsd-typography">
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
<section class="tsd-index-section ">
|
|
71
71
|
<h3>Interfaces</h3>
|
|
72
72
|
<ul class="tsd-index-list">
|
|
73
|
+
<li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/portal_widgets.floorfilter.html" class="tsd-kind-icon">Floor<wbr>Filter</a></li>
|
|
73
74
|
<li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/portal_widgets.range.html" class="tsd-kind-icon">Range</a></li>
|
|
74
75
|
<li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/portal_widgets.timeslider.html" class="tsd-kind-icon">Time<wbr>Slider</a></li>
|
|
75
76
|
<li class="tsd-kind-interface tsd-parent-kind-module"><a href="../interfaces/portal_widgets.widgets.html" class="tsd-kind-icon">Widgets</a></li>
|
|
@@ -92,7 +93,7 @@
|
|
|
92
93
|
<div class="tsd-signature tsd-kind-icon">Time<wbr>Units<wbr>Enum<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"esriTimeUnitsCenturies"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsDays"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsDecades"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsHours"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsMilliseconds"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsMinutes"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsMonths"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsSeconds"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsWeeks"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"esriTimeUnitsYears"</span></div>
|
|
93
94
|
<aside class="tsd-sources">
|
|
94
95
|
<ul>
|
|
95
|
-
<li>Defined in src/portal/Widgets.ts:
|
|
96
|
+
<li>Defined in src/portal/Widgets.ts:149</li>
|
|
96
97
|
</ul>
|
|
97
98
|
</aside>
|
|
98
99
|
<div class="tsd-comment tsd-typography">
|
|
@@ -116,6 +117,9 @@
|
|
|
116
117
|
</nav>
|
|
117
118
|
<nav class="tsd-navigation secondary menu-sticky">
|
|
118
119
|
<ul class="before-current">
|
|
120
|
+
<li class=" tsd-kind-interface tsd-parent-kind-module">
|
|
121
|
+
<a href="../interfaces/portal_widgets.floorfilter.html" class="tsd-kind-icon">Floor<wbr>Filter</a>
|
|
122
|
+
</li>
|
|
119
123
|
<li class=" tsd-kind-interface tsd-parent-kind-module">
|
|
120
124
|
<a href="../interfaces/portal_widgets.range.html" class="tsd-kind-icon">Range</a>
|
|
121
125
|
</li>
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
<section class="tsd-panel tsd-member tsd-kind-variable tsd-parent-kind-module">
|
|
82
82
|
<a name="version-1" class="tsd-anchor"></a>
|
|
83
83
|
<h3><span class="tsd-flag ts-flagConst">Const</span> version</h3>
|
|
84
|
-
<div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"32.
|
|
84
|
+
<div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"32.10.0"</span><span class="tsd-signature-symbol"> = "32.10.0"</span></div>
|
|
85
85
|
<aside class="tsd-sources">
|
|
86
86
|
<ul>
|
|
87
87
|
<li>Defined in src/version.ts:4</li>
|
package/docs/html/modules.html
CHANGED
|
@@ -218,6 +218,7 @@
|
|
|
218
218
|
<li class="tsd-kind-module"><a href="modules/portal_field.html" class="tsd-kind-icon">portal/<wbr>Field</a></li>
|
|
219
219
|
<li class="tsd-kind-module"><a href="modules/portal_fieldinfo.html" class="tsd-kind-icon">portal/<wbr>Field<wbr>Info</a></li>
|
|
220
220
|
<li class="tsd-kind-module"><a href="modules/portal_fillsymbol3dlayer.html" class="tsd-kind-icon">portal/<wbr>Fill<wbr>Symbol3DLayer</a></li>
|
|
221
|
+
<li class="tsd-kind-module"><a href="modules/portal_forminfo.html" class="tsd-kind-icon">portal/<wbr>Form<wbr>Info</a></li>
|
|
221
222
|
<li class="tsd-kind-module"><a href="modules/portal_format.html" class="tsd-kind-icon">portal/<wbr>Format</a></li>
|
|
222
223
|
<li class="tsd-kind-module"><a href="modules/portal_georsslayer.html" class="tsd-kind-icon">portal/<wbr>GeoRSSLayer</a></li>
|
|
223
224
|
<li class="tsd-kind-module"><a href="modules/portal_geometry.html" class="tsd-kind-icon">portal/<wbr>Geometry</a></li>
|
|
@@ -243,6 +244,7 @@
|
|
|
243
244
|
<li class="tsd-kind-module"><a href="modules/portal_linesymbol3d.html" class="tsd-kind-icon">portal/<wbr>Line<wbr>Symbol3D</a></li>
|
|
244
245
|
<li class="tsd-kind-module"><a href="modules/portal_linesymbol3dlayer.html" class="tsd-kind-icon">portal/<wbr>Line<wbr>Symbol3DLayer</a></li>
|
|
245
246
|
<li class="tsd-kind-module"><a href="modules/portal_locationinfo.html" class="tsd-kind-icon">portal/<wbr>Location<wbr>Info</a></li>
|
|
247
|
+
<li class="tsd-kind-module"><a href="modules/portal_mapfloorinfo.html" class="tsd-kind-icon">portal/<wbr>Map<wbr>Floor<wbr>Info</a></li>
|
|
246
248
|
<li class="tsd-kind-module"><a href="modules/portal_maprangeinfo.html" class="tsd-kind-icon">portal/<wbr>Map<wbr>Range<wbr>Info</a></li>
|
|
247
249
|
<li class="tsd-kind-module"><a href="modules/portal_mapservicelayer.html" class="tsd-kind-icon">portal/<wbr>Map<wbr>Service<wbr>Layer</a></li>
|
|
248
250
|
<li class="tsd-kind-module"><a href="modules/portal_mediainfo.html" class="tsd-kind-icon">portal/<wbr>Media<wbr>Info</a></li>
|
|
@@ -305,6 +307,7 @@
|
|
|
305
307
|
<li class="tsd-kind-module"><a href="modules/portal_type.html" class="tsd-kind-icon">portal/<wbr>Type</a></li>
|
|
306
308
|
<li class="tsd-kind-module"><a href="modules/portal_uniquevaluefromstyle.html" class="tsd-kind-icon">portal/<wbr>Unique<wbr>Value<wbr>From<wbr>Style</a></li>
|
|
307
309
|
<li class="tsd-kind-module"><a href="modules/portal_uniquevaluerenderer.html" class="tsd-kind-icon">portal/<wbr>Unique<wbr>Value<wbr>Renderer</a></li>
|
|
310
|
+
<li class="tsd-kind-module"><a href="modules/portal_utilitynetwork.html" class="tsd-kind-icon">portal/<wbr>Utility<wbr>Network</a></li>
|
|
308
311
|
<li class="tsd-kind-module"><a href="modules/portal_value.html" class="tsd-kind-icon">portal/<wbr>Value</a></li>
|
|
309
312
|
<li class="tsd-kind-module"><a href="modules/portal_vectortilelayer.html" class="tsd-kind-icon">portal/<wbr>Vector<wbr>Tile<wbr>Layer</a></li>
|
|
310
313
|
<li class="tsd-kind-module"><a href="modules/portal_verticaloffset.html" class="tsd-kind-icon">portal/<wbr>Vertical<wbr>Offset</a></li>
|
|
@@ -923,6 +926,9 @@
|
|
|
923
926
|
<li class=" tsd-kind-module">
|
|
924
927
|
<a href="modules/portal_fillsymbol3dlayer.html">portal/<wbr>Fill<wbr>Symbol3DLayer</a>
|
|
925
928
|
</li>
|
|
929
|
+
<li class=" tsd-kind-module">
|
|
930
|
+
<a href="modules/portal_forminfo.html">portal/<wbr>Form<wbr>Info</a>
|
|
931
|
+
</li>
|
|
926
932
|
<li class=" tsd-kind-module">
|
|
927
933
|
<a href="modules/portal_format.html">portal/<wbr>Format</a>
|
|
928
934
|
</li>
|
|
@@ -998,6 +1004,9 @@
|
|
|
998
1004
|
<li class=" tsd-kind-module">
|
|
999
1005
|
<a href="modules/portal_locationinfo.html">portal/<wbr>Location<wbr>Info</a>
|
|
1000
1006
|
</li>
|
|
1007
|
+
<li class=" tsd-kind-module">
|
|
1008
|
+
<a href="modules/portal_mapfloorinfo.html">portal/<wbr>Map<wbr>Floor<wbr>Info</a>
|
|
1009
|
+
</li>
|
|
1001
1010
|
<li class=" tsd-kind-module">
|
|
1002
1011
|
<a href="modules/portal_maprangeinfo.html">portal/<wbr>Map<wbr>Range<wbr>Info</a>
|
|
1003
1012
|
</li>
|
|
@@ -1184,6 +1193,9 @@
|
|
|
1184
1193
|
<li class=" tsd-kind-module">
|
|
1185
1194
|
<a href="modules/portal_uniquevaluerenderer.html">portal/<wbr>Unique<wbr>Value<wbr>Renderer</a>
|
|
1186
1195
|
</li>
|
|
1196
|
+
<li class=" tsd-kind-module">
|
|
1197
|
+
<a href="modules/portal_utilitynetwork.html">portal/<wbr>Utility<wbr>Network</a>
|
|
1198
|
+
</li>
|
|
1187
1199
|
<li class=" tsd-kind-module">
|
|
1188
1200
|
<a href="modules/portal_value.html">portal/<wbr>Value</a>
|
|
1189
1201
|
</li>
|
package/mapping/MapExtension.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import EsriViewpoint from"@arcgis/core/Viewpoint";import{ArgumentError}from"../ArgumentError.js";import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{TableExtension}from"../data/TableExtension.js";import{LayerPreset}from"../layer-preset/LayerPreset.js";import{Menu}from"../menus/Menu.js";import{toEsriApiGeometry}from"../portal/Geometry.js";import{WebMap as WebMapJson}from"../portal/WebMap.js";import{WebScene as WebSceneJson}from"../portal/WebScene.js";import{resolveRelativeHrefs}from"../portal/_utils.js";import{DefaultArcGISRequestHelper}from"../support/ArcGISRequestHelper.js";import{FormatSettings}from"../support/FormatSettings.js";import{InitializableCollectionProxy}from"../support/InitializableCollectionProxy.js";import{ReadOnlyInitializableCollection}from"../support/ReadOnlyInitializableCollection.js";import{serializable}from"../support/Serializable.js";import{WellKnownBasemap}from"../support/esri.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{basemapsAreEquivalent,createStandardBasemap,isStandardBasemap}from"../utilities/basemaps.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{load}from"../utilities/esri.js";import{project}from"../utilities/geometry.js";import{find}from"../utilities/iterable.js";import{layersAreEquivalent}from"../utilities/layers.js";import{getLogger}from"../utilities/log.js";import{getMapSpatialReference,isMap,isWebMap,isWebScene}from"../utilities/mapping.js";import{toPortalItem as toPortalItemBase}from"../utilities/portal.js";import{parallelEach}from"../utilities/promise.js";import{onCollectionPropertyChange,onEach}from"../utilities/watch.js";import{BasemapExtension}from"./BasemapExtension.js";import{Bookmark}from"./Bookmark.js";import{GroundExtension}from"./GroundExtension.js";import{GroupLayerExtension}from"./GroupLayerExtension.js";import{MapConstraints}from"./MapConstraints.js";import{_assignLayerExtensions,LayerExtension}from"./_LayerExtension.js";import{LayerExtensionCollectionBase}from"./support/_LayerExtensionCollection.js";const log=getLogger("MapExtension");let MapExtension=class extends EntityBase{constructor(e){var t;super(e),this.isSwitchingMap=!1,this._layerViews=new Collection,this._skipBasemapOptions=!1;let i={...e};this._basemapOptions=new BasemapExtensionCollection(this),this._groundExtensions=new WeakMap,this._layerExtensions=this._createLayerExtensionCollection(),this.tableExtensions=this._createTableExtensionCollection(),this.formatSettings=this._createFormatSettings(),this._bookmarks=new Collection,this.constraints=new MapConstraints,this.watch(["_map","_scene"],(e=>{e&&(onEach(e.layers,"layerview-create",(e=>{this._layerViews.add(e.layerView)})),onEach(e.layers,"layerview-destroy",(e=>{this._layerViews.remove(e.layerView)})))}));const{webMap:s,webScene:a,initialViewMode:n,map:o,basemapOptions:r}=i;if(this._webMap=s,this._webScene=a,this._webMapItem=toPortalItem(s),this._webSceneItem=toPortalItem(a),this.initialViewMode=n,isWebScene(o)&&a)throw new ArgumentError("Cannot specify webScene property if map is initialized to a WebScene instance.");if(isMap(o)&&s)throw new ArgumentError("Cannot specify webMap property if map is initialized to a 2D Map instance.");if(isWebScene(o)||isWebMap(o)||isMap(o))this.assignProperties({basemapOptions:r}),this._skipBasemapOptions=!!r;else{const{map:e,layerExtensions:t,tableExtensions:s,groundExtension:a,basemapOptions:n,basemapExtension:o,...r}=i;this._deferredProperties={map:e,layerExtensions:t,tableExtensions:s,groundExtension:a,basemapOptions:n,basemapExtension:o},i=r,n&&(this._skipBasemapOptions=!0)}this._initMapFromProperties(i),this.watch("map.basemap",(()=>this._onBasemapChange()),!0),this.watch("map.ground",(()=>this._onGroundChange()),!0),this.allLayerExtensions=new AllLayerExtensionCollectionImpl(this),(null===(t=this.map)||void 0===t?void 0:t.basemap)&&this._onBasemapChange()}get webMap(){return this._webMap}get webScene(){return this._webScene}get map(){return this._currentMap}get viewMode(){return this.map?isWebScene(this.map)?"scene":"map":this.initialViewMode}get initialViewMode(){return this.webMap&&this.webScene?this._initialViewMode||"map":isWebScene(this.map)||this.webScene&&!this.webMap?"scene":"map"}set initialViewMode(e){this._initialViewMode=e}get requestHelper(){return this._requestHelper||(this._requestHelper=new DefaultArcGISRequestHelper),this._requestHelper}set requestHelper(e){this._requestHelper=e}get basemapExtension(){return this._basemapExtension}set basemapExtension(e){const t=this._basemapExtension;if(t!==e)if(t&&t._setMapExtension(void 0),e){if(e._setMapExtension(this),this.isInitialized&&!e.basemap){if(e.isInitialized)throw e._setMapExtension(void 0),new InvalidOperationError("Cannot set MapExtension.basemapExtension without a valid Esri Basemap object");e.initialize()}this._ensureIsBasemapOption(e),this.map&&e.basemap&&e.basemap!==this.map.basemap?this.map.basemap=e.basemap:this._basemapExtension=e}else this.map.basemap=void 0,this._basemapExtension=void 0}get groundExtension(){var e;return this._groundExtension||(this.groundExtension=new GroundExtension({ground:null===(e=this.map)||void 0===e?void 0:e.ground})),this._groundExtension}set groundExtension(e){if(!e)throw new InvalidOperationError("Cannot set map.ground to undefined");const t=this._groundExtension;t!==e&&(t&&t._setMapExtension(void 0),e._setMapExtension(this),e._resolveGround(),e.ground?(this._groundExtensions.set(e.ground,e),this.map&&e.ground!==this.map.ground?this.map.ground=e.ground:this._groundExtension=e):this._groundExtension=e)}get basemapOptions(){return this._basemapOptions}get bookmarks(){return this._bookmarks}get initialBasemapExtension(){return this._initialBasemapExtension}get initialLayerPreset(){return this._initialLayerPreset}set initialLayerPreset(e){if(!e)return void(this._initialLayerPreset=void 0);const t=e instanceof LayerPreset?e:new LayerPreset(e);this._initialLayerPreset=t}get _itemType(){return ItemType.MAP_EXTENSION}get _spatialReference(){return getMapSpatialReference(this.map)}get webMapItemTitle(){if(this._webMapItem)return this._webMapItem.title}get webSceneItemTitle(){if(this._webSceneItem)return this._webSceneItem.title}get title(){return this._title?this._title:this._webMapItem&&"map"===this.viewMode?this.webMapItemTitle:this._webSceneItem&&"scene"===this.viewMode?this.webSceneItemTitle:void 0}set title(e){this._title=e}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&log.error({message:"An error occurred while initializing context menu.",error:e})}})()}get layerExtensions(){return this._layerExtensions}getAllFeatureSources(e=(()=>!0)){const t=[],i=a=>{a.hasFeatures&&t.push(a);for(const t of a.sublayerExtensions.initializedItems.filter(e).toArray())s(t);if(a instanceof GroupLayerExtension)for(const t of a.layerExtensions.initializedItems.filter(e).toArray())i(t)},s=i=>{t.push(i);for(const t of i.sublayerExtensions.initializedItems.filter(e).toArray())s(t)};for(const t of this.layerExtensions.initializedItems.filter(e).toArray())i(t);for(const i of this.tableExtensions.initializedItems.filter(e).toArray())t.push(i);if(this.basemapExtension){for(const t of this.basemapExtension.baseLayerExtensions.initializedItems.filter(e).toArray())i(t);for(const t of this.basemapExtension.referenceLayerExtensions.initializedItems.filter(e).toArray())i(t)}return t}isSupportedViewMode(e){return e===this.viewMode||!(!this.webMap&&!this.webScene)&&("scene"===e?!!this.webScene:!!this.webMap)}async switchViewMode(e){if(checkArg("viewMode",e).isNotMissing().satisfies((e=>this.isSupportedViewMode(e)),"Unsupported view mode."),this.viewMode===e)return;let t;"scene"===e?(await this._createScene(),t=this._scene):(await this._createMap(),t=this._map),t.basemap=this.map.basemap,await this.switchMap(t),this._notifyChange("viewMode"),this._notifyChange("title")}async switchMap(e){if(checkArg("newMap",e).isNotMissing(),e===this.map)return;if(!this.map)return void this._setMap(e);this.isSwitchingMap=!0,this.isInitialized&&await load(e);const t=new Map;this.map.layers.forEach((e=>t.set(e,this.layerExtensions.forLayer(e))));const{basemapExtension:i}=this;this._setMap(e),this._updateBookmarks();const s=[];for(const e of this.map.layers.toArray()){const i=find(t.entries(),(([t])=>layersAreEquivalent(t,e)));i&&s.push((async()=>{const t=i[1];await t._switchLayer(e),this._layerExtensions._register(t)})())}this.map.basemap&&i&&basemapsAreEquivalent(this.map.basemap,i.basemap)&&s.push((async()=>{await i._switchBasemap(this.map.basemap),this.basemapExtension=i})()),this.isInitialized&&s.push(this._initializeChildren()),await Promise.all(s),this.isSwitchingMap=!1}async setWebMap(e){if(!e&&this.webMap&&!this.webScene)throw new InvalidOperationError("Cannot unset both webMap and webScene.");this._webMap=e,this._map=void 0,this._createMapPromise=void 0,this._webMapItem=toPortalItem(e),await load(this._webMapItem),"map"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createMap(),await this.switchMap(this._map),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("scene")),this._notifyChange("webMap"),this._notifyChange("initialViewMode"),this._notifyChange("title")}async setWebScene(e){if(!e&&this.webScene&&!this.webMap)throw new InvalidOperationError("Cannot unset both webMap and webScene.");this._webScene=e,this._scene=void 0,this._createScenePromise=void 0,this._webSceneItem=toPortalItem(e),await load(this._webSceneItem),"scene"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createScene(),await this.switchMap(this._scene),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("map")),this._notifyChange("webScene"),this._notifyChange("initialViewMode"),this._notifyChange("title")}getDefaults(){const e=super.getDefaults();return e.initialViewMode="map",e}async _createScene(){var e;if(!this._scene&&this.webScene)return this._createScenePromise=null!==(e=this._createScenePromise)&&void 0!==e?e:(async()=>{if(isPortalItem(this.webScene)){const e=new((await import("@arcgis/core/WebScene")).default);await this._loadAndApplyPortalItemData(this._webSceneItem,e),this._scene=e}else this._scene=await WebSceneJson.toEsriApiWebScene(this.webScene)})()}async _createMap(){var e;if(!this._map&&this.webMap)return this._createMapPromise=null!==(e=this._createMapPromise)&&void 0!==e?e:(async()=>{if(isPortalItem(this.webMap)){const e=new((await import("@arcgis/core/WebMap")).default);await this._loadAndApplyPortalItemData(this._webMapItem,e),this._map=e}else this._map=await WebMapJson.toEsriApiWebMap(this.webMap)})()}_getSerializableProperties(){return{...super._getSerializableProperties(),layerExtensions:{serializeModes:["initial","project"],deserialize:e=>{var t,i;if(this.map&&e){const s=null!==(i=null===(t="map"===this.viewMode?this._scene:this._map)||void 0===t?void 0:t.layers.toArray())&&void 0!==i?i:[],a=e.filter((e=>!s.includes(e.layer)&&!s.some((t=>LayerExtension._matchesRef(t,e.layer)))));_assignLayerExtensions(this.layerExtensions,a)}},serialize:e=>{var t,i,s,a;if(null===(t=this._deferredProperties)||void 0===t?void 0:t.layerExtensions)return this._deferredProperties.layerExtensions;{const t="map"===this.viewMode,n=null===(i=t?this._map:this._scene)||void 0===i?void 0:i.layers.toArray();let o=null!==(a=null===(s=t?this._scene:this._map)||void 0===s?void 0:s.layers.toArray())&&void 0!==a?a:[];return o=o.filter((e=>!n.find((t=>layersAreEquivalent(t,e))))),this.layerExtensions.concat(o.map((e=>this._layerExtensions._forLayer(e)))).filter((t=>"initial"!==e||!t.dynamicallyAddedLayer)).toArray()}}},tableExtensions:{serializeModes:["initial","project"],deserialize:e=>{this.map?compare(this.tableExtensions,e,{onNew:(e,t)=>{this.tableExtensions.add(e instanceof TableExtension?e:TableExtension.create(e),t)},onMatch:(e,t,i,s)=>{t instanceof TableExtension||e.assignProperties(t),i!==s&&this.tableExtensions.reorder(e,s)},equals:(e,t)=>t instanceof TableExtension?t===e:!!TableExtension._matchesRef(e,t.table)||e.id===t.id}):this._deferredProperties={...this._deferredProperties,tableExtensions:e}},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.tableExtensions)?null===(t=this._deferredProperties)||void 0===t?void 0:t.tableExtensions:this.tableExtensions.toArray()}},basemapExtension:{serializeModes:["project"],deserialize:e=>{this.map?e?e instanceof BasemapExtension?this.basemapExtension=e:this.basemapExtension?this.basemapExtension.assignProperties(e):this.basemapExtension=BasemapExtension.create(e):this.basemapExtension=void 0:this._deferredProperties={...this._deferredProperties,basemapExtension:e}},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.basemapExtension)?null===(t=this._deferredProperties)||void 0===t?void 0:t.basemapExtension:this.basemapExtension}},basemapOptions:{serializeModes:["initial"],deserialize:e=>{this._skipBasemapOptions?this._skipBasemapOptions=!1:(compare(this.basemapOptions,e,{onNew:(e,t)=>{this.basemapOptions.add(e instanceof BasemapExtension?e:BasemapExtension.create(e),t)},onMatch:(e,t,i,s)=>{t instanceof BasemapExtension||e.assignProperties(t),i!==s&&this.basemapOptions.reorder(e,s)},onMissing:e=>{this.basemapOptions.remove(e)},equals:(e,t)=>{if(t instanceof BasemapExtension)return t===e;if(e.id&&t.id)return e.id===t.id;{const i=e.toJSON();return basemapsAreEquivalent(i.basemap,t.basemap||t.baseMap)}}}),this.basemapExtension&&this._ensureIsBasemapOption(this.basemapExtension),this.isInitialized&¶llelEach(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())))},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.basemapOptions)?null===(t=this._deferredProperties)||void 0===t?void 0:t.basemapOptions:this.basemapOptions.toArray()}},groundExtension:{serializeModes:["initial"],deserialize:e=>{this.map?e instanceof GroundExtension?this.groundExtension=e:this.groundExtension.assignProperties(e):this._deferredProperties={...this._deferredProperties,groundExtension:e}},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.groundExtension)?null===(t=this._deferredProperties)||void 0===t?void 0:t.groundExtension:this.groundExtension}},bookmarks:{serialize:()=>this.bookmarks.map((e=>e.toJSON())).toArray(),deserialize:e=>{this.bookmarks.addMany(e.map((e=>e instanceof Bookmark?e:new Bookmark(e))))}},webMap:{serializeModes:["initial"],deserialize:!1},webScene:{serializeModes:["initial"],deserialize:!1},initialLayerPreset:"initial",initialViewMode:{serializeModes:["initial","project"],serialize:e=>"project"===e?this.viewMode:"scene"!==this.initialViewMode||!this.webScene&&this.webMap?"map":"scene",deserialize:e=>{this.viewMode!==e&&(this._deserializedViewMode=e),this._initialViewMode=e},isDefault:(e,t)=>"project"!==t&&"map"===e},formatSettings:"initial",constraints:"initial",title:"initial",onClick:"initial",onHover:"initial",onHoverEnd:"initial",onInitialized:"initial",onViewpointChanged:"initial",contextMenu:{serializeModes:["initial"],deserialize:e=>{e?e instanceof Menu?this.contextMenu=e:this.contextMenu?this.contextMenu.assignProperties(e):this.contextMenu=Menu.create(e):this.contextMenu=void 0}},map:{serializeModes:["project"],serialize:()=>({operationalLayers:this.layerExtensions.toArray().filter((e=>e.layer)).map((e=>e._getProjectWebmapJSON())),tables:this.tableExtensions.toArray().filter((e=>e.table)).map((e=>({id:e.table.id,title:e.table.title})))}),deserialize:e=>{if(this.map)if(isMap(e)||isWebMap(e)||isWebScene(e)){if(e!==this.map)throw new ArgumentError("properties.map","Property 'map' is read-only.")}else this._deserializedMapPromise=(async()=>{this._deserializedViewMode&&this.webMap&&this.webScene&&(this._deserializedViewModePromise=this.switchViewMode(this._deserializedViewMode),await this._deserializedViewModePromise,this._deserializedViewMode=void 0,this._deserializedViewModePromise=void 0),await this._applyMapProperties(e,this.map),this._deserializedMapPromise=void 0})();else this._deferredProperties={...this._deferredProperties,map:e}}},requestHelper:{serialize:!1}}}async _applyMapProperties(e,t,i){await parallelEach(this.basemapOptions.toArray(),(e=>e._createBackingBasemap()));let s=e;const a=this.basemapOptions.find((e=>basemapsAreEquivalent(e.basemap,s.baseMap)));a&&(t.basemap=a.basemap,s={...s,baseMap:{...s.baseMap,title:t.basemap.title}}),isWebScene(t)?await WebSceneJson.applyToEsriApiWebScene(s,t,i):await WebMapJson.applyToEsriApiMap(s,t,i)}_createFormatSettings(){return new FormatSettings}_createLayerExtensionCollection(){return new LayerExtensionCollectionImpl(this)}_createTableExtensionCollection(){return new TableExtensionCollectionImpl(this)}async _onInitialize(){var e;await super._onInitialize();const{basemapExtension:t,basemapOptions:i,groundExtension:s,webMap:a,webScene:n,map:o,...r}=null!==(e=this._deferredProperties)&&void 0!==e?e:{};if(i&&this.assignProperties({basemapOptions:i}),this.map||("scene"===this.initialViewMode?this._setMap(new((await import("@arcgis/core/WebScene")).default)):this._setMap(new((await import("@arcgis/core/WebMap")).default))),this.map.basemap&&this._onBasemapChange(),(a||n)&&await this._applyMapProperties("scene"===this.initialViewMode?n:a,this.map),t&&(this.assignProperties({basemapExtension:t}),await this.basemapExtension._createBackingBasemap()),s&&this.assignProperties({groundExtension:s}),this._webMapItem||this._webSceneItem){await Promise.all([load(this.map),load(this._webMapItem),load(this._webSceneItem)]),validatePortalItem(this._webMapItem,"webMap","Web Map"),validatePortalItem(this._webSceneItem,"webScene","Web Scene");const e=isWebScene(this.map)?this._webSceneItem:this._webMapItem;await this._loadAndApplyPortalItemData(e)}else await load(this.map);o&&await this._applyMapProperties(o,this.map),this.assignProperties(r),this._deferredProperties=void 0,this._initialBasemapExtension=this.basemapExtension,this._updateBookmarks(),this.contextMenu&&await this.contextMenu.initialize();for(const e of this.layerExtensions.toArray())await e._createBackingLayer()}async _postInitialize(){await super._postInitialize(),await this._createStandardBasemapOptions(),await parallelEach(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())),this.initialLayerPreset&&await this.initialLayerPreset.applyTo(this)}*_initializableChildCollections(){yield*super._initializableChildCollections();const e=new Collection(this.layerExtensions.filter((e=>!!e.layer)));if(e.remove=e=>{this.layerExtensions.remove(e)},yield e,yield this.tableExtensions,this.basemapExtension){const e=new Collection;e.add(this.basemapExtension),yield e}const t=new Collection;t.add(this.groundExtension),yield t}_initMapFromProperties(e){const t=e.map;isMap(t)||isWebMap(t)||isWebScene(t)?this._setMap(t):"scene"===this.initialViewMode?e.webScene&&!isPortalItem(e.webScene)&&(this._deferredProperties={webScene:e.webScene,...this._deferredProperties}):e.webMap&&!isPortalItem(e.webMap)&&(this._deferredProperties={webMap:e.webMap,...this._deferredProperties})}_setMap(e){var t,i;isWebScene(e)?this._scene=e:this._map=e,this._currentMap=e,(null===(t=this.basemapExtension)||void 0===t?void 0:t.basemap)&&!e.basemap&&(e.basemap=this.basemapExtension.basemap),(null===(i=this.groundExtension)||void 0===i?void 0:i.ground)&&!e.ground&&(e.ground=this.groundExtension.ground),this._notifyChange("map")}async _loadAndApplyPortalItemData(e,t){var i;await load(e);const s=await e.fetchData();resolveRelativeHrefs(s,e),await this._inferLayerTypes(s),(null===(i=this.basemapExtension)||void 0===i?void 0:i.basemap)&&!t&&delete s.baseMap,GroundExtension.isDefaultGround(this.groundExtension.ground)||t||delete s.ground;const a=t||this.map;await load(a),await this._applyMapProperties(s,a,e),a.portalItem=e;const{viewpoint:n,spatialReference:o}=a.initialViewProperties;n&&n.targetGeometry&&!n.targetGeometry.spatialReference.equals(o)&&(a.initialViewProperties.viewpoint.targetGeometry=(await project([n.targetGeometry],o))[0]),n&&n.camera&&(n.camera.position.spatialReference=o.clone())}_onBasemapChange(){if(this._basemapExtension){if(this.basemapExtension.basemap==this.map.basemap)return;this._basemapExtension._setMapExtension(void 0)}if(this.map.basemap){let e=this.basemapOptions.find((e=>e.basemap===this.map.basemap));e||(e=BasemapExtension.create({basemap:this.map.basemap}),this._basemapOptions.addInternal(e,0)),e.mapExtension!==this&&e._setMapExtension(this),this._basemapExtension=e}else this._basemapExtension=void 0;this._notifyChange("basemapExtension")}_onGroundChange(){if(this._groundExtension){if(this.groundExtension.ground===this.map.ground)return void(this._groundExtensions.has(this.map.ground)||this._groundExtensions.set(this.map.ground,this.groundExtension));this.groundExtension._setMapExtension(void 0)}this._groundExtensions.has(this.map.ground)||this._groundExtensions.set(this.map.ground,new GroundExtension({ground:this.map.ground}));const e=this._groundExtensions.get(this.map.ground);e.mapExtension!==this&&e._setMapExtension(this),this._groundExtension=e,this._notifyChange("groundExtension")}async _inferLayerTypes(e){var t;const i=[];if(e.operationalLayers)for(const t of e.operationalLayers)i.push(this._inferLayerType(t));if(e.baseMap&&i.push(this._inferBasemapLayerTypes(e.baseMap)),e.hasOwnProperty("ground")&&i.push(this._inferGroundLayerTypes(e.ground)),null===(t=e.presentation)||void 0===t?void 0:t.slides)for(const t of e.presentation.slides)t.baseMap&&"string"!=typeof t.baseMap&&i.push(this._inferBasemapLayerTypes(t.baseMap));await Promise.all(i)}async _inferBasemapLayerTypes(e){const t=[];if(e.baseMapLayers)for(const i of e.baseMapLayers)t.push(this._inferLayerType(i));await Promise.all(t)}async _inferGroundLayerTypes(e){const t=[];if(e.layers)for(const i of e.layers)t.push(this._inferLayerType(i));await Promise.all(t)}async _inferLayerType(e){if(!e.layerType)if(e.type)e.layerType=e.type;else if(e.url){const t=e.url;if(t.match(".*MapServer/\\d{1,}/?$")||t.match(".*FeatureServer/\\d{1,}/?$"))e.layerType="ArcGISFeatureLayer";else if(t.match(".*StreamServer/?$"))e.layerType="ArcGISStreamLayer";else if(t.match(".*ImageServer/?$")){const i=await this._getLayerData(t);i.cacheType?"Map"===i.cacheType?e.layerType="ArcGISTiledImageServiceLayer":"Elevation"===i.cacheType&&(e.layerType="ArcGISTiledElevationServiceLayer"):e.layerType="ArcGISImageServiceLayer"}else if(t.match(".*MapServer/?$")){const i=await this._getLayerData(t);e.layerType=i.tileInfo?"ArcGISTiledMapServiceLayer":"ArcGISMapServiceLayer"}else if(t.match(".*\\.(csv|txt)$"))e.layerType="CSV";else if(t.match(".*\\.kml$"))e.layerType="KML";else if(t.match(".*SceneServer/layers/\\d{1,}/?$")){const i=await this._getLayerData(t);"3DObject"===i.layerType?e.layerType="ArcGISSceneServiceLayer":"IntegratedMesh"===i.layerType?e.layerType="IntegratedMeshLayer":"PointCloud"===i.layerType&&(e.layerType="PointCloudLayer")}else t.match(".*(\\.xml|rss/?)$")&&(e.layerType="GeoRSS")}else if(e.layers){e.layerType="GroupLayer";const t=[];for(const i of e.layers)t.push(this._inferLayerType(i));await Promise.all(t)}else e.templateUrl&&e.tileInfo?e.layerType="WebTiledLayer":e.featureCollection?e.layerType="ArcGISFeatureLayer":e.styleUrl?e.layerType="VectorTileLayer":e.mapUrl&&(e.layerType="WMS")}async _getLayerData(e){const t=await this.requestHelper.request(e,{query:{f:"json"}});if(!t||!t.data)throw new Error(`Response to request for url ${e} was invalid.`);return t.data}async _createStandardBasemapOptions(){const e=this._spatialReference;!this._basemapOptions.isExplicitlyModified&&e&&e.isWebMercator&&await parallelEach([WellKnownBasemap.SATELLITE,WellKnownBasemap.HYBRID_VECTOR,WellKnownBasemap.STREETS_VECTOR,WellKnownBasemap.TOPO_VECTOR,WellKnownBasemap.STREETS_NAVIGATION_VECTOR,WellKnownBasemap.STREETS_NIGHT_VECTOR,WellKnownBasemap.TERRAIN_VECTOR,WellKnownBasemap.DARK_GRAY_VECTOR,WellKnownBasemap.GRAY_VECTOR,WellKnownBasemap.NATIONAL_GEOGRAPHIC,WellKnownBasemap.OCEANS_VECTOR,WellKnownBasemap.OPEN_STREET_MAP_VECTOR],(async e=>{const t=await createStandardBasemap(e);basemapsAreEquivalent(this.map.basemap,t)?this._basemapOptions.addInternal(this.basemapExtension):this._basemapOptions.addInternal(BasemapExtension.create({basemap:t}),void 0,!1)}))}_ensureIsBasemapOption(e){const t=this.basemapOptions.findIndex((t=>t.basemap===e.basemap));t>=0?this._basemapOptions.getItemAt(t)!==e&&(this._basemapOptions.removeAtInternal(t),this._basemapOptions.addInternal(e,t)):this._basemapOptions.addInternal(e,0)}_updateBookmarks(){var e,t,i;this.bookmarks.removeMany(this.bookmarks.filter((e=>"map"===e.source))),isWebMap(this.map)&&(null===(e=this.map.bookmarks)||void 0===e?void 0:e.length)>0?this.map.bookmarks.forEach((e=>{const t=toEsriApiGeometry(e.extent),i=new EsriViewpoint({targetGeometry:t});this.bookmarks.add(new Bookmark({source:"map",title:e.name,viewpoint:i}))})):isWebScene(this.map)&&(null===(i=null===(t=this.map.presentation)||void 0===t?void 0:t.slides)||void 0===i?void 0:i.length)>0&&this.map.presentation.slides.forEach((e=>{const t={source:"map",title:e.title.text,viewpoint:e.viewpoint},i=new Bookmark(t);this.bookmarks.add(i)}))}};MapExtension=__decorate([serializable],MapExtension);export{MapExtension};class LayerExtensionCollectionImpl extends LayerExtensionCollectionBase{constructor(e){super(e,"map.layers")}get _mapExtension(){return this._parent}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(ItemType.LAYER_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}}class BasemapExtensionCollection extends InitializableCollectionProxy{constructor(e){super(new Collection),this.isExplicitlyModified=!1,this._mapExtension=e}add(e,t){super.add(e,t),this.isExplicitlyModified=!0,1===this.length&&this._mapExtension.map&&!this._mapExtension.basemapExtension&&(this._mapExtension.basemapExtension=e)}addMany(e,t){super.addMany(e,t),this.isExplicitlyModified=!0}addInternal(e,t,i=!0){const s=e=>{const t="-vector";return(null==e?void 0:e.endsWith(t))?e.substring(0,e.length-t.length):e};let a;if(e.basemap){const t=s(e.basemap.id);if(a=this.findIndex((e=>{var i;return s(null===(i=e.basemap)||void 0===i?void 0:i.id)===t})),isStandardBasemap(e.basemap)&&a>=0){if(!i)return;super.removeAt(a)}}super.add(e,null!=t?t:a>=0?a:void 0)}removeAt(e){const t=super.removeAt(e);return t&&(this.isExplicitlyModified=!0,t===this._mapExtension.basemapExtension&&(e<this.length?this._mapExtension.basemapExtension=this.getItemAt(e):this.length?this._mapExtension.basemapExtension=this.getItemAt(e-1):this._mapExtension.basemapExtension=void 0)),t}removeAll(){this._mapExtension.basemapExtension=void 0,super.removeAll()}removeAtInternal(e){return super.removeAt(e)}removeAllInternal(){for(;this.length;)this.removeAtInternal(this.length-1)}reorder(e,t){return super.reorder(e,t),this.isExplicitlyModified=!0,e}reorderInternal(e,t){return super.reorder(e,t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.basemap}}class TableExtensionCollectionImpl extends InitializableCollectionProxy{constructor(e){super(),this._tableExtensionMap=new WeakMap,this._uninitializedTableExtensions=new Set,this._mapExtension=e,onCollectionPropertyChange(this._mapExtension,"map.tables",(e=>{const t={added:(e.added||[]).map((e=>this._forTable(e))),moved:(e.moved||[]).map((e=>this._forTable(e))),removed:(e.removed||[]).map((e=>this._forTable(e))),target:this};this.emit("change",t)})),this._mapExtension.watch("map.tables.length",(()=>this._notifyChange("length")))}get _collection(){return this._tables.map((e=>this._forTable(e))).concat(Array.from(this._uninitializedTableExtensions))}get _tables(){var e,t;return null!==(t=null===(e=this._mapExtension.map)||void 0===e?void 0:e.tables)&&void 0!==t?t:new ReadOnlyCollection(new Collection)}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(ItemType.TABLE_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}clone(){const e=new TableExtensionCollectionImpl(this._mapExtension);return e._tableExtensionMap=this._tableExtensionMap,e}findById(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.id===e))}findByTableId(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.table.id===e))}forTable(e){if(checkArg("table",e).isNotMissing(),this._tables.includes(e))return this._forTable(e)}add(e,t){if(checkArg("tableX",e).isNotMissing(),e.mapExtension&&e.mapExtension.tableExtensions.remove(e),e._setMapExtension(this._mapExtension),e.table){const i=this._tableExtensionMap.get(e.table);if(this._tableExtensionMap.set(e.table,e),i&&i!==e&&this._onRemoved(i),this._tables.includes(e.table))if(void 0===t){const t={added:[e],moved:[],removed:i?[i]:[],target:this};this.emit("change",t)}else this._tables.reorder(e.table,t);else this._tables.add(e.table,t)}else{this._uninitializedTableExtensions.add(e);const t={added:[e],moved:[],removed:[],target:this};this.emit("change",t)}this._onAdded(e)}removeAt(e){const t=this.getItemAt(e);if(void 0!==t){if(this._uninitializedTableExtensions.has(t)){this._uninitializedTableExtensions.delete(t);const e={added:[],moved:[],removed:[t],target:this};this.emit("change",e)}else this._tables.remove(t.table);return this._onRemoved(t),t}}reorder(e,t){if(e&&this._tables.includes(e.table))return this._tables.reorder(e.table,t),e}sort(e){this._tables.sort(((t,i)=>e(this._forTable(t),this._forTable(i))))}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.table}_onAdded(e){}_onRemoved(e){e._setMapExtension(void 0)}_forTable(e){for(const e of this._uninitializedTableExtensions)e._resolveTable(),e.table&&(this._tableExtensionMap.set(e.table,e),this._uninitializedTableExtensions.delete(e));if(!this._tableExtensionMap.has(e)){const t=TableExtension.create({table:e});this._tableExtensionMap.set(e,t),t._setMapExtension(this._mapExtension),this._onAdded(t)}return this._tableExtensionMap.get(e)}}class AllLayerExtensionCollectionImpl extends ReadOnlyInitializableCollection{constructor(e){super(),this._mapExtension=e}get _collection(){let e=this._mapExtension.layerExtensions.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[]));return this._mapExtension.basemapExtension&&(e=e.concat(this._mapExtension.basemapExtension.baseLayerExtensions.toArray()).concat(this._mapExtension.basemapExtension.referenceLayerExtensions.toArray())),e=e.concat(this._mapExtension.groundExtension.layerExtensions.toArray()),e}findById(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.id===e))}findByLayerId(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.layer.id===e))}forLayer(e){return checkArg("layer",e).isNotMissing(),this.findByLayerId(e.id)}emit(e,t){if("change"===e){const i=new Collection;i.addMany(t.added);const s=i.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[])).toArray(),a=new Collection;a.addMany(t.removed);const n=a.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[])).toArray(),o=new Collection;o.addMany(t.moved);const r=o.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[])).toArray();super.emit(e,{added:s,removed:n,moved:r,target:this})}return super.emit(e,t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.layer}}function toPortalItem(e){if("object"!=typeof e||!e||!e.baseMap)return toPortalItemBase(e)}function isPortalItem(e){return"object"!=typeof e||e&&!e.baseMap}function validatePortalItem(e,t,i){if((null==e?void 0:e.type)&&e.type!==i)throw new Error(`Invalid portal item type "${e.type}" for property ${t}.`)}
|
|
1
|
+
import{__decorate}from"tslib";import EsriViewpoint from"@arcgis/core/Viewpoint";import{ArgumentError}from"../ArgumentError.js";import{EntityBase}from"../Entity.js";import{InvalidOperationError}from"../InvalidOperationError.js";import{ItemType}from"../ItemType.js";import{TableExtension}from"../data/TableExtension.js";import{LayerPreset}from"../layer-preset/LayerPreset.js";import{Menu}from"../menus/Menu.js";import{toEsriApiGeometry}from"../portal/Geometry.js";import{WebMap as WebMapJson}from"../portal/WebMap.js";import{WebScene as WebSceneJson}from"../portal/WebScene.js";import{resolveRelativeHrefs}from"../portal/_utils.js";import{DefaultArcGISRequestHelper}from"../support/ArcGISRequestHelper.js";import{FormatSettings}from"../support/FormatSettings.js";import{InitializableCollectionProxy}from"../support/InitializableCollectionProxy.js";import{ReadOnlyInitializableCollection}from"../support/ReadOnlyInitializableCollection.js";import{serializable}from"../support/Serializable.js";import{WellKnownBasemap}from"../support/esri.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{basemapsAreEquivalent,createStandardBasemap,isStandardBasemap}from"../utilities/basemaps.js";import{checkArg}from"../utilities/checkArg.js";import{Collection,compare}from"../utilities/collection.js";import{load}from"../utilities/esri.js";import{project}from"../utilities/geometry.js";import{find}from"../utilities/iterable.js";import{layersAreEquivalent}from"../utilities/layers.js";import{getLogger}from"../utilities/log.js";import{getMapSpatialReference,isMap,isWebMap,isWebScene}from"../utilities/mapping.js";import{toPortalItem as toPortalItemBase}from"../utilities/portal.js";import{parallelEach}from"../utilities/promise.js";import{onCollectionPropertyChange,onEach}from"../utilities/watch.js";import{BasemapExtension}from"./BasemapExtension.js";import{Bookmark}from"./Bookmark.js";import{GroundExtension}from"./GroundExtension.js";import{GroupLayerExtension}from"./GroupLayerExtension.js";import{MapConstraints}from"./MapConstraints.js";import{_assignLayerExtensions,LayerExtension}from"./_LayerExtension.js";import{LayerExtensionCollectionBase}from"./support/_LayerExtensionCollection.js";const log=getLogger("MapExtension");let MapExtension=class extends EntityBase{constructor(e){var t;super(e),this.isSwitchingMap=!1,this._layerViews=new Collection,this._skipBasemapOptions=!1;let i={...e};this._basemapOptions=new BasemapExtensionCollection(this),this._groundExtensions=new WeakMap,this._layerExtensions=this._createLayerExtensionCollection(),this.tableExtensions=this._createTableExtensionCollection(),this.formatSettings=this._createFormatSettings(),this._bookmarks=new Collection,this.constraints=new MapConstraints,this.watch(["_map","_scene"],(e=>{e&&(onEach(e.layers,"layerview-create",(e=>{this._layerViews.add(e.layerView)})),onEach(e.layers,"layerview-destroy",(e=>{this._layerViews.remove(e.layerView)})))}));const{webMap:s,webScene:a,initialViewMode:n,map:o,basemapOptions:r}=i;if(this._webMap=s,this._webScene=a,this._webMapItem=toPortalItem(s),this._webSceneItem=toPortalItem(a),this.initialViewMode=n,isWebScene(o)&&a)throw new ArgumentError("Cannot specify webScene property if map is initialized to a WebScene instance.");if(isMap(o)&&s)throw new ArgumentError("Cannot specify webMap property if map is initialized to a 2D Map instance.");if(isWebScene(o)||isWebMap(o)||isMap(o))this.assignProperties({basemapOptions:r}),this._skipBasemapOptions=!!r;else{const{map:e,layerExtensions:t,tableExtensions:s,groundExtension:a,basemapOptions:n,basemapExtension:o,...r}=i;this._deferredProperties={map:e,layerExtensions:t,tableExtensions:s,groundExtension:a,basemapOptions:n,basemapExtension:o},i=r,n&&(this._skipBasemapOptions=!0)}this._initMapFromProperties(i),this.watch("map.basemap",(()=>this._onBasemapChange()),!0),this.watch("map.ground",(()=>this._onGroundChange()),!0),this.allLayerExtensions=new AllLayerExtensionCollectionImpl(this),(null===(t=this.map)||void 0===t?void 0:t.basemap)&&this._onBasemapChange()}get webMap(){return this._webMap}get webScene(){return this._webScene}get map(){return this._currentMap}get viewMode(){return this.map?isWebScene(this.map)?"scene":"map":this.initialViewMode}get initialViewMode(){return this.webMap&&this.webScene?this._initialViewMode||"map":isWebScene(this.map)||this.webScene&&!this.webMap?"scene":"map"}set initialViewMode(e){this._initialViewMode=e}get requestHelper(){return this._requestHelper||(this._requestHelper=new DefaultArcGISRequestHelper),this._requestHelper}set requestHelper(e){this._requestHelper=e}get basemapExtension(){return this._basemapExtension}set basemapExtension(e){const t=this._basemapExtension;if(t!==e)if(t&&t._setMapExtension(void 0),e){if(e._setMapExtension(this),this.isInitialized&&!e.basemap){if(e.isInitialized)throw e._setMapExtension(void 0),new InvalidOperationError("Cannot set MapExtension.basemapExtension without a valid Esri Basemap object");e.initialize()}this._ensureIsBasemapOption(e),this.map&&e.basemap&&e.basemap!==this.map.basemap?this.map.basemap=e.basemap:this._basemapExtension=e}else this.map.basemap=void 0,this._basemapExtension=void 0}get groundExtension(){var e;return this._groundExtension||(this.groundExtension=new GroundExtension({ground:null===(e=this.map)||void 0===e?void 0:e.ground})),this._groundExtension}set groundExtension(e){if(!e)throw new InvalidOperationError("Cannot set map.ground to undefined");const t=this._groundExtension;t!==e&&(t&&t._setMapExtension(void 0),e._setMapExtension(this),e._resolveGround(),e.ground?(this._groundExtensions.set(e.ground,e),this.map&&e.ground!==this.map.ground?this.map.ground=e.ground:this._groundExtension=e):this._groundExtension=e)}get basemapOptions(){return this._basemapOptions}get bookmarks(){return this._bookmarks}get initialBasemapExtension(){return this._initialBasemapExtension}get initialLayerPreset(){return this._initialLayerPreset}set initialLayerPreset(e){if(!e)return void(this._initialLayerPreset=void 0);const t=e instanceof LayerPreset?e:new LayerPreset(e);this._initialLayerPreset=t}get _itemType(){return ItemType.MAP_EXTENSION}get _spatialReference(){return getMapSpatialReference(this.map)}get webMapItemTitle(){if(this._webMapItem)return this._webMapItem.title}get webSceneItemTitle(){if(this._webSceneItem)return this._webSceneItem.title}get title(){return this._title?this._title:this._webMapItem&&"map"===this.viewMode?this.webMapItemTitle:this._webSceneItem&&"scene"===this.viewMode?this.webSceneItemTitle:void 0}set title(e){this._title=e}get contextMenu(){return this._contextMenu}set contextMenu(e){this._contextMenu=e,e&&this.isInitialized&&!e.isInitialized&&(async()=>{try{await e.initialize()}catch(e){e instanceof Error&&log.error({message:"An error occurred while initializing context menu.",error:e})}})()}get layerExtensions(){return this._layerExtensions}getAllFeatureSources(e=(()=>!0)){const t=[],i=a=>{a.hasFeatures&&t.push(a);for(const t of a.sublayerExtensions.initializedItems.filter(e).toArray())s(t);if(a instanceof GroupLayerExtension)for(const t of a.layerExtensions.initializedItems.filter(e).toArray())i(t)},s=i=>{t.push(i);for(const t of i.sublayerExtensions.initializedItems.filter(e).toArray())s(t)};for(const t of this.layerExtensions.initializedItems.filter(e).toArray())i(t);for(const i of this.tableExtensions.initializedItems.filter(e).toArray())t.push(i);if(this.basemapExtension){for(const t of this.basemapExtension.baseLayerExtensions.initializedItems.filter(e).toArray())i(t);for(const t of this.basemapExtension.referenceLayerExtensions.initializedItems.filter(e).toArray())i(t)}return t}isSupportedViewMode(e){return e===this.viewMode||!(!this.webMap&&!this.webScene)&&("scene"===e?!!this.webScene:!!this.webMap)}async switchViewMode(e){if(checkArg("viewMode",e).isNotMissing().satisfies((e=>this.isSupportedViewMode(e)),"Unsupported view mode."),this.viewMode===e)return;let t;"scene"===e?(await this._createScene(),t=this._scene):(await this._createMap(),t=this._map),t.basemap=this.map.basemap,await this.switchMap(t),this._notifyChange("viewMode"),this._notifyChange("title")}async switchMap(e){if(checkArg("newMap",e).isNotMissing(),e===this.map)return;if(!this.map)return void this._setMap(e);this.isSwitchingMap=!0,this.isInitialized&&await load(e);const t=new Map;this.map.layers.forEach((e=>t.set(e,this.layerExtensions.forLayer(e))));const{basemapExtension:i}=this;this._setMap(e),this._updateBookmarks();const s=[];for(const e of this.map.layers.toArray()){const i=find(t.entries(),(([t])=>layersAreEquivalent(t,e)));i&&s.push((async()=>{const t=i[1];await t._switchLayer(e),this._layerExtensions._register(t)})())}this.map.basemap&&i&&basemapsAreEquivalent(this.map.basemap,i.basemap)&&s.push((async()=>{await i._switchBasemap(this.map.basemap),this.basemapExtension=i})()),this.isInitialized&&s.push(this._initializeChildren()),await Promise.all(s),this.isSwitchingMap=!1}async setWebMap(e){if(!e&&this.webMap&&!this.webScene)throw new InvalidOperationError("Cannot unset both webMap and webScene.");this._webMap=e,this._map=void 0,this._createMapPromise=void 0,this._webMapItem=toPortalItem(e),await load(this._webMapItem),"map"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createMap(),await this.switchMap(this._map),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("scene")),this._notifyChange("webMap"),this._notifyChange("initialViewMode"),this._notifyChange("title")}async setWebScene(e){if(!e&&this.webScene&&!this.webMap)throw new InvalidOperationError("Cannot unset both webMap and webScene.");this._webScene=e,this._scene=void 0,this._createScenePromise=void 0,this._webSceneItem=toPortalItem(e),await load(this._webSceneItem),"scene"===this.viewMode&&(e?(this._basemapOptions.isExplicitlyModified||this._basemapOptions.removeAllInternal(),await this._createScene(),await this.switchMap(this._scene),await this._createStandardBasemapOptions(),this._basemapOptions.reorderInternal(this.basemapExtension,0),this._initialBasemapExtension=this.basemapExtension):await this.switchViewMode("map")),this._notifyChange("webScene"),this._notifyChange("initialViewMode"),this._notifyChange("title")}getDefaults(){const e=super.getDefaults();return e.initialViewMode="map",e}async _createScene(){var e;if(!this._scene&&this.webScene)return this._createScenePromise=null!==(e=this._createScenePromise)&&void 0!==e?e:(async()=>{if(isPortalItem(this.webScene)){const e=new((await import("@arcgis/core/WebScene")).default);await this._loadAndApplyPortalItemData(this._webSceneItem,e),this._scene=e}else this._scene=await WebSceneJson.toEsriApiWebScene(this.webScene)})()}async _createMap(){var e;if(!this._map&&this.webMap)return this._createMapPromise=null!==(e=this._createMapPromise)&&void 0!==e?e:(async()=>{if(isPortalItem(this.webMap)){const e=new((await import("@arcgis/core/WebMap")).default);await this._loadAndApplyPortalItemData(this._webMapItem,e),this._map=e}else this._map=await WebMapJson.toEsriApiWebMap(this.webMap)})()}_getSerializableProperties(){return{...super._getSerializableProperties(),layerExtensions:{serializeModes:["initial","project"],deserialize:e=>{var t,i;if(this.map&&e){const s=null!==(i=null===(t="map"===this.viewMode?this._scene:this._map)||void 0===t?void 0:t.layers.toArray())&&void 0!==i?i:[],a=e.filter((e=>!s.includes(e.layer)&&!s.some((t=>LayerExtension._matchesRef(t,e.layer)))));_assignLayerExtensions(this.layerExtensions,a)}},serialize:e=>{var t,i,s,a;if(null===(t=this._deferredProperties)||void 0===t?void 0:t.layerExtensions)return this._deferredProperties.layerExtensions;{const t="map"===this.viewMode,n=null===(i=t?this._map:this._scene)||void 0===i?void 0:i.layers.toArray();let o=null!==(a=null===(s=t?this._scene:this._map)||void 0===s?void 0:s.layers.toArray())&&void 0!==a?a:[];return o=o.filter((e=>!n.find((t=>layersAreEquivalent(t,e))))),this.layerExtensions.concat(o.map((e=>this._layerExtensions._forLayer(e)))).filter((t=>"initial"!==e||!t.dynamicallyAddedLayer)).toArray()}}},tableExtensions:{serializeModes:["initial","project"],deserialize:e=>{this.map?compare(this.tableExtensions,e,{onNew:(e,t)=>{this.tableExtensions.add(e instanceof TableExtension?e:TableExtension.create(e),t)},onMatch:(e,t,i,s)=>{t instanceof TableExtension||e.assignProperties(t),i!==s&&this.tableExtensions.reorder(e,s)},equals:(e,t)=>t instanceof TableExtension?t===e:!!TableExtension._matchesRef(e,t.table)||e.id===t.id}):this._deferredProperties={...this._deferredProperties,tableExtensions:e}},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.tableExtensions)?null===(t=this._deferredProperties)||void 0===t?void 0:t.tableExtensions:this.tableExtensions.toArray()}},basemapExtension:{serializeModes:["project"],deserialize:e=>{this.map?e?e instanceof BasemapExtension?this.basemapExtension=e:this.basemapExtension?this.basemapExtension.assignProperties(e):this.basemapExtension=BasemapExtension.create(e):this.basemapExtension=void 0:this._deferredProperties={...this._deferredProperties,basemapExtension:e}},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.basemapExtension)?null===(t=this._deferredProperties)||void 0===t?void 0:t.basemapExtension:this.basemapExtension}},basemapOptions:{serializeModes:["initial"],deserialize:e=>{this._skipBasemapOptions?this._skipBasemapOptions=!1:(compare(this.basemapOptions,e,{onNew:(e,t)=>{this.basemapOptions.add(e instanceof BasemapExtension?e:BasemapExtension.create(e),t)},onMatch:(e,t,i,s)=>{t instanceof BasemapExtension||e.assignProperties(t),i!==s&&this.basemapOptions.reorder(e,s)},onMissing:e=>{this.basemapOptions.remove(e)},equals:(e,t)=>{if(t instanceof BasemapExtension)return t===e;if(e.id&&t.id)return e.id===t.id;{const i=e.toJSON();return basemapsAreEquivalent(i.basemap,t.basemap||t.baseMap)}}}),this.basemapExtension&&this._ensureIsBasemapOption(this.basemapExtension),this.isInitialized&¶llelEach(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())))},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.basemapOptions)?null===(t=this._deferredProperties)||void 0===t?void 0:t.basemapOptions:this.basemapOptions.toArray()}},groundExtension:{serializeModes:["initial"],deserialize:e=>{this.map?e instanceof GroundExtension?this.groundExtension=e:this.groundExtension.assignProperties(e):this._deferredProperties={...this._deferredProperties,groundExtension:e}},serialize:()=>{var e,t;return(null===(e=this._deferredProperties)||void 0===e?void 0:e.groundExtension)?null===(t=this._deferredProperties)||void 0===t?void 0:t.groundExtension:this.groundExtension}},bookmarks:{serialize:()=>this.bookmarks.map((e=>e.toJSON())).toArray(),deserialize:e=>{this.bookmarks.addMany(e.map((e=>e instanceof Bookmark?e:new Bookmark(e))))}},webMap:{serializeModes:["initial"],deserialize:!1},webScene:{serializeModes:["initial"],deserialize:!1},initialLayerPreset:"initial",initialViewMode:{serializeModes:["initial","project"],serialize:e=>"project"===e?this.viewMode:"scene"!==this.initialViewMode||!this.webScene&&this.webMap?"map":"scene",deserialize:e=>{this.viewMode!==e&&(this._deserializedViewMode=e),this._initialViewMode=e},isDefault:(e,t)=>"project"!==t&&"map"===e},formatSettings:"initial",constraints:"initial",title:"initial",onClick:"initial",onHover:"initial",onHoverEnd:"initial",onInitialized:"initial",onViewpointChanged:"initial",contextMenu:{serializeModes:["initial"],deserialize:e=>{e?e instanceof Menu?this.contextMenu=e:this.contextMenu?this.contextMenu.assignProperties(e):this.contextMenu=Menu.create(e):this.contextMenu=void 0}},map:{serializeModes:["project"],serialize:()=>({operationalLayers:this.layerExtensions.toArray().filter((e=>e.layer)).map((e=>e._getProjectWebmapJSON())),tables:this.tableExtensions.toArray().filter((e=>e.table)).map((e=>({id:e.table.id,title:e.table.title})))}),deserialize:e=>{if(this.map)if(isMap(e)||isWebMap(e)||isWebScene(e)){if(e!==this.map)throw new ArgumentError("properties.map","Property 'map' is read-only.")}else this._deserializedMapPromise=(async()=>{this._deserializedViewMode&&this.webMap&&this.webScene&&(this._deserializedViewModePromise=this.switchViewMode(this._deserializedViewMode),await this._deserializedViewModePromise,this._deserializedViewMode=void 0,this._deserializedViewModePromise=void 0),await this._applyMapProperties(e,this.map),this._deserializedMapPromise=void 0})();else this._deferredProperties={...this._deferredProperties,map:e}}},requestHelper:{serialize:!1}}}async _applyMapProperties(e,t,i){await parallelEach(this.basemapOptions.toArray(),(e=>e._createBackingBasemap()));let s=e;const a=this.basemapOptions.find((e=>basemapsAreEquivalent(e.basemap,s.baseMap)));a&&(t.basemap=a.basemap,s={...s,baseMap:{...s.baseMap,title:t.basemap.title}}),isWebScene(t)?await WebSceneJson.applyToEsriApiWebScene(s,t,i):await WebMapJson.applyToEsriApiMap(s,t,i)}_createFormatSettings(){return new FormatSettings}_createLayerExtensionCollection(){return new LayerExtensionCollectionImpl(this)}_createTableExtensionCollection(){return new TableExtensionCollectionImpl(this)}async _onInitialize(){var e;await super._onInitialize();const{basemapExtension:t,basemapOptions:i,groundExtension:s,webMap:a,webScene:n,map:o,...r}=null!==(e=this._deferredProperties)&&void 0!==e?e:{};if(i&&this.assignProperties({basemapOptions:i}),this.map||("scene"===this.initialViewMode?this._setMap(new((await import("@arcgis/core/WebScene")).default)):this._setMap(new((await import("@arcgis/core/WebMap")).default))),this.map.basemap&&this._onBasemapChange(),(a||n)&&await this._applyMapProperties("scene"===this.initialViewMode?n:a,this.map),t&&(this.assignProperties({basemapExtension:t}),await this.basemapExtension._createBackingBasemap()),s&&this.assignProperties({groundExtension:s}),this._webMapItem||this._webSceneItem){await Promise.all([load(this.map),load(this._webMapItem),load(this._webSceneItem)]),validatePortalItem(this._webMapItem,"webMap","Web Map"),validatePortalItem(this._webSceneItem,"webScene","Web Scene");const e=isWebScene(this.map)?this._webSceneItem:this._webMapItem;await this._loadAndApplyPortalItemData(e)}else await load(this.map);o&&await this._applyMapProperties(o,this.map),this.assignProperties(r),this._deferredProperties=void 0,this._initialBasemapExtension=this.basemapExtension,this._updateBookmarks(),this.contextMenu&&await this.contextMenu.initialize();for(const e of this.layerExtensions.toArray())await e._createBackingLayer();await Promise.all(this.tableExtensions.map((e=>e._createBackingTable())).toArray())}async _postInitialize(){await super._postInitialize(),await this._createStandardBasemapOptions(),await parallelEach(this.basemapOptions.toArray(),(e=>e._createBackingBasemap())),this.initialLayerPreset&&await this.initialLayerPreset.applyTo(this)}*_initializableChildCollections(){yield*super._initializableChildCollections();const e=new Collection(this.layerExtensions.filter((e=>!!e.layer)));e.remove=e=>{this.layerExtensions.remove(e)};const t=new Collection(this.tableExtensions.filter((e=>!!e.table)));if(t.remove=e=>{this.tableExtensions.remove(e)},yield e,yield t,this.basemapExtension){const e=new Collection;e.add(this.basemapExtension),yield e}const i=new Collection;i.add(this.groundExtension),yield i}_initMapFromProperties(e){const t=e.map;isMap(t)||isWebMap(t)||isWebScene(t)?this._setMap(t):"scene"===this.initialViewMode?e.webScene&&!isPortalItem(e.webScene)&&(this._deferredProperties={webScene:e.webScene,...this._deferredProperties}):e.webMap&&!isPortalItem(e.webMap)&&(this._deferredProperties={webMap:e.webMap,...this._deferredProperties})}_setMap(e){var t,i;isWebScene(e)?this._scene=e:this._map=e,this._currentMap=e,(null===(t=this.basemapExtension)||void 0===t?void 0:t.basemap)&&!e.basemap&&(e.basemap=this.basemapExtension.basemap),(null===(i=this.groundExtension)||void 0===i?void 0:i.ground)&&!e.ground&&(e.ground=this.groundExtension.ground),this._notifyChange("map")}async _loadAndApplyPortalItemData(e,t){var i;await load(e);const s=await e.fetchData();resolveRelativeHrefs(s,e),await this._inferLayerTypes(s),(null===(i=this.basemapExtension)||void 0===i?void 0:i.basemap)&&!t&&delete s.baseMap,GroundExtension.isDefaultGround(this.groundExtension.ground)||t||delete s.ground;const a=t||this.map;await load(a),await this._applyMapProperties(s,a,e),a.portalItem=e;const{viewpoint:n,spatialReference:o}=a.initialViewProperties;n&&n.targetGeometry&&!n.targetGeometry.spatialReference.equals(o)&&(a.initialViewProperties.viewpoint.targetGeometry=(await project([n.targetGeometry],o))[0]),n&&n.camera&&(n.camera.position.spatialReference=o.clone())}_onBasemapChange(){if(this._basemapExtension){if(this.basemapExtension.basemap==this.map.basemap)return;this._basemapExtension._setMapExtension(void 0)}if(this.map.basemap){let e=this.basemapOptions.find((e=>e.basemap===this.map.basemap));e||(e=BasemapExtension.create({basemap:this.map.basemap}),this._basemapOptions.addInternal(e,0)),e.mapExtension!==this&&e._setMapExtension(this),this._basemapExtension=e}else this._basemapExtension=void 0;this._notifyChange("basemapExtension")}_onGroundChange(){if(this._groundExtension){if(this.groundExtension.ground===this.map.ground)return void(this._groundExtensions.has(this.map.ground)||this._groundExtensions.set(this.map.ground,this.groundExtension));this.groundExtension._setMapExtension(void 0)}this._groundExtensions.has(this.map.ground)||this._groundExtensions.set(this.map.ground,new GroundExtension({ground:this.map.ground}));const e=this._groundExtensions.get(this.map.ground);e.mapExtension!==this&&e._setMapExtension(this),this._groundExtension=e,this._notifyChange("groundExtension")}async _inferLayerTypes(e){var t;const i=[];if(e.operationalLayers)for(const t of e.operationalLayers)i.push(this._inferLayerType(t));if(e.baseMap&&i.push(this._inferBasemapLayerTypes(e.baseMap)),e.hasOwnProperty("ground")&&i.push(this._inferGroundLayerTypes(e.ground)),null===(t=e.presentation)||void 0===t?void 0:t.slides)for(const t of e.presentation.slides)t.baseMap&&"string"!=typeof t.baseMap&&i.push(this._inferBasemapLayerTypes(t.baseMap));await Promise.all(i)}async _inferBasemapLayerTypes(e){const t=[];if(e.baseMapLayers)for(const i of e.baseMapLayers)t.push(this._inferLayerType(i));await Promise.all(t)}async _inferGroundLayerTypes(e){const t=[];if(e.layers)for(const i of e.layers)t.push(this._inferLayerType(i));await Promise.all(t)}async _inferLayerType(e){if(!e.layerType)if(e.type)e.layerType=e.type;else if(e.url){const t=e.url;if(t.match(".*MapServer/\\d{1,}/?$")||t.match(".*FeatureServer/\\d{1,}/?$"))e.layerType="ArcGISFeatureLayer";else if(t.match(".*StreamServer/?$"))e.layerType="ArcGISStreamLayer";else if(t.match(".*ImageServer/?$")){const i=await this._getLayerData(t);i.cacheType?"Map"===i.cacheType?e.layerType="ArcGISTiledImageServiceLayer":"Elevation"===i.cacheType&&(e.layerType="ArcGISTiledElevationServiceLayer"):e.layerType="ArcGISImageServiceLayer"}else if(t.match(".*MapServer/?$")){const i=await this._getLayerData(t);e.layerType=i.tileInfo?"ArcGISTiledMapServiceLayer":"ArcGISMapServiceLayer"}else if(t.match(".*\\.(csv|txt)$"))e.layerType="CSV";else if(t.match(".*\\.kml$"))e.layerType="KML";else if(t.match(".*SceneServer/layers/\\d{1,}/?$")){const i=await this._getLayerData(t);"3DObject"===i.layerType?e.layerType="ArcGISSceneServiceLayer":"IntegratedMesh"===i.layerType?e.layerType="IntegratedMeshLayer":"PointCloud"===i.layerType&&(e.layerType="PointCloudLayer")}else t.match(".*(\\.xml|rss/?)$")&&(e.layerType="GeoRSS")}else if(e.layers){e.layerType="GroupLayer";const t=[];for(const i of e.layers)t.push(this._inferLayerType(i));await Promise.all(t)}else e.templateUrl&&e.tileInfo?e.layerType="WebTiledLayer":e.featureCollection?e.layerType="ArcGISFeatureLayer":e.styleUrl?e.layerType="VectorTileLayer":e.mapUrl&&(e.layerType="WMS")}async _getLayerData(e){const t=await this.requestHelper.request(e,{query:{f:"json"}});if(!t||!t.data)throw new Error(`Response to request for url ${e} was invalid.`);return t.data}async _createStandardBasemapOptions(){const e=this._spatialReference;!this._basemapOptions.isExplicitlyModified&&e&&e.isWebMercator&&await parallelEach([WellKnownBasemap.SATELLITE,WellKnownBasemap.HYBRID_VECTOR,WellKnownBasemap.STREETS_VECTOR,WellKnownBasemap.TOPO_VECTOR,WellKnownBasemap.STREETS_NAVIGATION_VECTOR,WellKnownBasemap.STREETS_NIGHT_VECTOR,WellKnownBasemap.TERRAIN_VECTOR,WellKnownBasemap.DARK_GRAY_VECTOR,WellKnownBasemap.GRAY_VECTOR,WellKnownBasemap.NATIONAL_GEOGRAPHIC,WellKnownBasemap.OCEANS_VECTOR,WellKnownBasemap.OPEN_STREET_MAP_VECTOR],(async e=>{const t=await createStandardBasemap(e);basemapsAreEquivalent(this.map.basemap,t)?this._basemapOptions.addInternal(this.basemapExtension):this._basemapOptions.addInternal(BasemapExtension.create({basemap:t}),void 0,!1)}))}_ensureIsBasemapOption(e){const t=this.basemapOptions.findIndex((t=>t.basemap===e.basemap));t>=0?this._basemapOptions.getItemAt(t)!==e&&(this._basemapOptions.removeAtInternal(t),this._basemapOptions.addInternal(e,t)):this._basemapOptions.addInternal(e,0)}_updateBookmarks(){var e,t,i;this.bookmarks.removeMany(this.bookmarks.filter((e=>"map"===e.source))),isWebMap(this.map)&&(null===(e=this.map.bookmarks)||void 0===e?void 0:e.length)>0?this.map.bookmarks.forEach((e=>{const t=toEsriApiGeometry(e.extent),i=new EsriViewpoint({targetGeometry:t});this.bookmarks.add(new Bookmark({source:"map",title:e.name,viewpoint:i}))})):isWebScene(this.map)&&(null===(i=null===(t=this.map.presentation)||void 0===t?void 0:t.slides)||void 0===i?void 0:i.length)>0&&this.map.presentation.slides.forEach((e=>{const t={source:"map",title:e.title.text,viewpoint:e.viewpoint},i=new Bookmark(t);this.bookmarks.add(i)}))}};MapExtension=__decorate([serializable],MapExtension);export{MapExtension};class LayerExtensionCollectionImpl extends LayerExtensionCollectionBase{constructor(e){super(e,"map.layers")}get _mapExtension(){return this._parent}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(ItemType.LAYER_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}}class BasemapExtensionCollection extends InitializableCollectionProxy{constructor(e){super(new Collection),this.isExplicitlyModified=!1,this._mapExtension=e}add(e,t){super.add(e,t),this.isExplicitlyModified=!0,1===this.length&&this._mapExtension.map&&!this._mapExtension.basemapExtension&&(this._mapExtension.basemapExtension=e)}addMany(e,t){super.addMany(e,t),this.isExplicitlyModified=!0}addInternal(e,t,i=!0){const s=e=>{const t="-vector";return(null==e?void 0:e.endsWith(t))?e.substring(0,e.length-t.length):e};let a;if(e.basemap){const t=s(e.basemap.id);if(a=this.findIndex((e=>{var i;return s(null===(i=e.basemap)||void 0===i?void 0:i.id)===t})),isStandardBasemap(e.basemap)&&a>=0){if(!i)return;super.removeAt(a)}}super.add(e,null!=t?t:a>=0?a:void 0)}removeAt(e){const t=super.removeAt(e);return t&&(this.isExplicitlyModified=!0,t===this._mapExtension.basemapExtension&&(e<this.length?this._mapExtension.basemapExtension=this.getItemAt(e):this.length?this._mapExtension.basemapExtension=this.getItemAt(e-1):this._mapExtension.basemapExtension=void 0)),t}removeAll(){this._mapExtension.basemapExtension=void 0,super.removeAll()}removeAtInternal(e){return super.removeAt(e)}removeAllInternal(){for(;this.length;)this.removeAtInternal(this.length-1)}reorder(e,t){return super.reorder(e,t),this.isExplicitlyModified=!0,e}reorderInternal(e,t){return super.reorder(e,t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.basemap}}class TableExtensionCollectionImpl extends InitializableCollectionProxy{constructor(e){super(),this._tableExtensionMap=new WeakMap,this._uninitializedTableExtensions=new Set,this._mapExtension=e,onCollectionPropertyChange(this._mapExtension,"map.tables",(e=>{const t={added:(e.added||[]).map((e=>this._forTable(e))),moved:(e.moved||[]).map((e=>this._forTable(e))),removed:(e.removed||[]).map((e=>this._forTable(e))),target:this};this.emit("change",t)})),this._mapExtension.watch("map.tables.length",(()=>this._notifyChange("length")))}get _collection(){return this._tables.map((e=>this._forTable(e))).concat(Array.from(this._uninitializedTableExtensions))}get _tables(){var e,t;return null!==(t=null===(e=this._mapExtension.map)||void 0===e?void 0:e.tables)&&void 0!==t?t:new ReadOnlyCollection(new Collection)}toJSON(){const e=[];return this.forEach((t=>{e.push(`item://${encodeURIComponent(ItemType.TABLE_EXTENSION)}/${encodeURIComponent(t.id)}`)})),e}clone(){const e=new TableExtensionCollectionImpl(this._mapExtension);return e._tableExtensionMap=this._tableExtensionMap,e}findById(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.id===e))}findByTableId(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.table.id===e))}forTable(e){if(checkArg("table",e).isNotMissing(),this._tables.includes(e))return this._forTable(e)}add(e,t){if(checkArg("tableX",e).isNotMissing(),e.mapExtension&&e.mapExtension.tableExtensions.remove(e),e._setMapExtension(this._mapExtension),e.table){const i=this._tableExtensionMap.get(e.table);if(this._tableExtensionMap.set(e.table,e),i&&i!==e&&this._onRemoved(i),this._tables.includes(e.table))if(void 0===t){const t={added:[e],moved:[],removed:i?[i]:[],target:this};this.emit("change",t)}else this._tables.reorder(e.table,t);else this._tables.add(e.table,t)}else{this._uninitializedTableExtensions.add(e);const t={added:[e],moved:[],removed:[],target:this};this.emit("change",t)}this._onAdded(e)}removeAt(e){const t=this.getItemAt(e);if(void 0!==t){if(this._uninitializedTableExtensions.has(t)){this._uninitializedTableExtensions.delete(t);const e={added:[],moved:[],removed:[t],target:this};this.emit("change",e)}else this._tables.remove(t.table);return this._onRemoved(t),t}}reorder(e,t){if(e&&this._tables.includes(e.table))return this._tables.reorder(e.table,t),e}sort(e){this._tables.sort(((t,i)=>e(this._forTable(t),this._forTable(i))))}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.table}_onAdded(e){}_onRemoved(e){e._setMapExtension(void 0)}_forTable(e){for(const e of this._uninitializedTableExtensions)e._resolveTable(),e.table&&(this._tableExtensionMap.set(e.table,e),this._uninitializedTableExtensions.delete(e));if(!this._tableExtensionMap.has(e)){const t=TableExtension.create({table:e});this._tableExtensionMap.set(e,t),t._setMapExtension(this._mapExtension),this._onAdded(t)}return this._tableExtensionMap.get(e)}}class AllLayerExtensionCollectionImpl extends ReadOnlyInitializableCollection{constructor(e){super(),this._mapExtension=e}get _collection(){let e=this._mapExtension.layerExtensions.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[]));return this._mapExtension.basemapExtension&&(e=e.concat(this._mapExtension.basemapExtension.baseLayerExtensions.toArray()).concat(this._mapExtension.basemapExtension.referenceLayerExtensions.toArray())),e=e.concat(this._mapExtension.groundExtension.layerExtensions.toArray()),e}findById(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.id===e))}findByLayerId(e){return checkArg("id",e).isNotMissing(),this.find((t=>t.layer.id===e))}forLayer(e){return checkArg("layer",e).isNotMissing(),this.findByLayerId(e.id)}emit(e,t){if("change"===e){const i=new Collection;i.addMany(t.added);const s=i.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[])).toArray(),a=new Collection;a.addMany(t.removed);const n=a.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[])).toArray(),o=new Collection;o.addMany(t.moved);const r=o.flatten((e=>e instanceof GroupLayerExtension?e.layerExtensions:[])).toArray();super.emit(e,{added:s,removed:n,moved:r,target:this})}return super.emit(e,t)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.layer}}function toPortalItem(e){if("object"!=typeof e||!e||!e.baseMap)return toPortalItemBase(e)}function isPortalItem(e){return"object"!=typeof e||e&&!e.baseMap}function validatePortalItem(e,t,i){if((null==e?void 0:e.type)&&e.type!==i)throw new Error(`Invalid portal item type "${e.type}" for property ${t}.`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{InvalidOperationError}from"../../InvalidOperationError.js";import{InitializableCollectionProxy}from"../../support/InitializableCollectionProxy.js";import{checkArg}from"../../utilities/checkArg.js";import{Collection}from"../../utilities/collection.js";import{getLogger}from"../../utilities/log.js";import{onCollectionPropertyChange}from"../../utilities/watch.js";import{LayerExtension}from"../_LayerExtension.js";export class LayerExtensionCollectionBase extends InitializableCollectionProxy{constructor(e,i){super(),this._layerExtensionMap=new WeakMap,this._uninitializedLayerExtensions=new Collection,this._parent=e,this._layersProperty=i,onCollectionPropertyChange(this._parent,this._layersProperty,(e=>{try{const i={added:(e.added||[]).map((e=>this._forLayer(e))),moved:(e.moved||[]).map((e=>this._forLayer(e))),removed:(e.removed||[]).map((e=>this._forLayer(e)))};this.emit("change",i)}catch(e){getCollectionLogger().error(e)}})),this._parent.watch(`${this._layersProperty}.length`,(()=>this.notifyChange("length")))}get _collection(){return this._layers.map((e=>this._forLayer(e))).concat(this._uninitializedLayerExtensions)}get _layers(){let e=this._parent.get(this._layersProperty);return e||(this._tempLayers||(this._tempLayers=new Collection),e=this._tempLayers),e}emit(e,i){const t=super.emit(e,i);return"change"===e&&this._mapExtension&&this._mapExtension.allLayerExtensions.emit(e,i),t}clone(){const e=super.clone();return e._layerExtensionMap=this._layerExtensionMap,e}findById(e){return checkArg("id",e).isNotMissing(),this.find((i=>i.id===e))}findByLayerId(e){return checkArg("id",e).isNotMissing(),this.find((i=>i.layer.id===e))}forLayer(e){if(checkArg("layer",e).isNotMissing(),this._layers.includes(e))return this._forLayer(e)}add(e,i){if(checkArg("layerX",e).isNotMissing(),this._register(e),e.layer)this._layers.includes(e.layer)?void 0!==i&&this._layers.reorder(e.layer,i):this._layers.add(e.layer,i);else if(!e.isInitialized){const t=e.watch("layer",(()=>{e.layer&&(this._forLayer(e.layer),this._layers.includes(e.layer)||this._layers.add(e.layer,i)),t.remove()}),!0)}}removeAt(e){const i=this.getItemAt(e);if(void 0!==i){if(this._uninitializedLayerExtensions.includes(i)){this._uninitializedLayerExtensions.remove(i);const e={added:[],moved:[],removed:[i],target:this};this.emit("change",e)}else this._layers.remove(i.layer);return this._onRemoved(i),i}}reorder(e,i){if(this._uninitializedLayerExtensions.includes(e)){if(this._uninitializedLayerExtensions.some((e=>e.isInitialized)))throw new InvalidOperationError("Unable to reorder a mix of initialized / uninitialized layers.");this._uninitializedLayerExtensions.reorder(e,i)}if(e&&e.layer&&this._layers.includes(e.layer))return this._layers.reorder(e.layer,i),e}sort(e){this._layers.sort(((i,t)=>e(this._forLayer(i),this._forLayer(t))))}onParentInitialized(){var e;(null===(e=this._tempLayers)||void 0===e?void 0:e.length)&&(this.addMany(this._tempLayers.map((e=>this._forLayer(e)))),this._tempLayers=void 0)}onMapExtensionChanged(){for(const e of this.toArray())e._setMapExtension(this._mapExtension)}_forLayer(e){for(const e of this._uninitializedLayerExtensions.toArray())e._resolveLayer(this._layers),e.layer&&(this._layerExtensionMap.set(e.layer,e),this._uninitializedLayerExtensions.remove(e),this.emit("change",{added:[],moved:[],removed:[e],target:this}));if(!this._layerExtensionMap.has(e)){const i=LayerExtension.create({layer:e});this._register(
|
|
1
|
+
import{InvalidOperationError}from"../../InvalidOperationError.js";import{InitializableCollectionProxy}from"../../support/InitializableCollectionProxy.js";import{checkArg}from"../../utilities/checkArg.js";import{Collection}from"../../utilities/collection.js";import{layersAreEquivalent}from"../../utilities/layers.js";import{getLogger}from"../../utilities/log.js";import{onCollectionPropertyChange}from"../../utilities/watch.js";import{LayerExtension}from"../_LayerExtension.js";export class LayerExtensionCollectionBase extends InitializableCollectionProxy{constructor(e,i){super(),this._layerExtensionMap=new WeakMap,this._uninitializedLayerExtensions=new Collection,this._parent=e,this._layersProperty=i,onCollectionPropertyChange(this._parent,this._layersProperty,(e=>{try{const i={added:(e.added||[]).map((e=>this._forLayer(e))),moved:(e.moved||[]).map((e=>this._forLayer(e))),removed:(e.removed||[]).map((e=>this._forLayer(e)))};this.emit("change",i)}catch(e){getCollectionLogger().error(e)}})),this._parent.watch(`${this._layersProperty}.length`,(()=>this.notifyChange("length")))}get _collection(){return this._layers.map((e=>this._forLayer(e))).concat(this._uninitializedLayerExtensions)}get _layers(){let e=this._parent.get(this._layersProperty);return e||(this._tempLayers||(this._tempLayers=new Collection),e=this._tempLayers),e}emit(e,i){const t=super.emit(e,i);return"change"===e&&this._mapExtension&&this._mapExtension.allLayerExtensions.emit(e,i),t}clone(){const e=super.clone();return e._layerExtensionMap=this._layerExtensionMap,e}findById(e){return checkArg("id",e).isNotMissing(),this.find((i=>i.id===e))}findByLayerId(e){return checkArg("id",e).isNotMissing(),this.find((i=>i.layer.id===e))}forLayer(e){if(checkArg("layer",e).isNotMissing(),this._layers.includes(e))return this._forLayer(e)}add(e,i){if(checkArg("layerX",e).isNotMissing(),this._register(e),e.layer)this._layers.includes(e.layer)?void 0!==i&&this._layers.reorder(e.layer,i):this._layers.add(e.layer,i);else if(!e.isInitialized){const t=e.watch("layer",(()=>{e.layer&&(this._forLayer(e.layer),this._layers.includes(e.layer)||this._layers.add(e.layer,i)),t.remove()}),!0)}}removeAt(e){const i=this.getItemAt(e);if(void 0!==i){if(this._uninitializedLayerExtensions.includes(i)){this._uninitializedLayerExtensions.remove(i);const e={added:[],moved:[],removed:[i],target:this};this.emit("change",e)}else this._layers.remove(i.layer);return this._onRemoved(i),i}}reorder(e,i){if(this._uninitializedLayerExtensions.includes(e)){if(this._uninitializedLayerExtensions.some((e=>e.isInitialized)))throw new InvalidOperationError("Unable to reorder a mix of initialized / uninitialized layers.");this._uninitializedLayerExtensions.reorder(e,i)}if(e&&e.layer&&this._layers.includes(e.layer))return this._layers.reorder(e.layer,i),e}sort(e){this._layers.sort(((i,t)=>e(this._forLayer(i),this._forLayer(t))))}onParentInitialized(){var e;(null===(e=this._tempLayers)||void 0===e?void 0:e.length)&&(this.addMany(this._tempLayers.map((e=>this._forLayer(e)))),this._tempLayers=void 0)}onMapExtensionChanged(){for(const e of this.toArray())e._setMapExtension(this._mapExtension)}_forLayer(e){for(const e of this._uninitializedLayerExtensions.toArray())e._resolveLayer(this._layers),e.layer&&(this._layerExtensionMap.set(e.layer,e),this._uninitializedLayerExtensions.remove(e),this.emit("change",{added:[],moved:[],removed:[e],target:this}));if(!this._layerExtensionMap.has(e)){const i=this._uninitializedLayerExtensions.find((i=>layersAreEquivalent(e,i)));if(i)return i;const t=LayerExtension.create({layer:e});this._register(t)}return this._layerExtensionMap.get(e)}_register(e){if(checkArg("layerX",e).isNotMissing(),e._setMapExtension(this._mapExtension),e.layer||e._resolveLayer(this._layers),e.layer){const i=this._layerExtensionMap.get(e.layer);if(e===i)return;if(this._layerExtensionMap.set(e.layer,e),i&&(this._onRemoved(i),this._layers.includes(e.layer))){const t={added:[e],moved:[],removed:[i],target:this};this.emit("change",t)}}else{this._uninitializedLayerExtensions.add(e);const i={added:[e],moved:[],removed:[],target:this};this.emit("change",i)}this._onAdded(e)}_itemIsInitialized(e){return super._itemIsInitialized(e)&&!!e.layer}_onAdded(e){}_onRemoved(e){e._setMapExtension(void 0)}}function getCollectionLogger(){return getLogger("geocortex.api.support.LayerExtensionCollection")}
|
package/package.json
CHANGED
|
@@ -52,6 +52,19 @@ export interface ApplicationProperties {
|
|
|
52
52
|
* {@link https://developers.arcgis.com/web-map-specification/objects/offline/}.
|
|
53
53
|
*/
|
|
54
54
|
offline?: {
|
|
55
|
+
/**
|
|
56
|
+
* List of layers which should be included in an offline map as connected online layers.
|
|
57
|
+
* {@link https://developers.arcgis.com/web-map-specification/objects/connectedOnlineLayer/}.
|
|
58
|
+
*/
|
|
59
|
+
connectedOnlineLayers?: [
|
|
60
|
+
{
|
|
61
|
+
/**
|
|
62
|
+
* Identifies which layer or table in the web map is to remain
|
|
63
|
+
* online by specifying the value of its unique id property.
|
|
64
|
+
*/
|
|
65
|
+
id?: string;
|
|
66
|
+
}
|
|
67
|
+
];
|
|
55
68
|
/**
|
|
56
69
|
* Object detailing the available offline editing options.
|
|
57
70
|
* {@link https://developers.arcgis.com/web-map-specification/objects/editableLayers/}.
|
|
@@ -74,6 +87,18 @@ export interface ApplicationProperties {
|
|
|
74
87
|
*/
|
|
75
88
|
sync?: SyncMode;
|
|
76
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Object detailing offline basemap options.
|
|
92
|
+
* {@link https://developers.arcgis.com/web-map-specification/objects/offlinebasemap/}.
|
|
93
|
+
*/
|
|
94
|
+
offlinebasemap?: {
|
|
95
|
+
/**
|
|
96
|
+
* The filename of a basemap that has been copied to a mobile
|
|
97
|
+
* device. This can be used instead of the default basemap for the
|
|
98
|
+
* map to reduce downloads.
|
|
99
|
+
*/
|
|
100
|
+
referenceBasemapName?: string;
|
|
101
|
+
};
|
|
77
102
|
/**
|
|
78
103
|
* Object indicating what to do with attachments in read-only layers.
|
|
79
104
|
* {@link https://developers.arcgis.com/web-map-specification/objects/readonlyLayers/}.
|
package/portal/Bookmark.d.ts
CHANGED
|
@@ -22,9 +22,15 @@ export interface Bookmark {
|
|
|
22
22
|
*/
|
|
23
23
|
name: string;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Object containing a thumbnail image.
|
|
26
26
|
*/
|
|
27
|
-
thumbnail?:
|
|
27
|
+
thumbnail?: {
|
|
28
|
+
/**
|
|
29
|
+
* The URI pointing to the thumbnail image. Can be a URL or a
|
|
30
|
+
* base64-encoded image.
|
|
31
|
+
*/
|
|
32
|
+
url?: string;
|
|
33
|
+
};
|
|
28
34
|
/**
|
|
29
35
|
* Represents the location displayed on the map. If viewpoint is defined,
|
|
30
36
|
* ignore the extent. If viewpoint is not defined, use the extent property.
|
package/portal/CSVLayer.d.ts
CHANGED
|
@@ -55,6 +55,11 @@ export interface CSVLayer extends OperationalLayerBase {
|
|
|
55
55
|
* "\t". Used with CSV layers only.
|
|
56
56
|
*/
|
|
57
57
|
columnDelimiter?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Indicates whether to allow a client to ignore popups defined by the
|
|
60
|
+
* service item.
|
|
61
|
+
*/
|
|
62
|
+
disablePopup?: boolean;
|
|
58
63
|
/**
|
|
59
64
|
* A layerDefinition object defining the attribute schema and drawing
|
|
60
65
|
* information for the layer.
|
package/portal/DrawingInfo.d.ts
CHANGED
|
@@ -36,9 +36,8 @@ export interface DrawingInfo {
|
|
|
36
36
|
*/
|
|
37
37
|
filters?: PointCloudFilter[];
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* screen units regardless of the map scale.
|
|
39
|
+
* Only used for feature collections with a renderer. The feature's symbol
|
|
40
|
+
* is defined by the layer's renderer. Not implemented in JSAPI 4.x.
|
|
42
41
|
*/
|
|
43
42
|
fixedSymbols?: boolean;
|
|
44
43
|
/**
|
|
@@ -49,6 +48,13 @@ export interface DrawingInfo {
|
|
|
49
48
|
* A renderer object that provides the symbology for the layer.
|
|
50
49
|
*/
|
|
51
50
|
renderer?: Renderer;
|
|
51
|
+
/**
|
|
52
|
+
* Boolean property indicating whether symbols should stay the same size in
|
|
53
|
+
* screen units as you zoom in. A value of false means the symbols stay the
|
|
54
|
+
* same size in screen units regardless of the map scale. Not implemented in
|
|
55
|
+
* JSAPI 4.x.
|
|
56
|
+
*/
|
|
57
|
+
scaleSymbols?: boolean;
|
|
52
58
|
/**
|
|
53
59
|
* Defines whether labels should be shown or not. This is only valid for
|
|
54
60
|
* sublayers.
|
package/portal/FeatureLayer.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type EsriStreamLayer from "@arcgis/core/layers/StreamLayer";
|
|
|
4
4
|
import Portal from "@arcgis/core/portal/Portal";
|
|
5
5
|
import type { DefinitionEditor } from "./DefinitionEditor.js";
|
|
6
6
|
import type { FeatureCollection } from "./FeatureCollection.js";
|
|
7
|
+
import type { FormInfo } from "./FormInfo.js";
|
|
7
8
|
import { LayerDefinition } from "./LayerDefinition.js";
|
|
8
9
|
import type { OperationalLayerBase } from "./OperationalLayer.js";
|
|
9
10
|
import { PopupInfo } from "./PopupInfo.js";
|
|
@@ -98,6 +99,11 @@ export interface FeatureLayer extends OperationalLayerBase {
|
|
|
98
99
|
* Delete | Query | Update | Editing.
|
|
99
100
|
*/
|
|
100
101
|
capabilities?: string;
|
|
102
|
+
/**
|
|
103
|
+
* A sequence of custom parameters appended to the URL of all requests
|
|
104
|
+
* related to supporting ArcGIS layer types.
|
|
105
|
+
*/
|
|
106
|
+
customParameters?: Record<string, unknown>;
|
|
101
107
|
/**
|
|
102
108
|
* Stores interactive filters.
|
|
103
109
|
*/
|
|
@@ -119,6 +125,11 @@ export interface FeatureLayer extends OperationalLayerBase {
|
|
|
119
125
|
* regular single-layer or multi-layer feature collection.
|
|
120
126
|
*/
|
|
121
127
|
featureCollectionType?: FeatureCollectionType;
|
|
128
|
+
/**
|
|
129
|
+
* A formInfo object defining the content of the form when you are editing a
|
|
130
|
+
* feature.
|
|
131
|
+
*/
|
|
132
|
+
formInfo?: FormInfo;
|
|
122
133
|
/**
|
|
123
134
|
* Optional string containing the item ID of the service if it's registered
|
|
124
135
|
* on ArcGIS Online or your organization's portal.
|
|
@@ -166,6 +177,11 @@ export interface FeatureLayer extends OperationalLayerBase {
|
|
|
166
177
|
* appear as defined in the labelingInfo property.
|
|
167
178
|
*/
|
|
168
179
|
showLabels?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* The feature subtype code identifying the layer. Used with
|
|
182
|
+
* SubtypeGroupLayers.
|
|
183
|
+
*/
|
|
184
|
+
subtypeCode?: string | number;
|
|
169
185
|
/**
|
|
170
186
|
* The URL to the layer.If the layer is not from a web service but rather a
|
|
171
187
|
* feature collection, than the url property is omitted.
|