@artstesh/maps 4.1.22 → 4.1.24
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/map-plate/features/polygons/polygons.component.mjs +6 -2
- package/dist/esm2020/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +13 -1
- package/dist/esm2020/map/map-plate/map-plate.component.mjs +5 -1
- package/dist/esm2020/map/messages/events/map-feature-hovered.event.mjs +21 -0
- package/dist/esm2020/map/messages/events/map-pointer-move.event.mjs +20 -0
- package/dist/esm2020/map/messages/index.mjs +3 -1
- package/dist/esm2020/map/models/feature-format.enum.mjs +2 -1
- package/dist/esm2020/map/models/map.constants.mjs +2 -1
- package/dist/esm2020/map/services/drawing/drawing.service.mjs +4 -2
- package/dist/esm2020/map/services/drawing/feature-modification.service.mjs +4 -2
- package/dist/esm2020/map/services/map-feature.service.mjs +22 -2
- package/dist/esm2020/map/services/message-registrator.service.mjs +7 -2
- package/dist/esm2020/src/map/map-plate/features/polygons/polygons.component.mjs +6 -2
- package/dist/esm2020/src/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +13 -1
- package/dist/esm2020/src/map/map-plate/map-plate.component.mjs +5 -1
- package/dist/esm2020/src/map/messages/events/map-feature-hovered.event.mjs +21 -0
- package/dist/esm2020/src/map/messages/events/map-pointer-move.event.mjs +20 -0
- package/dist/esm2020/src/map/messages/index.mjs +3 -1
- package/dist/esm2020/src/map/models/feature-format.enum.mjs +2 -1
- package/dist/esm2020/src/map/models/map.constants.mjs +2 -1
- package/dist/esm2020/src/map/services/drawing/drawing.service.mjs +4 -2
- package/dist/esm2020/src/map/services/drawing/feature-modification.service.mjs +4 -2
- package/dist/esm2020/src/map/services/map-feature.service.mjs +22 -2
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +7 -2
- package/dist/fesm2015/maps-components-src-map.mjs +89 -7
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +89 -7
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +89 -7
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +89 -7
- package/dist/fesm2020/maps-components.mjs.map +1 -1
- package/dist/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +22 -0
- package/dist/map/messages/events/map-feature-hovered.event.d.ts +19 -0
- package/dist/map/messages/events/map-pointer-move.event.d.ts +17 -0
- package/dist/map/messages/index.d.ts +2 -0
- package/dist/map/models/feature-format.enum.d.ts +2 -1
- package/dist/map/models/map.constants.d.ts +1 -0
- package/dist/map/services/map-feature.service.d.ts +1 -0
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +22 -0
- package/dist/src/map/messages/events/map-feature-hovered.event.d.ts +19 -0
- package/dist/src/map/messages/events/map-pointer-move.event.d.ts +17 -0
- package/dist/src/map/messages/index.d.ts +2 -0
- package/dist/src/map/models/feature-format.enum.d.ts +2 -1
- package/dist/src/map/models/map.constants.d.ts +1 -0
- package/dist/src/map/services/map-feature.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -13,15 +13,15 @@ import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, Postboy
|
|
|
13
13
|
import { Draw, Modify, Translate, defaults } from 'ol/interaction';
|
|
14
14
|
import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
|
|
15
15
|
import * as Sphere from 'ol/sphere';
|
|
16
|
+
import { Subject, combineLatest } from 'rxjs';
|
|
17
|
+
import { first, debounceTime, filter, auditTime } from 'rxjs/operators';
|
|
16
18
|
import { Dictionary } from '@artstesh/collections';
|
|
17
|
-
import { first, filter, auditTime } from 'rxjs/operators';
|
|
18
19
|
import { Vector, XYZ } from 'ol/source';
|
|
19
20
|
import TileLayer from 'ol/layer/Tile';
|
|
20
21
|
import OSM from 'ol/source/OSM';
|
|
21
22
|
import { Vector as Vector$1 } from 'ol/layer';
|
|
22
23
|
import { bbox } from 'ol/loadingstrategy';
|
|
23
24
|
import Cluster from 'ol/source/Cluster';
|
|
24
|
-
import { combineLatest } from 'rxjs';
|
|
25
25
|
import Map from 'ol/Map';
|
|
26
26
|
import View from 'ol/View';
|
|
27
27
|
import Overlay from 'ol/Overlay';
|
|
@@ -194,7 +194,8 @@ IdGenerator.collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
|
194
194
|
class MapConstants {
|
|
195
195
|
}
|
|
196
196
|
MapConstants.FeatureInfo = 'f-info';
|
|
197
|
-
MapConstants.DrawingLayerId = '93a981756ec7';
|
|
197
|
+
MapConstants.DrawingLayerId = '93a981756ec7';
|
|
198
|
+
MapConstants.FeatureLayerName = 'L-253';
|
|
198
199
|
|
|
199
200
|
class MarkerModel {
|
|
200
201
|
constructor(lat, lng, id, info) {
|
|
@@ -278,6 +279,7 @@ var FeatureOutputFormat;
|
|
|
278
279
|
(function (FeatureOutputFormat) {
|
|
279
280
|
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
280
281
|
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
282
|
+
FeatureOutputFormat[FeatureOutputFormat["Geometry"] = 3] = "Geometry";
|
|
281
283
|
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
282
284
|
|
|
283
285
|
/**
|
|
@@ -517,6 +519,45 @@ class MapMoveEndEvent extends PostboyGenericMessage {
|
|
|
517
519
|
}
|
|
518
520
|
MapMoveEndEvent.ID = 'd210ec7e-032f-4ce8-8a39-7b816519eaae';
|
|
519
521
|
|
|
522
|
+
/**
|
|
523
|
+
* Represents an event that is triggered when the pointer moves on a map.
|
|
524
|
+
* This class extends PostboyGenericMessage.
|
|
525
|
+
*
|
|
526
|
+
* It contains information about the coordinates of the pointer when the event occurs.
|
|
527
|
+
*/
|
|
528
|
+
class MapPointerMoveEvent extends PostboyGenericMessage {
|
|
529
|
+
/**
|
|
530
|
+
* Constructor for initializing an instance with a given point.
|
|
531
|
+
*
|
|
532
|
+
* @param {Array<number>} point - An array representing the coordinates of the point.
|
|
533
|
+
*/
|
|
534
|
+
constructor(point) {
|
|
535
|
+
super();
|
|
536
|
+
this.point = point;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
MapPointerMoveEvent.ID = '193cb41d-2489-45cc-b349-59c3ec18ed72';
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Represents an event triggered when a map feature is hovered over.
|
|
543
|
+
* This event contains information about the hovered feature and its associated layer.
|
|
544
|
+
* Extends the PostboyGenericMessage class.
|
|
545
|
+
*/
|
|
546
|
+
class MapFeatureHoveredEvent extends PostboyGenericMessage {
|
|
547
|
+
/**
|
|
548
|
+
* Constructs an instance of the class.
|
|
549
|
+
*
|
|
550
|
+
* @param {Feature|null} feature - The feature associated with this instance. Can be null.
|
|
551
|
+
* @param {string|null} layer - The layer associated with this instance. Can be null.
|
|
552
|
+
*/
|
|
553
|
+
constructor(feature, layer) {
|
|
554
|
+
super();
|
|
555
|
+
this.feature = feature;
|
|
556
|
+
this.layer = layer;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
MapFeatureHoveredEvent.ID = 'eb9b032a-1616-4823-a628-0fd8ffc3b57a';
|
|
560
|
+
|
|
520
561
|
/**
|
|
521
562
|
* A class responsible for executing filtering of geographical features
|
|
522
563
|
* based on a specific geographical point (latitude and longitude).
|
|
@@ -931,6 +972,7 @@ class MapFeatureService {
|
|
|
931
972
|
this.observeMapRender();
|
|
932
973
|
this.observeFitToFeatures();
|
|
933
974
|
this.observeFitToPolygons();
|
|
975
|
+
this.observePointerMove();
|
|
934
976
|
}
|
|
935
977
|
observeMapRender() {
|
|
936
978
|
this.postboy.sub(MapRenderedEvent).subscribe((m) => {
|
|
@@ -939,6 +981,22 @@ class MapFeatureService {
|
|
|
939
981
|
this.postboy.fire(this.fitPolygonsWaiting);
|
|
940
982
|
});
|
|
941
983
|
}
|
|
984
|
+
observePointerMove() {
|
|
985
|
+
this.postboy.sub(MapPointerMoveEvent).subscribe((ev) => {
|
|
986
|
+
if (!this.map)
|
|
987
|
+
return;
|
|
988
|
+
let featureFound = false;
|
|
989
|
+
this.map.forEachFeatureAtPixel(ev.point, (f) => {
|
|
990
|
+
if (f instanceof Feature) {
|
|
991
|
+
this.postboy.fire(new MapFeatureHoveredEvent(f, f.get(MapConstants.FeatureLayerName)));
|
|
992
|
+
featureFound = true;
|
|
993
|
+
}
|
|
994
|
+
return true;
|
|
995
|
+
});
|
|
996
|
+
if (!featureFound)
|
|
997
|
+
this.postboy.fire(new MapFeatureHoveredEvent(null, null));
|
|
998
|
+
});
|
|
999
|
+
}
|
|
942
1000
|
observeFitToFeatures() {
|
|
943
1001
|
this.postboy.sub(FitToFeaturesCommand).subscribe((cmd) => {
|
|
944
1002
|
this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
|
|
@@ -1057,7 +1115,9 @@ class DrawingService {
|
|
|
1057
1115
|
onEnd(evt, command, layer) {
|
|
1058
1116
|
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
1059
1117
|
? new GeoJSON().writeFeature(evt.feature)
|
|
1060
|
-
:
|
|
1118
|
+
: command.format === FeatureOutputFormat.WKT
|
|
1119
|
+
? new WKT().writeFeature(evt.feature)
|
|
1120
|
+
: new GeoJSON().writeGeometry(evt.feature.getGeometry()));
|
|
1061
1121
|
this.clearInteraction(layer);
|
|
1062
1122
|
}
|
|
1063
1123
|
observeMapRender() {
|
|
@@ -1143,7 +1203,9 @@ class FeatureModificationService {
|
|
|
1143
1203
|
onModified(command) {
|
|
1144
1204
|
command.next(command.format === FeatureOutputFormat.GeoJson
|
|
1145
1205
|
? new GeoJSON().writeFeature(command.model.feature)
|
|
1146
|
-
:
|
|
1206
|
+
: command.format === FeatureOutputFormat.WKT
|
|
1207
|
+
? new WKT().writeFeature(command.model.feature)
|
|
1208
|
+
: new GeoJSON().writeGeometry(command.model.feature.getGeometry()));
|
|
1147
1209
|
}
|
|
1148
1210
|
observeMapRender() {
|
|
1149
1211
|
this.postboy.sub(MapRenderedEvent).subscribe((m) => {
|
|
@@ -1229,6 +1291,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1229
1291
|
this.recordSubject(CancelDrawingCommand);
|
|
1230
1292
|
this.recordSubject(StartDrawingCommand);
|
|
1231
1293
|
this.recordSubject(GetLayerQuery);
|
|
1294
|
+
this.recordSubject(MapFeatureHoveredEvent);
|
|
1295
|
+
this.recordWithPipe(MapPointerMoveEvent, new Subject(), (s) => s.pipe(debounceTime(150)));
|
|
1232
1296
|
this.recordSubject(DrawingFinishedEvent);
|
|
1233
1297
|
this.recordSubject(GetFeaturesInAreaQuery);
|
|
1234
1298
|
this.recordSubject(DrawSelectionAreaCommand);
|
|
@@ -1585,6 +1649,7 @@ class FeatureLayerSettings {
|
|
|
1585
1649
|
result.minZoom = model.minZoom;
|
|
1586
1650
|
result.zIndex = model.zIndex;
|
|
1587
1651
|
result.style = model.style;
|
|
1652
|
+
result.featureHoverStyle = model.featureHoverStyle;
|
|
1588
1653
|
return result;
|
|
1589
1654
|
}
|
|
1590
1655
|
/**
|
|
@@ -1633,6 +1698,15 @@ class FeatureLayerSettings {
|
|
|
1633
1698
|
setStyle(style) {
|
|
1634
1699
|
return FeatureLayerSettings.copy({ ...this, style });
|
|
1635
1700
|
}
|
|
1701
|
+
/**
|
|
1702
|
+
* Sets the style to apply to features when they are hovered over.
|
|
1703
|
+
*
|
|
1704
|
+
* @param {Style | StyleFunction} featureHoverStyle - The style or style function to use for hovered features.
|
|
1705
|
+
* @return {FeatureLayerSettings} A new instance of FeatureLayerSettings with the updated hover style.
|
|
1706
|
+
*/
|
|
1707
|
+
setFeatureHoverStyle(featureHoverStyle) {
|
|
1708
|
+
return FeatureLayerSettings.copy({ ...this, featureHoverStyle });
|
|
1709
|
+
}
|
|
1636
1710
|
/**
|
|
1637
1711
|
* Checks if the given FeatureLayerSettings object is identical to the current object.
|
|
1638
1712
|
*
|
|
@@ -1650,6 +1724,8 @@ class FeatureLayerSettings {
|
|
|
1650
1724
|
return false;
|
|
1651
1725
|
if (this.style !== model.style)
|
|
1652
1726
|
return false;
|
|
1727
|
+
if (this.featureHoverStyle !== model.featureHoverStyle)
|
|
1728
|
+
return false;
|
|
1653
1729
|
return true;
|
|
1654
1730
|
}
|
|
1655
1731
|
}
|
|
@@ -2046,6 +2122,9 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
2046
2122
|
this.map.updateSize();
|
|
2047
2123
|
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
2048
2124
|
});
|
|
2125
|
+
this.map.on('pointermove', (ev) => {
|
|
2126
|
+
this.postboy.fire(new MapPointerMoveEvent(ev.pixel));
|
|
2127
|
+
});
|
|
2049
2128
|
this.setOsm();
|
|
2050
2129
|
}
|
|
2051
2130
|
setOsm() {
|
|
@@ -2257,7 +2336,10 @@ class PolygonsComponent extends DestructibleComponent {
|
|
|
2257
2336
|
putPolygons() {
|
|
2258
2337
|
if (!this._polygons)
|
|
2259
2338
|
return;
|
|
2260
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) =>
|
|
2339
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => {
|
|
2340
|
+
m.feature.set(MapConstants.FeatureLayerName, this.layerName);
|
|
2341
|
+
return m.feature;
|
|
2342
|
+
})));
|
|
2261
2343
|
}
|
|
2262
2344
|
}
|
|
2263
2345
|
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -2689,5 +2771,5 @@ class StringifyFeatureHelper {
|
|
|
2689
2771
|
* Generated bundle index. Do not edit.
|
|
2690
2772
|
*/
|
|
2691
2773
|
|
|
2692
|
-
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, MapClickEvent, MapConstants, 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 };
|
|
2774
|
+
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPointerMoveEvent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
2693
2775
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|