@artstesh/maps 4.1.12 → 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 +4 -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 +4 -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 +78 -23
  14. package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
  15. package/dist/fesm2015/maps-components.mjs +78 -23
  16. package/dist/fesm2015/maps-components.mjs.map +1 -1
  17. package/dist/fesm2020/maps-components-src-map.mjs +77 -23
  18. package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
  19. package/dist/fesm2020/maps-components.mjs +77 -23
  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 +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
@@ -401,6 +401,51 @@ class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
401
401
  }
402
402
  GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
403
403
 
404
+ class FilterFeaturesInAreaExecutor extends PostboyExecutor {
405
+ constructor(area, features) {
406
+ super();
407
+ this.area = area;
408
+ this.features = features;
409
+ }
410
+ get id() {
411
+ return FilterFeaturesInAreaExecutor.ID;
412
+ }
413
+ }
414
+ FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
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
+
404
449
  class AddLayerCommand extends PostboyGenericMessage {
405
450
  constructor(layer) {
406
451
  super();
@@ -517,6 +562,9 @@ class FeatureService {
517
562
  static filterFeaturesInArea(query) {
518
563
  return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
519
564
  }
565
+ static filterFeaturesInPoint(query) {
566
+ return query.features.filter((f) => FeatureService.booleanIntersects(f.getGeometry(), new Point([query.lng, query.lat])));
567
+ }
520
568
  static calculateArea(g) {
521
569
  if (!g)
522
570
  return 0;
@@ -533,18 +581,6 @@ class FeatureService {
533
581
  }
534
582
  }
535
583
 
536
- class FilterFeaturesInAreaExecutor extends PostboyExecutor {
537
- constructor(area, features) {
538
- super();
539
- this.area = area;
540
- this.features = features;
541
- }
542
- get id() {
543
- return FilterFeaturesInAreaExecutor.ID;
544
- }
545
- }
546
- FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
547
-
548
584
  class GenerateDrawExecutor extends PostboyExecutor {
549
585
  constructor(layer, style, type) {
550
586
  super();
@@ -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);
704
+ qr.finish(result);
705
+ });
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);
673
714
  qr.finish(result);
674
715
  });
675
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, 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