@artstesh/maps 1.1.11 → 1.1.13

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 (31) hide show
  1. package/dist/bundles/maps-components-src-map.umd.js +105 -30
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +105 -30
  4. package/dist/bundles/maps-components.umd.js.map +1 -1
  5. package/dist/esm2015/map/messages/executors/filter-features-in-point.executor.js +17 -0
  6. package/dist/esm2015/map/messages/index.js +4 -1
  7. package/dist/esm2015/map/messages/queries/get-features-in-point.query.js +18 -0
  8. package/dist/esm2015/map/services/feature.service.js +5 -1
  9. package/dist/esm2015/map/services/map-management.service.js +31 -13
  10. package/dist/esm2015/map/services/message-registrator.service.js +5 -2
  11. package/dist/esm2015/src/map/messages/executors/filter-features-in-point.executor.js +17 -0
  12. package/dist/esm2015/src/map/messages/index.js +4 -1
  13. package/dist/esm2015/src/map/messages/queries/get-features-in-point.query.js +18 -0
  14. package/dist/esm2015/src/map/services/feature.service.js +5 -1
  15. package/dist/esm2015/src/map/services/map-management.service.js +31 -13
  16. package/dist/esm2015/src/map/services/message-registrator.service.js +5 -2
  17. package/dist/fesm2015/maps-components-src-map.js +80 -24
  18. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  19. package/dist/fesm2015/maps-components.js +80 -24
  20. package/dist/fesm2015/maps-components.js.map +1 -1
  21. package/dist/map/messages/executors/filter-features-in-point.executor.d.ts +14 -0
  22. package/dist/map/messages/index.d.ts +3 -0
  23. package/dist/map/messages/queries/get-features-in-point.query.d.ts +15 -0
  24. package/dist/map/services/feature.service.d.ts +2 -0
  25. package/dist/map/services/map-management.service.d.ts +2 -0
  26. package/dist/src/map/messages/executors/filter-features-in-point.executor.d.ts +14 -0
  27. package/dist/src/map/messages/index.d.ts +3 -0
  28. package/dist/src/map/messages/queries/get-features-in-point.query.d.ts +15 -0
  29. package/dist/src/map/services/feature.service.d.ts +2 -0
  30. package/dist/src/map/services/map-management.service.d.ts +2 -0
  31. package/package.json +1 -1
@@ -1018,6 +1018,73 @@
1018
1018
  }(postboy.PostboyCallbackMessage));
1019
1019
  GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
1020
1020
 
