adb-shared 22.0.0-beta.1 → 22.0.0-beta.3
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/fesm2022/adb-shared-map.mjs +115 -103
- package/fesm2022/adb-shared-map.mjs.map +1 -1
- package/fesm2022/adb-shared.mjs +89 -19
- package/fesm2022/adb-shared.mjs.map +1 -1
- package/package.json +5 -4
- package/redlist-colors.css +7 -0
- package/types/adb-shared-map.d.ts +20 -12
- package/types/adb-shared.d.ts +34 -8
|
@@ -14,6 +14,7 @@ import { fromLonLat, toLonLat, transformExtent } from "ol/proj.js";
|
|
|
14
14
|
import { getDistance } from "ol/sphere.js";
|
|
15
15
|
import Map from "ol/Map.js";
|
|
16
16
|
import View from "ol/View.js";
|
|
17
|
+
import { extend, getCenter, getForViewAndSize, isEmpty } from "ol/extent.js";
|
|
17
18
|
import TileLayer from "ol/layer/Tile.js";
|
|
18
19
|
import TileWMS from "ol/source/TileWMS.js";
|
|
19
20
|
import XYZ from "ol/source/XYZ.js";
|
|
@@ -27,7 +28,6 @@ import { TranslatePipe } from "@ngx-translate/core";
|
|
|
27
28
|
import * as i1 from "@angular/router";
|
|
28
29
|
import { NavigationEnd, RouterModule } from "@angular/router";
|
|
29
30
|
import Feature from "ol/Feature.js";
|
|
30
|
-
import { extend, getCenter, getForViewAndSize, isEmpty } from "ol/extent.js";
|
|
31
31
|
import { finalize } from "rxjs/operators";
|
|
32
32
|
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
33
33
|
import * as i2 from "@angular/common/http";
|
|
@@ -67,6 +67,82 @@ const MapConstants = {
|
|
|
67
67
|
HOVER_RADIUS: 10
|
|
68
68
|
};
|
|
69
69
|
var AdbMapUtils = class AdbMapUtils {
|
|
70
|
+
static INITIAL_METERS_PER_PIXEL = 500;
|
|
71
|
+
static INITIAL_CENTER_LAT = 62;
|
|
72
|
+
static INITIAL_CENTER_LNG = 17;
|
|
73
|
+
static OverlayMaps = {
|
|
74
|
+
"Altitude": AdbMapUtils.wms("https://maps.sgu.se/lmv/hojdmodell/v1.1?SERVICE=WMS", {
|
|
75
|
+
layers: "terrangskuggning",
|
|
76
|
+
format: "image/png",
|
|
77
|
+
transparent: true,
|
|
78
|
+
opacity: .3,
|
|
79
|
+
maxZoom: 16,
|
|
80
|
+
version: "1.3.0"
|
|
81
|
+
}),
|
|
82
|
+
"Fjällkarta": AdbMapUtils.wms("api/maps/mountain", {
|
|
83
|
+
minZoom: 6,
|
|
84
|
+
maxZoom: 18,
|
|
85
|
+
maxNativeZoom: 14,
|
|
86
|
+
attribution: "© <a href=\"https://www.lantmateriet.se/\">Fjällkart</a>",
|
|
87
|
+
wms: true
|
|
88
|
+
}),
|
|
89
|
+
"Kommuner": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
90
|
+
layers: "GeoRegion:Municipality",
|
|
91
|
+
version: "1.1.0",
|
|
92
|
+
transparent: true,
|
|
93
|
+
format: "image/png"
|
|
94
|
+
}),
|
|
95
|
+
"Län": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
96
|
+
layers: "GeoRegion:County",
|
|
97
|
+
version: "1.1.0",
|
|
98
|
+
transparent: true,
|
|
99
|
+
format: "image/png"
|
|
100
|
+
}),
|
|
101
|
+
"Ortnamn": AdbMapUtils.wms("https://maps.sgu.se/lmv/topowebb-skikt/v1.1?SERVICE=WMS", {
|
|
102
|
+
layers: "text",
|
|
103
|
+
format: "image/png",
|
|
104
|
+
transparent: true,
|
|
105
|
+
version: "1.3.0"
|
|
106
|
+
}),
|
|
107
|
+
"Ekonomisk zon": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms?", {
|
|
108
|
+
layers: "it.geosolutions:Ekonomiska_zonens_yttre_avgränsningslinjer_linje",
|
|
109
|
+
format: "image/png",
|
|
110
|
+
transparent: true,
|
|
111
|
+
version: "1.1.0"
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
static Providers = [{
|
|
115
|
+
name: "Open Streetmap",
|
|
116
|
+
id: 3,
|
|
117
|
+
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
118
|
+
minZoom: 0,
|
|
119
|
+
maxZoom: 18,
|
|
120
|
+
params: {
|
|
121
|
+
maxNativeZoom: 18,
|
|
122
|
+
attribution: "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
|
|
123
|
+
},
|
|
124
|
+
wms: false
|
|
125
|
+
}, {
|
|
126
|
+
name: "Sveriges gränser",
|
|
127
|
+
id: 7,
|
|
128
|
+
url: "https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms",
|
|
129
|
+
minZoom: 6,
|
|
130
|
+
maxZoom: 18,
|
|
131
|
+
params: {
|
|
132
|
+
maxNativeZoom: 14,
|
|
133
|
+
attribution: "© <a href=\"https://www.lantmateriet.se/\">Sveriges gränser</a>",
|
|
134
|
+
layers: "it.geosolutions:Sverige_epsg5845",
|
|
135
|
+
styles: "municipality_name_yellow",
|
|
136
|
+
epsg: 5845
|
|
137
|
+
},
|
|
138
|
+
wms: true
|
|
139
|
+
}];
|
|
140
|
+
static fitExtentIfReady(map, extent, options) {
|
|
141
|
+
const size = map.getSize();
|
|
142
|
+
if (!size?.[0] || !size[1] || !extent || isEmpty(extent)) return false;
|
|
143
|
+
map.getView().fit(extent, options);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
70
146
|
static locationSymbol(feature, selected = false, hovered = false) {
|
|
71
147
|
const props = feature.getProperties();
|
|
72
148
|
const cluster = props["groupingType"] === "pixelCluster" || props["isCluster"];
|
|
@@ -167,9 +243,16 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
167
243
|
const latitude = toLonLat(center)[1];
|
|
168
244
|
return new CircleGeometry(center, radius / Math.cos(latitude * Math.PI / 180));
|
|
169
245
|
}
|
|
170
|
-
static
|
|
171
|
-
|
|
172
|
-
|
|
246
|
+
static gridSymbol(observationCount, levels) {
|
|
247
|
+
const color = levels.find((level) => observationCount <= level.max)?.color ?? "#2FB3BB";
|
|
248
|
+
return new Style({
|
|
249
|
+
stroke: new Stroke({
|
|
250
|
+
color: "#212529",
|
|
251
|
+
width: 1
|
|
252
|
+
}),
|
|
253
|
+
fill: new Fill({ color })
|
|
254
|
+
});
|
|
255
|
+
}
|
|
173
256
|
static gridLevels(result) {
|
|
174
257
|
const counts = (result?.features ?? []).map((feature) => feature.properties?.ObservationsCount).filter((count) => typeof count === "number");
|
|
175
258
|
if (!counts.length) return [];
|
|
@@ -202,73 +285,6 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
202
285
|
}
|
|
203
286
|
return AdbMapUtils.INITIAL_METERS_PER_PIXEL;
|
|
204
287
|
}
|
|
205
|
-
static OverlayMaps = {
|
|
206
|
-
"Altitude": AdbMapUtils.wms("https://maps.sgu.se/lmv/hojdmodell/v1.1?SERVICE=WMS", {
|
|
207
|
-
layers: "terrangskuggning",
|
|
208
|
-
format: "image/png",
|
|
209
|
-
transparent: true,
|
|
210
|
-
opacity: .3,
|
|
211
|
-
maxZoom: 16,
|
|
212
|
-
version: "1.3.0"
|
|
213
|
-
}),
|
|
214
|
-
"Fjällkarta": AdbMapUtils.wms("api/maps/mountain", {
|
|
215
|
-
minZoom: 6,
|
|
216
|
-
maxZoom: 18,
|
|
217
|
-
maxNativeZoom: 14,
|
|
218
|
-
attribution: "© <a href=\"https://www.lantmateriet.se/\">Fjällkart</a>",
|
|
219
|
-
wms: true
|
|
220
|
-
}),
|
|
221
|
-
"Kommuner": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
222
|
-
layers: "GeoRegion:Municipality",
|
|
223
|
-
version: "1.1.0",
|
|
224
|
-
transparent: true,
|
|
225
|
-
format: "image/png"
|
|
226
|
-
}),
|
|
227
|
-
"Län": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/GeoRegion/wms?", {
|
|
228
|
-
layers: "GeoRegion:County",
|
|
229
|
-
version: "1.1.0",
|
|
230
|
-
transparent: true,
|
|
231
|
-
format: "image/png"
|
|
232
|
-
}),
|
|
233
|
-
"Ortnamn": AdbMapUtils.wms("https://maps.sgu.se/lmv/topowebb-skikt/v1.1?SERVICE=WMS", {
|
|
234
|
-
layers: "text",
|
|
235
|
-
format: "image/png",
|
|
236
|
-
transparent: true,
|
|
237
|
-
version: "1.3.0"
|
|
238
|
-
}),
|
|
239
|
-
"Ekonomisk zon": AdbMapUtils.wms("https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms?", {
|
|
240
|
-
layers: "it.geosolutions:Ekonomiska_zonens_yttre_avgränsningslinjer_linje",
|
|
241
|
-
format: "image/png",
|
|
242
|
-
transparent: true,
|
|
243
|
-
version: "1.1.0"
|
|
244
|
-
})
|
|
245
|
-
};
|
|
246
|
-
static Providers = [{
|
|
247
|
-
name: "Open Streetmap",
|
|
248
|
-
id: 3,
|
|
249
|
-
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
250
|
-
minZoom: 0,
|
|
251
|
-
maxZoom: 18,
|
|
252
|
-
params: {
|
|
253
|
-
maxNativeZoom: 18,
|
|
254
|
-
attribution: "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
|
|
255
|
-
},
|
|
256
|
-
wms: false
|
|
257
|
-
}, {
|
|
258
|
-
name: "Sveriges gränser",
|
|
259
|
-
id: 7,
|
|
260
|
-
url: "https://sosgeo.artdata.slu.se/geoserver/it.geosolutions/wms",
|
|
261
|
-
minZoom: 6,
|
|
262
|
-
maxZoom: 18,
|
|
263
|
-
params: {
|
|
264
|
-
maxNativeZoom: 14,
|
|
265
|
-
attribution: "© <a href=\"https://www.lantmateriet.se/\">Sveriges gränser</a>",
|
|
266
|
-
layers: "it.geosolutions:Sverige_epsg5845",
|
|
267
|
-
styles: "municipality_name_yellow",
|
|
268
|
-
epsg: 5845
|
|
269
|
-
},
|
|
270
|
-
wms: true
|
|
271
|
-
}];
|
|
272
288
|
static wms(url, options) {
|
|
273
289
|
const { opacity = 1, attribution, minZoom, maxZoom, maxNativeZoom, epsg, wms, ...parameters } = options;
|
|
274
290
|
const params = Object.fromEntries(Object.entries(parameters).map(([key, value]) => [key.toUpperCase(), value]));
|
|
@@ -364,9 +380,9 @@ var AdbMapUtils = class AdbMapUtils {
|
|
|
364
380
|
var PolygonDrawerInput = class PolygonDrawerInput {
|
|
365
381
|
mapId = "draw-" + Math.floor(Math.random() * Date.now());
|
|
366
382
|
map;
|
|
367
|
-
polygonDraw = false;
|
|
383
|
+
polygonDraw = signal(false, ...ngDevMode ? [{ debugName: "polygonDraw" }] : /* istanbul ignore next */ []);
|
|
368
384
|
disabled = false;
|
|
369
|
-
shapeLayer = false;
|
|
385
|
+
shapeLayer = signal(false, ...ngDevMode ? [{ debugName: "shapeLayer" }] : /* istanbul ignore next */ []);
|
|
370
386
|
source = new VectorSource();
|
|
371
387
|
format = new GeoJSON();
|
|
372
388
|
draw;
|
|
@@ -398,7 +414,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
398
414
|
startDraw(type) {
|
|
399
415
|
if (this.disabled) return;
|
|
400
416
|
this.stopDraw();
|
|
401
|
-
this.polygonDraw
|
|
417
|
+
this.polygonDraw.set(true);
|
|
402
418
|
this.draw = new Draw({
|
|
403
419
|
source: this.source,
|
|
404
420
|
type
|
|
@@ -420,7 +436,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
420
436
|
};
|
|
421
437
|
} else geo = this.format.writeFeatureObject(event.feature, options);
|
|
422
438
|
this.geoJson = geo;
|
|
423
|
-
this.shapeLayer
|
|
439
|
+
this.shapeLayer.set(true);
|
|
424
440
|
this.onChange(geo);
|
|
425
441
|
this.onTouched();
|
|
426
442
|
this.stopDraw();
|
|
@@ -429,7 +445,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
429
445
|
stopDraw() {
|
|
430
446
|
if (this.draw) this.map.removeInteraction(this.draw);
|
|
431
447
|
this.draw = void 0;
|
|
432
|
-
this.polygonDraw
|
|
448
|
+
this.polygonDraw.set(false);
|
|
433
449
|
}
|
|
434
450
|
onUndoStep() {
|
|
435
451
|
this.draw?.removeLastPoint();
|
|
@@ -439,7 +455,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
439
455
|
this.stopDraw();
|
|
440
456
|
this.source.clear();
|
|
441
457
|
this.pendingFit = false;
|
|
442
|
-
this.shapeLayer
|
|
458
|
+
this.shapeLayer.set(false);
|
|
443
459
|
this.geoJson = null;
|
|
444
460
|
this.onChange(null);
|
|
445
461
|
this.onTouched();
|
|
@@ -450,7 +466,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
450
466
|
if (!this.map) return;
|
|
451
467
|
this.source.clear();
|
|
452
468
|
this.pendingFit = false;
|
|
453
|
-
this.shapeLayer
|
|
469
|
+
this.shapeLayer.set(false);
|
|
454
470
|
if (this.geoJson?.type !== "Feature") return;
|
|
455
471
|
const feature = this.format.readFeatures(this.geoJson, { featureProjection: this.map.getView().getProjection() })[0];
|
|
456
472
|
if (this.geoJson.geometry.type === "Point" && this.geoJson.properties?.radius) {
|
|
@@ -458,14 +474,13 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
458
474
|
feature.setGeometry(new CircleGeometry(fromLonLat(this.geoJson.geometry.coordinates), this.geoJson.properties.radius / Math.cos(latitude * Math.PI / 180)));
|
|
459
475
|
}
|
|
460
476
|
this.source.addFeature(feature);
|
|
461
|
-
this.shapeLayer
|
|
477
|
+
this.shapeLayer.set(true);
|
|
462
478
|
this.pendingFit = true;
|
|
463
479
|
this.fitShape();
|
|
464
480
|
}
|
|
465
481
|
fitShape() {
|
|
466
|
-
|
|
467
|
-
if (!this.
|
|
468
|
-
this.map.getView().fit(this.source.getExtent(), {
|
|
482
|
+
if (!this.pendingFit) return;
|
|
483
|
+
if (!AdbMapUtils.fitExtentIfReady(this.map, this.source.getExtent(), {
|
|
469
484
|
padding: [
|
|
470
485
|
20,
|
|
471
486
|
20,
|
|
@@ -473,7 +488,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
473
488
|
20
|
|
474
489
|
],
|
|
475
490
|
maxZoom: 18
|
|
476
|
-
});
|
|
491
|
+
})) return;
|
|
477
492
|
this.pendingFit = false;
|
|
478
493
|
}
|
|
479
494
|
writeValue(value) {
|
|
@@ -514,7 +529,7 @@ var PolygonDrawerInput = class PolygonDrawerInput {
|
|
|
514
529
|
multi: true
|
|
515
530
|
}],
|
|
516
531
|
ngImport: i0,
|
|
517
|
-
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>",
|
|
532
|
+
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>",
|
|
518
533
|
dependencies: [{
|
|
519
534
|
kind: "pipe",
|
|
520
535
|
type: i1$3.TranslatePipe,
|
|
@@ -539,7 +554,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
539
554
|
useExisting: forwardRef(() => PolygonDrawerInput),
|
|
540
555
|
multi: true
|
|
541
556
|
}],
|
|
542
|
-
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>"
|
|
557
|
+
template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\n <span class=\"bi bi-pentagon\"></span> {{'OBSERVATION.DRAW'|translate}}\n </button>\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled || shapeLayer()\" (click)=\"onDrawCircle()\" title=\"Circle\">\n <span class=\"bi bi-circle\"></span> {{'OBSERVATION.DRAW_CIRCLE'|translate}}\n </button>\n @if (shapeLayer()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\n <span class=\"bi bi-x\"></span>\n </button>\n }\n @if (polygonDraw()) {\n <button class=\"btn btn-secondary\" type=\"button\" [disabled]=\"disabled\" (click)=\"onUndoStep()\" title=\"Ångra\">\n <span class=\"bi bi-arrow-counterclockwise\"></span>\n </button>\n }\n</div>\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>"
|
|
543
558
|
}]
|
|
544
559
|
}]
|
|
545
560
|
});
|
|
@@ -1332,9 +1347,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1332
1347
|
return [...this.map.getView().getCenter(), this.map.getView().getResolution()].join(",");
|
|
1333
1348
|
}
|
|
1334
1349
|
fitPendingExtent() {
|
|
1335
|
-
|
|
1336
|
-
if (!this.pendingExtent || !size?.[0] || !size[1]) return;
|
|
1337
|
-
this.map.getView().fit(this.pendingExtent, {
|
|
1350
|
+
if (!AdbMapUtils.fitExtentIfReady(this.map, this.pendingExtent, {
|
|
1338
1351
|
padding: [
|
|
1339
1352
|
20,
|
|
1340
1353
|
20,
|
|
@@ -1342,7 +1355,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1342
1355
|
20
|
|
1343
1356
|
],
|
|
1344
1357
|
maxZoom: 18
|
|
1345
|
-
});
|
|
1358
|
+
})) return;
|
|
1346
1359
|
this.fittedView = this.viewKey();
|
|
1347
1360
|
this.pendingExtent = void 0;
|
|
1348
1361
|
}
|
|
@@ -1366,14 +1379,7 @@ var AdbMapComponent = class AdbMapComponent {
|
|
|
1366
1379
|
}),
|
|
1367
1380
|
fill: new Fill({ color: "rgba(0,118,129,0.1)" })
|
|
1368
1381
|
});
|
|
1369
|
-
|
|
1370
|
-
return new Style({
|
|
1371
|
-
stroke: new Stroke({
|
|
1372
|
-
color: "#212529",
|
|
1373
|
-
width: 1
|
|
1374
|
-
}),
|
|
1375
|
-
fill: new Fill({ color })
|
|
1376
|
-
});
|
|
1382
|
+
return AdbMapUtils.gridSymbol(props["ObservationsCount"], this.gridLevels());
|
|
1377
1383
|
}
|
|
1378
1384
|
locationSymbol(feature) {
|
|
1379
1385
|
return AdbMapUtils.locationSymbol(feature, feature === this.selectedFeature, feature === this.hoveredFeature);
|
|
@@ -1668,9 +1674,7 @@ var AdbLocationMapComponent = class AdbLocationMapComponent {
|
|
|
1668
1674
|
}
|
|
1669
1675
|
}
|
|
1670
1676
|
fitPendingExtent() {
|
|
1671
|
-
|
|
1672
|
-
if (!this.pendingExtent || !size?.[0] || !size[1]) return;
|
|
1673
|
-
this.map.getView().fit(this.pendingExtent, {
|
|
1677
|
+
if (!AdbMapUtils.fitExtentIfReady(this.map, this.pendingExtent, {
|
|
1674
1678
|
padding: [
|
|
1675
1679
|
20,
|
|
1676
1680
|
20,
|
|
@@ -1678,7 +1682,7 @@ var AdbLocationMapComponent = class AdbLocationMapComponent {
|
|
|
1678
1682
|
20
|
|
1679
1683
|
],
|
|
1680
1684
|
maxZoom: 18
|
|
1681
|
-
});
|
|
1685
|
+
})) return;
|
|
1682
1686
|
this.pendingExtent = null;
|
|
1683
1687
|
}
|
|
1684
1688
|
ngOnDestroy() {
|
|
@@ -1761,6 +1765,8 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1761
1765
|
];
|
|
1762
1766
|
subscriptions = new Subscription();
|
|
1763
1767
|
form;
|
|
1768
|
+
canFilter = signal(false, ...ngDevMode ? [{ debugName: "canFilter" }] : /* istanbul ignore next */ []);
|
|
1769
|
+
formEvents;
|
|
1764
1770
|
thisYear = /* @__PURE__ */ new Date();
|
|
1765
1771
|
lastYear = addYears(/* @__PURE__ */ new Date(), -1);
|
|
1766
1772
|
queryParamsMap;
|
|
@@ -1801,7 +1807,12 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1801
1807
|
lists: results[2]
|
|
1802
1808
|
})), debounceTime(0));
|
|
1803
1809
|
this.subscriptions.add(combined$.subscribe((result) => {
|
|
1810
|
+
this.formEvents?.unsubscribe();
|
|
1804
1811
|
this.form = this.createForm(result.params, result.qParams, result.lists);
|
|
1812
|
+
this.canFilter.set(false);
|
|
1813
|
+
this.formEvents = this.form.events.subscribe(() => {
|
|
1814
|
+
this.canFilter.set(!this.form.invalid && this.form.dirty);
|
|
1815
|
+
});
|
|
1805
1816
|
this.cdr.markForCheck();
|
|
1806
1817
|
}));
|
|
1807
1818
|
}
|
|
@@ -1924,6 +1935,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1924
1935
|
}
|
|
1925
1936
|
}
|
|
1926
1937
|
ngOnDestroy() {
|
|
1938
|
+
this.formEvents?.unsubscribe();
|
|
1927
1939
|
this.subscriptions.unsubscribe();
|
|
1928
1940
|
}
|
|
1929
1941
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
@@ -1963,7 +1975,7 @@ var AdbMapFilters = class AdbMapFilters {
|
|
|
1963
1975
|
}
|
|
1964
1976
|
},
|
|
1965
1977
|
ngImport: i0,
|
|
1966
|
-
template: "@if(form){\n<form [formGroup]=\"form\" class=\"form mb-3\" (ngSubmit)=\"onSubmit()\">\n <div class=\"mb-3\">\n @if(visibleFilters().taxon){\n <adb-filter-section titleResource=\"TAXON.TAXA\" [expanded]=\"true\">\n @if(!hasTaxonInUrlParameter){\n <div class=\"mb-3\">\n <label for=\"species\">{{'TAXON.TAXON'|translate}}</label>\n <adb-taxon-picker formControlName=\"taxonId\" id=\"species\"></adb-taxon-picker>\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().time){\n <adb-filter-section [count]=\"periodCount\" titleResource=\"OBSERVATION.PERIOD\">\n <div class=\"mb-1\">\n <select class=\"form-select\" formControlName=\"period\" id=\"period\">\n <option value=\"1\">{{thisYear|date:'yyyy'}}</option>\n <option value=\"2\">{{lastYear|date:'yyyy'}}</option>\n <option value=\"3\">{{'OBSERVATION.ALL_YEAR'|translate}}</option>\n <option value=\"4\">{{'OBSERVATION.LAST_5_YEAR'|translate}}</option>\n <option value=\"5\">{{'OBSERVATION.LAST_25_YEAR'|translate}}</option>\n <option value=\"6\">{{'OBSERVATION.CUSTOMIZED'|translate}}</option>\n </select>\n </div>\n @if (form.value?.period==='6') {\n <div class=\"mb-2\">\n <label for=\"startAt\">{{'FROM' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"startAt\" formControlName=\"startAt\" [settings]=\"dateStartConfig\">\n </div>\n <div class=\"mb-2\">\n <label for=\"endAt\">{{'TO' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"endAt\" formControlName=\"endAt\" [settings]=\"dateEndConfig\">\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().area){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().ownArea){\n <div role=\"tablist\" aria-label=\"{{'AREA'|translate}}\" class=\"d-flex gap-2 justify-content-end\">\n <button class=\"btn btn-link p-0\" [class.text-dark]=\"!hasOwnArea\" (click)=\"hasOwnArea=false\" role=\"tab\" id=\"tab-select\" aria-selected=\"{{!hasOwnArea}}\" aria-controls=\"
|
|
1978
|
+
template: "@if(form){\n<form [formGroup]=\"form\" class=\"form mb-3\" (ngSubmit)=\"onSubmit()\">\n <div class=\"mb-3\">\n @if(visibleFilters().taxon){\n <adb-filter-section titleResource=\"TAXON.TAXA\" [expanded]=\"true\">\n @if(!hasTaxonInUrlParameter){\n <div class=\"mb-3\">\n <label for=\"species\">{{'TAXON.TAXON'|translate}}</label>\n <adb-taxon-picker formControlName=\"taxonId\" id=\"species\"></adb-taxon-picker>\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().time){\n <adb-filter-section [count]=\"periodCount\" titleResource=\"OBSERVATION.PERIOD\">\n <div class=\"mb-1\">\n <select class=\"form-select\" formControlName=\"period\" id=\"period\">\n <option value=\"1\">{{thisYear|date:'yyyy'}}</option>\n <option value=\"2\">{{lastYear|date:'yyyy'}}</option>\n <option value=\"3\">{{'OBSERVATION.ALL_YEAR'|translate}}</option>\n <option value=\"4\">{{'OBSERVATION.LAST_5_YEAR'|translate}}</option>\n <option value=\"5\">{{'OBSERVATION.LAST_25_YEAR'|translate}}</option>\n <option value=\"6\">{{'OBSERVATION.CUSTOMIZED'|translate}}</option>\n </select>\n </div>\n @if (form.value?.period==='6') {\n <div class=\"mb-2\">\n <label for=\"startAt\">{{'FROM' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"startAt\" formControlName=\"startAt\" [settings]=\"dateStartConfig\">\n </div>\n <div class=\"mb-2\">\n <label for=\"endAt\">{{'TO' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"endAt\" formControlName=\"endAt\" [settings]=\"dateEndConfig\">\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().area){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().ownArea){\n <div role=\"tablist\" aria-label=\"{{'AREA'|translate}}\" class=\"d-flex gap-2 justify-content-end\">\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"!hasOwnArea\" (click)=\"hasOwnArea=false\" role=\"tab\" id=\"tab-select\" aria-selected=\"{{!hasOwnArea}}\" aria-controls=\"area-select\">\n {{'CHOOSE'|translate}}\n </button>\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"hasOwnArea\" (click)=\"hasOwnArea=true\" role=\"tab\" id=\"tab-draw\" aria-selected=\"{{hasOwnArea}}\" aria-controls=\"area-draw\">\n {{'OWN_AREA'|translate}}\n </button>\n </div>\n }\n <div class=\"mb-2\">\n @if(hasOwnArea&&visibleFilters().ownArea){\n <div class=\"pt-1\" role=\"tabpanel\" id=\"area-draw\" aria-labelledby=\"tab-draw\">\n <div>\n <adb-polygon-drawer formControlName=\"geo\"></adb-polygon-drawer>\n </div>\n </div>\n }@else{\n <div role=\"tabpanel\" id=\"area-select\" aria-labelledby=\"tab-select\">\n <div formArrayName=\"areas\">\n <div class=\"d-flex align-items-end mb-1\">\n <label>{{'AREAS'|translate}}</label>\n <button class=\"ms-auto text-dark btn btn-sm btn-secondary\" attr.aria-label=\"{{'OBSERVATION.ADD_AREA'|translate}}\" title=\"{{'OBSERVATION.ADD_AREA'|translate}}\" type=\"button\" (click)=\"addArea()\">\n <span class=\"bi bi-plus\"></span>\n </button>\n </div>\n @for (ctrl of areasArray.controls; track ctrl; let i = $index; let last = $last) {\n <div class=\"d-flex mb-2\">\n <adb-area-picker id=\"area-{{i}}\" [formControlName]=\"i\"></adb-area-picker>\n @if(areasArray.length>1){\n <button class=\"btn btn-secondary ms-1\" attr.aria-label=\"{{'DELETE'|translate}}\" title=\"{{'DELETE'|translate}}\" type=\"button\" (click)=\"removeArea(i)\">\n <span class=\"bi bi-trash\"></span>\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n </ng-template>\n </adb-filter-section>\n }\n @if(form.get('taxonId')){\n @if(visibleFilters().taxaLists){\n <adb-filter-section [count]=\"taxonListCount\" titleResource=\"LISTS.NATURE_CONSERVATION_LISTS\">\n <div class=\"mb-3\">\n <app-treeview formControlName=\"list\" [nodes]=\"taxaLists\"></app-treeview>\n </div>\n {{'LISTS.READ_MORE'|translate}}\n <a [href]=\"artfakta\">{{'LISTS.LIST_CONTENT'|translate}}</a>\n </adb-filter-section>\n }\n @if(visibleFilters().datasources){\n <adb-filter-section [count]=\"dataSetCount\" titleResource=\"DATASET.DATASETS\">\n @if (form.get('ds')) {\n <div formArrayName=\"ds\">\n @for (item of dsControls; track item; let i = $index) {\n <div [formGroupName]=\"i\" class=\"form-check\">\n <input type=\"checkbox\" formControlName=\"selected\" [id]=\"'ds-' + item.value.id\" class=\"form-check-input\">\n <label [for]=\"'ds-' + item.value.id\" class=\"form-check-label\">{{ 'PROVIDERS.'+item.value.id |translate }}</label>\n </div>\n }\n </div>\n }\n </adb-filter-section>\n }\n }\n </div>\n <div class=\"d-flex justify-content-end gap-2\">\n @if (inline) {\n <a class=\"btn btn-secondary\" [routerLink]=\"[]\">\n {{'CANCEL'|translate}}\n </a>\n }\n <a [routerLink]=\"[]\" class=\"btn btn-secondary\" [queryParams]=\"null\">\n {{'CLEAR'|translate}}\n </a>\n <button type=\"submit\" class=\"btn btn-primary\" [disabled]=\"!canFilter()\">{{'FILTER'|translate}}</button>\n </div>\n</form>\n}\n",
|
|
1967
1979
|
dependencies: [
|
|
1968
1980
|
{
|
|
1969
1981
|
kind: "directive",
|
|
@@ -2138,7 +2150,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2138
2150
|
selector: "adb-map-filters",
|
|
2139
2151
|
changeDetection: ChangeDetectionStrategy.Eager,
|
|
2140
2152
|
standalone: false,
|
|
2141
|
-
template: "@if(form){\n<form [formGroup]=\"form\" class=\"form mb-3\" (ngSubmit)=\"onSubmit()\">\n <div class=\"mb-3\">\n @if(visibleFilters().taxon){\n <adb-filter-section titleResource=\"TAXON.TAXA\" [expanded]=\"true\">\n @if(!hasTaxonInUrlParameter){\n <div class=\"mb-3\">\n <label for=\"species\">{{'TAXON.TAXON'|translate}}</label>\n <adb-taxon-picker formControlName=\"taxonId\" id=\"species\"></adb-taxon-picker>\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().time){\n <adb-filter-section [count]=\"periodCount\" titleResource=\"OBSERVATION.PERIOD\">\n <div class=\"mb-1\">\n <select class=\"form-select\" formControlName=\"period\" id=\"period\">\n <option value=\"1\">{{thisYear|date:'yyyy'}}</option>\n <option value=\"2\">{{lastYear|date:'yyyy'}}</option>\n <option value=\"3\">{{'OBSERVATION.ALL_YEAR'|translate}}</option>\n <option value=\"4\">{{'OBSERVATION.LAST_5_YEAR'|translate}}</option>\n <option value=\"5\">{{'OBSERVATION.LAST_25_YEAR'|translate}}</option>\n <option value=\"6\">{{'OBSERVATION.CUSTOMIZED'|translate}}</option>\n </select>\n </div>\n @if (form.value?.period==='6') {\n <div class=\"mb-2\">\n <label for=\"startAt\">{{'FROM' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"startAt\" formControlName=\"startAt\" [settings]=\"dateStartConfig\">\n </div>\n <div class=\"mb-2\">\n <label for=\"endAt\">{{'TO' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"endAt\" formControlName=\"endAt\" [settings]=\"dateEndConfig\">\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().area){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().ownArea){\n <div role=\"tablist\" aria-label=\"{{'AREA'|translate}}\" class=\"d-flex gap-2 justify-content-end\">\n <button class=\"btn btn-link p-0\" [class.text-dark]=\"!hasOwnArea\" (click)=\"hasOwnArea=false\" role=\"tab\" id=\"tab-select\" aria-selected=\"{{!hasOwnArea}}\" aria-controls=\"
|
|
2153
|
+
template: "@if(form){\n<form [formGroup]=\"form\" class=\"form mb-3\" (ngSubmit)=\"onSubmit()\">\n <div class=\"mb-3\">\n @if(visibleFilters().taxon){\n <adb-filter-section titleResource=\"TAXON.TAXA\" [expanded]=\"true\">\n @if(!hasTaxonInUrlParameter){\n <div class=\"mb-3\">\n <label for=\"species\">{{'TAXON.TAXON'|translate}}</label>\n <adb-taxon-picker formControlName=\"taxonId\" id=\"species\"></adb-taxon-picker>\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().time){\n <adb-filter-section [count]=\"periodCount\" titleResource=\"OBSERVATION.PERIOD\">\n <div class=\"mb-1\">\n <select class=\"form-select\" formControlName=\"period\" id=\"period\">\n <option value=\"1\">{{thisYear|date:'yyyy'}}</option>\n <option value=\"2\">{{lastYear|date:'yyyy'}}</option>\n <option value=\"3\">{{'OBSERVATION.ALL_YEAR'|translate}}</option>\n <option value=\"4\">{{'OBSERVATION.LAST_5_YEAR'|translate}}</option>\n <option value=\"5\">{{'OBSERVATION.LAST_25_YEAR'|translate}}</option>\n <option value=\"6\">{{'OBSERVATION.CUSTOMIZED'|translate}}</option>\n </select>\n </div>\n @if (form.value?.period==='6') {\n <div class=\"mb-2\">\n <label for=\"startAt\">{{'FROM' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"startAt\" formControlName=\"startAt\" [settings]=\"dateStartConfig\">\n </div>\n <div class=\"mb-2\">\n <label for=\"endAt\">{{'TO' |translate}}</label>\n <input adbDatepicker type=\"text\" class=\"form-control datepicker\" id=\"endAt\" formControlName=\"endAt\" [settings]=\"dateEndConfig\">\n </div>\n }\n </adb-filter-section>\n }\n @if(visibleFilters().area){\n <adb-filter-section [count]=\"areaCount\" titleResource=\"GEOGRAPHY\" [lazy]=\"true\">\n <ng-template>\n @if(visibleFilters().ownArea){\n <div role=\"tablist\" aria-label=\"{{'AREA'|translate}}\" class=\"d-flex gap-2 justify-content-end\">\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"!hasOwnArea\" (click)=\"hasOwnArea=false\" role=\"tab\" id=\"tab-select\" aria-selected=\"{{!hasOwnArea}}\" aria-controls=\"area-select\">\n {{'CHOOSE'|translate}}\n </button>\n <button type=\"button\" class=\"btn btn-link p-0\" [class.text-dark]=\"hasOwnArea\" (click)=\"hasOwnArea=true\" role=\"tab\" id=\"tab-draw\" aria-selected=\"{{hasOwnArea}}\" aria-controls=\"area-draw\">\n {{'OWN_AREA'|translate}}\n </button>\n </div>\n }\n <div class=\"mb-2\">\n @if(hasOwnArea&&visibleFilters().ownArea){\n <div class=\"pt-1\" role=\"tabpanel\" id=\"area-draw\" aria-labelledby=\"tab-draw\">\n <div>\n <adb-polygon-drawer formControlName=\"geo\"></adb-polygon-drawer>\n </div>\n </div>\n }@else{\n <div role=\"tabpanel\" id=\"area-select\" aria-labelledby=\"tab-select\">\n <div formArrayName=\"areas\">\n <div class=\"d-flex align-items-end mb-1\">\n <label>{{'AREAS'|translate}}</label>\n <button class=\"ms-auto text-dark btn btn-sm btn-secondary\" attr.aria-label=\"{{'OBSERVATION.ADD_AREA'|translate}}\" title=\"{{'OBSERVATION.ADD_AREA'|translate}}\" type=\"button\" (click)=\"addArea()\">\n <span class=\"bi bi-plus\"></span>\n </button>\n </div>\n @for (ctrl of areasArray.controls; track ctrl; let i = $index; let last = $last) {\n <div class=\"d-flex mb-2\">\n <adb-area-picker id=\"area-{{i}}\" [formControlName]=\"i\"></adb-area-picker>\n @if(areasArray.length>1){\n <button class=\"btn btn-secondary ms-1\" attr.aria-label=\"{{'DELETE'|translate}}\" title=\"{{'DELETE'|translate}}\" type=\"button\" (click)=\"removeArea(i)\">\n <span class=\"bi bi-trash\"></span>\n </button>\n }\n </div>\n }\n </div>\n </div>\n }\n </div>\n </ng-template>\n </adb-filter-section>\n }\n @if(form.get('taxonId')){\n @if(visibleFilters().taxaLists){\n <adb-filter-section [count]=\"taxonListCount\" titleResource=\"LISTS.NATURE_CONSERVATION_LISTS\">\n <div class=\"mb-3\">\n <app-treeview formControlName=\"list\" [nodes]=\"taxaLists\"></app-treeview>\n </div>\n {{'LISTS.READ_MORE'|translate}}\n <a [href]=\"artfakta\">{{'LISTS.LIST_CONTENT'|translate}}</a>\n </adb-filter-section>\n }\n @if(visibleFilters().datasources){\n <adb-filter-section [count]=\"dataSetCount\" titleResource=\"DATASET.DATASETS\">\n @if (form.get('ds')) {\n <div formArrayName=\"ds\">\n @for (item of dsControls; track item; let i = $index) {\n <div [formGroupName]=\"i\" class=\"form-check\">\n <input type=\"checkbox\" formControlName=\"selected\" [id]=\"'ds-' + item.value.id\" class=\"form-check-input\">\n <label [for]=\"'ds-' + item.value.id\" class=\"form-check-label\">{{ 'PROVIDERS.'+item.value.id |translate }}</label>\n </div>\n }\n </div>\n }\n </adb-filter-section>\n }\n }\n </div>\n <div class=\"d-flex justify-content-end gap-2\">\n @if (inline) {\n <a class=\"btn btn-secondary\" [routerLink]=\"[]\">\n {{'CANCEL'|translate}}\n </a>\n }\n <a [routerLink]=\"[]\" class=\"btn btn-secondary\" [queryParams]=\"null\">\n {{'CLEAR'|translate}}\n </a>\n <button type=\"submit\" class=\"btn btn-primary\" [disabled]=\"!canFilter()\">{{'FILTER'|translate}}</button>\n </div>\n</form>\n}\n"
|
|
2142
2154
|
}]
|
|
2143
2155
|
}],
|
|
2144
2156
|
ctorParameters: () => [
|