@artstesh/maps 4.0.10 → 4.1.0

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 (92) hide show
  1. package/dist/esm2020/map/helpers/polygon-style.helper.mjs +19 -2
  2. package/dist/esm2020/map/map-plate/controls/index.mjs +3 -0
  3. package/dist/esm2020/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +49 -0
  4. package/dist/esm2020/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +13 -0
  5. package/dist/esm2020/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +47 -0
  6. package/dist/esm2020/map/map-plate/map-plate.component.mjs +4 -1
  7. package/dist/esm2020/map/map.module.mjs +8 -3
  8. package/dist/esm2020/map/messages/commands/cancel-feature-modification.command.mjs +8 -0
  9. package/dist/esm2020/map/messages/commands/modify-feature.command.mjs +15 -0
  10. package/dist/esm2020/map/messages/executors/filter-features-in-area.executor.mjs +13 -0
  11. package/dist/esm2020/map/messages/executors/generate-draw.executor.mjs +14 -0
  12. package/dist/esm2020/map/messages/executors/generate-zoom-control.executor.mjs +12 -0
  13. package/dist/esm2020/map/messages/index.mjs +3 -1
  14. package/dist/esm2020/map/models/drawing-type.enum.mjs +2 -1
  15. package/dist/esm2020/map/public-api.mjs +2 -1
  16. package/dist/esm2020/map/services/drawing/drawing-generation.service.mjs +16 -21
  17. package/dist/esm2020/map/services/drawing/drawing.service.mjs +8 -12
  18. package/dist/esm2020/map/services/drawing/feature-modification.service.mjs +99 -0
  19. package/dist/esm2020/map/services/feature.service.mjs +4 -17
  20. package/dist/esm2020/map/services/map-management.service.mjs +5 -13
  21. package/dist/esm2020/map/services/message-registrator.service.mjs +22 -11
  22. package/dist/esm2020/src/map/helpers/polygon-style.helper.mjs +19 -2
  23. package/dist/esm2020/src/map/map-plate/controls/index.mjs +3 -0
  24. package/dist/esm2020/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +49 -0
  25. package/dist/esm2020/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +13 -0
  26. package/dist/esm2020/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +47 -0
  27. package/dist/esm2020/src/map/map-plate/map-plate.component.mjs +4 -1
  28. package/dist/esm2020/src/map/map.module.mjs +8 -3
  29. package/dist/esm2020/src/map/messages/commands/cancel-feature-modification.command.mjs +8 -0
  30. package/dist/esm2020/src/map/messages/commands/modify-feature.command.mjs +15 -0
  31. package/dist/esm2020/src/map/messages/executors/filter-features-in-area.executor.mjs +13 -0
  32. package/dist/esm2020/src/map/messages/executors/generate-draw.executor.mjs +14 -0
  33. package/dist/esm2020/src/map/messages/executors/generate-zoom-control.executor.mjs +12 -0
  34. package/dist/esm2020/src/map/messages/index.mjs +3 -1
  35. package/dist/esm2020/src/map/models/drawing-type.enum.mjs +2 -1
  36. package/dist/esm2020/src/map/public-api.mjs +2 -1
  37. package/dist/esm2020/src/map/services/drawing/drawing-generation.service.mjs +16 -21
  38. package/dist/esm2020/src/map/services/drawing/drawing.service.mjs +8 -12
  39. package/dist/esm2020/src/map/services/drawing/feature-modification.service.mjs +99 -0
  40. package/dist/esm2020/src/map/services/feature.service.mjs +4 -17
  41. package/dist/esm2020/src/map/services/map-management.service.mjs +5 -13
  42. package/dist/esm2020/src/map/services/message-registrator.service.mjs +22 -11
  43. package/dist/fesm2015/maps-components-src-map.mjs +316 -83
  44. package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
  45. package/dist/fesm2015/maps-components.mjs +316 -83
  46. package/dist/fesm2015/maps-components.mjs.map +1 -1
  47. package/dist/fesm2020/maps-components-src-map.mjs +310 -82
  48. package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
  49. package/dist/fesm2020/maps-components.mjs +310 -82
  50. package/dist/fesm2020/maps-components.mjs.map +1 -1
  51. package/dist/map/helpers/polygon-style.helper.d.ts +1 -0
  52. package/dist/map/map-plate/controls/index.d.ts +2 -0
  53. package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
  54. package/dist/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
  55. package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
  56. package/dist/map/map.module.d.ts +3 -2
  57. package/dist/map/messages/commands/cancel-feature-modification.command.d.ts +5 -0
  58. package/dist/map/messages/commands/modify-feature.command.d.ts +11 -0
  59. package/dist/map/messages/{queries/filter-features-in-area.query.d.ts → executors/filter-features-in-area.executor.d.ts} +2 -2
  60. package/dist/map/messages/{queries/generate-draw.query.d.ts → executors/generate-draw.executor.d.ts} +2 -2
  61. package/dist/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
  62. package/dist/map/messages/index.d.ts +2 -0
  63. package/dist/map/models/drawing-type.enum.d.ts +2 -1
  64. package/dist/map/public-api.d.ts +1 -0
  65. package/dist/map/services/drawing/drawing-generation.service.d.ts +5 -9
  66. package/dist/map/services/drawing/feature-modification.service.d.ts +22 -0
  67. package/dist/map/services/feature.service.d.ts +6 -9
  68. package/dist/map/services/message-registrator.service.d.ts +3 -3
  69. package/dist/package.json +1 -1
  70. package/dist/src/map/helpers/polygon-style.helper.d.ts +1 -0
  71. package/dist/src/map/map-plate/controls/index.d.ts +2 -0
  72. package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
  73. package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
  74. package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
  75. package/dist/src/map/map.module.d.ts +3 -2
  76. package/dist/src/map/messages/commands/cancel-feature-modification.command.d.ts +5 -0
  77. package/dist/src/map/messages/commands/modify-feature.command.d.ts +11 -0
  78. package/dist/src/map/messages/{queries/filter-features-in-area.query.d.ts → executors/filter-features-in-area.executor.d.ts} +2 -2
  79. package/dist/src/map/messages/{queries/generate-draw.query.d.ts → executors/generate-draw.executor.d.ts} +2 -2
  80. package/dist/src/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
  81. package/dist/src/map/messages/index.d.ts +2 -0
  82. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  83. package/dist/src/map/public-api.d.ts +1 -0
  84. package/dist/src/map/services/drawing/drawing-generation.service.d.ts +5 -9
  85. package/dist/src/map/services/drawing/feature-modification.service.d.ts +22 -0
  86. package/dist/src/map/services/feature.service.d.ts +6 -9
  87. package/dist/src/map/services/message-registrator.service.d.ts +3 -3
  88. package/package.json +2 -2
  89. package/dist/esm2020/map/messages/queries/filter-features-in-area.query.mjs +0 -13
  90. package/dist/esm2020/map/messages/queries/generate-draw.query.mjs +0 -14
  91. package/dist/esm2020/src/map/messages/queries/filter-features-in-area.query.mjs +0 -13
  92. package/dist/esm2020/src/map/messages/queries/generate-draw.query.mjs +0 -14
