adb-shared 6.2.5 → 6.2.6
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.mjs +35 -32
- package/fesm2022/adb-shared.mjs.map +1 -1
- package/package.json +2 -3
- package/types/adb-shared.d.ts +2 -5
package/fesm2022/adb-shared.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import * as i4 from '@angular/forms';
|
|
|
14
14
|
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule, FormControl, FormGroup, FormArray, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
15
15
|
import { delay, debounceTime, switchMap, map, catchError as catchError$1, finalize } from 'rxjs/operators';
|
|
16
16
|
import * as Leaflet from 'leaflet';
|
|
17
|
-
import 'leaflet
|
|
17
|
+
import 'leaflet.pm';
|
|
18
18
|
|
|
19
19
|
class EnvironmentService {
|
|
20
20
|
constructor(environment) {
|
|
@@ -2951,6 +2951,7 @@ class PolygonDrawerInput {
|
|
|
2951
2951
|
this.subscriptions = new Subscription();
|
|
2952
2952
|
this.mapId = "" + Math.floor(Math.random() * Date.now());
|
|
2953
2953
|
this.polygonDraw = false;
|
|
2954
|
+
this.shapeLayer = null;
|
|
2954
2955
|
// ControlValueAccessor
|
|
2955
2956
|
this.onChange = () => { };
|
|
2956
2957
|
this.onTouched = () => { };
|
|
@@ -2971,29 +2972,33 @@ class PolygonDrawerInput {
|
|
|
2971
2972
|
this.subscriptions.unsubscribe();
|
|
2972
2973
|
}
|
|
2973
2974
|
initDraw() {
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
this.map.on("
|
|
2982
|
-
if (
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2975
|
+
this.map.pm.removeControls();
|
|
2976
|
+
this.map.pm.enableDraw('Polygon', {
|
|
2977
|
+
tooltips: false,
|
|
2978
|
+
finishOn: 'snap',
|
|
2979
|
+
snapDistance: 25,
|
|
2980
|
+
snapMiddle: false
|
|
2981
|
+
});
|
|
2982
|
+
this.map.on("pm:create", (e) => {
|
|
2983
|
+
if (e.shape !== "Polygon")
|
|
2984
|
+
return;
|
|
2985
|
+
this.polygonDraw = false;
|
|
2986
|
+
this.map.pm.disableDraw();
|
|
2987
|
+
this.clearShape();
|
|
2988
|
+
this.shapeLayer = Leaflet.geoJSON(e.layer.toGeoJSON(), {
|
|
2989
|
+
interactive: false
|
|
2990
|
+
});
|
|
2991
|
+
this.map.addLayer(this.shapeLayer);
|
|
2992
|
+
this.map.fitBounds(this.shapeLayer.getBounds());
|
|
2993
|
+
this.onChange(e.layer.toGeoJSON());
|
|
2994
|
+
this.map.removeLayer(e.layer);
|
|
2991
2995
|
});
|
|
2992
2996
|
}
|
|
2993
2997
|
renderInitialShape() {
|
|
2994
2998
|
if (this.geoJson?.type === "Feature") {
|
|
2995
|
-
this.shapeLayer = Leaflet.
|
|
2996
|
-
|
|
2999
|
+
this.shapeLayer = Leaflet.geoJSON(this.geoJson, {
|
|
3000
|
+
interactive: false
|
|
3001
|
+
});
|
|
2997
3002
|
this.map.addLayer(this.shapeLayer);
|
|
2998
3003
|
this.map.fitBounds(this.shapeLayer.getBounds());
|
|
2999
3004
|
}
|
|
@@ -3002,10 +3007,6 @@ class PolygonDrawerInput {
|
|
|
3002
3007
|
}
|
|
3003
3008
|
}
|
|
3004
3009
|
clearShape() {
|
|
3005
|
-
if (this.drawLayer) {
|
|
3006
|
-
this.map.removeLayer(this.drawLayer);
|
|
3007
|
-
this.drawLayer = null;
|
|
3008
|
-
}
|
|
3009
3010
|
if (this.shapeLayer) {
|
|
3010
3011
|
this.map.removeLayer(this.shapeLayer);
|
|
3011
3012
|
this.shapeLayer = null;
|
|
@@ -3013,20 +3014,22 @@ class PolygonDrawerInput {
|
|
|
3013
3014
|
}
|
|
3014
3015
|
onDrawPolygon() {
|
|
3015
3016
|
this.polygonDraw = true;
|
|
3016
|
-
this.
|
|
3017
|
-
|
|
3017
|
+
this.map.pm.enableDraw("Polygon", {
|
|
3018
|
+
allowSelfIntersection: false,
|
|
3019
|
+
snappable: false
|
|
3018
3020
|
});
|
|
3019
|
-
|
|
3021
|
+
}
|
|
3022
|
+
onUndoStep() {
|
|
3023
|
+
const draw = this.map.pm.Draw?.Polygon;
|
|
3024
|
+
draw?._removeLastVertex();
|
|
3020
3025
|
}
|
|
3021
3026
|
onDeleteShape() {
|
|
3022
3027
|
this.clearShape();
|
|
3028
|
+
this.map.pm.disableDraw();
|
|
3023
3029
|
this.polygonDraw = false;
|
|
3024
3030
|
this.onChange(null);
|
|
3025
3031
|
this.map.setView([62, 17], 5);
|
|
3026
3032
|
}
|
|
3027
|
-
onUndoStep() {
|
|
3028
|
-
this.drawLayer?.deleteLastVertex();
|
|
3029
|
-
}
|
|
3030
3033
|
writeValue(geoJson) {
|
|
3031
3034
|
this.geoJson = geoJson;
|
|
3032
3035
|
}
|
|
@@ -3044,7 +3047,7 @@ class PolygonDrawerInput {
|
|
|
3044
3047
|
useExisting: forwardRef((() => PolygonDrawerInput)),
|
|
3045
3048
|
multi: true
|
|
3046
3049
|
}
|
|
3047
|
-
], ngImport: i0, template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\r\n <button class=\"btn btn-secondary\" type=\"button\"
|
|
3050
|
+
], ngImport: i0, template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\r\n <span class=\"fas fa-draw-polygon\"></span> {{'OBSERVATION.DRAW'|translate}}\r\n </button>\r\n @if (polygonDraw) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\r\n <span class=\"fas fa-times\"></span>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onUndoStep()\" title=\"\u00C5ngra\">\r\n <span class=\"fas fa-undo\"></span>\r\n </button>\r\n }\r\n</div>\r\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>", dependencies: [{ kind: "pipe", type: i1$1.TranslatePipe, name: "translate" }] }); }
|
|
3048
3051
|
}
|
|
3049
3052
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImport: i0, type: PolygonDrawerInput, decorators: [{
|
|
3050
3053
|
type: Component,
|
|
@@ -3054,7 +3057,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.8", ngImpor
|
|
|
3054
3057
|
useExisting: forwardRef((() => PolygonDrawerInput)),
|
|
3055
3058
|
multi: true
|
|
3056
3059
|
}
|
|
3057
|
-
], template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\r\n <button class=\"btn btn-secondary\" type=\"button\"
|
|
3060
|
+
], template: "<div class=\"mb-1 d-flex gap-1 flex-wrap align-items-start\">\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDrawPolygon()\" title=\"Polygon\">\r\n <span class=\"fas fa-draw-polygon\"></span> {{'OBSERVATION.DRAW'|translate}}\r\n </button>\r\n @if (polygonDraw) {\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onDeleteShape()\" title=\"Ta bort\">\r\n <span class=\"fas fa-times\"></span>\r\n </button>\r\n <button class=\"btn btn-secondary\" type=\"button\" (click)=\"onUndoStep()\" title=\"\u00C5ngra\">\r\n <span class=\"fas fa-undo\"></span>\r\n </button>\r\n }\r\n</div>\r\n<div [id]=\"mapId\" class=\"border\" style=\"height:20rem\"></div>" }]
|
|
3058
3061
|
}] });
|
|
3059
3062
|
|
|
3060
3063
|
var AdbMapFilterType;
|