@artstesh/maps 6.0.2 → 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/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-position.model.mjs +2 -0
- package/dist/esm2022/map/services/map-state.service.mjs +10 -4
- package/dist/esm2022/map/services/message-registrator.service.mjs +5 -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-position.model.mjs +2 -0
- package/dist/esm2022/src/map/services/map-state.service.mjs +10 -4
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +5 -1
- package/dist/fesm2022/maps-components-src-map.mjs +31 -9
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +31 -9
- package/dist/fesm2022/maps-components.mjs.map +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-position.model.d.ts +6 -0
- 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/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-position.model.d.ts +6 -0
- 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
|
@@ -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';
|
|
@@ -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
|
}
|
|
@@ -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 });
|
|
@@ -2531,5 +2553,5 @@ class StringifyFeatureHelper {
|
|
|
2531
2553
|
* Generated bundle index. Do not edit.
|
|
2532
2554
|
*/
|
|
2533
2555
|
|
|
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 };
|
|
2556
|
+
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 };
|
|
2535
2557
|
//# sourceMappingURL=maps-components.mjs.map
|