@artstesh/maps 1.1.12 → 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 +85 -11
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +85 -11
  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 +3 -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 +3 -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 +68 -12
  18. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  19. package/dist/fesm2015/maps-components.js +68 -12
  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 +2 -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 +2 -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
@@ -414,6 +414,39 @@ class FilterFeaturesInAreaExecutor extends PostboyExecutor {
414
414
  }
415
415
  FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
416
416
 
417
+ /**
418
+ * Represents a query to retrieve features located at a specific geographical point.
419
+ * The query is defined by latitude, longitude, and an optional set of features to ignore.
420
+ */
421
+ class GetFeaturesInPointQuery extends PostboyCallbackMessage {
422
+ constructor(lat, lng, ignore = new Set()) {
423
+ super();
424
+ this.lat = lat;
425
+ this.lng = lng;
426
+ this.ignore = ignore;
427
+ }
428
+ get id() {
429
+ return GetFeaturesInPointQuery.ID;
430
+ }
431
+ }
432
+ GetFeaturesInPointQuery.ID = '7c051c97-bbf1-47eb-baa3-4d1eef6f281f';
433
+
434
+ /**
435
+ * The FilterFeaturesInPointExecutor class is responsible for filtering features within a given point.
436
+ */
437
+ class FilterFeaturesInPointExecutor extends PostboyExecutor {
438
+ constructor(lat, lng, features) {
439
+ super();
440
+ this.lat = lat;
441
+ this.lng = lng;
442
+ this.features = features;
443
+ }
444
+ get id() {
445
+ return FilterFeaturesInPointExecutor.ID;
446
+ }
447
+ }
448
+ FilterFeaturesInPointExecutor.ID = '5b859282-5d5a-47ca-a6ad-863a66c8b82b';
449
+
417
450
  class AddLayerCommand extends PostboyGenericMessage {
418
451
  constructor(layer) {
419
452
  super();
@@ -530,6 +563,9 @@ class FeatureService {
530
563
  static filterFeaturesInArea(query) {
531
564
  return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
532
565
  }
566
+ static filterFeaturesInPoint(query) {
567
+ return query.features.filter((f) => FeatureService.booleanIntersects(f.getGeometry(), new Point([query.lng, query.lat])));
568
+ }
533
569
  static calculateArea(g) {
534
570
  if (!g)
535
571
  return 0;
@@ -608,6 +644,7 @@ class MapManagementService {
608
644
  this.observeRemoveTile();
609
645
  this.observeLayerQuery();
610
646
  this.observeFeaturesInArea();
647
+ this.observeFeaturesInPoint();
611
648
  }
612
649
  observeRemoveTile() {
613
650
  this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
@@ -662,20 +699,37 @@ class MapManagementService {
662
699
  observeFeaturesInArea() {
663
700
  this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
664
701
  let result = new Dictionary();
665
- this.layers.forEach((l) => {
666
- var _a, _b;
667
- let layerName = l.get('name');
668
- if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
669
- return;
670
- let source = l.getSource();
671
- if (!!source['getSource'])
672
- source = (_a = source) === null || _a === void 0 ? void 0 : _a.getSource();
673
- let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, (_b = source === null || source === void 0 ? void 0 : source.getFeatures()) !== null && _b !== void 0 ? _b : []));
674
- result.put(layerName, features.map((e) => (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo)))));
675
- });
702
+ this.forEachLayer((l, s) => {
703
+ var _a;
704
+ let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, (_a = s === null || s === void 0 ? void 0 : s.getFeatures()) !== null && _a !== void 0 ? _a : []));
705
+ result.put(l.get('name'), features.map((e) => (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo)))));
706
+ }, qr.ignore);
676
707
  qr.finish(result);
677
708
  });
678
709
  }
710
+ observeFeaturesInPoint() {
711
+ this.postboy.subscribe(GetFeaturesInPointQuery.ID).subscribe((qr) => {
712
+ let result = new Dictionary();
713
+ this.forEachLayer((l, s) => {
714
+ var _a;
715
+ let 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 : []));
716
+ result.put(l.get('name'), features.map((e) => (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo)))));
717
+ }, qr.ignore);
718
+ qr.finish(result);
719
+ });
720
+ }
721
+ forEachLayer(action, ignore) {
722
+ this.layers.forEach((l) => {
723
+ var _a;
724
+ let layerName = l.get('name');
725
+ if (ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
726
+ return;
727
+ let source = l.getSource();
728
+ if (!!source['getSource'])
729
+ source = (_a = source) === null || _a === void 0 ? void 0 : _a.getSource();
730
+ action(l, source);
731
+ });
732
+ }
679
733
  }
680
734
  MapManagementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
681
735
  MapManagementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapManagementService });
@@ -1056,10 +1110,12 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1056
1110
  this.registerSubject(DrawSelectionAreaCommand.ID);
1057
1111
  this.registerSubject(CancelFeatureModificationCommand.ID);
1058
1112
  this.registerSubject(ModifyFeatureCommand.ID);
1113
+ this.registerSubject(GetFeaturesInPointQuery.ID);
1059
1114
  this.setExecutors();
1060
1115
  }
1061
1116
  setExecutors() {
1062
1117
  this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
1118
+ this.registerExecutor(FilterFeaturesInPointExecutor.ID, (e) => FeatureService.filterFeaturesInPoint(e));
1063
1119
  this.registerExecutor(CalculateAreaExecutor.ID, (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()); });
1064
1120
  this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
1065
1121
  this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
@@ -2566,5 +2622,5 @@ class StringifyFeatureHelper {
2566
2622
  * Generated bundle index. Do not edit.
2567
2623
  */
2568
2624
 
2569
- export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetMapPositionExecutor, MapClickEvent, MapControl, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
2625
+ export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, MapClickEvent, MapControl, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
2570
2626
  //# sourceMappingURL=maps-components.js.map