@artstesh/maps 1.0.7 → 1.0.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 (128) hide show
  1. package/dist/bundles/maps-components-src-map.umd.js +644 -433
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +644 -433
  4. package/dist/bundles/maps-components.umd.js.map +1 -1
  5. package/dist/esm2015/map/helpers/text-style.helper.js +1 -1
  6. package/dist/esm2015/map/map-plate/features/polygons/polygons.component.js +2 -3
  7. package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.js +1 -1
  8. package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer.manager.js +20 -2
  9. package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer.settings.js +8 -1
  10. package/dist/esm2015/map/map-plate/layers/tile-layer/tile-layer.component.js +1 -1
  11. package/dist/esm2015/map/map-plate/map-plate.component.js +23 -4
  12. package/dist/esm2015/map/messages/commands/add-layer.command.js +3 -3
  13. package/dist/esm2015/map/messages/commands/add-tile.command.js +3 -3
  14. package/dist/esm2015/map/messages/commands/cancel-drawing.command.js +8 -0
  15. package/dist/esm2015/map/messages/commands/close-tooltip.command.js +3 -3
  16. package/dist/esm2015/map/messages/commands/fit-to-features.command.js +3 -3
  17. package/dist/esm2015/map/messages/commands/place-layer-features.command.js +3 -3
  18. package/dist/esm2015/map/messages/commands/remove-layer.command.js +3 -3
  19. package/dist/esm2015/map/messages/commands/remove-tile.command.js +3 -3
  20. package/dist/esm2015/map/messages/commands/start-drawing.command.js +15 -0
  21. package/dist/esm2015/map/messages/events/drawing-finished.event.js +11 -0
  22. package/dist/esm2015/map/messages/events/map-click.event.js +3 -3
  23. package/dist/esm2015/map/messages/events/map-move-end.event.js +13 -0
  24. package/dist/esm2015/map/messages/events/map-rendered.event.js +3 -3
  25. package/dist/esm2015/map/messages/index.js +4 -2
  26. package/dist/esm2015/map/messages/queries/get-layer.query.js +12 -0
  27. package/dist/esm2015/map/models/drawing-type.enum.js +5 -0
  28. package/dist/esm2015/map/models/feature-format.enum.js +6 -0
  29. package/dist/esm2015/map/models/index.js +3 -1
  30. package/dist/esm2015/map/models/map.constants.js +2 -1
  31. package/dist/esm2015/map/services/drawing/drawing.service.js +80 -0
  32. package/dist/esm2015/map/services/map-management.service.js +6 -1
  33. package/dist/esm2015/map/services/map-postboy.service.js +8 -5
  34. package/dist/esm2015/map/services/map-state.service.js +12 -2
  35. package/dist/esm2015/map/services/message-registrator.service.js +16 -5
  36. package/dist/esm2015/src/map/helpers/text-style.helper.js +1 -1
  37. package/dist/esm2015/src/map/map-plate/features/polygons/polygons.component.js +2 -3
  38. package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.js +1 -1
  39. package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.js +20 -2
  40. package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.js +8 -1
  41. package/dist/esm2015/src/map/map-plate/layers/tile-layer/tile-layer.component.js +1 -1
  42. package/dist/esm2015/src/map/map-plate/map-plate.component.js +23 -4
  43. package/dist/esm2015/src/map/messages/commands/add-layer.command.js +3 -3
  44. package/dist/esm2015/src/map/messages/commands/add-tile.command.js +3 -3
  45. package/dist/esm2015/src/map/messages/commands/cancel-drawing.command.js +8 -0
  46. package/dist/esm2015/src/map/messages/commands/close-tooltip.command.js +3 -3
  47. package/dist/esm2015/src/map/messages/commands/fit-to-features.command.js +3 -3
  48. package/dist/esm2015/src/map/messages/commands/place-layer-features.command.js +3 -3
  49. package/dist/esm2015/src/map/messages/commands/remove-layer.command.js +3 -3
  50. package/dist/esm2015/src/map/messages/commands/remove-tile.command.js +3 -3
  51. package/dist/esm2015/src/map/messages/commands/start-drawing.command.js +15 -0
  52. package/dist/esm2015/src/map/messages/events/drawing-finished.event.js +11 -0
  53. package/dist/esm2015/src/map/messages/events/map-click.event.js +3 -3
  54. package/dist/esm2015/src/map/messages/events/map-move-end.event.js +13 -0
  55. package/dist/esm2015/src/map/messages/events/map-rendered.event.js +3 -3
  56. package/dist/esm2015/src/map/messages/index.js +4 -2
  57. package/dist/esm2015/src/map/messages/queries/get-layer.query.js +12 -0
  58. package/dist/esm2015/src/map/models/drawing-type.enum.js +5 -0
  59. package/dist/esm2015/src/map/models/feature-format.enum.js +6 -0
  60. package/dist/esm2015/src/map/models/index.js +3 -1
  61. package/dist/esm2015/src/map/models/map.constants.js +2 -1
  62. package/dist/esm2015/src/map/services/drawing/drawing.service.js +80 -0
  63. package/dist/esm2015/src/map/services/map-management.service.js +6 -1
  64. package/dist/esm2015/src/map/services/map-postboy.service.js +8 -5
  65. package/dist/esm2015/src/map/services/map-state.service.js +12 -2
  66. package/dist/esm2015/src/map/services/message-registrator.service.js +16 -5
  67. package/dist/fesm2015/maps-components-src-map.js +553 -381
  68. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  69. package/dist/fesm2015/maps-components.js +553 -381
  70. package/dist/fesm2015/maps-components.js.map +1 -1
  71. package/dist/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +2 -0
  72. package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +2 -0
  73. package/dist/map/map-plate/map-plate.component.d.ts +2 -0
  74. package/dist/map/messages/commands/add-layer.command.d.ts +3 -3
  75. package/dist/map/messages/commands/add-tile.command.d.ts +3 -3
  76. package/dist/map/messages/commands/cancel-drawing.command.d.ts +5 -0
  77. package/dist/map/messages/commands/close-tooltip.command.d.ts +3 -3
  78. package/dist/map/messages/commands/fit-to-features.command.d.ts +3 -3
  79. package/dist/map/messages/commands/place-layer-features.command.d.ts +3 -3
  80. package/dist/map/messages/commands/remove-layer.command.d.ts +3 -3
  81. package/dist/map/messages/commands/remove-tile.command.d.ts +3 -3
  82. package/dist/map/messages/commands/start-drawing.command.d.ts +11 -0
  83. package/dist/map/messages/events/drawing-finished.event.d.ts +6 -0
  84. package/dist/map/messages/events/map-click.event.d.ts +3 -3
  85. package/dist/map/messages/events/map-move-end.event.d.ts +8 -0
  86. package/dist/map/messages/events/map-rendered.event.d.ts +3 -3
  87. package/dist/map/messages/index.d.ts +3 -1
  88. package/dist/map/messages/queries/get-layer.query.d.ts +10 -0
  89. package/dist/map/models/drawing-type.enum.d.ts +3 -0
  90. package/dist/map/models/feature-format.enum.d.ts +4 -0
  91. package/dist/map/models/index.d.ts +2 -0
  92. package/dist/map/models/map.constants.d.ts +1 -0
  93. package/dist/map/services/drawing/drawing.service.d.ts +17 -0
  94. package/dist/map/services/map-management.service.d.ts +1 -0
  95. package/dist/map/services/map-postboy.service.d.ts +1 -2
  96. package/dist/map/services/message-registrator.service.d.ts +2 -1
  97. package/dist/package.json +1 -1
  98. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +2 -0
  99. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +2 -0
  100. package/dist/src/map/map-plate/map-plate.component.d.ts +2 -0
  101. package/dist/src/map/messages/commands/add-layer.command.d.ts +3 -3
  102. package/dist/src/map/messages/commands/add-tile.command.d.ts +3 -3
  103. package/dist/src/map/messages/commands/cancel-drawing.command.d.ts +5 -0
  104. package/dist/src/map/messages/commands/close-tooltip.command.d.ts +3 -3
  105. package/dist/src/map/messages/commands/fit-to-features.command.d.ts +3 -3
  106. package/dist/src/map/messages/commands/place-layer-features.command.d.ts +3 -3
  107. package/dist/src/map/messages/commands/remove-layer.command.d.ts +3 -3
  108. package/dist/src/map/messages/commands/remove-tile.command.d.ts +3 -3
  109. package/dist/src/map/messages/commands/start-drawing.command.d.ts +11 -0
  110. package/dist/src/map/messages/events/drawing-finished.event.d.ts +6 -0
  111. package/dist/src/map/messages/events/map-click.event.d.ts +3 -3
  112. package/dist/src/map/messages/events/map-move-end.event.d.ts +8 -0
  113. package/dist/src/map/messages/events/map-rendered.event.d.ts +3 -3
  114. package/dist/src/map/messages/index.d.ts +3 -1
  115. package/dist/src/map/messages/queries/get-layer.query.d.ts +10 -0
  116. package/dist/src/map/models/drawing-type.enum.d.ts +3 -0
  117. package/dist/src/map/models/feature-format.enum.d.ts +4 -0
  118. package/dist/src/map/models/index.d.ts +2 -0
  119. package/dist/src/map/models/map.constants.d.ts +1 -0
  120. package/dist/src/map/services/drawing/drawing.service.d.ts +17 -0
  121. package/dist/src/map/services/map-management.service.d.ts +1 -0
  122. package/dist/src/map/services/map-postboy.service.d.ts +1 -2
  123. package/dist/src/map/services/message-registrator.service.d.ts +2 -1
  124. package/package.json +2 -2
  125. package/dist/esm2015/map/messages/generic-message.js +0 -15
  126. package/dist/esm2015/src/map/messages/generic-message.js +0 -15
  127. package/dist/map/messages/generic-message.d.ts +0 -9
  128. package/dist/src/map/messages/generic-message.d.ts +0 -9
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/proj'), require('rxjs'), require('@artstesh/postboy'), require('ol/Map'), require('ol/View'), require('ol/layer/Tile'), require('ol/source/OSM'), require('rxjs/operators'), require('ol/source'), require('ol/layer'), require('ol/Overlay'), require('ol/loadingstrategy'), require('ol/geom/Polygon'), require('ol/source/Cluster'), require('ol/style/Style'), require('ol/style')) :
3
- typeof define === 'function' && define.amd ? define('maps-components', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/proj', 'rxjs', '@artstesh/postboy', 'ol/Map', 'ol/View', 'ol/layer/Tile', 'ol/source/OSM', 'rxjs/operators', 'ol/source', 'ol/layer', 'ol/Overlay', 'ol/loadingstrategy', 'ol/geom/Polygon', 'ol/source/Cluster', 'ol/style/Style', 'ol/style'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["maps-components"] = {}, global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.proj, global.rxjs, global.postboy, global.Map, global.View, global.TileLayer, global.OSM, global.rxjs.operators, global.source, global.layer, global.Overlay, global.loadingstrategy, global.Polygon, global.Cluster, global.Style, global.style));
5
- })(this, (function (exports, i0, i5, ol, geom, format, extent, proj, rxjs, postboy, Map, View, TileLayer, OSM, operators, source, layer, Overlay, loadingstrategy, Polygon, Cluster, Style, style) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/proj'), require('@artstesh/postboy'), require('rxjs/operators'), require('ol/source'), require('ol/interaction'), require('ol/layer/Tile'), require('ol/source/OSM'), require('ol/layer'), require('ol/loadingstrategy'), require('ol/geom/Polygon'), require('ol/source/Cluster'), require('rxjs'), require('ol/Map'), require('ol/View'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style')) :
3
+ typeof define === 'function' && define.amd ? define('maps-components', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/proj', '@artstesh/postboy', 'rxjs/operators', 'ol/source', 'ol/interaction', 'ol/layer/Tile', 'ol/source/OSM', 'ol/layer', 'ol/loadingstrategy', 'ol/geom/Polygon', 'ol/source/Cluster', 'rxjs', 'ol/Map', 'ol/View', 'ol/Overlay', 'ol/style/Style', 'ol/style'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["maps-components"] = {}, global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.proj, global.postboy, global.rxjs.operators, global.source, global.interaction, global.TileLayer, global.OSM, global.layer, global.loadingstrategy, global.Polygon, global.Cluster, global.rxjs, global.Map, global.View, global.Overlay, global.Style, global.style));
5
+ })(this, (function (exports, i0, i6, ol, geom, format, extent, proj, postboy, operators, source, interaction, TileLayer, OSM, layer, loadingstrategy, Polygon, Cluster, rxjs, Map, View, Overlay, Style, style) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -25,13 +25,13 @@
25
25
  }
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
29
- var Map__default = /*#__PURE__*/_interopDefaultLegacy(Map);
30
- var View__default = /*#__PURE__*/_interopDefaultLegacy(View);
28
+ var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
31
29
  var TileLayer__default = /*#__PURE__*/_interopDefaultLegacy(TileLayer);
32
30
  var OSM__default = /*#__PURE__*/_interopDefaultLegacy(OSM);
33
- var Overlay__default = /*#__PURE__*/_interopDefaultLegacy(Overlay);
34
31
  var Cluster__default = /*#__PURE__*/_interopDefaultLegacy(Cluster);
32
+ var Map__default = /*#__PURE__*/_interopDefaultLegacy(Map);
33
+ var View__default = /*#__PURE__*/_interopDefaultLegacy(View);
34
+ var Overlay__default = /*#__PURE__*/_interopDefaultLegacy(Overlay);
35
35
  var Style__default = /*#__PURE__*/_interopDefaultLegacy(Style);
36
36
 
37
37
  var DestructibleComponent = /** @class */ (function () {
@@ -614,7 +614,8 @@
614
614
  }
615
615
  return MapConstants;
616
616
  }());
