@artstesh/maps 1.1.8 → 1.1.10

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 (37) hide show
  1. package/dist/bundles/maps-components-src-map.umd.js +57 -27
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +57 -27
  4. package/dist/bundles/maps-components.umd.js.map +1 -1
  5. package/dist/esm2015/map/messages/events/map-move-end.event.js +3 -4
  6. package/dist/esm2015/map/messages/executors/get-map-position.executor.js +16 -0
  7. package/dist/esm2015/map/messages/index.js +3 -1
  8. package/dist/esm2015/map/models/index.js +2 -1
  9. package/dist/esm2015/map/models/map-position.model.js +2 -0
  10. package/dist/esm2015/map/services/map-state.service.js +10 -5
  11. package/dist/esm2015/map/services/message-registrator.service.js +4 -1
  12. package/dist/esm2015/src/map/messages/events/map-move-end.event.js +3 -4
  13. package/dist/esm2015/src/map/messages/executors/get-map-position.executor.js +16 -0
  14. package/dist/esm2015/src/map/messages/index.js +3 -1
  15. package/dist/esm2015/src/map/models/index.js +2 -1
  16. package/dist/esm2015/src/map/models/map-position.model.js +2 -0
  17. package/dist/esm2015/src/map/services/map-state.service.js +10 -5
  18. package/dist/esm2015/src/map/services/message-registrator.service.js +4 -1
  19. package/dist/fesm2015/maps-components-src-map.js +41 -20
  20. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  21. package/dist/fesm2015/maps-components.js +41 -20
  22. package/dist/fesm2015/maps-components.js.map +1 -1
  23. package/dist/map/messages/events/map-move-end.event.d.ts +3 -3
  24. package/dist/map/messages/executors/get-map-position.executor.d.ts +12 -0
  25. package/dist/map/messages/index.d.ts +2 -0
  26. package/dist/map/models/index.d.ts +1 -0
  27. package/dist/map/models/map-position.model.d.ts +6 -0
  28. package/dist/map/services/map-state.service.d.ts +2 -0
  29. package/dist/map/services/message-registrator.service.d.ts +1 -0
  30. package/dist/src/map/messages/events/map-move-end.event.d.ts +3 -3
  31. package/dist/src/map/messages/executors/get-map-position.executor.d.ts +12 -0
  32. package/dist/src/map/messages/index.d.ts +2 -0
  33. package/dist/src/map/models/index.d.ts +1 -0
  34. package/dist/src/map/models/map-position.model.d.ts +6 -0
  35. package/dist/src/map/services/map-state.service.d.ts +2 -0
  36. package/dist/src/map/services/message-registrator.service.d.ts +1 -0
  37. package/package.json +1 -1
@@ -745,10 +745,9 @@
745
745
 
