@artstesh/maps 5.0.10 → 5.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 (88) hide show
  1. package/dist/esm2022/map/helpers/polygon-style.helper.mjs +19 -2
  2. package/dist/esm2022/map/map-plate/controls/index.mjs +3 -0
  3. package/dist/esm2022/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +52 -0
  4. package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +13 -0
  5. package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +45 -0
  6. package/dist/esm2022/map/map-plate/map-plate.component.mjs +4 -1
  7. package/dist/esm2022/map/map.module.mjs +8 -3
  8. package/dist/esm2022/map/messages/commands/cancel-feature-modification.command.mjs +8 -0
  9. package/dist/esm2022/map/messages/commands/modify-feature.command.mjs +18 -0
  10. package/dist/esm2022/map/messages/executors/filter-features-in-area.executor.mjs +15 -0
  11. package/dist/esm2022/map/messages/executors/generate-draw.executor.mjs +17 -0
  12. package/dist/esm2022/map/messages/executors/generate-zoom-control.executor.mjs +13 -0
  13. package/dist/esm2022/map/messages/index.mjs +3 -1
  14. package/dist/esm2022/map/models/drawing-type.enum.mjs +2 -1
  15. package/dist/esm2022/map/public-api.mjs +2 -1
  16. package/dist/esm2022/map/services/drawing/drawing-generation.service.mjs +16 -22
  17. package/dist/esm2022/map/services/drawing/drawing.service.mjs +8 -12
  18. package/dist/esm2022/map/services/drawing/feature-modification.service.mjs +103 -0
  19. package/dist/esm2022/map/services/feature.service.mjs +4 -18
  20. package/dist/esm2022/map/services/map-management.service.mjs +5 -13
  21. package/dist/esm2022/map/services/message-registrator.service.mjs +22 -11
  22. package/dist/esm2022/src/map/helpers/polygon-style.helper.mjs +19 -2
  23. package/dist/esm2022/src/map/map-plate/controls/index.mjs +3 -0
  24. package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +52 -0
  25. package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +13 -0
  26. package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +45 -0
  27. package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +4 -1
  28. package/dist/esm2022/src/map/map.module.mjs +8 -3
  29. package/dist/esm2022/src/map/messages/commands/cancel-feature-modification.command.mjs +8 -0
  30. package/dist/esm2022/src/map/messages/commands/modify-feature.command.mjs +18 -0
  31. package/dist/esm2022/src/map/messages/executors/filter-features-in-area.executor.mjs +15 -0
  32. package/dist/esm2022/src/map/messages/executors/generate-draw.executor.mjs +17 -0
  33. package/dist/esm2022/src/map/messages/executors/generate-zoom-control.executor.mjs +13 -0
  34. package/dist/esm2022/src/map/messages/index.mjs +3 -1
  35. package/dist/esm2022/src/map/models/drawing-type.enum.mjs +2 -1
  36. package/dist/esm2022/src/map/public-api.mjs +2 -1
  37. package/dist/esm2022/src/map/services/drawing/drawing-generation.service.mjs +16 -22
  38. package/dist/esm2022/src/map/services/drawing/drawing.service.mjs +8 -12
  39. package/dist/esm2022/src/map/services/drawing/feature-modification.service.mjs +103 -0
  40. package/dist/esm2022/src/map/services/feature.service.mjs +4 -18
  41. package/dist/esm2022/src/map/services/map-management.service.mjs +5 -13
  42. package/dist/esm2022/src/map/services/message-registrator.service.mjs +22 -11
  43. package/dist/fesm2022/maps-components-src-map.mjs +322 -87
  44. package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
  45. package/dist/fesm2022/maps-components.mjs +322 -87
  46. package/dist/fesm2022/maps-components.mjs.map +1 -1
  47. package/dist/map/helpers/polygon-style.helper.d.ts +1 -0
  48. package/dist/map/map-plate/controls/index.d.ts +2 -0
  49. package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
  50. package/dist/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
  51. package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
  52. package/dist/map/map.module.d.ts +3 -2
  53. package/dist/map/messages/commands/cancel-feature-modification.command.d.ts +5 -0
  54. package/dist/map/messages/commands/modify-feature.command.d.ts +11 -0
  55. package/dist/map/messages/{queries/filter-features-in-area.query.d.ts → executors/filter-features-in-area.executor.d.ts} +2 -2
  56. package/dist/map/messages/{queries/generate-draw.query.d.ts → executors/generate-draw.executor.d.ts} +2 -2
  57. package/dist/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
  58. package/dist/map/messages/index.d.ts +2 -0
  59. package/dist/map/models/drawing-type.enum.d.ts +2 -1
  60. package/dist/map/public-api.d.ts +1 -0
  61. package/dist/map/services/drawing/drawing-generation.service.d.ts +5 -9
  62. package/dist/map/services/drawing/feature-modification.service.d.ts +22 -0
  63. package/dist/map/services/feature.service.d.ts +6 -9
  64. package/dist/map/services/message-registrator.service.d.ts +3 -3
  65. package/dist/package.json +1 -1
  66. package/dist/src/map/helpers/polygon-style.helper.d.ts +1 -0
  67. package/dist/src/map/map-plate/controls/index.d.ts +2 -0
  68. package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
  69. package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
  70. package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
  71. package/dist/src/map/map.module.d.ts +3 -2
  72. package/dist/src/map/messages/commands/cancel-feature-modification.command.d.ts +5 -0
  73. package/dist/src/map/messages/commands/modify-feature.command.d.ts +11 -0
  74. package/dist/src/map/messages/{queries/filter-features-in-area.query.d.ts → executors/filter-features-in-area.executor.d.ts} +2 -2
  75. package/dist/src/map/messages/{queries/generate-draw.query.d.ts → executors/generate-draw.executor.d.ts} +2 -2
  76. package/dist/src/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
  77. package/dist/src/map/messages/index.d.ts +2 -0
  78. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  79. package/dist/src/map/public-api.d.ts +1 -0
  80. package/dist/src/map/services/drawing/drawing-generation.service.d.ts +5 -9
  81. package/dist/src/map/services/drawing/feature-modification.service.d.ts +22 -0
  82. package/dist/src/map/services/feature.service.d.ts +6 -9
  83. package/dist/src/map/services/message-registrator.service.d.ts +3 -3
  84. package/package.json +2 -2
  85. package/dist/esm2022/map/messages/queries/filter-features-in-area.query.mjs +0 -15
  86. package/dist/esm2022/map/messages/queries/generate-draw.query.mjs +0 -17
  87. package/dist/esm2022/src/map/messages/queries/filter-features-in-area.query.mjs +0 -15
  88. package/dist/esm2022/src/map/messages/queries/generate-draw.query.mjs +0 -17
