@artstesh/maps 5.0.11 → 5.1.0
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/controls/index.mjs +3 -0
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +52 -0
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +13 -0
- package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +45 -0
- package/dist/esm2022/map/map.module.mjs +8 -3
- package/dist/esm2022/map/messages/executors/generate-zoom-control.executor.mjs +13 -0
- package/dist/esm2022/map/public-api.mjs +2 -1
- package/dist/esm2022/map/services/message-registrator.service.mjs +4 -1
- package/dist/esm2022/src/map/map-plate/controls/index.mjs +3 -0
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +52 -0
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +13 -0
- package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +45 -0
- package/dist/esm2022/src/map/map.module.mjs +8 -3
- package/dist/esm2022/src/map/messages/executors/generate-zoom-control.executor.mjs +13 -0
- package/dist/esm2022/src/map/public-api.mjs +2 -1
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +4 -1
- package/dist/fesm2022/maps-components-src-map.mjs +122 -3
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +122 -3
- package/dist/fesm2022/maps-components.mjs.map +1 -1
- package/dist/map/map-plate/controls/index.d.ts +2 -0
- package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
- package/dist/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
- package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
- package/dist/map/map.module.d.ts +3 -2
- package/dist/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
- package/dist/map/public-api.d.ts +1 -0
- package/dist/src/map/map-plate/controls/index.d.ts +2 -0
- package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
- package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
- package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
- package/dist/src/map/map.module.d.ts +3 -2
- package/dist/src/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
- package/dist/src/map/public-api.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ import { get, useGeographic, transform } from 'ol/proj';
|
|
|
10
10
|
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
11
11
|
import { Draw, Modify, Translate } from 'ol/interaction';
|
|
12
12
|
import { createRegularPolygon } from 'ol/interaction/Draw';
|
|
13
|
+
import { Zoom } from 'ol/control';
|
|
13
14
|
import { first, filter, auditTime } from 'rxjs/operators';
|
|
14
15
|
import { Vector, XYZ } from 'ol/source';
|
|
15
16
|
import TileLayer from 'ol/layer/Tile';
|
|
@@ -543,6 +544,30 @@ class GenerateDrawExecutor extends PostboyExecutor {
|
|
|
543
544
|
}
|
|
544
545
|
}
|
|
545
546
|
|
|
547
|
+
class GenerateZoomControlExecutor extends PostboyExecutor {
|
|
548
|
+
settings;
|
|
549
|
+
static ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
|
|
550
|
+
constructor(settings) {
|
|
551
|
+
super();
|
|
552
|
+
this.settings = settings;
|
|
553
|
+
}
|
|
554
|
+
get id() {
|
|
555
|
+
return GenerateZoomControlExecutor.ID;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
class ZoomControlFactory {
|
|
560
|
+
static build(settings) {
|
|
561
|
+
return new Zoom({
|
|
562
|
+
zoomInTipLabel: settings.zoomInLabel,
|
|
563
|
+
zoomOutTipLabel: settings.zoomOutLabel,
|
|
564
|
+
zoomInClassName: settings.zoomInClass,
|
|
565
|
+
zoomOutClassName: settings.zoomOutClass,
|
|
566
|
+
className: settings.controlClass,
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
546
571
|
class MapPostboyService extends PostboyService {
|
|
547
572
|
constructor() {
|
|
548
573
|
super();
|
|
@@ -954,6 +979,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
954
979
|
setExecutors() {
|
|
955
980
|
this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
|
|
956
981
|
this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
|
|
982
|
+
this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
|
|
957
983
|
}
|
|
958
984
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: FeatureModificationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
959
985
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService });
|
|
@@ -1719,6 +1745,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1719
1745
|
type: Input
|
|
1720
1746
|
}] } });
|
|
1721
1747
|
|
|
1748
|
+
class ZoomControlSettings {
|
|
1749
|
+
controlClass = 'ol-zoom';
|
|
1750
|
+
zoomInClass = 'ol-zoom-in';
|
|
1751
|
+
zoomOutClass = 'ol-zoom-out';
|
|
1752
|
+
zoomInLabel = 'Zoom In';
|
|
1753
|
+
zoomOutLabel = 'Zoom Out';
|
|
1754
|
+
static copy(model) {
|
|
1755
|
+
const result = new ZoomControlSettings();
|
|
1756
|
+
result.controlClass = model.controlClass;
|
|
1757
|
+
result.zoomInClass = model.zoomInClass;
|
|
1758
|
+
result.zoomOutClass = model.zoomOutClass;
|
|
1759
|
+
result.zoomInLabel = model.zoomInLabel;
|
|
1760
|
+
result.zoomOutLabel = model.zoomOutLabel;
|
|
1761
|
+
return result;
|
|
1762
|
+
}
|
|
1763
|
+
isSame(model) {
|
|
1764
|
+
if (this.zoomInClass !== model.zoomInClass)
|
|
1765
|
+
return false;
|
|
1766
|
+
if (this.zoomOutClass !== model.zoomOutClass)
|
|
1767
|
+
return false;
|
|
1768
|
+
if (this.zoomInLabel !== model.zoomInLabel)
|
|
1769
|
+
return false;
|
|
1770
|
+
if (this.controlClass !== model.controlClass)
|
|
1771
|
+
return false;
|
|
1772
|
+
if (this.zoomOutLabel !== model.zoomOutLabel)
|
|
1773
|
+
return false;
|
|
1774
|
+
return true;
|
|
1775
|
+
}
|
|
1776
|
+
setZoomInLabel(zoomInLabel) {
|
|
1777
|
+
return ZoomControlSettings.copy({ ...this, zoomInLabel });
|
|
1778
|
+
}
|
|
1779
|
+
setZoomOutClass(zoomOutClass) {
|
|
1780
|
+
return ZoomControlSettings.copy({ ...this, zoomOutClass });
|
|
1781
|
+
}
|
|
1782
|
+
setZoomInClass(zoomInClass) {
|
|
1783
|
+
return ZoomControlSettings.copy({ ...this, zoomInClass });
|
|
1784
|
+
}
|
|
1785
|
+
setZoomOutLabel(zoomOutLabel) {
|
|
1786
|
+
return ZoomControlSettings.copy({ ...this, zoomOutLabel });
|
|
1787
|
+
}
|
|
1788
|
+
setControlClass(controlClass) {
|
|
1789
|
+
return ZoomControlSettings.copy({ ...this, controlClass });
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
class MapControlZoomComponent extends DestructibleComponent {
|
|
1794
|
+
postboy;
|
|
1795
|
+
_settings = new ZoomControlSettings();
|
|
1796
|
+
map;
|
|
1797
|
+
control;
|
|
1798
|
+
set settings(value) {
|
|
1799
|
+
if (!value || this._settings.isSame(value))
|
|
1800
|
+
return;
|
|
1801
|
+
this._settings = value;
|
|
1802
|
+
this.setControl();
|
|
1803
|
+
}
|
|
1804
|
+
constructor(postboy) {
|
|
1805
|
+
super();
|
|
1806
|
+
this.postboy = postboy;
|
|
1807
|
+
}
|
|
1808
|
+
ngOnInit() {
|
|
1809
|
+
this.postboy
|
|
1810
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1811
|
+
.pipe(filter((m) => !!m), first())
|
|
1812
|
+
.subscribe((m) => {
|
|
1813
|
+
this.map = m.map;
|
|
1814
|
+
this.setControl();
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
setControl() {
|
|
1818
|
+
if (!this.map)
|
|
1819
|
+
return;
|
|
1820
|
+
this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
|
|
1821
|
+
this.map.addControl(this.control);
|
|
1822
|
+
}
|
|
1823
|
+
onDestroy = () => {
|
|
1824
|
+
this.eliminate();
|
|
1825
|
+
};
|
|
1826
|
+
eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
|
|
1827
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1828
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapControlZoomComponent, selector: "lib-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1829
|
+
}
|
|
1830
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapControlZoomComponent, decorators: [{
|
|
1831
|
+
type: Component,
|
|
1832
|
+
args: [{ selector: 'lib-map-control-zoom', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1833
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { settings: [{
|
|
1834
|
+
type: Input
|
|
1835
|
+
}] } });
|
|
1836
|
+
|
|
1722
1837
|
class MapModule {
|
|
1723
1838
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1724
1839
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
|
|
@@ -1729,13 +1844,15 @@ class MapModule {
|
|
|
1729
1844
|
MarkersComponent,
|
|
1730
1845
|
TooltipComponent,
|
|
1731
1846
|
PolygonsComponent,
|
|
1732
|
-
ClusterLayerComponent
|
|
1847
|
+
ClusterLayerComponent,
|
|
1848
|
+
MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
|
|
1733
1849
|
FeatureLayerComponent,
|
|
1734
1850
|
MarkersComponent,
|
|
1735
1851
|
TileLayerComponent,
|
|
1736
1852
|
TooltipComponent,
|
|
1737
1853
|
PolygonsComponent,
|
|
1738
|
-
ClusterLayerComponent
|
|
1854
|
+
ClusterLayerComponent,
|
|
1855
|
+
MapControlZoomComponent] });
|
|
1739
1856
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, imports: [CommonModule] });
|
|
1740
1857
|
}
|
|
1741
1858
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, decorators: [{
|
|
@@ -1752,6 +1869,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1752
1869
|
TooltipComponent,
|
|
1753
1870
|
PolygonsComponent,
|
|
1754
1871
|
ClusterLayerComponent,
|
|
1872
|
+
MapControlZoomComponent,
|
|
1755
1873
|
],
|
|
1756
1874
|
exports: [
|
|
1757
1875
|
MapPlateComponent,
|
|
@@ -1761,6 +1879,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1761
1879
|
TooltipComponent,
|
|
1762
1880
|
PolygonsComponent,
|
|
1763
1881
|
ClusterLayerComponent,
|
|
1882
|
+
MapControlZoomComponent,
|
|
1764
1883
|
],
|
|
1765
1884
|
}]
|
|
1766
1885
|
}] });
|
|
@@ -1895,5 +2014,5 @@ class StringifyFeatureHelper {
|
|
|
1895
2014
|
* Generated bundle index. Do not edit.
|
|
1896
2015
|
*/
|
|
1897
2016
|
|
|
1898
|
-
export { CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, MapClickEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings };
|
|
2017
|
+
export { CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, MapClickEvent, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
1899
2018
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|