617
- MapConstants.FeatureInfo = 'f-info';
617
+ MapConstants.FeatureInfo = 'f-info';
618
+ MapConstants.DrawingLayerId = '93a981756ec7';
618
619
 
619
620
  var MarkerModel = /** @class */ (function () {
620
621
  function MarkerModel(lat, lng, id, info) {
@@ -670,25 +671,16 @@
670
671
  return PolygonModel;
671
672
  }());
672
673
 
673
- var GenericMessage = /** @class */ (function () {
674
- function GenericMessage() {
675
- }
676
- return GenericMessage;
677
- }());
678
- var CallbackMessage = /** @class */ (function (_super) {
679
- __extends(CallbackMessage, _super);
680
- function CallbackMessage() {
681
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
682
- _this.result$ = new rxjs.Subject();
683
- _this.result = _this.result$.asObservable();
684
- return _this;
685
- }
686
- CallbackMessage.prototype.finish = function (value) {
687
- this.result$.next(value);
688
- this.result$.complete();
689
- };
690
- return CallbackMessage;
691
- }(GenericMessage));
674
+ exports.DrawingType = void 0;
675
+ (function (DrawingType) {
676
+ DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
677
+ })(exports.DrawingType || (exports.DrawingType = {}));
678
+
679
+ exports.FeatureOutputFormat = void 0;
680
+ (function (FeatureOutputFormat) {
681
+ FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
682
+ FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
683
+ })(exports.FeatureOutputFormat || (exports.FeatureOutputFormat = {}));
692
684
 
693
685
  var MapRenderedEvent = /** @class */ (function (_super) {
694
686
  __extends(MapRenderedEvent, _super);
@@ -705,7 +697,7 @@
705
697
  configurable: true
706
698
  });
707
699
  return MapRenderedEvent;
708
- }(GenericMessage));
700
+ }(postboy.PostboyGenericMessage));
709
701
  MapRenderedEvent.ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
710
702
 
711
703
  var MapClickEvent = /** @class */ (function (_super) {
@@ -725,9 +717,28 @@
725
717
  configurable: true
726
718
  });
727
719
  return MapClickEvent;
728
- }(GenericMessage));
720
+ }(postboy.PostboyGenericMessage));
729
721
  MapClickEvent.ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
730
722
 
723
+ var MapMoveEndEvent = /** @class */ (function (_super) {
724
+ __extends(MapMoveEndEvent, _super);
725
+ function MapMoveEndEvent(zoom, extent) {
726
+ var _this = _super.call(this) || this;
727
+ _this.zoom = zoom;
728
+ _this.extent = extent;
729
+ return _this;
730
+ }
731
+ Object.defineProperty(MapMoveEndEvent.prototype, "id", {
732
+ get: function () {
733
+ return MapMoveEndEvent.ID;
734
+ },
735
+ enumerable: false,
736
+ configurable: true
737
+ });
738
+ return MapMoveEndEvent;
739
+ }(postboy.PostboyGenericMessage));
740
+ MapMoveEndEvent.ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
741
+
731
742
  var CloseTooltipCommand = /** @class */ (function (_super) {
732
743
  __extends(CloseTooltipCommand, _super);
733
744
  function CloseTooltipCommand(tooltipId) {
@@ -743,9 +754,46 @@
743
754
  configurable: true
744
755
  });
745
756
  return CloseTooltipCommand;
746
- }(GenericMessage));
757
+ }(postboy.PostboyGenericMessage));
747
758
  CloseTooltipCommand.ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