@@ -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';
@@ -186,6 +187,7 @@ var DrawingType;
186
187
  (function (DrawingType) {
187
188
  DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
188
189
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
190
+ DrawingType[DrawingType["Square"] = 3] = "Square";
189
191
  })(DrawingType || (DrawingType = {}));
190
192
 
191
193
  var FeatureOutputFormat;
@@ -341,6 +343,29 @@ class DrawSelectionAreaCommand extends PostboyCallbackMessage {
341
343
  }
342
344
  }
343
345
 
346
+ class ModifyFeatureCommand extends PostboyCallbackMessage {
347
+ model;
348
+ style;
349
+ format;
350
+ static ID = 'ead85caa-24c6-4844-a68c-2cea91774c8c';
351
+ constructor(model, style, format = FeatureOutputFormat.GeoJson) {
352
+ super();
353
+ this.model = model;
354
+ this.style = style;
355
+ this.format = format;
356
+ }
357
+ get id() {
358
+ return ModifyFeatureCommand.ID;
359
+ }
360
+ }
361
+
362
+ class CancelFeatureModificationCommand extends PostboyGenericMessage {
363
+ static ID = '9c9fb40f-ea95-4704-8177-0e9ecabf36fa';
364
+ get id() {
365
+ return CancelFeatureModificationCommand.ID;
366
+ }
367
+ }
368
+
344
369
  class AddLayerCommand extends PostboyGenericMessage {
345
370
  layer;
346
371
  static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
@@ -439,23 +464,57 @@ class DrawingFinishedEvent extends PostboyGenericMessage {
439
464
  }
440
465
  }
