@artstesh/maps 1.1.27 → 1.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 (47) hide show
  1. package/dist/bundles/maps-components-src-map.umd.js +75 -13
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +75 -13
  4. package/dist/bundles/maps-components.umd.js.map +1 -1
  5. package/dist/esm2015/map/helpers/text-style.helper.js +15 -7
  6. package/dist/esm2015/map/messages/commands/modify-feature.command.js +2 -2
  7. package/dist/esm2015/map/messages/commands/start-drawing.command.js +1 -1
  8. package/dist/esm2015/map/messages/executors/generate-draw.executor.js +1 -1
  9. package/dist/esm2015/map/messages/executors/get-geometry-length.executor.js +16 -0
  10. package/dist/esm2015/map/messages/index.js +2 -1
  11. package/dist/esm2015/map/models/drawing-type.enum.js +2 -1
  12. package/dist/esm2015/map/ol-proxy.js +4 -1
  13. package/dist/esm2015/map/services/drawing/drawing-generation.service.js +2 -2
  14. package/dist/esm2015/map/services/map-click.service.js +2 -2
  15. package/dist/esm2015/map/services/message-registrator.service.js +3 -1
  16. package/dist/esm2015/src/map/helpers/text-style.helper.js +15 -7
  17. package/dist/esm2015/src/map/messages/commands/modify-feature.command.js +2 -2
  18. package/dist/esm2015/src/map/messages/commands/start-drawing.command.js +1 -1
  19. package/dist/esm2015/src/map/messages/executors/generate-draw.executor.js +1 -1
  20. package/dist/esm2015/src/map/messages/executors/get-geometry-length.executor.js +16 -0
  21. package/dist/esm2015/src/map/messages/index.js +2 -1
  22. package/dist/esm2015/src/map/models/drawing-type.enum.js +2 -1
  23. package/dist/esm2015/src/map/ol-proxy.js +4 -1
  24. package/dist/esm2015/src/map/services/drawing/drawing-generation.service.js +2 -2
  25. package/dist/esm2015/src/map/services/map-click.service.js +2 -2
  26. package/dist/esm2015/src/map/services/message-registrator.service.js +3 -1
  27. package/dist/fesm2015/maps-components-src-map.js +43 -15
  28. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  29. package/dist/fesm2015/maps-components.js +43 -15
  30. package/dist/fesm2015/maps-components.js.map +1 -1
  31. package/dist/map/helpers/text-style.helper.d.ts +10 -6
  32. package/dist/map/messages/commands/modify-feature.command.d.ts +4 -4
  33. package/dist/map/messages/commands/start-drawing.command.d.ts +3 -3
  34. package/dist/map/messages/executors/generate-draw.executor.d.ts +3 -3
  35. package/dist/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  36. package/dist/map/messages/index.d.ts +1 -0
  37. package/dist/map/models/drawing-type.enum.d.ts +2 -1
  38. package/dist/map/ol-proxy.d.ts +4 -0
  39. package/dist/src/map/helpers/text-style.helper.d.ts +10 -6
  40. package/dist/src/map/messages/commands/modify-feature.command.d.ts +4 -4
  41. package/dist/src/map/messages/commands/start-drawing.command.d.ts +3 -3
  42. package/dist/src/map/messages/executors/generate-draw.executor.d.ts +3 -3
  43. package/dist/src/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  44. package/dist/src/map/messages/index.d.ts +1 -0
  45. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  46. package/dist/src/map/ol-proxy.d.ts +4 -0
  47. 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() {
@@ -271,6 +275,7 @@ var DrawingType;
271
275
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
272
276
  DrawingType[DrawingType["Square"] = 3] = "Square";
273
277
  DrawingType[DrawingType["Box"] = 4] = "Box";
278
+ DrawingType[DrawingType["LineString"] = 5] = "LineString";
274
279
  })(DrawingType || (DrawingType = {}));
275
280
 
276
281
  /**
@@ -394,7 +399,7 @@ class ModifyFeatureCommand extends PostboyCallbackMessage {
394
399
  * Constructs an instance of the class.
395
400
  *
396
401
  * @param {PolygonModel} model - The model representing the polygon data.
397
- * @param {Style} style - The style to be applied to the polygon.
402
+ * @param {StyleLike} style - The style to be applied to the polygon.
398
403
  * @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the feature, defaults to GeoJson.
399
404
  * @param {boolean} [draggable=true] - Determines whether the polygon is draggable, defaults to true.
400
405
  */
@@ -691,6 +696,20 @@ class FitToFeaturesCommand extends PostboyGenericMessage {
691
696
  }
692
697
  FitToFeaturesCommand.ID = '04d67609-0b4c-4f52-aa53-ad0a3db967dc';
693
698
 