1021
+ var FilterFeaturesInAreaExecutor = /** @class */ (function (_super) {
1022
+ __extends(FilterFeaturesInAreaExecutor, _super);
1023
+ function FilterFeaturesInAreaExecutor(area, features) {
1024
+ var _this = _super.call(this) || this;
1025
+ _this.area = area;
1026
+ _this.features = features;
1027
+ return _this;
1028
+ }
1029
+ Object.defineProperty(FilterFeaturesInAreaExecutor.prototype, "id", {
1030
+ get: function () {
1031
+ return FilterFeaturesInAreaExecutor.ID;
1032
+ },
1033
+ enumerable: false,
1034
+ configurable: true
1035
+ });
1036
+ return FilterFeaturesInAreaExecutor;
1037
+ }(postboy.PostboyExecutor));
1038
+ FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
1039
+
1040
+ /**
1041
+ * Represents a query to retrieve features located at a specific geographical point.
1042
+ * The query is defined by latitude, longitude, and an optional set of features to ignore.
1043
+ */
1044
+ var GetFeaturesInPointQuery = /** @class */ (function (_super) {
1045
+ __extends(GetFeaturesInPointQuery, _super);
1046
+ function GetFeaturesInPointQuery(lat, lng, ignore) {
1047
+ if (ignore === void 0) { ignore = new Set(); }
1048
+ var _this = _super.call(this) || this;
1049
+ _this.lat = lat;
1050
+ _this.lng = lng;
1051
+ _this.ignore = ignore;
1052
+ return _this;
1053
+ }
1054
+ Object.defineProperty(GetFeaturesInPointQuery.prototype, "id", {
1055
+ get: function () {
1056
+ return GetFeaturesInPointQuery.ID;
1057
+ },
1058
+ enumerable: false,
1059
+ configurable: true
1060
+ });
1061
+ return GetFeaturesInPointQuery;
1062
+ }(postboy.PostboyCallbackMessage));
1063
+ GetFeaturesInPointQuery.ID = '7c051c97-bbf1-47eb-baa3-4d1eef6f281f';
1064
+
1065
+ /**
1066
+ * The FilterFeaturesInPointExecutor class is responsible for filtering features within a given point.
1067
+ */
1068
+ var FilterFeaturesInPointExecutor = /** @class */ (function (_super) {
1069
+ __extends(FilterFeaturesInPointExecutor, _super);
1070
+ function FilterFeaturesInPointExecutor(lat, lng, features) {
1071
+ var _this = _super.call(this) || this;
1072
+ _this.lat = lat;
1073
+ _this.lng = lng;
1074
+ _this.features = features;
1075
+ return _this;
1076
+ }
1077
+ Object.defineProperty(FilterFeaturesInPointExecutor.prototype, "id", {
1078
+ get: function () {
1079
+ return FilterFeaturesInPointExecutor.ID;
1080
+ },
1081
+ enumerable: false,
1082
+ configurable: true
1083
+ });
1084
+ return FilterFeaturesInPointExecutor;
1085
+ }(postboy.PostboyExecutor));
1086
+ FilterFeaturesInPointExecutor.ID = '5b859282-5d5a-47ca-a6ad-863a66c8b82b';
1087
+
1021
1088
  var AddLayerCommand = /** @class */ (function (_super) {
1022
1089
  __extends(AddLayerCommand, _super);
1023
1090
  function AddLayerCommand(layer) {
@@ -1194,6 +1261,9 @@
1194
1261
  FeatureService.filterFeaturesInArea = function (query) {
1195
1262
  return query.features.filter(function (f) { return FeatureService.booleanIntersects(query.area, f.getGeometry()); });
1196
1263
  };
1264
+ FeatureService.filterFeaturesInPoint = function (query) {
1265
+ return query.features.filter(function (f) { return FeatureService.booleanIntersects(f.getGeometry(), new geom.Point([query.lng, query.lat])); });
1266
+ };
1197
1267
  FeatureService.calculateArea = function (g) {
1198
1268
  if (!g)
1199
1269
  return 0;
@@ -1211,25 +1281,6 @@
1211
1281
  return FeatureService;
1212
1282
  }());
1213
1283
 
1214
- var FilterFeaturesInAreaExecutor = /** @class */ (function (_super) {
1215
- __extends(FilterFeaturesInAreaExecutor, _super);
1216
- function FilterFeaturesInAreaExecutor(area, features) {
1217
- var _this = _super.call(this) || this;
1218
- _this.area = area;
1219
- _this.features = features;
1220
- return _this;
1221
- }
1222
- Object.defineProperty(FilterFeaturesInAreaExecutor.prototype, "id", {
1223
- get: function () {
1224
- return FilterFeaturesInAreaExecutor.ID;
1225
- },
1226
- enumerable: false,
1227
- configurable: true
1228
- });
1229
- return FilterFeaturesInAreaExecutor;
1230
- }(postboy.PostboyExecutor));
1231
- FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
1232
-
1233
1284
  var GenerateDrawExecutor = /** @class */ (function (_super) {
1234
1285
  __extends(GenerateDrawExecutor, _super);
1235
1286
  function GenerateDrawExecutor(layer, style, type) {
@@ -1312,6 +1363,7 @@
1312
1363
  this.observeRemoveTile();
1313
1364
  this.observeLayerQuery();
1314
1365
  this.observeFeaturesInArea();
1366
+ this.observeFeaturesInPoint();
1315
1367
  };
1316
1368
  MapManagementService.prototype.observeRemoveTile = function () {
1317
1369
  var _this = this;
@@ -1374,20 +1426,38 @@
1374
1426
  var _this = this;
1375
1427
  this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe(function (qr) {
1376
1428
  var result = new collections.Dictionary();
1377
- _this.layers.forEach(function (l) {
1378
- var _a, _b;
1379
- var layerName = l.get('name');
1380
- if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
1381
- return;
1382
- var source = l.getSource();
1383
- if (!!source['getSource'])
1384
- source = (_a = source) === null || _a === void 0 ? void 0 : _a.getSource();
1385
- var features = _this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, (_b = source === null || source === void 0 ? void 0 : source.getFeatures()) !== null && _b !== void 0 ? _b : []));
1386
- result.put(layerName, features.map(function (e) { return (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo))); }));
1387
- });
1429
+ _this.forEachLayer(function (l, s) {
1430
+ var _a;
1431
+ var features = _this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, (_a = s === null || s === void 0 ? void 0 : s.getFeatures()) !== null && _a !== void 0 ? _a : []));
1432
+ result.put(l.get('name'), features.map(function (e) { return (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo))); }));
1433
+ }, qr.ignore);
1388
1434
  qr.finish(result);
