@artstesh/maps 1.1.22 → 1.1.23
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/bundles/maps-components-src-map.umd.js +93 -6
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +93 -6
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/map-plate/features/polygons/polygons.component.js +6 -2
- package/dist/esm2015/map/map-plate/layers/feature-layer/feature-layer.settings.js +13 -1
- package/dist/esm2015/map/map-plate/map-plate.component.js +5 -1
- package/dist/esm2015/map/messages/events/map-feature-hovered.event.js +21 -0
- package/dist/esm2015/map/messages/events/map-pointer-move.event.js +20 -0
- package/dist/esm2015/map/messages/index.js +3 -1
- package/dist/esm2015/map/models/map.constants.js +2 -1
- package/dist/esm2015/map/services/map-feature.service.js +22 -2
- package/dist/esm2015/map/services/message-registrator.service.js +7 -2
- package/dist/esm2015/src/map/map-plate/features/polygons/polygons.component.js +6 -2
- package/dist/esm2015/src/map/map-plate/layers/feature-layer/feature-layer.settings.js +13 -1
- package/dist/esm2015/src/map/map-plate/map-plate.component.js +5 -1
- package/dist/esm2015/src/map/messages/events/map-feature-hovered.event.js +21 -0
- package/dist/esm2015/src/map/messages/events/map-pointer-move.event.js +20 -0
- package/dist/esm2015/src/map/messages/index.js +3 -1
- package/dist/esm2015/src/map/models/map.constants.js +2 -1
- package/dist/esm2015/src/map/services/map-feature.service.js +22 -2
- package/dist/esm2015/src/map/services/message-registrator.service.js +7 -2
- package/dist/fesm2015/maps-components-src-map.js +82 -5
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +82 -5
- package/dist/fesm2015/maps-components.js.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/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/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) {
|
|
@@ -519,6 +520,45 @@ class MapMoveEndEvent extends PostboyGenericMessage {
|
|
|
519
520
|
}
|
|
520
521
|
MapMoveEndEvent.ID = 'd210ec7e-032f-4ce8-8a39-7b816519eaae';
|
|
521
522
|
|
|
523
|
+
/**
|
|
524
|
+
* Represents an event that is triggered when the pointer moves on a map.
|
|
525
|
+
* This class extends PostboyGenericMessage.
|
|
526
|
+
*
|
|
527
|
+
* It contains information about the coordinates of the pointer when the event occurs.
|
|
528
|
+
*/
|
|
529
|
+
class MapPointerMoveEvent extends PostboyGenericMessage {
|
|
530
|
+
/**
|
|
531
|
+
* Constructor for initializing an instance with a given point.
|
|
532
|
+
*
|
|
533
|
+
* @param {Array<number>} point - An array representing the coordinates of the point.
|
|
534
|
+
*/
|
|
535
|
+
constructor(point) {
|
|
536
|
+
super();
|
|
537
|
+
this.point = point;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
MapPointerMoveEvent.ID = '193cb41d-2489-45cc-b349-59c3ec18ed72';
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Represents an event triggered when a map feature is hovered over.
|
|
544
|
+
* This event contains information about the hovered feature and its associated layer.
|
|
545
|
+
* Extends the PostboyGenericMessage class.
|
|
546
|
+
*/
|
|
547
|
+
class MapFeatureHoveredEvent extends PostboyGenericMessage {
|
|
548
|
+
/**
|
|
549
|
+
* Constructs an instance of the class.
|
|
550
|
+
*
|
|
551
|
+
* @param {Feature|null} feature - The feature associated with this instance. Can be null.
|
|
552
|
+
* @param {string|null} layer - The layer associated with this instance. Can be null.
|
|
553
|
+
*/
|
|
554
|
+
constructor(feature, layer) {
|
|
555
|
+
super();
|
|
556
|
+
this.feature = feature;
|
|
557
|
+
this.layer = layer;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
MapFeatureHoveredEvent.ID = 'eb9b032a-1616-4823-a628-0fd8ffc3b57a';
|
|
561
|
+
|
|
522
562
|
/**
|
|
523
563
|
* A class responsible for executing filtering of geographical features
|
|
524
564
|
* based on a specific geographical point (latitude and longitude).
|
|
@@ -939,6 +979,7 @@ class MapFeatureService {
|
|
|
939
979
|
this.observeMapRender();
|
|
940
980
|
this.observeFitToFeatures();
|
|
941
981
|
this.observeFitToPolygons();
|
|
982
|
+
this.observePointerMove();
|
|
942
983
|
}
|
|
943
984
|
observeMapRender() {
|
|
944
985
|
this.postboy.sub(MapRenderedEvent).subscribe((m) => {
|
|
@@ -947,6 +988,22 @@ class MapFeatureService {
|
|
|
947
988
|
this.postboy.fire(this.fitPolygonsWaiting);
|
|
948
989
|
});
|
|
949
990
|
}
|
|
991
|
+
observePointerMove() {
|
|
992
|
+
this.postboy.sub(MapPointerMoveEvent).subscribe((ev) => {
|
|
993
|
+
if (!this.map)
|
|
994
|
+
return;
|
|
995
|
+
let featureFound = false;
|
|
996
|
+
this.map.forEachFeatureAtPixel(ev.point, (f) => {
|
|
997
|
+
if (f instanceof Feature) {
|
|
998
|
+
this.postboy.fire(new MapFeatureHoveredEvent(f, f.get(MapConstants.FeatureLayerName)));
|
|
999
|
+
featureFound = true;
|
|
1000
|
+
}
|
|
1001
|
+
return true;
|
|
1002
|
+
});
|
|
1003
|
+
if (!featureFound)
|
|
1004
|
+
this.postboy.fire(new MapFeatureHoveredEvent(null, null));
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
950
1007
|
observeFitToFeatures() {
|
|
951
1008
|
this.postboy.sub(FitToFeaturesCommand).subscribe((cmd) => {
|
|
952
1009
|
this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
|
|
@@ -1250,6 +1307,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1250
1307
|
this.recordSubject(CancelDrawingCommand);
|
|
1251
1308
|
this.recordSubject(StartDrawingCommand);
|
|
1252
1309
|
this.recordSubject(GetLayerQuery);
|
|
1310
|
+
this.recordSubject(MapFeatureHoveredEvent);
|
|
1311
|
+
this.recordWithPipe(MapPointerMoveEvent, new Subject(), (s) => s.pipe(debounceTime(150)));
|
|
1253
1312
|
this.recordSubject(DrawingFinishedEvent);
|
|
1254
1313
|
this.recordSubject(GetFeaturesInAreaQuery);
|
|
1255
1314
|
this.recordSubject(DrawSelectionAreaCommand);
|
|
@@ -1617,6 +1676,7 @@ class FeatureLayerSettings {
|
|
|
1617
1676
|
result.minZoom = model.minZoom;
|
|
1618
1677
|
result.zIndex = model.zIndex;
|
|
1619
1678
|
result.style = model.style;
|
|
1679
|
+
result.featureHoverStyle = model.featureHoverStyle;
|
|
1620
1680
|
return result;
|
|
1621
1681
|
}
|
|
1622
1682
|
/**
|
|
@@ -1665,6 +1725,15 @@ class FeatureLayerSettings {
|
|
|
1665
1725
|
setStyle(style) {
|
|
1666
1726
|
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { style }));
|
|
1667
1727
|
}
|
|
1728
|
+
/**
|
|
1729
|
+
* Sets the style to apply to features when they are hovered over.
|
|
1730
|
+
*
|
|
1731
|
+
* @param {Style | StyleFunction} featureHoverStyle - The style or style function to use for hovered features.
|
|
1732
|
+
* @return {FeatureLayerSettings} A new instance of FeatureLayerSettings with the updated hover style.
|
|
1733
|
+
*/
|
|
1734
|
+
setFeatureHoverStyle(featureHoverStyle) {
|
|
1735
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { featureHoverStyle }));
|
|
1736
|
+
}
|
|
1668
1737
|
/**
|
|
1669
1738
|
* Checks if the given FeatureLayerSettings object is identical to the current object.
|
|
1670
1739
|
*
|
|
@@ -1682,6 +1751,8 @@ class FeatureLayerSettings {
|
|
|
1682
1751
|
return false;
|
|
1683
1752
|
if (this.style !== model.style)
|
|
1684
1753
|
return false;
|
|
1754
|
+
if (this.featureHoverStyle !== model.featureHoverStyle)
|
|
1755
|
+
return false;
|
|
1685
1756
|
return true;
|
|
1686
1757
|
}
|
|
1687
1758
|
}
|
|
@@ -2092,6 +2163,9 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
2092
2163
|
this.map.updateSize();
|
|
2093
2164
|
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
2094
2165
|
});
|
|
2166
|
+
this.map.on('pointermove', (ev) => {
|
|
2167
|
+
this.postboy.fire(new MapPointerMoveEvent(ev.pixel));
|
|
2168
|
+
});
|
|
2095
2169
|
this.setOsm();
|
|
2096
2170
|
}
|
|
2097
2171
|
setOsm() {
|
|
@@ -2322,7 +2396,10 @@ class PolygonsComponent extends DestructibleComponent {
|
|
|
2322
2396
|
putPolygons() {
|
|
2323
2397
|
if (!this._polygons)
|
|
2324
2398
|
return;
|
|
2325
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) =>
|
|
2399
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => {
|
|
2400
|
+
m.feature.set(MapConstants.FeatureLayerName, this.layerName);
|
|
2401
|
+
return m.feature;
|
|
2402
|
+
})));
|
|
2326
2403
|
}
|
|
2327
2404
|
}
|
|
2328
2405
|
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -2768,5 +2845,5 @@ class StringifyFeatureHelper {
|
|
|
2768
2845
|
* Generated bundle index. Do not edit.
|
|
2769
2846
|
*/
|
|
2770
2847
|
|
|
2771
|
-
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 };
|
|
2848
|
+
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 };
|
|
2772
2849
|
//# sourceMappingURL=maps-components.js.map
|