@artstesh/maps 5.2.6 → 5.2.8

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 (43) hide show
  1. package/dist/esm2022/map/helpers/text-style.helper.mjs +15 -7
  2. package/dist/esm2022/map/messages/commands/modify-feature.command.mjs +2 -2
  3. package/dist/esm2022/map/messages/commands/start-drawing.command.mjs +1 -1
  4. package/dist/esm2022/map/messages/executors/generate-draw.executor.mjs +1 -1
  5. package/dist/esm2022/map/messages/executors/get-geometry-length.executor.mjs +18 -0
  6. package/dist/esm2022/map/messages/index.mjs +2 -1
  7. package/dist/esm2022/map/models/drawing-type.enum.mjs +2 -1
  8. package/dist/esm2022/map/ol-proxy.mjs +4 -1
  9. package/dist/esm2022/map/services/drawing/drawing-generation.service.mjs +2 -2
  10. package/dist/esm2022/map/services/map-click.service.mjs +2 -2
  11. package/dist/esm2022/map/services/message-registrator.service.mjs +3 -1
  12. package/dist/esm2022/src/map/helpers/text-style.helper.mjs +15 -7
  13. package/dist/esm2022/src/map/messages/commands/modify-feature.command.mjs +2 -2
  14. package/dist/esm2022/src/map/messages/commands/start-drawing.command.mjs +1 -1
  15. package/dist/esm2022/src/map/messages/executors/generate-draw.executor.mjs +1 -1
  16. package/dist/esm2022/src/map/messages/executors/get-geometry-length.executor.mjs +18 -0
  17. package/dist/esm2022/src/map/messages/index.mjs +2 -1
  18. package/dist/esm2022/src/map/models/drawing-type.enum.mjs +2 -1
  19. package/dist/esm2022/src/map/ol-proxy.mjs +4 -1
  20. package/dist/esm2022/src/map/services/drawing/drawing-generation.service.mjs +2 -2
  21. package/dist/esm2022/src/map/services/map-click.service.mjs +2 -2
  22. package/dist/esm2022/src/map/services/message-registrator.service.mjs +3 -1
  23. package/dist/fesm2022/maps-components-src-map.mjs +45 -15
  24. package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
  25. package/dist/fesm2022/maps-components.mjs +45 -15
  26. package/dist/fesm2022/maps-components.mjs.map +1 -1
  27. package/dist/map/helpers/text-style.helper.d.ts +10 -6
  28. package/dist/map/messages/commands/modify-feature.command.d.ts +4 -4
  29. package/dist/map/messages/commands/start-drawing.command.d.ts +3 -3
  30. package/dist/map/messages/executors/generate-draw.executor.d.ts +3 -3
  31. package/dist/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  32. package/dist/map/messages/index.d.ts +1 -0
  33. package/dist/map/models/drawing-type.enum.d.ts +2 -1
  34. package/dist/map/ol-proxy.d.ts +4 -0
  35. package/dist/src/map/helpers/text-style.helper.d.ts +10 -6
  36. package/dist/src/map/messages/commands/modify-feature.command.d.ts +4 -4
  37. package/dist/src/map/messages/commands/start-drawing.command.d.ts +3 -3
  38. package/dist/src/map/messages/executors/generate-draw.executor.d.ts +3 -3
  39. package/dist/src/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  40. package/dist/src/map/messages/index.d.ts +1 -0
  41. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  42. package/dist/src/map/ol-proxy.d.ts +4 -0
  43. 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
  subs = [];
@@ -277,6 +281,7 @@ var DrawingType;
277
281
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
278
282
  DrawingType[DrawingType["Square"] = 3] = "Square";
279
283
  DrawingType[DrawingType["Box"] = 4] = "Box";
284
+ DrawingType[DrawingType["LineString"] = 5] = "LineString";
280
285
  })(DrawingType || (DrawingType = {}));
281
286
 
282
287
  /**
@@ -413,7 +418,7 @@ class ModifyFeatureCommand extends PostboyCallbackMessage {
413
418
  * Constructs an instance of the class.
414
419
  *
415
420
  * @param {PolygonModel} model - The model representing the polygon data.
416
- * @param {Style} style - The style to be applied to the polygon.
421
+ * @param {StyleLike} style - The style to be applied to the polygon.
417
422
  * @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the feature, defaults to GeoJson.
418
423
  * @param {boolean} [draggable=true] - Determines whether the polygon is draggable, defaults to true.
419
424
  */
@@ -737,6 +742,22 @@ class FitToFeaturesCommand extends PostboyGenericMessage {
737
742
  }
738
743
  }
739
744
 