441
466
 
442
- class GenerateDrawQuery extends PostboyCallbackMessage {
443
- layer;
444
- style;
445
- type;
446
- static ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
447
- constructor(layer, style, type) {
467
+ class DrawingGenerationService {
468
+ static getDraw(ev) {
469
+ return new Draw({
470
+ source: ev.layer.getSource(),
471
+ type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
472
+ style: ev.style,
473
+ geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
474
+ });
475
+ }
476
+ static geometryFunc(type) {
477
+ switch (type) {
478
+ case DrawingType.Circle:
479
+ return createRegularPolygon(32);
480
+ case DrawingType.Square:
481
+ return createRegularPolygon(4);
482
+ }
483
+ return undefined;
484
+ }
485
+ }
486
+
487
+ class FeatureService {
488
+ constructor() { }
489
+ static filterFeaturesInArea(query) {
490
+ return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
491
+ }
492
+ static booleanIntersects(g1, g2) {
493
+ if (g2.getType() === 'Point')
494
+ return g1.intersectsCoordinate(g2.getCoordinates());
495
+ if (g2.getType() === 'Circle')
496
+ return g1.intersectsCoordinate(g2.getCenter());
497
+ if (g2.getType() === 'Polygon')
498
+ return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
499
+ return false;
500
+ }
501
+ }
502
+
503
+ class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
504
+ area;
505
+ ignore;
506
+ static ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
507
+ constructor(area, ignore = new Set()) {
448
508
  super();
449
- this.layer = layer;
450
- this.style = style;
451
- this.type = type;
509
+ this.area = area;
510
+ this.ignore = ignore;
452
511
  }
453
512
  get id() {
454
- return GenerateDrawQuery.ID;
513
+ return GetFeaturesInAreaQuery.ID;
455
514
  }
456
515
  }
457
516
 
458
- class FilterFeaturesInAreaQuery extends PostboyCallbackMessage {
517
+ class FilterFeaturesInAreaExecutor extends PostboyExecutor {
459
518
  area;
460
519
  features;
461
520
  static ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
@@ -465,21 +524,47 @@ class FilterFeaturesInAreaQuery extends PostboyCallbackMessage {
465
524
  this.features = features;
466
525
  }
467
526
  get id() {
468
- return FilterFeaturesInAreaQuery.ID;
527
+ return FilterFeaturesInAreaExecutor.ID;
469
528
  }
470
529
  }
471
530
 
472
- class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
473
- area;
474
- ignore;
475
- static ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
476
- constructor(area, ignore = new Set()) {
531
+ class GenerateDrawExecutor extends PostboyExecutor {
532
+ layer;
533
+ style;
534
+ type;
535
+ static ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
536
+ constructor(layer, style, type) {
477
537
  super();
478
- this.area = area;
479
- this.ignore = ignore;
538
+ this.layer = layer;
539
+ this.style = style;
540
+ this.type = type;
480
541
  }
481
542
  get id() {
482
- return GetFeaturesInAreaQuery.ID;
543
+ return GenerateDrawExecutor.ID;
544
+ }
545
+ }
546
+
547
+ class GenerateZoomControlExecutor extends PostboyExecutor {
548
+ settings;
549
+ static ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
550
+ constructor(settings) {
551
+ super();
552
+ this.settings = settings;
553
+ }
554
+ get id() {
555
+ return GenerateZoomControlExecutor.ID;
556
+ }
557
+ }
558
+
559
+ class ZoomControlFactory {
560
+ static build(settings) {
561
+ return new Zoom({
562
+ zoomInTipLabel: settings.zoomInLabel,
563
+ zoomOutTipLabel: settings.zoomOutLabel,
564
+ zoomInClassName: settings.zoomInClass,
565
+ zoomOutClassName: settings.zoomOutClass,
566
+ className: settings.controlClass,
567
+ });
483
568
  }
484
569
  }
485
570
 
@@ -564,8 +649,6 @@ class MapManagementService {
564
649
  observeFeaturesInArea() {
565
650
  this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
566
651
  let result = new Dictionary();
567
- const queue = [];
568
- const queries = [];
569
652
  this.layers.forEach((l) => {
570
653
  let layerName = l.get('name');
571
654
  if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
@@ -573,14 +656,10 @@ class MapManagementService {
573
656
  let source = l.getSource();
574
657
  if (!!source['getSource'])
575
658
  source = source?.getSource();
576
- const query = new FilterFeaturesInAreaQuery(qr.area, source?.getFeatures() ?? []);
577
- queue.push(query.result.pipe(tap((r) => {
578
- result.put(l.get('name'), r.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
579
- })));
580
- queries.push(query);
659
+ let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
660
+ result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
581
661
  });
582
- forkJoin(queue).subscribe(() => qr.finish(result));
583
- queries.forEach((q) => this.postboy.fire(q));
662
+ qr.finish(result);
584
663
  });
585
664
  }
586
665
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
@@ -732,17 +811,13 @@ class DrawingService {
732
811
  this.clearInteraction(l);
733
812
  return;
734
813
  }
735
- const drawQuery = new GenerateDrawQuery(l, ev.style, ev.type);
736
- drawQuery.result.subscribe((draw) => {
737
- const cancelSub = this.observeCancelation(ev, l);
738
- this.drawInteraction = draw;
739
- this.map?.addInteraction(this.drawInteraction);
740
- this.drawInteraction.on('drawend', (evt) => {
741
- cancelSub.unsubscribe();
742
- this.onEnd(evt, ev, l);
743
- });
814
+ const cancelSub = this.observeCancelation(ev, l);
815
+ this.drawInteraction = this.postboy.execute(new GenerateDrawExecutor(l, ev.style, ev.type));
816
+ this.map?.addInteraction(this.drawInteraction);
817
+ this.drawInteraction.on('drawend', (evt) => {
818
+ cancelSub.unsubscribe();
819
+ this.onEnd(evt, ev, l);
744
820
  });
745
- this.postboy.fire(drawQuery);
746
821
  });
747
822
  });
748
823
  }
@@ -785,58 +860,100 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
785
860
  type: Injectable
786
861
  }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
