@artstesh/maps 6.0.5 → 6.0.7
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.
- package/dist/esm2022/map/messages/executors/filter-features-in-point.executor.mjs +20 -0
- package/dist/esm2022/map/messages/index.mjs +4 -1
- package/dist/esm2022/map/messages/queries/get-features-in-point.query.mjs +21 -0
- package/dist/esm2022/map/services/feature.service.mjs +5 -1
- package/dist/esm2022/map/services/map-management.service.mjs +28 -12
- package/dist/esm2022/map/services/message-registrator.service.mjs +5 -2
- package/dist/esm2022/src/map/messages/executors/filter-features-in-point.executor.mjs +20 -0
- package/dist/esm2022/src/map/messages/index.mjs +4 -1
- package/dist/esm2022/src/map/messages/queries/get-features-in-point.query.mjs +21 -0
- package/dist/esm2022/src/map/services/feature.service.mjs +5 -1
- package/dist/esm2022/src/map/services/map-management.service.mjs +28 -12
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +5 -2
- package/dist/fesm2022/maps-components-src-map.mjs +85 -25
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +85 -25
- package/dist/fesm2022/maps-components.mjs.map +1 -1
- package/dist/map/messages/executors/filter-features-in-point.executor.d.ts +14 -0
- package/dist/map/messages/index.d.ts +3 -0
- package/dist/map/messages/queries/get-features-in-point.query.d.ts +15 -0
- package/dist/map/services/feature.service.d.ts +2 -0
- package/dist/map/services/map-management.service.d.ts +2 -0
- package/dist/src/map/messages/executors/filter-features-in-point.executor.d.ts +14 -0
- package/dist/src/map/messages/index.d.ts +3 -0
- package/dist/src/map/messages/queries/get-features-in-point.query.d.ts +15 -0
- package/dist/src/map/services/feature.service.d.ts +2 -0
- package/dist/src/map/services/map-management.service.d.ts +2 -0
- package/package.json +1 -1
|
@@ -433,6 +433,59 @@ class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
class FilterFeaturesInAreaExecutor extends PostboyExecutor {
|
|
437
|
+
area;
|
|
438
|
+
features;
|
|
439
|
+
static ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
|
|
440
|
+
constructor(area, features) {
|
|
441
|
+
super();
|
|
442
|
+
this.area = area;
|
|
443
|
+
this.features = features;
|
|
444
|
+
}
|
|
445
|
+
get id() {
|
|
446
|
+
return FilterFeaturesInAreaExecutor.ID;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Represents a query to retrieve features located at a specific geographical point.
|
|
452
|
+
* The query is defined by latitude, longitude, and an optional set of features to ignore.
|
|
453
|
+
*/
|
|
454
|
+
class GetFeaturesInPointQuery extends PostboyCallbackMessage {
|
|
455
|
+
lat;
|
|
456
|
+
lng;
|
|
457
|
+
ignore;
|
|
458
|
+
static ID = '7c051c97-bbf1-47eb-baa3-4d1eef6f281f';
|
|
459
|
+
constructor(lat, lng, ignore = new Set()) {
|
|
460
|
+
super();
|
|
461
|
+
this.lat = lat;
|
|
462
|
+
this.lng = lng;
|
|
463
|
+
this.ignore = ignore;
|
|
464
|
+
}
|
|
465
|
+
get id() {
|
|
466
|
+
return GetFeaturesInPointQuery.ID;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* The FilterFeaturesInPointExecutor class is responsible for filtering features within a given point.
|
|
472
|
+
*/
|
|
473
|
+
class FilterFeaturesInPointExecutor extends PostboyExecutor {
|
|
474
|
+
lat;
|
|
475
|
+
lng;
|
|
476
|
+
features;
|
|
477
|
+
static ID = '5b859282-5d5a-47ca-a6ad-863a66c8b82b';
|
|
478
|
+
get id() {
|
|
479
|
+
return FilterFeaturesInPointExecutor.ID;
|
|
480
|
+
}
|
|
481
|
+
constructor(lat, lng, features) {
|
|
482
|
+
super();
|
|
483
|
+
this.lat = lat;
|
|
484
|
+
this.lng = lng;
|
|
485
|
+
this.features = features;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
436
489
|
class AddLayerCommand extends PostboyGenericMessage {
|
|
437
490
|
layer;
|
|
438
491
|
static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
@@ -558,6 +611,9 @@ class FeatureService {
|
|
|
558
611
|
static filterFeaturesInArea(query) {
|
|
559
612
|
return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
|
|
560
613
|
}
|
|
614
|
+
static filterFeaturesInPoint(query) {
|
|
615
|
+
return query.features.filter((f) => FeatureService.booleanIntersects(f.getGeometry(), new Point([query.lng, query.lat])));
|
|
616
|
+
}
|
|
561
617
|
static calculateArea(g) {
|
|
562
618
|
if (!g)
|
|
563
619
|
return 0;
|
|
@@ -574,20 +630,6 @@ class FeatureService {
|
|
|
574
630
|
}
|
|
575
631
|
}
|
|
576
632
|
|
|
577
|
-
class FilterFeaturesInAreaExecutor extends PostboyExecutor {
|
|
578
|
-
area;
|
|
579
|
-
features;
|
|
580
|
-
static ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
|
|
581
|
-
constructor(area, features) {
|
|
582
|
-
super();
|
|
583
|
-
this.area = area;
|
|
584
|
-
this.features = features;
|
|
585
|
-
}
|
|
586
|
-
get id() {
|
|
587
|
-
return FilterFeaturesInAreaExecutor.ID;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
633
|
class GenerateDrawExecutor extends PostboyExecutor {
|
|
592
634
|
layer;
|
|
593
635
|
style;
|
|
@@ -656,6 +698,7 @@ class MapManagementService {
|
|
|
656
698
|
this.observeRemoveTile();
|
|
657
699
|
this.observeLayerQuery();
|
|
658
700
|
this.observeFeaturesInArea();
|
|
701
|
+
this.observeFeaturesInPoint();
|
|
659
702
|
}
|
|
660
703
|
observeRemoveTile() {
|
|
661
704
|
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
@@ -709,19 +752,34 @@ class MapManagementService {
|
|
|
709
752
|
observeFeaturesInArea() {
|
|
710
753
|
this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
|
|
711
754
|
let result = new Dictionary();
|
|
712
|
-
this.
|
|
713
|
-
let
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
let source = l.getSource();
|
|
717
|
-
if (!!source['getSource'])
|
|
718
|
-
source = source?.getSource();
|
|
719
|
-
let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
|
|
720
|
-
result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
|
|
721
|
-
});
|
|
755
|
+
this.forEachLayer((l, s) => {
|
|
756
|
+
let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, s?.getFeatures() ?? []));
|
|
757
|
+
result.put(l.get('name'), features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
|
|
758
|
+
}, qr.ignore);
|
|
722
759
|
qr.finish(result);
|
|
723
760
|
});
|
|
724
761
|
}
|
|
762
|
+
observeFeaturesInPoint() {
|
|
763
|
+
this.postboy.subscribe(GetFeaturesInPointQuery.ID).subscribe((qr) => {
|
|
764
|
+
let result = new Dictionary();
|
|
765
|
+
this.forEachLayer((l, s) => {
|
|
766
|
+
let features = this.postboy.execute(new FilterFeaturesInPointExecutor(qr.lat, qr.lng, s?.getFeatures() ?? []));
|
|
767
|
+
result.put(l.get('name'), features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
|
|
768
|
+
}, qr.ignore);
|
|
769
|
+
qr.finish(result);
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
forEachLayer(action, ignore) {
|
|
773
|
+
this.layers.forEach((l) => {
|
|
774
|
+
let layerName = l.get('name');
|
|
775
|
+
if (ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
|
|
776
|
+
return;
|
|
777
|
+
let source = l.getSource();
|
|
778
|
+
if (!!source['getSource'])
|
|
779
|
+
source = source?.getSource();
|
|
780
|
+
action(l, source);
|
|
781
|
+
});
|
|
782
|
+
}
|
|
725
783
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
726
784
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService });
|
|
727
785
|
}
|
|
@@ -1108,10 +1166,12 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1108
1166
|
this.registerSubject(DrawSelectionAreaCommand.ID);
|
|
1109
1167
|
this.registerSubject(CancelFeatureModificationCommand.ID);
|
|
1110
1168
|
this.registerSubject(ModifyFeatureCommand.ID);
|
|
1169
|
+
this.registerSubject(GetFeaturesInPointQuery.ID);
|
|
1111
1170
|
this.setExecutors();
|
|
1112
1171
|
}
|
|
1113
1172
|
setExecutors() {
|
|
1114
1173
|
this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
|
|
1174
|
+
this.registerExecutor(FilterFeaturesInPointExecutor.ID, (e) => FeatureService.filterFeaturesInPoint(e));
|
|
1115
1175
|
this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
|
|
1116
1176
|
this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
|
|
1117
1177
|
this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
|
|
@@ -2590,5 +2650,5 @@ class StringifyFeatureHelper {
|
|
|
2590
2650
|
* Generated bundle index. Do not edit.
|
|
2591
2651
|
*/
|
|
2592
2652
|
|
|
2593
|
-
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 };
|
|
2653
|
+
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 };
|
|
2594
2654
|
//# sourceMappingURL=maps-components.mjs.map
|