748
759
 
760
+ var StartDrawingCommand = /** @class */ (function (_super) {
761
+ __extends(StartDrawingCommand, _super);
762
+ function StartDrawingCommand(type, style, format) {
763
+ if (format === void 0) { format = exports.FeatureOutputFormat.GeoJson; }
764
+ var _this = _super.call(this) || this;
765
+ _this.type = type;
766
+ _this.style = style;
767
+ _this.format = format;
768
+ return _this;
769
+ }
770
+ Object.defineProperty(StartDrawingCommand.prototype, "id", {
771
+ get: function () {
772
+ return StartDrawingCommand.ID;
773
+ },
774
+ enumerable: false,
775
+ configurable: true
776
+ });
777
+ return StartDrawingCommand;
778
+ }(postboy.PostboyCallbackMessage));
779
+ StartDrawingCommand.ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
780
+
781
+ var CancelDrawingCommand = /** @class */ (function (_super) {
782
+ __extends(CancelDrawingCommand, _super);
783
+ function CancelDrawingCommand() {
784
+ return _super !== null && _super.apply(this, arguments) || this;
785
+ }
786
+ Object.defineProperty(CancelDrawingCommand.prototype, "id", {
787
+ get: function () {
788
+ return CancelDrawingCommand.ID;
789
+ },
790
+ enumerable: false,
791
+ configurable: true
792
+ });
793
+ return CancelDrawingCommand;
794
+ }(postboy.PostboyGenericMessage));
795
+ CancelDrawingCommand.ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
796
+
749
797
  var AddLayerCommand = /** @class */ (function (_super) {
750
798
  __extends(AddLayerCommand, _super);
751
799
  function AddLayerCommand(layer) {
@@ -761,7 +809,7 @@
761
809
  configurable: true
762
810
  });
763
811
  return AddLayerCommand;
764
- }(GenericMessage));
812
+ }(postboy.PostboyGenericMessage));
765
813
  AddLayerCommand.ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
766
814
 
767
815
  var PlaceLayerFeaturesCommand = /** @class */ (function (_super) {
@@ -780,7 +828,7 @@
780
828
  configurable: true
781
829
  });
782
830
  return PlaceLayerFeaturesCommand;
783
- }(GenericMessage));
831
+ }(postboy.PostboyGenericMessage));
784
832
  PlaceLayerFeaturesCommand.ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
785
833
 
786
834
  var RemoveLayerCommand = /** @class */ (function (_super) {
@@ -798,7 +846,7 @@
798
846
  configurable: true
799
847
  });
800
848
  return RemoveLayerCommand;
801
- }(GenericMessage));
849
+ }(postboy.PostboyGenericMessage));
802
850
  RemoveLayerCommand.ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
803
851
 
804
852
  var AddTileCommand = /** @class */ (function (_super) {
@@ -816,7 +864,7 @@
816
864
  configurable: true
817
865
  });
818
866
  return AddTileCommand;
819
- }(GenericMessage));
867
+ }(postboy.PostboyGenericMessage));
820
868
  AddTileCommand.ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
821
869
 
822
870
  var RemoveTileCommand = /** @class */ (function (_super) {
@@ -834,7 +882,7 @@
834
882
  configurable: true
835
883
  });
836
884
  return RemoveTileCommand;
837
- }(GenericMessage));
885
+ }(postboy.PostboyGenericMessage));
838
886
  RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
839
887
 
840
888
  var FitToFeaturesCommand = /** @class */ (function (_super) {
@@ -854,23 +902,57 @@
854
902
  configurable: true
855
903
  });
856
904
  return FitToFeaturesCommand;
857
- }(GenericMessage));
905
+ }(postboy.PostboyGenericMessage));
858
906
  FitToFeaturesCommand.ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
859
907
 
908
+ var GetLayerQuery = /** @class */ (function (_super) {
909
+ __extends(GetLayerQuery, _super);
910
+ function GetLayerQuery(name) {
911
+ var _this = _super.call(this) || this;
912
+ _this.name = name;
913
+ return _this;
914
+ }
915
+ Object.defineProperty(GetLayerQuery.prototype, "id", {
916
+ get: function () {
917
+ return GetLayerQuery.ID;
918
+ },
919
+ enumerable: false,
920
+ configurable: true
921
+ });
922
+ return GetLayerQuery;
923
+ }(postboy.PostboyCallbackMessage));
924
+ GetLayerQuery.ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
925
+
926
+ var DrawingFinishedEvent = /** @class */ (function (_super) {
927
+ __extends(DrawingFinishedEvent, _super);
928
+ function DrawingFinishedEvent() {
929
+ return _super.call(this) || this;
930
+ }
931
+ Object.defineProperty(DrawingFinishedEvent.prototype, "id", {
932
+ get: function () {
933
+ return DrawingFinishedEvent.ID;
934
+ },
935
+ enumerable: false,
936
+ configurable: true
937
+ });
938
+ return DrawingFinishedEvent;
939
+ }(postboy.PostboyGenericMessage));
940
+ DrawingFinishedEvent.ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
941
+
860
942
  var MapPostboyService = /** @class */ (function (_super) {
861
943
  __extends(MapPostboyService, _super);
862
944
  function MapPostboyService() {
863
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
864
- _this.observe = function (id) { return _this.subscribe(id); };
945
+ var _this = _super.call(this) || this;
946
+ _this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
865
947
  return _this;
866
948
  }
867
949
  return MapPostboyService;
868
950
  }(postboy.PostboyService));
869
- MapPostboyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPostboyService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
951
+ MapPostboyService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPostboyService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
870
952
  MapPostboyService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPostboyService });
871
953
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPostboyService, decorators: [{
872
954
  type: i0.Injectable
873
- }] });
955
+ }], ctorParameters: function () { return []; } });
874
956
 
875
957
  var MapManagementService = /** @class */ (function () {
876
958
  function MapManagementService(postboy) {
@@ -884,6 +966,7 @@
884
966
  this.observePlaceFeatures();
885
967
  this.observeAddTile();
886
968
  this.observeRemoveTile();
969
+ this.observeLayerQuery();
887
970
  };
888
971
  MapManagementService.prototype.observeRemoveTile = function () {
889
972
  var _this = this;
@@ -893,6 +976,10 @@
893
976
  _this.map.removeLayer(c.layer);
894
977
  });
895
978
  };
979
+ MapManagementService.prototype.observeLayerQuery = function () {
980
+ var _this = this;
981
+ this.postboy.subscribe(GetLayerQuery.ID).subscribe(function (ev) { var _a; return ev.finish((_a = _this.layers[ev.name]) !== null && _a !== void 0 ? _a : null); });
982
+ };
896
983
  MapManagementService.prototype.observeAddTile = function () {
897
984
  var _this = this;
898
985
  this.postboy.subscribe(AddTileCommand.ID).subscribe(function (c) {
@@ -952,7 +1039,16 @@
952
1039
  }
953
1040
  MapStateService.prototype.up = function () {
954
1041
  var _this = this;
955
- this.postboy.subscribe(MapRenderedEvent.ID).subscribe(function (m) { return (_this.map = m); });
1042
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe(function (ev) {
1043
+ var _a;
1044
+ _this.map = ev.map;
1045
+ (_a = _this.map) === null || _a === void 0 ? void 0 : _a.on('moveend', function () {
1046
+ var _a, _b;
1047
+ var zoom = Math.floor(((_a = _this.map) === null || _a === void 0 ? void 0 : _a.getView().getZoom()) || -1);
1048
+ var extent = ((_b = _this.map) === null || _b === void 0 ? void 0 : _b.getView().calculateExtent()) || [];
1049
+ _this.postboy.fire(new MapMoveEndEvent(zoom, extent));
1050
+ });
1051
+ });
956
1052
  };
957
1053
  return MapStateService;
958
1054
  }());
@@ -1050,11 +1146,82 @@
1050
1146
  type: i0.Injectable
1051
1147
  }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
1052
1148
 