787
862
 
788
- class DrawingGenerationService {
863
+ class FeatureModificationService {
789
864
  postboy;
865
+ modify;
866
+ translate;
867
+ map;
790
868
  constructor(postboy) {
791
869
  this.postboy = postboy;
792
870
  }
793
871
  up() {
794
- this.postboy.subscribe(GenerateDrawQuery.ID).subscribe((ev) => {
795
- ev.finish(new Draw({
796
- source: ev.layer.getSource(),
797
- type: DrawingType[ev.type],
798
- style: ev.style,
799
- geometryFunction: ev.type !== DrawingType.Circle ? undefined : createRegularPolygon(32),
800
- }));
872
+ this.observeModification();
873
+ this.observeMapRender();
874
+ }
875
+ observeModification() {
876
+ this.postboy.subscribe(ModifyFeatureCommand.ID).subscribe((ev) => {
877
+ this.defineLayer((l) => {
878
+ if (!l || !this.map) {
879
+ this.clearInteraction(l);
880
+ return;
881
+ }
882
+ this.observeCancelation(ev, l);
883
+ this.initFeature(l, ev.model.feature);
884
+ this.addModify(ev);
885
+ this.addDragging(ev);
886
+ });
801
887
  });
802
888
  }
803
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingGenerationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
804
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingGenerationService });
805
- }
806
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingGenerationService, decorators: [{
807
- type: Injectable
808
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
809
-
810
- class FeatureService {
811
- postboy;
812
- constructor(postboy) {
813
- this.postboy = postboy;
889
+ initFeature(layer, feature) {
890
+ layer.getSource()?.clear();
891
+ layer.getSource()?.addFeature(feature);
814
892
  }
815
- up() {
816
- this.postboy.subscribe(FilterFeaturesInAreaQuery.ID).subscribe((qr) => {
817
- qr.finish(qr.features.filter((f) => FeatureService.booleanIntersects(qr.area, f.getGeometry())));
893
+ addModify(command) {
894
+ this.modify = new Modify({
895
+ features: new Collection([command.model.feature]),
896
+ style: command.style,
897
+ });
898
+ this.modify.on('modifyend', () => {
899
+ this.onModified(command);
900
+ command.model.feature.changed();
901
+ });
902
+ this.map?.addInteraction(this.modify);
903
+ }
904
+ addDragging(command) {
905
+ this.translate = new Translate({
906
+ features: new Collection([command.model.feature]),
907
+ condition: (ev) => {
908
+ const clone = command.model.feature.clone();
909
+ clone.getGeometry()?.scale(0.999);
910
+ return clone.getGeometry().intersectsCoordinate(ev.coordinate);
911
+ },
818
912
  });
913
+ this.translate.on('translateend', () => this.onModified(command));
914
+ this.map?.addInteraction(this.translate);
819
915
  }
820
- static booleanIntersects(g1, g2) {
821
- if (g2.getType() === 'Point')
822
- return g1.intersectsCoordinate(g2.getCoordinates());
823
- if (g2.getType() === 'Circle')
824
- return g1.intersectsCoordinate(g2.getCenter());
825
- if (g2.getType() === 'Polygon')
826
- return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
827
- return false;
916
+ onModified(command) {
917
+ command.next(command.format === FeatureOutputFormat.GeoJson
918
+ ? new GeoJSON().writeFeature(command.model.feature)
919
+ : new WKT().writeFeature(command.model.feature));
920
+ }
921
+ observeMapRender() {
922
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
923
+ this.map = m.map;
924
+ });
925
+ }
926
+ defineLayer(action) {
927
+ const query = new GetLayerQuery(MapConstants.DrawingLayerId);
928
+ query.result.subscribe((l) => action(l));
929
+ this.postboy.fire(query);
828
930
  }
829
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
830
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureService });
931
+ observeCancelation(ev, layer) {
932
+ return this.postboy
933
+ .subscribe(CancelFeatureModificationCommand.ID)
934
+ .pipe(first())
935
+ .subscribe(() => {
936
+ ev.finish(null);
937
+ this.clearInteraction(layer);
938
+ });
939
+ }
940
+ clearInteraction(layer) {
941
+ if (this.modify)
942
+ this.map?.removeInteraction(this.modify);
943
+ if (this.translate)
944
+ this.map?.removeInteraction(this.translate);
945
+ }
946
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureModificationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
947
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureModificationService });
831
948
  }
832
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureService, decorators: [{
949
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureModificationService, decorators: [{
833
950
  type: Injectable
834
951
  }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
835
952
 
836
953
  class MessageRegistratorService extends PostboyAbstractRegistrator {
837
- constructor(service, management, state, mapFeature, interaction, drawing, drawGenerator, feature) {
954
+ constructor(service, management, state, mapFeature, interaction, drawing, featureModification) {
838
955
  super(service);
839
- this.registerServices([management, state, interaction, mapFeature, drawing, drawGenerator, feature]);
956
+ this.registerServices([management, state, interaction, mapFeature, drawing, featureModification]);
840
957
  }
841
958
  _up() {
842
959
  this.registerReplay(MapRenderedEvent.ID);
@@ -853,17 +970,23 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
853
970
  this.registerSubject(StartDrawingCommand.ID);
854
971
  this.registerSubject(GetLayerQuery.ID);
855
972
  this.registerSubject(DrawingFinishedEvent.ID);
856
- this.registerSubject(GenerateDrawQuery.ID);
857
- this.registerSubject(FilterFeaturesInAreaQuery.ID);
858
973
  this.registerSubject(GetFeaturesInAreaQuery.ID);
859
974
  this.registerSubject(DrawSelectionAreaCommand.ID);
975
+ this.registerSubject(CancelFeatureModificationCommand.ID);
976
+ this.registerSubject(ModifyFeatureCommand.ID);
977
+ this.setExecutors();
978
+ }
979
+ setExecutors() {
980
+ this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
981
+ this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
982
+ this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
860
983
  }
861
- 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: DrawingGenerationService }, { token: FeatureService }], target: i0.ɵɵFactoryTarget.Injectable });
984
+ 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 }], target: i0.ɵɵFactoryTarget.Injectable });
862
985
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService });
863
986
  }
