@artstesh/maps 6.0.1 → 6.0.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/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/fit-to-polygons.command.mjs +1 -1
- package/dist/esm2022/map/messages/events/map-move-end.event.mjs +4 -6
- package/dist/esm2022/map/messages/executors/get-map-position.executor.mjs +16 -0
- package/dist/esm2022/map/messages/index.mjs +2 -1
- package/dist/esm2022/map/models/index.mjs +2 -1
- package/dist/esm2022/map/models/map-control.mjs +2 -2
- package/dist/esm2022/map/models/map-position.model.mjs +2 -0
- 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/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 +1 -1
- package/dist/esm2022/map/services/map-state.service.mjs +11 -6
- package/dist/esm2022/map/services/message-registrator.service.mjs +5 -1
- 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/fit-to-polygons.command.mjs +1 -1
- package/dist/esm2022/src/map/messages/events/map-move-end.event.mjs +4 -6
- package/dist/esm2022/src/map/messages/executors/get-map-position.executor.mjs +16 -0
- package/dist/esm2022/src/map/messages/index.mjs +2 -1
- package/dist/esm2022/src/map/models/index.mjs +2 -1
- package/dist/esm2022/src/map/models/map-control.mjs +2 -2
- package/dist/esm2022/src/map/models/map-position.model.mjs +2 -0
- 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/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 +1 -1
- package/dist/esm2022/src/map/services/map-state.service.mjs +11 -6
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +5 -1
- package/dist/fesm2022/maps-components-src-map.mjs +498 -125
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +498 -125
- 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/events/map-move-end.event.d.ts +3 -3
- package/dist/map/messages/executors/get-map-position.executor.d.ts +12 -0
- package/dist/map/messages/index.d.ts +1 -0
- package/dist/map/models/index.d.ts +1 -0
- package/dist/map/models/map-control.d.ts +1 -1
- package/dist/map/models/map-position.model.d.ts +6 -0
- 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-state.service.d.ts +2 -0
- package/dist/map/services/message-registrator.service.d.ts +1 -0
- 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/events/map-move-end.event.d.ts +3 -3
- package/dist/src/map/messages/executors/get-map-position.executor.d.ts +12 -0
- package/dist/src/map/messages/index.d.ts +1 -0
- package/dist/src/map/models/index.d.ts +1 -0
- package/dist/src/map/models/map-control.d.ts +1 -1
- package/dist/src/map/models/map-position.model.d.ts +6 -0
- 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-state.service.d.ts +2 -0
- package/dist/src/map/services/message-registrator.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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';
|
|
@@ -163,17 +163,6 @@ class PolygonModel {
|
|
|
163
163
|
id;
|
|
164
164
|
lat;
|
|
165
165
|
lng;
|
|
166
|
-
_feature;
|
|
167
|
-
static fromGeoJson(id, json, info) {
|
|
168
|
-
let feature = new GeoJSON().readFeature(json);
|
|
169
|
-
feature.setId(id);
|
|
170
|
-
return new PolygonModel(feature, id, info);
|
|
171
|
-
}
|
|
172
|
-
static fromWKT(id, wkt, info) {
|
|
173
|
-
let feature = new WKT().readFeature(wkt);
|
|
174
|
-
feature.setId(id);
|
|
175
|
-
return new PolygonModel(feature, id, info);
|
|
176
|
-
}
|
|
177
166
|
constructor(feature, id, info) {
|
|
178
167
|
this.info = info;
|
|
179
168
|
this.id = id == null ? IdGenerator.get() : id;
|
|
@@ -182,9 +171,20 @@ class PolygonModel {
|
|
|
182
171
|
this._feature?.set(MapConstants.FeatureInfo, this.info);
|
|
183
172
|
[this.lng, this.lat] = getCenter(this._feature.getGeometry()?.getExtent());
|
|
184
173
|
}
|
|
174
|
+
_feature;
|
|
185
175
|
get feature() {
|
|
186
176
|
return this._feature;
|
|
187
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
|
+
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
var DrawingType;
|
|
@@ -203,7 +203,7 @@ var FeatureOutputFormat;
|
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
*
|
|
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.
|
|
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.
|
|
207
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:
|
|
208
208
|
* var myControl = new Control({element: myElement}); and then adding this to the map.
|
|
209
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.
|
|
@@ -244,13 +244,11 @@ class MapClickEvent extends PostboyGenericMessage {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
247
|
-
|
|
248
|
-
extent;
|
|
247
|
+
position;
|
|
249
248
|
static ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
250
|
-
constructor(
|
|
249
|
+
constructor(position) {
|
|
251
250
|
super();
|
|
252
|
-
this.
|
|
253
|
-
this.extent = extent;
|
|
251
|
+
this.position = position;
|
|
254
252
|
}
|
|
255
253
|
get id() {
|
|
256
254
|
return MapMoveEndEvent.ID;
|
|
@@ -406,6 +404,21 @@ class FitToPolygonsCommand extends PostboyGenericMessage {
|
|
|
406
404
|
}
|
|
407
405
|
}
|
|
408
406
|
|
|
407
|
+
/**
|
|
408
|
+
* A message that allows to get the current state of the map.
|
|
409
|
+
* If the map's state is not defined yet, the executor would return null
|
|
410
|
+
* @returns {MapPosition | null}
|
|
411
|
+
*/
|
|
412
|
+
class GetMapPositionExecutor extends PostboyExecutor {
|
|
413
|
+
static ID = '52c95689-d09b-4082-ba58-9183ea96a213';
|
|
414
|
+
get id() {
|
|
415
|
+
return GetMapPositionExecutor.ID;
|
|
416
|
+
}
|
|
417
|
+
constructor() {
|
|
418
|
+
super();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
409
422
|
class AddLayerCommand extends PostboyGenericMessage {
|
|
410
423
|
layer;
|
|
411
424
|
static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
@@ -531,6 +544,11 @@ class FeatureService {
|
|
|
531
544
|
static filterFeaturesInArea(query) {
|
|
532
545
|
return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
|
|
533
546
|
}
|
|
547
|
+
static calculateArea(g) {
|
|
548
|
+
if (!g)
|
|
549
|
+
return 0;
|
|
550
|
+
return Sphere.getArea(g, { projection: 'EPSG:4326' });
|
|
551
|
+
}
|
|
534
552
|
static booleanIntersects(g1, g2) {
|
|
535
553
|
if (g2.getType() === 'Point')
|
|
536
554
|
return g1.intersectsCoordinate(g2.getCoordinates());
|
|
@@ -540,11 +558,6 @@ class FeatureService {
|
|
|
540
558
|
return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
|
|
541
559
|
return false;
|
|
542
560
|
}
|
|
543
|
-
static calculateArea(g) {
|
|
544
|
-
if (!g)
|
|
545
|
-
return 0;
|
|
546
|
-
return Sphere.getArea(g, { projection: 'EPSG:4326' });
|
|
547
|
-
}
|
|
548
561
|
}
|
|
549
562
|
|
|
550
563
|
class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
|
|
@@ -726,6 +739,14 @@ class MapStateService {
|
|
|
726
739
|
this.observeMapRendering();
|
|
727
740
|
this.observeCenter();
|
|
728
741
|
}
|
|
742
|
+
getMapPosition() {
|
|
743
|
+
if (!this.map)
|
|
744
|
+
return null;
|
|
745
|
+
let [longitude, latitude] = this.map.getView().getCenter();
|
|
746
|
+
const zoom = Math.floor(this.map.getView().getZoom());
|
|
747
|
+
const extent = this.map.getView().calculateExtent();
|
|
748
|
+
return { longitude, latitude, zoom, extent };
|
|
749
|
+
}
|
|
729
750
|
observeMapRendering() {
|
|
730
751
|
this.postboy
|
|
731
752
|
.subscribe(MapRenderedEvent.ID)
|
|
@@ -733,9 +754,7 @@ class MapStateService {
|
|
|
733
754
|
.subscribe((ev) => {
|
|
734
755
|
this.map = ev.map;
|
|
735
756
|
this.map?.on('moveend', () => {
|
|
736
|
-
|
|
737
|
-
const extent = this.map?.getView().calculateExtent() || [];
|
|
738
|
-
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
757
|
+
this.postboy.fire(new MapMoveEndEvent(this.getMapPosition()));
|
|
739
758
|
});
|
|
740
759
|
});
|
|
741
760
|
}
|
|
@@ -811,14 +830,6 @@ class MapClickService {
|
|
|
811
830
|
up() {
|
|
812
831
|
this.observeMapRender();
|
|
813
832
|
}
|
|
814
|
-
observeMapRender() {
|
|
815
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
816
|
-
this.map = m.map;
|
|
817
|
-
this.map?.on('singleclick', (e) => {
|
|
818
|
-
this.postboy.fire(this.onClick(e));
|
|
819
|
-
});
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
833
|
onClick(ev) {
|
|
823
834
|
const model = new MapClickEvent(ev.coordinate, {}, {});
|
|
824
835
|
this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
|
|
@@ -836,6 +847,14 @@ class MapClickService {
|
|
|
836
847
|
});
|
|
837
848
|
return model;
|
|
838
849
|
}
|
|
850
|
+
observeMapRender() {
|
|
851
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
852
|
+
this.map = m.map;
|
|
853
|
+
this.map?.on('singleclick', (e) => {
|
|
854
|
+
this.postboy.fire(this.onClick(e));
|
|
855
|
+
});
|
|
856
|
+
});
|
|
857
|
+
}
|
|
839
858
|
getFeatureCollectionWithInner(features) {
|
|
840
859
|
const result = [];
|
|
841
860
|
features?.forEach((f) => {
|
|
@@ -1060,8 +1079,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1060
1079
|
}], ctorParameters: () => [{ type: MapPostboyService }] });
|
|
1061
1080
|
|
|
1062
1081
|
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
1082
|
+
state;
|
|
1063
1083
|
constructor(service, management, state, mapFeature, interaction, drawing, featureModification, controls) {
|
|
1064
1084
|
super(service);
|
|
1085
|
+
this.state = state;
|
|
1065
1086
|
this.registerServices([management, state, interaction, mapFeature, drawing, featureModification, controls]);
|
|
1066
1087
|
}
|
|
1067
1088
|
_up() {
|
|
@@ -1094,6 +1115,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1094
1115
|
this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
|
|
1095
1116
|
this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
|
|
1096
1117
|
this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
|
|
1118
|
+
this.registerExecutor(GetMapPositionExecutor.ID, () => this.state.getMapPosition());
|
|
1097
1119
|
}
|
|
1098
1120
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: FeatureModificationService }, { token: ControlsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1099
1121
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService });
|
|
@@ -1102,12 +1124,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1102
1124
|
type: Injectable
|
|
1103
1125
|
}], ctorParameters: () => [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }, { type: ControlsService }] });
|
|
1104
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* Class representing settings for a tile layer.
|
|
1129
|
+
*/
|
|
1105
1130
|
class TileLayerSettings {
|
|
1131
|
+
/**
|
|
1132
|
+
* The maximum zoom level for a map view.
|
|
1133
|
+
*
|
|
1134
|
+
* @type {number}
|
|
1135
|
+
* @default 19
|
|
1136
|
+
*/
|
|
1106
1137
|
maxZoom = 19;
|
|
1138
|
+
/**
|
|
1139
|
+
* The minimum zoom level allowed.
|
|
1140
|
+
*
|
|
1141
|
+
* @type {number}
|
|
1142
|
+
*/
|
|
1107
1143
|
minZoom = 0;
|
|
1144
|
+
/**
|
|
1145
|
+
* The opacity of an element.
|
|
1146
|
+
*
|
|
1147
|
+
* @type {number}
|
|
1148
|
+
* @default 0.6
|
|
1149
|
+
*/
|
|
1108
1150
|
opacity = 0.6;
|
|
1151
|
+
/**
|
|
1152
|
+
* Represents the tiles URL.
|
|
1153
|
+
* @typedef {string} url
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* 'https://example.ex/{z}/{x}/{y}.png'
|
|
1157
|
+
*/
|
|
1109
1158
|
url = '';
|
|
1159
|
+
/**
|
|
1160
|
+
* The projection of the coordinate system.
|
|
1161
|
+
*
|
|
1162
|
+
* @type {string}
|
|
1163
|
+
* @default 'EPSG:3857'
|
|
1164
|
+
*/
|
|
1110
1165
|
projection = 'EPSG:3857';
|
|
1166
|
+
/**
|
|
1167
|
+
* Creates a copy of the given tile layer settings.
|
|
1168
|
+
*
|
|
1169
|
+
* @param {TileLayerSettings} model - The tile layer settings to be copied.
|
|
1170
|
+
* @return {TileLayerSettings} - A new instance of TileLayerSettings with the same properties as the model.
|
|
1171
|
+
*/
|
|
1111
1172
|
static copy(model) {
|
|
1112
1173
|
const result = new TileLayerSettings();
|
|
1113
1174
|
result.maxZoom = model.maxZoom;
|
|
@@ -1117,21 +1178,57 @@ class TileLayerSettings {
|
|
|
1117
1178
|
result.url = model.url;
|
|
1118
1179
|
return result;
|
|
1119
1180
|
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Sets the URL of the TileLayerSettings object.
|
|
1183
|
+
*
|
|
1184
|
+
* @param {string} url - The URL to be set.
|
|
1185
|
+
* @return {TileLayerSettings} - The updated TileLayerSettings object.
|
|
1186
|
+
*/
|
|
1120
1187
|
setUrl(url) {
|
|
1121
1188
|
return TileLayerSettings.copy({ ...this, url });
|
|
1122
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Sets the maximum zoom level for the tile layer.
|
|
1192
|
+
*
|
|
1193
|
+
* @param {number} maxZoom - The maximum zoom level.
|
|
1194
|
+
* @returns {TileLayerSettings} - The updated tile layer settings object.
|
|
1195
|
+
*/
|
|
1123
1196
|
setMaxZoom(maxZoom) {
|
|
1124
1197
|
return TileLayerSettings.copy({ ...this, maxZoom });
|
|
1125
1198
|
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Sets the minimum zoom level for the Tile Layer.
|
|
1201
|
+
*
|
|
1202
|
+
* @param {number} minZoom - The minimum zoom level to be set.
|
|
1203
|
+
* @return {TileLayerSettings} The modified TileLayerSettings object with the updated minimum zoom level.
|
|
1204
|
+
*/
|
|
1126
1205
|
setMinZoom(minZoom) {
|
|
1127
1206
|
return TileLayerSettings.copy({ ...this, minZoom });
|
|
1128
1207
|
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Sets the opacity of the TileLayerSettings.
|
|
1210
|
+
*
|
|
1211
|
+
* @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
|
|
1212
|
+
* @return {TileLayerSettings} - A new instance of TileLayerSettings with the opacity set.
|
|
1213
|
+
*/
|
|
1129
1214
|
setOpacity(opacity) {
|
|
1130
1215
|
return TileLayerSettings.copy({ ...this, opacity });
|
|
1131
1216
|
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Sets the projection for the tile layer settings.
|
|
1219
|
+
*
|
|
1220
|
+
* @param {string} projection - The desired projection for the tile layer settings.
|
|
1221
|
+
* @return {TileLayerSettings} - The updated tile layer settings with the new projection.
|
|
1222
|
+
*/
|
|
1132
1223
|
setProjection(projection) {
|
|
1133
1224
|
return TileLayerSettings.copy({ ...this, projection });
|
|
1134
1225
|
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Checks if the current instance of TileLayerSettings is equal to the given model.
|
|
1228
|
+
* @param {TileLayerSettings} model - The model to compare against.
|
|
1229
|
+
* @return {boolean} - True if all properties of the current instance matches the properties of the model;
|
|
1230
|
+
* otherwise, false.
|
|
1231
|
+
*/
|
|
1135
1232
|
isSame(model) {
|
|
1136
1233
|
if (this.maxZoom !== model.maxZoom)
|
|
1137
1234
|
return false;
|
|
@@ -1201,12 +1298,6 @@ class TileLayerComponent extends DestructibleComponent {
|
|
|
1201
1298
|
this.postboy = postboy;
|
|
1202
1299
|
this.factory = factory;
|
|
1203
1300
|
}
|
|
1204
|
-
ngOnInit() {
|
|
1205
|
-
this.postboy
|
|
1206
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1207
|
-
.pipe(filter((m) => !!m), first())
|
|
1208
|
-
.subscribe((m) => this.initLayer());
|
|
1209
|
-
}
|
|
1210
1301
|
_settings = new TileLayerSettings();
|
|
1211
1302
|
set settings(value) {
|
|
1212
1303
|
if (!value || this._settings.isSame(value))
|
|
@@ -1214,6 +1305,12 @@ class TileLayerComponent extends DestructibleComponent {
|
|
|
1214
1305
|
this._settings = value;
|
|
1215
1306
|
this.initLayer();
|
|
1216
1307
|
}
|
|
1308
|
+
ngOnInit() {
|
|
1309
|
+
this.postboy
|
|
1310
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1311
|
+
.pipe(filter((m) => !!m), first())
|
|
1312
|
+
.subscribe((m) => this.initLayer());
|
|
1313
|
+
}
|
|
1217
1314
|
onDestroy = () => this.removeLayer();
|
|
1218
1315
|
initLayer() {
|
|
1219
1316
|
this.removeLayer();
|
|
@@ -1299,11 +1396,16 @@ class FeatureLayerSettings {
|
|
|
1299
1396
|
*/
|
|
1300
1397
|
zIndex = 1;
|
|
1301
1398
|
/**
|
|
1302
|
-
|
|
1399
|
+
The maximum view zoom level (inclusive) at which this layer will be visible.
|
|
1400
|
+
|
|
1401
|
+
@type {number}
|
|
1402
|
+
@default 19
|
|
1303
1403
|
*/
|
|
1304
1404
|
maxZoom = 19;
|
|
1305
1405
|
/**
|
|
1306
|
-
|
|
1406
|
+
The minimum view zoom level (exclusive) at which this layer will be visible.
|
|
1407
|
+
|
|
1408
|
+
@type {number}
|
|
1307
1409
|
*/
|
|
1308
1410
|
minZoom = 0;
|
|
1309
1411
|
/**
|
|
@@ -1311,8 +1413,10 @@ class FeatureLayerSettings {
|
|
|
1311
1413
|
*/
|
|
1312
1414
|
style;
|
|
1313
1415
|
/**
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1416
|
+
* Copies the given FeatureLayerSettings object
|
|
1417
|
+
*
|
|
1418
|
+
* @param {FeatureLayerSettings} model - The FeatureLayerSettings object to be copied
|
|
1419
|
+
* @returns {FeatureLayerSettings} - A copy of the FeatureLayerSettings object
|
|
1316
1420
|
*/
|
|
1317
1421
|
static copy(model) {
|
|
1318
1422
|
const result = new FeatureLayerSettings();
|
|
@@ -1324,43 +1428,56 @@ class FeatureLayerSettings {
|
|
|
1324
1428
|
return result;
|
|
1325
1429
|
}
|
|
1326
1430
|
/**
|
|
1327
|
-
|
|
1328
|
-
*
|
|
1431
|
+
* Sets the z-index value for the FeatureLayerSettings object.
|
|
1432
|
+
*
|
|
1433
|
+
* @param {number} zIndex - The new z-index value.
|
|
1434
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
|
|
1329
1435
|
*/
|
|
1330
1436
|
setZIndex(zIndex) {
|
|
1331
1437
|
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
1332
1438
|
}
|
|
1333
1439
|
/**
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
1440
|
+
* Sets the name of the FeatureLayerSettings.
|
|
1441
|
+
*
|
|
1442
|
+
* @param {string} name - The name to set for the FeatureLayerSettings.
|
|
1443
|
+
*
|
|
1444
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new name.
|
|
1336
1445
|
*/
|
|
1337
1446
|
setName(name) {
|
|
1338
1447
|
return FeatureLayerSettings.copy({ ...this, name });
|
|
1339
1448
|
}
|
|
1340
1449
|
/**
|
|
1341
|
-
*
|
|
1342
|
-
*
|
|
1450
|
+
* Sets the maximum zoom level for the FeatureLayerSettings.
|
|
1451
|
+
*
|
|
1452
|
+
* @param {number} maxZoom - The maximum zoom level.
|
|
1453
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
|
|
1343
1454
|
*/
|
|
1344
1455
|
setMaxZoom(maxZoom) {
|
|
1345
1456
|
return FeatureLayerSettings.copy({ ...this, maxZoom });
|
|
1346
1457
|
}
|
|
1347
1458
|
/**
|
|
1348
|
-
*
|
|
1349
|
-
*
|
|
1459
|
+
* Sets the minimum zoom level for the feature layer.
|
|
1460
|
+
*
|
|
1461
|
+
* @param {number} minZoom The minimum zoom level to be set.
|
|
1462
|
+
* @returns {FeatureLayerSettings} The updated feature layer settings object.
|
|
1350
1463
|
*/
|
|
1351
1464
|
setMinZoom(minZoom) {
|
|
1352
1465
|
return FeatureLayerSettings.copy({ ...this, minZoom });
|
|
1353
1466
|
}
|
|
1354
1467
|
/**
|
|
1355
|
-
*
|
|
1356
|
-
*
|
|
1468
|
+
* Sets the style for the FeatureLayerSettings object.
|
|
1469
|
+
*
|
|
1470
|
+
* @param {Style | StyleFunction} style - The new style to set. It can be either a Style object or a StyleFunction.
|
|
1471
|
+
* @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new style.
|
|
1357
1472
|
*/
|
|
1358
1473
|
setStyle(style) {
|
|
1359
1474
|
return FeatureLayerSettings.copy({ ...this, style });
|
|
1360
1475
|
}
|
|
1361
1476
|
/**
|
|
1362
|
-
* Checks if the
|
|
1363
|
-
*
|
|
1477
|
+
* Checks if the given FeatureLayerSettings object is identical to the current object.
|
|
1478
|
+
*
|
|
1479
|
+
* @param {FeatureLayerSettings} model - The FeatureLayerSettings object to compare with.
|
|
1480
|
+
* @return {boolean} - Returns true if the given object is identical to the current object, otherwise false.
|
|
1364
1481
|
*/
|
|
1365
1482
|
isSame(model) {
|
|
1366
1483
|
if (this.maxZoom !== model.maxZoom)
|
|
@@ -1405,24 +1522,24 @@ class FeatureLayerComponent extends DestructibleComponent {
|
|
|
1405
1522
|
postboy;
|
|
1406
1523
|
factory;
|
|
1407
1524
|
layer = null;
|
|
1408
|
-
_settings = new FeatureLayerSettings();
|
|
1409
1525
|
constructor(postboy, factory) {
|
|
1410
1526
|
super();
|
|
1411
1527
|
this.postboy = postboy;
|
|
1412
1528
|
this.factory = factory;
|
|
1413
1529
|
}
|
|
1414
|
-
|
|
1415
|
-
this.postboy
|
|
1416
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1417
|
-
.pipe(filter((m) => !!m), first())
|
|
1418
|
-
.subscribe((m) => this.initLayer());
|
|
1419
|
-
}
|
|
1530
|
+
_settings = new FeatureLayerSettings();
|
|
1420
1531
|
set settings(value) {
|
|
1421
1532
|
if (!value || this._settings.isSame(value))
|
|
1422
1533
|
return;
|
|
1423
1534
|
this._settings = value;
|
|
1424
1535
|
this.initLayer();
|
|
1425
1536
|
}
|
|
1537
|
+
ngOnInit() {
|
|
1538
|
+
this.postboy
|
|
1539
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1540
|
+
.pipe(filter((m) => !!m), first())
|
|
1541
|
+
.subscribe((m) => this.initLayer());
|
|
1542
|
+
}
|
|
1426
1543
|
onDestroy = () => this.removeLayer();
|
|
1427
1544
|
initLayer() {
|
|
1428
1545
|
this.removeLayer();
|
|
@@ -1446,12 +1563,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1446
1563
|
class ClusterLayerSettings {
|
|
1447
1564
|
name = IdGenerator.get();
|
|
1448
1565
|
zIndex = 1;
|
|
1566
|
+
/**
|
|
1567
|
+
* The maximum view zoom level (inclusive) at which this layer will be visible.
|
|
1568
|
+
*
|
|
1569
|
+
* @type {number}
|
|
1570
|
+
* @default 19
|
|
1571
|
+
*/
|
|
1449
1572
|
maxZoom = 19;
|
|
1573
|
+
/**
|
|
1574
|
+
* The minimum view zoom level (exclusive) at which this layer will be visible.
|
|
1575
|
+
*
|
|
1576
|
+
* @type {number}
|
|
1577
|
+
*/
|
|
1450
1578
|
minZoom = 0;
|
|
1579
|
+
/**
|
|
1580
|
+
* Distance in pixels within which features will be clustered together.
|
|
1581
|
+
*
|
|
1582
|
+
* @type {number}
|
|
1583
|
+
*/
|
|
1451
1584
|
distance = 20;
|
|
1452
1585
|
bbox = false;
|
|
1453
1586
|
clusterCancel = 14;
|
|
1454
1587
|
style;
|
|
1588
|
+
/**
|
|
1589
|
+
* Creates a copy of the given ClusterLayerSettings object.
|
|
1590
|
+
*
|
|
1591
|
+
* @param {ClusterLayerSettings} model - The ClusterLayerSettings object to be copied.
|
|
1592
|
+
* @returns {ClusterLayerSettings} - A new ClusterLayerSettings object that is a copy of the original object.
|
|
1593
|
+
*/
|
|
1455
1594
|
static copy(model) {
|
|
1456
1595
|
const result = new ClusterLayerSettings();
|
|
1457
1596
|
result.name = model.name;
|
|
@@ -1464,30 +1603,86 @@ class ClusterLayerSettings {
|
|
|
1464
1603
|
result.style = model.style;
|
|
1465
1604
|
return result;
|
|
1466
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Set the z-index for the ClusterLayer.
|
|
1608
|
+
*
|
|
1609
|
+
* @param {number} zIndex - The new z-index for the ClusterLayer.
|
|
1610
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1611
|
+
*/
|
|
1467
1612
|
setZIndex(zIndex) {
|
|
1468
1613
|
return ClusterLayerSettings.copy({ ...this, zIndex });
|
|
1469
1614
|
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Sets the distance value for ClusterLayerSettings.
|
|
1617
|
+
*
|
|
1618
|
+
* @param {number} distance - The distance value to be set.
|
|
1619
|
+
* @return {ClusterLayerSettings} - The modified ClusterLayerSettings object.
|
|
1620
|
+
*/
|
|
1470
1621
|
setDistance(distance) {
|
|
1471
1622
|
return ClusterLayerSettings.copy({ ...this, distance });
|
|
1472
1623
|
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Sets the name of the ClusterLayerSettings object.
|
|
1626
|
+
*
|
|
1627
|
+
* @param {string} name - The name to set for the ClusterLayerSettings.
|
|
1628
|
+
* @return {ClusterLayerSettings} - A new ClusterLayerSettings object with the updated name.
|
|
1629
|
+
*/
|
|
1473
1630
|
setName(name) {
|
|
1474
1631
|
return ClusterLayerSettings.copy({ ...this, name });
|
|
1475
1632
|
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Sets the maximum zoom level for the Cluster Layer.
|
|
1635
|
+
*
|
|
1636
|
+
* @param {number} maxZoom - The maximum zoom level to be set.
|
|
1637
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1638
|
+
*/
|
|
1476
1639
|
setMaxZoom(maxZoom) {
|
|
1477
1640
|
return ClusterLayerSettings.copy({ ...this, maxZoom });
|
|
1478
1641
|
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Sets the minimum zoom level for the ClusterLayerSettings.
|
|
1644
|
+
*
|
|
1645
|
+
* @param {number} minZoom - The minimum zoom level to set.
|
|
1646
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1647
|
+
*/
|
|
1479
1648
|
setMinZoom(minZoom) {
|
|
1480
1649
|
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1481
1650
|
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Sets the cluster cancel number for the ClusterLayerSettings.
|
|
1653
|
+
*
|
|
1654
|
+
* @param {number} clusterCancel - The new cluster cancel number.
|
|
1655
|
+
* @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object.
|
|
1656
|
+
*/
|
|
1482
1657
|
setClusterCancel(clusterCancel) {
|
|
1483
1658
|
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
1484
1659
|
}
|
|
1660
|
+
/**
|
|
1661
|
+
* Sets the value of 'bbox' property in the ClusterLayerSettings object.
|
|
1662
|
+
*
|
|
1663
|
+
* @param {boolean} bbox - A boolean value indicating whether to include bounding box calculation in the cluster layer settings.
|
|
1664
|
+
* @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object with the newly set 'bbox' value.
|
|
1665
|
+
*/
|
|
1485
1666
|
setBbox(bbox) {
|
|
1486
1667
|
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1487
1668
|
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Sets the style for the ClusterLayerSettings.
|
|
1671
|
+
*
|
|
1672
|
+
* @param {function} style - A function that takes an array of identified features as input and returns a Style or StyleFunction.
|
|
1673
|
+
*
|
|
1674
|
+
* @return {ClusterLayerSettings} - The updated ClusterLayerSettings object with the new style applied.
|
|
1675
|
+
*/
|
|
1488
1676
|
setStyle(style) {
|
|
1489
1677
|
return ClusterLayerSettings.copy({ ...this, style });
|
|
1490
1678
|
}
|
|
1679
|
+
/**
|
|
1680
|
+
* Checks if the current ClusterLayerSettings object is the same as the specified model.
|
|
1681
|
+
*
|
|
1682
|
+
* @param {ClusterLayerSettings} model - The model to compare with the current object.
|
|
1683
|
+
*
|
|
1684
|
+
* @return {boolean} - Returns true if the current ClusterLayerSettings object is the same as the specified model, otherwise false.
|
|
1685
|
+
*/
|
|
1491
1686
|
isSame(model) {
|
|
1492
1687
|
if (this.maxZoom !== model.maxZoom)
|
|
1493
1688
|
return false;
|
|
@@ -1592,28 +1787,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1592
1787
|
}]
|
|
1593
1788
|
}] });
|
|
1594
1789
|
|
|
1790
|
+
/**
|
|
1791
|
+
* Represents a cluster layer component.
|
|
1792
|
+
*/
|
|
1595
1793
|
class ClusterLayerComponent extends DestructibleComponent {
|
|
1596
1794
|
postboy;
|
|
1597
1795
|
factory;
|
|
1598
1796
|
manager = null;
|
|
1599
|
-
_settings = new ClusterLayerSettings();
|
|
1600
1797
|
constructor(postboy, factory) {
|
|
1601
1798
|
super();
|
|
1602
1799
|
this.postboy = postboy;
|
|
1603
1800
|
this.factory = factory;
|
|
1604
1801
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1802
|
+
_settings = new ClusterLayerSettings();
|
|
1803
|
+
/**
|
|
1804
|
+
* Sets the settings for the cluster layer.
|
|
1805
|
+
*
|
|
1806
|
+
* @param {ClusterLayerSettings | undefined} value - The settings for the cluster layer.
|
|
1807
|
+
*/
|
|
1611
1808
|
set settings(value) {
|
|
1612
1809
|
if (!value || this._settings.isSame(value))
|
|
1613
1810
|
return;
|
|
1614
1811
|
this._settings = value;
|
|
1615
1812
|
this.initLayer();
|
|
1616
1813
|
}
|
|
1814
|
+
ngOnInit() {
|
|
1815
|
+
this.postboy
|
|
1816
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1817
|
+
.pipe(filter((m) => !!m), first())
|
|
1818
|
+
.subscribe((m) => this.initLayer());
|
|
1819
|
+
}
|
|
1617
1820
|
onDestroy = () => this.removeLayer();
|
|
1618
1821
|
initLayer() {
|
|
1619
1822
|
this.removeLayer();
|
|
@@ -1665,6 +1868,7 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1665
1868
|
detector;
|
|
1666
1869
|
map;
|
|
1667
1870
|
osmUrl = '';
|
|
1871
|
+
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1668
1872
|
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1669
1873
|
super();
|
|
1670
1874
|
this.elementRef = elementRef;
|
|
@@ -1675,7 +1879,6 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1675
1879
|
registrator.up();
|
|
1676
1880
|
}
|
|
1677
1881
|
_settings = new MapSettings();
|
|
1678
|
-
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1679
1882
|
set settings(value) {
|
|
1680
1883
|
if (!value || this._settings.isSame(value))
|
|
1681
1884
|
return;
|
|
@@ -1693,6 +1896,9 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1693
1896
|
});
|
|
1694
1897
|
this.setOsm();
|
|
1695
1898
|
}
|
|
1899
|
+
onDestroy = () => {
|
|
1900
|
+
this.registrator.down();
|
|
1901
|
+
};
|
|
1696
1902
|
setOsm() {
|
|
1697
1903
|
if (!this.map)
|
|
1698
1904
|
return;
|
|
@@ -1700,9 +1906,6 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
1700
1906
|
this.detector.detectChanges();
|
|
1701
1907
|
this.map.updateSize();
|
|
1702
1908
|
}
|
|
1703
|
-
onDestroy = () => {
|
|
1704
|
-
this.registrator.down();
|
|
1705
|
-
};
|
|
1706
1909
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1707
1910
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MapPlateComponent, selector: "art-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1708
1911
|
MessageRegistratorService,
|
|
@@ -1735,6 +1938,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1735
1938
|
type: Input
|
|
1736
1939
|
}] } });
|
|
1737
1940
|
|
|
1941
|
+
/**
|
|
1942
|
+
* MarkersComponent is a component that displays markers on a map.
|
|
1943
|
+
* It listens for changes in the `markers` input property and
|
|
1944
|
+
* automatically puts the markers on the map using the MapPostboyService.
|
|
1945
|
+
*/
|
|
1738
1946
|
class MarkersComponent extends DestructibleComponent {
|
|
1739
1947
|
postboy;
|
|
1740
1948
|
layerName = '';
|
|
@@ -1743,6 +1951,11 @@ class MarkersComponent extends DestructibleComponent {
|
|
|
1743
1951
|
this.postboy = postboy;
|
|
1744
1952
|
}
|
|
1745
1953
|
_markers = [];
|
|
1954
|
+
/**
|
|
1955
|
+
* Sets the markers property.
|
|
1956
|
+
*
|
|
1957
|
+
* @param {MarkerModel[]} value - The array of MarkerModel objects to set as markers.
|
|
1958
|
+
*/
|
|
1746
1959
|
set markers(value) {
|
|
1747
1960
|
this._markers = value ?? [];
|
|
1748
1961
|
this.putMarkers();
|
|
@@ -1773,7 +1986,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1773
1986
|
class TooltipSettings {
|
|
1774
1987
|
id;
|
|
1775
1988
|
containerClass = 'custom-tooltip-class';
|
|
1776
|
-
show = (e) => true;
|
|
1777
1989
|
constructor(id) {
|
|
1778
1990
|
this.id = id ?? IdGenerator.get();
|
|
1779
1991
|
}
|
|
@@ -1783,6 +1995,7 @@ class TooltipSettings {
|
|
|
1783
1995
|
result.containerClass = model.containerClass;
|
|
1784
1996
|
return result;
|
|
1785
1997
|
}
|
|
1998
|
+
show = (e) => true;
|
|
1786
1999
|
setShow(show) {
|
|
1787
2000
|
return TooltipSettings.copy({ ...this, show });
|
|
1788
2001
|
}
|
|
@@ -1804,26 +2017,41 @@ class TooltipComponent extends DestructibleComponent {
|
|
|
1804
2017
|
postboy;
|
|
1805
2018
|
detector;
|
|
1806
2019
|
container;
|
|
1807
|
-
_settings = new TooltipSettings();
|
|
1808
|
-
map;
|
|
1809
2020
|
overlay;
|
|
1810
2021
|
show = false;
|
|
2022
|
+
map;
|
|
2023
|
+
constructor(postboy, detector) {
|
|
2024
|
+
super();
|
|
2025
|
+
this.postboy = postboy;
|
|
2026
|
+
this.detector = detector;
|
|
2027
|
+
}
|
|
2028
|
+
_settings = new TooltipSettings();
|
|
1811
2029
|
set settings(value) {
|
|
1812
2030
|
if (!value || this._settings.isSame(value))
|
|
1813
2031
|
return;
|
|
1814
2032
|
this._settings = value;
|
|
1815
2033
|
this.detector.detectChanges();
|
|
1816
2034
|
}
|
|
1817
|
-
constructor(postboy, detector) {
|
|
1818
|
-
super();
|
|
1819
|
-
this.postboy = postboy;
|
|
1820
|
-
this.detector = detector;
|
|
1821
|
-
}
|
|
1822
2035
|
ngOnInit() {
|
|
1823
2036
|
this.subs.push(this.observeMapRender());
|
|
1824
2037
|
this.subs.push(this.observeMapClick());
|
|
1825
2038
|
this.subs.push(this.observeClose());
|
|
1826
2039
|
}
|
|
2040
|
+
addOverlay(coordinates) {
|
|
2041
|
+
this.removeOverlay();
|
|
2042
|
+
this.overlay = new Overlay(this.options(coordinates));
|
|
2043
|
+
this.map?.addOverlay(this.overlay);
|
|
2044
|
+
this.show = true;
|
|
2045
|
+
this.detector.detectChanges();
|
|
2046
|
+
}
|
|
2047
|
+
options = (coordinates) => {
|
|
2048
|
+
return {
|
|
2049
|
+
element: this.container?.nativeElement,
|
|
2050
|
+
autoPan: false,
|
|
2051
|
+
autoPanAnimation: { duration: 0 },
|
|
2052
|
+
position: coordinates,
|
|
2053
|
+
};
|
|
2054
|
+
};
|
|
1827
2055
|
observeMapClick() {
|
|
1828
2056
|
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1829
2057
|
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
@@ -1844,21 +2072,6 @@ class TooltipComponent extends DestructibleComponent {
|
|
|
1844
2072
|
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
1845
2073
|
this.show = false;
|
|
1846
2074
|
};
|
|
1847
|
-
addOverlay(coordinates) {
|
|
1848
|
-
this.removeOverlay();
|
|
1849
|
-
this.overlay = new Overlay(this.options(coordinates));
|
|
1850
|
-
this.map?.addOverlay(this.overlay);
|
|
1851
|
-
this.show = true;
|
|
1852
|
-
this.detector.detectChanges();
|
|
1853
|
-
}
|
|
1854
|
-
options = (coordinates) => {
|
|
1855
|
-
return {
|
|
1856
|
-
element: this.container?.nativeElement,
|
|
1857
|
-
autoPan: false,
|
|
1858
|
-
autoPanAnimation: { duration: 0 },
|
|
1859
|
-
position: coordinates,
|
|
1860
|
-
};
|
|
1861
|
-
};
|
|
1862
2075
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1863
2076
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", 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 });
|
|
1864
2077
|
}
|
|
@@ -1872,6 +2085,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1872
2085
|
type: Input
|
|
1873
2086
|
}] } });
|
|
1874
2087
|
|
|
2088
|
+
/**
|
|
2089
|
+
* Component for rendering polygons on a map.
|
|
2090
|
+
* It listens for changes in the `polygons` input property and
|
|
2091
|
+
* automatically puts the polygons on the map using the MapPostboyService.
|
|
2092
|
+
*/
|
|
1875
2093
|
class PolygonsComponent extends DestructibleComponent {
|
|
1876
2094
|
postboy;
|
|
1877
2095
|
layerName = '';
|
|
@@ -1880,6 +2098,11 @@ class PolygonsComponent extends DestructibleComponent {
|
|
|
1880
2098
|
this.postboy = postboy;
|
|
1881
2099
|
}
|
|
1882
2100
|
_polygons = [];
|
|
2101
|
+
/**
|
|
2102
|
+
* Sets the value of polygons.
|
|
2103
|
+
*
|
|
2104
|
+
* @param {PolygonModel[]} value - The new value for polygons.
|
|
2105
|
+
*/
|
|
1883
2106
|
set polygons(value) {
|
|
1884
2107
|
this._polygons = value ?? [];
|
|
1885
2108
|
this.putPolygons();
|
|
@@ -1907,12 +2130,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
1907
2130
|
type: Input
|
|
1908
2131
|
}] } });
|
|
1909
2132
|
|
|
2133
|
+
/**
|
|
2134
|
+
* Represents the settings for a zoom control.
|
|
2135
|
+
*/
|
|
1910
2136
|
class ZoomControlSettings {
|
|
2137
|
+
/**
|
|
2138
|
+
* The CSS class name of the control element.
|
|
2139
|
+
*
|
|
2140
|
+
* @type {string}
|
|
2141
|
+
*/
|
|
1911
2142
|
controlClass = 'ol-zoom';
|
|
2143
|
+
/**
|
|
2144
|
+
* The CSS class name for zoom in button.
|
|
2145
|
+
* @type {string}
|
|
2146
|
+
*/
|
|
1912
2147
|
zoomInClass = 'ol-zoom-in';
|
|
2148
|
+
/**
|
|
2149
|
+
* The CSS class name for the zoom out button element.
|
|
2150
|
+
*
|
|
2151
|
+
* @type {string}
|
|
2152
|
+
*/
|
|
1913
2153
|
zoomOutClass = 'ol-zoom-out';
|
|
2154
|
+
/**
|
|
2155
|
+
* The label for the zoom in action.
|
|
2156
|
+
*
|
|
2157
|
+
* @type {string}
|
|
2158
|
+
*/
|
|
1914
2159
|
zoomInLabel = 'Zoom In';
|
|
2160
|
+
/**
|
|
2161
|
+
* The label for the zoom out control.
|
|
2162
|
+
*
|
|
2163
|
+
* @type {string}
|
|
2164
|
+
*/
|
|
1915
2165
|
zoomOutLabel = 'Zoom Out';
|
|
2166
|
+
/**
|
|
2167
|
+
* Copies the provided ZoomControlSettings object.
|
|
2168
|
+
*
|
|
2169
|
+
* @param {ZoomControlSettings} model - The ZoomControlSettings object to be copied.
|
|
2170
|
+
* @return {ZoomControlSettings} - The copied ZoomControlSettings object.
|
|
2171
|
+
*/
|
|
1916
2172
|
static copy(model) {
|
|
1917
2173
|
const result = new ZoomControlSettings();
|
|
1918
2174
|
result.controlClass = model.controlClass;
|
|
@@ -1922,6 +2178,13 @@ class ZoomControlSettings {
|
|
|
1922
2178
|
result.zoomOutLabel = model.zoomOutLabel;
|
|
1923
2179
|
return result;
|
|
1924
2180
|
}
|
|
2181
|
+
/**
|
|
2182
|
+
* Checks if the current ZoomControlSettings object is equal to the given model.
|
|
2183
|
+
*
|
|
2184
|
+
* @param {ZoomControlSettings} model - The ZoomControlSettings object to compare with.
|
|
2185
|
+
*
|
|
2186
|
+
* @return {boolean} - true if the current object is equal to the given model, false otherwise.
|
|
2187
|
+
*/
|
|
1925
2188
|
isSame(model) {
|
|
1926
2189
|
if (this.zoomInClass !== model.zoomInClass)
|
|
1927
2190
|
return false;
|
|
@@ -1935,38 +2198,86 @@ class ZoomControlSettings {
|
|
|
1935
2198
|
return false;
|
|
1936
2199
|
return true;
|
|
1937
2200
|
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Sets the zoom in label of the Zoom Control Settings.
|
|
2203
|
+
*
|
|
2204
|
+
* @param {string} zoomInLabel - The label for the zoom in button.
|
|
2205
|
+
* @return {ZoomControlSettings} - The new Zoom Control Settings object with the updated zoom in label.
|
|
2206
|
+
*/
|
|
1938
2207
|
setZoomInLabel(zoomInLabel) {
|
|
1939
2208
|
return ZoomControlSettings.copy({ ...this, zoomInLabel });
|
|
1940
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Sets the zoomOutClass property of the ZoomControlSettings object.
|
|
2212
|
+
*
|
|
2213
|
+
* @param {string} zoomOutClass - The CSS class to be assigned to the zoom out button.
|
|
2214
|
+
* @return {ZoomControlSettings} - The updated ZoomControlSettings object with the new zoomOutClass value.
|
|
2215
|
+
*/
|
|
1941
2216
|
setZoomOutClass(zoomOutClass) {
|
|
1942
2217
|
return ZoomControlSettings.copy({ ...this, zoomOutClass });
|
|
1943
2218
|
}
|
|
2219
|
+
/**
|
|
2220
|
+
* Sets the zoom in class for the zoom control settings.
|
|
2221
|
+
*
|
|
2222
|
+
* @param {string} zoomInClass - The new zoom in class to be set.
|
|
2223
|
+
* @return {ZoomControlSettings} - The updated zoom control settings.
|
|
2224
|
+
*/
|
|
1944
2225
|
setZoomInClass(zoomInClass) {
|
|
1945
2226
|
return ZoomControlSettings.copy({ ...this, zoomInClass });
|
|
1946
2227
|
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Set the label for the zoom out control.
|
|
2230
|
+
*
|
|
2231
|
+
* @param {string} zoomOutLabel - The label for the zoom out control.
|
|
2232
|
+
* @returns {ZoomControlSettings} - The updated zoom control settings.
|
|
2233
|
+
*/
|
|
1947
2234
|
setZoomOutLabel(zoomOutLabel) {
|
|
1948
2235
|
return ZoomControlSettings.copy({ ...this, zoomOutLabel });
|
|
1949
2236
|
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Sets the control class for the ZoomControlSettings.
|
|
2239
|
+
*
|
|
2240
|
+
* @param {string} controlClass - The class name of the control to be set.
|
|
2241
|
+
*
|
|
2242
|
+
* @return {ZoomControlSettings} - The modified ZoomControlSettings object.
|
|
2243
|
+
*/
|
|
1950
2244
|
setControlClass(controlClass) {
|
|
1951
2245
|
return ZoomControlSettings.copy({ ...this, controlClass });
|
|
1952
2246
|
}
|
|
1953
2247
|
}
|
|
1954
2248
|
|
|
2249
|
+
/**
|
|
2250
|
+
* @class
|
|
2251
|
+
* @classdesc Represents a component for the Zoom control on a map.
|
|
2252
|
+
* @extends DestructibleComponent
|
|
2253
|
+
* @implements OnInit
|
|
2254
|
+
*/
|
|
1955
2255
|
class MapControlZoomComponent extends DestructibleComponent {
|
|
1956
2256
|
postboy;
|
|
1957
|
-
_settings = new ZoomControlSettings();
|
|
1958
2257
|
map;
|
|
1959
2258
|
control;
|
|
2259
|
+
constructor(postboy) {
|
|
2260
|
+
super();
|
|
2261
|
+
this.postboy = postboy;
|
|
2262
|
+
}
|
|
2263
|
+
_settings = new ZoomControlSettings();
|
|
2264
|
+
/**
|
|
2265
|
+
* Sets the settings for the Zoom Control.
|
|
2266
|
+
*
|
|
2267
|
+
* @param {ZoomControlSettings | undefined} value - The new settings for the Zoom Control.
|
|
2268
|
+
*
|
|
2269
|
+
* @description
|
|
2270
|
+
* This method sets the settings for the Zoom Control. It takes a parameter `value` which should be an object of type `ZoomControlSettings` or `undefined`.
|
|
2271
|
+
*
|
|
2272
|
+
* If the `value` is `undefined` or the same as the current settings, the method will return without making any changes.
|
|
2273
|
+
*
|
|
2274
|
+
*/
|
|
1960
2275
|
set settings(value) {
|
|
1961
2276
|
if (!value || this._settings.isSame(value))
|
|
1962
2277
|
return;
|
|
1963
2278
|
this._settings = value;
|
|
1964
2279
|
this.setControl();
|
|
1965
2280
|
}
|
|
1966
|
-
constructor(postboy) {
|
|
1967
|
-
super();
|
|
1968
|
-
this.postboy = postboy;
|
|
1969
|
-
}
|
|
1970
2281
|
ngOnInit() {
|
|
1971
2282
|
this.postboy
|
|
1972
2283
|
.subscribe(MapRenderedEvent.ID)
|
|
@@ -1976,15 +2287,15 @@ class MapControlZoomComponent extends DestructibleComponent {
|
|
|
1976
2287
|
this.setControl();
|
|
1977
2288
|
});
|
|
1978
2289
|
}
|
|
2290
|
+
onDestroy = () => {
|
|
2291
|
+
this.eliminate();
|
|
2292
|
+
};
|
|
1979
2293
|
setControl() {
|
|
1980
2294
|
if (!this.map)
|
|
1981
2295
|
return;
|
|
1982
2296
|
this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
|
|
1983
2297
|
this.map.addControl(this.control);
|
|
1984
2298
|
}
|
|
1985
|
-
onDestroy = () => {
|
|
1986
|
-
this.eliminate();
|
|
1987
|
-
};
|
|
1988
2299
|
eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
|
|
1989
2300
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1990
2301
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MapControlZoomComponent, selector: "art-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -2046,7 +2357,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImpor
|
|
|
2046
2357
|
}]
|
|
2047
2358
|
}] });
|
|
2048
2359
|
|
|
2360
|
+
/**
|
|
2361
|
+
* Helper class to create and modify marker styles.
|
|
2362
|
+
*/
|
|
2049
2363
|
class MarkerStyleHelper {
|
|
2364
|
+
/**
|
|
2365
|
+
* Creates a new Style object from an SVG.
|
|
2366
|
+
* @param {string} svg - The SVG string.
|
|
2367
|
+
* @param {Array<number>} [size=[30, 30]] - The size of the icon image.
|
|
2368
|
+
* @param {number} [zIndex=400] - The zIndex of the style.
|
|
2369
|
+
* @returns {Style} A new Style object.
|
|
2370
|
+
*/
|
|
2050
2371
|
static fromSvg(svg, size = [30, 30], zIndex = 400) {
|
|
2051
2372
|
let image = new Image();
|
|
2052
2373
|
image.src = 'data:image/svg+xml,' + escape(svg);
|
|
@@ -2058,6 +2379,15 @@ class MarkerStyleHelper {
|
|
|
2058
2379
|
zIndex,
|
|
2059
2380
|
});
|
|
2060
2381
|
}
|
|
2382
|
+
/**
|
|
2383
|
+
* Returns a Style object with a circle style.
|
|
2384
|
+
*
|
|
2385
|
+
* @param {number} radius - The radius of the circle.
|
|
2386
|
+
* @param {string} fill - The fill color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
|
|
2387
|
+
* @param {string} strokeColor - The stroke color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
|
|
2388
|
+
* @param {number} [strokeWidth=1] - The width of the stroke. Default is 1.
|
|
2389
|
+
* @returns {Style} - A Style object with a Circle image.
|
|
2390
|
+
*/
|
|
2061
2391
|
static circle(radius, fill, strokeColor, strokeWidth = 1) {
|
|
2062
2392
|
return new Style({
|
|
2063
2393
|
image: new Circle({
|
|
@@ -2067,13 +2397,32 @@ class MarkerStyleHelper {
|
|
|
2067
2397
|
}),
|
|
2068
2398
|
});
|
|
2069
2399
|
}
|
|
2400
|
+
/**
|
|
2401
|
+
* Applies the given Text to the provided Style.
|
|
2402
|
+
*
|
|
2403
|
+
* @param {Style} style - The Style to modify.
|
|
2404
|
+
* @param {Text} text - The Text to apply to the Style.
|
|
2405
|
+
* @return {Style} - The modified Style with the applied Text.
|
|
2406
|
+
*/
|
|
2070
2407
|
static withText(style, text) {
|
|
2071
2408
|
style.setText(text);
|
|
2072
2409
|
return style;
|
|
2073
2410
|
}
|
|
2074
2411
|
}
|
|
2075
2412
|
|
|
2413
|
+
/**
|
|
2414
|
+
* A helper class for creating polygon styles.
|
|
2415
|
+
* @class
|
|
2416
|
+
*/
|
|
2076
2417
|
class PolygonStyleHelper {
|
|
2418
|
+
/**
|
|
2419
|
+
* Creates a Style object with the given fill color, stroke color, and stroke width.
|
|
2420
|
+
*
|
|
2421
|
+
* @param {string} fill - The fill color in hexadecimal or RGB format.
|
|
2422
|
+
* @param {string} stroke - The stroke color in hexadecimal or RGB format.
|
|
2423
|
+
* @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
|
|
2424
|
+
* @return {Style} The created Style object.
|
|
2425
|
+
*/
|
|
2077
2426
|
static simple(fill, stroke, strokeWidth = 1) {
|
|
2078
2427
|
return new Style({
|
|
2079
2428
|
fill: new Fill({
|
|
@@ -2085,6 +2434,15 @@ class PolygonStyleHelper {
|
|
|
2085
2434
|
}),
|
|
2086
2435
|
});
|
|
2087
2436
|
}
|
|
2437
|
+
/**
|
|
2438
|
+
* Creates a new Style object with the given fill, stroke, stroke width, and pin radius.
|
|
2439
|
+
*
|
|
2440
|
+
* @param {string} fill - The color to use for the fill of the style.
|
|
2441
|
+
* @param {string} stroke - The color to use for the stroke of the style.
|
|
2442
|
+
* @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
|
|
2443
|
+
* @param {number} [pinRadius=5] - The radius of the circle used as the image for the style. Defaults to 5.
|
|
2444
|
+
* @returns {Style} - The newly created Style object.
|
|
2445
|
+
*/
|
|
2088
2446
|
static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
|
|
2089
2447
|
return new Style({
|
|
2090
2448
|
image: new Circle({
|
|
@@ -2104,7 +2462,18 @@ class PolygonStyleHelper {
|
|
|
2104
2462
|
}
|
|
2105
2463
|
}
|
|
2106
2464
|
|
|
2465
|
+
/**
|
|
2466
|
+
* Helper class for creating text styles.
|
|
2467
|
+
*/
|
|
2107
2468
|
class TextStyleHelper {
|
|
2469
|
+
/**
|
|
2470
|
+
* Creates a new instance of the Text class with the specified properties.
|
|
2471
|
+
*
|
|
2472
|
+
* @param {string} text - The text content of the Text object.
|
|
2473
|
+
* @param {string} font - The font style of the Text object.
|
|
2474
|
+
* @param {string} color - The color of the Text object.
|
|
2475
|
+
* @return {Text} A new instance of the Text class.
|
|
2476
|
+
*/
|
|
2108
2477
|
static get(text, font, color) {
|
|
2109
2478
|
return new Text({
|
|
2110
2479
|
text: text,
|
|
@@ -2117,37 +2486,41 @@ class TextStyleHelper {
|
|
|
2117
2486
|
}
|
|
2118
2487
|
}
|
|
2119
2488
|
|
|
2489
|
+
/**
|
|
2490
|
+
* A helper class for converting and stringify features.
|
|
2491
|
+
*/
|
|
2120
2492
|
class StringifyFeatureHelper {
|
|
2121
2493
|
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2122
2494
|
return format === FeatureOutputFormat.GeoJson
|
|
2123
2495
|
? new GeoJSON().writeFeature(feature)
|
|
2124
2496
|
: new WKT().writeFeature(feature);
|
|
2125
2497
|
}
|
|
2498
|
+
/**
|
|
2499
|
+
* Creates a polygon feature representing a circle based on a given feature with a circle geometry.
|
|
2500
|
+
*
|
|
2501
|
+
* @param {Feature<Geometry>} feature - The input feature with a circle geometry.
|
|
2502
|
+
* @param {FeatureOutputFormat} format - The format for outputting the polygon feature. (default: FeatureOutputFormat.GeoJson)
|
|
2503
|
+
*
|
|
2504
|
+
* @return {string} - The string representation of the polygon feature.
|
|
2505
|
+
*/
|
|
2126
2506
|
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
2127
|
-
// const clone = feature.clone();
|
|
2128
|
-
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
2129
|
-
const tetemp = feature.getGeometryName();
|
|
2130
2507
|
const circle = feature.getGeometry();
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
2136
|
-
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
2508
|
+
const ext = feature.getGeometry().getExtent();
|
|
2509
|
+
const coords = [
|
|
2510
|
+
...transform([ext[0], ext[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
2511
|
+
...transform([ext[2], ext[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
2137
2512
|
];
|
|
2138
|
-
const radius = (
|
|
2139
|
-
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
2513
|
+
const radius = (coords[2] - coords[0]) / 2;
|
|
2140
2514
|
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
2141
|
-
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
2142
|
-
// var wgs84Sphere = new Sphere(6378137);
|
|
2143
2515
|
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
2144
|
-
// const rad = circle.getRadius();
|
|
2145
|
-
// const degrees = 180 / Math.PI; // radians to degrees
|
|
2146
|
-
// const radians = Math.PI / 180; // degrees to radians
|
|
2147
|
-
// const rlat = rad * degrees * 1000;
|
|
2148
|
-
// const rlng = rad * radians;
|
|
2149
|
-
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
2150
2516
|
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Draw a circle based on a center point and radius.
|
|
2519
|
+
*
|
|
2520
|
+
* @param {number[]} point - The center point coordinates in EPSG:4326 format.
|
|
2521
|
+
* @param {number} radius - The radius of the circle in meters.
|
|
2522
|
+
* @return {Coordinate[][]} - The coordinates of the circle boundary in EPSG:4326 format.
|
|
2523
|
+
*/
|
|
2151
2524
|
static drawCircle(point, radius) {
|
|
2152
2525
|
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
2153
2526
|
// const tetetemp = point;
|
|
@@ -2176,5 +2549,5 @@ class StringifyFeatureHelper {
|
|
|
2176
2549
|
* Generated bundle index. Do not edit.
|
|
2177
2550
|
*/
|
|
2178
2551
|
|
|
2179
|
-
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 };
|
|
2552
|
+
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FitToPolygonsCommand, GetMapPositionExecutor, 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 };
|
|
2180
2553
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|