@artstesh/maps 4.1.28 → 4.1.29

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.
Files changed (41) hide show
  1. package/dist/esm2020/map/helpers/text-style.helper.mjs +15 -7
  2. package/dist/esm2020/map/messages/commands/start-drawing.command.mjs +1 -1
  3. package/dist/esm2020/map/messages/executors/generate-draw.executor.mjs +1 -1
  4. package/dist/esm2020/map/messages/executors/get-geometry-length.executor.mjs +16 -0
  5. package/dist/esm2020/map/messages/index.mjs +2 -1
  6. package/dist/esm2020/map/models/drawing-type.enum.mjs +2 -1
  7. package/dist/esm2020/map/ol-proxy.mjs +4 -1
  8. package/dist/esm2020/map/services/drawing/drawing-generation.service.mjs +2 -2
  9. package/dist/esm2020/map/services/message-registrator.service.mjs +3 -1
  10. package/dist/esm2020/src/map/helpers/text-style.helper.mjs +15 -7
  11. package/dist/esm2020/src/map/messages/commands/start-drawing.command.mjs +1 -1
  12. package/dist/esm2020/src/map/messages/executors/generate-draw.executor.mjs +1 -1
  13. package/dist/esm2020/src/map/messages/executors/get-geometry-length.executor.mjs +16 -0
  14. package/dist/esm2020/src/map/messages/index.mjs +2 -1
  15. package/dist/esm2020/src/map/models/drawing-type.enum.mjs +2 -1
  16. package/dist/esm2020/src/map/ol-proxy.mjs +4 -1
  17. package/dist/esm2020/src/map/services/drawing/drawing-generation.service.mjs +2 -2
  18. package/dist/esm2020/src/map/services/message-registrator.service.mjs +3 -1
  19. package/dist/fesm2015/maps-components-src-map.mjs +41 -13
  20. package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
  21. package/dist/fesm2015/maps-components.mjs +41 -13
  22. package/dist/fesm2015/maps-components.mjs.map +1 -1
  23. package/dist/fesm2020/maps-components-src-map.mjs +41 -13
  24. package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
  25. package/dist/fesm2020/maps-components.mjs +41 -13
  26. package/dist/fesm2020/maps-components.mjs.map +1 -1
  27. package/dist/map/helpers/text-style.helper.d.ts +10 -6
  28. package/dist/map/messages/commands/start-drawing.command.d.ts +3 -3
  29. package/dist/map/messages/executors/generate-draw.executor.d.ts +3 -3
  30. package/dist/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  31. package/dist/map/messages/index.d.ts +1 -0
  32. package/dist/map/models/drawing-type.enum.d.ts +2 -1
  33. package/dist/map/ol-proxy.d.ts +4 -0
  34. package/dist/src/map/helpers/text-style.helper.d.ts +10 -6
  35. package/dist/src/map/messages/commands/start-drawing.command.d.ts +3 -3
  36. package/dist/src/map/messages/executors/generate-draw.executor.d.ts +3 -3
  37. package/dist/src/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  38. package/dist/src/map/messages/index.d.ts +1 -0
  39. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  40. package/dist/src/map/ol-proxy.d.ts +4 -0
  41. package/package.json +1 -1
@@ -5,15 +5,17 @@ import { CommonModule } from '@angular/common';
5
5
  import { Feature, Collection } from 'ol';
6
6
  export { Feature } from 'ol';
7
7
  import { Point, LineString } from 'ol/geom';
8
+ export { Geometry, LineString, Point } from 'ol/geom';
8
9
  import { GeoJSON, WKT } from 'ol/format';
9
10
  import { getCenter, createEmpty, extend } from 'ol/extent';
10
11
  import Polygon, { circular, fromExtent } from 'ol/geom/Polygon';
11
12
  import { Control, Zoom } from 'ol/control';
12
13
  import { get, useGeographic, transform } from 'ol/proj';
13
14
  import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
15
+ import * as Sphere from 'ol/sphere';
16
+ import { getLength } from 'ol/sphere';
14
17
  import { Draw, Modify, Translate, defaults } from 'ol/interaction';
15
18
  import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
16
- import * as Sphere from 'ol/sphere';
17
19
  import { Subject, combineLatest } from 'rxjs';
18
20
  import { first, debounceTime, filter, auditTime } from 'rxjs/operators';
19
21
  import { Dictionary } from '@artstesh/collections';
@@ -30,9 +32,11 @@ import Map from 'ol/Map';
30
32
  import View from 'ol/View';
31
33
  import Overlay from 'ol/Overlay';
32
34
  import Style from 'ol/style/Style';
33
- import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
34
- export { Style } from 'ol/style';
35
+ import { Icon, Circle as Circle$1, Fill, Stroke, Text } from 'ol/style';
36
+ export { Fill, RegularShape, Stroke, Style, Text } from 'ol/style';
35
37
  import { METERS_PER_UNIT } from 'ol/proj/epsg4326';
38
+ import * as Circle from 'ol/style/Circle';
39
+ export { Circle as CircleStyle };
36
40
 
37
41
  class DestructibleComponent {
38
42
  constructor() {
@@ -270,6 +274,7 @@ var DrawingType;
270
274
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
271
275
  DrawingType[DrawingType["Square"] = 3] = "Square";
272
276
  DrawingType[DrawingType["Box"] = 4] = "Box";
277
+ DrawingType[DrawingType["LineString"] = 5] = "LineString";
273
278
  })(DrawingType || (DrawingType = {}));
