@regionerne/gis-komponent 0.0.80 → 0.0.82
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.
|
@@ -22,7 +22,7 @@ import { register } from 'ol/proj/proj4';
|
|
|
22
22
|
import proj4 from 'proj4';
|
|
23
23
|
import { Control, Rotate as Rotate$1 } from 'ol/control';
|
|
24
24
|
import { TileWMS, Vector } from 'ol/source';
|
|
25
|
-
import { Subject, BehaviorSubject, tap, switchMap, EMPTY, map, combineLatest, Observable, debounceTime, distinctUntilChanged, of, ReplaySubject,
|
|
25
|
+
import { Subject, BehaviorSubject, tap, switchMap, EMPTY, map, combineLatest, Observable, debounceTime, distinctUntilChanged, filter, take, of, ReplaySubject, interval, forkJoin, catchError, throwError } from 'rxjs';
|
|
26
26
|
import WMTS, { optionsFromCapabilities } from 'ol/source/WMTS';
|
|
27
27
|
import VectorLayer from 'ol/layer/Vector';
|
|
28
28
|
import TileSource from 'ol/source/Tile';
|
|
@@ -283,6 +283,11 @@ class LayerHelperService {
|
|
|
283
283
|
_dmpLayersCacheStoragKey = 'dmpLayersCache';
|
|
284
284
|
_layerErrorService = inject(LayerErrorService);
|
|
285
285
|
layerActivatedByBackgroundGroup = new Subject();
|
|
286
|
+
layersAddedToMapSubject = new BehaviorSubject(false);
|
|
287
|
+
_map;
|
|
288
|
+
set map(value) {
|
|
289
|
+
this._map = value;
|
|
290
|
+
}
|
|
286
291
|
setDbId(layer, id) {
|
|
287
292
|
layer.set(this._layerDbIdKey, id);
|
|
288
293
|
}
|
|
@@ -349,9 +354,9 @@ class LayerHelperService {
|
|
|
349
354
|
});
|
|
350
355
|
}
|
|
351
356
|
}
|
|
352
|
-
startFailoverForBackgroundGroup(
|
|
357
|
+
startFailoverForBackgroundGroup(groupId, aMap = undefined) {
|
|
353
358
|
const currentIndex$ = new BehaviorSubject(0);
|
|
354
|
-
const layergroup = aMap.getLayers().getArray()
|
|
359
|
+
const layergroup = (aMap ? aMap : this._map).getLayers().getArray()
|
|
355
360
|
.find(layergroup => layergroup instanceof OLLayerGroup && layergroup.get('id') === groupId);
|
|
356
361
|
if (!layergroup)
|
|
357
362
|
return;
|
|
@@ -934,7 +939,6 @@ class LayerSelectorComponent {
|
|
|
934
939
|
else {
|
|
935
940
|
this._loadPosition(this.collapsed);
|
|
936
941
|
this.filteredLayerGroups = cachedProfileInfo.cachedLayerGroups.filter(gr => !gr.background);
|
|
937
|
-
;
|
|
938
942
|
this.filteredBackgroundLayerGroups = cachedProfileInfo.cachedLayerGroups.filter(gr => gr.background);
|
|
939
943
|
this._setVisibleLayersFromCache(cachedProfileInfo.cachedLayerGroups);
|
|
940
944
|
}
|
|
@@ -964,7 +968,7 @@ class LayerSelectorComponent {
|
|
|
964
968
|
group.layers.forEach(layer => layer.visible = false); //Turn all layers off in selector to begin with
|
|
965
969
|
group.visible = true; // Expand the group (there will be at least one active layer)
|
|
966
970
|
group.expanded = true;
|
|
967
|
-
this.
|
|
971
|
+
this._layerHelper.layersAddedToMapSubject.pipe(filter(added => added === true), take(1)).subscribe((added) => this._layerHelper.startFailoverForBackgroundGroup(group.id));
|
|
968
972
|
});
|
|
969
973
|
this._initializeMapControl();
|
|
970
974
|
}
|
|
@@ -1090,7 +1094,7 @@ class LayerSelectorComponent {
|
|
|
1090
1094
|
if (visible && layerGroup.background) {
|
|
1091
1095
|
//Toggle background group on, apply failover logic
|
|
1092
1096
|
layerGroup.layers.forEach(layer => layer.visible = false); // Turn all off in selector to begin with
|
|
1093
|
-
this._layerHelper.startFailoverForBackgroundGroup(
|
|
1097
|
+
this._layerHelper.startFailoverForBackgroundGroup(layerGroup.id, this.map);
|
|
1094
1098
|
}
|
|
1095
1099
|
else {
|
|
1096
1100
|
layerGroup.layers.forEach(layer => {
|
|
@@ -5421,11 +5425,13 @@ class GisKomponentComponent {
|
|
|
5421
5425
|
}))
|
|
5422
5426
|
];
|
|
5423
5427
|
this.map.setLayers(layers);
|
|
5428
|
+
this._layerHelper.layersAddedToMapSubject.next(true);
|
|
5424
5429
|
if (this.settings) {
|
|
5425
5430
|
this._featureLoader.loadFeaturesSettings(this.settings);
|
|
5426
5431
|
}
|
|
5427
5432
|
this._currentItems.map = this.map;
|
|
5428
5433
|
this._layoutService.map = this.map;
|
|
5434
|
+
this._layerHelper.map = this.map;
|
|
5429
5435
|
this._layerHelper.applyCachedLayersToDisplayInMap(this.map, profile.id);
|
|
5430
5436
|
}
|
|
5431
5437
|
});
|