864
987
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, decorators: [{
865
988
  type: Injectable
866
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: DrawingGenerationService }, { type: FeatureService }]; } });
989
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }]; } });
867
990
 
868
991
  class TileLayerSettings {
869
992
  maxZoom = 19;
@@ -1430,6 +1553,7 @@ class MapPlateComponent extends DestructibleComponent {
1430
1553
  DrawingService,
1431
1554
  DrawingGenerationService,
1432
1555
  FeatureService,
1556
+ FeatureModificationService,
1433
1557
  ], 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 });
1434
1558
  }
1435
1559
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, decorators: [{
@@ -1443,6 +1567,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1443
1567
  DrawingService,
1444
1568
  DrawingGenerationService,
1445
1569
  FeatureService,
1570
+ FeatureModificationService,
1446
1571
  ], 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"] }]
1447
1572
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
1448
1573
  type: Input
@@ -1620,6 +1745,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1620
1745
  type: Input
1621
1746
  }] } });
1622
1747
 
1748
+ class ZoomControlSettings {
1749
+ controlClass = 'ol-zoom';
1750
+ zoomInClass = 'ol-zoom-in';
1751
+ zoomOutClass = 'ol-zoom-out';
1752
+ zoomInLabel = 'Zoom In';
1753
+ zoomOutLabel = 'Zoom Out';
1754
+ static copy(model) {
1755
+ const result = new ZoomControlSettings();
1756
+ result.controlClass = model.controlClass;
1757
+ result.zoomInClass = model.zoomInClass;
1758
+ result.zoomOutClass = model.zoomOutClass;
1759
+ result.zoomInLabel = model.zoomInLabel;
1760
+ result.zoomOutLabel = model.zoomOutLabel;
1761
+ return result;
1762
+ }
1763
+ isSame(model) {
1764
+ if (this.zoomInClass !== model.zoomInClass)
1765
+ return false;
1766
+ if (this.zoomOutClass !== model.zoomOutClass)
1767
+ return false;
1768
+ if (this.zoomInLabel !== model.zoomInLabel)
1769
+ return false;
1770
+ if (this.controlClass !== model.controlClass)
1771
+ return false;
1772
+ if (this.zoomOutLabel !== model.zoomOutLabel)
1773
+ return false;
1774
+ return true;
1775
+ }
1776
+ setZoomInLabel(zoomInLabel) {
1777
+ return ZoomControlSettings.copy({ ...this, zoomInLabel });
1778
+ }
1779
+ setZoomOutClass(zoomOutClass) {
1780
+ return ZoomControlSettings.copy({ ...this, zoomOutClass });
1781
+ }
1782
+ setZoomInClass(zoomInClass) {
1783
+ return ZoomControlSettings.copy({ ...this, zoomInClass });
1784
+ }
1785
+ setZoomOutLabel(zoomOutLabel) {
1786
+ return ZoomControlSettings.copy({ ...this, zoomOutLabel });
1787
+ }
1788
+ setControlClass(controlClass) {
1789
+ return ZoomControlSettings.copy({ ...this, controlClass });
1790
+ }
1791
+ }
1792
+
1793
+ class MapControlZoomComponent extends DestructibleComponent {
1794
+ postboy;
1795
+ _settings = new ZoomControlSettings();
1796
+ map;
1797
+ control;
1798
+ set settings(value) {
1799
+ if (!value || this._settings.isSame(value))
1800
+ return;
1801
+ this._settings = value;
1802
+ this.setControl();
1803
+ }
1804
+ constructor(postboy) {
1805
+ super();
1806
+ this.postboy = postboy;
1807
+ }
1808
+ ngOnInit() {
1809
+ this.postboy
1810
+ .subscribe(MapRenderedEvent.ID)
1811
+ .pipe(filter((m) => !!m), first())
1812
+ .subscribe((m) => {
1813
+ this.map = m.map;
1814
+ this.setControl();
1815
+ });
1816
+ }
1817
+ setControl() {
1818
+ if (!this.map)
1819
+ return;
1820
+ this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
1821
+ this.map.addControl(this.control);
1822
+ }
1823
+ onDestroy = () => {
1824
+ this.eliminate();
1825
+ };
1826
+ eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
1827
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
1828
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapControlZoomComponent, selector: "lib-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1829
+ }
1830
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapControlZoomComponent, decorators: [{
1831
+ type: Component,
1832
+ args: [{ selector: 'lib-map-control-zoom', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1833
+ }], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { settings: [{
1834
+ type: Input
1835
+ }] } });
1836
+
1623
1837
  class MapModule {
1624
1838
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1625
1839
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
@@ -1630,13 +1844,15 @@ class MapModule {
1630
1844
  MarkersComponent,
1631
1845
  TooltipComponent,
1632
1846
  PolygonsComponent,
1633
- ClusterLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
1847
+ ClusterLayerComponent,
1848
+ MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
1634
1849
  FeatureLayerComponent,
1635
1850
  MarkersComponent,
1636
1851
  TileLayerComponent,
1637
1852
  TooltipComponent,
1638
1853
  PolygonsComponent,
1639
- ClusterLayerComponent] });
1854
+ ClusterLayerComponent,
1855
+ MapControlZoomComponent] });
1640
1856
  static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, imports: [CommonModule] });
