@artstesh/maps 4.1.13 → 4.1.14

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/esm2020/map/messages/executors/filter-features-in-point.executor.mjs +17 -0
  2. package/dist/esm2020/map/messages/index.mjs +3 -1
  3. package/dist/esm2020/map/messages/queries/get-features-in-point.query.mjs +18 -0
  4. package/dist/esm2020/map/services/feature.service.mjs +5 -1
  5. package/dist/esm2020/map/services/map-management.service.mjs +28 -12
  6. package/dist/esm2020/map/services/message-registrator.service.mjs +5 -2
  7. package/dist/esm2020/src/map/messages/executors/filter-features-in-point.executor.mjs +17 -0
  8. package/dist/esm2020/src/map/messages/index.mjs +3 -1
  9. package/dist/esm2020/src/map/messages/queries/get-features-in-point.query.mjs +18 -0
  10. package/dist/esm2020/src/map/services/feature.service.mjs +5 -1
  11. package/dist/esm2020/src/map/services/map-management.service.mjs +28 -12
  12. package/dist/esm2020/src/map/services/message-registrator.service.mjs +5 -2
  13. package/dist/fesm2015/maps-components-src-map.mjs +66 -11
  14. package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
  15. package/dist/fesm2015/maps-components.mjs +66 -11
  16. package/dist/fesm2015/maps-components.mjs.map +1 -1
  17. package/dist/fesm2020/maps-components-src-map.mjs +65 -11
  18. package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
  19. package/dist/fesm2020/maps-components.mjs +65 -11
  20. package/dist/fesm2020/maps-components.mjs.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
@@ -413,6 +413,39 @@ class FilterFeaturesInAreaExecutor extends PostboyExecutor {
413
413
  }
414
414
  FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
415
415
 
416
+ /**
417
+ * Represents a query to retrieve features located at a specific geographical point.
418
+ * The query is defined by latitude, longitude, and an optional set of features to ignore.
419
+ */
420
+ class GetFeaturesInPointQuery extends PostboyCallbackMessage {
421
+ constructor(lat, lng, ignore = new Set()) {
422
+ super();
423
+ this.lat = lat;
424
+ this.lng = lng;
425
+ this.ignore = ignore;
426
+ }
427
+ get id() {
428
+ return GetFeaturesInPointQuery.ID;
429
+ }
430
+ }
431
+ GetFeaturesInPointQuery.ID = '7c051c97-bbf1-47eb-baa3-4d1eef6f281f';
432
+
433
+ /**
434
+ * The FilterFeaturesInPointExecutor class is responsible for filtering features within a given point.
435
+ */
436
+ class FilterFeaturesInPointExecutor extends PostboyExecutor {
437
+ get id() {
438
+ return FilterFeaturesInPointExecutor.ID;
439
+ }
440
+ constructor(lat, lng, features) {
441
+ super();
442
+ this.lat = lat;
443
+ this.lng = lng;
444
+ this.features = features;
445
+ }
446
+ }
447
+ FilterFeaturesInPointExecutor.ID = '5b859282-5d5a-47ca-a6ad-863a66c8b82b';
448
+
416
449
  class AddLayerCommand extends PostboyGenericMessage {
417
450
  constructor(layer) {
418
451
  super();
@@ -529,6 +562,9 @@ class FeatureService {
529
562
  static filterFeaturesInArea(query) {
530
563
  return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
531
564
  }
565
+ static filterFeaturesInPoint(query) {
566
+ return query.features.filter((f) => FeatureService.booleanIntersects(f.getGeometry(), new Point([query.lng, query.lat])));
567
+ }
532
568
  static calculateArea(g) {
533
569
  if (!g)
534
570
  return 0;
@@ -607,6 +643,7 @@ class MapManagementService {
607
643
  this.observeRemoveTile();
608
644
  this.observeLayerQuery();
609
645
  this.observeFeaturesInArea();
646
+ this.observeFeaturesInPoint();
610
647
  }
611
648
  observeRemoveTile() {
612
649
  this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
@@ -660,19 +697,34 @@ class MapManagementService {
660
697
  observeFeaturesInArea() {
661
698
  this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
662
699
  let result = new Dictionary();
663
- this.layers.forEach((l) => {
664
- let layerName = l.get('name');
665
- if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
666
- return;
667
- let source = l.getSource();
668
- if (!!source['getSource'])
669
- source = source?.getSource();
670
- let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
671
- result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
672
- });
700
+ this.forEachLayer((l, s) => {
701
+ let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, s?.getFeatures() ?? []));
702
+ result.put(l.get('name'), features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
703
+ }, qr.ignore);
673
704
  qr.finish(result);
674
705
  });
675
706
  }
707
+ observeFeaturesInPoint() {
708
+ this.postboy.subscribe(GetFeaturesInPointQuery.ID).subscribe((qr) => {
709
+ let result = new Dictionary();
710
+ this.forEachLayer((l, s) => {
711
+ let features = this.postboy.execute(new FilterFeaturesInPointExecutor(qr.lat, qr.lng, s?.getFeatures() ?? []));
712
+ result.put(l.get('name'), features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
713
+ }, qr.ignore);
714
+ qr.finish(result);
715
+ });
716
+ }
717
+ forEachLayer(action, ignore) {
718
+ this.layers.forEach((l) => {
719
+ let layerName = l.get('name');
720
+ if (ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
721
+ return;
722
+ let source = l.getSource();
723
+ if (!!source['getSource'])
724
+ source = source?.getSource();
725
+ action(l, source);
726
+ });
727
+ }
676
728
  }
677
729
  MapManagementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
678
730
  MapManagementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapManagementService });
@@ -1042,10 +1094,12 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1042
1094
  this.registerSubject(DrawSelectionAreaCommand.ID);
1043
1095
  this.registerSubject(CancelFeatureModificationCommand.ID);
1044
1096
  this.registerSubject(ModifyFeatureCommand.ID);
1097
+ this.registerSubject(GetFeaturesInPointQuery.ID);
1045
1098
  this.setExecutors();
1046
1099
  }
1047
1100
  setExecutors() {
1048
1101
  this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
1102
+ this.registerExecutor(FilterFeaturesInPointExecutor.ID, (e) => FeatureService.filterFeaturesInPoint(e));
1049
1103
  this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
1050
1104
  this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
1051
1105
  this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
@@ -2494,5 +2548,5 @@ class StringifyFeatureHelper {
2494
2548
  * Generated bundle index. Do not edit.
2495
2549
  */
2496
2550
 
2497
- 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 };
2551
+ 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 };
2498
2552
  //# sourceMappingURL=maps-components-src-map.mjs.map