@vertigis/arcgis-extensions 33.5.6 → 34.1.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/data/_TableExtension.js +1 -1
- package/docs/html/assets/js/search.js +1 -1
- package/docs/html/classes/data__tableextension.tableextension.html +8 -8
- package/docs/html/classes/data__tableextension.tablefeaturesettings.html +10 -10
- package/docs/html/classes/data__tableextension.tableschema.html +13 -13
- package/docs/html/classes/data_arcgisservicetableextension.arcgisservicetableextension.html +3 -3
- package/docs/html/classes/mapping__layerextension.arraywrappedcollection.html +2 -2
- package/docs/html/classes/mapping__layerextension.layerextension.html +41 -41
- package/docs/html/classes/mapping__layerextension.layerextensionschema.html +6 -6
- package/docs/html/classes/mapping__sublayerextension.sublayerextension.html +48 -48
- package/docs/html/classes/mapping__sublayerextension.sublayerschema.html +4 -4
- package/docs/html/classes/mapping__sublayerextension.subsublayerextensioncollection.html +6 -6
- package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerextension.html +61 -57
- package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerfeaturesettings.html +8 -8
- package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerrelationshipcollection.html +4 -4
- package/docs/html/classes/mapping_arcgissublayerextension.arcgissublayerschema.html +15 -15
- package/docs/html/classes/mapping_buildingcomponentsublayerextension.buildingcomponentsublayerextension.html +32 -32
- package/docs/html/classes/mapping_buildingcomponentsublayerextension.buildingcomponentsublayerschema.html +2 -2
- package/docs/html/classes/mapping_buildinggroupsublayerextension.buildinggroupsublayerextension.html +35 -35
- package/docs/html/classes/mapping_buildinggroupsublayerextension.buildinggroupsublayerschema.html +4 -4
- package/docs/html/classes/mapping_buildingscenelayerextension.buildingscenelayerextension.html +32 -32
- package/docs/html/classes/mapping_buildingscenelayerextension.buildingscenelayerreadonlyschema.html +4 -4
- package/docs/html/classes/mapping_buildingsublayerextension.buildingsublayerextension.html +42 -42
- package/docs/html/classes/mapping_buildingsublayerextension.buildingsublayerschema.html +3 -3
- package/docs/html/classes/mapping_csvlayerextension.csvlayerextension.html +39 -39
- package/docs/html/classes/mapping_elevationlayerextension.elevationlayerextension.html +37 -37
- package/docs/html/classes/mapping_featurecollectionlayerextension.featurecollectionlayerextension.html +33 -33
- package/docs/html/classes/mapping_featurelayerextension.featurelayerextension.html +35 -35
- package/docs/html/classes/mapping_featurelayerextensionbase.featurelayerextensionbase.html +37 -37
- package/docs/html/classes/mapping_featurelayerextensionbase.featurelayerschema.html +4 -4
- package/docs/html/classes/mapping_georsslayerextension.georsslayerextension.html +37 -37
- package/docs/html/classes/mapping_graphicslayerextension.graphicslayerextension.html +32 -32
- package/docs/html/classes/mapping_grouplayerextension.grouplayerextension.html +30 -30
- package/docs/html/classes/mapping_imagerylayerextension.imagerylayerextension.html +37 -37
- package/docs/html/classes/mapping_imagerytilelayerextension.imagerytilelayerextension.html +34 -34
- package/docs/html/classes/mapping_integratedmeshlayerextension.integratedmeshlayerextension.html +38 -38
- package/docs/html/classes/mapping_kmllayerextension.kmllayerextension.html +34 -34
- package/docs/html/classes/mapping_kmlsublayerextension.kmlsublayerextension.html +36 -36
- package/docs/html/classes/mapping_mapextension.mapextension.html +13 -13
- package/docs/html/classes/mapping_mapimagelayerextension.mapimagelayerextension.html +35 -35
- package/docs/html/classes/mapping_mapimagesublayerextension.mapimagesublayerextension.html +55 -51
- package/docs/html/classes/mapping_openstreetmaplayerextension.openstreetmaplayerextension.html +39 -39
- package/docs/html/classes/mapping_pointcloudlayerextension.pointcloudlayerextension.html +37 -37
- package/docs/html/classes/mapping_scenelayerextension.scenelayerextension.html +37 -37
- package/docs/html/classes/mapping_streamlayerextension.streamlayerextension.html +38 -38
- package/docs/html/classes/mapping_streamlayerextension.streamlayerschema.html +4 -4
- package/docs/html/classes/mapping_tilelayerextension.tilelayerextension.html +33 -33
- package/docs/html/classes/mapping_tilesublayerextension.tilesublayerextension.html +62 -62
- package/docs/html/classes/mapping_vectortilelayerextension.vectortilelayerextension.html +36 -36
- package/docs/html/classes/mapping_webtilelayerextension.webtilelayerextension.html +39 -39
- package/docs/html/classes/mapping_wmslayerextension.wmslayerextension.html +34 -34
- package/docs/html/classes/mapping_wmssublayerextension.wmssublayerextension.html +36 -36
- package/docs/html/classes/mapping_wmtslayerextension.wmtslayerextension.html +34 -34
- package/docs/html/classes/mapping_wmtssublayerextension.wmtssublayerextension.html +53 -53
- package/docs/html/interfaces/mapping__sublayerextension.sublayerextensionproperties.html +5 -5
- package/docs/html/interfaces/mapping__sublayerextension.sublayerproperties.html +2 -2
- package/docs/html/interfaces/mapping__sublayerextension.sublayerreference.html +2 -2
- package/docs/html/interfaces/mapping_arcgissublayerextension.arcgissublayerextensioncollection.html +3 -3
- package/docs/html/interfaces/mapping_arcgissublayerextension.arcgissublayerextensionproperties.html +6 -6
- package/docs/html/interfaces/mapping_arcgissublayerextension.arcgissublayerproperties.html +2 -2
- package/docs/html/interfaces/mapping_buildingcomponentsublayerextension.buildingcomponentsublayerextensionproperties.html +3 -3
- package/docs/html/interfaces/mapping_buildinggroupsublayerextension.buildinggroupsublayerextensionproperties.html +3 -3
- package/docs/html/interfaces/mapping_buildingsublayerextension.buildingsublayerextensionproperties.html +3 -3
- package/docs/html/interfaces/mapping_buildingsublayerextension.buildingsublayerproperties.html +2 -2
- package/docs/html/interfaces/mapping_kmlsublayerextension.kmlsublayerextensionproperties.html +3 -3
- package/docs/html/interfaces/mapping_mapimagesublayerextension.mapimagesublayerextensionproperties.html +4 -4
- package/docs/html/interfaces/mapping_mapimagesublayerextension.mapimagesublayerproperties.html +2 -2
- package/docs/html/interfaces/mapping_tilesublayerextension.tilesublayerextensionproperties.html +6 -6
- package/docs/html/interfaces/mapping_tilesublayerextension.tilesublayerproperties.html +2 -2
- package/docs/html/interfaces/mapping_wmssublayerextension.wmssublayerextensionproperties.html +3 -3
- package/docs/html/interfaces/mapping_wmssublayerextension.wmssublayerproperties.html +2 -2
- package/docs/html/interfaces/mapping_wmtssublayerextension.wmtssublayerextensionproperties.html +5 -5
- package/docs/html/interfaces/support_serializable.propertydef.html +1 -1
- package/docs/html/modules/mapping__layerextension.html +1 -1
- package/docs/html/modules/mapping__sublayerextension.html +3 -3
- package/docs/html/modules/mapping_mapextension.html +1 -1
- package/docs/html/modules/utilities_extensions.html +85 -15
- package/docs/html/modules/version.html +1 -1
- package/mapping/ArcGISSublayerExtension.d.ts +4 -0
- package/mapping/ArcGISSublayerExtension.js +1 -1
- package/mapping/MapExtension.js +1 -1
- package/mapping/TileSublayerExtension.d.ts +5 -0
- package/mapping/TileSublayerExtension.js +1 -1
- package/mapping/WMTSSublayerExtension.d.ts +5 -0
- package/mapping/WMTSSublayerExtension.js +1 -1
- package/mapping/_LayerExtension.js +1 -1
- package/mapping/_SublayerExtension.d.ts +1 -1
- package/mapping/_SublayerExtension.js +1 -1
- package/mapping/support/DefaultSublayerExtensionFactory.js +1 -1
- package/package.json +3 -2
- package/support/Serializable.d.ts +1 -1
- package/utilities/extensions.d.ts +14 -0
- package/utilities/extensions.js +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -79,9 +79,11 @@
|
|
|
79
79
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#isgrouplayerextension" class="tsd-kind-icon">is<wbr>Group<wbr>Layer<wbr>Extension</a></li>
|
|
80
80
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#isimagerylayerextension" class="tsd-kind-icon">is<wbr>Imagery<wbr>Layer<wbr>Extension</a></li>
|
|
81
81
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#iskmllayerextension" class="tsd-kind-icon">isKMLLayer<wbr>Extension</a></li>
|
|
82
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#ismapimagelayerextension" class="tsd-kind-icon">is<wbr>Map<wbr>Image<wbr>Layer<wbr>Extension</a></li>
|
|
82
83
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#ismapimagesublayerextension" class="tsd-kind-icon">is<wbr>Map<wbr>Image<wbr>Sublayer<wbr>Extension</a></li>
|
|
83
84
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#isscenelayerextension" class="tsd-kind-icon">is<wbr>Scene<wbr>Layer<wbr>Extension</a></li>
|
|
84
85
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#isstreamlayerextension" class="tsd-kind-icon">is<wbr>Stream<wbr>Layer<wbr>Extension</a></li>
|
|
86
|
+
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#istilelayerextension" class="tsd-kind-icon">is<wbr>Tile<wbr>Layer<wbr>Extension</a></li>
|
|
85
87
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#iswmslayerextension" class="tsd-kind-icon">isWMSLayer<wbr>Extension</a></li>
|
|
86
88
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#iswmssublayerextension" class="tsd-kind-icon">isWMSSublayer<wbr>Extension</a></li>
|
|
87
89
|
<li class="tsd-kind-function tsd-parent-kind-module"><a href="utilities_extensions.html#iswmtslayerextension" class="tsd-kind-icon">isWMTSLayer<wbr>Extension</a></li>
|
|
@@ -102,7 +104,7 @@
|
|
|
102
104
|
<li class="tsd-description">
|
|
103
105
|
<aside class="tsd-sources">
|
|
104
106
|
<ul>
|
|
105
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
107
|
+
<li>Defined in src/utilities/extensions.ts:40</li>
|
|
106
108
|
</ul>
|
|
107
109
|
</aside>
|
|
108
110
|
<div class="tsd-comment tsd-typography">
|
|
@@ -133,7 +135,7 @@
|
|
|
133
135
|
<li class="tsd-description">
|
|
134
136
|
<aside class="tsd-sources">
|
|
135
137
|
<ul>
|
|
136
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
138
|
+
<li>Defined in src/utilities/extensions.ts:242</li>
|
|
137
139
|
</ul>
|
|
138
140
|
</aside>
|
|
139
141
|
<div class="tsd-comment tsd-typography">
|
|
@@ -164,7 +166,7 @@
|
|
|
164
166
|
<li class="tsd-description">
|
|
165
167
|
<aside class="tsd-sources">
|
|
166
168
|
<ul>
|
|
167
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
169
|
+
<li>Defined in src/utilities/extensions.ts:89</li>
|
|
168
170
|
</ul>
|
|
169
171
|
</aside>
|
|
170
172
|
<div class="tsd-comment tsd-typography">
|
|
@@ -195,7 +197,7 @@
|
|
|
195
197
|
<li class="tsd-description">
|
|
196
198
|
<aside class="tsd-sources">
|
|
197
199
|
<ul>
|
|
198
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
200
|
+
<li>Defined in src/utilities/extensions.ts:75</li>
|
|
199
201
|
</ul>
|
|
200
202
|
</aside>
|
|
201
203
|
<div class="tsd-comment tsd-typography">
|
|
@@ -226,7 +228,7 @@
|
|
|
226
228
|
<li class="tsd-description">
|
|
227
229
|
<aside class="tsd-sources">
|
|
228
230
|
<ul>
|
|
229
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
231
|
+
<li>Defined in src/utilities/extensions.ts:63</li>
|
|
230
232
|
</ul>
|
|
231
233
|
</aside>
|
|
232
234
|
<div class="tsd-comment tsd-typography">
|
|
@@ -257,7 +259,7 @@
|
|
|
257
259
|
<li class="tsd-description">
|
|
258
260
|
<aside class="tsd-sources">
|
|
259
261
|
<ul>
|
|
260
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
262
|
+
<li>Defined in src/utilities/extensions.ts:101</li>
|
|
261
263
|
</ul>
|
|
262
264
|
</aside>
|
|
263
265
|
<div class="tsd-comment tsd-typography">
|
|
@@ -288,7 +290,7 @@
|
|
|
288
290
|
<li class="tsd-description">
|
|
289
291
|
<aside class="tsd-sources">
|
|
290
292
|
<ul>
|
|
291
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
293
|
+
<li>Defined in src/utilities/extensions.ts:54</li>
|
|
292
294
|
</ul>
|
|
293
295
|
</aside>
|
|
294
296
|
<div class="tsd-comment tsd-typography">
|
|
@@ -319,7 +321,7 @@
|
|
|
319
321
|
<li class="tsd-description">
|
|
320
322
|
<aside class="tsd-sources">
|
|
321
323
|
<ul>
|
|
322
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
324
|
+
<li>Defined in src/utilities/extensions.ts:113</li>
|
|
323
325
|
</ul>
|
|
324
326
|
</aside>
|
|
325
327
|
<div class="tsd-comment tsd-typography">
|
|
@@ -350,7 +352,7 @@
|
|
|
350
352
|
<li class="tsd-description">
|
|
351
353
|
<aside class="tsd-sources">
|
|
352
354
|
<ul>
|
|
353
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
355
|
+
<li>Defined in src/utilities/extensions.ts:230</li>
|
|
354
356
|
</ul>
|
|
355
357
|
</aside>
|
|
356
358
|
<div class="tsd-comment tsd-typography">
|
|
@@ -371,6 +373,37 @@
|
|
|
371
373
|
</li>
|
|
372
374
|
</ul>
|
|
373
375
|
</section>
|
|
376
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
377
|
+
<a name="ismapimagelayerextension" class="tsd-anchor"></a>
|
|
378
|
+
<h3>is<wbr>Map<wbr>Image<wbr>Layer<wbr>Extension</h3>
|
|
379
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
380
|
+
<li class="tsd-signature tsd-kind-icon">is<wbr>Map<wbr>Image<wbr>Layer<wbr>Extension<span class="tsd-signature-symbol">(</span>extension<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">extension</span><span class="tsd-signature-symbol"> is </span><a href="../classes/mapping_mapimagelayerextension.mapimagelayerextension.html" class="tsd-signature-type" data-tsd-kind="Class">MapImageLayerExtension</a></li>
|
|
381
|
+
</ul>
|
|
382
|
+
<ul class="tsd-descriptions">
|
|
383
|
+
<li class="tsd-description">
|
|
384
|
+
<aside class="tsd-sources">
|
|
385
|
+
<ul>
|
|
386
|
+
<li>Defined in src/utilities/extensions.ts:151</li>
|
|
387
|
+
</ul>
|
|
388
|
+
</aside>
|
|
389
|
+
<div class="tsd-comment tsd-typography">
|
|
390
|
+
<div class="lead">
|
|
391
|
+
<p>Returns true if the extension is a MapImageLayerExtension.</p>
|
|
392
|
+
</div>
|
|
393
|
+
</div>
|
|
394
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
395
|
+
<ul class="tsd-parameters">
|
|
396
|
+
<li>
|
|
397
|
+
<h5>extension: <span class="tsd-signature-type">unknown</span></h5>
|
|
398
|
+
<div class="tsd-comment tsd-typography">
|
|
399
|
+
<p>The extension to check.</p>
|
|
400
|
+
</div>
|
|
401
|
+
</li>
|
|
402
|
+
</ul>
|
|
403
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">extension</span><span class="tsd-signature-symbol"> is </span><a href="../classes/mapping_mapimagelayerextension.mapimagelayerextension.html" class="tsd-signature-type" data-tsd-kind="Class">MapImageLayerExtension</a></h4>
|
|
404
|
+
</li>
|
|
405
|
+
</ul>
|
|
406
|
+
</section>
|
|
374
407
|
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
375
408
|
<a name="ismapimagesublayerextension" class="tsd-anchor"></a>
|
|
376
409
|
<h3>is<wbr>Map<wbr>Image<wbr>Sublayer<wbr>Extension</h3>
|
|
@@ -381,7 +414,7 @@
|
|
|
381
414
|
<li class="tsd-description">
|
|
382
415
|
<aside class="tsd-sources">
|
|
383
416
|
<ul>
|
|
384
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
417
|
+
<li>Defined in src/utilities/extensions.ts:202</li>
|
|
385
418
|
</ul>
|
|
386
419
|
</aside>
|
|
387
420
|
<div class="tsd-comment tsd-typography">
|
|
@@ -412,7 +445,7 @@
|
|
|
412
445
|
<li class="tsd-description">
|
|
413
446
|
<aside class="tsd-sources">
|
|
414
447
|
<ul>
|
|
415
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
448
|
+
<li>Defined in src/utilities/extensions.ts:126</li>
|
|
416
449
|
</ul>
|
|
417
450
|
</aside>
|
|
418
451
|
<div class="tsd-comment tsd-typography">
|
|
@@ -443,7 +476,7 @@
|
|
|
443
476
|
<li class="tsd-description">
|
|
444
477
|
<aside class="tsd-sources">
|
|
445
478
|
<ul>
|
|
446
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
479
|
+
<li>Defined in src/utilities/extensions.ts:139</li>
|
|
447
480
|
</ul>
|
|
448
481
|
</aside>
|
|
449
482
|
<div class="tsd-comment tsd-typography">
|
|
@@ -464,6 +497,37 @@
|
|
|
464
497
|
</li>
|
|
465
498
|
</ul>
|
|
466
499
|
</section>
|
|
500
|
+
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
501
|
+
<a name="istilelayerextension" class="tsd-anchor"></a>
|
|
502
|
+
<h3>is<wbr>Tile<wbr>Layer<wbr>Extension</h3>
|
|
503
|
+
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module">
|
|
504
|
+
<li class="tsd-signature tsd-kind-icon">is<wbr>Tile<wbr>Layer<wbr>Extension<span class="tsd-signature-symbol">(</span>extension<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">extension</span><span class="tsd-signature-symbol"> is </span><a href="../classes/mapping_tilelayerextension.tilelayerextension.html" class="tsd-signature-type" data-tsd-kind="Class">TileLayerExtension</a></li>
|
|
505
|
+
</ul>
|
|
506
|
+
<ul class="tsd-descriptions">
|
|
507
|
+
<li class="tsd-description">
|
|
508
|
+
<aside class="tsd-sources">
|
|
509
|
+
<ul>
|
|
510
|
+
<li>Defined in src/utilities/extensions.ts:164</li>
|
|
511
|
+
</ul>
|
|
512
|
+
</aside>
|
|
513
|
+
<div class="tsd-comment tsd-typography">
|
|
514
|
+
<div class="lead">
|
|
515
|
+
<p>Returns true if the extension is a TileLayerExtension.</p>
|
|
516
|
+
</div>
|
|
517
|
+
</div>
|
|
518
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
519
|
+
<ul class="tsd-parameters">
|
|
520
|
+
<li>
|
|
521
|
+
<h5>extension: <span class="tsd-signature-type">unknown</span></h5>
|
|
522
|
+
<div class="tsd-comment tsd-typography">
|
|
523
|
+
<p>The extension to check.</p>
|
|
524
|
+
</div>
|
|
525
|
+
</li>
|
|
526
|
+
</ul>
|
|
527
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">extension</span><span class="tsd-signature-symbol"> is </span><a href="../classes/mapping_tilelayerextension.tilelayerextension.html" class="tsd-signature-type" data-tsd-kind="Class">TileLayerExtension</a></h4>
|
|
528
|
+
</li>
|
|
529
|
+
</ul>
|
|
530
|
+
</section>
|
|
467
531
|
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module">
|
|
468
532
|
<a name="iswmslayerextension" class="tsd-anchor"></a>
|
|
469
533
|
<h3>isWMSLayer<wbr>Extension</h3>
|
|
@@ -474,7 +538,7 @@
|
|
|
474
538
|
<li class="tsd-description">
|
|
475
539
|
<aside class="tsd-sources">
|
|
476
540
|
<ul>
|
|
477
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
541
|
+
<li>Defined in src/utilities/extensions.ts:177</li>
|
|
478
542
|
</ul>
|
|
479
543
|
</aside>
|
|
480
544
|
<div class="tsd-comment tsd-typography">
|
|
@@ -505,7 +569,7 @@
|
|
|
505
569
|
<li class="tsd-description">
|
|
506
570
|
<aside class="tsd-sources">
|
|
507
571
|
<ul>
|
|
508
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
572
|
+
<li>Defined in src/utilities/extensions.ts:189</li>
|
|
509
573
|
</ul>
|
|
510
574
|
</aside>
|
|
511
575
|
<div class="tsd-comment tsd-typography">
|
|
@@ -536,7 +600,7 @@
|
|
|
536
600
|
<li class="tsd-description">
|
|
537
601
|
<aside class="tsd-sources">
|
|
538
602
|
<ul>
|
|
539
|
-
<li>Defined in src/utilities/extensions.ts:
|
|
603
|
+
<li>Defined in src/utilities/extensions.ts:217</li>
|
|
540
604
|
</ul>
|
|
541
605
|
</aside>
|
|
542
606
|
<div class="tsd-comment tsd-typography">
|
|
@@ -599,6 +663,9 @@
|
|
|
599
663
|
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
600
664
|
<a href="utilities_extensions.html#iskmllayerextension" class="tsd-kind-icon">isKMLLayer<wbr>Extension</a>
|
|
601
665
|
</li>
|
|
666
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
667
|
+
<a href="utilities_extensions.html#ismapimagelayerextension" class="tsd-kind-icon">is<wbr>Map<wbr>Image<wbr>Layer<wbr>Extension</a>
|
|
668
|
+
</li>
|
|
602
669
|
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
603
670
|
<a href="utilities_extensions.html#ismapimagesublayerextension" class="tsd-kind-icon">is<wbr>Map<wbr>Image<wbr>Sublayer<wbr>Extension</a>
|
|
604
671
|
</li>
|
|
@@ -608,6 +675,9 @@
|
|
|
608
675
|
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
609
676
|
<a href="utilities_extensions.html#isstreamlayerextension" class="tsd-kind-icon">is<wbr>Stream<wbr>Layer<wbr>Extension</a>
|
|
610
677
|
</li>
|
|
678
|
+
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
679
|
+
<a href="utilities_extensions.html#istilelayerextension" class="tsd-kind-icon">is<wbr>Tile<wbr>Layer<wbr>Extension</a>
|
|
680
|
+
</li>
|
|
611
681
|
<li class=" tsd-kind-function tsd-parent-kind-module">
|
|
612
682
|
<a href="utilities_extensions.html#iswmslayerextension" class="tsd-kind-icon">isWMSLayer<wbr>Extension</a>
|
|
613
683
|
</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">"
|
|
84
|
+
<div class="tsd-signature tsd-kind-icon">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"34.1.0"</span><span class="tsd-signature-symbol"> = "34.1.0"</span></div>
|
|
85
85
|
<aside class="tsd-sources">
|
|
86
86
|
<ul>
|
|
87
87
|
<li>Defined in src/version.ts:4</li>
|
|
@@ -72,6 +72,10 @@ export interface ArcGISSublayerExtensionCollection<S extends ArcGISSublayerExten
|
|
|
72
72
|
* Extends the capabilities of an Esri Sublayer object.
|
|
73
73
|
*/
|
|
74
74
|
export declare abstract class ArcGISSublayerExtension<TProperties extends ArcGISSublayerExtensionProperties = ArcGISSublayerExtensionProperties> extends SublayerExtension<TProperties> {
|
|
75
|
+
/**
|
|
76
|
+
* @inheritdoc
|
|
77
|
+
*/
|
|
78
|
+
get canToggleVisibility(): boolean;
|
|
75
79
|
/**
|
|
76
80
|
* @inheritdoc
|
|
77
81
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import EsriExtent from"@arcgis/core/geometry/Extent";import FeatureType from"@arcgis/core/layers/support/FeatureType";import Field from"@arcgis/core/layers/support/Field";import{InvalidOperationError}from"../InvalidOperationError.js";import{toAttachment}from"../data/Attachment.js";import{FeatureSettings}from"../data/FeatureSettings.js";import{GeometryType as PortalGeometryType}from"../portal/Geometry.js";import{Layer as PortalLayer}from"../portal/Layer.js";import{DefaultArcGISRequestHelper}from"../support/ArcGISRequestHelper.js";import{serializable}from"../support/Serializable.js";import{ArcGISRelationshipCollection}from"../support/_ArcGISRelationshipCollection.js";import{executeQuery}from"../support/_query.js";import{Collection}from"../support/esri.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{isFeatureLayer,isMapImageSublayer as isArcGISSublayer}from"../utilities/layers.js";import{parse}from"../utilities/number.js";import{SublayerExtension,SublayerSchema}from"./_SublayerExtension.js";import{ExtensionBaseLayerListSettings}from"./support/LayerListSettings.js";const ERR_SCHEMA_READ_ONLY="This schema property is read-only.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1});export class ArcGISSublayerExtension extends SublayerExtension{constructor(e){super(e),this._capabilitiesField=DEFAULT_CAPABILITIES}get supportsSublayers(){return!0}get renderer(){var e;return null===(e=this.sublayer)||void 0===e?void 0:e.renderer}get supportsPagination(){return this._supportsPagination}get hasFeatures(){return 0===this.sublayerExtensions.length}get requestHelper(){return this._requestHelper?this._requestHelper:this.layerExtension?this.layerExtension.requestHelper:(this._autoCreatedRequestHelper||(this._autoCreatedRequestHelper=this._createRequestHelper()),this._autoCreatedRequestHelper)}set requestHelper(e){this._requestHelper=e}get sublayer(){return super.sublayer}get sublayerExtensions(){return super.sublayerExtensions}_getSerializableProperties(){return{...super._getSerializableProperties(),requestHelper:{serialize:!1}}}_isSupportedSublayer(e){return isArcGISSublayer(e)}async _getAttachments(e){var t,r;const i=null===(t=this.sublayer)||void 0===t?void 0:t.url;if(!this._hasAttachments||!i)return[];const s=`${i}/${e.primaryKey}/attachments`,a=await this.requestHelper.request(s,{query:{f:"json"}});return(null===(r=null==a?void 0:a.data)||void 0===r?void 0:r.attachmentInfos)?a.data.attachmentInfos.map((e=>toAttachment(e,s))):[]}_getFeatures(e,t){const r=this.sublayer.createQuery();return r.where=void 0,r.objectIds=e.map((e=>parse(e))),r.outFields=t.outFields,r.returnGeometry=t.returnGeometry,executeQuery(r,this,this.sublayer,t.cancelToken)}_createLayerListSettings(e){return new ArcGISSublayerExtensionLayerListSettings(e,this)}_createFeatureSettings(){return new ArcGISSublayerFeatureSettings(this)}_createRelationships(){return new ArcGISSublayerRelationshipCollection(this)}_createRequestHelper(){return new DefaultArcGISRequestHelper}_createSublayer(e){return PortalLayer.toEsriApiSublayer(e,"ArcGISMapServiceLayer")}_createSchema(){return new ArcGISSublayerSchema(this)}async _applySublayerProperties(e,t){return PortalLayer.applyToEsriApiSublayer(e,t)}_capabilities(){return this._capabilitiesField}async _onInitialize(){var e,t,r;await super._onInitialize(),this._effectiveFullExtent=null===(e=this.sublayer)||void 0===e?void 0:e.fullExtent;const i=await this._getSublayerDefinition();if(i){if(i.capabilities){const e=i.capabilities.split(",").map((e=>e.trim()));this._capabilitiesField={supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsUpdate:!1,supportsQuery:e.includes("Data")},this.notifyChange("capabilities")}(null===(t=i.advancedQueryCapabilities)||void 0===t?void 0:t.hasOwnProperty("supportsPagination"))&&(this._supportsPagination=i.advancedQueryCapabilities.supportsPagination),i.extent&&(this._effectiveFullExtent=null!==(r=this._effectiveFullExtent)&&void 0!==r?r:EsriExtent.fromJSON(i.extent)),this._hasAttachments=!!i.hasAttachments,this.schema.initialize(i)}await this.relationships.initialize()}async _postInitialize(){await super._postInitialize(),this.layerListSettings.onLayerExtensionInitialized()}_serializeSublayer(e){return PortalLayer.fromEsriApiSublayer(e)}async _getSublayerDefinition(){var e;const t=null===(e=this.sublayer)||void 0===e?void 0:e.url;if(!t)return;return(await this.requestHelper.request(t,{query:{f:"json"}})).data}}let ArcGISSublayerSchema=class extends SublayerSchema{constructor(e){super(e),this._fieldBackingCollection=new Collection,this._fieldCollection=new ReadOnlyCollection(this._fieldBackingCollection),this._typeBackingCollection=new Collection,this._typeCollection=new ReadOnlyCollection(this._typeBackingCollection)}get types(){return this._typeCollection}get _fields(){return this._fieldCollection}get primaryKeyField(){var e,t;return null!==(e=this._primaryKeyField)&&void 0!==e?e:null===(t=this._sublayerExtension.sublayer)||void 0===t?void 0:t.objectIdField}set primaryKeyField(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}get geometryType(){return this._geometryType}set geometryType(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}get displayField(){return this._displayField}set displayField(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}get typeIdField(){var e;return null===(e=this._sublayerExtension.sublayer)||void 0===e?void 0:e.typeIdField}set typeIdField(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}initialize(e){if(e.fields&&(this._fieldBackingCollection.removeAll(),this._fieldBackingCollection.addMany(e.fields.map((e=>Field.fromJSON(e))))),e.types){this._typeBackingCollection.removeAll();for(const t of e.types)this._typeBackingCollection.add(FeatureType.fromJSON(t))}this._geometryType=PortalGeometryType.toEsriApiGeometryType(e.geometryType),this.notifyChange("geometryType"),this._displayField=e.displayField,this.notifyChange("displayField"),this._primaryKeyField=e.objectIdField,this.notifyChange("primaryKeyField")}};ArcGISSublayerSchema=__decorate([serializable],ArcGISSublayerSchema);export{ArcGISSublayerSchema};let ArcGISSublayerFeatureSettings=class extends FeatureSettings{constructor(e){if(super(),this._sublayerBindings=new Map,this._sublayerExtension=e,this._bindSettingToSublayerProperty("popupTemplate"),e.sublayer)this._onSublayerResolved(e.sublayer);else{const t=e.watch("sublayer",(()=>{this._onSublayerResolved(e.sublayer),t.remove()}),!0)}}get zoomScale(){const e="point"===this._sublayerExtension.schema.geometryType?this._sublayerExtension.sublayer.maxScale:void 0;return this._getSetting("zoomScale",e)}set zoomScale(e){this._setSetting("zoomScale",e)}_getSetting(e,t){return this._sublayerBindings.has(e)&&this._sublayerExtension.sublayer?this._sublayerExtension.sublayer[this._sublayerBindings.get(e)]:super._getSetting(e,t)}_setSetting(e,t){this._sublayerBindings.has(e)&&this._sublayerExtension.sublayer?this._sublayerExtension.sublayer[this._sublayerBindings.get(e)]=t:super._setSetting(e,t)}_bindSettingToSublayerProperty(e,t){const r=null!=t?t:e;this._sublayerBindings.set(e,r),this._sublayerExtension.watch(`sublayer.${r}`,(()=>this.notifyChange(e)),!0)}_onSublayerResolved(e){for(const t of this._sublayerBindings.keys())this.isModified(t)&&(e[t]=this[t],this.reset(t))}};ArcGISSublayerFeatureSettings=__decorate([serializable],ArcGISSublayerFeatureSettings);export{ArcGISSublayerFeatureSettings};let ArcGISSublayerExtensionLayerListSettings=class extends ExtensionBaseLayerListSettings{get _layerSupportsHideChildren(){return!0}get _esriLayer(){return this._extension.sublayer}get _listModePath(){return"sublayer.listMode"}get _supportsChildren(){return!0}};ArcGISSublayerExtensionLayerListSettings=__decorate([serializable],ArcGISSublayerExtensionLayerListSettings);export class ArcGISSublayerRelationshipCollection extends ArcGISRelationshipCollection{get _sourceUrl(){return this._source.sublayer?this._source.sublayer.url:void 0}get _sourceLayerId(){return this._source.sublayer?this._source.sublayer.id:void 0}_findRelatedSource(e){if(!this._source.layerExtension||!this._source.sublayer||!this._source.sublayer.url)return;const t=this._source.layerExtension.allSublayerExtensions.initializedItems.find((t=>t.sublayer.id===e));return t||(this._source.layerExtension.mapExtension?this._source.layerExtension.mapExtension.tableExtensions.initializedItems.find((t=>isFeatureLayer(t.table)&&t.table.url===this._source.sublayer.layer.url&&t.table.layerId===e)):void 0)}}
|
|
1
|
+
import{__decorate}from"tslib";import EsriExtent from"@arcgis/core/geometry/Extent";import FeatureType from"@arcgis/core/layers/support/FeatureType";import Field from"@arcgis/core/layers/support/Field";import{InvalidOperationError}from"../InvalidOperationError.js";import{toAttachment}from"../data/Attachment.js";import{FeatureSettings}from"../data/FeatureSettings.js";import{GeometryType as PortalGeometryType}from"../portal/Geometry.js";import{Layer as PortalLayer}from"../portal/Layer.js";import{DefaultArcGISRequestHelper}from"../support/ArcGISRequestHelper.js";import{serializable}from"../support/Serializable.js";import{ArcGISRelationshipCollection}from"../support/_ArcGISRelationshipCollection.js";import{executeQuery}from"../support/_query.js";import{Collection}from"../support/esri.js";import{ReadOnlyCollection}from"../utilities/ReadOnlyCollection.js";import{isMapImageLayerExtension}from"../utilities/extensions.js";import{isFeatureLayer,isMapImageLayer,isMapImageSublayer as isArcGISSublayer}from"../utilities/layers.js";import{parse}from"../utilities/number.js";import{SublayerExtension,SublayerSchema}from"./_SublayerExtension.js";import{ExtensionBaseLayerListSettings}from"./support/LayerListSettings.js";const ERR_SCHEMA_READ_ONLY="This schema property is read-only.",DEFAULT_CAPABILITIES=Object.freeze({supportsAdd:!1,supportsUpdate:!1,supportsDelete:!1,supportsEditing:!1,supportsQuery:!1});export class ArcGISSublayerExtension extends SublayerExtension{constructor(e){super(e),this._capabilitiesField=DEFAULT_CAPABILITIES}get canToggleVisibility(){var e,t,r;const i=e=>e.parentSublayerExtension?i(e.parentSublayerExtension):e.layerExtension,s=i(this),a=null!==(e=null==s?void 0:s.layer)&&void 0!==e?e:null===(t=this.sublayer)||void 0===t?void 0:t.layer,l=null===(r=null==a?void 0:a.capabilities)||void 0===r?void 0:r.exportMap;return l?l.supportsSublayerVisibility:a?isMapImageLayer(a):s?isMapImageLayerExtension(s):super.canToggleVisibility}get supportsSublayers(){return!0}get renderer(){var e;return null===(e=this.sublayer)||void 0===e?void 0:e.renderer}get supportsPagination(){return this._supportsPagination}get hasFeatures(){return 0===this.sublayerExtensions.length}get requestHelper(){return this._requestHelper?this._requestHelper:this.layerExtension?this.layerExtension.requestHelper:(this._autoCreatedRequestHelper||(this._autoCreatedRequestHelper=this._createRequestHelper()),this._autoCreatedRequestHelper)}set requestHelper(e){this._requestHelper=e}get sublayer(){return super.sublayer}get sublayerExtensions(){return super.sublayerExtensions}_getSerializableProperties(){return{...super._getSerializableProperties(),requestHelper:{serialize:!1}}}_isSupportedSublayer(e){return isArcGISSublayer(e)}async _getAttachments(e){var t,r;const i=null===(t=this.sublayer)||void 0===t?void 0:t.url;if(!this._hasAttachments||!i)return[];const s=`${i}/${e.primaryKey}/attachments`,a=await this.requestHelper.request(s,{query:{f:"json"}});return(null===(r=null==a?void 0:a.data)||void 0===r?void 0:r.attachmentInfos)?a.data.attachmentInfos.map((e=>toAttachment(e,s))):[]}_getFeatures(e,t){const r=this.sublayer.createQuery();return r.where=void 0,r.objectIds=e.map((e=>parse(e))),r.outFields=t.outFields,r.returnGeometry=t.returnGeometry,executeQuery(r,this,this.sublayer,t.cancelToken)}_createLayerListSettings(e){return new ArcGISSublayerExtensionLayerListSettings(e,this)}_createFeatureSettings(){return new ArcGISSublayerFeatureSettings(this)}_createRelationships(){return new ArcGISSublayerRelationshipCollection(this)}_createRequestHelper(){return new DefaultArcGISRequestHelper}_createSublayer(e){return PortalLayer.toEsriApiSublayer(e,"ArcGISMapServiceLayer")}_createSchema(){return new ArcGISSublayerSchema(this)}async _applySublayerProperties(e,t){return PortalLayer.applyToEsriApiSublayer(e,t)}_capabilities(){return this._capabilitiesField}async _onInitialize(){var e,t,r;await super._onInitialize(),this._effectiveFullExtent=null===(e=this.sublayer)||void 0===e?void 0:e.fullExtent;const i=await this._getSublayerDefinition();if(i){if(i.capabilities){const e=i.capabilities.split(",").map((e=>e.trim()));this._capabilitiesField={supportsAdd:!1,supportsDelete:!1,supportsEditing:!1,supportsUpdate:!1,supportsQuery:e.includes("Data")},this.notifyChange("capabilities")}(null===(t=i.advancedQueryCapabilities)||void 0===t?void 0:t.hasOwnProperty("supportsPagination"))&&(this._supportsPagination=i.advancedQueryCapabilities.supportsPagination),i.extent&&(this._effectiveFullExtent=null!==(r=this._effectiveFullExtent)&&void 0!==r?r:EsriExtent.fromJSON(i.extent)),this._hasAttachments=!!i.hasAttachments,this.schema.initialize(i)}await this.relationships.initialize()}async _postInitialize(){await super._postInitialize(),this.layerListSettings.onLayerExtensionInitialized()}_serializeSublayer(e){return PortalLayer.fromEsriApiSublayer(e)}async _getSublayerDefinition(){var e;const t=null===(e=this.sublayer)||void 0===e?void 0:e.url;if(!t)return;return(await this.requestHelper.request(t,{query:{f:"json"}})).data}}let ArcGISSublayerSchema=class extends SublayerSchema{constructor(e){super(e),this._fieldBackingCollection=new Collection,this._fieldCollection=new ReadOnlyCollection(this._fieldBackingCollection),this._typeBackingCollection=new Collection,this._typeCollection=new ReadOnlyCollection(this._typeBackingCollection)}get types(){return this._typeCollection}get _fields(){return this._fieldCollection}get primaryKeyField(){var e,t;return null!==(e=this._primaryKeyField)&&void 0!==e?e:null===(t=this._sublayerExtension.sublayer)||void 0===t?void 0:t.objectIdField}set primaryKeyField(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}get geometryType(){return this._geometryType}set geometryType(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}get displayField(){return this._displayField}set displayField(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}get typeIdField(){var e;return null===(e=this._sublayerExtension.sublayer)||void 0===e?void 0:e.typeIdField}set typeIdField(e){throw new InvalidOperationError(ERR_SCHEMA_READ_ONLY)}initialize(e){if(e.fields&&(this._fieldBackingCollection.removeAll(),this._fieldBackingCollection.addMany(e.fields.map((e=>Field.fromJSON(e))))),e.types){this._typeBackingCollection.removeAll();for(const t of e.types)this._typeBackingCollection.add(FeatureType.fromJSON(t))}this._geometryType=PortalGeometryType.toEsriApiGeometryType(e.geometryType),this.notifyChange("geometryType"),this._displayField=e.displayField,this.notifyChange("displayField"),this._primaryKeyField=e.objectIdField,this.notifyChange("primaryKeyField")}};ArcGISSublayerSchema=__decorate([serializable],ArcGISSublayerSchema);export{ArcGISSublayerSchema};let ArcGISSublayerFeatureSettings=class extends FeatureSettings{constructor(e){if(super(),this._sublayerBindings=new Map,this._sublayerExtension=e,this._bindSettingToSublayerProperty("popupTemplate"),e.sublayer)this._onSublayerResolved(e.sublayer);else{const t=e.watch("sublayer",(()=>{this._onSublayerResolved(e.sublayer),t.remove()}),!0)}}get zoomScale(){const e="point"===this._sublayerExtension.schema.geometryType?this._sublayerExtension.sublayer.maxScale:void 0;return this._getSetting("zoomScale",e)}set zoomScale(e){this._setSetting("zoomScale",e)}_getSetting(e,t){return this._sublayerBindings.has(e)&&this._sublayerExtension.sublayer?this._sublayerExtension.sublayer[this._sublayerBindings.get(e)]:super._getSetting(e,t)}_setSetting(e,t){this._sublayerBindings.has(e)&&this._sublayerExtension.sublayer?this._sublayerExtension.sublayer[this._sublayerBindings.get(e)]=t:super._setSetting(e,t)}_bindSettingToSublayerProperty(e,t){const r=null!=t?t:e;this._sublayerBindings.set(e,r),this._sublayerExtension.watch(`sublayer.${r}`,(()=>this.notifyChange(e)),!0)}_onSublayerResolved(e){for(const t of this._sublayerBindings.keys())this.isModified(t)&&(e[t]=this[t],this.reset(t))}};ArcGISSublayerFeatureSettings=__decorate([serializable],ArcGISSublayerFeatureSettings);export{ArcGISSublayerFeatureSettings};let ArcGISSublayerExtensionLayerListSettings=class extends ExtensionBaseLayerListSettings{get _layerSupportsHideChildren(){return!0}get _esriLayer(){return this._extension.sublayer}get _listModePath(){return"sublayer.listMode"}get _supportsChildren(){return!0}};ArcGISSublayerExtensionLayerListSettings=__decorate([serializable],ArcGISSublayerExtensionLayerListSettings);export class ArcGISSublayerRelationshipCollection extends ArcGISRelationshipCollection{get _sourceUrl(){return this._source.sublayer?this._source.sublayer.url:void 0}get _sourceLayerId(){return this._source.sublayer?this._source.sublayer.id:void 0}_findRelatedSource(e){if(!this._source.layerExtension||!this._source.sublayer||!this._source.sublayer.url)return;const t=this._source.layerExtension.allSublayerExtensions.initializedItems.find((t=>t.sublayer.id===e));return t||(this._source.layerExtension.mapExtension?this._source.layerExtension.mapExtension.tableExtensions.initializedItems.find((t=>isFeatureLayer(t.table)&&t.table.url===this._source.sublayer.layer.url&&t.table.layerId===e)):void 0)}}
|
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{isBasemapExtension,isBookmark,isGroundExtension,isLayerPreset,isMenu,isTableExtension,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{isGroupLayerExtension}from"../utilities/extensions.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{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._itemType=ItemType.MAP_EXTENSION,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=isLayerPreset(e)?e:new LayerPreset(e);this._initialLayerPreset=t}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(isGroupLayerExtension(a))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(isTableExtension(e)?e:TableExtension.create(e),t)},onMatch:(e,t,i,s)=>{isTableExtension(t)||e.assignProperties(t),i!==s&&this.tableExtensions.reorder(e,s)},equals:(e,t)=>isTableExtension(t)?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?isBasemapExtension(e)?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(isBasemapExtension(e)?e:BasemapExtension.create(e),t)},onMatch:(e,t,i,s)=>{isBasemapExtension(t)||e.assignProperties(t),i!==s&&this.basemapOptions.reorder(e,s)},onMissing:e=>{this.basemapOptions.remove(e)},equals:(e,t)=>{if(isBasemapExtension(t))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?isGroundExtension(e)?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=>isBookmark(e)?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?isMenu(e)?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=>isGroupLayerExtension(e)?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=>isGroupLayerExtension(e)?e.layerExtensions:[])).toArray(),a=new Collection;a.addMany(t.removed);const n=a.flatten((e=>isGroupLayerExtension(e)?e.layerExtensions:[])).toArray(),o=new Collection;o.addMany(t.moved);const r=o.flatten((e=>isGroupLayerExtension(e)?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{isBasemapExtension,isBookmark,isGroundExtension,isLayerPreset,isMenu,isTableExtension,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{isGroupLayerExtension}from"../utilities/extensions.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{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._itemType=ItemType.MAP_EXTENSION,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=isLayerPreset(e)?e:new LayerPreset(e);this._initialLayerPreset=t}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(isGroupLayerExtension(a))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)));if(i)s.push((async()=>{const t=i[1];await t._switchLayer(e),this._layerExtensions._register(t)})());else{const t=this._layerExtensions._forLayer(e);(null==t?void 0:t.layer)!==e&&s.push(t._switchLayer(e))}}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=>e.layer&&(LayerExtension._matchesRef(t,e.layer)||layersAreEquivalent(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(isTableExtension(e)?e:TableExtension.create(e),t)},onMatch:(e,t,i,s)=>{isTableExtension(t)||e.assignProperties(t),i!==s&&this.tableExtensions.reorder(e,s)},equals:(e,t)=>isTableExtension(t)?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?isBasemapExtension(e)?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(isBasemapExtension(e)?e:BasemapExtension.create(e),t)},onMatch:(e,t,i,s)=>{isBasemapExtension(t)||e.assignProperties(t),i!==s&&this.basemapOptions.reorder(e,s)},onMissing:e=>{this.basemapOptions.remove(e)},equals:(e,t)=>{if(isBasemapExtension(t))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?isGroundExtension(e)?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=>isBookmark(e)?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?isMenu(e)?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=>isGroupLayerExtension(e)?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=>isGroupLayerExtension(e)?e.layerExtensions:[])).toArray(),a=new Collection;a.addMany(t.removed);const n=a.flatten((e=>isGroupLayerExtension(e)?e.layerExtensions:[])).toArray(),o=new Collection;o.addMany(t.moved);const r=o.flatten((e=>isGroupLayerExtension(e)?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,5 +1,6 @@
|
|
|
1
1
|
import type ArcGISSublayer from "@arcgis/core/layers/support/Sublayer";
|
|
2
2
|
import type { Layer as PortalLayer } from "../portal/Layer.js";
|
|
3
|
+
import { PropertyDefs } from "../support/Serializable.js";
|
|
3
4
|
import { ArcGISSublayerExtension, ArcGISSublayerExtensionCollection, ArcGISSublayerExtensionProperties, ArcGISSublayerProperties } from "./ArcGISSublayerExtension.js";
|
|
4
5
|
import type { TileLayerExtension } from "./TileLayerExtension.js";
|
|
5
6
|
/**
|
|
@@ -44,4 +45,8 @@ export declare class TileSublayerExtension extends ArcGISSublayerExtension<TileS
|
|
|
44
45
|
* @inheritdoc
|
|
45
46
|
*/
|
|
46
47
|
protected _createSublayerExtension(properties?: TileSublayerExtensionProperties): TileSublayerExtension;
|
|
48
|
+
/**
|
|
49
|
+
* @inheritdoc
|
|
50
|
+
*/
|
|
51
|
+
protected _getSerializableProperties(): PropertyDefs<TileSublayerExtensionProperties>;
|
|
47
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var TileSublayerExtension_1;import{__decorate}from"tslib";import{serializable}from"../support/Serializable.js";import{ArcGISSublayerExtension}from"./ArcGISSublayerExtension.js";let TileSublayerExtension=TileSublayerExtension_1=class extends ArcGISSublayerExtension{get layerExtension(){return super.layerExtension}get sublayerExtensions(){return super.sublayerExtensions}get canToggleVisibility(){return!1}get canChangeOpacity(){return!1}_createSublayerExtension(e){return new TileSublayerExtension_1(e)}};TileSublayerExtension=TileSublayerExtension_1=__decorate([serializable],TileSublayerExtension);export{TileSublayerExtension};
|
|
1
|
+
var TileSublayerExtension_1;import{__decorate}from"tslib";import{serializable}from"../support/Serializable.js";import{getLogger}from"../utilities/log.js";import{ArcGISSublayerExtension}from"./ArcGISSublayerExtension.js";const log=getLogger("TileSublayerExtension");let TileSublayerExtension=TileSublayerExtension_1=class extends ArcGISSublayerExtension{get layerExtension(){return super.layerExtension}get sublayerExtensions(){return super.sublayerExtensions}get canToggleVisibility(){return!1}get canChangeOpacity(){return!1}_createSublayerExtension(e){return new TileSublayerExtension_1(e)}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,visibilityMode:{...this._toPropertyDef(e.visibilityMode),serialize:()=>"inherited",deserialize:e=>{"inherited"!==e&&log.error(`SublayerExtension (id: ${this.id}, title: ${this.title}) visibilityMode cannot be set to ${e}.`)},default:"inherited"}}}};TileSublayerExtension=TileSublayerExtension_1=__decorate([serializable],TileSublayerExtension);export{TileSublayerExtension};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type Extent from "@arcgis/core/geometry/Extent";
|
|
2
2
|
import type WMTSSublayer from "@arcgis/core/layers/support/WMTSSublayer";
|
|
3
|
+
import { PropertyDefs } from "../support/Serializable.js";
|
|
3
4
|
import type { SublayerLike } from "../support/esri.js";
|
|
4
5
|
import type { WMTSLayerExtension } from "./WMTSLayerExtension.js";
|
|
5
6
|
import { SublayerExtension, SublayerExtensionProperties, SublayerProperties } from "./_SublayerExtension.js";
|
|
@@ -54,4 +55,8 @@ export declare class WMTSSublayerExtension extends SublayerExtension<WMTSSublaye
|
|
|
54
55
|
* @inheritdoc
|
|
55
56
|
*/
|
|
56
57
|
protected _serializeSublayer(_sublayer: SublayerLike): SublayerProperties;
|
|
58
|
+
/**
|
|
59
|
+
* @inheritdoc
|
|
60
|
+
*/
|
|
61
|
+
protected _getSerializableProperties(): PropertyDefs<WMTSSublayerExtensionProperties>;
|
|
57
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{InvalidOperationError}from"../InvalidOperationError.js";import{serializable}from"../support/Serializable.js";import{isWMTSSublayer}from"../utilities/_layers.js";import{SublayerExtension}from"./_SublayerExtension.js";const ERR_CREATE_SUBLAYER_NOT_SUPPORTED="WMTS sublayers cannot be created or configured from JSON. They must be created with an ESRI WMTSSublayer object.";let WMTSSublayerExtension=class extends SublayerExtension{get sublayer(){return super.sublayer}get layerExtension(){return super.layerExtension}get canToggleVisibility(){return!1}get canChangeOpacity(){return!1}get effectiveFullExtent(){return this.sublayer?this.sublayer.fullExtent:this.parentSublayerExtension?this.parentSublayerExtension.effectiveFullExtent:this.layerExtension?this.layerExtension.effectiveFullExtent:void 0}constructor(e){var r;if(super(e),!this.sublayer&&!(null===(r=this._deferredSublayerProperties)||void 0===r?void 0:r.$ref))throw new InvalidOperationError(ERR_CREATE_SUBLAYER_NOT_SUPPORTED)}_isSupportedSublayer(e){return isWMTSSublayer(e)}_createSublayer(e){throw new InvalidOperationError(ERR_CREATE_SUBLAYER_NOT_SUPPORTED)}async _applySublayerProperties(e,r){}_serializeSublayer(e){return this._createSublayerRef()}};WMTSSublayerExtension=__decorate([serializable],WMTSSublayerExtension);export{WMTSSublayerExtension};
|
|
1
|
+
import{__decorate}from"tslib";import{InvalidOperationError}from"../InvalidOperationError.js";import{serializable}from"../support/Serializable.js";import{isWMTSSublayer}from"../utilities/_layers.js";import{getLogger}from"../utilities/log.js";import{SublayerExtension}from"./_SublayerExtension.js";const log=getLogger("WMTSSublayerExtension"),ERR_CREATE_SUBLAYER_NOT_SUPPORTED="WMTS sublayers cannot be created or configured from JSON. They must be created with an ESRI WMTSSublayer object.";let WMTSSublayerExtension=class extends SublayerExtension{get sublayer(){return super.sublayer}get layerExtension(){return super.layerExtension}get canToggleVisibility(){return!1}get canChangeOpacity(){return!1}get effectiveFullExtent(){return this.sublayer?this.sublayer.fullExtent:this.parentSublayerExtension?this.parentSublayerExtension.effectiveFullExtent:this.layerExtension?this.layerExtension.effectiveFullExtent:void 0}constructor(e){var r;if(super(e),!this.sublayer&&!(null===(r=this._deferredSublayerProperties)||void 0===r?void 0:r.$ref))throw new InvalidOperationError(ERR_CREATE_SUBLAYER_NOT_SUPPORTED)}_isSupportedSublayer(e){return isWMTSSublayer(e)}_createSublayer(e){throw new InvalidOperationError(ERR_CREATE_SUBLAYER_NOT_SUPPORTED)}async _applySublayerProperties(e,r){}_serializeSublayer(e){return this._createSublayerRef()}_getSerializableProperties(){const e=super._getSerializableProperties();return{...e,visibilityMode:{...this._toPropertyDef(e.visibilityMode),serialize:()=>"inherited",deserialize:e=>{"inherited"!==e&&log.error(`SublayerExtension (id: ${this.id}, title: ${this.title}) visibilityMode cannot be set to ${e}.`)},default:"inherited"}}}};WMTSSublayerExtension=__decorate([serializable],WMTSSublayerExtension);export{WMTSSublayerExtension};
|