@artstesh/maps 9.0.4 → 9.0.5
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/fesm2022/maps-components-src-map.mjs +236 -2
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +236 -2
- package/dist/fesm2022/maps-components.mjs.map +1 -1
- package/dist/index.d.ts +121 -1
- package/dist/src/map/index.d.ts +121 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
|
|
|
17
17
|
import { Subject, combineLatest } from 'rxjs';
|
|
18
18
|
import { first, debounceTime, filter, auditTime } from 'rxjs/operators';
|
|
19
19
|
import { Dictionary } from '@artstesh/collections';
|
|
20
|
-
import { Vector, XYZ } from 'ol/source';
|
|
20
|
+
import { Vector, XYZ, GeoTIFF } from 'ol/source';
|
|
21
21
|
import TileLayer from 'ol/layer/Tile';
|
|
22
22
|
import OSM from 'ol/source/OSM';
|
|
23
23
|
import { Vector as Vector$1 } from 'ol/layer';
|
|
@@ -26,6 +26,7 @@ import Cluster from 'ol/source/Cluster';
|
|
|
26
26
|
import Static from 'ol/source/ImageStatic';
|
|
27
27
|
import ImageLayer from 'ol/layer/Image';
|
|
28
28
|
import RasterSource from 'ol/source/Raster';
|
|
29
|
+
import TileLayer$1 from 'ol/layer/WebGLTile';
|
|
29
30
|
import { NgIf, NgTemplateOutlet } from '@angular/common';
|
|
30
31
|
import Map from 'ol/Map';
|
|
31
32
|
import View from 'ol/View';
|
|
@@ -997,6 +998,24 @@ class RemoveRasterTileCommand extends PostboyGenericMessage {
|
|
|
997
998
|
}
|
|
998
999
|
}
|
|
999
1000
|
|
|
1001
|
+
class AddGeotiffTileCommand extends PostboyGenericMessage {
|
|
1002
|
+
layer;
|
|
1003
|
+
static ID = '80e1b7be-09cd-43de-b11c-e0699a91b287';
|
|
1004
|
+
constructor(layer) {
|
|
1005
|
+
super();
|
|
1006
|
+
this.layer = layer;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
class RemoveGeotiffTileCommand extends PostboyGenericMessage {
|
|
1011
|
+
layer;
|
|
1012
|
+
static ID = '5545a521-62c4-4b25-a555-ee264258799b';
|
|
1013
|
+
constructor(layer) {
|
|
1014
|
+
super();
|
|
1015
|
+
this.layer = layer;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1000
1019
|
class MapPostboyService extends PostboyService {
|
|
1001
1020
|
constructor() {
|
|
1002
1021
|
super();
|
|
@@ -1050,6 +1069,16 @@ class MapManagementService {
|
|
|
1050
1069
|
return;
|
|
1051
1070
|
this.map.removeLayer(c.layer);
|
|
1052
1071
|
});
|
|
1072
|
+
this.postboy.sub(AddGeotiffTileCommand).subscribe((c) => {
|
|
1073
|
+
if (!this.map)
|
|
1074
|
+
return;
|
|
1075
|
+
this.map.addLayer(c.layer);
|
|
1076
|
+
});
|
|
1077
|
+
this.postboy.sub(RemoveGeotiffTileCommand).subscribe((c) => {
|
|
1078
|
+
if (!this.map)
|
|
1079
|
+
return;
|
|
1080
|
+
this.map.removeLayer(c.layer);
|
|
1081
|
+
});
|
|
1053
1082
|
}
|
|
1054
1083
|
observeImageLayer() {
|
|
1055
1084
|
this.postboy.sub(AddImageLayerCommand).subscribe((c) => {
|
|
@@ -1513,6 +1542,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1513
1542
|
this.recordSubject(AddLayerCommand);
|
|
1514
1543
|
this.recordSubject(RemoveLayerCommand);
|
|
1515
1544
|
this.recordSubject(AddTileCommand);
|
|
1545
|
+
this.recordSubject(AddGeotiffTileCommand);
|
|
1546
|
+
this.recordSubject(RemoveGeotiffTileCommand);
|
|
1516
1547
|
this.recordSubject(AddRasterTileCommand);
|
|
1517
1548
|
this.recordSubject(RemoveRasterTileCommand);
|
|
1518
1549
|
this.recordSubject(RemoveImageLayerCommand);
|
|
@@ -2812,6 +2843,209 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
2812
2843
|
type: Input
|
|
2813
2844
|
}] } });
|
|
2814
2845
|
|
|
2846
|
+
class GeotiffTileLayerSettings {
|
|
2847
|
+
/**
|
|
2848
|
+
* The maximum source data value. Rendered values are scaled from 0 to 1 based on the configured min and max.
|
|
2849
|
+
*
|
|
2850
|
+
* @type {number | undefined}
|
|
2851
|
+
* @default undefined
|
|
2852
|
+
*/
|
|
2853
|
+
max = undefined;
|
|
2854
|
+
/**
|
|
2855
|
+
* The minimum source data value. Rendered values are scaled from 0 to 1 based on the configured min and max.
|
|
2856
|
+
*
|
|
2857
|
+
* @type {number | undefined}
|
|
2858
|
+
* @default undefined
|
|
2859
|
+
*/
|
|
2860
|
+
min = undefined;
|
|
2861
|
+
/**
|
|
2862
|
+
* Represents the URL of the tif.
|
|
2863
|
+
* @typedef {string} url
|
|
2864
|
+
*
|
|
2865
|
+
* @example
|
|
2866
|
+
* 'https://example.ex/geotiff.tif'
|
|
2867
|
+
*/
|
|
2868
|
+
url = '';
|
|
2869
|
+
/**
|
|
2870
|
+
* Style to apply to the layer.
|
|
2871
|
+
*
|
|
2872
|
+
* @type {Style | undefined}
|
|
2873
|
+
*/
|
|
2874
|
+
style;
|
|
2875
|
+
/**
|
|
2876
|
+
* The opacity of an element.
|
|
2877
|
+
*
|
|
2878
|
+
* @type {number}
|
|
2879
|
+
* @default 0.6
|
|
2880
|
+
*/
|
|
2881
|
+
opacity = 0.6;
|
|
2882
|
+
/**
|
|
2883
|
+
* The priority of showing - layers with higher zIndex cover others in case of collisions
|
|
2884
|
+
*/
|
|
2885
|
+
zIndex = 1;
|
|
2886
|
+
/**
|
|
2887
|
+
* Creates a copy of the given tile layer settings.
|
|
2888
|
+
*
|
|
2889
|
+
* @param {GeotiffTileLayerSettings} model - The tile layer settings to be copied.
|
|
2890
|
+
* @return {GeotiffTileLayerSettings} - A new instance of GeotiffTileLayerSettings with the same properties as the model.
|
|
2891
|
+
*/
|
|
2892
|
+
static copy(model) {
|
|
2893
|
+
const result = new GeotiffTileLayerSettings();
|
|
2894
|
+
result.max = model.max;
|
|
2895
|
+
result.min = model.min;
|
|
2896
|
+
result.zIndex = model.zIndex;
|
|
2897
|
+
result.style = model.style;
|
|
2898
|
+
result.opacity = model.opacity;
|
|
2899
|
+
result.url = model.url;
|
|
2900
|
+
return result;
|
|
2901
|
+
}
|
|
2902
|
+
/**
|
|
2903
|
+
* Sets the URL of the GeotiffTileLayerSettings object.
|
|
2904
|
+
*
|
|
2905
|
+
* @param {string} url - The URL to be set.
|
|
2906
|
+
* @return {GeotiffTileLayerSettings} - The updated GeotiffTileLayerSettings object.
|
|
2907
|
+
*/
|
|
2908
|
+
setUrl(url) {
|
|
2909
|
+
return GeotiffTileLayerSettings.copy({ ...this, url });
|
|
2910
|
+
}
|
|
2911
|
+
/**
|
|
2912
|
+
* Updates the style settings for the GeotiffTileLayerSettings and returns a new instance with the updated style.
|
|
2913
|
+
*
|
|
2914
|
+
* @param {Style} [style] - An optional style object that defines the new style settings.
|
|
2915
|
+
* @return {GeotiffTileLayerSettings} A new instance of GeotiffTileLayerSettings with the updated style.
|
|
2916
|
+
*/
|
|
2917
|
+
setStyle(style) {
|
|
2918
|
+
return GeotiffTileLayerSettings.copy({ ...this, style });
|
|
2919
|
+
}
|
|
2920
|
+
/**
|
|
2921
|
+
* Sets the maximum value for the GeotiffTileLayerSettings.
|
|
2922
|
+
*
|
|
2923
|
+
* @param {number} max - The maximum value to set.
|
|
2924
|
+
* @return {GeotiffTileLayerSettings} A new instance of GeotiffTileLayerSettings with the updated maximum value.
|
|
2925
|
+
*/
|
|
2926
|
+
setMax(max) {
|
|
2927
|
+
return GeotiffTileLayerSettings.copy({ ...this, max: max });
|
|
2928
|
+
}
|
|
2929
|
+
/**
|
|
2930
|
+
* Sets the z-index for the GeotiffTileLayerSettings.
|
|
2931
|
+
*
|
|
2932
|
+
* @param {number} zIndex - The new z-index to be assigned.
|
|
2933
|
+
* @return {GeotiffTileLayerSettings} A new GeotiffTileLayerSettings instance with the updated z-index.
|
|
2934
|
+
*/
|
|
2935
|
+
setZIndex(zIndex) {
|
|
2936
|
+
return GeotiffTileLayerSettings.copy({ ...this, zIndex });
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* Sets the minimum value for the GeotiffTileLayerSettings.
|
|
2940
|
+
*
|
|
2941
|
+
* @param {number} min - The new minimum value to be set.
|
|
2942
|
+
* @return {GeotiffTileLayerSettings} A new instance of GeotiffTileLayerSettings with the updated minimum value.
|
|
2943
|
+
*/
|
|
2944
|
+
setMin(min) {
|
|
2945
|
+
return GeotiffTileLayerSettings.copy({ ...this, min: min });
|
|
2946
|
+
}
|
|
2947
|
+
/**
|
|
2948
|
+
* Sets the opacity of the GeotiffTileLayerSettings.
|
|
2949
|
+
*
|
|
2950
|
+
* @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
|
|
2951
|
+
* @return {GeotiffTileLayerSettings} - A new instance of GeotiffTileLayerSettings with the opacity set.
|
|
2952
|
+
*/
|
|
2953
|
+
setOpacity(opacity) {
|
|
2954
|
+
return GeotiffTileLayerSettings.copy({ ...this, opacity });
|
|
2955
|
+
}
|
|
2956
|
+
/**
|
|
2957
|
+
* Checks if the current instance of GeotiffTileLayerSettings is equal to the given model.
|
|
2958
|
+
* @param {GeotiffTileLayerSettings} model - The model to compare against.
|
|
2959
|
+
* @return {boolean} - True if all properties of the current instance matches the properties of the model;
|
|
2960
|
+
* otherwise, false.
|
|
2961
|
+
*/
|
|
2962
|
+
isSame(model) {
|
|
2963
|
+
if (this.max !== model.max)
|
|
2964
|
+
return false;
|
|
2965
|
+
if (this.min !== model.min)
|
|
2966
|
+
return false;
|
|
2967
|
+
if (this.zIndex !== model.zIndex)
|
|
2968
|
+
return false;
|
|
2969
|
+
if (this.url !== model.url)
|
|
2970
|
+
return false;
|
|
2971
|
+
if (this.style !== model.style)
|
|
2972
|
+
return false;
|
|
2973
|
+
if (this.opacity !== model.opacity)
|
|
2974
|
+
return false;
|
|
2975
|
+
return true;
|
|
2976
|
+
}
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
class GeotiffTileLayerFactory {
|
|
2980
|
+
build(settings) {
|
|
2981
|
+
const source = new GeoTIFF({
|
|
2982
|
+
sources: [
|
|
2983
|
+
{
|
|
2984
|
+
url: settings.url,
|
|
2985
|
+
min: settings.min,
|
|
2986
|
+
max: settings.max,
|
|
2987
|
+
},
|
|
2988
|
+
],
|
|
2989
|
+
});
|
|
2990
|
+
return new TileLayer$1({
|
|
2991
|
+
style: settings.style,
|
|
2992
|
+
source: source,
|
|
2993
|
+
zIndex: settings.zIndex,
|
|
2994
|
+
opacity: settings.opacity,
|
|
2995
|
+
});
|
|
2996
|
+
}
|
|
2997
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GeotiffTileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2998
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GeotiffTileLayerFactory, providedIn: 'root' });
|
|
2999
|
+
}
|
|
3000
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GeotiffTileLayerFactory, decorators: [{
|
|
3001
|
+
type: Injectable,
|
|
3002
|
+
args: [{
|
|
3003
|
+
providedIn: 'root',
|
|
3004
|
+
}]
|
|
3005
|
+
}] });
|
|
3006
|
+
|
|
3007
|
+
class GeotiffTileLayerComponent extends DestructibleComponent {
|
|
3008
|
+
postboy;
|
|
3009
|
+
factory;
|
|
3010
|
+
layer;
|
|
3011
|
+
constructor(postboy, factory) {
|
|
3012
|
+
super();
|
|
3013
|
+
this.postboy = postboy;
|
|
3014
|
+
this.factory = factory;
|
|
3015
|
+
}
|
|
3016
|
+
_settings = new GeotiffTileLayerSettings();
|
|
3017
|
+
set settings(value) {
|
|
3018
|
+
if (!value || this._settings.isSame(value))
|
|
3019
|
+
return;
|
|
3020
|
+
this._settings = value;
|
|
3021
|
+
this.initLayer();
|
|
3022
|
+
}
|
|
3023
|
+
ngOnInit() {
|
|
3024
|
+
this.postboy
|
|
3025
|
+
.sub(MapRenderedEvent)
|
|
3026
|
+
.pipe(filter((m) => !!m), first())
|
|
3027
|
+
.subscribe((m) => this.initLayer());
|
|
3028
|
+
}
|
|
3029
|
+
onDestroy = () => this.removeLayer();
|
|
3030
|
+
initLayer() {
|
|
3031
|
+
this.removeLayer();
|
|
3032
|
+
this.layer = this.factory.build(this._settings);
|
|
3033
|
+
this.postboy.fire(new AddGeotiffTileCommand(this.layer));
|
|
3034
|
+
}
|
|
3035
|
+
removeLayer() {
|
|
3036
|
+
if (this.layer)
|
|
3037
|
+
this.postboy.fire(new RemoveGeotiffTileCommand(this.layer));
|
|
3038
|
+
}
|
|
3039
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GeotiffTileLayerComponent, deps: [{ token: MapPostboyService }, { token: GeotiffTileLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
3040
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.18", type: GeotiffTileLayerComponent, isStandalone: true, selector: "lib-geotiff-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
3041
|
+
}
|
|
3042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImport: i0, type: GeotiffTileLayerComponent, decorators: [{
|
|
3043
|
+
type: Component,
|
|
3044
|
+
args: [{ selector: 'lib-geotiff-tile-layer', imports: [], template: '' }]
|
|
3045
|
+
}], ctorParameters: () => [{ type: MapPostboyService }, { type: GeotiffTileLayerFactory }], propDecorators: { settings: [{
|
|
3046
|
+
type: Input
|
|
3047
|
+
}] } });
|
|
3048
|
+
|
|
2815
3049
|
class MapPlateFactory {
|
|
2816
3050
|
build(settings) {
|
|
2817
3051
|
return new Map({
|
|
@@ -3503,5 +3737,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.18", ngImpo
|
|
|
3503
3737
|
* Generated bundle index. Do not edit.
|
|
3504
3738
|
*/
|
|
3505
3739
|
|
|
3506
|
-
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetGeometryLengthExecutor, GetMapPositionExecutor, ImageLayerComponent, ImageLayerSettings, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapMoveEndEvent, MapPlateComponent, MapPointerMoveEvent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonSelfIntersectionExecutor, PolygonStyleHelper, PolygonsComponent, RasterTileLayerComponent, RasterTileLayerSettings, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
3740
|
+
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GeotiffTileLayerComponent, GeotiffTileLayerSettings, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetGeometryLengthExecutor, GetMapPositionExecutor, ImageLayerComponent, ImageLayerSettings, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapMoveEndEvent, MapPlateComponent, MapPointerMoveEvent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonSelfIntersectionExecutor, PolygonStyleHelper, PolygonsComponent, RasterTileLayerComponent, RasterTileLayerSettings, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
3507
3741
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|