@artstesh/maps 4.1.17 → 4.1.19

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 {
@@ -77,6 +77,7 @@ class MapSettings {
77
77
  this.zoom = 4;
78
78
  this.lyrs = MapLyrs.Hybrid;
79
79
  this.language = 'en';
80
+ this.interactionSettings = {};
80
81
  }
81
82
  static copy(model) {
82
83
  const result = new MapSettings();
@@ -85,9 +86,20 @@ class MapSettings {
85
86
  result.minZoom = model.minZoom;
86
87
  result.zoom = model.zoom;
87
88
  result.lyrs = model.lyrs;
89
+ result.interactionSettings = model.interactionSettings;
88
90
  result.language = model.language;
89
91
  return result;
90
92
  }
93
+ /**
94
+ * Updates the interaction settings of the map and returns a new MapSettings instance
95
+ * with the updated settings.
96
+ *
97
+ * @param {DefaultsOptions} interactionSettings - The new interaction settings to be applied.
98
+ * @return {MapSettings} A new MapSettings instance with the updated interaction settings.
99
+ */
100
+ setInteractionSettings(interactionSettings) {
101
+ return MapSettings.copy({ ...this, interactionSettings });
102
+ }
91
103
  /**
92
104
  * Sets the center for the map settings.
93
105
  *
@@ -159,6 +171,8 @@ class MapSettings {
159
171
  return false;
160
172
  if (this.language !== model.language)
161
173
  return false;
174
+ if (this.interactionSettings !== model.interactionSettings)
175
+ return false;
162
176
  return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
163
177
  }
164
178
  }
@@ -224,6 +238,11 @@ class PolygonModel {
224
238
  feature.setId(id);
225
239
  return new PolygonModel(feature, id, info);
226
240
  }
241
+ static circle(id, lat, lng, radius, info) {
242
+ let feature = new Feature(new Circle([lng, lat], radius));
243
+ feature.setId(id);
244
+ return new PolygonModel(feature, id, info);
245
+ }
227
246
  }
228
247
 
229
248
  /**
@@ -1983,6 +2002,7 @@ class MapPlateFactory {
1983
2002
  maxZoom: settings?.maxZoom || 19,
1984
2003
  }),
1985
2004
  layers: [],
2005
+ interactions: defaults(settings.interactionSettings),
1986
2006
  });
1987
2007
  }
1988
2008
  }
@@ -2510,7 +2530,7 @@ class MarkerStyleHelper {
2510
2530
  */
2511
2531
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
2512
2532
  return new Style({
2513
- image: new Circle({
2533
+ image: new Circle$1({
2514
2534
  radius,
2515
2535
  fill: new Fill({ color: fill }),
2516
2536
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -2565,7 +2585,7 @@ class PolygonStyleHelper {
2565
2585
  */
2566
2586
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
2567
2587
  return new Style({
2568
- image: new Circle({
2588
+ image: new Circle$1({
2569
2589
  fill: new Fill({
2570
2590
  color: stroke,
2571
2591
  }),
@@ -2669,5 +2689,5 @@ class StringifyFeatureHelper {
2669
2689
  * Generated bundle index. Do not edit.
2670
2690
  */
2671
2691
 
2672
- 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 };
2692
+ 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 };
2673
2693
  //# sourceMappingURL=maps-components-src-map.mjs.map