@artstesh/maps 4.1.5 → 4.1.6
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/esm2020/map/messages/executors/calculate-area.executor.mjs +12 -0
- package/dist/esm2020/map/messages/index.mjs +2 -1
- package/dist/esm2020/map/services/feature.service.mjs +7 -1
- package/dist/esm2020/map/services/message-registrator.service.mjs +3 -1
- package/dist/esm2020/src/map/messages/executors/calculate-area.executor.mjs +12 -0
- package/dist/esm2020/src/map/messages/index.mjs +2 -1
- package/dist/esm2020/src/map/services/feature.service.mjs +7 -1
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +3 -1
- package/dist/fesm2015/maps-components-src-map.mjs +19 -1
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +19 -1
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +19 -1
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +19 -1
- package/dist/fesm2020/maps-components.mjs.map +1 -1
- package/dist/map/messages/executors/calculate-area.executor.d.ts +10 -0
- package/dist/map/messages/index.d.ts +1 -0
- package/dist/map/services/feature.service.d.ts +1 -0
- package/dist/src/map/messages/executors/calculate-area.executor.d.ts +10 -0
- package/dist/src/map/messages/index.d.ts +1 -0
- package/dist/src/map/services/feature.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ import { get, useGeographic, transform } from 'ol/proj';
|
|
|
11
11
|
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
12
12
|
import { Draw, Modify, Translate } from 'ol/interaction';
|
|
13
13
|
import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
|
|
14
|
+
import * as Sphere from 'ol/sphere';
|
|
14
15
|
import { first, filter, auditTime } from 'rxjs/operators';
|
|
15
16
|
import { Vector, XYZ } from 'ol/source';
|
|
16
17
|
import TileLayer from 'ol/layer/Tile';
|
|
@@ -406,6 +407,17 @@ class SetMapCenterCommand extends PostboyGenericMessage {
|
|
|
406
407
|
}
|
|
407
408
|
SetMapCenterCommand.ID = 'd50e89c9-6707-4f8c-ab57-65fcef232182';
|
|
408
409
|
|
|
410
|
+
class CalculateAreaExecutor extends PostboyExecutor {
|
|
411
|
+
constructor(polygon) {
|
|
412
|
+
super();
|
|
413
|
+
this.polygon = polygon;
|
|
414
|
+
}
|
|
415
|
+
get id() {
|
|
416
|
+
return CalculateAreaExecutor.ID;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
CalculateAreaExecutor.ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
|
|
420
|
+
|
|
409
421
|
class AddLayerCommand extends PostboyGenericMessage {
|
|
410
422
|
constructor(layer) {
|
|
411
423
|
super();
|
|
@@ -531,6 +543,11 @@ class FeatureService {
|
|
|
531
543
|
return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
|
|
532
544
|
return false;
|
|
533
545
|
}
|
|
546
|
+
static calculateArea(g) {
|
|
547
|
+
if (!g)
|
|
548
|
+
return 0;
|
|
549
|
+
return Sphere.getArea(g, { projection: 'EPSG:4326' });
|
|
550
|
+
}
|
|
534
551
|
}
|
|
535
552
|
|
|
536
553
|
class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
|
|
@@ -1037,6 +1054,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1037
1054
|
}
|
|
1038
1055
|
setExecutors() {
|
|
1039
1056
|
this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
|
|
1057
|
+
this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
|
|
1040
1058
|
this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
|
|
1041
1059
|
this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
|
|
1042
1060
|
}
|
|
@@ -2095,5 +2113,5 @@ class StringifyFeatureHelper {
|
|
|
2095
2113
|
* Generated bundle index. Do not edit.
|
|
2096
2114
|
*/
|
|
2097
2115
|
|
|
2098
|
-
export { AddControlCommand, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, 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 };
|
|
2116
|
+
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, 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 };
|
|
2099
2117
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|