@regionerne/gis-komponent 0.0.114 → 0.0.116
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.
|
@@ -50,7 +50,6 @@ import * as i1$4 from '@angular/material/dialog';
|
|
|
50
50
|
import { MatDialog, MatDialogModule, MatDialogContent, MatDialogActions, MAT_DIALOG_DATA, MatDialogRef, MatDialogTitle } from '@angular/material/dialog';
|
|
51
51
|
import 'ol/ol.css';
|
|
52
52
|
import { MultiPolygon, Polygon, Point as Point$1, LineString } from 'ol/geom';
|
|
53
|
-
import { getArea, getLength } from 'ol/sphere';
|
|
54
53
|
import Draw, { createBox, createRegularPolygon } from 'ol/interaction/Draw';
|
|
55
54
|
import { Draw as Draw$1, Snap, Select as Select$1, Modify } from 'ol/interaction';
|
|
56
55
|
import { Style, Fill, Circle, Stroke, Icon, Text, RegularShape } from 'ol/style';
|
|
@@ -80,6 +79,7 @@ import PrecisionModel from 'jsts/org/locationtech/jts/geom/PrecisionModel';
|
|
|
80
79
|
import { polygon } from '@turf/helpers';
|
|
81
80
|
import booleanWithin$1 from '@turf/boolean-within';
|
|
82
81
|
import booleanOverlap from '@turf/boolean-overlap';
|
|
82
|
+
import { getArea } from 'ol/sphere';
|
|
83
83
|
import * as i5 from '@angular/material/autocomplete';
|
|
84
84
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
85
85
|
import { map as map$1 } from 'rxjs/operators';
|
|
@@ -2192,12 +2192,15 @@ class MergeFeaturesService {
|
|
|
2192
2192
|
const newFeatureObject = union(featureCollection([bufferedFeature1, bufferedFeature2]));
|
|
2193
2193
|
const newFeature = this.formatter.readFeature(newFeatureObject, this._formatterOptions);
|
|
2194
2194
|
this._drawLayerService.source.removeFeatures([evt.selected[0], this._selectedMergeFeature]);
|
|
2195
|
+
const style = this._selectedMergeFeature.getStyle();
|
|
2196
|
+
const typeId = this._featureHelper.typeId(this._selectedMergeFeature);
|
|
2195
2197
|
this._overLapService.handleOverlaps([newFeature]).subscribe({
|
|
2196
2198
|
next: overlapResult => {
|
|
2197
2199
|
this._selectedMergeFeature?.setGeometry(overlapResult[0].getGeometry());
|
|
2198
2200
|
const mergedFeature = evt.selected[0].clone();
|
|
2199
2201
|
mergedFeature.setGeometry(overlapResult[0].getGeometry());
|
|
2200
|
-
mergedFeature.setStyle(
|
|
2202
|
+
mergedFeature.setStyle(style);
|
|
2203
|
+
this._featureHelper.setTypeId(mergedFeature, typeId);
|
|
2201
2204
|
this._featureHelper.setId(mergedFeature);
|
|
2202
2205
|
this._drawLayerService.source.addFeature(mergedFeature);
|
|
2203
2206
|
this._undoRedoService.addStep();
|
|
@@ -4263,7 +4266,7 @@ class ToolboxComponent {
|
|
|
4263
4266
|
zIndex: 999,
|
|
4264
4267
|
style: (feature) => {
|
|
4265
4268
|
const geom = feature.getGeometry();
|
|
4266
|
-
const area = getArea(
|
|
4269
|
+
const area = geom.getArea();
|
|
4267
4270
|
const formattedArea = this.settings.sizeInHa
|
|
4268
4271
|
? `(${this._formatNumber(area / 10000, 2)} ha)`
|
|
4269
4272
|
: (area > 1000000
|
|
@@ -4308,7 +4311,7 @@ class ToolboxComponent {
|
|
|
4308
4311
|
zIndex: 999,
|
|
4309
4312
|
style: (feature) => {
|
|
4310
4313
|
const geom = feature.getGeometry();
|
|
4311
|
-
const length = getLength(geom);
|
|
4314
|
+
const length = geom.getLength(); // getLength(geom);
|
|
4312
4315
|
const formattedLength = `${this._formatNumber(length, 2)} m`;
|
|
4313
4316
|
return new Style({
|
|
4314
4317
|
stroke: new Stroke({
|
|
@@ -4342,7 +4345,6 @@ class ToolboxComponent {
|
|
|
4342
4345
|
this._distanceMeasureDraw.on('drawstart', (evt) => {
|
|
4343
4346
|
const sketch = evt.feature;
|
|
4344
4347
|
this._featureHelper.setId(sketch);
|
|
4345
|
-
console.log("🚀 ~ ToolboxComponent ~ constructor ~ sketch:", sketch);
|
|
4346
4348
|
sketch.getGeometry().on('change', (geomEvt) => {
|
|
4347
4349
|
const geom = geomEvt.target;
|
|
4348
4350
|
const coords = geom.getCoordinates();
|
|
@@ -4354,7 +4356,7 @@ class ToolboxComponent {
|
|
|
4354
4356
|
const c1 = coords[i];
|
|
4355
4357
|
const c2 = coords[i + 1];
|
|
4356
4358
|
const segment = new LineString([c1, c2]);
|
|
4357
|
-
const length = getLength(segment);
|
|
4359
|
+
const length = segment.getLength(); // getLength(segment, { projection: 'EPSG:25832' });
|
|
4358
4360
|
totalLength += length;
|
|
4359
4361
|
const mid = [(c1[0] + c2[0]) / 2, (c1[1] + c2[1]) / 2];
|
|
4360
4362
|
const formatted = `${this._formatNumber(length, 2)} m`;
|