@artstesh/maps 6.1.0 → 6.1.2
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/map-plate/layers/feature-layer/feature-layer.settings.mjs +28 -1
- package/dist/esm2022/map/map-plate/map-plate.component.mjs +5 -1
- package/dist/esm2022/map/messages/events/map-feature-hovered.event.mjs +23 -0
- package/dist/esm2022/map/messages/events/map-pointer-move.event.mjs +21 -0
- package/dist/esm2022/map/messages/index.mjs +3 -1
- package/dist/esm2022/map/models/feature-format.enum.mjs +2 -1
- package/dist/esm2022/map/models/map.constants.mjs +2 -1
- package/dist/esm2022/map/services/drawing/drawing.service.mjs +4 -2
- package/dist/esm2022/map/services/drawing/feature-modification.service.mjs +4 -2
- package/dist/esm2022/map/services/map-feature.service.mjs +22 -2
- package/dist/esm2022/map/services/message-registrator.service.mjs +7 -2
- package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +28 -1
- package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +5 -1
- package/dist/esm2022/src/map/messages/events/map-feature-hovered.event.mjs +23 -0
- package/dist/esm2022/src/map/messages/events/map-pointer-move.event.mjs +21 -0
- package/dist/esm2022/src/map/messages/index.mjs +3 -1
- package/dist/esm2022/src/map/models/feature-format.enum.mjs +2 -1
- package/dist/esm2022/src/map/models/map.constants.mjs +2 -1
- package/dist/esm2022/src/map/services/drawing/drawing.service.mjs +4 -2
- package/dist/esm2022/src/map/services/drawing/feature-modification.service.mjs +4 -2
- package/dist/esm2022/src/map/services/map-feature.service.mjs +22 -2
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +7 -2
- package/dist/fesm2022/maps-components-src-map.mjs +102 -5
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +102 -5
- package/dist/fesm2022/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';
|
|
@@ -191,6 +191,7 @@ class IdGenerator {
|
|
|
191
191
|
class MapConstants {
|
|
192
192
|
static FeatureInfo = 'f-info';
|
|
193
193
|
static DrawingLayerId = '93a981756ec7';
|
|
194
|
+
static FeatureLayerName = 'L-253';
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
class MarkerModel {
|
|
@@ -285,6 +286,7 @@ var FeatureOutputFormat;
|
|
|
285
286
|
(function (FeatureOutputFormat) {
|
|
286
287
|
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
287
288
|
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
289
|
+
FeatureOutputFormat[FeatureOutputFormat["Geometry"] = 3] = "Geometry";
|
|
288
290
|
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
289
291
|
|
|
290
292
|
/**
|
|
@@ -546,6 +548,48 @@ class MapMoveEndEvent extends PostboyGenericMessage {
|
|
|
546
548
|
}
|
|
547
549
|
}
|
|
548
550
|
|
|
551
|
+
/**
|
|
552
|
+
* Represents an event that is triggered when the pointer moves on a map.
|
|
553
|
+
* This class extends PostboyGenericMessage.
|
|
554
|
+
*
|
|
555
|
+
* It contains information about the coordinates of the pointer when the event occurs.
|
|
556
|
+
*/
|
|
557
|
+
class MapPointerMoveEvent extends PostboyGenericMessage {
|
|
558
|
+
point;
|
|
559
|
+
static ID = '193cb41d-2489-45cc-b349-59c3ec18ed72';
|
|
560
|
+
/**
|
|
561
|
+
* Constructor for initializing an instance with a given point.
|
|
562
|
+
*
|
|
563
|
+
* @param {Array<number>} point - An array representing the coordinates of the point.
|
|
564
|
+
*/
|
|
565
|
+
constructor(point) {
|
|
566
|
+
super();
|
|
567
|
+
this.point = point;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Represents an event triggered when a map feature is hovered over.
|
|
573
|
+
* This event contains information about the hovered feature and its associated layer.
|
|
574
|
+
* Extends the PostboyGenericMessage class.
|
|
575
|
+
*/
|
|
576
|
+
class MapFeatureHoveredEvent extends PostboyGenericMessage {
|
|
577
|
+
feature;
|
|
578
|
+
layer;
|
|
579
|
+
static ID = 'eb9b032a-1616-4823-a628-0fd8ffc3b57a';
|
|
580
|
+
/**
|
|
581
|
+
* Constructs an instance of the class.
|
|
582
|
+
*
|
|
583
|
+
* @param {Feature|null} feature - The feature associated with this instance. Can be null.
|
|
584
|
+
* @param {string|null} layer - The layer associated with this instance. Can be null.
|
|
585
|
+
*/
|
|
586
|
+
constructor(feature, layer) {
|
|
587
|
+
super();
|
|
588
|
+
this.feature = feature;
|
|
589
|
+
this.layer = layer;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
549
593
|
/**
|
|
550
594
|
* A class responsible for executing filtering of geographical features
|
|
551
595
|
* based on a specific geographical point (latitude and longitude).
|
|
@@ -986,6 +1030,7 @@ class MapFeatureService {
|
|
|
986
1030
|
this.observeMapRender();
|
|
987
1031
|
this.observeFitToFeatures();
|
|
988
1032
|
this.observeFitToPolygons();
|
|
1033
|
+
this.observePointerMove();
|
|
989
1034
|
}
|
|
990
1035
|
observeMapRender() {
|
|
991
1036
|
this.postboy.sub(MapRenderedEvent).subscribe((m) => {
|
|
@@ -994,6 +1039,22 @@ class MapFeatureService {
|
|
|
994
1039
|
this.postboy.fire(this.fitPolygonsWaiting);
|
|
995
1040
|
});
|
|
996
1041
|
}
|
|
1042
|
+
observePointerMove() {
|
|
1043
|
+
this.postboy.sub(MapPointerMoveEvent).subscribe((ev) => {
|
|
1044
|
+
if (!this.map)
|
|
1045
|
+
return;
|
|
1046
|
+
let featureFound = false;
|
|
1047
|
+
this.map.forEachFeatureAtPixel(ev.point, (f) => {
|
|
1048
|
+
if (f instanceof Feature) {
|
|
1049
|
+
this.postboy.fire(new MapFeatureHoveredEvent(f, f.get(MapConstants.FeatureLayerName)));
|
|
1050
|
+
featureFound = true;
|
|
1051
|
+
}
|
|
1052
|
+
return true;
|
|
1053
|
+
});
|
|
1054
|
+
if (!featureFound)
|
|
1055
|
+
this.postboy.fire(new MapFeatureHoveredEvent(null, null));
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
997
1058
|
observeFitToFeatures() {
|
|
998
1059
|
this.postboy.sub(FitToFeaturesCommand).subscribe((cmd) => {
|
|
999
1060
|
this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
|
|
@@ -1118,7 +1179,9 @@ class DrawingService {
|
|
|
1118
1179
|
onEnd(evt, command, layer) {
|
|
1119
1180
|
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
1120
1181
|
? new GeoJSON().writeFeature(evt.feature)
|
|
1121
|
-
:
|
|
1182
|
+
: command.format === FeatureOutputFormat.WKT
|
|
1183
|
+
? new WKT().writeFeature(evt.feature)
|
|
1184
|
+
: new GeoJSON().writeGeometry(evt.feature.getGeometry()));
|
|
1122
1185
|
this.clearInteraction(layer);
|
|
1123
1186
|
}
|
|
1124
1187
|
observeMapRender() {
|
|
@@ -1209,7 +1272,9 @@ class FeatureModificationService {
|
|
|
1209
1272
|
onModified(command) {
|
|
1210
1273
|
command.next(command.format === FeatureOutputFormat.GeoJson
|
|
1211
1274
|
? new GeoJSON().writeFeature(command.model.feature)
|
|
1212
|
-
:
|
|
1275
|
+
: command.format === FeatureOutputFormat.WKT
|
|
1276
|
+
? new WKT().writeFeature(command.model.feature)
|
|
1277
|
+
: new GeoJSON().writeGeometry(command.model.feature.getGeometry()));
|
|
1213
1278
|
}
|
|
1214
1279
|
observeMapRender() {
|
|
1215
1280
|
this.postboy.sub(MapRenderedEvent).subscribe((m) => {
|
|
@@ -1298,6 +1363,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1298
1363
|
this.recordSubject(CancelDrawingCommand);
|
|
1299
1364
|
this.recordSubject(StartDrawingCommand);
|
|
1300
1365
|
this.recordSubject(GetLayerQuery);
|
|
1366
|
+
this.recordSubject(MapFeatureHoveredEvent);
|
|
1367
|
+
this.recordWithPipe(MapPointerMoveEvent, new Subject(), (s) => s.pipe(debounceTime(150)));
|
|
1301
1368
|
this.recordSubject(DrawingFinishedEvent);
|
|
1302
1369
|
this.recordSubject(GetFeaturesInAreaQuery);
|
|
1303
1370
|
this.recordSubject(DrawSelectionAreaCommand);
|
|
@@ -1646,6 +1713,21 @@ class FeatureLayerSettings {
|
|
|
1646
1713
|
* The styling definition of layer's features. The easiest way is to use {@link PolygonStyleHelper},{@link MarkerStyleHelper}
|
|
1647
1714
|
*/
|
|
1648
1715
|
style;
|
|
1716
|
+
/**
|
|
1717
|
+
* Defines the style applied to a feature when it is hovered over.
|
|
1718
|
+
*
|
|
1719
|
+
* This property can accept either a static style object or a dynamic style function.
|
|
1720
|
+
* When a `StyleFunction` is provided, it will determine the style dynamically
|
|
1721
|
+
* based on the feature being hovered.
|
|
1722
|
+
*
|
|
1723
|
+
* The style is applied temporarily, specifically for the hovered feature,
|
|
1724
|
+
* and overrides any default or predefined styles for that feature.
|
|
1725
|
+
*
|
|
1726
|
+
* Optional property.
|
|
1727
|
+
*
|
|
1728
|
+
* @type {(Style | StyleFunction)}
|
|
1729
|
+
*/
|
|
1730
|
+
featureHoverStyle;
|
|
1649
1731
|
/**
|
|
1650
1732
|
* Copies the given FeatureLayerSettings object
|
|
1651
1733
|
*
|
|
@@ -1659,6 +1741,7 @@ class FeatureLayerSettings {
|
|
|
1659
1741
|
result.minZoom = model.minZoom;
|
|
1660
1742
|
result.zIndex = model.zIndex;
|
|
1661
1743
|
result.style = model.style;
|
|
1744
|
+
result.featureHoverStyle = model.featureHoverStyle;
|
|
1662
1745
|
return result;
|
|
1663
1746
|
}
|
|
1664
1747
|
/**
|
|
@@ -1707,6 +1790,15 @@ class FeatureLayerSettings {
|
|
|
1707
1790
|
setStyle(style) {
|
|
1708
1791
|
return FeatureLayerSettings.copy({ ...this, style });
|
|
1709
1792
|
}
|
|
1793
|
+
/**
|
|
1794
|
+
* Sets the style to apply to features when they are hovered over.
|
|
1795
|
+
*
|
|
1796
|
+
* @param {Style | StyleFunction} featureHoverStyle - The style or style function to use for hovered features.
|
|
1797
|
+
* @return {FeatureLayerSettings} A new instance of FeatureLayerSettings with the updated hover style.
|
|
1798
|
+
*/
|
|
1799
|
+
setFeatureHoverStyle(featureHoverStyle) {
|
|
1800
|
+
return FeatureLayerSettings.copy({ ...this, featureHoverStyle });
|
|
1801
|
+
}
|
|
1710
1802
|
/**
|
|
1711
1803
|
* Checks if the given FeatureLayerSettings object is identical to the current object.
|
|
1712
1804
|
*
|
|
@@ -1724,6 +1816,8 @@ class FeatureLayerSettings {
|
|
|
1724
1816
|
return false;
|
|
1725
1817
|
if (this.style !== model.style)
|
|
1726
1818
|
return false;
|
|
1819
|
+
if (this.featureHoverStyle !== model.featureHoverStyle)
|
|
1820
|
+
return false;
|
|
1727
1821
|
return true;
|
|
1728
1822
|
}
|
|
1729
1823
|
}
|
|
@@ -2129,6 +2223,9 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
2129
2223
|
this.map.updateSize();
|
|
2130
2224
|
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
2131
2225
|
});
|
|
2226
|
+
this.map.on('pointermove', (ev) => {
|
|
2227
|
+
this.postboy.fire(new MapPointerMoveEvent(ev.pixel));
|
|
2228
|
+
});
|
|
2132
2229
|
this.setOsm();
|
|
2133
2230
|
}
|
|
2134
2231
|
onDestroy = () => {
|
|
@@ -2788,5 +2885,5 @@ class StringifyFeatureHelper {
|
|
|
2788
2885
|
* Generated bundle index. Do not edit.
|
|
2789
2886
|
*/
|
|
2790
2887
|
|
|
2791
|
-
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 };
|
|
2888
|
+
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 };
|
|
2792
2889
|
//# sourceMappingURL=maps-components.mjs.map
|