1389
1435
  });
1390
1436
  };
1437
+ MapManagementService.prototype.observeFeaturesInPoint = function () {
1438
+ var _this = this;
1439
+ this.postboy.subscribe(GetFeaturesInPointQuery.ID).subscribe(function (qr) {
1440
+ var result = new collections.Dictionary();
1441
+ _this.forEachLayer(function (l, s) {
1442
+ var _a;
1443
+ var features = _this.postboy.execute(new FilterFeaturesInPointExecutor(qr.lat, qr.lng, (_a = s === null || s === void 0 ? void 0 : s.getFeatures()) !== null && _a !== void 0 ? _a : []));
1444
+ result.put(l.get('name'), features.map(function (e) { return (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo))); }));
1445
+ }, qr.ignore);
1446
+ qr.finish(result);
1447
+ });
1448
+ };
1449
+ MapManagementService.prototype.forEachLayer = function (action, ignore) {
1450
+ this.layers.forEach(function (l) {
1451
+ var _a;
1452
+ var layerName = l.get('name');
1453
+ if (ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
1454
+ return;
1455
+ var source = l.getSource();
1456
+ if (!!source['getSource'])
1457
+ source = (_a = source) === null || _a === void 0 ? void 0 : _a.getSource();
1458
+ action(l, source);
1459
+ });
1460
+ };
1391
1461
  return MapManagementService;
1392
1462
  }());
1393
1463
  MapManagementService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
@@ -1797,11 +1867,13 @@
1797
1867
  this.registerSubject(DrawSelectionAreaCommand.ID);
1798
1868
  this.registerSubject(CancelFeatureModificationCommand.ID);
1799
1869
  this.registerSubject(ModifyFeatureCommand.ID);
1870
+ this.registerSubject(GetFeaturesInPointQuery.ID);
1800
1871
  this.setExecutors();
1801
1872
  };
1802
1873
  MessageRegistratorService.prototype.setExecutors = function () {
1803
1874
  var _this = this;
1804
1875
  this.registerExecutor(FilterFeaturesInAreaExecutor.ID, function (e) { return FeatureService.filterFeaturesInArea(e); });
1876
+ this.registerExecutor(FilterFeaturesInPointExecutor.ID, function (e) { return FeatureService.filterFeaturesInPoint(e); });
1805
1877
  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()); });
1806
1878
  this.registerExecutor(GenerateDrawExecutor.ID, function (e) { return DrawingGenerationService.getDraw(e); });
1807
1879
  this.registerExecutor(GenerateZoomControlExecutor.ID, function (e) { return ZoomControlFactory.build(e.settings); });
@@ -3439,8 +3511,11 @@
3439
3511
  exports.DrawSelectionAreaCommand = DrawSelectionAreaCommand;
3440
3512
  exports.FeatureLayerComponent = FeatureLayerComponent;
3441
3513
  exports.FeatureLayerSettings = FeatureLayerSettings;
3514
+ exports.FilterFeaturesInAreaExecutor = FilterFeaturesInAreaExecutor;
3515
+ exports.FilterFeaturesInPointExecutor = FilterFeaturesInPointExecutor;
3442
3516
  exports.FitToPolygonsCommand = FitToPolygonsCommand;
3443
3517
  exports.GetFeaturesInAreaQuery = GetFeaturesInAreaQuery;
3518
+ exports.GetFeaturesInPointQuery = GetFeaturesInPointQuery;
3444
3519
  exports.GetMapPositionExecutor = GetMapPositionExecutor;
3445
3520
  exports.MapClickEvent = MapClickEvent;
3446
3521
  exports.MapControl = MapControl;