@artstesh/maps 1.1.16 → 1.1.18

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 i6 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(Object.assign(Object.assign({}, 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
  }
@@ -225,6 +239,11 @@ class PolygonModel {
225
239
  feature.setId(id);
226
240
  return new PolygonModel(feature, id, info);
227
241
  }
242
+ static circle(id, lat, lng, radius, info) {
243
+ let feature = new Feature(new Circle([lng, lat], radius));
244
+ feature.setId(id);
245
+ return new PolygonModel(feature, id, info);
246
+ }
228
247
  }
229
248
 
230
249
  /**
@@ -2024,6 +2043,7 @@ class MapPlateFactory {
2024
2043
  maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
2025
2044
  }),
2026
2045
  layers: [],
2046
+ interactions: defaults(settings.interactionSettings),
2027
2047
  });
2028
2048
  }
2029
2049
  }
@@ -2580,7 +2600,7 @@ class MarkerStyleHelper {
2580
2600
  */
2581
2601
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
2582
2602
  return new Style({
2583
- image: new Circle({
2603
+ image: new Circle$1({
2584
2604
  radius,
2585
2605
  fill: new Fill({ color: fill }),
2586
2606
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -2635,7 +2655,7 @@ class PolygonStyleHelper {
2635
2655
  */
2636
2656
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
2637
2657
  return new Style({
2638
- image: new Circle({
2658
+ image: new Circle$1({
2639
2659
  fill: new Fill({
2640
2660
  color: stroke,
2641
2661
  }),
@@ -2743,5 +2763,5 @@ class StringifyFeatureHelper {
2743
2763
  * Generated bundle index. Do not edit.
2744
2764
  */
2745
2765
 
2746
- 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 };
2766
+ 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 };
2747
2767
  //# sourceMappingURL=maps-components.js.map