@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(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
  /**
@@ -2003,6 +2022,7 @@ class MapPlateFactory {
2003
2022
  maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
2004
2023
  }),
2005
2024
  layers: [],
2025
+ interactions: defaults(settings.interactionSettings),
2006
2026
  });
2007
2027
  }
2008
2028
  }
@@ -2533,7 +2553,7 @@ class MarkerStyleHelper {
2533
2553
  */
2534
2554
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
2535
2555
  return new Style({
2536
- image: new Circle({
2556
+ image: new Circle$1({
2537
2557
  radius,
2538
2558
  fill: new Fill({ color: fill }),
2539
2559
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -2588,7 +2608,7 @@ class PolygonStyleHelper {
2588
2608
  */
2589
2609
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
2590
2610
  return new Style({
2591
- image: new Circle({
2611
+ image: new Circle$1({
2592
2612
  fill: new Fill({
2593
2613
  color: stroke,
2594
2614
  }),
@@ -2696,5 +2716,5 @@ class StringifyFeatureHelper {
2696
2716
  * Generated bundle index. Do not edit.
2697
2717
  */
2698
2718
 
2699
- 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 };
2719
+ 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 };
2700
2720
  //# sourceMappingURL=maps-components.mjs.map