@artstesh/maps 6.0.10 → 6.0.12

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.
@@ -3,13 +3,13 @@ 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 } from 'ol/geom';
6
+ import { Point, Circle } 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';
10
10
  import { get, useGeographic, transform } from 'ol/proj';
11
11
  import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
12
- import { Draw, Modify, Translate } from 'ol/interaction';
12
+ import { Draw, Modify, Translate, defaults } from 'ol/interaction';
13
13
  import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
14
14
  import * as Sphere from 'ol/sphere';
15
15
  import { Dictionary } from '@artstesh/collections';
@@ -26,7 +26,7 @@ import Map from 'ol/Map';
26
26
  import View from 'ol/View';
27
27
  import Overlay from 'ol/Overlay';
28
28
  import Style from 'ol/style/Style';
29
- import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
29
+ import { Icon, Circle as Circle$1, Fill, Stroke, Text } from 'ol/style';
30
30
  import { METERS_PER_UNIT } from 'ol/proj/epsg4326';
31
31
 
32
32
  class DestructibleComponent {
@@ -75,6 +75,7 @@ class MapSettings {
75
75
  zoom = 4;
76
76
  lyrs = MapLyrs.Hybrid;
77
77
  language = 'en';
78
+ interactionSettings = {};
78
79
  static copy(model) {
79
80
  const result = new MapSettings();
80
81
  result.center = model.center;
@@ -82,9 +83,20 @@ class MapSettings {
82
83
  result.minZoom = model.minZoom;
83
84
  result.zoom = model.zoom;
84
85
  result.lyrs = model.lyrs;
86
+ result.interactionSettings = model.interactionSettings;
85
87
  result.language = model.language;
86
88
  return result;
87
89
  }
90
+ /**
91
+ * Updates the interaction settings of the map and returns a new MapSettings instance
92
+ * with the updated settings.
93
+ *
94
+ * @param {DefaultsOptions} interactionSettings - The new interaction settings to be applied.
95
+ * @return {MapSettings} A new MapSettings instance with the updated interaction settings.
96
+ */
97
+ setInteractionSettings(interactionSettings) {
98
+ return MapSettings.copy({ ...this, interactionSettings });
99
+ }
88
100
  /**
89
101
  * Sets the center for the map settings.
90
102
  *
@@ -156,6 +168,8 @@ class MapSettings {
156
168
  return false;
157
169
  if (this.language !== model.language)
158
170
  return false;
171
+ if (this.interactionSettings !== model.interactionSettings)
172
+ return false;
159
173
  return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
160
174
  }
161
175
  }
@@ -231,6 +245,11 @@ class PolygonModel {
231
245
  feature.setId(id);
232
246
  return new PolygonModel(feature, id, info);
233
247
  }
248
+ static circle(id, lat, lng, radius, info) {
249
+ let feature = new Feature(new Circle([lng, lat], radius));
250
+ feature.setId(id);
251
+ return new PolygonModel(feature, id, info);
252
+ }
234
253
  }
235
254
 
236
255
  /**
@@ -2066,6 +2085,7 @@ class MapPlateFactory {
2066
2085
  maxZoom: settings?.maxZoom || 19,
2067
2086
  }),
2068
2087
  layers: [],
2088
+ interactions: defaults(settings.interactionSettings),
2069
2089
  });
2070
2090
  }
2071
2091
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -2608,7 +2628,7 @@ class MarkerStyleHelper {
2608
2628
  */
2609
2629
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
2610
2630
  return new Style({
2611
- image: new Circle({
2631
+ image: new Circle$1({
2612
2632
  radius,
2613
2633
  fill: new Fill({ color: fill }),
2614
2634
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -2663,7 +2683,7 @@ class PolygonStyleHelper {
2663
2683
  */
2664
2684
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
2665
2685
  return new Style({
2666
- image: new Circle({
2686
+ image: new Circle$1({
2667
2687
  fill: new Fill({
2668
2688
  color: stroke,
2669
2689
  }),
@@ -2771,5 +2791,5 @@ class StringifyFeatureHelper {
2771
2791
  * Generated bundle index. Do not edit.
2772
2792
  */
2773
2793
 
2774
- export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, 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 };
2794
+ export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, MapClickEvent, MapConstants, 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 };
2775
2795
  //# sourceMappingURL=maps-components.mjs.map