746
746
  var MapMoveEndEvent = /** @class */ (function (_super) {
747
747
  __extends(MapMoveEndEvent, _super);
748
- function MapMoveEndEvent(zoom, extent) {
748
+ function MapMoveEndEvent(position) {
749
749
  var _this = _super.call(this) || this;
750
- _this.zoom = zoom;
751
- _this.extent = extent;
750
+ _this.position = position;
752
751
  return _this;
753
752
  }
754
753
  Object.defineProperty(MapMoveEndEvent.prototype, "id", {
@@ -978,6 +977,47 @@
978
977
  }(postboy.PostboyGenericMessage));
979
978
  FitToPolygonsCommand.ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
980
979
 
980
+ /**
981
+ * A message that allows to get the current state of the map.
982
+ * If the map's state is not defined yet, the executor would return null
983
+ * @returns {MapPosition | null}
984
+ */
985
+ var GetMapPositionExecutor = /** @class */ (function (_super) {
986
+ __extends(GetMapPositionExecutor, _super);
987
+ function GetMapPositionExecutor() {
988
+ return _super.call(this) || this;
989
+ }
990
+ Object.defineProperty(GetMapPositionExecutor.prototype, "id", {
991
+ get: function () {
992
+ return GetMapPositionExecutor.ID;
993
+ },
994
+ enumerable: false,
995
+ configurable: true
996
+ });
997
+ return GetMapPositionExecutor;
998
+ }(postboy.PostboyExecutor));
999
+ GetMapPositionExecutor.ID = '52c95689-d09b-4082-ba58-9183ea96a213';
1000
+
1001
+ var GetFeaturesInAreaQuery = /** @class */ (function (_super) {
1002
+ __extends(GetFeaturesInAreaQuery, _super);
1003
+ function GetFeaturesInAreaQuery(area, ignore) {
1004
+ if (ignore === void 0) { ignore = new Set(); }
1005
+ var _this = _super.call(this) || this;
1006
+ _this.area = area;
1007
+ _this.ignore = ignore;
1008
+ return _this;
1009
+ }
1010
+ Object.defineProperty(GetFeaturesInAreaQuery.prototype, "id", {
1011
+ get: function () {
1012
+ return GetFeaturesInAreaQuery.ID;
1013
+ },
1014
+ enumerable: false,
1015
+ configurable: true
1016
+ });
1017
+ return GetFeaturesInAreaQuery;
1018
+ }(postboy.PostboyCallbackMessage));
1019
+ GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
1020
+
981
1021
  var AddLayerCommand = /** @class */ (function (_super) {
982
1022
  __extends(AddLayerCommand, _super);
983
1023
  function AddLayerCommand(layer) {
@@ -1171,26 +1211,6 @@
1171
1211
  return FeatureService;
1172
1212
  }());
1173
1213
 
1174
- var GetFeaturesInAreaQuery = /** @class */ (function (_super) {
1175
- __extends(GetFeaturesInAreaQuery, _super);
1176
- function GetFeaturesInAreaQuery(area, ignore) {
1177
- if (ignore === void 0) { ignore = new Set(); }
1178
- var _this = _super.call(this) || this;
1179
- _this.area = area;
1180
- _this.ignore = ignore;
1181
- return _this;
1182
- }
1183
- Object.defineProperty(GetFeaturesInAreaQuery.prototype, "id", {
1184
- get: function () {
1185
- return GetFeaturesInAreaQuery.ID;
1186
- },
1187
- enumerable: false,
1188
- configurable: true
1189
- });
1190
- return GetFeaturesInAreaQuery;
1191
- }(postboy.PostboyCallbackMessage));
1192
- GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
1193
-
1194
1214
  var FilterFeaturesInAreaExecutor = /** @class */ (function (_super) {
1195
1215
  __extends(FilterFeaturesInAreaExecutor, _super);
1196
1216
  function FilterFeaturesInAreaExecutor(area, features) {
@@ -1384,6 +1404,14 @@
1384
1404
  this.observeMapRendering();
1385
1405
  this.observeCenter();
1386
1406
  };
1407
+ MapStateService.prototype.getMapPosition = function () {
1408
+ if (!this.map)
1409
+ return null;
1410
+ var _c = __read(this.map.getView().getCenter(), 2), longitude = _c[0], latitude = _c[1];
1411
+ var zoom = Math.floor(this.map.getView().getZoom());
1412
+ var extent = this.map.getView().calculateExtent();
1413
+ return { longitude: longitude, latitude: latitude, zoom: zoom, extent: extent };
1414
+ };
1387
1415
  MapStateService.prototype.observeMapRendering = function () {
1388
1416
  var _this = this;
1389
1417
  this.postboy
@@ -1393,10 +1421,7 @@
1393
1421
  var _a;
1394
1422
  _this.map = ev.map;
1395
1423
  (_a = _this.map) === null || _a === void 0 ? void 0 : _a.on('moveend', function () {
1396
- var _a, _b;
1397
- var zoom = Math.floor(((_a = _this.map) === null || _a === void 0 ? void 0 : _a.getView().getZoom()) || -1);
1398
- var extent = ((_b = _this.map) === null || _b === void 0 ? void 0 : _b.getView().calculateExtent()) || [];
1399
- _this.postboy.fire(new MapMoveEndEvent(zoom, extent));
1424
+ _this.postboy.fire(new MapMoveEndEvent(_this.getMapPosition()));
1400
1425
  });
1401
1426
  });
1402
1427
  };
@@ -1745,6 +1770,7 @@
1745
1770
  __extends(MessageRegistratorService, _super);
1746
1771
  function MessageRegistratorService(service, management, state, mapFeature, interaction, drawing, featureModification, controls) {
1747
1772
  var _this = _super.call(this, service) || this;
1773
+ _this.state = state;
1748
1774
  _this.registerServices([management, state, interaction, mapFeature, drawing, featureModification, controls]);
1749
1775
  return _this;
1750
1776
  }
@@ -1774,10 +1800,12 @@
1774
1800
  this.setExecutors();
1775
1801
  };
1776
1802
  MessageRegistratorService.prototype.setExecutors = function () {
1803
+ var _this = this;
1777
1804
  this.registerExecutor(FilterFeaturesInAreaExecutor.ID, function (e) { return FeatureService.filterFeaturesInArea(e); });
1778
1805
  this.registerExecutor(CalculateAreaExecutor.ID, function (e) { var _a, _b; return FeatureService.calculateArea((_b = (_a = e.polygon) === null || _a === void 0 ? void 0 : _a.feature) === null || _b === void 0 ? void 0 : _b.getGeometry()); });
1779
1806
  this.registerExecutor(GenerateDrawExecutor.ID, function (e) { return DrawingGenerationService.getDraw(e); });
1780
1807
  this.registerExecutor(GenerateZoomControlExecutor.ID, function (e) { return ZoomControlFactory.build(e.settings); });
1808
+ this.registerExecutor(GetMapPositionExecutor.ID, function () { return _this.state.getMapPosition(); });
1781
1809
  };
1782
1810
  return MessageRegistratorService;
1783
1811
  }(postboy.PostboyAbstractRegistrator));
@@ -3370,6 +3398,8 @@
3370
3398
  exports.FeatureLayerComponent = FeatureLayerComponent;
3371
3399
  exports.FeatureLayerSettings = FeatureLayerSettings;
3372
3400
  exports.FitToPolygonsCommand = FitToPolygonsCommand;
3401
+ exports.GetFeaturesInAreaQuery = GetFeaturesInAreaQuery;
3402
+ exports.GetMapPositionExecutor = GetMapPositionExecutor;
3373
3403
  exports.MapClickEvent = MapClickEvent;
3374
3404
  exports.MapControl = MapControl;
3375
3405
  exports.MapControlZoomComponent = MapControlZoomComponent;