699
+ class GetGeometryLengthExecutor extends PostboyExecutor {
700
+ constructor(geometry, projection = 'EPSG:4326') {
701
+ super();
702
+ this.geometry = geometry;
703
+ this.projection = projection;
704
+ }
705
+ }
706
+ GetGeometryLengthExecutor.ID = '763146df-6d93-4dc2-a532-0e9ba2b2d023';
707
+ class GetGeometryLengthExecutorHandler {
708
+ handle(executor) {
709
+ return Math.round(getLength(executor.geometry, { projection: executor.projection }) * 100) / 100;
710
+ }
711
+ }
712
+
694
713
  class AddLayerCommand extends PostboyGenericMessage {
695
714
  constructor(layer) {
696
715
  super();
@@ -748,7 +767,7 @@ class DrawingGenerationService {
748
767
  static getDraw(ev) {
749
768
  return new Draw({
750
769
  source: ev.layer.getSource(),
751
- type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
770
+ type: ev.type === DrawingType.Polygon ? 'Polygon' : ev.type === DrawingType.LineString ? 'LineString' : 'Circle',
752
771
  style: ev.style,
753
772
  geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
754
773
  });
@@ -1164,7 +1183,7 @@ class MapClickService {
1164
1183
  const model = new MapClickEvent(ev.coordinate, {}, {});
1165
1184
  (_a = this.map) === null || _a === void 0 ? void 0 : _a.forEachFeatureAtPixel(ev.pixel, (f, l) => {
1166
1185
  this.getFeatureCollectionWithInner([f])
1167
- .filter((f) => f.getId() != null)
1186
+ .filter((f) => f.getId() != null && !!l)
1168
1187
  .forEach((fs) => {
1169
1188
  let layerName = l.get('name');
1170
1189
  if (!model.entities[layerName])
@@ -1448,6 +1467,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1448
1467
  this.recordExecutor(GenerateDrawExecutor, (e) => DrawingGenerationService.getDraw(e));
1449
1468
  this.recordExecutor(GenerateZoomControlExecutor, (e) => ZoomControlFactory.build(e.settings));
1450
1469
  this.recordExecutor(GetMapPositionExecutor, () => this.state.getMapPosition());
1470
+ this.recordExecutor(GetGeometryLengthExecutor, (e) => new GetGeometryLengthExecutorHandler().handle(e));
1451
1471
  }
1452
1472
  }
1453
1473
  MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", 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 });
@@ -3278,7 +3298,7 @@ class MarkerStyleHelper {
3278
3298
  */
3279
3299
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
3280
3300
  return new Style({
3281
- image: new Circle({
3301
+ image: new Circle$1({
3282
3302
  radius,
3283
3303
  fill: new Fill({ color: fill }),
3284
3304
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -3333,7 +3353,7 @@ class PolygonStyleHelper {
3333
3353
  */
3334
3354
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
3335
3355
  return new Style({
3336
- image: new Circle({
3356
+ image: new Circle$1({
3337
3357
  fill: new Fill({
3338
3358
  color: stroke,
3339
3359
  }),
@@ -3355,14 +3375,18 @@ class PolygonStyleHelper {
3355
3375
  */
3356
3376
  class TextStyleHelper {
3357
3377
  /**
3358
- * Creates a new instance of the Text class with the specified properties.
3378
+ * Creates and returns a new Text instance with specified styling properties.
3359
3379
  *
3360
- * @param {string} text - The text content of the Text object.
3361
- * @param {string} font - The font style of the Text object.
3362
- * @param {string} color - The color of the Text object.
3363
- * @return {Text} A new instance of the Text class.
3380
+ * @param {string} text - The text content to display.
3381
+ * @param {string} font - The font style to use for the text.
3382
+ * @param {string} color - The color of the text.
3383
+ * @param {string|null|undefined} [backColor] - The background color of the text. Optional.
3384
+ * @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
3385
+ * @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
3386
+ * @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
3387
+ * @return {Text} A new Text instance configured with the specified properties.
3364
3388
  */
3365
- static get(text, font, color) {
3389
+ static get(text, font, color, backColor, padding, textBaseline, offsetY) {
3366
3390
  return new Text({
3367
3391
  text: text,
3368
3392
  font: font,
@@ -3370,6 +3394,10 @@ class TextStyleHelper {
3370
3394
  fill: new Fill({
3371
3395
  color: color,
3372
3396
  }),
3397
+ backgroundFill: backColor ? new Fill({ color: backColor }) : undefined,
3398
+ padding: padding !== null && padding !== void 0 ? padding : undefined,
3399
+ textBaseline: textBaseline !== null && textBaseline !== void 0 ? textBaseline : undefined,
3400
+ offsetY: offsetY !== null && offsetY !== void 0 ? offsetY : undefined,
3373
3401
  });
3374
3402
  }
3375
3403
  }
@@ -3441,5 +3469,5 @@ class StringifyFeatureHelper {
3441
3469
  * Generated bundle index. Do not edit.
3442
3470
  */
3443
3471
 
3444
- 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 };
3472
+ 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 };
3445
3473
  //# sourceMappingURL=maps-components.js.map