1149
+ var DrawingService = /** @class */ (function () {
1150
+ function DrawingService(postboy) {
1151
+ this.postboy = postboy;
1152
+ }
1153
+ DrawingService.prototype.up = function () {
1154
+ var _this = this;
1155
+ this.postboy.subscribe(StartDrawingCommand.ID).subscribe(function (ev) {
1156
+ _this.draw(function (l) {
1157
+ if (!l || !_this.map) {
1158
+ _this.clearInteraction(l);
1159
+ return;
1160
+ }
1161
+ var cancelSub = _this.observeCancelation(ev, l);
1162
+ _this.drawInteraction = new interaction.Draw({
1163
+ source: l.getSource(),
1164
+ type: exports.DrawingType[ev.type],
1165
+ style: ev.style,
1166
+ });
1167
+ _this.map.addInteraction(_this.drawInteraction);
1168
+ _this.drawInteraction.on('drawend', function (evt) {
1169
+ cancelSub.unsubscribe();
1170
+ _this.onEnd(evt, ev, l);
1171
+ });
1172
+ });
1173
+ });
1174
+ this.observeMapRender();
1175
+ };
1176
+ DrawingService.prototype.onEnd = function (evt, command, layer) {
1177
+ command.finish(command.format === exports.FeatureOutputFormat.GeoJson
1178
+ ? new format.GeoJSON().writeFeature(evt.feature)
1179
+ : new format.WKT().writeFeature(evt.feature));
1180
+ this.clearInteraction(layer);
1181
+ };
1182
+ DrawingService.prototype.observeMapRender = function () {
1183
+ var _this = this;
1184
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe(function (m) {
1185
+ _this.map = m.map;
1186
+ });
1187
+ };
1188
+ DrawingService.prototype.draw = function (action) {
1189
+ var query = new GetLayerQuery(MapConstants.DrawingLayerId);
1190
+ query.result.subscribe(function (l) { return action(l); });
1191
+ this.postboy.fire(query);
1192
+ };
1193
+ DrawingService.prototype.observeCancelation = function (ev, layer) {
1194
+ var _this = this;
1195
+ return this.postboy
1196
+ .subscribe(CancelDrawingCommand.ID)
1197
+ .pipe(operators.first())
1198
+ .subscribe(function () {
1199
+ ev.finish(null);
1200
+ _this.clearInteraction(layer);
1201
+ });
1202
+ };
1203
+ DrawingService.prototype.clearInteraction = function (layer) {
1204
+ var _this = this;
1205
+ var _a;
1206
+ if (!!this.drawInteraction) {
1207
+ (_a = this.map) === null || _a === void 0 ? void 0 : _a.removeInteraction(this.drawInteraction);
1208
+ layer === null || layer === void 0 ? void 0 : layer.setSource(new source.Vector({}));
1209
+ }
1210
+ setTimeout(function () { return _this.postboy.fire(new DrawingFinishedEvent()); }, 300);
1211
+ };
1212
+ return DrawingService;
1213
+ }());
1214
+ DrawingService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1215
+ DrawingService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DrawingService });
1216
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DrawingService, decorators: [{
1217
+ type: i0.Injectable
1218
+ }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
1219
+
1053
1220
  var MessageRegistratorService = /** @class */ (function (_super) {
1054
1221
  __extends(MessageRegistratorService, _super);
1055
- function MessageRegistratorService(service, management, state, feature, interaction) {
1222
+ function MessageRegistratorService(service, management, state, feature, interaction, drawing) {
1056
1223
  var _this = _super.call(this, service) || this;
1057
- _this.registerServices([management, state, interaction, feature]);
1224
+ _this.registerServices([management, state, interaction, feature, drawing]);
1058
1225
  return _this;
1059
1226
  }
1060
1227
  MessageRegistratorService.prototype._up = function () {
@@ -1067,170 +1234,19 @@
1067
1234
  this.registerSubject(MapClickEvent.ID);
1068
1235
  this.registerSubject(CloseTooltipCommand.ID);
1069
1236
  this.registerSubject(FitToFeaturesCommand.ID);
1237
+ this.registerSubject(MapMoveEndEvent.ID);
1238
+ this.registerSubject(CancelDrawingCommand.ID);
1239
+ this.registerSubject(StartDrawingCommand.ID);
1240
+ this.registerSubject(GetLayerQuery.ID);
1241
+ this.registerSubject(DrawingFinishedEvent.ID);
1070
1242
  };
1071
1243
  return MessageRegistratorService;
1072
1244
  }(postboy.PostboyAbstractRegistrator));
1073
- MessageRegistratorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1245
+ MessageRegistratorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1074
1246
  MessageRegistratorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService });
1075
1247
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MessageRegistratorService, decorators: [{
1076
1248
  type: i0.Injectable
1077
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }]; } });
1078
-
1079
- var MapPlateFactory = /** @class */ (function () {
1080
- function MapPlateFactory() {
1081
- }
1082
- MapPlateFactory.prototype.build = function (settings) {
1083
- return new Map__default["default"]({
1084
- controls: [],
1085
- view: new View__default["default"]({
1086
- center: (settings === null || settings === void 0 ? void 0 : settings.center) || [0, 0],
1087
- zoom: (settings === null || settings === void 0 ? void 0 : settings.zoom) || 4,
1088
- minZoom: (settings === null || settings === void 0 ? void 0 : settings.minZoom) || 0,
1089
- maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
1090
- }),
1091
- layers: [],
1092
- });
1093
- };
1094
- return MapPlateFactory;
1095
- }());
1096
- MapPlateFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1097
- MapPlateFactory.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateFactory, providedIn: 'root' });
1098
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateFactory, decorators: [{
1099
- type: i0.Injectable,
1100
- args: [{
1101
- providedIn: 'root',
1102
- }]
1103
- }] });
1104
-
1105
- var OsmTileLayerComponent = /** @class */ (function (_super) {
1106
- __extends(OsmTileLayerComponent, _super);
1107
- function OsmTileLayerComponent() {
1108
- var _this = _super.call(this) || this;
1109
- _this._url = '';
1110
- return _this;
1111
- }
1112
- Object.defineProperty(OsmTileLayerComponent.prototype, "url", {
1113
- set: function (value) {
1114
- if (!value || this._url === value)
1115
- return;
1116
- this._url = value;
1117
- this.initLayer();
1118
- },
1119
- enumerable: false,
1120
- configurable: true
1121
- });
1122
- Object.defineProperty(OsmTileLayerComponent.prototype, "map", {
1123
- set: function (value) {
1124
- if (!value || this._map === value)
1125
- return;
1126
- this._map = value;
1127
- this.initLayer();
1128
- },
1129
- enumerable: false,
1130
- configurable: true
1131
- });
1132
- OsmTileLayerComponent.prototype.ngOnInit = function () { };
1133
- OsmTileLayerComponent.prototype.ngOnDestroy = function () {
1134
- var _a, _b;
1135
- if (this.layer) {
1136
- (_a = this._map) === null || _a === void 0 ? void 0 : _a.removeLayer(this.layer);
1137
- }
1138
- // @ts-ignore
1139
- (_b = this.layer) === null || _b === void 0 ? void 0 : _b.setMap(null);
1140
- };
1141
- OsmTileLayerComponent.prototype.initLayer = function () {
1142
- if (!this._url || !this._map)
1143
- return;
1144
- if (this.layer)
1145
- this._map.removeLayer(this.layer);
1146
- this.layer = new TileLayer__default["default"]({
1147
- source: new OSM__default["default"]({
1148
- url: this._url,
1149
- }),
1150
- });
1151
- this.layer.set('name', 'osm-tile-layer');
1152
- this._map.addLayer(this.layer);
1153
- };
1154
- return OsmTileLayerComponent;
1155
- }(DestructibleComponent));
1156
- OsmTileLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: OsmTileLayerComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1157
- OsmTileLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1158
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: OsmTileLayerComponent, decorators: [{
1159
- type: i0.Component,
1160
- args: [{
1161
- selector: 'lib-osm-tile-layer',
1162
- template: '',
1163
- styleUrls: [],
1164
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1165
- }]
1166
- }], ctorParameters: function () { return []; }, propDecorators: { url: [{
1167
- type: i0.Input
1168
- }], map: [{
1169
- type: i0.Input
1170
- }] } });
1171
-
1172
- var MapPlateComponent = /** @class */ (function (_super) {
1173
- __extends(MapPlateComponent, _super);
1174
- function MapPlateComponent(elementRef, postboy, mapFactory, registrator, detector) {
1175
- var _this = _super.call(this) || this;
1176
- _this.elementRef = elementRef;
1177
- _this.postboy = postboy;
1178
- _this.mapFactory = mapFactory;
1179
- _this.registrator = registrator;
1180
- _this.detector = detector;
1181
- _this.osmUrl = '';
1182
- _this._settings = new MapSettings();
1183
- _this.onDestroy = function () {
1184
- _this.registrator.down();
1185
- };
1186
- registrator.up();
1187
- return _this;
1188
- }
1189
- Object.defineProperty(MapPlateComponent.prototype, "settings", {
1190
- set: function (value) {
1191
- if (!value || this._settings.isSame(value))
1192
- return;
1193
- this._settings = value;
1194
- this.setOsm();
1195
- },
1196
- enumerable: false,
1197
- configurable: true
1198
- });
1199
- MapPlateComponent.prototype.ngOnInit = function () {
1200
- var _this = this;
1201
- proj.useGeographic();
1202
- this.map = this.mapFactory.build(this._settings);
1203
- this.map.setTarget(this.elementRef.nativeElement);
1204
- this.detector.detectChanges();
1205
- this.map.once('postrender', function () {
1206
- _this.map.updateSize();
1207
- _this.postboy.fire(new MapRenderedEvent(_this.map));
1208
- });
1209
- this.setOsm();
1210
- };
1211
- MapPlateComponent.prototype.setOsm = function () {
1212
- if (!this.map)
1213
- return;
1214
- this.osmUrl = "https://mt{0-3}.google.com/vt/lyrs=" + MapLyrsLabel.get(this._settings.lyrs) + "&hl=" + this._settings.language + "&x={x}&y={y}&z={z}";
1215
- this.detector.detectChanges();
1216
- this.map.updateSize();
1217
- };
1218
- return MapPlateComponent;
1219
- }(DestructibleComponent));
1220
- MapPlateComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateComponent, deps: [{ token: i0__namespace.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1221
- MapPlateComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], usesInheritance: true, ngImport: i0__namespace, template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }], directives: [{ type: i5__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1222
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateComponent, decorators: [{
1223
- type: i0.Component,
1224
- args: [{
1225
- selector: 'lib-map-plate',
1226
- templateUrl: './map-plate.component.html',
1227
- styleUrls: ['./map-plate.component.scss'],
1228
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1229
- providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService],
1230
- }]
1231
- }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { settings: [{
1232
- type: i0.Input
1233
- }] } });
1249
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }]; } });
1234
1250
 
