@artstesh/maps 5.1.6 → 5.1.8
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/dist/esm2022/map/helpers/marker-style.helper.mjs +27 -1
- package/dist/esm2022/map/helpers/polygon-style.helper.mjs +22 -1
- package/dist/esm2022/map/helpers/stringify-feature.helper.mjs +24 -21
- package/dist/esm2022/map/helpers/text-style.helper.mjs +12 -1
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +26 -9
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +72 -1
- package/dist/esm2022/map/map-plate/features/markers/markers.component.mjs +11 -1
- package/dist/esm2022/map/map-plate/features/polygons/polygons.component.mjs +11 -1
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +16 -8
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +79 -1
- package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.component.mjs +8 -8
- package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +37 -17
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.component.mjs +7 -7
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +76 -1
- package/dist/esm2022/map/map-plate/map-plate.component.mjs +5 -5
- package/dist/esm2022/map/map-plate/tooltips/tooltip/tooltip.component.mjs +23 -23
- package/dist/esm2022/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +2 -2
- package/dist/esm2022/map/messages/commands/draw-selection-area.command.mjs +1 -1
- package/dist/esm2022/map/messages/commands/fit-to-polygons.command.mjs +15 -0
- package/dist/esm2022/map/messages/index.mjs +2 -1
- package/dist/esm2022/map/messages/queries/get-features-in-area.query.mjs +1 -1
- package/dist/esm2022/map/models/index.mjs +1 -2
- package/dist/esm2022/map/models/map-control.mjs +2 -2
- package/dist/esm2022/map/models/marker-model.mjs +1 -1
- package/dist/esm2022/map/models/polygon.model.mjs +12 -12
- package/dist/esm2022/map/services/drawing/drawing.service.mjs +3 -2
- package/dist/esm2022/map/services/feature.service.mjs +6 -6
- package/dist/esm2022/map/services/map-click.service.mjs +9 -9
- package/dist/esm2022/map/services/map-feature.service.mjs +18 -4
- package/dist/esm2022/map/services/map-management.service.mjs +2 -2
- package/dist/esm2022/map/services/map-state.service.mjs +2 -3
- package/dist/esm2022/map/services/message-registrator.service.mjs +3 -2
- package/dist/esm2022/src/map/helpers/marker-style.helper.mjs +27 -1
- package/dist/esm2022/src/map/helpers/polygon-style.helper.mjs +22 -1
- package/dist/esm2022/src/map/helpers/stringify-feature.helper.mjs +24 -21
- package/dist/esm2022/src/map/helpers/text-style.helper.mjs +12 -1
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +26 -9
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +72 -1
- package/dist/esm2022/src/map/map-plate/features/markers/markers.component.mjs +11 -1
- package/dist/esm2022/src/map/map-plate/features/polygons/polygons.component.mjs +11 -1
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +16 -8
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +79 -1
- package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.component.mjs +8 -8
- package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +37 -17
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +7 -7
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +76 -1
- package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +5 -5
- package/dist/esm2022/src/map/map-plate/tooltips/tooltip/tooltip.component.mjs +23 -23
- package/dist/esm2022/src/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +2 -2
- package/dist/esm2022/src/map/messages/commands/draw-selection-area.command.mjs +1 -1
- package/dist/esm2022/src/map/messages/commands/fit-to-polygons.command.mjs +15 -0
- package/dist/esm2022/src/map/messages/index.mjs +2 -1
- package/dist/esm2022/src/map/messages/queries/get-features-in-area.query.mjs +1 -1
- package/dist/esm2022/src/map/models/index.mjs +1 -2
- package/dist/esm2022/src/map/models/map-control.mjs +2 -2
- package/dist/esm2022/src/map/models/marker-model.mjs +1 -1
- package/dist/esm2022/src/map/models/polygon.model.mjs +12 -12
- package/dist/esm2022/src/map/services/drawing/drawing.service.mjs +3 -2
- package/dist/esm2022/src/map/services/feature.service.mjs +6 -6
- package/dist/esm2022/src/map/services/map-click.service.mjs +9 -9
- package/dist/esm2022/src/map/services/map-feature.service.mjs +18 -4
- package/dist/esm2022/src/map/services/map-management.service.mjs +2 -2
- package/dist/esm2022/src/map/services/map-state.service.mjs +2 -3
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +3 -2
- package/dist/fesm2022/maps-components-src-map.mjs +500 -173
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +500 -173
- package/dist/fesm2022/maps-components.mjs.map +1 -1
- package/dist/map/helpers/marker-style.helper.d.ts +26 -0
- package/dist/map/helpers/polygon-style.helper.d.ts +21 -0
- package/dist/map/helpers/stringify-feature.helper.d.ts +18 -0
- package/dist/map/helpers/text-style.helper.d.ts +11 -0
- package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +20 -3
- package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +71 -0
- package/dist/map/map-plate/features/markers/markers.component.d.ts +10 -0
- package/dist/map/map-plate/features/polygons/polygons.component.d.ts +10 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +10 -2
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +78 -0
- package/dist/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +2 -2
- package/dist/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +36 -16
- package/dist/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +1 -1
- package/dist/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +75 -0
- package/dist/map/map-plate/map-plate.component.d.ts +2 -2
- package/dist/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +5 -5
- package/dist/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +1 -1
- package/dist/map/messages/commands/draw-selection-area.command.d.ts +2 -1
- package/dist/map/messages/commands/fit-to-polygons.command.d.ts +9 -0
- package/dist/map/messages/index.d.ts +1 -0
- package/dist/map/messages/queries/get-features-in-area.query.d.ts +1 -1
- package/dist/map/models/index.d.ts +0 -1
- package/dist/map/models/map-control.d.ts +1 -1
- package/dist/map/models/polygon.model.d.ts +2 -2
- package/dist/map/services/feature.service.d.ts +1 -1
- package/dist/map/services/map-click.service.d.ts +1 -1
- package/dist/map/services/map-feature.service.d.ts +2 -0
- package/dist/package.json +2 -1
- package/dist/src/map/helpers/marker-style.helper.d.ts +26 -0
- package/dist/src/map/helpers/polygon-style.helper.d.ts +21 -0
- package/dist/src/map/helpers/stringify-feature.helper.d.ts +18 -0
- package/dist/src/map/helpers/text-style.helper.d.ts +11 -0
- package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +20 -3
- package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +71 -0
- package/dist/src/map/map-plate/features/markers/markers.component.d.ts +10 -0
- package/dist/src/map/map-plate/features/polygons/polygons.component.d.ts +10 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +10 -2
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +78 -0
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +2 -2
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +36 -16
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +1 -1
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +75 -0
- package/dist/src/map/map-plate/map-plate.component.d.ts +2 -2
- package/dist/src/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +5 -5
- package/dist/src/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +1 -1
- package/dist/src/map/messages/commands/draw-selection-area.command.d.ts +2 -1
- package/dist/src/map/messages/commands/fit-to-polygons.command.d.ts +9 -0
- package/dist/src/map/messages/index.d.ts +1 -0
- package/dist/src/map/messages/queries/get-features-in-area.query.d.ts +1 -1
- package/dist/src/map/models/index.d.ts +0 -1
- package/dist/src/map/models/map-control.d.ts +1 -1
- package/dist/src/map/models/polygon.model.d.ts +2 -2
- package/dist/src/map/services/feature.service.d.ts +1 -1
- package/dist/src/map/services/map-click.service.d.ts +1 -1
- package/dist/src/map/services/map-feature.service.d.ts +2 -0
- package/package.json +3 -2
- package/dist/esm2022/map/models/dictionary.mjs +0 -54
- package/dist/esm2022/src/map/models/dictionary.mjs +0 -54
- package/dist/map/models/dictionary.d.ts +0 -17
- package/dist/src/map/models/dictionary.d.ts +0 -17
|
@@ -3,7 +3,7 @@ import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgMod
|
|
|
3
3
|
import * as i4 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { Feature, Collection } from 'ol';
|
|
6
|
-
import { Point
|
|
6
|
+
import { Point } from 'ol/geom';
|
|
7
7
|
import { GeoJSON, WKT } from 'ol/format';
|
|
8
8
|
import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
9
9
|
import { Control, Zoom } from 'ol/control';
|
|
@@ -12,6 +12,7 @@ import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, Postboy
|
|
|
12
12
|
import { Draw, Modify, Translate } from 'ol/interaction';
|
|
13
13
|
import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
|
|
14
14
|
import * as Sphere from 'ol/sphere';
|
|
15
|
+
import { Dictionary } from '@artstesh/collections';
|
|
15
16
|
import { first, filter, auditTime } from 'rxjs/operators';
|
|
16
17
|
import { Vector, XYZ } from 'ol/source';
|
|
17
18
|
import TileLayer from 'ol/layer/Tile';
|
|
@@ -162,17 +163,6 @@ class PolygonModel {
|
|
|
162
163
|
id;
|
|
163
164
|
lat;
|
|
164
165
|
lng;
|
|
165
|
-
_feature;
|
|
166
|
-
static fromGeoJson(id, json, info) {
|
|
167
|
-
let feature = new GeoJSON().readFeature(json);
|
|
168
|
-
feature.setId(id);
|
|
169
|
-
return new PolygonModel(feature, id, info);
|
|
170
|
-
}
|
|
171
|
-
static fromWKT(id, wkt, info) {
|
|
172
|
-
let feature = new WKT().readFeature(wkt);
|
|
173
|
-
feature.setId(id);
|
|
174
|
-
return new PolygonModel(feature, id, info);
|
|
175
|
-
}
|
|
176
166
|
constructor(feature, id, info) {
|
|
177
167
|
this.info = info;
|
|
178
168
|
this.id = id == null ? IdGenerator.get() : id;
|
|
@@ -181,9 +171,20 @@ class PolygonModel {
|
|
|
181
171
|
this._feature?.set(MapConstants.FeatureInfo, this.info);
|
|
182
172
|
[this.lng, this.lat] = getCenter(this._feature.getGeometry()?.getExtent());
|
|
183
173
|
}
|
|
174
|
+
_feature;
|
|
184
175
|
get feature() {
|
|
185
176
|
return this._feature;
|
|
186
177
|
}
|
|
178
|
+
static fromGeoJson(id, json, info) {
|
|
179
|
+
let feature = new GeoJSON().readFeature(json);
|
|
180
|
+
feature.setId(id);
|
|
181
|
+
return new PolygonModel(feature, id, info);
|
|
182
|
+
}
|
|
183
|
+
static fromWKT(id, wkt, info) {
|
|
184
|
+
let feature = new WKT().readFeature(wkt);
|
|
185
|
+
feature.setId(id);
|
|
186
|
+
return new PolygonModel(feature, id, info);
|
|
187
|
+
}
|
|
187
188
|
}
|
|
188
189
|
|
|
189
190
|
var DrawingType;
|
|
@@ -200,63 +201,9 @@ var FeatureOutputFormat;
|
|
|
200
201
|
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
201
202
|
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
202
203
|
|
|
203
|
-
class Dictionary {
|
|
204
|
-
collection = {};
|
|
205
|
-
_keys = new Set();
|
|
206
|
-
get keys() {
|
|
207
|
-
return Array.from(this._keys);
|
|
208
|
-
}
|
|
209
|
-
get size() {
|
|
210
|
-
return this._keys.size;
|
|
211
|
-
}
|
|
212
|
-
static clone(dic, action) {
|
|
213
|
-
return Dictionary.create(dic.collection, action);
|
|
214
|
-
}
|
|
215
|
-
static create(dic, action) {
|
|
216
|
-
let keyList = Object.keys(dic);
|
|
217
|
-
const result = new Dictionary();
|
|
218
|
-
for (let i = 0; i < keyList.length; i++) {
|
|
219
|
-
let key = keyList[i];
|
|
220
|
-
result._keys.add(key);
|
|
221
|
-
result.collection[key] = action ? action(dic[key], key) : dic[key];
|
|
222
|
-
}
|
|
223
|
-
return result;
|
|
224
|
-
}
|
|
225
|
-
find(predicate) {
|
|
226
|
-
let result = null;
|
|
227
|
-
this.forEach((e) => {
|
|
228
|
-
if (result === null && predicate(e))
|
|
229
|
-
result = e;
|
|
230
|
-
});
|
|
231
|
-
return result;
|
|
232
|
-
}
|
|
233
|
-
has = (key) => this._keys.has(key);
|
|
234
|
-
take(key) {
|
|
235
|
-
return this._keys.has(key) ? this.collection[key] : null;
|
|
236
|
-
}
|
|
237
|
-
put(key, value) {
|
|
238
|
-
if (value == null)
|
|
239
|
-
return;
|
|
240
|
-
this.collection[key] = value;
|
|
241
|
-
this._keys.add(key);
|
|
242
|
-
}
|
|
243
|
-
rmv(key) {
|
|
244
|
-
if (!this._keys.has(key))
|
|
245
|
-
return;
|
|
246
|
-
delete this.collection[key];
|
|
247
|
-
this._keys.delete(key);
|
|
248
|
-
}
|
|
249
|
-
forEach(callback) {
|
|
250
|
-
let keys = Object.keys(this.collection);
|
|
251
|
-
for (let i = 0; i < keys.length; i++) {
|
|
252
|
-
callback(this.collection[keys[i]], i);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
204
|
/**
|
|
258
205
|
*
|
|
259
|
-
* A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
|
|
206
|
+
* A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default, these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
|
|
260
207
|
* This is the base class for controls. You can use it for simple custom controls by creating the element with listeners, creating an instance:
|
|
261
208
|
* var myControl = new Control({element: myElement}); and then adding this to the map.
|
|
262
209
|
* The main advantage of having this as a control rather than a simple separate DOM element is that preventing propagation is handled for you. Controls will also be objects in a module:ol/Collection~Collection, so you can use their methods.
|
|
@@ -445,6 +392,20 @@ class CalculateAreaExecutor extends PostboyExecutor {
|
|
|
445
392
|
}
|
|
446
393
|
}
|
|
447
394
|
|
|
395
|
+
class FitToPolygonsCommand extends PostboyGenericMessage {
|
|
396
|
+
features;
|
|
397
|
+
zoomAfter;
|
|
398
|
+
static ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
|
|
399
|
+
constructor(features, zoomAfter = 0) {
|
|
400
|
+
super();
|
|
401
|
+
this.features = features;
|
|
402
|
+
this.zoomAfter = zoomAfter;
|
|
403
|
+
}
|
|
404
|
+
get id() {
|
|
405
|
+
return FitToPolygonsCommand.ID;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
448
409
|
class AddLayerCommand extends PostboyGenericMessage {
|
|
449
410
|
layer;
|
|
450
411
|
static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
@@ -570,6 +531,11 @@ class FeatureService {
|
|
|
570
531
|
static filterFeaturesInArea(query) {
|
|
571
532
|
return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
|
|
572
533
|
}
|
|
534
|
+
static calculateArea(g) {
|
|
535
|
+
if (!g)
|
|
536
|
+
return 0;
|
|
537
|
+
return Sphere.getArea(g, { projection: 'EPSG:4326' });
|
|
538
|
+
}
|
|
573
539
|
static booleanIntersects(g1, g2) {
|
|
574
540
|
if (g2.getType() === 'Point')
|
|
575
541
|
return g1.intersectsCoordinate(g2.getCoordinates());
|
|
@@ -579,11 +545,6 @@ class FeatureService {
|
|
|
579
545
|
return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
|
|
580
546
|
return false;
|
|
581
547
|
}
|
|
582
|
-
static calculateArea(g) {
|
|
583
|
-
if (!g)
|
|
584
|
-
return 0;
|
|
585
|
-
return Sphere.getArea(g, { projection: 'EPSG:4326' });
|
|
586
|
-
}
|
|
587
548
|
}
|
|
588
549
|
|
|
589
550
|
class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
|
|
@@ -795,21 +756,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
795
756
|
class MapFeatureService {
|
|
796
757
|
postboy;
|
|
797
758
|
map;
|
|
759
|
+
fitPolygonsWaiting;
|
|
798
760
|
constructor(postboy) {
|
|
799
761
|
this.postboy = postboy;
|
|
800
762
|
}
|
|
801
763
|
up() {
|
|
802
764
|
this.observeMapRender();
|
|
803
765
|
this.observeFitToFeatures();
|
|
766
|
+
this.observeFitToPolygons();
|
|
804
767
|
}
|
|
805
768
|
observeMapRender() {
|
|
806
769
|
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
807
770
|
this.map = m.map;
|
|
771
|
+
if (this.fitPolygonsWaiting)
|
|
772
|
+
this.postboy.fire(this.fitPolygonsWaiting);
|
|
808
773
|
});
|
|
809
774
|
}
|
|
810
775
|
observeFitToFeatures() {
|
|
811
|
-
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((
|
|
812
|
-
this.fitToGeometries(
|
|
776
|
+
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((cmd) => {
|
|
777
|
+
this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
observeFitToPolygons() {
|
|
781
|
+
this.postboy.subscribe(FitToPolygonsCommand.ID).subscribe((cmd) => {
|
|
782
|
+
if (!this.map) {
|
|
783
|
+
this.fitPolygonsWaiting = cmd;
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
this.fitPolygonsWaiting = undefined;
|
|
787
|
+
this.fitToGeometries(cmd.features.map((f) => f.feature.getGeometry()), cmd.zoomAfter);
|
|
813
788
|
});
|
|
814
789
|
}
|
|
815
790
|
fitToGeometries(geometries, zoomAfter) {
|
|
@@ -836,14 +811,6 @@ class MapClickService {
|
|
|
836
811
|
up() {
|
|
837
812
|
this.observeMapRender();
|
|
838
813
|
}
|
|
839
|
-
observeMapRender() {
|
|
840
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
841
|
-
this.map = m.map;
|
|
842
|
-
this.map?.on('singleclick', (e) => {
|
|
843
|
-
this.postboy.fire(this.onClick(e));
|
|
844
|
-
});
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
814
|
onClick(ev) {
|
|
848
815
|
const model = new MapClickEvent(ev.coordinate, {}, {});
|
|
849
816
|
this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
|
|
@@ -861,6 +828,14 @@ class MapClickService {
|
|
|
861
828
|
});
|
|
862
829
|
return model;
|
|
863
830
|
}
|
|
831
|
+
observeMapRender() {
|
|
832
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
833
|
+
this.map = m.map;
|
|
834
|
+
this.map?.on('singleclick', (e) => {
|
|
835
|
+
this.postboy.fire(this.onClick(e));
|
|
836
|
+
});
|
|
837
|
+
});
|
|
838
|
+
}
|
|
864
839
|
getFeatureCollectionWithInner(features) {
|
|
865
840
|
const result = [];
|
|
866
841
|
features?.forEach((f) => {
|
|
@@ -1102,6 +1077,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1102
1077
|
this.registerSubject(MapClickEvent.ID);
|
|
1103
1078
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
1104
1079
|
this.registerSubject(FitToFeaturesCommand.ID);
|
|
1080
|
+
this.registerSubject(FitToPolygonsCommand.ID);
|
|
1105
1081
|
this.registerSubject(MapMoveEndEvent.ID);
|
|
1106
1082
|
this.registerSubject(CancelDrawingCommand.ID);
|
|
1107
1083
|
this.registerSubject(StartDrawingCommand.ID);
|
|
@@ -1126,12 +1102,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1126
1102
|
type: Injectable
|
|
1127
1103
|
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }, { type: ControlsService }]; } });
|
|
1128
1104
|
|
|
1105
|
+
/**
|
|
1106
|
+
* Class representing settings for a tile layer.
|
|
1107
|
+
*/
|
|
1129
1108
|
class TileLayerSettings {
|
|
1109
|
+
/**
|
|
1110
|
+
* The maximum zoom level for a map view.
|
|
1111
|
+
*
|
|
1112
|
+
* @type {number}
|
|
1113
|
+
* @default 19
|
|
1114
|
+
*/
|
|
1130
1115
|
maxZoom = 19;
|
|
1116
|
+
/**
|
|
1117
|
+
* The minimum zoom level allowed.
|
|
1118
|
+
*
|
|
1119
|
+
* @type {number}
|
|
1120
|
+
*/
|
|
1131
1121
|
minZoom = 0;
|
|
1122
|
+
/**
|
|
1123
|
+
* The opacity of an element.
|
|
1124
|
+
*
|
|
1125
|
+
* @type {number}
|
|
1126
|
+
* @default 0.6
|
|
1127
|
+
*/
|
|
1132
1128
|
opacity = 0.6;
|
|
1129
|
+
/**
|
|
1130
|
+
* Represents the tiles URL.
|
|
1131
|
+
* @typedef {string} url
|
|
1132
|
+
*
|
|
1133
|
+
* @example
|
|
1134
|
+
* 'https://example.ex/{z}/{x}/{y}.png'
|
|
1135
|
+
*/
|
|
1133
1136
|
url = '';
|
|
1137
|
+
/**
|
|
1138
|
+
* The projection of the coordinate system.
|
|
1139
|
+
*
|
|
1140
|
+
* @type {string}
|
|
1141
|
+
* @default 'EPSG:3857'
|
|
1142
|
+
*/
|
|
1134
1143
|
projection = 'EPSG:3857';
|
|
1144
|
+
/**
|
|
1145
|
+
* Creates a copy of the given tile layer settings.
|
|
1146
|
+
*
|
|
1147
|
+
* @param {TileLayerSettings} model - The tile layer settings to be copied.
|
|
1148
|
+
* @return {TileLayerSettings} - A new instance of TileLayerSettings with the same properties as the model.
|
|
1149
|
+
*/
|
|
1135
1150
|
static copy(model) {
|
|
1136
1151
|
const result = new TileLayerSettings();
|
|
1137
1152
|
result.maxZoom = model.maxZoom;
|
|
@@ -1141,21 +1156,57 @@ class TileLayerSettings {
|
|
|
1141
1156
|
result.url = model.url;
|
|
1142
1157
|
return result;
|
|
1143
1158
|
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Sets the URL of the TileLayerSettings object.
|
|
1161
|
+
*
|
|
1162
|
+
* @param {string} url - The URL to be set.
|
|
1163
|
+
* @return {TileLayerSettings} - The updated TileLayerSettings object.
|
|
1164
|
+
*/
|
|
1144
1165
|
setUrl(url) {
|
|
1145
1166
|
return TileLayerSettings.copy({ ...this, url });
|
|
1146
1167
|
}
|
|
1168
|
+
/**
|
|
1169
|
+
* Sets the maximum zoom level for the tile layer.
|
|
1170
|
+
*
|
|
1171
|
+
* @param {number} maxZoom - The maximum zoom level.
|
|
1172
|
+
* @returns {TileLayerSettings} - The updated tile layer settings object.
|
|
1173
|
+
*/
|
|
1147
1174
|
setMaxZoom(maxZoom) {
|
|
1148
1175
|
return TileLayerSettings.copy({ ...this, maxZoom });
|
|
1149
1176
|
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Sets the minimum zoom level for the Tile Layer.
|
|
1179
|
+
*
|
|
1180
|
+
* @param {number} minZoom - The minimum zoom level to be set.
|
|
1181
|
+
* @return {TileLayerSettings} The modified TileLayerSettings object with the updated minimum zoom level.
|
|
1182
|
+
*/
|
|
1150
1183
|
setMinZoom(minZoom) {
|
|
1151
1184
|
return TileLayerSettings.copy({ ...this, minZoom });
|
|
1152
1185
|
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Sets the opacity of the TileLayerSettings.
|
|
1188
|
+
*
|
|
1189
|
+
* @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
|
|
1190
|
+
* @return {TileLayerSettings} - A new instance of TileLayerSettings with the opacity set.
|
|
1191
|
+
*/
|
|
1153
1192
|
setOpacity(opacity) {
|
|
1154
1193
|
return TileLayerSettings.copy({ ...this, opacity });
|
|
1155
1194
|
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Sets the projection for the tile layer settings.
|
|
1197
|
+
*
|
|
1198
|
+
* @param {string} projection - The desired projection for the tile layer settings.
|
|
1199
|
+
* @return {TileLayerSettings} - The updated tile layer settings with the new projection.
|
|
1200
|
+
*/
|
|
1156
1201
|
setProjection(projection) {
|
|
1157
1202
|
return TileLayerSettings.copy({ ...this, projection });
|
|
1158
1203
|
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Checks if the current instance of TileLayerSettings is equal to the given model.
|
|
1206
|
+
* @param {TileLayerSettings} model - The model to compare against.
|
|
1207
|
+
* @return {boolean} - True if all properties of the current instance matches the properties of the model;
|
|
1208
|
+
* otherwise, false.
|
|
1209
|
+
*/
|
|
1159
1210
|
isSame(model) {
|
|
1160
1211
|
if (this.maxZoom !== model.maxZoom)
|
|
1161
1212
|
return false;
|
|
@@ -1225,12 +1276,6 @@ class TileLayerComponent extends DestructibleComponent {
|
|
|
1225
1276
|
this.postboy = postboy;
|
|
1226
1277
|
this.factory = factory;
|
|
1227
1278
|
}
|
|
1228
|
-
ngOnInit() {
|
|
1229
|
-
this.postboy
|
|
1230
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1231
|
-
.pipe(filter((m) => !!m), first())
|
|
1232
|
-
.subscribe((m) => this.initLayer());
|
|
1233
|
-
}
|
|
1234
1279
|
_settings = new TileLayerSettings();
|
|
1235
1280
|
set settings(value) {
|
|
1236
1281
|
if (!value || this._settings.isSame(value))
|
|
@@ -1238,6 +1283,12 @@ class TileLayerComponent extends DestructibleComponent {
|
|
|
1238
1283
|
this._settings = value;
|
|
1239
1284
|
this.initLayer();
|
|
1240
1285
|
}
|
|
1286
|
+
ngOnInit() {
|
|
1287
|
+
this.postboy
|
|
1288
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1289
|
+
.pipe(filter((m) => !!m), first())
|
|
1290
|
+
.subscribe((m) => this.initLayer());
|
|
1291
|
+
}
|
|
1241
1292
|
onDestroy = () => this.removeLayer();
|
|
1242
1293
|
initLayer() {
|
|
1243
1294
|
this.removeLayer();
|
|
@@ -1323,11 +1374,16 @@ class FeatureLayerSettings {
|
|
|
1323
1374
|
*/
|
|
1324
1375
|
zIndex = 1;
|
|
1325
1376
|
/**
|
|
1326
|
-
|
|
1377
|
+
The maximum view zoom level (inclusive) at which this layer will be visible.
|
|
1378
|
+
|
|
1379
|
+
@type {number}
|
|
1380
|
+
@default 19
|
|
1327
1381
|
*/
|
|
1328
1382
|
maxZoom = 19;
|
|
1329
1383
|
/**
|
|
1330
|
-
|
|
1384
|
+
The minimum view zoom level (exclusive) at which this layer will be visible.
|
|
1385
|
+
|
|
1386
|
+
@type {number}
|
|
1331
1387
|
*/
|
|
1332
1388
|
minZoom = 0;
|
|
1333
1389
|
/**
|
|
@@ -1335,8 +1391,10 @@ class FeatureLayerSettings {
|
|
|
1335
1391
|
*/
|
|
1336
1392
|
style;
|
|
1337
1393
|
/**
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1394
|
+
* Copies the given FeatureLayerSettings object
|
|
1395
|
+
*
|
|
1396
|
+
* @param {FeatureLayerSettings} model - The FeatureLayerSettings object to be copied
|
|
1397
|
+
* @returns {FeatureLayerSettings} - A copy of the FeatureLayerSettings object
|
|
1340
1398
|
*/
|
|
1341
1399
|
static copy(model) {
|
|
1342
1400
|
const result = new FeatureLayerSettings();
|
|
@@ -1348,43 +1406,56 @@ class FeatureLayerSettings {
|
|
|
1348
1406
|
return result;
|
|
1349
1407
|
}
|
|
1350
1408
|
/**
|
|
1351
|
-
|
|
1352
|
-
*
|
|
1409
|
+
* Sets the z-index value for the FeatureLayerSettings object.
|
|
1410
|
+
*
|
|
1411
|
+
* @param {number} zIndex - The new z-index value.
|
|
1412
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
|
|
1353
1413
|
*/
|
|
1354
1414
|
setZIndex(zIndex) {
|
|
1355
1415
|
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
1356
1416
|
}
|
|
1357
1417
|
/**
|
|
1358
|
-
*
|
|
1359
|
-
*
|
|
1418
|
+
* Sets the name of the FeatureLayerSettings.
|
|
1419
|
+
*
|
|
1420
|
+
* @param {string} name - The name to set for the FeatureLayerSettings.
|
|
1421
|
+
*
|
|
1422
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new name.
|
|
1360
1423
|
*/
|
|
1361
1424
|
setName(name) {
|
|
1362
1425
|
return FeatureLayerSettings.copy({ ...this, name });
|
|
1363
1426
|
}
|
|
1364
1427
|
/**
|
|
1365
|
-
*
|
|
1366
|
-
*
|
|
1428
|
+
* Sets the maximum zoom level for the FeatureLayerSettings.
|
|
1429
|
+
*
|
|
1430
|
+
* @param {number} maxZoom - The maximum zoom level.
|
|
1431
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
|
|
1367
1432
|
*/
|
|
1368
1433
|
setMaxZoom(maxZoom) {
|
|
1369
1434
|
return FeatureLayerSettings.copy({ ...this, maxZoom });
|
|
1370
1435
|
}
|
|
1371
1436
|
/**
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1437
|
+
* Sets the minimum zoom level for the feature layer.
|
|
1438
|
+
*
|
|
1439
|
+
* @param {number} minZoom The minimum zoom level to be set.
|
|
1440
|
+
* @returns {FeatureLayerSettings} The updated feature layer settings object.
|
|
1374
1441
|
*/
|
|
1375
1442
|
setMinZoom(minZoom) {
|
|
1376
1443
|
return FeatureLayerSettings.copy({ ...this, minZoom });
|
|
1377
1444
|
}
|
|
1378
1445
|
/**
|
|
1379
|
-
*
|
|
1380
|
-
*
|
|
1446
|
+
* Sets the style for the FeatureLayerSettings object.
|
|
1447
|
+
*
|
|
1448
|
+
* @param {Style | StyleFunction} style - The new style to set. It can be either a Style object or a StyleFunction.
|
|
1449
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new style.
|
|
1381
1450
|
*/
|
|
1382
1451
|
setStyle(style) {
|
|
1383
1452
|
return FeatureLayerSettings.copy({ ...this, style });
|
|
1384
1453
|
}
|
|
1385
1454
|
/**
|
|
1386
|
-
* Checks if the
|
|
1387
|
-
*
|
|
1455
|
+
* Checks if the given FeatureLayerSettings object is identical to the current object.
|
|
1456
|
+
*
|
|
1457
|
+
* @param {FeatureLayerSettings} model - The FeatureLayerSettings object to compare with.
|
|
1458
|
+
* @return {boolean} - Returns true if the given object is identical to the current object, otherwise false.
|
|
1388
1459
|
*/
|
|
1389
1460
|
isSame(model) {
|
|
1390
1461
|
if (this.maxZoom !== model.maxZoom)
|
|
@@ -1429,24 +1500,24 @@ class FeatureLayerComponent extends DestructibleComponent {
|
|
|
1429
1500
|
postboy;
|
|
1430
1501
|
factory;
|
|
1431
1502
|
layer = null;
|
|
1432
|
-
_settings = new FeatureLayerSettings();
|
|
1433
1503
|
constructor(postboy, factory) {
|
|
1434
1504
|
super();
|
|
1435
1505
|
this.postboy = postboy;
|
|
1436
1506
|
this.factory = factory;
|
|
1437
1507
|
}
|
|
1438
|
-
|
|
1439
|
-
this.postboy
|
|
1440
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1441
|
-
.pipe(filter((m) => !!m), first())
|
|
1442
|
-
.subscribe((m) => this.initLayer());
|
|
1443
|
-
}
|
|
1508
|
+
_settings = new FeatureLayerSettings();
|
|
1444
1509
|
set settings(value) {
|
|
1445
1510
|
if (!value || this._settings.isSame(value))
|
|
1446
1511
|
return;
|
|
1447
1512
|
this._settings = value;
|
|
1448
1513
|
this.initLayer();
|
|
1449
1514
|
}
|
|
1515
|
+
ngOnInit() {
|
|
1516
|
+
this.postboy
|
|
1517
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1518
|
+
.pipe(filter((m) => !!m), first())
|
|
1519
|
+
.subscribe((m) => this.initLayer());
|
|
1520
|
+
}
|
|
1450
1521
|
onDestroy = () => this.removeLayer();
|
|
1451
1522
|
initLayer() {
|
|
1452
1523
|
this.removeLayer();
|
|
@@ -1470,12 +1541,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1470
1541
|
class ClusterLayerSettings {
|
|
1471
1542
|
name = IdGenerator.get();
|
|
1472
1543
|
zIndex = 1;
|
|
1544
|
+
/**
|
|
1545
|
+
* The maximum view zoom level (inclusive) at which this layer will be visible.
|
|
1546
|
+
*
|
|
1547
|
+
* @type {number}
|
|
1548
|
+
* @default 19
|
|
1549
|
+
*/
|
|
1473
1550
|
maxZoom = 19;
|
|
1551
|
+
/**
|
|
1552
|
+
* The minimum view zoom level (exclusive) at which this layer will be visible.
|
|
1553
|
+
*
|
|
1554
|
+
* @type {number}
|
|
1555
|
+
*/
|
|
1474
1556
|
minZoom = 0;
|
|
1557
|
+
/**
|
|
1558
|
+
* Distance in pixels within which features will be clustered together.
|
|
1559
|
+
*
|
|
1560
|
+
* @type {number}
|
|
1561
|
+
*/
|
|
1475
1562
|
distance = 20;
|
|
1476
1563
|
bbox = false;
|
|
1477
1564
|
clusterCancel = 14;
|
|
1478
1565
|
style;
|
|
1566
|
+
/**
|
|
1567
|
+
* Creates a copy of the given ClusterLayerSettings object.
|
|
1568
|
+
*
|
|
1569
|
+
* @param {ClusterLayerSettings} model - The ClusterLayerSettings object to be copied.
|
|
1570
|
+
* @returns {ClusterLayerSettings} - A new ClusterLayerSettings object that is a copy of the original object.
|
|
1571
|
+
*/
|
|
1479
1572
|
static copy(model) {
|
|
1480
1573
|
const result = new ClusterLayerSettings();
|
|
1481
1574
|
result.name = model.name;
|
|
@@ -1488,30 +1581,86 @@ class ClusterLayerSettings {
|
|
|
1488
1581
|
result.style = model.style;
|
|
1489
1582
|
return result;
|
|
1490
1583
|
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Set the z-index for the ClusterLayer.
|
|
1586
|
+
*
|
|
1587
|
+
* @param {number} zIndex - The new z-index for the ClusterLayer.
|
|
1588
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1589
|
+
*/
|
|
1491
1590
|
setZIndex(zIndex) {
|
|
1492
1591
|
return ClusterLayerSettings.copy({ ...this, zIndex });
|
|
1493
1592
|
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Sets the distance value for ClusterLayerSettings.
|
|
1595
|
+
*
|
|
1596
|
+
* @param {number} distance - The distance value to be set.
|
|
1597
|
+
* @return {ClusterLayerSettings} - The modified ClusterLayerSettings object.
|
|
1598
|
+
*/
|
|
1494
1599
|
setDistance(distance) {
|
|
1495
1600
|
return ClusterLayerSettings.copy({ ...this, distance });
|
|
1496
1601
|
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Sets the name of the ClusterLayerSettings object.
|
|
1604
|
+
*
|
|
1605
|
+
* @param {string} name - The name to set for the ClusterLayerSettings.
|
|
1606
|
+
* @return {ClusterLayerSettings} - A new ClusterLayerSettings object with the updated name.
|
|
1607
|
+
*/
|
|
1497
1608
|
setName(name) {
|
|
1498
1609
|
return ClusterLayerSettings.copy({ ...this, name });
|
|
1499
1610
|
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Sets the maximum zoom level for the Cluster Layer.
|
|
1613
|
+
*
|
|
1614
|
+
* @param {number} maxZoom - The maximum zoom level to be set.
|
|
1615
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1616
|
+
*/
|
|
1500
1617
|
setMaxZoom(maxZoom) {
|
|
1501
1618
|
return ClusterLayerSettings.copy({ ...this, maxZoom });
|
|
1502
1619
|
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Sets the minimum zoom level for the ClusterLayerSettings.
|
|
1622
|
+
*
|
|
1623
|
+
* @param {number} minZoom - The minimum zoom level to set.
|
|
1624
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1625
|
+
*/
|
|
1503
1626
|
setMinZoom(minZoom) {
|
|
1504
1627
|
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1505
1628
|
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Sets the cluster cancel number for the ClusterLayerSettings.
|
|
1631
|
+
*
|
|
1632
|
+
* @param {number} clusterCancel - The new cluster cancel number.
|
|
1633
|
+
* @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1634
|
+
*/
|
|
1506
1635
|
setClusterCancel(clusterCancel) {
|
|
1507
1636
|
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
1508
1637
|
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Sets the value of 'bbox' property in the ClusterLayerSettings object.
|
|
1640
|
+
*
|
|
1641
|
+
* @param {boolean} bbox - A boolean value indicating whether to include bounding box calculation in the cluster layer settings.
|
|
1642
|
+
* @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object with the newly set 'bbox' value.
|
|
1643
|
+
*/
|
|
1509
1644
|
setBbox(bbox) {
|
|
1510
1645
|
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1511
1646
|
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Sets the style for the ClusterLayerSettings.
|
|
1649
|
+
*
|
|
1650
|
+
* @param {function} style - A function that takes an array of identified features as input and returns a Style or StyleFunction.
|
|
1651
|
+
*
|
|
1652
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object with the new style applied.
|
|
1653
|
+
*/
|
|
1512
1654
|
setStyle(style) {
|
|
1513
1655
|
return ClusterLayerSettings.copy({ ...this, style });
|
|
1514
1656
|
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Checks if the current ClusterLayerSettings object is the same as the specified model.
|
|
1659
|
+
*
|
|
1660
|
+
* @param {ClusterLayerSettings} model - The model to compare with the current object.
|
|
1661
|
+
*
|
|
1662
|
+
* @return {boolean} - Returns true if the current ClusterLayerSettings object is the same as the specified model, otherwise false.
|
|
1663
|
+
*/
|
|
1515
1664
|
isSame(model) {
|
|
1516
1665
|
if (this.maxZoom !== model.maxZoom)
|
|
1517
1666
|
return false;
|
|
@@ -1616,28 +1765,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1616
1765
|
}]
|
|
1617
1766
|
}] });
|
|
1618
1767
|
|
|
1768
|
+
/**
|
|
1769
|
+
* Represents a cluster layer component.
|
|
1770
|
+
*/
|
|
1619
1771
|
class ClusterLayerComponent extends DestructibleComponent {
|
|
1620
1772
|
postboy;
|
|
1621
1773
|
factory;
|
|
1622
1774
|
manager = null;
|
|
1623
|
-
_settings = new ClusterLayerSettings();
|
|
1624
1775
|
constructor(postboy, factory) {
|
|
1625
1776
|
super();
|
|
1626
1777
|
this.postboy = postboy;
|
|
1627
1778
|
this.factory = factory;
|
|
1628
1779
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1780
|
+
_settings = new ClusterLayerSettings();
|
|
1781
|
+
/**
|
|
1782
|
+
* Sets the settings for the cluster layer.
|
|
1783
|
+
*
|
|
1784
|
+
* @param {ClusterLayerSettings | undefined} value - The settings for the cluster layer.
|
|
1785
|
+
*/
|
|
1635
1786
|
set settings(value) {
|
|
1636
1787
|
if (!value || this._settings.isSame(value))
|
|
1637
1788
|
return;
|
|
1638
1789
|
this._settings = value;
|
|
1639
1790
|
this.initLayer();
|
|
1640
1791
|
}
|
|
1792
|
+
ngOnInit() {
|
|
1793
|
+
this.postboy
|
|
1794
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1795
|
+
.pipe(filter((m) => !!m), first())
|
|
1796
|
+
.subscribe((m) => this.initLayer());
|
|
1797
|
+
}
|
|
1641
1798
|
onDestroy = () => this.removeLayer();
|
|
1642
1799
|
initLayer() {
|
|
1643
1800
|
this.removeLayer();
|
|
@@ -1689,6 +1846,7 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1689
1846
|
detector;
|
|
1690
1847
|
map;
|
|
1691
1848
|
osmUrl = '';
|
|
1849
|
+
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1692
1850
|
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1693
1851
|
super();
|
|
1694
1852
|
this.elementRef = elementRef;
|
|
@@ -1699,7 +1857,6 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1699
1857
|
registrator.up();
|
|
1700
1858
|
}
|
|
1701
1859
|
_settings = new MapSettings();
|
|
1702
|
-
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1703
1860
|
set settings(value) {
|
|
1704
1861
|
if (!value || this._settings.isSame(value))
|
|
1705
1862
|
return;
|
|
@@ -1717,6 +1874,9 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1717
1874
|
});
|
|
1718
1875
|
this.setOsm();
|
|
1719
1876
|
}
|
|
1877
|
+
onDestroy = () => {
|
|
1878
|
+
this.registrator.down();
|
|
1879
|
+
};
|
|
1720
1880
|
setOsm() {
|
|
1721
1881
|
if (!this.map)
|
|
1722
1882
|
return;
|
|
@@ -1724,9 +1884,6 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1724
1884
|
this.detector.detectChanges();
|
|
1725
1885
|
this.map.updateSize();
|
|
1726
1886
|
}
|
|
1727
|
-
onDestroy = () => {
|
|
1728
|
-
this.registrator.down();
|
|
1729
|
-
};
|
|
1730
1887
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1731
1888
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapPlateComponent, selector: "art-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1732
1889
|
MessageRegistratorService,
|
|
@@ -1759,6 +1916,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1759
1916
|
type: Input
|
|
1760
1917
|
}] } });
|
|
1761
1918
|
|
|
1919
|
+
/**
|
|
1920
|
+
* MarkersComponent is a component that displays markers on a map.
|
|
1921
|
+
* It listens for changes in the `markers` input property and
|
|
1922
|
+
* automatically puts the markers on the map using the MapPostboyService.
|
|
1923
|
+
*/
|
|
1762
1924
|
class MarkersComponent extends DestructibleComponent {
|
|
1763
1925
|
postboy;
|
|
1764
1926
|
layerName = '';
|
|
@@ -1767,6 +1929,11 @@ class MarkersComponent extends DestructibleComponent {
|
|
|
1767
1929
|
this.postboy = postboy;
|
|
1768
1930
|
}
|
|
1769
1931
|
_markers = [];
|
|
1932
|
+
/**
|
|
1933
|
+
* Sets the markers property.
|
|
1934
|
+
*
|
|
1935
|
+
* @param {MarkerModel[]} value - The array of MarkerModel objects to set as markers.
|
|
1936
|
+
*/
|
|
1770
1937
|
set markers(value) {
|
|
1771
1938
|
this._markers = value ?? [];
|
|
1772
1939
|
this.putMarkers();
|
|
@@ -1797,7 +1964,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1797
1964
|
class TooltipSettings {
|
|
1798
1965
|
id;
|
|
1799
1966
|
containerClass = 'custom-tooltip-class';
|
|
1800
|
-
show = (e) => true;
|
|
1801
1967
|
constructor(id) {
|
|
1802
1968
|
this.id = id ?? IdGenerator.get();
|
|
1803
1969
|
}
|
|
@@ -1807,6 +1973,7 @@ class TooltipSettings {
|
|
|
1807
1973
|
result.containerClass = model.containerClass;
|
|
1808
1974
|
return result;
|
|
1809
1975
|
}
|
|
1976
|
+
show = (e) => true;
|
|
1810
1977
|
setShow(show) {
|
|
1811
1978
|
return TooltipSettings.copy({ ...this, show });
|
|
1812
1979
|
}
|
|
@@ -1828,26 +1995,41 @@ class TooltipComponent extends DestructibleComponent {
|
|
|
1828
1995
|
postboy;
|
|
1829
1996
|
detector;
|
|
1830
1997
|
container;
|
|
1831
|
-
_settings = new TooltipSettings();
|
|
1832
|
-
map;
|
|
1833
1998
|
overlay;
|
|
1834
1999
|
show = false;
|
|
2000
|
+
map;
|
|
2001
|
+
constructor(postboy, detector) {
|
|
2002
|
+
super();
|
|
2003
|
+
this.postboy = postboy;
|
|
2004
|
+
this.detector = detector;
|
|
2005
|
+
}
|
|
2006
|
+
_settings = new TooltipSettings();
|
|
1835
2007
|
set settings(value) {
|
|
1836
2008
|
if (!value || this._settings.isSame(value))
|
|
1837
2009
|
return;
|
|
1838
2010
|
this._settings = value;
|
|
1839
2011
|
this.detector.detectChanges();
|
|
1840
2012
|
}
|
|
1841
|
-
constructor(postboy, detector) {
|
|
1842
|
-
super();
|
|
1843
|
-
this.postboy = postboy;
|
|
1844
|
-
this.detector = detector;
|
|
1845
|
-
}
|
|
1846
2013
|
ngOnInit() {
|
|
1847
2014
|
this.subs.push(this.observeMapRender());
|
|
1848
2015
|
this.subs.push(this.observeMapClick());
|
|
1849
2016
|
this.subs.push(this.observeClose());
|
|
1850
2017
|
}
|
|
2018
|
+
addOverlay(coordinates) {
|
|
2019
|
+
this.removeOverlay();
|
|
2020
|
+
this.overlay = new Overlay(this.options(coordinates));
|
|
2021
|
+
this.map?.addOverlay(this.overlay);
|
|
2022
|
+
this.show = true;
|
|
2023
|
+
this.detector.detectChanges();
|
|
2024
|
+
}
|
|
2025
|
+
options = (coordinates) => {
|
|
2026
|
+
return {
|
|
2027
|
+
element: this.container?.nativeElement,
|
|
2028
|
+
autoPan: false,
|
|
2029
|
+
autoPanAnimation: { duration: 0 },
|
|
2030
|
+
position: coordinates,
|
|
2031
|
+
};
|
|
2032
|
+
};
|
|
1851
2033
|
observeMapClick() {
|
|
1852
2034
|
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1853
2035
|
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
@@ -1868,21 +2050,6 @@ class TooltipComponent extends DestructibleComponent {
|
|
|
1868
2050
|
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
1869
2051
|
this.show = false;
|
|
1870
2052
|
};
|
|
1871
|
-
addOverlay(coordinates) {
|
|
1872
|
-
this.removeOverlay();
|
|
1873
|
-
this.overlay = new Overlay(this.options(coordinates));
|
|
1874
|
-
this.map?.addOverlay(this.overlay);
|
|
1875
|
-
this.show = true;
|
|
1876
|
-
this.detector.detectChanges();
|
|
1877
|
-
}
|
|
1878
|
-
options = (coordinates) => {
|
|
1879
|
-
return {
|
|
1880
|
-
element: this.container?.nativeElement,
|
|
1881
|
-
autoPan: false,
|
|
1882
|
-
autoPanAnimation: { duration: 0 },
|
|
1883
|
-
position: coordinates,
|
|
1884
|
-
};
|
|
1885
|
-
};
|
|
1886
2053
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1887
2054
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TooltipComponent, selector: "art-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1888
2055
|
}
|
|
@@ -1896,6 +2063,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1896
2063
|
type: Input
|
|
1897
2064
|
}] } });
|
|
1898
2065
|
|
|
2066
|
+
/**
|
|
2067
|
+
* Component for rendering polygons on a map.
|
|
2068
|
+
* It listens for changes in the `polygons` input property and
|
|
2069
|
+
* automatically puts the polygons on the map using the MapPostboyService.
|
|
2070
|
+
*/
|
|
1899
2071
|
class PolygonsComponent extends DestructibleComponent {
|
|
1900
2072
|
postboy;
|
|
1901
2073
|
layerName = '';
|
|
@@ -1904,6 +2076,11 @@ class PolygonsComponent extends DestructibleComponent {
|
|
|
1904
2076
|
this.postboy = postboy;
|
|
1905
2077
|
}
|
|
1906
2078
|
_polygons = [];
|
|
2079
|
+
/**
|
|
2080
|
+
* Sets the value of polygons.
|
|
2081
|
+
*
|
|
2082
|
+
* @param {PolygonModel[]} value - The new value for polygons.
|
|
2083
|
+
*/
|
|
1907
2084
|
set polygons(value) {
|
|
1908
2085
|
this._polygons = value ?? [];
|
|
1909
2086
|
this.putPolygons();
|
|
@@ -1931,12 +2108,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1931
2108
|
type: Input
|
|
1932
2109
|
}] } });
|
|
1933
2110
|
|
|
2111
|
+
/**
|
|
2112
|
+
* Represents the settings for a zoom control.
|
|
2113
|
+
*/
|
|
1934
2114
|
class ZoomControlSettings {
|
|
2115
|
+
/**
|
|
2116
|
+
* The CSS class name of the control element.
|
|
2117
|
+
*
|
|
2118
|
+
* @type {string}
|
|
2119
|
+
*/
|
|
1935
2120
|
controlClass = 'ol-zoom';
|
|
2121
|
+
/**
|
|
2122
|
+
* The CSS class name for zoom in button.
|
|
2123
|
+
* @type {string}
|
|
2124
|
+
*/
|
|
1936
2125
|
zoomInClass = 'ol-zoom-in';
|
|
2126
|
+
/**
|
|
2127
|
+
* The CSS class name for the zoom out button element.
|
|
2128
|
+
*
|
|
2129
|
+
* @type {string}
|
|
2130
|
+
*/
|
|
1937
2131
|
zoomOutClass = 'ol-zoom-out';
|
|
2132
|
+
/**
|
|
2133
|
+
* The label for the zoom in action.
|
|
2134
|
+
*
|
|
2135
|
+
* @type {string}
|
|
2136
|
+
*/
|
|
1938
2137
|
zoomInLabel = 'Zoom In';
|
|
2138
|
+
/**
|
|
2139
|
+
* The label for the zoom out control.
|
|
2140
|
+
*
|
|
2141
|
+
* @type {string}
|
|
2142
|
+
*/
|
|
1939
2143
|
zoomOutLabel = 'Zoom Out';
|
|
2144
|
+
/**
|
|
2145
|
+
* Copies the provided ZoomControlSettings object.
|
|
2146
|
+
*
|
|
2147
|
+
* @param {ZoomControlSettings} model - The ZoomControlSettings object to be copied.
|
|
2148
|
+
* @return {ZoomControlSettings} - The copied ZoomControlSettings object.
|
|
2149
|
+
*/
|
|
1940
2150
|
static copy(model) {
|
|
1941
2151
|
const result = new ZoomControlSettings();
|
|
1942
2152
|
result.controlClass = model.controlClass;
|
|
@@ -1946,6 +2156,13 @@ class ZoomControlSettings {
|
|
|
1946
2156
|
result.zoomOutLabel = model.zoomOutLabel;
|
|
1947
2157
|
return result;
|
|
1948
2158
|
}
|
|
2159
|
+
/**
|
|
2160
|
+
* Checks if the current ZoomControlSettings object is equal to the given model.
|
|
2161
|
+
*
|
|
2162
|
+
* @param {ZoomControlSettings} model - The ZoomControlSettings object to compare with.
|
|
2163
|
+
*
|
|
2164
|
+
* @return {boolean} - true if the current object is equal to the given model, false otherwise.
|
|
2165
|
+
*/
|
|
1949
2166
|
isSame(model) {
|
|
1950
2167
|
if (this.zoomInClass !== model.zoomInClass)
|
|
1951
2168
|
return false;
|
|
@@ -1959,38 +2176,86 @@ class ZoomControlSettings {
|
|
|
1959
2176
|
return false;
|
|
1960
2177
|
return true;
|
|
1961
2178
|
}
|
|
2179
|
+
/**
|
|
2180
|
+
* Sets the zoom in label of the Zoom Control Settings.
|
|
2181
|
+
*
|
|
2182
|
+
* @param {string} zoomInLabel - The label for the zoom in button.
|
|
2183
|
+
* @return {ZoomControlSettings} - The new Zoom Control Settings object with the updated zoom in label.
|
|
2184
|
+
*/
|
|
1962
2185
|
setZoomInLabel(zoomInLabel) {
|
|
1963
2186
|
return ZoomControlSettings.copy({ ...this, zoomInLabel });
|
|
1964
2187
|
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Sets the zoomOutClass property of the ZoomControlSettings object.
|
|
2190
|
+
*
|
|
2191
|
+
* @param {string} zoomOutClass - The CSS class to be assigned to the zoom out button.
|
|
2192
|
+
* @return {ZoomControlSettings} - The updated ZoomControlSettings object with the new zoomOutClass value.
|
|
2193
|
+
*/
|
|
1965
2194
|
setZoomOutClass(zoomOutClass) {
|
|
1966
2195
|
return ZoomControlSettings.copy({ ...this, zoomOutClass });
|
|
1967
2196
|
}
|
|
2197
|
+
/**
|
|
2198
|
+
* Sets the zoom in class for the zoom control settings.
|
|
2199
|
+
*
|
|
2200
|
+
* @param {string} zoomInClass - The new zoom in class to be set.
|
|
2201
|
+
* @return {ZoomControlSettings} - The updated zoom control settings.
|
|
2202
|
+
*/
|
|
1968
2203
|
setZoomInClass(zoomInClass) {
|
|
1969
2204
|
return ZoomControlSettings.copy({ ...this, zoomInClass });
|
|
1970
2205
|
}
|
|
2206
|
+
/**
|
|
2207
|
+
* Set the label for the zoom out control.
|
|
2208
|
+
*
|
|
2209
|
+
* @param {string} zoomOutLabel - The label for the zoom out control.
|
|
2210
|
+
* @returns {ZoomControlSettings} - The updated zoom control settings.
|
|
2211
|
+
*/
|
|
1971
2212
|
setZoomOutLabel(zoomOutLabel) {
|
|
1972
2213
|
return ZoomControlSettings.copy({ ...this, zoomOutLabel });
|
|
1973
2214
|
}
|
|
2215
|
+
/**
|
|
2216
|
+
* Sets the control class for the ZoomControlSettings.
|
|
2217
|
+
*
|
|
2218
|
+
* @param {string} controlClass - The class name of the control to be set.
|
|
2219
|
+
*
|
|
2220
|
+
* @return {ZoomControlSettings} - The modified ZoomControlSettings object.
|
|
2221
|
+
*/
|
|
1974
2222
|
setControlClass(controlClass) {
|
|
1975
2223
|
return ZoomControlSettings.copy({ ...this, controlClass });
|
|
1976
2224
|
}
|
|
1977
2225
|
}
|
|
1978
2226
|
|
|
2227
|
+
/**
|
|
2228
|
+
* @class
|
|
2229
|
+
* @classdesc Represents a component for the Zoom control on a map.
|
|
2230
|
+
* @extends DestructibleComponent
|
|
2231
|
+
* @implements OnInit
|
|
2232
|
+
*/
|
|
1979
2233
|
class MapControlZoomComponent extends DestructibleComponent {
|
|
1980
2234
|
postboy;
|
|
1981
|
-
_settings = new ZoomControlSettings();
|
|
1982
2235
|
map;
|
|
1983
2236
|
control;
|
|
2237
|
+
constructor(postboy) {
|
|
2238
|
+
super();
|
|
2239
|
+
this.postboy = postboy;
|
|
2240
|
+
}
|
|
2241
|
+
_settings = new ZoomControlSettings();
|
|
2242
|
+
/**
|
|
2243
|
+
* Sets the settings for the Zoom Control.
|
|
2244
|
+
*
|
|
2245
|
+
* @param {ZoomControlSettings | undefined} value - The new settings for the Zoom Control.
|
|
2246
|
+
*
|
|
2247
|
+
* @description
|
|
2248
|
+
* This method sets the settings for the Zoom Control. It takes a parameter `value` which should be an object of type `ZoomControlSettings` or `undefined`.
|
|
2249
|
+
*
|
|
2250
|
+
* If the `value` is `undefined` or the same as the current settings, the method will return without making any changes.
|
|
2251
|
+
*
|
|
2252
|
+
*/
|
|
1984
2253
|
set settings(value) {
|
|
1985
2254
|
if (!value || this._settings.isSame(value))
|
|
1986
2255
|
return;
|
|
1987
2256
|
this._settings = value;
|
|
1988
2257
|
this.setControl();
|
|
1989
2258
|
}
|
|
1990
|
-
constructor(postboy) {
|
|
1991
|
-
super();
|
|
1992
|
-
this.postboy = postboy;
|
|
1993
|
-
}
|
|
1994
2259
|
ngOnInit() {
|
|
1995
2260
|
this.postboy
|
|
1996
2261
|
.subscribe(MapRenderedEvent.ID)
|
|
@@ -2000,15 +2265,15 @@ class MapControlZoomComponent extends DestructibleComponent {
|
|
|
2000
2265
|
this.setControl();
|
|
2001
2266
|
});
|
|
2002
2267
|
}
|
|
2268
|
+
onDestroy = () => {
|
|
2269
|
+
this.eliminate();
|
|
2270
|
+
};
|
|
2003
2271
|
setControl() {
|
|
2004
2272
|
if (!this.map)
|
|
2005
2273
|
return;
|
|
2006
2274
|
this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
|
|
2007
2275
|
this.map.addControl(this.control);
|
|
2008
2276
|
}
|
|
2009
|
-
onDestroy = () => {
|
|
2010
|
-
this.eliminate();
|
|
2011
|
-
};
|
|
2012
2277
|
eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
|
|
2013
2278
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2014
2279
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapControlZoomComponent, selector: "art-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -2070,7 +2335,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
2070
2335
|
}]
|
|
2071
2336
|
}] });
|
|
2072
2337
|
|
|
2338
|
+
/**
|
|
2339
|
+
* Helper class to create and modify marker styles.
|
|
2340
|
+
*/
|
|
2073
2341
|
class MarkerStyleHelper {
|
|
2342
|
+
/**
|
|
2343
|
+
* Creates a new Style object from an SVG.
|
|
2344
|
+
* @param {string} svg - The SVG string.
|
|
2345
|
+
* @param {Array<number>} [size=[30, 30]] - The size of the icon image.
|
|
2346
|
+
* @param {number} [zIndex=400] - The zIndex of the style.
|
|
2347
|
+
* @returns {Style} A new Style object.
|
|
2348
|
+
*/
|
|
2074
2349
|
static fromSvg(svg, size = [30, 30], zIndex = 400) {
|
|
2075
2350
|
let image = new Image();
|
|
2076
2351
|
image.src = 'data:image/svg+xml,' + escape(svg);
|
|
@@ -2082,6 +2357,15 @@ class MarkerStyleHelper {
|
|
|
2082
2357
|
zIndex,
|
|
2083
2358
|
});
|
|
2084
2359
|
}
|
|
2360
|
+
/**
|
|
2361
|
+
* Returns a Style object with a circle style.
|
|
2362
|
+
*
|
|
2363
|
+
* @param {number} radius - The radius of the circle.
|
|
2364
|
+
* @param {string} fill - The fill color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
|
|
2365
|
+
* @param {string} strokeColor - The stroke color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
|
|
2366
|
+
* @param {number} [strokeWidth=1] - The width of the stroke. Default is 1.
|
|
2367
|
+
* @returns {Style} - A Style object with a Circle image.
|
|
2368
|
+
*/
|
|
2085
2369
|
static circle(radius, fill, strokeColor, strokeWidth = 1) {
|
|
2086
2370
|
return new Style({
|
|
2087
2371
|
image: new Circle({
|
|
@@ -2091,13 +2375,32 @@ class MarkerStyleHelper {
|
|
|
2091
2375
|
}),
|
|
2092
2376
|
});
|
|
2093
2377
|
}
|
|
2378
|
+
/**
|
|
2379
|
+
* Applies the given Text to the provided Style.
|
|
2380
|
+
*
|
|
2381
|
+
* @param {Style} style - The Style to modify.
|
|
2382
|
+
* @param {Text} text - The Text to apply to the Style.
|
|
2383
|
+
* @return {Style} - The modified Style with the applied Text.
|
|
2384
|
+
*/
|
|
2094
2385
|
static withText(style, text) {
|
|
2095
2386
|
style.setText(text);
|
|
2096
2387
|
return style;
|
|
2097
2388
|
}
|
|
2098
2389
|
}
|
|
2099
2390
|
|
|
2391
|
+
/**
|
|
2392
|
+
* A helper class for creating polygon styles.
|
|
2393
|
+
* @class
|
|
2394
|
+
*/
|
|
2100
2395
|
class PolygonStyleHelper {
|
|
2396
|
+
/**
|
|
2397
|
+
* Creates a Style object with the given fill color, stroke color, and stroke width.
|
|
2398
|
+
*
|
|
2399
|
+
* @param {string} fill - The fill color in hexadecimal or RGB format.
|
|
2400
|
+
* @param {string} stroke - The stroke color in hexadecimal or RGB format.
|
|
2401
|
+
* @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
|
|
2402
|
+
* @return {Style} The created Style object.
|
|
2403
|
+
*/
|
|
2101
2404
|
static simple(fill, stroke, strokeWidth = 1) {
|
|
2102
2405
|
return new Style({
|
|
2103
2406
|
fill: new Fill({
|
|
@@ -2109,6 +2412,15 @@ class PolygonStyleHelper {
|
|
|
2109
2412
|
}),
|
|
2110
2413
|
});
|
|
2111
2414
|
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Creates a new Style object with the given fill, stroke, stroke width, and pin radius.
|
|
2417
|
+
*
|
|
2418
|
+
* @param {string} fill - The color to use for the fill of the style.
|
|
2419
|
+
* @param {string} stroke - The color to use for the stroke of the style.
|
|
2420
|
+
* @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
|
|
2421
|
+
* @param {number} [pinRadius=5] - The radius of the circle used as the image for the style. Defaults to 5.
|
|
2422
|
+
* @returns {Style} - The newly created Style object.
|
|
2423
|
+
*/
|
|
2112
2424
|
static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
|
|
2113
2425
|
return new Style({
|
|
2114
2426
|
image: new Circle({
|
|
@@ -2128,7 +2440,18 @@ class PolygonStyleHelper {
|
|
|
2128
2440
|
}
|
|
2129
2441
|
}
|
|
2130
2442
|
|
|
2443
|
+
/**
|
|
2444
|
+
* Helper class for creating text styles.
|
|
2445
|
+
*/
|
|
2131
2446
|
class TextStyleHelper {
|
|
2447
|
+
/**
|
|
2448
|
+
* Creates a new instance of the Text class with the specified properties.
|
|
2449
|
+
*
|
|
2450
|
+
* @param {string} text - The text content of the Text object.
|
|
2451
|
+
* @param {string} font - The font style of the Text object.
|
|
2452
|
+
* @param {string} color - The color of the Text object.
|
|
2453
|
+
* @return {Text} A new instance of the Text class.
|
|
2454
|
+
*/
|
|
2132
2455
|
static get(text, font, color) {
|
|
2133
2456
|
return new Text({
|
|
2134
2457
|
text: text,
|
|
@@ -2141,37 +2464,41 @@ class TextStyleHelper {
|
|
|
2141
2464
|
}
|
|
2142
2465
|
}
|
|
2143
2466
|
|
|
2467
|
+
/**
|
|
2468
|
+
* A helper class for converting and stringify features.
|
|
2469
|
+
*/
|
|
2144
2470
|
class StringifyFeatureHelper {
|
|
2145
2471
|
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2146
2472
|
return format === FeatureOutputFormat.GeoJson
|
|
2147
2473
|
? new GeoJSON().writeFeature(feature)
|
|
2148
2474
|
: new WKT().writeFeature(feature);
|
|
2149
2475
|
}
|
|
2476
|
+
/**
|
|
2477
|
+
* Creates a polygon feature representing a circle based on a given feature with a circle geometry.
|
|
2478
|
+
*
|
|
2479
|
+
* @param {Feature<Geometry>} feature - The input feature with a circle geometry.
|
|
2480
|
+
* @param {FeatureOutputFormat} format - The format for outputting the polygon feature. (default: FeatureOutputFormat.GeoJson)
|
|
2481
|
+
*
|
|
2482
|
+
* @return {string} - The string representation of the polygon feature.
|
|
2483
|
+
*/
|
|
2150
2484
|
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2151
|
-
// const clone = feature.clone();
|
|
2152
|
-
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
2153
|
-
const tetemp = feature.getGeometryName();
|
|
2154
2485
|
const circle = feature.getGeometry();
|
|
2155
|
-
|
|
2156
|
-
const
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
2160
|
-
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
2486
|
+
const ext = feature.getGeometry().getExtent();
|
|
2487
|
+
const coords = [
|
|
2488
|
+
...transform([ext[0], ext[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
2489
|
+
...transform([ext[2], ext[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
2161
2490
|
];
|
|
2162
|
-
const radius = (
|
|
2163
|
-
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
2491
|
+
const radius = (coords[2] - coords[0]) / 2;
|
|
2164
2492
|
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
2165
|
-
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
2166
|
-
// var wgs84Sphere = new Sphere(6378137);
|
|
2167
2493
|
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
2168
|
-
// const rad = circle.getRadius();
|
|
2169
|
-
// const degrees = 180 / Math.PI; // radians to degrees
|
|
2170
|
-
// const radians = Math.PI / 180; // degrees to radians
|
|
2171
|
-
// const rlat = rad * degrees * 1000;
|
|
2172
|
-
// const rlng = rad * radians;
|
|
2173
|
-
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
2174
2494
|
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Draw a circle based on a center point and radius.
|
|
2497
|
+
*
|
|
2498
|
+
* @param {number[]} point - The center point coordinates in EPSG:4326 format.
|
|
2499
|
+
* @param {number} radius - The radius of the circle in meters.
|
|
2500
|
+
* @return {Coordinate[][]} - The coordinates of the circle boundary in EPSG:4326 format.
|
|
2501
|
+
*/
|
|
2175
2502
|
static drawCircle(point, radius) {
|
|
2176
2503
|
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
2177
2504
|
// const tetetemp = point;
|
|
@@ -2204,5 +2531,5 @@ class StringifyFeatureHelper {
|
|
|
2204
2531
|
* Generated bundle index. Do not edit.
|
|
2205
2532
|
*/
|
|
2206
2533
|
|
|
2207
|
-
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings,
|
|
2534
|
+
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FitToPolygonsCommand, MapClickEvent, MapControl, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
2208
2535
|
//# sourceMappingURL=maps-components.mjs.map
|