@@ -2,23 +2,24 @@ import * as i0 from '@angular/core';
2
2
  import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgModule } from '@angular/core';
3
3
  import * as i4 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
- import { Feature } from 'ol';
5
+ import { Feature, Collection } from 'ol';
6
6
  import { Point, LineString } from 'ol/geom';
7
7
  import { GeoJSON, WKT } from 'ol/format';
8
8
  import { getCenter, createEmpty, extend } from 'ol/extent';
9
9
  import { get, useGeographic, transform } from 'ol/proj';
10
- import { PostboyGenericMessage, PostboyCallbackMessage, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
11
- import { forkJoin, combineLatest } from 'rxjs';
12
- import { tap, first, filter, auditTime } from 'rxjs/operators';
13
- import { Vector, XYZ } from 'ol/source';
14
- import { Draw } from 'ol/interaction';
10
+ import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
11
+ import { Draw, Modify, Translate } from 'ol/interaction';
15
12
  import { createRegularPolygon } from 'ol/interaction/Draw';
13
+ import { Zoom } from 'ol/control';
14
+ import { first, filter, auditTime } from 'rxjs/operators';
15
+ import { Vector, XYZ } from 'ol/source';
16
16
  import TileLayer from 'ol/layer/Tile';
17
17
  import OSM from 'ol/source/OSM';
18
18
  import { Vector as Vector$1 } from 'ol/layer';
19
19
  import { bbox } from 'ol/loadingstrategy';
20
20
  import Polygon, { fromExtent } from 'ol/geom/Polygon';
21
21
  import Cluster from 'ol/source/Cluster';
22
+ import { combineLatest } from 'rxjs';
22
23
  import Map from 'ol/Map';
23
24
  import View from 'ol/View';
24
25
  import Overlay from 'ol/Overlay';
@@ -179,6 +180,7 @@ var DrawingType;
179
180
  (function (DrawingType) {
180
181
  DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
181
182
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
183
+ DrawingType[DrawingType["Square"] = 3] = "Square";
182
184
  })(DrawingType || (DrawingType = {}));
183
185
 
184
186
  var FeatureOutputFormat;
@@ -323,6 +325,26 @@ class DrawSelectionAreaCommand extends PostboyCallbackMessage {
323
325
  }
324
326
  DrawSelectionAreaCommand.ID = '573d8a0d-f25b-42b7-9ad7-0ac6d86ac362';
325
327
 
328
+ class ModifyFeatureCommand extends PostboyCallbackMessage {
329
+ constructor(model, style, format = FeatureOutputFormat.GeoJson) {
330
+ super();
331
+ this.model = model;
332
+ this.style = style;
333
+ this.format = format;
334
+ }
335
+ get id() {
336
+ return ModifyFeatureCommand.ID;
337
+ }
338
+ }
339
+ ModifyFeatureCommand.ID = 'ead85caa-24c6-4844-a68c-2cea91774c8c';
340
+
341
+ class CancelFeatureModificationCommand extends PostboyGenericMessage {
342
+ get id() {
343
+ return CancelFeatureModificationCommand.ID;
344
+ }
345
+ }
346
+ CancelFeatureModificationCommand.ID = '9c9fb40f-ea95-4704-8177-0e9ecabf36fa';
347
+
326
348
  class AddLayerCommand extends PostboyGenericMessage {
327
349
  constructor(layer) {
328
350
  super();
@@ -412,42 +434,101 @@ class DrawingFinishedEvent extends PostboyGenericMessage {
412
434
  }
413
435
  DrawingFinishedEvent.ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
414
436
 
415
- class GenerateDrawQuery extends PostboyCallbackMessage {
416
- constructor(layer, style, type) {
437
+ class DrawingGenerationService {
438
+ static getDraw(ev) {
439
+ return new Draw({
440
+ source: ev.layer.getSource(),
441
+ type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
442
+ style: ev.style,
443
+ geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
444
+ });
445
+ }
446
+ static geometryFunc(type) {
447
+ switch (type) {
448
+ case DrawingType.Circle:
449
+ return createRegularPolygon(32);
450
+ case DrawingType.Square:
451
+ return createRegularPolygon(4);
452
+ }
453
+ return undefined;
454
+ }
455
+ }
456
+
457
+ class FeatureService {
458
+ constructor() { }
459
+ static filterFeaturesInArea(query) {
460
+ return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
461
+ }
462
+ static booleanIntersects(g1, g2) {
463
+ if (g2.getType() === 'Point')
464
+ return g1.intersectsCoordinate(g2.getCoordinates());
465
+ if (g2.getType() === 'Circle')
466
+ return g1.intersectsCoordinate(g2.getCenter());
467
+ if (g2.getType() === 'Polygon')
468
+ return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
469
+ return false;
470
+ }
471
+ }
472
+
473
+ class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
474
+ constructor(area, ignore = new Set()) {
417
475
  super();
418
- this.layer = layer;
419
- this.style = style;
420
- this.type = type;
476
+ this.area = area;
477
+ this.ignore = ignore;
421
478
  }
422
479
  get id() {
423
- return GenerateDrawQuery.ID;
480
+ return GetFeaturesInAreaQuery.ID;
424
481
  }
425
482
  }
426
- GenerateDrawQuery.ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
483
+ GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
427
484
 
428
- class FilterFeaturesInAreaQuery extends PostboyCallbackMessage {
485
+ class FilterFeaturesInAreaExecutor extends PostboyExecutor {
429
486
  constructor(area, features) {
430
487
  super();
431
488
  this.area = area;
432
489
  this.features = features;
433
490
  }
434
491
  get id() {
435
- return FilterFeaturesInAreaQuery.ID;
492
+ return FilterFeaturesInAreaExecutor.ID;
436
493
  }
437
494
  }
438
- FilterFeaturesInAreaQuery.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
495
+ FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
439
496
 
440
- class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
441
- constructor(area, ignore = new Set()) {
497
+ class GenerateDrawExecutor extends PostboyExecutor {
498
+ constructor(layer, style, type) {
442
499
  super();
443
- this.area = area;
444
- this.ignore = ignore;
500
+ this.layer = layer;
501
+ this.style = style;
502
+ this.type = type;
445
503
  }
446
504
  get id() {
447
- return GetFeaturesInAreaQuery.ID;
505
+ return GenerateDrawExecutor.ID;
448
506
  }
449
507
  }
450
- GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
508
+ GenerateDrawExecutor.ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
509
+
510
+ class GenerateZoomControlExecutor extends PostboyExecutor {
511
+ constructor(settings) {
512
+ super();
513
+ this.settings = settings;
514
+ }
515
+ get id() {
516
+ return GenerateZoomControlExecutor.ID;
517
+ }
518
+ }
519
+ GenerateZoomControlExecutor.ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
520
+
521
+ class ZoomControlFactory {
522
+ static build(settings) {
523
+ return new Zoom({
524
+ zoomInTipLabel: settings.zoomInLabel,
525
+ zoomOutTipLabel: settings.zoomOutLabel,
526
+ zoomInClassName: settings.zoomInClass,
527
+ zoomOutClassName: settings.zoomOutClass,
528
+ className: settings.controlClass,
529
+ });
530
+ }
531
+ }
451
532
 
452
533
  class MapPostboyService extends PostboyService {
453
534
  constructor() {
@@ -528,8 +609,6 @@ class MapManagementService {
528
609
  observeFeaturesInArea() {
529
610
  this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
530
611
  let result = new Dictionary();
531
- const queue = [];
532
- const queries = [];
533
612
  this.layers.forEach((l) => {
534
613
  let layerName = l.get('name');
535
614
  if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
@@ -537,14 +616,10 @@ class MapManagementService {
537
616
  let source = l.getSource();
538
617
  if (!!source['getSource'])
539
618
  source = source?.getSource();
540
- const query = new FilterFeaturesInAreaQuery(qr.area, source?.getFeatures() ?? []);
541
- queue.push(query.result.pipe(tap((r) => {
542
- result.put(l.get('name'), r.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
543
- })));
544
- queries.push(query);
619
+ let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
620
+ result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
545
621
  });
546
- forkJoin(queue).subscribe(() => qr.finish(result));
547
- queries.forEach((q) => this.postboy.fire(q));
622
+ qr.finish(result);
548
623
  });
549
624
  }
550
625
  }
@@ -687,17 +762,13 @@ class DrawingService {
687
762
  this.clearInteraction(l);
688
763
  return;
689
764
  }
690
- const drawQuery = new GenerateDrawQuery(l, ev.style, ev.type);
691
- drawQuery.result.subscribe((draw) => {
692
- const cancelSub = this.observeCancelation(ev, l);
693
- this.drawInteraction = draw;
694
- this.map?.addInteraction(this.drawInteraction);
695
- this.drawInteraction.on('drawend', (evt) => {
696
- cancelSub.unsubscribe();
697
- this.onEnd(evt, ev, l);
698
- });
765
+ const cancelSub = this.observeCancelation(ev, l);
766
+ this.drawInteraction = this.postboy.execute(new GenerateDrawExecutor(l, ev.style, ev.type));
767
+ this.map?.addInteraction(this.drawInteraction);
768
+ this.drawInteraction.on('drawend', (evt) => {
769
+ cancelSub.unsubscribe();
770
+ this.onEnd(evt, ev, l);
699
771
  });
700
- this.postboy.fire(drawQuery);
701
772
  });
702
773
  });
703
774
  }
@@ -740,56 +811,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
740
811
  type: Injectable
741
812
  }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
742
813
 
743
- class DrawingGenerationService {
814
+ class FeatureModificationService {
744
815
  constructor(postboy) {
745
816
  this.postboy = postboy;
746
817
  }
747
818
  up() {
748
- this.postboy.subscribe(GenerateDrawQuery.ID).subscribe((ev) => {
749
- ev.finish(new Draw({
750
- source: ev.layer.getSource(),
751
- type: DrawingType[ev.type],
752
- style: ev.style,
753
- geometryFunction: ev.type !== DrawingType.Circle ? undefined : createRegularPolygon(32),
754
- }));
819
+ this.observeModification();
820
+ this.observeMapRender();
821
+ }
822
+ observeModification() {
823
+ this.postboy.subscribe(ModifyFeatureCommand.ID).subscribe((ev) => {
824
+ this.defineLayer((l) => {
825
+ if (!l || !this.map) {
826
+ this.clearInteraction(l);
827
+ return;
828
+ }
829
+ this.observeCancelation(ev, l);
830
+ this.initFeature(l, ev.model.feature);
831
+ this.addModify(ev);
832
+ this.addDragging(ev);
833
+ });
755
834
  });
756
835
  }
757
- }
758
- DrawingGenerationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingGenerationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
759
- DrawingGenerationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingGenerationService });
760
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingGenerationService, decorators: [{
761
- type: Injectable
762
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
763
-
764
- class FeatureService {
765
- constructor(postboy) {
766
- this.postboy = postboy;
836
+ initFeature(layer, feature) {
837
+ layer.getSource()?.clear();
838
+ layer.getSource()?.addFeature(feature);
767
839
  }
768
- up() {
769
- this.postboy.subscribe(FilterFeaturesInAreaQuery.ID).subscribe((qr) => {
770
- qr.finish(qr.features.filter((f) => FeatureService.booleanIntersects(qr.area, f.getGeometry())));
840
+ addModify(command) {
841
+ this.modify = new Modify({
842
+ features: new Collection([command.model.feature]),
843
+ style: command.style,
844
+ });
845
+ this.modify.on('modifyend', () => {
846
+ this.onModified(command);
847
+ command.model.feature.changed();
771
848
  });
849
+ this.map?.addInteraction(this.modify);
850
+ }
851
+ addDragging(command) {
852
+ this.translate = new Translate({
853
+ features: new Collection([command.model.feature]),
854
+ condition: (ev) => {
855
+ const clone = command.model.feature.clone();
856
+ clone.getGeometry()?.scale(0.999);
857
+ return clone.getGeometry().intersectsCoordinate(ev.coordinate);
858
+ },
859
+ });
860
+ this.translate.on('translateend', () => this.onModified(command));
861
+ this.map?.addInteraction(this.translate);
772
862
  }
773
- static booleanIntersects(g1, g2) {
774
- if (g2.getType() === 'Point')
775
- return g1.intersectsCoordinate(g2.getCoordinates());
776
- if (g2.getType() === 'Circle')
777
- return g1.intersectsCoordinate(g2.getCenter());
778
- if (g2.getType() === 'Polygon')
779
- return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
780
- return false;
863
+ onModified(command) {
864
+ command.next(command.format === FeatureOutputFormat.GeoJson
865
+ ? new GeoJSON().writeFeature(command.model.feature)
866
+ : new WKT().writeFeature(command.model.feature));
867
+ }
868
+ observeMapRender() {
869
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
870
+ this.map = m.map;
871
+ });
872
+ }
873
+ defineLayer(action) {
874
+ const query = new GetLayerQuery(MapConstants.DrawingLayerId);
875
+ query.result.subscribe((l) => action(l));
876
+ this.postboy.fire(query);
877
+ }
878
+ observeCancelation(ev, layer) {
879
+ return this.postboy
880
+ .subscribe(CancelFeatureModificationCommand.ID)
881
+ .pipe(first())
882
+ .subscribe(() => {
883
+ ev.finish(null);
884
+ this.clearInteraction(layer);
885
+ });
886
+ }
887
+ clearInteraction(layer) {
888
+ if (this.modify)
889
+ this.map?.removeInteraction(this.modify);
890
+ if (this.translate)
891
+ this.map?.removeInteraction(this.translate);
781
892
  }
782
893
  }
783
- FeatureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
784
- FeatureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureService });
785
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureService, decorators: [{
894
+ FeatureModificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureModificationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
895
+ FeatureModificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureModificationService });
896
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureModificationService, decorators: [{
786
897
  type: Injectable
787
898
  }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
788
899
 
789
900
  class MessageRegistratorService extends PostboyAbstractRegistrator {
790
- constructor(service, management, state, mapFeature, interaction, drawing, drawGenerator, feature) {
901
+ constructor(service, management, state, mapFeature, interaction, drawing, featureModification) {
791
902
  super(service);
792
- this.registerServices([management, state, interaction, mapFeature, drawing, drawGenerator, feature]);
903
+ this.registerServices([management, state, interaction, mapFeature, drawing, featureModification]);
793
904
  }
794
905
  _up() {
795
906
  this.registerReplay(MapRenderedEvent.ID);
@@ -806,17 +917,23 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
806
917
  this.registerSubject(StartDrawingCommand.ID);
807
918
  this.registerSubject(GetLayerQuery.ID);
808
919
  this.registerSubject(DrawingFinishedEvent.ID);
809
- this.registerSubject(GenerateDrawQuery.ID);
810
- this.registerSubject(FilterFeaturesInAreaQuery.ID);
811
920
  this.registerSubject(GetFeaturesInAreaQuery.ID);
812
921
  this.registerSubject(DrawSelectionAreaCommand.ID);
922
+ this.registerSubject(CancelFeatureModificationCommand.ID);
923
+ this.registerSubject(ModifyFeatureCommand.ID);
924
+ this.setExecutors();
925
+ }
926
+ setExecutors() {
927
+ this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
928
+ this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
929
+ this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
813
930
  }
814
931
  }
815
- 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: DrawingGenerationService }, { token: FeatureService }], target: i0.ɵɵFactoryTarget.Injectable });
932
+ 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 }], target: i0.ɵɵFactoryTarget.Injectable });
816
933
  MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService });
817
934
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, decorators: [{
818
935
  type: Injectable
819
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: DrawingGenerationService }, { type: FeatureService }]; } });
936
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }]; } });
820
937
 
821
938
  class TileLayerSettings {
822
939
  constructor() {
@@ -1370,6 +1487,7 @@ MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", vers
1370
1487
  DrawingService,
1371
1488
  DrawingGenerationService,
1372
1489
  FeatureService,
1490
+ FeatureModificationService,
1373
1491
  ], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\r\n<lib-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></lib-feature-layer>\r\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1374
1492
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
1375
1493
  type: Component,
@@ -1382,6 +1500,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1382
1500
  DrawingService,
1383
1501
  DrawingGenerationService,
1384
1502
  FeatureService,
1503
+ FeatureModificationService,
1385
1504
  ], template: "<ng-content></ng-content>\r\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\r\n<lib-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></lib-feature-layer>\r\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
1386
1505
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
1387
1506
  type: Input
@@ -1551,6 +1670,94 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1551
1670
  type: Input
1552
1671
  }] } });
1553
1672
 
1673
+ class ZoomControlSettings {
1674
+ constructor() {
1675
+ this.controlClass = 'ol-zoom';
1676
+ this.zoomInClass = 'ol-zoom-in';
1677
+ this.zoomOutClass = 'ol-zoom-out';
1678
+ this.zoomInLabel = 'Zoom In';
1679
+ this.zoomOutLabel = 'Zoom Out';
1680
+ }
1681
+ static copy(model) {
1682
+ const result = new ZoomControlSettings();
1683
+ result.controlClass = model.controlClass;
1684
+ result.zoomInClass = model.zoomInClass;
1685
+ result.zoomOutClass = model.zoomOutClass;
1686
+ result.zoomInLabel = model.zoomInLabel;
1687
+ result.zoomOutLabel = model.zoomOutLabel;
1688
+ return result;
1689
+ }
1690
+ isSame(model) {
1691
+ if (this.zoomInClass !== model.zoomInClass)
1692
+ return false;
1693
+ if (this.zoomOutClass !== model.zoomOutClass)
1694
+ return false;
1695
+ if (this.zoomInLabel !== model.zoomInLabel)
1696
+ return false;
1697
+ if (this.controlClass !== model.controlClass)
1698
+ return false;
1699
+ if (this.zoomOutLabel !== model.zoomOutLabel)
1700
+ return false;
1701
+ return true;
1702
+ }
1703
+ setZoomInLabel(zoomInLabel) {
1704
+ return ZoomControlSettings.copy({ ...this, zoomInLabel });
1705
+ }
1706
+ setZoomOutClass(zoomOutClass) {
1707
+ return ZoomControlSettings.copy({ ...this, zoomOutClass });
1708
+ }
1709
+ setZoomInClass(zoomInClass) {
1710
+ return ZoomControlSettings.copy({ ...this, zoomInClass });
1711
+ }
1712
+ setZoomOutLabel(zoomOutLabel) {
1713
+ return ZoomControlSettings.copy({ ...this, zoomOutLabel });
1714
+ }
1715
+ setControlClass(controlClass) {
1716
+ return ZoomControlSettings.copy({ ...this, controlClass });
1717
+ }
1718
+ }
1719
+
1720
+ class MapControlZoomComponent extends DestructibleComponent {
1721
+ set settings(value) {
1722
+ if (!value || this._settings.isSame(value))
1723
+ return;
1724
+ this._settings = value;
1725
+ this.setControl();
1726
+ }
1727
+ constructor(postboy) {
1728
+ super();
1729
+ this.postboy = postboy;
1730
+ this._settings = new ZoomControlSettings();
1731
+ this.onDestroy = () => {
1732
+ this.eliminate();
1733
+ };
1734
+ this.eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
1735
+ }
1736
+ ngOnInit() {
1737
+ this.postboy
1738
+ .subscribe(MapRenderedEvent.ID)
1739
+ .pipe(filter((m) => !!m), first())
1740
+ .subscribe((m) => {
1741
+ this.map = m.map;
1742
+ this.setControl();
1743
+ });
1744
+ }
1745
+ setControl() {
1746
+ if (!this.map)
1747
+ return;
1748
+ this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
1749
+ this.map.addControl(this.control);
1750
+ }
1751
+ }
1752
+ MapControlZoomComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
1753
+ MapControlZoomComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapControlZoomComponent, selector: "lib-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1754
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapControlZoomComponent, decorators: [{
1755
+ type: Component,
1756
+ args: [{ selector: 'lib-map-control-zoom', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1757
+ }], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { settings: [{
1758
+ type: Input
1759
+ }] } });
1760
+
1554
1761
  class MapModule {
1555
1762
  }