745
+ class GetGeometryLengthExecutor extends PostboyExecutor {
746
+ geometry;
747
+ projection;
748
+ static ID = '763146df-6d93-4dc2-a532-0e9ba2b2d023';
749
+ constructor(geometry, projection = 'EPSG:4326') {
750
+ super();
751
+ this.geometry = geometry;
752
+ this.projection = projection;
753
+ }
754
+ }
755
+ class GetGeometryLengthExecutorHandler {
756
+ handle(executor) {
757
+ return Math.round(getLength(executor.geometry, { projection: executor.projection }) * 100) / 100;
758
+ }
759
+ }
760
+
740
761
  class AddLayerCommand extends PostboyGenericMessage {
741
762
  layer;
742
763
  static ID = '7fe68d71-350f-47e2-b1ae-62cc333e1572';
@@ -801,7 +822,7 @@ class DrawingGenerationService {
801
822
  static getDraw(ev) {
802
823
  return new Draw({
803
824
  source: ev.layer.getSource(),
804
- type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
825
+ type: ev.type === DrawingType.Polygon ? 'Polygon' : ev.type === DrawingType.LineString ? 'LineString' : 'Circle',
805
826
  style: ev.style,
806
827
  geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
807
828
  });
@@ -1222,7 +1243,7 @@ class MapClickService {
1222
1243
  const model = new MapClickEvent(ev.coordinate, {}, {});
1223
1244
  this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
1224
1245
  this.getFeatureCollectionWithInner([f])
1225
- .filter((f) => f.getId() != null)
1246
+ .filter((f) => f.getId() != null && !!l)
1226
1247
  .forEach((fs) => {
1227
1248
  let layerName = l.get('name');
1228
1249
  if (!model.entities[layerName])
@@ -1510,6 +1531,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1510
1531
  this.recordExecutor(GenerateDrawExecutor, (e) => DrawingGenerationService.getDraw(e));
1511
1532
  this.recordExecutor(GenerateZoomControlExecutor, (e) => ZoomControlFactory.build(e.settings));
1512
1533
  this.recordExecutor(GetMapPositionExecutor, () => this.state.getMapPosition());
1534
+ this.recordExecutor(GetGeometryLengthExecutor, (e) => new GetGeometryLengthExecutorHandler().handle(e));
1513
1535
  }
1514
1536
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", 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 });
1515
1537
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService });
@@ -3319,7 +3341,7 @@ class MarkerStyleHelper {
3319
3341
  */
3320
3342
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
3321
3343
  return new Style({
3322
- image: new Circle({
3344
+ image: new Circle$1({
3323
3345
  radius,
3324
3346
  fill: new Fill({ color: fill }),
3325
3347
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -3374,7 +3396,7 @@ class PolygonStyleHelper {
3374
3396
  */
3375
3397
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
3376
3398
  return new Style({
3377
- image: new Circle({
3399
+ image: new Circle$1({
3378
3400
  fill: new Fill({
3379
3401
  color: stroke,
3380
3402
  }),
@@ -3396,14 +3418,18 @@ class PolygonStyleHelper {
3396
3418
  */
3397
3419
  class TextStyleHelper {
3398
3420
  /**
3399
- * Creates a new instance of the Text class with the specified properties.
3421
+ * Creates and returns a new Text instance with specified styling properties.
3400
3422
  *
3401
- * @param {string} text - The text content of the Text object.
3402
- * @param {string} font - The font style of the Text object.
3403
- * @param {string} color - The color of the Text object.
3404
- * @return {Text} A new instance of the Text class.
3423
+ * @param {string} text - The text content to display.
3424
+ * @param {string} font - The font style to use for the text.
3425
+ * @param {string} color - The color of the text.
3426
+ * @param {string|null|undefined} [backColor] - The background color of the text. Optional.
3427
+ * @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
3428
+ * @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
3429
+ * @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
3430
+ * @return {Text} A new Text instance configured with the specified properties.
3405
3431
  */
3406
- static get(text, font, color) {
3432
+ static get(text, font, color, backColor, padding, textBaseline, offsetY) {
3407
3433
  return new Text({
3408
3434
  text: text,
3409
3435
  font: font,
@@ -3411,6 +3437,10 @@ class TextStyleHelper {
3411
3437
  fill: new Fill({
3412
3438
  color: color,
3413
3439
  }),
3440
+ backgroundFill: backColor ? new Fill({ color: backColor }) : undefined,
3441
+ padding: padding ?? undefined,
3442
+ textBaseline: textBaseline ?? undefined,
3443
+ offsetY: offsetY ?? undefined,
3414
3444
  });
3415
3445
  }
3416
3446
  }
@@ -3482,5 +3512,5 @@ class StringifyFeatureHelper {
3482
3512
  * Generated bundle index. Do not edit.
3483
3513
  */
3484
3514
 
3485
- 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 };
3515
+ 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 };
3486
3516
  //# sourceMappingURL=maps-components.mjs.map