@igo2/context 21.0.0-next.49 → 21.0.0-next.50
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.
|
@@ -25,7 +25,7 @@ import { HttpParams, HttpClient } from '@angular/common/http';
|
|
|
25
25
|
import { AuthService, TokenService } from '@igo2/auth';
|
|
26
26
|
import { RouteService } from '@igo2/core/route';
|
|
27
27
|
import { StorageService } from '@igo2/core/storage';
|
|
28
|
-
import { QueryFormat, isLayerGroupOptions, ID_GROUP_PREFIX, isLayerGroup, isLayerItem, getLayerOptionIdentifier, findParentId, generateIdFromSourceOptions, ExportService, FeatureDataSource, randomOlFlatStyle, MapBrowserComponent, LayerService, sortLayersByZindex, mergeLayersOptions, MapService, isLayerItemOptions, moveToOlFeatures, FeatureMotion, FeatureDetailsComponent } from '@igo2/geo';
|
|
28
|
+
import { QueryFormat, isLayerGroupOptions, ID_GROUP_PREFIX, isLayerGroup, isLayerItem, getLayerOptionIdentifier, findParentId, getLayerParam, generateIdFromSourceOptions, ExportService, FeatureDataSource, randomOlFlatStyle, MapBrowserComponent, LayerService, sortLayersByZindex, mergeLayersOptions, MapService, isLayerItemOptions, moveToOlFeatures, FeatureMotion, FeatureDetailsComponent } from '@igo2/geo';
|
|
29
29
|
import { ObjectUtils, uuid, downloadContent } from '@igo2/utils';
|
|
30
30
|
import GeoJSON from 'ol/format/GeoJSON';
|
|
31
31
|
import olPoint from 'ol/geom/Point';
|
|
@@ -104,12 +104,6 @@ const GroupParamsKeys = [
|
|
|
104
104
|
'expanded',
|
|
105
105
|
...BaseLayerParamsKeys
|
|
106
106
|
];
|
|
107
|
-
const PositionParamsKeys = [
|
|
108
|
-
'center',
|
|
109
|
-
'zoom',
|
|
110
|
-
'rotation',
|
|
111
|
-
'projection'
|
|
112
|
-
];
|
|
113
107
|
const SHARE_MAP_KEYS_DEFAULT_OPTIONS = {
|
|
114
108
|
context: 'ctx',
|
|
115
109
|
urls: 'urls',
|
|
@@ -504,12 +498,13 @@ class ShareMapEncoder {
|
|
|
504
498
|
getContextLayersMap() {
|
|
505
499
|
const ctxLayers = this.getCurrentContext()?.layers || [];
|
|
506
500
|
const ctxFlattened = getFlattenOptions(ctxLayers);
|
|
507
|
-
|
|
501
|
+
const filtered = ctxFlattened
|
|
508
502
|
.map((lctx) => {
|
|
509
503
|
const identifier = getLayerOptionIdentifier(lctx);
|
|
510
504
|
return [identifier ?? '', lctx];
|
|
511
505
|
})
|
|
512
|
-
.filter(([key]) => key !== '')
|
|
506
|
+
.filter(([key]) => key !== '');
|
|
507
|
+
return new Map(filtered);
|
|
513
508
|
}
|
|
514
509
|
/**
|
|
515
510
|
* Filters layers and context layers based on visibility, opacity, and expanded state.
|
|
@@ -520,7 +515,7 @@ class ShareMapEncoder {
|
|
|
520
515
|
const mapLayerIdentifier = getLayerOptionIdentifier(layer.options);
|
|
521
516
|
if (!mapLayerIdentifier)
|
|
522
517
|
return false;
|
|
523
|
-
const ctxLayer =
|
|
518
|
+
const ctxLayer = this.findContextLayer(layer.options, ctxLayersMap);
|
|
524
519
|
if (!ctxLayer)
|
|
525
520
|
return true;
|
|
526
521
|
const visibilityChange = layer.visible !== (ctxLayer.visible ?? true);
|
|
@@ -546,6 +541,22 @@ class ShareMapEncoder {
|
|
|
546
541
|
parentIdChange);
|
|
547
542
|
});
|
|
548
543
|
}
|
|
544
|
+
// Try to retrieve the layer by id or by params identifier for legacy
|
|
545
|
+
findContextLayer(options, ctxLayers) {
|
|
546
|
+
const identifier = getLayerOptionIdentifier(options);
|
|
547
|
+
if (!identifier) {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
const ctxLayer = ctxLayers.get(identifier);
|
|
551
|
+
if (!ctxLayer) {
|
|
552
|
+
const paramIdentifier = getLayerParam(options);
|
|
553
|
+
if (!paramIdentifier) {
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
556
|
+
return ctxLayers.get(paramIdentifier);
|
|
557
|
+
}
|
|
558
|
+
return ctxLayer;
|
|
559
|
+
}
|
|
549
560
|
getIdsNestedParent(node, ids) {
|
|
550
561
|
if (!node.parent)
|
|
551
562
|
return ids;
|