274
279
 
275
280
  /**
@@ -690,6 +695,20 @@ class FitToFeaturesCommand extends PostboyGenericMessage {
690
695
  }
691
696
  FitToFeaturesCommand.ID = '04d67609-0b4c-4f52-aa53-ad0a3db967dc';
692
697
 
698
+ class GetGeometryLengthExecutor extends PostboyExecutor {
699
+ constructor(geometry, projection = 'EPSG:4326') {
700
+ super();
701
+ this.geometry = geometry;
702
+ this.projection = projection;
703
+ }
704
+ }
705
+ GetGeometryLengthExecutor.ID = '763146df-6d93-4dc2-a532-0e9ba2b2d023';
706
+ class GetGeometryLengthExecutorHandler {
707
+ handle(executor) {
708
+ return Math.round(getLength(executor.geometry, { projection: executor.projection }) * 100) / 100;
709
+ }
710
+ }
711
+
693
712
  class AddLayerCommand extends PostboyGenericMessage {
694
713
  constructor(layer) {
695
714
  super();
@@ -747,7 +766,7 @@ class DrawingGenerationService {
747
766
  static getDraw(ev) {
748
767
  return new Draw({
749
768
  source: ev.layer.getSource(),
750
- type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
769
+ type: ev.type === DrawingType.Polygon ? 'Polygon' : ev.type === DrawingType.LineString ? 'LineString' : 'Circle',
751
770
  style: ev.style,
752
771
  geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
753
772
  });
@@ -1432,6 +1451,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1432
1451
  this.recordExecutor(GenerateDrawExecutor, (e) => DrawingGenerationService.getDraw(e));
1433
1452
  this.recordExecutor(GenerateZoomControlExecutor, (e) => ZoomControlFactory.build(e.settings));
1434
1453
  this.recordExecutor(GetMapPositionExecutor, () => this.state.getMapPosition());
1454
+ this.recordExecutor(GetGeometryLengthExecutor, (e) => new GetGeometryLengthExecutorHandler().handle(e));
1435
1455
  }
1436
1456
  }
1437
1457
  MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", 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 });
@@ -3198,7 +3218,7 @@ class MarkerStyleHelper {
3198
3218
  */
3199
3219
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
3200
3220
  return new Style({
3201
- image: new Circle({
3221
+ image: new Circle$1({
3202
3222
  radius,
3203
3223
  fill: new Fill({ color: fill }),
3204
3224
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -3253,7 +3273,7 @@ class PolygonStyleHelper {
3253
3273
  */
3254
3274
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
3255
3275
  return new Style({
3256
- image: new Circle({
3276
+ image: new Circle$1({
3257
3277
  fill: new Fill({
3258
3278
  color: stroke,
3259
3279
  }),
@@ -3275,14 +3295,18 @@ class PolygonStyleHelper {
3275
3295
  */
3276
3296
  class TextStyleHelper {
3277
3297
  /**
3278
- * Creates a new instance of the Text class with the specified properties.
3298
+ * Creates and returns a new Text instance with specified styling properties.
3279
3299
  *
3280
- * @param {string} text - The text content of the Text object.
3281
- * @param {string} font - The font style of the Text object.
3282
- * @param {string} color - The color of the Text object.
3283
- * @return {Text} A new instance of the Text class.
3300
+ * @param {string} text - The text content to display.
3301
+ * @param {string} font - The font style to use for the text.
3302
+ * @param {string} color - The color of the text.
3303
+ * @param {string|null|undefined} [backColor] - The background color of the text. Optional.
3304
+ * @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
3305
+ * @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
3306
+ * @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
3307
+ * @return {Text} A new Text instance configured with the specified properties.
3284
3308
  */
3285
- static get(text, font, color) {
3309
+ static get(text, font, color, backColor, padding, textBaseline, offsetY) {
3286
3310
  return new Text({
3287
3311
  text: text,
3288
3312
  font: font,
@@ -3290,6 +3314,10 @@ class TextStyleHelper {
3290
3314
  fill: new Fill({
3291
3315
  color: color,
3292
3316
  }),
3317
+ backgroundFill: backColor ? new Fill({ color: backColor }) : undefined,
3318
+ padding: padding ?? undefined,
3319
+ textBaseline: textBaseline ?? undefined,
3320
+ offsetY: offsetY ?? undefined,
3293
3321
  });
3294
3322
  }
3295
3323
  }
@@ -3357,5 +3385,5 @@ class StringifyFeatureHelper {
3357
3385
  * Generated bundle index. Do not edit.
3358
3386
  */
3359
3387
 
3360
- export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, ImageLayerComponent, ImageLayerSettings, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPointerMoveEvent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonSelfIntersectionExecutor, PolygonStyleHelper, PolygonsComponent, RasterTileLayerComponent, RasterTileLayerSettings, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
3388
+ export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetGeometryLengthExecutor, GetMapPositionExecutor, ImageLayerComponent, ImageLayerSettings, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPointerMoveEvent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonSelfIntersectionExecutor, PolygonStyleHelper, PolygonsComponent, RasterTileLayerComponent, RasterTileLayerSettings, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
3361
3389
  //# sourceMappingURL=maps-components-src-map.mjs.map