1235
1251
  var TileLayerSettings = /** @class */ (function () {
1236
1252
  function TileLayerSettings() {
@@ -1381,15 +1397,82 @@
1381
1397
  type: i0.Input
1382
1398
  }] } });
1383
1399
 
1384
- var FeatureLayerSettings = /** @class */ (function () {
1385
- function FeatureLayerSettings() {
1386
- this.name = IdGenerator.get();
1387
- this.zIndex = 1;
1388
- this.maxZoom = 19;
1389
- this.minZoom = 0;
1400
+ var OsmTileLayerComponent = /** @class */ (function (_super) {
1401
+ __extends(OsmTileLayerComponent, _super);
1402
+ function OsmTileLayerComponent() {
1403
+ var _this = _super.call(this) || this;
1404
+ _this._url = '';
1405
+ return _this;
1390
1406
  }
1391
- FeatureLayerSettings.copy = function (model) {
1392
- var result = new FeatureLayerSettings();
1407
+ Object.defineProperty(OsmTileLayerComponent.prototype, "url", {
1408
+ set: function (value) {
1409
+ if (!value || this._url === value)
1410
+ return;
1411
+ this._url = value;
1412
+ this.initLayer();
1413
+ },
1414
+ enumerable: false,
1415
+ configurable: true
1416
+ });
1417
+ Object.defineProperty(OsmTileLayerComponent.prototype, "map", {
1418
+ set: function (value) {
1419
+ if (!value || this._map === value)
1420
+ return;
1421
+ this._map = value;
1422
+ this.initLayer();
1423
+ },
1424
+ enumerable: false,
1425
+ configurable: true
1426
+ });
1427
+ OsmTileLayerComponent.prototype.ngOnInit = function () { };
1428
+ OsmTileLayerComponent.prototype.ngOnDestroy = function () {
1429
+ var _a, _b;
1430
+ if (this.layer) {
1431
+ (_a = this._map) === null || _a === void 0 ? void 0 : _a.removeLayer(this.layer);
1432
+ }
1433
+ // @ts-ignore
1434
+ (_b = this.layer) === null || _b === void 0 ? void 0 : _b.setMap(null);
1435
+ };
1436
+ OsmTileLayerComponent.prototype.initLayer = function () {
1437
+ if (!this._url || !this._map)
1438
+ return;
1439
+ if (this.layer)
1440
+ this._map.removeLayer(this.layer);
1441
+ this.layer = new TileLayer__default["default"]({
1442
+ source: new OSM__default["default"]({
1443
+ url: this._url,
1444
+ }),
1445
+ });
1446
+ this.layer.set('name', 'osm-tile-layer');
1447
+ this._map.addLayer(this.layer);
1448
+ };
1449
+ return OsmTileLayerComponent;
1450
+ }(DestructibleComponent));
1451
+ OsmTileLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: OsmTileLayerComponent, deps: [], target: i0__namespace.ɵɵFactoryTarget.Component });
1452
+ OsmTileLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1453
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: OsmTileLayerComponent, decorators: [{
1454
+ type: i0.Component,
1455
+ args: [{
1456
+ selector: 'lib-osm-tile-layer',
1457
+ template: '',
1458
+ styleUrls: [],
1459
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1460
+ }]
1461
+ }], ctorParameters: function () { return []; }, propDecorators: { url: [{
1462
+ type: i0.Input
1463
+ }], map: [{
1464
+ type: i0.Input
1465
+ }] } });
1466
+
1467
+ var FeatureLayerSettings = /** @class */ (function () {
1468
+ function FeatureLayerSettings() {
1469
+ this.name = IdGenerator.get();
1470
+ this.zIndex = 1;
1471
+ this.maxZoom = 19;
1472
+ this.minZoom = 0;
1473
+ }
1474
+ FeatureLayerSettings.copy = function (model) {
1475
+ var result = new FeatureLayerSettings();
1393
1476
  result.name = model.name;
1394
1477
  result.maxZoom = model.maxZoom;
1395
1478
  result.minZoom = model.minZoom;
@@ -1460,51 +1543,367 @@
1460
1543
  function FeatureLayerComponent(postboy, factory) {
1461
1544
  var _this = _super.call(this) || this;
1462
1545
  _this.postboy = postboy;
1463
- _this.factory = factory;
1464
- _this.layer = null;
1465
- _this._settings = new FeatureLayerSettings();
1466
- _this.onDestroy = function () { return _this.removeLayer(); };
1546
+ _this.factory = factory;
1547
+ _this.layer = null;
1548
+ _this._settings = new FeatureLayerSettings();
1549
+ _this.onDestroy = function () { return _this.removeLayer(); };
1550
+ return _this;
1551
+ }
1552
+ FeatureLayerComponent.prototype.ngOnInit = function () {
1553
+ var _this = this;
1554
+ this.postboy
1555
+ .subscribe(MapRenderedEvent.ID)
1556
+ .pipe(operators.filter(function (m) { return !!m; }), operators.first())
1557
+ .subscribe(function (m) { return _this.initLayer(); });
1558
+ };
1559
+ Object.defineProperty(FeatureLayerComponent.prototype, "settings", {
1560
+ set: function (value) {
1561
+ if (!value || this._settings.isSame(value))
1562
+ return;
1563
+ this._settings = value;
1564
+ this.initLayer();
1565
+ },
1566
+ enumerable: false,
1567
+ configurable: true
1568
+ });
1569
+ FeatureLayerComponent.prototype.initLayer = function () {
1570
+ this.removeLayer();
1571
+ this.layer = this.factory.build(this._settings);
1572
+ this.postboy.fire(new AddLayerCommand(this.layer));
1573
+ };
1574
+ FeatureLayerComponent.prototype.removeLayer = function () {
1575
+ if (this.layer)
1576
+ this.postboy.fire(new RemoveLayerCommand(this.layer));
1577
+ };
1578
+ return FeatureLayerComponent;
1579
+ }(DestructibleComponent));
1580
+ FeatureLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FeatureLayerComponent, deps: [{ token: MapPostboyService }, { token: FeatureLayerFactory }], target: i0__namespace.ɵɵFactoryTarget.Component });
1581
+ FeatureLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1582
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FeatureLayerComponent, decorators: [{
1583
+ type: i0.Component,
1584
+ args: [{
1585
+ selector: 'lib-feature-layer',
1586
+ template: '',
1587
+ styleUrls: [],
1588
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1589
+ }]
1590
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: FeatureLayerFactory }]; }, propDecorators: { settings: [{
1591
+ type: i0.Input
1592
+ }] } });
1593
+
1594
+ var ClusterLayerSettings = /** @class */ (function () {
1595
+ function ClusterLayerSettings() {
1596
+ this.name = IdGenerator.get();
1597
+ this.zIndex = 1;
1598
+ this.maxZoom = 19;
1599
+ this.minZoom = 0;
1600
+ this.distance = 20;
1601
+ this.bbox = false;
1602
+ this.clusterCancel = 14;
1603
+ }
1604
+ ClusterLayerSettings.copy = function (model) {
1605
+ var result = new ClusterLayerSettings();
1606
+ result.name = model.name;
1607
+ result.maxZoom = model.maxZoom;
1608
+ result.minZoom = model.minZoom;
1609
+ result.zIndex = model.zIndex;
1610
+ result.bbox = model.bbox;
1611
+ result.clusterCancel = model.clusterCancel;
1612
+ result.distance = model.distance;
1613
+ result.style = model.style;
1614
+ return result;
1615
+ };
1616
+ ClusterLayerSettings.prototype.setZIndex = function (zIndex) {
1617
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex: zIndex }));
1618
+ };
1619
+ ClusterLayerSettings.prototype.setDistance = function (distance) {
1620
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { distance: distance }));
1621
+ };
1622
+ ClusterLayerSettings.prototype.setName = function (name) {
1623
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { name: name }));
1624
+ };
1625
+ ClusterLayerSettings.prototype.setMaxZoom = function (maxZoom) {
1626
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom: maxZoom }));
1627
+ };
1628
+ ClusterLayerSettings.prototype.setMinZoom = function (minZoom) {
1629
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom: minZoom }));
1630
+ };
1631
+ ClusterLayerSettings.prototype.setClusterCancel = function (clusterCancel) {
1632
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { clusterCancel: clusterCancel }));
1633
+ };
1634
+ ClusterLayerSettings.prototype.setBbox = function (bbox) {
1635
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { bbox: bbox }));
1636
+ };
1637
+ ClusterLayerSettings.prototype.setStyle = function (style) {
1638
+ return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { style: style }));
1639
+ };
1640
+ ClusterLayerSettings.prototype.isSame = function (model) {
1641
+ if (this.maxZoom !== model.maxZoom)
1642
+ return false;
1643
+ if (this.minZoom !== model.minZoom)
1644
+ return false;
1645
+ if (this.zIndex !== model.zIndex)
1646
+ return false;
1647
+ if (this.name !== model.name)
1648
+ return false;
1649
+ if (this.distance !== model.distance)
1650
+ return false;
1651
+ if (this.clusterCancel !== model.clusterCancel)
1652
+ return false;
1653
+ if (this.bbox !== model.bbox)
1654
+ return false;
1655
+ if (this.style !== model.style)
1656
+ return false;
1657
+ return true;
1658
+ };
1659
+ return ClusterLayerSettings;
1660
+ }());
1661
+
1662
+ var ClusterLayerManager = /** @class */ (function () {
1663
+ function ClusterLayerManager(settings, layer, postboy) {
1664
+ this.settings = settings;
1665
+ this.layer = layer;
1666
+ this.postboy = postboy;
1667
+ this.observeClick();
1668
+ this.observeMapMovement();
1669
+ }
1670
+ ClusterLayerManager.prototype.observeMapMovement = function () {
1671
+ var _this = this;
1672
+ rxjs.combineLatest([
1673
+ this.postboy.subscribe(MapMoveEndEvent.ID).pipe(operators.auditTime(250)),
1674
+ this.postboy.subscribe(MapRenderedEvent.ID),
1675
+ ]).subscribe(function (_d) {
1676
+ var _e = __read(_d, 2), movement = _e[0], renderEvent = _e[1];
1677
+ _this.checkClusterNecessity(renderEvent.map);
1678
+ });
1679
+ };
1680
+ ClusterLayerManager.prototype.observeClick = function () {
1681
+ var _this = this;
1682
+ this.postboy.subscribe(MapClickEvent.ID).subscribe(function (m) {
1683
+ var _a, _b;
1684
+ if (((_b = (_a = m.features[_this.settings.name]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1) {
1685
+ _this.postboy.fire(new FitToFeaturesCommand(m.features[_this.settings.name], -1));
1686
+ }
1687
+ });
1688
+ };
1689
+ ClusterLayerManager.prototype.checkClusterNecessity = function (map) {
1690
+ var _a, _b, _c;
1691
+ var zoom = (_a = map.getView().getZoom()) !== null && _a !== void 0 ? _a : 0;
1692
+ var distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
1693
+ (_c = (_b = this.layer) === null || _b === void 0 ? void 0 : _b.getSource()) === null || _c === void 0 ? void 0 : _c.setDistance(distance);
1694
+ };
1695
+ return ClusterLayerManager;
1696
+ }());
1697
+
1698
+ var ClusterLayerFactory = /** @class */ (function () {
1699
+ function ClusterLayerFactory() {
1700
+ }
1701
+ ClusterLayerFactory.prototype.build = function (settings, postboy) {
1702
+ var source$1 = new source.Vector({
1703
+ strategy: settings.bbox ? loadingstrategy.bbox : undefined,
1704
+ });
1705
+ var cluster = new Cluster__default["default"]({
1706
+ distance: settings.distance,
1707
+ source: source$1,
1708
+ geometryFunction: function (feature) {
1709
+ var _a, _b;
1710
+ var geom = feature.getGeometry();
1711
+ if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Point') {
1712
+ return geom;
1713
+ }
1714
+ else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Polygon') {
1715
+ return (_a = geom) === null || _a === void 0 ? void 0 : _a.getInteriorPoint();
1716
+ }
1717
+ else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'MultiPolygon') {
1718
+ return (_b = Polygon.fromExtent(geom.getExtent())) === null || _b === void 0 ? void 0 : _b.getInteriorPoint();
1719
+ }
1720
+ return undefined;
1721
+ },
1722
+ });
1723
+ var layer$1 = new layer.Vector({
1724
+ source: cluster,
1725
+ maxZoom: settings.maxZoom || undefined,
1726
+ minZoom: settings.minZoom || undefined,
1727
+ zIndex: settings.zIndex || 0,
1728
+ });
1729
+ layer$1.setStyle(this.styleFunc(settings));
1730
+ layer$1.set('name', settings.name);
1731
+ return new ClusterLayerManager(settings, layer$1, postboy);
1732
+ };
1733
+ ClusterLayerFactory.prototype.styleFunc = function (settings) {
1734
+ return function (feature) {
1735
+ var features = feature.get('features');
1736
+ if (!settings.style)
1737
+ return undefined;
1738
+ return settings.style(features.map(function (f) { return (Object.assign({ id: f.getId() }, f.get(MapConstants.FeatureInfo))); }));
1739
+ };
1740
+ };
1741
+ return ClusterLayerFactory;
1742
+ }());
1743
+ ClusterLayerFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1744
+ ClusterLayerFactory.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, providedIn: 'root' });
1745
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, decorators: [{
1746
+ type: i0.Injectable,
1747
+ args: [{
1748
+ providedIn: 'root',
1749
+ }]
1750
+ }] });
1751
+
1752
+ var ClusterLayerComponent = /** @class */ (function (_super) {
1753
+ __extends(ClusterLayerComponent, _super);
1754
+ function ClusterLayerComponent(postboy, factory) {
1755
+ var _this = _super.call(this) || this;
1756
+ _this.postboy = postboy;
1757
+ _this.factory = factory;
1758
+ _this.manager = null;
1759
+ _this._settings = new ClusterLayerSettings();
1760
+ _this.onDestroy = function () { return _this.removeLayer(); };
1761
+ return _this;
1762
+ }
1763
+ ClusterLayerComponent.prototype.ngOnInit = function () {
1764
+ var _this = this;
1765
+ this.postboy
1766
+ .subscribe(MapRenderedEvent.ID)
1767
+ .pipe(operators.filter(function (m) { return !!m; }), operators.first())
1768
+ .subscribe(function (m) { return _this.initLayer(); });
1769
+ };
1770
+ Object.defineProperty(ClusterLayerComponent.prototype, "settings", {
1771
+ set: function (value) {
1772
+ if (!value || this._settings.isSame(value))
1773
+ return;
1774
+ this._settings = value;
1775
+ this.initLayer();
1776
+ },
1777
+ enumerable: false,
1778
+ configurable: true
1779
+ });
1780
+ ClusterLayerComponent.prototype.initLayer = function () {
1781
+ this.removeLayer();
1782
+ this.manager = this.factory.build(this._settings, this.postboy);
1783
+ this.postboy.fire(new AddLayerCommand(this.manager.layer));
1784
+ };
1785
+ ClusterLayerComponent.prototype.removeLayer = function () {
1786
+ var _a;
1787
+ if ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.layer)
1788
+ this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
1789
+ };
1790
+ return ClusterLayerComponent;
1791
+ }(DestructibleComponent));
1792
+ ClusterLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0__namespace.ɵɵFactoryTarget.Component });
1793
+ ClusterLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1794
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerComponent, decorators: [{
1795
+ type: i0.Component,
1796
+ args: [{
1797
+ selector: 'lib-cluster-layer',
1798
+ template: '',
1799
+ styleUrls: [],
1800
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1801
+ }]
1802
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
1803
+ type: i0.Input
1804
+ }] } });
1805
+
1806
+ var MapPlateFactory = /** @class */ (function () {
1807
+ function MapPlateFactory() {
1808
+ }
1809
+ MapPlateFactory.prototype.build = function (settings) {
1810
+ return new Map__default["default"]({
1811
+ controls: [],
1812
+ view: new View__default["default"]({
1813
+ center: (settings === null || settings === void 0 ? void 0 : settings.center) || [0, 0],
1814
+ zoom: (settings === null || settings === void 0 ? void 0 : settings.zoom) || 4,
1815
+ minZoom: (settings === null || settings === void 0 ? void 0 : settings.minZoom) || 0,
1816
+ maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
1817
+ }),
1818
+ layers: [],
1819
+ });
1820
+ };
1821
+ return MapPlateFactory;
1822
+ }());
1823
+ MapPlateFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1824
+ MapPlateFactory.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateFactory, providedIn: 'root' });
1825
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateFactory, decorators: [{
1826
+ type: i0.Injectable,
1827
+ args: [{
1828
+ providedIn: 'root',
1829
+ }]
1830
+ }] });
1831
+
1832
+ var MapPlateComponent = /** @class */ (function (_super) {
1833
+ __extends(MapPlateComponent, _super);
1834
+ function MapPlateComponent(elementRef, postboy, mapFactory, registrator, detector) {
1835
+ var _this = _super.call(this) || this;
1836
+ _this.elementRef = elementRef;
1837
+ _this.postboy = postboy;
1838
+ _this.mapFactory = mapFactory;
1839
+ _this.registrator = registrator;
1840
+ _this.detector = detector;
1841
+ _this.osmUrl = '';
1842
+ _this._settings = new MapSettings();
1843
+ _this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
1844
+ _this.onDestroy = function () {
1845
+ _this.registrator.down();
1846
+ };
1847
+ registrator.up();
1467
1848
  return _this;
1468
1849
  }
1469
- FeatureLayerComponent.prototype.ngOnInit = function () {
1470
- var _this = this;
1471
- this.postboy
1472
- .subscribe(MapRenderedEvent.ID)
1473
- .pipe(operators.filter(function (m) { return !!m; }), operators.first())
1474
- .subscribe(function (m) { return _this.initLayer(); });
1475
- };
1476
- Object.defineProperty(FeatureLayerComponent.prototype, "settings", {
1850
+ Object.defineProperty(MapPlateComponent.prototype, "settings", {
1477
1851
  set: function (value) {
1478
1852
  if (!value || this._settings.isSame(value))
1479
1853
  return;
1480
1854
  this._settings = value;
1481
- this.initLayer();
1855
+ this.setOsm();
1482
1856
  },
1483
1857
  enumerable: false,
1484
1858
  configurable: true
1485
1859
  });
1486
- FeatureLayerComponent.prototype.initLayer = function () {
1487
- this.removeLayer();
1488
- this.layer = this.factory.build(this._settings);
1489
- this.postboy.fire(new AddLayerCommand(this.layer));
1860
+ MapPlateComponent.prototype.ngOnInit = function () {
1861
+ var _this = this;
1862
+ proj.useGeographic();
1863
+ this.map = this.mapFactory.build(this._settings);
1864
+ this.map.setTarget(this.elementRef.nativeElement);
1865
+ this.detector.detectChanges();
1866
+ this.map.once('postrender', function () {
1867
+ _this.map.updateSize();
1868
+ _this.postboy.fire(new MapRenderedEvent(_this.map));
1869
+ });
1870
+ this.setOsm();
1490
1871
  };
1491
- FeatureLayerComponent.prototype.removeLayer = function () {
1492
- if (this.layer)
1493
- this.postboy.fire(new RemoveLayerCommand(this.layer));
1872
+ MapPlateComponent.prototype.setOsm = function () {
1873
+ if (!this.map)
1874
+ return;
1875
+ this.osmUrl = "https://mt{0-3}.google.com/vt/lyrs=" + MapLyrsLabel.get(this._settings.lyrs) + "&hl=" + this._settings.language + "&x={x}&y={y}&z={z}";
1876
+ this.detector.detectChanges();
1877
+ this.map.updateSize();
1494
1878
  };
1495
- return FeatureLayerComponent;
1879
+ return MapPlateComponent;
1496
1880
  }(DestructibleComponent));
1497
- FeatureLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FeatureLayerComponent, deps: [{ token: MapPostboyService }, { token: FeatureLayerFactory }], target: i0__namespace.ɵɵFactoryTarget.Component });
1498
- FeatureLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1499
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FeatureLayerComponent, decorators: [{
1881
+ MapPlateComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateComponent, deps: [{ token: i0__namespace.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1882
+ MapPlateComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [
1883
+ MessageRegistratorService,
1884
+ MapStateService,
1885
+ MapManagementService,
1886
+ MapClickService,
1887
+ MapFeatureService,
1888
+ DrawingService,
1889
+ ], usesInheritance: true, ngImport: i0__namespace, 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"], components: [{ type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }, { type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: ["settings"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1890
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapPlateComponent, decorators: [{
1500
1891
  type: i0.Component,
1501
1892
  args: [{
1502
- selector: 'lib-feature-layer',
1503
- template: '',
1504
- styleUrls: [],
1893
+ selector: 'lib-map-plate',
1894
+ templateUrl: './map-plate.component.html',
1895
+ styleUrls: ['./map-plate.component.scss'],
1505
1896
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1897
+ providers: [
1898
+ MessageRegistratorService,
1899
+ MapStateService,
1900
+ MapManagementService,
1901
+ MapClickService,
1902
+ MapFeatureService,
1903
+ DrawingService,
1904
+ ],
1506
1905
  }]
1507
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: FeatureLayerFactory }]; }, propDecorators: { settings: [{
1906
+ }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { settings: [{
1508
1907
  type: i0.Input
1509
1908
  }] } });
1510
1909
 
@@ -1696,8 +2095,7 @@
1696
2095
  .subscribe(function () { return _this.putPolygons(); });
1697
2096
  };
1698
2097
  PolygonsComponent.prototype.putPolygons = function () {
1699
- var _a;
1700
- if (!((_a = this._polygons) === null || _a === void 0 ? void 0 : _a.length))
2098
+ if (!this._polygons)
1701
2099
  return;
1702
2100
  this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map(function (m) { return m.feature; })));
1703
2101
  };
@@ -1719,194 +2117,6 @@
1719
2117
  type: i0.Input
1720
2118
  }] } });
