@artstesh/maps 1.1.36 → 1.2.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/bundles/maps-components-src-map.umd.js +32 -9
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +32 -9
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.js +12 -2
- package/dist/esm2015/map/map-plate/map-plate.component.js +2 -2
- package/dist/esm2015/map/messages/executors/generate-zoom-control.executor.js +1 -1
- package/dist/esm2015/map/models/map-settings.js +14 -1
- package/dist/esm2015/map/services/drawing/drawing.service.js +5 -2
- package/dist/esm2015/map/services/map-postboy.service.js +1 -9
- package/dist/esm2015/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.js +12 -2
- package/dist/esm2015/src/map/map-plate/map-plate.component.js +2 -2
- package/dist/esm2015/src/map/messages/executors/generate-zoom-control.executor.js +1 -1
- package/dist/esm2015/src/map/models/map-settings.js +14 -1
- package/dist/esm2015/src/map/services/drawing/drawing.service.js +5 -2
- package/dist/esm2015/src/map/services/map-postboy.service.js +1 -9
- package/dist/fesm2015/maps-components-src-map.js +28 -8
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +28 -8
- package/dist/fesm2015/maps-components.js.map +1 -1
- package/dist/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +4 -2
- package/dist/map/messages/executors/generate-zoom-control.executor.d.ts +2 -2
- package/dist/map/models/map-settings.d.ts +8 -0
- package/dist/package.json +1 -1
- package/dist/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +4 -2
- package/dist/src/map/messages/executors/generate-zoom-control.executor.d.ts +2 -2
- package/dist/src/map/models/map-settings.d.ts +8 -0
- package/package.json +13 -3
|
@@ -11,7 +11,7 @@ import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
|
11
11
|
import Polygon, { circular, fromExtent } from 'ol/geom/Polygon';
|
|
12
12
|
import { Control, Zoom } from 'ol/control';
|
|
13
13
|
import { get, useGeographic, transform } from 'ol/proj';
|
|
14
|
-
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
14
|
+
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, LockMessage, UnlockMessage, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
15
15
|
import * as Sphere from 'ol/sphere';
|
|
16
16
|
import { getLength } from 'ol/sphere';
|
|
17
17
|
import { Draw, Modify, Translate, defaults } from 'ol/interaction';
|
|
@@ -86,6 +86,7 @@ class MapSettings {
|
|
|
86
86
|
this.zoom = 4;
|
|
87
87
|
this.lyrs = MapLyrs.Hybrid;
|
|
88
88
|
this.language = 'en';
|
|
89
|
+
this.osmOpacity = 1;
|
|
89
90
|
this.interactionSettings = {};
|
|
90
91
|
}
|
|
91
92
|
static copy(model) {
|
|
@@ -97,6 +98,7 @@ class MapSettings {
|
|
|
97
98
|
result.lyrs = model.lyrs;
|
|
98
99
|
result.interactionSettings = model.interactionSettings;
|
|
99
100
|
result.language = model.language;
|
|
101
|
+
result.osmOpacity = model.osmOpacity;
|
|
100
102
|
return result;
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
@@ -163,6 +165,15 @@ class MapSettings {
|
|
|
163
165
|
setLanguage(language) {
|
|
164
166
|
return MapSettings.copy(Object.assign(Object.assign({}, this), { language }));
|
|
165
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* Sets the opacity level for the OpenStreetMap layer.
|
|
170
|
+
*
|
|
171
|
+
* @param {number} osmOpacity - The opacity value for the OpenStreetMap layer, where 0 is fully transparent and 1 is fully opaque.
|
|
172
|
+
* @return {MapSettings} A new MapSettings instance with the updated OpenStreetMap opacity.
|
|
173
|
+
*/
|
|
174
|
+
setOsmOpacity(osmOpacity) {
|
|
175
|
+
return MapSettings.copy(Object.assign(Object.assign({}, this), { osmOpacity }));
|
|
176
|
+
}
|
|
166
177
|
/**
|
|
167
178
|
* Compares the current MapSettings instance with another to determine if they are identical.
|
|
168
179
|
*
|
|
@@ -182,6 +193,8 @@ class MapSettings {
|
|
|
182
193
|
return false;
|
|
183
194
|
if (this.interactionSettings !== model.interactionSettings)
|
|
184
195
|
return false;
|
|
196
|
+
if (this.osmOpacity !== model.osmOpacity)
|
|
197
|
+
return false;
|
|
185
198
|
return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
|
|
186
199
|
}
|
|
187
200
|
}
|
|
@@ -925,11 +938,6 @@ RemoveRasterTileCommand.ID = 'd1c4bf6a-e2f2-4385-a7a2-cecb525f8939';
|
|
|
925
938
|
class MapPostboyService extends PostboyService {
|
|
926
939
|
constructor() {
|
|
927
940
|
super();
|
|
928
|
-
this.addLocker({
|
|
929
|
-
locker: StartDrawingCommand.ID,
|
|
930
|
-
unlocker: DrawingFinishedEvent.ID,
|
|
931
|
-
locking: [MapClickEvent.ID],
|
|
932
|
-
});
|
|
933
941
|
}
|
|
934
942
|
}
|
|
935
943
|
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -1243,6 +1251,7 @@ class DrawingService {
|
|
|
1243
1251
|
}
|
|
1244
1252
|
observeDrawing() {
|
|
1245
1253
|
this.postboy.sub(StartDrawingCommand).subscribe((ev) => {
|
|
1254
|
+
this.postboy.exec(new LockMessage(MapClickEvent));
|
|
1246
1255
|
this.draw((l) => {
|
|
1247
1256
|
var _a;
|
|
1248
1257
|
if (!l || !this.map) {
|
|
@@ -1290,6 +1299,7 @@ class DrawingService {
|
|
|
1290
1299
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.removeInteraction(this.drawInteraction);
|
|
1291
1300
|
layer === null || layer === void 0 ? void 0 : layer.setSource(new Vector({}));
|
|
1292
1301
|
}
|
|
1302
|
+
this.postboy.exec(new UnlockMessage(MapClickEvent));
|
|
1293
1303
|
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
1294
1304
|
}
|
|
1295
1305
|
}
|
|
@@ -1729,6 +1739,7 @@ class OsmTileLayerComponent extends DestructibleComponent {
|
|
|
1729
1739
|
constructor() {
|
|
1730
1740
|
super();
|
|
1731
1741
|
this._url = '';
|
|
1742
|
+
this._opacity = 1;
|
|
1732
1743
|
}
|
|
1733
1744
|
set url(value) {
|
|
1734
1745
|
if (!value || this._url === value)
|
|
@@ -1736,6 +1747,12 @@ class OsmTileLayerComponent extends DestructibleComponent {
|
|
|
1736
1747
|
this._url = value;
|
|
1737
1748
|
this.initLayer();
|
|
1738
1749
|
}
|
|
1750
|
+
set opacity(value) {
|
|
1751
|
+
if (!value || this._opacity === value)
|
|
1752
|
+
return;
|
|
1753
|
+
this._opacity = value;
|
|
1754
|
+
this.initLayer();
|
|
1755
|
+
}
|
|
1739
1756
|
set map(value) {
|
|
1740
1757
|
if (!value || this._map === value)
|
|
1741
1758
|
return;
|
|
@@ -1760,13 +1777,14 @@ class OsmTileLayerComponent extends DestructibleComponent {
|
|
|
1760
1777
|
source: new OSM({
|
|
1761
1778
|
url: this._url,
|
|
1762
1779
|
}),
|
|
1780
|
+
opacity: this._opacity,
|
|
1763
1781
|
});
|
|
1764
1782
|
this.layer.set('name', 'osm-tile-layer');
|
|
1765
1783
|
this._map.addLayer(this.layer);
|
|
1766
1784
|
}
|
|
1767
1785
|
}
|
|
1768
1786
|
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1769
|
-
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1787
|
+
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: { url: "url", opacity: "opacity", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1770
1788
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
1771
1789
|
type: Component,
|
|
1772
1790
|
args: [{
|
|
@@ -1777,6 +1795,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1777
1795
|
}]
|
|
1778
1796
|
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
1779
1797
|
type: Input
|
|
1798
|
+
}], opacity: [{
|
|
1799
|
+
type: Input
|
|
1780
1800
|
}], map: [{
|
|
1781
1801
|
type: Input
|
|
1782
1802
|
}] } });
|
|
@@ -2828,7 +2848,7 @@ MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
2828
2848
|
FeatureService,
|
|
2829
2849
|
FeatureModificationService,
|
|
2830
2850
|
ControlsService,
|
|
2831
|
-
], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{display:block;width:100%;height:100%}\n"], components: [{ type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "map"] }, { type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2851
|
+
], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\" [opacity]=\"_settings.osmOpacity\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{display:block;width:100%;height:100%}\n"], components: [{ type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "opacity", "map"] }, { type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2832
2852
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
2833
2853
|
type: Component,
|
|
2834
2854
|
args: [{
|