1556
1763
  MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
@@ -1562,13 +1769,15 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
1562
1769
  MarkersComponent,
1563
1770
  TooltipComponent,
1564
1771
  PolygonsComponent,
1565
- ClusterLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
1772
+ ClusterLayerComponent,
1773
+ MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
1566
1774
  FeatureLayerComponent,
1567
1775
  MarkersComponent,
1568
1776
  TileLayerComponent,
1569
1777
  TooltipComponent,
1570
1778
  PolygonsComponent,
1571
- ClusterLayerComponent] });
1779
+ ClusterLayerComponent,
1780
+ MapControlZoomComponent] });
1572
1781
  MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
1573
1782
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
1574
1783
  type: NgModule,
@@ -1584,6 +1793,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1584
1793
  TooltipComponent,
1585
1794
  PolygonsComponent,
1586
1795
  ClusterLayerComponent,
1796
+ MapControlZoomComponent,
1587
1797
  ],
1588
1798
  exports: [
1589
1799
  MapPlateComponent,
@@ -1593,6 +1803,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1593
1803
  TooltipComponent,
1594
1804
  PolygonsComponent,
1595
1805
  ClusterLayerComponent,
1806
+ MapControlZoomComponent,
1596
1807
  ],
1597
1808
  }]
1598
1809
  }] });
@@ -1636,6 +1847,23 @@ class PolygonStyleHelper {
1636
1847
  }),
1637
1848
  });
1638
1849
  }
1850
+ static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
1851
+ return new Style({
1852
+ image: new Circle({
1853
+ fill: new Fill({
1854
+ color: stroke,
1855
+ }),
1856
+ radius: pinRadius,
1857
+ }),
1858
+ fill: new Fill({
1859
+ color: fill,
1860
+ }),
1861
+ stroke: new Stroke({
1862
+ color: stroke,
1863
+ width: strokeWidth,
1864
+ }),
1865
+ });
1866
+ }
1639
1867
  }
1640
1868
 
1641
1869
  class TextStyleHelper {
@@ -1710,5 +1938,5 @@ class StringifyFeatureHelper {
1710
1938
  * Generated bundle index. Do not edit.
1711
1939
  */
1712
1940
 
1713
- export { CancelDrawingCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, MapClickEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings };
1941
+ export { CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, MapClickEvent, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
1714
1942
  //# sourceMappingURL=maps-components-src-map.mjs.map