1721
2119
 
1722
- var ClusterLayerSettings = /** @class */ (function () {
1723
- function ClusterLayerSettings() {
1724
- this.name = IdGenerator.get();
1725
- this.zIndex = 1;
1726
- this.maxZoom = 19;
1727
- this.minZoom = 0;
1728
- this.distance = 20;
1729
- this.bbox = false;
1730
- }
1731
- ClusterLayerSettings.copy = function (model) {
1732
- var result = new ClusterLayerSettings();
1733
- result.name = model.name;
1734
- result.maxZoom = model.maxZoom;
1735
- result.minZoom = model.minZoom;
1736
- result.zIndex = model.zIndex;
1737
- result.bbox = model.bbox;
1738
- result.distance = model.distance;
1739
- result.style = model.style;
1740
- return result;
1741
- };
1742
- ClusterLayerSettings.prototype.setZIndex = function (zIndex) {
1743
- return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex: zIndex }));
1744
- };
1745
- ClusterLayerSettings.prototype.setDistance = function (distance) {
1746
- return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { distance: distance }));
1747
- };
1748
- ClusterLayerSettings.prototype.setName = function (name) {
1749
- return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { name: name }));
1750
- };
1751
- ClusterLayerSettings.prototype.setMaxZoom = function (maxZoom) {
1752
- return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom: maxZoom }));
1753
- };
1754
- ClusterLayerSettings.prototype.setMinZoom = function (minZoom) {
1755
- return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom: minZoom }));
1756
- };
1757
- ClusterLayerSettings.prototype.setBbox = function (bbox) {
1758
- return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { bbox: bbox }));
1759
- };
1760
- ClusterLayerSettings.prototype.setStyle = function (style) {
1761
- return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { style: style }));
1762
- };
1763
- ClusterLayerSettings.prototype.isSame = function (model) {
1764
- if (this.maxZoom !== model.maxZoom)
1765
- return false;
1766
- if (this.minZoom !== model.minZoom)
1767
- return false;
1768
- if (this.zIndex !== model.zIndex)
1769
- return false;
1770
- if (this.name !== model.name)
1771
- return false;
1772
- if (this.distance !== model.distance)
1773
- return false;
1774
- if (this.bbox !== model.bbox)
1775
- return false;
1776
- if (this.style !== model.style)
1777
- return false;
1778
- return true;
1779
- };
1780
- return ClusterLayerSettings;
1781
- }());
1782
-
1783
- var ClusterLayerManager = /** @class */ (function () {
1784
- function ClusterLayerManager(settings, layer, postboy) {
1785
- this.settings = settings;
1786
- this.layer = layer;
1787
- this.postboy = postboy;
1788
- this.observeClick();
1789
- }
1790
- ClusterLayerManager.prototype.observeClick = function () {
1791
- var _this = this;
1792
- this.postboy.subscribe(MapClickEvent.ID).subscribe(function (m) {
1793
- var _a, _b;
1794
- if (((_b = (_a = m.features[_this.settings.name]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1) {
1795
- _this.postboy.fire(new FitToFeaturesCommand(m.features[_this.settings.name], -1));
1796
- }
1797
- });
1798
- };
1799
- return ClusterLayerManager;
1800
- }());
1801
-
1802
- var ClusterLayerFactory = /** @class */ (function () {
1803
- function ClusterLayerFactory() {
1804
- }
1805
- ClusterLayerFactory.prototype.build = function (settings, postboy) {
1806
- var source$1 = new source.Vector({
1807
- strategy: settings.bbox ? loadingstrategy.bbox : undefined,
1808
- });
1809
- var cluster = new Cluster__default["default"]({
1810
- distance: settings.distance,
1811
- source: source$1,
1812
- geometryFunction: function (feature) {
1813
- var _a, _b;
1814
- var geom = feature.getGeometry();
1815
- if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Point') {
1816
- return geom;
1817
- }
1818
- else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Polygon') {
1819
- return (_a = geom) === null || _a === void 0 ? void 0 : _a.getInteriorPoint();
1820
- }
1821
- else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'MultiPolygon') {
1822
- return (_b = Polygon.fromExtent(geom.getExtent())) === null || _b === void 0 ? void 0 : _b.getInteriorPoint();
1823
- }
1824
- return undefined;
1825
- },
1826
- });
1827
- var layer$1 = new layer.Vector({
1828
- source: cluster,
1829
- maxZoom: settings.maxZoom || undefined,
1830
- minZoom: settings.minZoom || undefined,
1831
- zIndex: settings.zIndex || 0,
1832
- });
1833
- layer$1.setStyle(this.styleFunc(settings));
1834
- layer$1.set('name', settings.name);
1835
- return new ClusterLayerManager(settings, layer$1, postboy);
1836
- };
1837
- ClusterLayerFactory.prototype.styleFunc = function (settings) {
1838
- return function (feature) {
1839
- var features = feature.get('features');
1840
- if (!settings.style)
1841
- return undefined;
1842
- return settings.style(features.map(function (f) { return (Object.assign({ id: f.getId() }, f.get(MapConstants.FeatureInfo))); }));
1843
- };
1844
- };
1845
- return ClusterLayerFactory;
1846
- }());
1847
- ClusterLayerFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1848
- ClusterLayerFactory.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, providedIn: 'root' });
1849
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerFactory, decorators: [{
1850
- type: i0.Injectable,
1851
- args: [{
1852
- providedIn: 'root',
1853
- }]
1854
- }] });
1855
-
1856
- var ClusterLayerComponent = /** @class */ (function (_super) {
1857
- __extends(ClusterLayerComponent, _super);
1858
- function ClusterLayerComponent(postboy, factory) {
1859
- var _this = _super.call(this) || this;
1860
- _this.postboy = postboy;
1861
- _this.factory = factory;
1862
- _this.manager = null;
1863
- _this._settings = new ClusterLayerSettings();
1864
- _this.onDestroy = function () { return _this.removeLayer(); };
1865
- return _this;
1866
- }
1867
- ClusterLayerComponent.prototype.ngOnInit = function () {
1868
- var _this = this;
1869
- this.postboy
1870
- .subscribe(MapRenderedEvent.ID)
1871
- .pipe(operators.filter(function (m) { return !!m; }), operators.first())
1872
- .subscribe(function (m) { return _this.initLayer(); });
1873
- };
1874
- Object.defineProperty(ClusterLayerComponent.prototype, "settings", {
1875
- set: function (value) {
1876
- if (!value || this._settings.isSame(value))
1877
- return;
1878
- this._settings = value;
1879
- this.initLayer();
1880
- },
1881
- enumerable: false,
1882
- configurable: true
1883
- });
1884
- ClusterLayerComponent.prototype.initLayer = function () {
1885
- this.removeLayer();
1886
- this.manager = this.factory.build(this._settings, this.postboy);
1887
- this.postboy.fire(new AddLayerCommand(this.manager.layer));
1888
- };
1889
- ClusterLayerComponent.prototype.removeLayer = function () {
1890
- var _a;
1891
- if ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.layer)
1892
- this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
1893
- };
1894
- return ClusterLayerComponent;
1895
- }(DestructibleComponent));
1896
- ClusterLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0__namespace.ɵɵFactoryTarget.Component });
1897
- ClusterLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1898
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ClusterLayerComponent, decorators: [{
1899
- type: i0.Component,
1900
- args: [{
1901
- selector: 'lib-cluster-layer',
1902
- template: '',
1903
- styleUrls: [],
1904
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1905
- }]
1906
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
1907
- type: i0.Input
1908
- }] } });
1909
-
1910
2120
  var MapModule = /** @class */ (function () {
1911
2121
  function MapModule() {
1912
2122
  }
@@ -1921,18 +2131,18 @@
1921
2131
  MarkersComponent,
1922
2132
  TooltipComponent,
1923
2133
  PolygonsComponent,
1924
- ClusterLayerComponent], imports: [i5.CommonModule], exports: [MapPlateComponent,
2134
+ ClusterLayerComponent], imports: [i6.CommonModule], exports: [MapPlateComponent,
1925
2135
  FeatureLayerComponent,
1926
2136
  MarkersComponent,
1927
2137
  TileLayerComponent,
1928
2138
  TooltipComponent,
1929
2139
  PolygonsComponent,
1930
2140
  ClusterLayerComponent] });
