@regionerne/gis-komponent 0.0.105 → 0.0.107
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.
|
@@ -53,24 +53,24 @@ import { MultiPolygon, Polygon, Point as Point$1, LineString } from 'ol/geom';
|
|
|
53
53
|
import { getArea, getLength } from 'ol/sphere';
|
|
54
54
|
import Draw, { createBox, createRegularPolygon } from 'ol/interaction/Draw';
|
|
55
55
|
import { Draw as Draw$1, Snap, Select as Select$1, Modify } from 'ol/interaction';
|
|
56
|
-
import { Style, Circle, Stroke,
|
|
56
|
+
import { Style, Fill, Circle, Stroke, Icon, Text, RegularShape } from 'ol/style';
|
|
57
57
|
import * as SLDReader from '@nieuwlandgeo/sldreader';
|
|
58
|
+
import Point from 'ol/geom/Point';
|
|
59
|
+
import CircleStyle from 'ol/style/Circle';
|
|
60
|
+
import Feature from 'ol/Feature';
|
|
58
61
|
import WKT from 'ol/format/WKT';
|
|
59
|
-
import Feature$1 from 'ol/Feature';
|
|
60
62
|
import { always, never } from 'ol/events/condition';
|
|
61
63
|
import { buffer, lineIntersect, lineSplit, featureCollection, difference, area, flatten, feature, booleanIntersects, booleanWithin, intersect, union, booleanPointInPolygon, point, bboxPolygon } from '@turf/turf';
|
|
62
64
|
import GeoJSON$1 from 'ol/format/GeoJSON';
|
|
63
65
|
import { containsXY, extend, createEmpty, buffer as buffer$1 } from 'ol/extent';
|
|
64
|
-
import { Feature } from 'ol';
|
|
66
|
+
import { Feature as Feature$1 } from 'ol';
|
|
65
67
|
import { easeOut } from 'ol/easing';
|
|
66
68
|
import Select from 'ol/interaction/Select';
|
|
67
69
|
import * as i2$1 from '@angular/material/button';
|
|
68
70
|
import { MatButtonModule } from '@angular/material/button';
|
|
69
71
|
import html2canvas from 'html2canvas-pro';
|
|
70
|
-
import CircleStyle from 'ol/style/Circle';
|
|
71
72
|
import { transform, toLonLat } from 'ol/proj';
|
|
72
73
|
import WFS from 'ol/format/WFS';
|
|
73
|
-
import Point from 'ol/geom/Point';
|
|
74
74
|
import { intersects, dwithin, contains, like } from 'ol/format/filter';
|
|
75
75
|
import Rotate from 'ol/control/Rotate';
|
|
76
76
|
import { BufferOp } from 'jsts/org/locationtech/jts/operation/buffer';
|
|
@@ -1308,6 +1308,52 @@ class KomponentSettingsHelperService {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
}));
|
|
1310
1310
|
}
|
|
1311
|
+
createCursorLayer(fillColor) {
|
|
1312
|
+
const feature = new Feature(new Point([0, 0]));
|
|
1313
|
+
feature.setStyle(new Style({
|
|
1314
|
+
image: new CircleStyle({
|
|
1315
|
+
radius: 4,
|
|
1316
|
+
fill: new Fill({ color: fillColor })
|
|
1317
|
+
}),
|
|
1318
|
+
zIndex: 999
|
|
1319
|
+
}));
|
|
1320
|
+
const source = new VectorSource({
|
|
1321
|
+
features: [feature],
|
|
1322
|
+
});
|
|
1323
|
+
const layer = new VectorLayer({
|
|
1324
|
+
source,
|
|
1325
|
+
});
|
|
1326
|
+
// store reference for updates
|
|
1327
|
+
layer._cursorFeature = feature;
|
|
1328
|
+
return layer;
|
|
1329
|
+
}
|
|
1330
|
+
attachCursorToMap(map, layer) {
|
|
1331
|
+
const feature = layer._cursorFeature;
|
|
1332
|
+
map.on('pointermove', (evt) => {
|
|
1333
|
+
if (evt.dragging)
|
|
1334
|
+
return;
|
|
1335
|
+
feature.getGeometry().setCoordinates(evt.coordinate);
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
getFillColorFromStyle(style) {
|
|
1339
|
+
let styles;
|
|
1340
|
+
// resolve StyleFunction
|
|
1341
|
+
if (typeof style === 'function') {
|
|
1342
|
+
// we call it with a dummy feature just to get styles
|
|
1343
|
+
const dummyFeature = new Feature(new Point([0, 0]));
|
|
1344
|
+
styles = style(dummyFeature, 0);
|
|
1345
|
+
}
|
|
1346
|
+
else {
|
|
1347
|
+
styles = style;
|
|
1348
|
+
}
|
|
1349
|
+
// normalize to array
|
|
1350
|
+
if (!Array.isArray(styles)) {
|
|
1351
|
+
styles = [styles];
|
|
1352
|
+
}
|
|
1353
|
+
// find first style with fill
|
|
1354
|
+
const fillStyle = styles.find((s) => s?.getFill?.());
|
|
1355
|
+
return fillStyle?.getFill()?.getColor() || null;
|
|
1356
|
+
}
|
|
1311
1357
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: KomponentSettingsHelperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1312
1358
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: KomponentSettingsHelperService, providedIn: 'root' });
|
|
1313
1359
|
}
|
|
@@ -1693,7 +1739,7 @@ class HighlightService {
|
|
|
1693
1739
|
return;
|
|
1694
1740
|
}
|
|
1695
1741
|
const newFeatures = feature.map(f => {
|
|
1696
|
-
const newFeature = new Feature({ geometry: f.getGeometry(), style: this._getFadedStyle(1) });
|
|
1742
|
+
const newFeature = new Feature$1({ geometry: f.getGeometry(), style: this._getFadedStyle(1) });
|
|
1697
1743
|
const now = performance.now();
|
|
1698
1744
|
newFeature.set(this.fadeStart, now);
|
|
1699
1745
|
const fadeMs = this._current.gisKomponentSettings?.highlightFadeTimerMs ?? 2000;
|
|
@@ -1954,7 +2000,7 @@ class OverlapService {
|
|
|
1954
2000
|
// The only way to get here is that the new feature completely overlaps this one. This one should be removed
|
|
1955
2001
|
// and added to the output-array, because that is used for hiding features in preview
|
|
1956
2002
|
if (isPreview) {
|
|
1957
|
-
const featureToHide = new Feature(f.geometry);
|
|
2003
|
+
const featureToHide = new Feature$1(f.geometry);
|
|
1958
2004
|
featureToHide.setId(f.id);
|
|
1959
2005
|
featuresToAddToOutput.push(featureToHide);
|
|
1960
2006
|
const overlappedFeature = features.find(existingFeature => existingFeature.getId() === f.id);
|
|
@@ -2040,7 +2086,7 @@ class OverlapService {
|
|
|
2040
2086
|
const result = [];
|
|
2041
2087
|
if (aTurfFeature.geometry.type === 'MultiPolygon') {
|
|
2042
2088
|
aTurfFeature.geometry.coordinates.forEach((coords) => {
|
|
2043
|
-
const newFeature = new Feature(this._geoJSONToOl({
|
|
2089
|
+
const newFeature = new Feature$1(this._geoJSONToOl({
|
|
2044
2090
|
type: 'Polygon',
|
|
2045
2091
|
coordinates: coords,
|
|
2046
2092
|
style: style
|
|
@@ -2051,7 +2097,7 @@ class OverlapService {
|
|
|
2051
2097
|
});
|
|
2052
2098
|
}
|
|
2053
2099
|
else {
|
|
2054
|
-
const newFeature = new Feature(this._geoJSONToOl(aTurfFeature.geometry));
|
|
2100
|
+
const newFeature = new Feature$1(this._geoJSONToOl(aTurfFeature.geometry));
|
|
2055
2101
|
if (style)
|
|
2056
2102
|
newFeature.setStyle(style);
|
|
2057
2103
|
result.push(newFeature);
|
|
@@ -3025,6 +3071,7 @@ class ToolboxComponent {
|
|
|
3025
3071
|
_originalMapWidth = 0;
|
|
3026
3072
|
_originalMapHeight = 0;
|
|
3027
3073
|
pointClickKey;
|
|
3074
|
+
_cursorLayerForDraw;
|
|
3028
3075
|
_geometrySearchService = inject(GeometrySearchService);
|
|
3029
3076
|
_polygonCleanupService = inject(PolygonCleanupService);
|
|
3030
3077
|
drawInteraction;
|
|
@@ -3799,6 +3846,10 @@ class ToolboxComponent {
|
|
|
3799
3846
|
if (this.activeMode === 'draw') {
|
|
3800
3847
|
this._clearAllInteractions();
|
|
3801
3848
|
this.activeMode = null;
|
|
3849
|
+
if (this._cursorLayerForDraw) {
|
|
3850
|
+
this.map.removeLayer(this._cursorLayerForDraw);
|
|
3851
|
+
this._cursorLayerForDraw = undefined;
|
|
3852
|
+
}
|
|
3802
3853
|
}
|
|
3803
3854
|
else {
|
|
3804
3855
|
this.activeMode = 'draw';
|
|
@@ -3931,7 +3982,7 @@ class ToolboxComponent {
|
|
|
3931
3982
|
let feature = wktFormat.readFeature(item.wkt, { featureProjection: 'EPSG:25832', dataProjection: 'EPSG:25832' });
|
|
3932
3983
|
if (withBuffer) {
|
|
3933
3984
|
const bufferedGeometry = this._bufferGeometry(feature.getGeometry(), this.bufferInMeters);
|
|
3934
|
-
feature = new Feature
|
|
3985
|
+
feature = new Feature({ geometry: bufferedGeometry });
|
|
3935
3986
|
}
|
|
3936
3987
|
const geomType = feature.getGeometry()?.getType();
|
|
3937
3988
|
if (!geomType) {
|
|
@@ -4087,6 +4138,19 @@ class ToolboxComponent {
|
|
|
4087
4138
|
this._settingsHelper.getStyle(style, this.profile.styleRepositoryWorkspace, this.profile.styleRepositoryGeoserver, geomType)
|
|
4088
4139
|
.subscribe({
|
|
4089
4140
|
next: style => {
|
|
4141
|
+
if (geomType === 'Polygon' || geomType === 'LineString') {
|
|
4142
|
+
// Clear circle preview from previous Polygon\LineString style if needed
|
|
4143
|
+
if (this._cursorLayerForDraw) {
|
|
4144
|
+
this.map.removeLayer(this._cursorLayerForDraw);
|
|
4145
|
+
this._cursorLayerForDraw = undefined;
|
|
4146
|
+
}
|
|
4147
|
+
// Extract fill color from style
|
|
4148
|
+
const fillColor = this._settingsHelper.getFillColorFromStyle(style) || 'rgba(0,0,255,0.3)';
|
|
4149
|
+
// Create cursor layer (circle showing the Polygon's fill color)
|
|
4150
|
+
this._cursorLayerForDraw = this._settingsHelper.createCursorLayer(fillColor);
|
|
4151
|
+
this.map.addLayer(this._cursorLayerForDraw);
|
|
4152
|
+
this._settingsHelper.attachCursorToMap(this.map, this._cursorLayerForDraw);
|
|
4153
|
+
}
|
|
4090
4154
|
const drawInteraction = new Draw({
|
|
4091
4155
|
type: geomType,
|
|
4092
4156
|
source: new VectorSource(),
|
|
@@ -4146,7 +4210,6 @@ class ToolboxComponent {
|
|
|
4146
4210
|
});
|
|
4147
4211
|
this._interactionHelper.setAsTemp(drawInteraction);
|
|
4148
4212
|
this.map.addInteraction(drawInteraction);
|
|
4149
|
-
this.map.getTargetElement().style.cursor = 'crosshair'; // Placeholder for now
|
|
4150
4213
|
this._addSnap();
|
|
4151
4214
|
}
|
|
4152
4215
|
});
|
|
@@ -4248,7 +4311,7 @@ class ToolboxComponent {
|
|
|
4248
4311
|
totalLength += length;
|
|
4249
4312
|
const mid = [(c1[0] + c2[0]) / 2, (c1[1] + c2[1]) / 2];
|
|
4250
4313
|
const formatted = `${this._formatNumber(length, 2)} m`;
|
|
4251
|
-
const labelFeature = new Feature
|
|
4314
|
+
const labelFeature = new Feature({
|
|
4252
4315
|
geometry: new Point$1(mid),
|
|
4253
4316
|
label: formatted
|
|
4254
4317
|
});
|
|
@@ -4258,7 +4321,7 @@ class ToolboxComponent {
|
|
|
4258
4321
|
if (coords.length > 1) {
|
|
4259
4322
|
const positionPoint = coords[0];
|
|
4260
4323
|
const formattedTotal = `${this._formatNumber(totalLength, 2)} m`;
|
|
4261
|
-
const totalFeature = new Feature
|
|
4324
|
+
const totalFeature = new Feature({
|
|
4262
4325
|
geometry: new Point$1(positionPoint),
|
|
4263
4326
|
label: `Total: ${formattedTotal}`
|
|
4264
4327
|
});
|
|
@@ -4281,6 +4344,10 @@ class ToolboxComponent {
|
|
|
4281
4344
|
if (clearPrintDrawTool) {
|
|
4282
4345
|
this._active = 'No';
|
|
4283
4346
|
}
|
|
4347
|
+
if (this._cursorLayerForDraw) {
|
|
4348
|
+
this.map.removeLayer(this._cursorLayerForDraw);
|
|
4349
|
+
this._cursorLayerForDraw = undefined;
|
|
4350
|
+
}
|
|
4284
4351
|
this.map.getTargetElement().style.cursor = "";
|
|
4285
4352
|
}
|
|
4286
4353
|
ngOnInit() {
|
|
@@ -5665,7 +5732,7 @@ class ShowInfoHoverService {
|
|
|
5665
5732
|
.flatMap(f => f.values)
|
|
5666
5733
|
.map(f => {
|
|
5667
5734
|
const styleForFeature = this._getStyle(f.showValue);
|
|
5668
|
-
const newFeature = new Feature({ geometry: f.center });
|
|
5735
|
+
const newFeature = new Feature$1({ geometry: f.center });
|
|
5669
5736
|
newFeature.setStyle(styleForFeature);
|
|
5670
5737
|
return newFeature;
|
|
5671
5738
|
});
|