1641
1857
  }
1642
1858
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, decorators: [{
@@ -1653,6 +1869,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1653
1869
  TooltipComponent,
1654
1870
  PolygonsComponent,
1655
1871
  ClusterLayerComponent,
1872
+ MapControlZoomComponent,
1656
1873
  ],
1657
1874
  exports: [
1658
1875
  MapPlateComponent,
@@ -1662,6 +1879,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1662
1879
  TooltipComponent,
1663
1880
  PolygonsComponent,
1664
1881
  ClusterLayerComponent,
1882
+ MapControlZoomComponent,
1665
1883
  ],
1666
1884
  }]
1667
1885
  }] });
@@ -1705,6 +1923,23 @@ class PolygonStyleHelper {
1705
1923
  }),
1706
1924
  });
1707
1925
  }
1926
+ static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
1927
+ return new Style({
1928
+ image: new Circle({
1929
+ fill: new Fill({
1930
+ color: stroke,
1931
+ }),
1932
+ radius: pinRadius,
1933
+ }),
1934
+ fill: new Fill({
1935
+ color: fill,
1936
+ }),
1937
+ stroke: new Stroke({
1938
+ color: stroke,
1939
+ width: strokeWidth,
1940
+ }),
1941
+ });
1942
+ }
1708
1943
  }
1709
1944
 
1710
1945
  class TextStyleHelper {
@@ -1779,5 +2014,5 @@ class StringifyFeatureHelper {
1779
2014
  * Generated bundle index. Do not edit.
1780
2015
  */
1781
2016
 
1782
- 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 };
2017
+ 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 };
1783
2018
  //# sourceMappingURL=maps-components-src-map.mjs.map