1931
- MapModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, imports: [[i5.CommonModule]] });
2141
+ MapModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, imports: [[i6.CommonModule]] });
1932
2142
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, decorators: [{
1933
2143
  type: i0.NgModule,
1934
2144
  args: [{
1935
- imports: [i5.CommonModule],
2145
+ imports: [i6.CommonModule],
1936
2146
  declarations: [
1937
2147
  DestructibleComponent,
1938
2148
  MapPlateComponent,
@@ -2035,16 +2245,16 @@
2035
2245
  * Generated bundle index. Do not edit.
2036
2246
  */
2037
2247
 
2038
- exports.CallbackMessage = CallbackMessage;
2248
+ exports.CancelDrawingCommand = CancelDrawingCommand;
2039
2249
  exports.CloseTooltipCommand = CloseTooltipCommand;
2040
2250
  exports.ClusterLayerComponent = ClusterLayerComponent;
2041
2251
  exports.ClusterLayerSettings = ClusterLayerSettings;
2042
2252
  exports.FeatureLayerComponent = FeatureLayerComponent;
2043
2253
  exports.FeatureLayerSettings = FeatureLayerSettings;
2044
- exports.GenericMessage = GenericMessage;
2045
2254
  exports.MapClickEvent = MapClickEvent;
2046
2255
  exports.MapLyrsLabel = MapLyrsLabel;
2047
2256
  exports.MapModule = MapModule;
2257
+ exports.MapMoveEndEvent = MapMoveEndEvent;
2048
2258
  exports.MapPlateComponent = MapPlateComponent;
2049
2259
  exports.MapPostboyService = MapPostboyService;
2050
2260
  exports.MapRenderedEvent = MapRenderedEvent;
@@ -2057,6 +2267,7 @@
2057
2267
  exports.PolygonModel = PolygonModel;
2058
2268
  exports.PolygonStyleHelper = PolygonStyleHelper;
2059
2269
  exports.PolygonsComponent = PolygonsComponent;
2270
+ exports.StartDrawingCommand = StartDrawingCommand;
2060
2271
  exports.TextStyleHelper = TextStyleHelper;
2061
2272
  exports.TileLayerComponent = TileLayerComponent;
2062
2273
  exports.TileLayerSettings = TileLayerSettings;