@regionerne/gis-komponent 0.0.92 → 0.0.93
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.
|
@@ -11,7 +11,7 @@ import ImageWMS from 'ol/source/ImageWMS';
|
|
|
11
11
|
import WMTSCapabilities from 'ol/format/WMTSCapabilities';
|
|
12
12
|
import ImageLayer from 'ol/layer/Image';
|
|
13
13
|
import * as i1 from '@angular/common/http';
|
|
14
|
-
import { HttpClient, HttpParams, HttpHeaders,
|
|
14
|
+
import { HttpClient, HttpParams, HttpHeaders, HttpResponse, provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
15
15
|
import OLLayerGroup from 'ol/layer/Group';
|
|
16
16
|
import * as i6$1 from '@angular/material/select';
|
|
17
17
|
import { MatSelectModule } from '@angular/material/select';
|
|
@@ -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, filter, take, of, ReplaySubject, interval, catchError, forkJoin
|
|
25
|
+
import { Subject, BehaviorSubject, tap, switchMap, EMPTY, map, combineLatest, Observable, debounceTime, distinctUntilChanged, filter, take, of, ReplaySubject, interval, catchError, forkJoin } 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';
|
|
@@ -2305,7 +2305,7 @@ class SearchProviderBase {
|
|
|
2305
2305
|
});
|
|
2306
2306
|
const body = this._serializer.serializeToString(searchFeature);
|
|
2307
2307
|
// Call the post without generic <WfsFeatureCollection>, because the GeoServer will return a 200 and an error as xml. Handle the deserialize manually instead.
|
|
2308
|
-
const req$ = this._http.post(layer.baseUrl.replace('wms', 'wfs'), body, { headers: { 'Content-Type': 'text/xml' }, responseType: 'text', observe: 'response' }).pipe(map(r => {
|
|
2308
|
+
const req$ = this._http.post(layer.baseUrl.replace('wms', 'wfs'), body, { headers: { '_noLogError': '_', 'Content-Type': 'text/xml' }, responseType: 'text', observe: 'response' }).pipe(map(r => {
|
|
2309
2309
|
try {
|
|
2310
2310
|
const result = JSON.parse(r.body ?? '');
|
|
2311
2311
|
return this.map(layer, result);
|
|
@@ -5033,19 +5033,12 @@ class MapSearchComponent {
|
|
|
5033
5033
|
}
|
|
5034
5034
|
highlight(wkt, event) {
|
|
5035
5035
|
event.stopPropagation();
|
|
5036
|
-
const wktFormatter = new WKT();
|
|
5037
|
-
const geom = wktFormatter.readGeometry(wkt);
|
|
5038
5036
|
if (this.activeHighlightWkt === wkt) {
|
|
5039
5037
|
this.activeHighlightWkt = null;
|
|
5040
5038
|
}
|
|
5041
5039
|
else {
|
|
5042
5040
|
this.activeHighlightWkt = wkt;
|
|
5043
|
-
|
|
5044
|
-
this._zoomService.zoomToFeatures(wkt);
|
|
5045
|
-
}
|
|
5046
|
-
else {
|
|
5047
|
-
this._highlight.highlight(wkt);
|
|
5048
|
-
}
|
|
5041
|
+
this._highlight.highlight(wkt);
|
|
5049
5042
|
}
|
|
5050
5043
|
}
|
|
5051
5044
|
onDragEnded(event) {
|
|
@@ -5154,7 +5147,12 @@ class LegendsListComponent {
|
|
|
5154
5147
|
_mapFilteredLayerGroupsKeyName = 'mapFilteredLayerGroups';
|
|
5155
5148
|
POSITION_STORAGE_KEY = 'legendsListPosition';
|
|
5156
5149
|
ngOnInit() {
|
|
5157
|
-
this._layerHelperService.activeLayersChanged.subscribe(() =>
|
|
5150
|
+
this._layerHelperService.activeLayersChanged.subscribe(() => {
|
|
5151
|
+
return this._setFilteredLegends().subscribe(result => {
|
|
5152
|
+
console.log("🚀 ~ LegendsListComponent ~ ngOnInit ~ result:", result);
|
|
5153
|
+
this.filteredLayersDetailed = result;
|
|
5154
|
+
});
|
|
5155
|
+
});
|
|
5158
5156
|
}
|
|
5159
5157
|
ngOnChanges(changes) {
|
|
5160
5158
|
this._layoutService.mapResizedSubject.subscribe(async () => {
|
|
@@ -5163,7 +5161,10 @@ class LegendsListComponent {
|
|
|
5163
5161
|
if (changes['profile'] && this.profile) {
|
|
5164
5162
|
this.collapsed = this.profile.legendsListFolded;
|
|
5165
5163
|
this._loadPosition(this.collapsed);
|
|
5166
|
-
this._setFilteredLegends().subscribe(result =>
|
|
5164
|
+
this._setFilteredLegends().subscribe(result => {
|
|
5165
|
+
console.log("🚀 ~ LegendsListComponent ~ ngOnChanges ~ result:", result);
|
|
5166
|
+
this.filteredLayersDetailed = result;
|
|
5167
|
+
});
|
|
5167
5168
|
}
|
|
5168
5169
|
}
|
|
5169
5170
|
ngOnDestroy() {
|
|
@@ -5269,17 +5270,22 @@ class LegendsListComponent {
|
|
|
5269
5270
|
}
|
|
5270
5271
|
// Fallback to Geoserver legend file
|
|
5271
5272
|
const fallbackUrl = `${layer.baseUrl}?service=WMS&REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&layer=${layer.layers}`;
|
|
5272
|
-
|
|
5273
|
+
const headers = new HttpHeaders().append('_noLogError', '_');
|
|
5274
|
+
return this._http.get(fallbackUrl, { responseType: 'blob', headers }).pipe(map(blob => {
|
|
5275
|
+
console.log("🚀 ~ LegendsListComponent ~ resolveLegendImage ~ layer:", layer);
|
|
5273
5276
|
// Blob returned as an image, so layer has a legend in Geoserver
|
|
5274
5277
|
const isImage = blob.type.startsWith('image/');
|
|
5275
5278
|
return {
|
|
5276
5279
|
...layer,
|
|
5277
5280
|
imageUrl: isImage ? fallbackUrl : ''
|
|
5278
5281
|
};
|
|
5279
|
-
}), catchError(() =>
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5282
|
+
}), catchError((err) => {
|
|
5283
|
+
console.error(`Signatur kunne ikke indlæses for ${layer.name}`, err);
|
|
5284
|
+
return of({
|
|
5285
|
+
...layer,
|
|
5286
|
+
imageUrl: '' // fallback failed, layer has no legend on Geoserver
|
|
5287
|
+
});
|
|
5288
|
+
}));
|
|
5283
5289
|
}
|
|
5284
5290
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: LegendsListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5285
5291
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.15", type: LegendsListComponent, isStandalone: true, selector: "lib-legends-list", inputs: { map: "map", profile: "profile" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"legends-list-body-wrapper global-wrapper-container\" \n cdkDrag \n cdkDragBoundary=\".map-container\" \n [cdkDragFreeDragPosition]=\"dragPosition\"\n (cdkDragEnded)=\"onDragEnded($event)\"\n [class.collapsed]=\"collapsed\">\n\n <div class=\"drag-handle-legends\" cdkDragHandle>\n <mat-icon \n class=\"legend-icon\" \n matTooltip=\"Signaturforklaring\" \n (click)=\"toggleLegendsList()\"\n [matTooltipShowDelay]=\"500\"\n [matTooltipHideDelay]=\"100\" \n matTooltipPosition=\"above\">\n area_chart\n </mat-icon>\n <div class=\"right-icons\">\n <mat-icon class=\"toggle-icon\" (click)=\"toggleLegendsList()\">\n {{ collapsed ? 'flip_to_front' : 'remove' }}\n </mat-icon>\n </div>\n</div>\n\n<div class=\"legends-list-container\">\n @if(!collapsed) {\n <div class=\"ol-unselectable ol-control legends-list-body\">\n <div class=\"item-list\">\n @for (layer of filteredLayersDetailed; track layer.id; let i = $index) {\n @if (layer.imageUrl) {\n <mat-expansion-panel [expanded]=\"i === 0\"> \n <mat-expansion-panel-header>\n <span class=\"panel-title\">\n {{ layer.name }}\n </span>\n </mat-expansion-panel-header>\n <div class=\"legend\">\n <img [src]=\"layer.imageUrl\" class=\"legend-thumbnail\"/>\n </div>\n </mat-expansion-panel>\n }\n }\n </div>\n </div>\n}\n</div>\n</div>", styles: [".legends-list-body-wrapper{position:absolute;top:0!important;left:0!important;margin:0!important;z-index:1000;box-shadow:0 2px 10px #0000001a;width:350px;box-sizing:border-box;transition:width .3s ease,max-width .3s ease;border-radius:5px}.legends-list-body-wrapper.collapsed .drag-handle-legends{box-sizing:border-box}.legends-list-body-wrapper.collapsed .drag-handle-legends .legend-icon{margin-right:0}.legends-list-body-wrapper.cdk-drag-dragging{opacity:.8;cursor:grabbing;z-index:1001}@media (max-width: 1024px){.legends-list-body-wrapper{width:240px;max-width:240px;min-width:240px}.legends-list-body-wrapper.collapsed{width:90px!important;max-width:90px!important;min-width:90px!important}}@media (max-width: 768px){.legends-list-body-wrapper{right:1em;width:calc(100% - 2em);max-width:350px;min-width:unset}.legends-list-body-wrapper.collapsed{width:90px!important;max-width:90px!important;min-width:90px!important;left:auto;right:1em}}@media (max-width: 480px){.legends-list-body-wrapper.collapsed{width:90px!important;max-width:90px!important;min-width:90px!important}}.drag-handle-legends .legend-icon{font-size:18px;cursor:default!important;transition:all .2s ease;display:flex;align-items:center;justify-content:center}.drag-handle-legends .toggle-icon{cursor:pointer!important;transition:all .2s ease;-webkit-user-select:none;user-select:none;font-size:18px!important;display:flex;align-items:center;justify-content:center;flex-shrink:0}.drag-handle-legends .toggle-icon:hover{color:#d3d3d3}.right-icons{display:flex;align-items:center;gap:10px}.legends-list-container{display:flex;flex-direction:column;align-items:center;width:100%;transition:all .3s ease;cursor:default;box-sizing:border-box}.panel-title{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}::ng-deep .legends-list-body{position:relative;left:auto;right:auto;bottom:auto;z-index:auto;width:100%;max-height:610px;min-height:80px;overflow:hidden;display:flex;flex-direction:column}@media (max-width: 1024px){::ng-deep .legends-list-body{max-height:450px;min-height:70px}}@media (max-width: 768px){::ng-deep .legends-list-body{max-height:60vh;max-height:calc(var(--vh, 1vh) * 60);min-height:100px}}@media (max-width: 480px){::ng-deep .legends-list-body{max-height:70vh;max-height:calc(var(--vh, 1vh) * 70);min-height:90px}}::ng-deep .legends-list-body .item-list{flex:1 1 auto;overflow-y:auto}@media (max-width: 768px){::ng-deep .legends-list-body .item-list{padding:6px;max-height:400px}}::ng-deep .legends-list-body .item-list mat-expansion-panel{border-radius:0!important;box-shadow:none!important;width:100%;background:transparent}::ng-deep .legends-list-body .item-list mat-expansion-panel.mat-expansion-panel{background:transparent}::ng-deep .legends-list-body .item-list mat-expansion-panel .mat-expansion-panel-header{box-sizing:border-box;width:100%;overflow:hidden}::ng-deep .legends-list-body .item-list mat-expansion-panel .mat-expansion-panel-header .mat-content{overflow:hidden;min-width:0}::ng-deep .legends-list-body .item-list mat-expansion-panel .mat-expansion-panel-body{padding:12px 16px;background:#0003}::ng-deep .legends-list-body .item-list .legend{overflow:hidden}::ng-deep .legends-list-body .item-list .legend span{color:#fff}.legend-thumbnail{width:100%;max-width:100%;height:auto;border:1px solid #dee2e6;display:block;border-radius:5px;box-sizing:border-box}@media (max-width: 768px){.legend-thumbnail{padding:3px}}::ng-deep .legends-list-body .item-list::-webkit-scrollbar{width:12px}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-track{background:#757474;border-radius:8px}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-thumb{background:#1a1c1f;border-radius:8px;border:2px solid #2a2c30}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-thumb:hover{background:#0f1012}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-button{width:12px;height:16px;background:#2a2c30;border:1px solid #1a1c1f}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-button:vertical:decrement{background:#2a2c30 url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 4l-4 4h8z'/%3E%3C/svg%3E\") no-repeat center;border-radius:8px 8px 0 0}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-button:vertical:decrement:hover{background-color:#1a1c1f}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-button:vertical:increment{background:#2a2c30 url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8l4-4H2z'/%3E%3C/svg%3E\") no-repeat center;border-radius:0 0 8px 8px}::ng-deep .legends-list-body .item-list::-webkit-scrollbar-button:vertical:increment:hover{background-color:#1a1c1f}::ng-deep .mat-expansion-indicator:after{color:#bdc1c3cc!important}::ng-deep .mat-expansion-panel-header.mat-expanded .mat-expansion-indicator:after{color:#fff!important}@media (max-width: 768px){.legends-list-body-wrapper{right:.5em;max-width:350px}}@media (max-width: 480px){.legends-list-body-wrapper{right:.5em;left:.5em;max-width:calc(100vw - 1em);width:auto}.legends-list-body-wrapper.collapsed{width:90px;left:auto}::ng-deep .legends-list-body .item-list{max-height:300px}}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i5.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i5.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: MatExpansionModule }, { kind: "component", type: i6.MatExpansionPanel, selector: "mat-expansion-panel", inputs: ["hideToggle", "togglePosition"], outputs: ["afterExpand", "afterCollapse"], exportAs: ["matExpansionPanel"] }, { kind: "component", type: i6.MatExpansionPanelHeader, selector: "mat-expansion-panel-header", inputs: ["expandedHeight", "collapsedHeight", "tabIndex"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i8.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] });
|
|
@@ -5887,16 +5893,14 @@ class LibErrorService {
|
|
|
5887
5893
|
_messages = [];
|
|
5888
5894
|
//Format errors from backend or UI
|
|
5889
5895
|
format(error) {
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
return error.message;
|
|
5899
|
-
return 'An unexpected error occurred.';
|
|
5896
|
+
return `Der er opstået en uventet fejl. Kontroller venligst din opsætning. Kontakt supporten, hvis problemet fortsætter`;
|
|
5897
|
+
// if (error instanceof HttpErrorResponse) {
|
|
5898
|
+
// if (error.error?.message) return error.error.message;
|
|
5899
|
+
// if (typeof error.error === 'string') return error.error;
|
|
5900
|
+
// return `Der er opstået en uventet fejl. Kontroller venligst din opsætning. Kontakt supporten, hvis problemet fortsætter`;
|
|
5901
|
+
// }
|
|
5902
|
+
// if (error instanceof Error) return error.message;
|
|
5903
|
+
// return 'An unexpected error occurred.';
|
|
5900
5904
|
}
|
|
5901
5905
|
// Log errors (for debugging or telemetry)
|
|
5902
5906
|
log(error) {
|
|
@@ -5933,9 +5937,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
|
|
|
5933
5937
|
const libErrorInterceptor = (req, next) => {
|
|
5934
5938
|
const errorService = inject(LibErrorService);
|
|
5935
5939
|
return next(req).pipe(catchError((error) => {
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5940
|
+
console.log("🚀 ~ libErrorInterceptor ~ req.headers.get('_noLogError'):", req.headers.get('_noLogError'));
|
|
5941
|
+
if (!req.headers.get('_noLogError')) {
|
|
5942
|
+
errorService.log(error);
|
|
5943
|
+
errorService.show(error);
|
|
5944
|
+
}
|
|
5945
|
+
return of(new HttpResponse({ body: '' }));
|
|
5946
|
+
// return throwError(() => error); // Let the component decide if needed
|
|
5939
5947
|
}));
|
|
5940
5948
|
};
|
|
5941
5949
|
|