@artstesh/maps 4.1.26 → 4.1.28
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/esm2020/map/map-plate/layers/image-layer/image-layer-factory.mjs +26 -0
- package/dist/esm2020/map/map-plate/layers/image-layer/image-layer.component.mjs +49 -0
- package/dist/esm2020/map/map-plate/layers/image-layer/image-layer.settings.mjs +136 -0
- package/dist/esm2020/map/map-plate/layers/index.mjs +5 -1
- package/dist/esm2020/map/map-plate/layers/raster-tile/raster-tile-layer.component.mjs +49 -0
- package/dist/esm2020/map/map-plate/layers/raster-tile/raster-tile-layer.factory.mjs +74 -0
- package/dist/esm2020/map/map-plate/layers/raster-tile/raster-tile-layer.settings.mjs +151 -0
- package/dist/esm2020/map/map.module.mjs +13 -3
- package/dist/esm2020/map/messages/commands/add-image-layer.command.mjs +9 -0
- package/dist/esm2020/map/messages/commands/add-raster-tile-command.mjs +9 -0
- package/dist/esm2020/map/messages/commands/remove-image-layer.command.mjs +9 -0
- package/dist/esm2020/map/messages/commands/remove-raster-tile.command.mjs +9 -0
- package/dist/esm2020/map/ol-proxy.mjs +3 -0
- package/dist/esm2020/map/public-api.mjs +2 -2
- package/dist/esm2020/map/services/map-management.service.mjs +32 -8
- package/dist/esm2020/map/services/message-registrator.service.mjs +9 -1
- package/dist/esm2020/src/map/map-plate/layers/image-layer/image-layer-factory.mjs +26 -0
- package/dist/esm2020/src/map/map-plate/layers/image-layer/image-layer.component.mjs +49 -0
- package/dist/esm2020/src/map/map-plate/layers/image-layer/image-layer.settings.mjs +136 -0
- package/dist/esm2020/src/map/map-plate/layers/index.mjs +5 -1
- package/dist/esm2020/src/map/map-plate/layers/raster-tile/raster-tile-layer.component.mjs +49 -0
- package/dist/esm2020/src/map/map-plate/layers/raster-tile/raster-tile-layer.factory.mjs +74 -0
- package/dist/esm2020/src/map/map-plate/layers/raster-tile/raster-tile-layer.settings.mjs +151 -0
- package/dist/esm2020/src/map/map.module.mjs +13 -3
- package/dist/esm2020/src/map/messages/commands/add-image-layer.command.mjs +9 -0
- package/dist/esm2020/src/map/messages/commands/add-raster-tile-command.mjs +9 -0
- package/dist/esm2020/src/map/messages/commands/remove-image-layer.command.mjs +9 -0
- package/dist/esm2020/src/map/messages/commands/remove-raster-tile.command.mjs +9 -0
- package/dist/esm2020/src/map/ol-proxy.mjs +3 -0
- package/dist/esm2020/src/map/public-api.mjs +2 -2
- package/dist/esm2020/src/map/services/map-management.service.mjs +32 -8
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +9 -1
- package/dist/fesm2015/maps-components-src-map.mjs +532 -10
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +532 -10
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +532 -10
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +532 -10
- package/dist/fesm2020/maps-components.mjs.map +1 -1
- package/dist/map/map-plate/layers/image-layer/image-layer-factory.d.ts +9 -0
- package/dist/map/map-plate/layers/image-layer/image-layer.component.d.ts +22 -0
- package/dist/map/map-plate/layers/image-layer/image-layer.settings.d.ts +97 -0
- package/dist/map/map-plate/layers/index.d.ts +4 -0
- package/dist/map/map-plate/layers/raster-tile/raster-tile-layer.component.d.ts +21 -0
- package/dist/map/map-plate/layers/raster-tile/raster-tile-layer.factory.d.ts +12 -0
- package/dist/map/map-plate/layers/raster-tile/raster-tile-layer.settings.d.ts +108 -0
- package/dist/map/map.module.d.ts +4 -2
- package/dist/map/messages/commands/add-image-layer.command.d.ts +8 -0
- package/dist/map/messages/commands/add-raster-tile-command.d.ts +8 -0
- package/dist/map/messages/commands/remove-image-layer.command.d.ts +8 -0
- package/dist/map/messages/commands/remove-raster-tile.command.d.ts +8 -0
- package/dist/map/ol-proxy.d.ts +3 -0
- package/dist/map/public-api.d.ts +1 -1
- package/dist/map/services/map-management.service.d.ts +1 -1
- package/dist/package.json +1 -1
- package/dist/src/map/map-plate/layers/image-layer/image-layer-factory.d.ts +9 -0
- package/dist/src/map/map-plate/layers/image-layer/image-layer.component.d.ts +22 -0
- package/dist/src/map/map-plate/layers/image-layer/image-layer.settings.d.ts +97 -0
- package/dist/src/map/map-plate/layers/index.d.ts +4 -0
- package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.component.d.ts +21 -0
- package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.factory.d.ts +12 -0
- package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.settings.d.ts +108 -0
- package/dist/src/map/map.module.d.ts +4 -2
- package/dist/src/map/messages/commands/add-image-layer.command.d.ts +8 -0
- package/dist/src/map/messages/commands/add-raster-tile-command.d.ts +8 -0
- package/dist/src/map/messages/commands/remove-image-layer.command.d.ts +8 -0
- package/dist/src/map/messages/commands/remove-raster-tile.command.d.ts +8 -0
- package/dist/src/map/ol-proxy.d.ts +3 -0
- package/dist/src/map/public-api.d.ts +1 -1
- package/dist/src/map/services/map-management.service.d.ts +1 -1
- package/package.json +2 -2
|
@@ -3,6 +3,7 @@ import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgMod
|
|
|
3
3
|
import * as i4 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { Feature, Collection } from 'ol';
|
|
6
|
+
export { Feature } from 'ol';
|
|
6
7
|
import { Point, LineString } from 'ol/geom';
|
|
7
8
|
import { GeoJSON, WKT } from 'ol/format';
|
|
8
9
|
import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
@@ -22,6 +23,9 @@ import OSM from 'ol/source/OSM';
|
|
|
22
23
|
import { Vector as Vector$1 } from 'ol/layer';
|
|
23
24
|
import { bbox } from 'ol/loadingstrategy';
|
|
24
25
|
import Cluster from 'ol/source/Cluster';
|
|
26
|
+
import Static from 'ol/source/ImageStatic';
|
|
27
|
+
import ImageLayer from 'ol/layer/Image';
|
|
28
|
+
import RasterSource from 'ol/source/Raster';
|
|
25
29
|
import Map from 'ol/Map';
|
|
26
30
|
import View from 'ol/View';
|
|
27
31
|
import Overlay from 'ol/Overlay';
|
|
@@ -867,6 +871,38 @@ class ZoomControlFactory {
|
|
|
867
871
|
}
|
|
868
872
|
}
|
|
869
873
|
|
|
874
|
+
class AddImageLayerCommand extends PostboyGenericMessage {
|
|
875
|
+
constructor(layer) {
|
|
876
|
+
super();
|
|
877
|
+
this.layer = layer;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
AddImageLayerCommand.ID = '70f9b86f-8bc2-4f28-ae79-a13fc0b1ee5d';
|
|
881
|
+
|
|
882
|
+
class RemoveImageLayerCommand extends PostboyGenericMessage {
|
|
883
|
+
constructor(layer) {
|
|
884
|
+
super();
|
|
885
|
+
this.layer = layer;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
RemoveImageLayerCommand.ID = 'c8e7efdb-17ff-4cf9-89be-e688b8de3b95';
|
|
889
|
+
|
|
890
|
+
class AddRasterTileCommand extends PostboyGenericMessage {
|
|
891
|
+
constructor(layer) {
|
|
892
|
+
super();
|
|
893
|
+
this.layer = layer;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
AddRasterTileCommand.ID = 'd33447fe-eec0-4205-9b5d-0d79ddc74ad7';
|
|
897
|
+
|
|
898
|
+
class RemoveRasterTileCommand extends PostboyGenericMessage {
|
|
899
|
+
constructor(layer) {
|
|
900
|
+
super();
|
|
901
|
+
this.layer = layer;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
RemoveRasterTileCommand.ID = 'd1c4bf6a-e2f2-4385-a7a2-cecb525f8939';
|
|
905
|
+
|
|
870
906
|
class MapPostboyService extends PostboyService {
|
|
871
907
|
constructor() {
|
|
872
908
|
super();
|
|
@@ -894,27 +930,47 @@ class MapManagementService {
|
|
|
894
930
|
this.observeRemoveLayer();
|
|
895
931
|
this.observePlaceFeatures();
|
|
896
932
|
this.observeAddTile();
|
|
897
|
-
this.observeRemoveTile();
|
|
898
933
|
this.observeLayerQuery();
|
|
899
934
|
this.observeFeaturesInArea();
|
|
900
935
|
this.observeFeaturesInPoint();
|
|
936
|
+
this.observeImageLayer();
|
|
937
|
+
}
|
|
938
|
+
observeLayerQuery() {
|
|
939
|
+
this.postboy.sub(GetLayerQuery).subscribe((ev) => ev.finish(this.layers.take(ev.name)));
|
|
901
940
|
}
|
|
902
|
-
|
|
941
|
+
observeAddTile() {
|
|
942
|
+
this.postboy.sub(AddTileCommand).subscribe((c) => {
|
|
943
|
+
if (!this.map)
|
|
944
|
+
return;
|
|
945
|
+
this.map.addLayer(c.layer);
|
|
946
|
+
});
|
|
903
947
|
this.postboy.sub(RemoveTileCommand).subscribe((c) => {
|
|
904
948
|
if (!this.map)
|
|
905
949
|
return;
|
|
906
950
|
this.map.removeLayer(c.layer);
|
|
907
951
|
});
|
|
952
|
+
this.postboy.sub(AddRasterTileCommand).subscribe((c) => {
|
|
953
|
+
if (!this.map)
|
|
954
|
+
return;
|
|
955
|
+
this.map.addLayer(c.layer);
|
|
956
|
+
});
|
|
957
|
+
this.postboy.sub(RemoveRasterTileCommand).subscribe((c) => {
|
|
958
|
+
if (!this.map)
|
|
959
|
+
return;
|
|
960
|
+
this.map.removeLayer(c.layer);
|
|
961
|
+
});
|
|
908
962
|
}
|
|
909
|
-
|
|
910
|
-
this.postboy.sub(
|
|
911
|
-
}
|
|
912
|
-
observeAddTile() {
|
|
913
|
-
this.postboy.sub(AddTileCommand).subscribe((c) => {
|
|
963
|
+
observeImageLayer() {
|
|
964
|
+
this.postboy.sub(AddImageLayerCommand).subscribe((c) => {
|
|
914
965
|
if (!this.map)
|
|
915
966
|
return;
|
|
916
967
|
this.map.addLayer(c.layer);
|
|
917
968
|
});
|
|
969
|
+
this.postboy.sub(RemoveImageLayerCommand).subscribe((c) => {
|
|
970
|
+
if (!this.map)
|
|
971
|
+
return;
|
|
972
|
+
this.map.removeLayer(c.layer);
|
|
973
|
+
});
|
|
918
974
|
}
|
|
919
975
|
observeMapRender() {
|
|
920
976
|
this.postboy.sub(MapRenderedEvent).subscribe((m) => {
|
|
@@ -1360,6 +1416,10 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1360
1416
|
this.recordSubject(AddLayerCommand);
|
|
1361
1417
|
this.recordSubject(RemoveLayerCommand);
|
|
1362
1418
|
this.recordSubject(AddTileCommand);
|
|
1419
|
+
this.recordSubject(AddRasterTileCommand);
|
|
1420
|
+
this.recordSubject(RemoveRasterTileCommand);
|
|
1421
|
+
this.recordSubject(RemoveImageLayerCommand);
|
|
1422
|
+
this.recordSubject(AddImageLayerCommand);
|
|
1363
1423
|
this.recordSubject(RemoveTileCommand);
|
|
1364
1424
|
this.recordSubject(MapClickEvent);
|
|
1365
1425
|
this.recordSubject(CloseTooltipCommand);
|
|
@@ -2151,6 +2211,460 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2151
2211
|
type: Input
|
|
2152
2212
|
}] } });
|
|
2153
2213
|
|
|
2214
|
+
class ImageLayerSettings {
|
|
2215
|
+
constructor() {
|
|
2216
|
+
/**
|
|
2217
|
+
* Represents the tiles URL.
|
|
2218
|
+
* @typedef {string} url
|
|
2219
|
+
*
|
|
2220
|
+
* @example
|
|
2221
|
+
* 'https://example.ex/{z}/{x}/{y}.png'
|
|
2222
|
+
*/
|
|
2223
|
+
this.url = '';
|
|
2224
|
+
/**
|
|
2225
|
+
* Use interpolated values when resampling.
|
|
2226
|
+
* By default, linear interpolation is used when resampling.
|
|
2227
|
+
* Set to false to use the nearest neighbor instead.
|
|
2228
|
+
*/
|
|
2229
|
+
this.interpolate = undefined;
|
|
2230
|
+
/**
|
|
2231
|
+
* The projection of the coordinate system.
|
|
2232
|
+
*
|
|
2233
|
+
* @type {string}
|
|
2234
|
+
* @default 'EPSG:3857'
|
|
2235
|
+
*/
|
|
2236
|
+
this.projection = 'EPSG:3857';
|
|
2237
|
+
this.extent = [0, 0, 0, 0];
|
|
2238
|
+
/**
|
|
2239
|
+
* Additional headers that should be added to each tile request
|
|
2240
|
+
*
|
|
2241
|
+
* @type {Record<string, string>}
|
|
2242
|
+
* @default An empty array
|
|
2243
|
+
*/
|
|
2244
|
+
this.requestHeaders = null;
|
|
2245
|
+
}
|
|
2246
|
+
/**
|
|
2247
|
+
* Creates a copy of the given tile layer settings.
|
|
2248
|
+
*
|
|
2249
|
+
* @param {ImageLayerSettings} model - The tile layer settings to be copied.
|
|
2250
|
+
* @return {ImageLayerSettings} - A new instance of ImageLayerSettings with the same properties as the model.
|
|
2251
|
+
*/
|
|
2252
|
+
static copy(model) {
|
|
2253
|
+
const result = new ImageLayerSettings();
|
|
2254
|
+
result.interpolate = model.interpolate;
|
|
2255
|
+
result.projection = model.projection;
|
|
2256
|
+
result.extent = model.extent;
|
|
2257
|
+
result.url = model.url;
|
|
2258
|
+
result.requestHeaders = model.requestHeaders;
|
|
2259
|
+
return result;
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Sets the URL of the ImageLayerSettings object.
|
|
2263
|
+
*
|
|
2264
|
+
* @param {string} url - The URL to be set.
|
|
2265
|
+
* @return {ImageLayerSettings} - The updated ImageLayerSettings object.
|
|
2266
|
+
*/
|
|
2267
|
+
setUrl(url) {
|
|
2268
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { url }));
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Sets the interpolation state for the image layer settings.
|
|
2272
|
+
*
|
|
2273
|
+
* @param {boolean} [interpolate] - Use interpolated values when resampling.
|
|
2274
|
+
* By default, linear interpolation is used when resampling.
|
|
2275
|
+
* Set to false to use the nearest neighbor instead.
|
|
2276
|
+
* @return {ImageLayerSettings} A new instance of ImageLayerSettings with the updated interpolation setting.
|
|
2277
|
+
*/
|
|
2278
|
+
setInterpolate(interpolate) {
|
|
2279
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { interpolate }));
|
|
2280
|
+
}
|
|
2281
|
+
setExtent(extent) {
|
|
2282
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { extent }));
|
|
2283
|
+
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Sets the requestHeaders of the ImageLayerSettings object.
|
|
2286
|
+
*
|
|
2287
|
+
* @param {Record<string, string>} requestHeaders - The headers which should be provided.
|
|
2288
|
+
* @return {ImageLayerSettings} - The updated ImageLayerSettings object.
|
|
2289
|
+
*/
|
|
2290
|
+
setRequestHeaders(requestHeaders) {
|
|
2291
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { requestHeaders }));
|
|
2292
|
+
}
|
|
2293
|
+
/**
|
|
2294
|
+
* Sets the maximum zoom level for the tile layer.
|
|
2295
|
+
*
|
|
2296
|
+
* @param {number} maxZoom - The maximum zoom level.
|
|
2297
|
+
* @returns {ImageLayerSettings} - The updated tile layer settings object.
|
|
2298
|
+
*/
|
|
2299
|
+
setMaxZoom(maxZoom) {
|
|
2300
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Sets the minimum zoom level for the Tile Layer.
|
|
2304
|
+
*
|
|
2305
|
+
* @param {number} minZoom - The minimum zoom level to be set.
|
|
2306
|
+
* @return {ImageLayerSettings} The modified ImageLayerSettings object with the updated minimum zoom level.
|
|
2307
|
+
*/
|
|
2308
|
+
setMinZoom(minZoom) {
|
|
2309
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Sets the opacity of the ImageLayerSettings.
|
|
2313
|
+
*
|
|
2314
|
+
* @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
|
|
2315
|
+
* @return {ImageLayerSettings} - A new instance of ImageLayerSettings with the opacity set.
|
|
2316
|
+
*/
|
|
2317
|
+
setOpacity(opacity) {
|
|
2318
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity }));
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Sets the projection for the tile layer settings.
|
|
2322
|
+
*
|
|
2323
|
+
* @param {string} projection - The desired projection for the tile layer settings.
|
|
2324
|
+
* @return {ImageLayerSettings} - The updated tile layer settings with the new projection.
|
|
2325
|
+
*/
|
|
2326
|
+
setProjection(projection) {
|
|
2327
|
+
return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { projection }));
|
|
2328
|
+
}
|
|
2329
|
+
/**
|
|
2330
|
+
* Checks if the current instance of ImageLayerSettings is equal to the given model.
|
|
2331
|
+
* @param {ImageLayerSettings} model - The model to compare against.
|
|
2332
|
+
* @return {boolean} - True if all properties of the current instance matches the properties of the model;
|
|
2333
|
+
* otherwise, false.
|
|
2334
|
+
*/
|
|
2335
|
+
isSame(model) {
|
|
2336
|
+
if (this.url !== model.url)
|
|
2337
|
+
return false;
|
|
2338
|
+
if (this.projection !== model.projection)
|
|
2339
|
+
return false;
|
|
2340
|
+
if (this.extent !== model.extent)
|
|
2341
|
+
return false;
|
|
2342
|
+
if (this.interpolate !== model.interpolate)
|
|
2343
|
+
return false;
|
|
2344
|
+
if (this.requestHeaders !== model.requestHeaders)
|
|
2345
|
+
return false;
|
|
2346
|
+
return true;
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
class ImageLayerFactory {
|
|
2351
|
+
build(settings) {
|
|
2352
|
+
const source = new Static({
|
|
2353
|
+
url: settings.url,
|
|
2354
|
+
interpolate: settings.interpolate,
|
|
2355
|
+
crossOrigin: 'Anonymous',
|
|
2356
|
+
projection: get(settings.projection),
|
|
2357
|
+
imageExtent: settings.extent,
|
|
2358
|
+
});
|
|
2359
|
+
return new ImageLayer({ source });
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
ImageLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2363
|
+
ImageLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, providedIn: 'root' });
|
|
2364
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, decorators: [{
|
|
2365
|
+
type: Injectable,
|
|
2366
|
+
args: [{
|
|
2367
|
+
providedIn: 'root',
|
|
2368
|
+
}]
|
|
2369
|
+
}] });
|
|
2370
|
+
|
|
2371
|
+
class ImageLayerComponent extends DestructibleComponent {
|
|
2372
|
+
constructor(postboy, factory) {
|
|
2373
|
+
super();
|
|
2374
|
+
this.postboy = postboy;
|
|
2375
|
+
this.factory = factory;
|
|
2376
|
+
this._settings = new ImageLayerSettings();
|
|
2377
|
+
this.onDestroy = () => this.removeLayer();
|
|
2378
|
+
}
|
|
2379
|
+
set settings(value) {
|
|
2380
|
+
if (!value || this._settings.isSame(value))
|
|
2381
|
+
return;
|
|
2382
|
+
this._settings = value;
|
|
2383
|
+
this.initLayer();
|
|
2384
|
+
}
|
|
2385
|
+
ngOnInit() {
|
|
2386
|
+
this.postboy
|
|
2387
|
+
.sub(MapRenderedEvent)
|
|
2388
|
+
.pipe(filter((m) => !!m), first())
|
|
2389
|
+
.subscribe((m) => this.initLayer());
|
|
2390
|
+
}
|
|
2391
|
+
initLayer() {
|
|
2392
|
+
this.removeLayer();
|
|
2393
|
+
this.layer = this.factory.build(this._settings);
|
|
2394
|
+
this.postboy.fire(new AddImageLayerCommand(this.layer));
|
|
2395
|
+
}
|
|
2396
|
+
removeLayer() {
|
|
2397
|
+
if (this.layer)
|
|
2398
|
+
this.postboy.fire(new RemoveImageLayerCommand(this.layer));
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
ImageLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerComponent, deps: [{ token: MapPostboyService }, { token: ImageLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
2402
|
+
ImageLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ImageLayerComponent, selector: "art-image-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerComponent, decorators: [{
|
|
2404
|
+
type: Component,
|
|
2405
|
+
args: [{ selector: 'art-image-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
2406
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ImageLayerFactory }]; }, propDecorators: { settings: [{
|
|
2407
|
+
type: Input
|
|
2408
|
+
}] } });
|
|
2409
|
+
|
|
2410
|
+
class RasterTileLayerSettings {
|
|
2411
|
+
constructor() {
|
|
2412
|
+
/**
|
|
2413
|
+
* The maximum zoom level for a map view.
|
|
2414
|
+
*
|
|
2415
|
+
* @type {number}
|
|
2416
|
+
* @default 19
|
|
2417
|
+
*/
|
|
2418
|
+
this.maxZoom = 19;
|
|
2419
|
+
/**
|
|
2420
|
+
* The minimum zoom level allowed.
|
|
2421
|
+
*
|
|
2422
|
+
* @type {number}
|
|
2423
|
+
*/
|
|
2424
|
+
this.minZoom = 0;
|
|
2425
|
+
/**
|
|
2426
|
+
* The opacity of an element.
|
|
2427
|
+
*
|
|
2428
|
+
* @type {number}
|
|
2429
|
+
* @default 0.6
|
|
2430
|
+
*/
|
|
2431
|
+
this.opacity = 0.6;
|
|
2432
|
+
/**
|
|
2433
|
+
* Represents the tiles URL.
|
|
2434
|
+
* @typedef {string} url
|
|
2435
|
+
*
|
|
2436
|
+
* @example
|
|
2437
|
+
* 'https://example.ex/{z}/{x}/{y}.png'
|
|
2438
|
+
*/
|
|
2439
|
+
this.url = '';
|
|
2440
|
+
/**
|
|
2441
|
+
* The projection of the coordinate system.
|
|
2442
|
+
*
|
|
2443
|
+
* @type {string}
|
|
2444
|
+
* @default 'EPSG:3857'
|
|
2445
|
+
*/
|
|
2446
|
+
this.projection = 'EPSG:3857';
|
|
2447
|
+
/**
|
|
2448
|
+
* Additional headers that should be added to each tile request
|
|
2449
|
+
*
|
|
2450
|
+
* @type {Record<string, string>}
|
|
2451
|
+
* @default An empty array
|
|
2452
|
+
*/
|
|
2453
|
+
this.requestHeaders = null;
|
|
2454
|
+
this.operation = (d) => { var _a; return (_a = d[0]) !== null && _a !== void 0 ? _a : []; };
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* Creates a copy of the given tile layer settings.
|
|
2458
|
+
*
|
|
2459
|
+
* @param {RasterTileLayerSettings} model - The tile layer settings to be copied.
|
|
2460
|
+
* @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the same properties as the model.
|
|
2461
|
+
*/
|
|
2462
|
+
static copy(model) {
|
|
2463
|
+
const result = new RasterTileLayerSettings();
|
|
2464
|
+
result.maxZoom = model.maxZoom;
|
|
2465
|
+
result.minZoom = model.minZoom;
|
|
2466
|
+
result.projection = model.projection;
|
|
2467
|
+
result.opacity = model.opacity;
|
|
2468
|
+
result.url = model.url;
|
|
2469
|
+
result.requestHeaders = model.requestHeaders;
|
|
2470
|
+
result.operation = model.operation;
|
|
2471
|
+
return result;
|
|
2472
|
+
}
|
|
2473
|
+
/**
|
|
2474
|
+
* Sets the URL of the RasterTileLayerSettings object.
|
|
2475
|
+
*
|
|
2476
|
+
* @param {string} url - The URL to be set.
|
|
2477
|
+
* @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
|
|
2478
|
+
*/
|
|
2479
|
+
setUrl(url) {
|
|
2480
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { url }));
|
|
2481
|
+
}
|
|
2482
|
+
/**
|
|
2483
|
+
* Sets the operation to apply on raster tile data.
|
|
2484
|
+
*
|
|
2485
|
+
* @param {function} operation - A function that takes an input of either a two-dimensional array of numbers or an array of ImageData objects and returns either a one-dimensional array of numbers or an ImageData object.
|
|
2486
|
+
* @return {RasterTileLayerSettings} A new instance of RasterTileLayerSettings with the updated operation.
|
|
2487
|
+
*/
|
|
2488
|
+
setOperation(operation) {
|
|
2489
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { operation }));
|
|
2490
|
+
}
|
|
2491
|
+
/**
|
|
2492
|
+
* Sets the requestHeaders of the RasterTileLayerSettings object.
|
|
2493
|
+
*
|
|
2494
|
+
* @param {Record<string, string>} requestHeaders - The headers which should be provided.
|
|
2495
|
+
* @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
|
|
2496
|
+
*/
|
|
2497
|
+
setRequestHeaders(requestHeaders) {
|
|
2498
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { requestHeaders }));
|
|
2499
|
+
}
|
|
2500
|
+
/**
|
|
2501
|
+
* Sets the maximum zoom level for the tile layer.
|
|
2502
|
+
*
|
|
2503
|
+
* @param {number} maxZoom - The maximum zoom level.
|
|
2504
|
+
* @returns {RasterTileLayerSettings} - The updated tile layer settings object.
|
|
2505
|
+
*/
|
|
2506
|
+
setMaxZoom(maxZoom) {
|
|
2507
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
2508
|
+
}
|
|
2509
|
+
/**
|
|
2510
|
+
* Sets the minimum zoom level for the Tile Layer.
|
|
2511
|
+
*
|
|
2512
|
+
* @param {number} minZoom - The minimum zoom level to be set.
|
|
2513
|
+
* @return {RasterTileLayerSettings} The modified RasterTileLayerSettings object with the updated minimum zoom level.
|
|
2514
|
+
*/
|
|
2515
|
+
setMinZoom(minZoom) {
|
|
2516
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
2517
|
+
}
|
|
2518
|
+
/**
|
|
2519
|
+
* Sets the opacity of the RasterTileLayerSettings.
|
|
2520
|
+
*
|
|
2521
|
+
* @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
|
|
2522
|
+
* @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the opacity set.
|
|
2523
|
+
*/
|
|
2524
|
+
setOpacity(opacity) {
|
|
2525
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity }));
|
|
2526
|
+
}
|
|
2527
|
+
/**
|
|
2528
|
+
* Sets the projection for the tile layer settings.
|
|
2529
|
+
*
|
|
2530
|
+
* @param {string} projection - The desired projection for the tile layer settings.
|
|
2531
|
+
* @return {RasterTileLayerSettings} - The updated tile layer settings with the new projection.
|
|
2532
|
+
*/
|
|
2533
|
+
setProjection(projection) {
|
|
2534
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { projection }));
|
|
2535
|
+
}
|
|
2536
|
+
/**
|
|
2537
|
+
* Checks if the current instance of RasterTileLayerSettings is equal to the given model.
|
|
2538
|
+
* @param {RasterTileLayerSettings} model - The model to compare against.
|
|
2539
|
+
* @return {boolean} - True if all properties of the current instance matches the properties of the model;
|
|
2540
|
+
* otherwise, false.
|
|
2541
|
+
*/
|
|
2542
|
+
isSame(model) {
|
|
2543
|
+
if (this.maxZoom !== model.maxZoom)
|
|
2544
|
+
return false;
|
|
2545
|
+
if (this.minZoom !== model.minZoom)
|
|
2546
|
+
return false;
|
|
2547
|
+
if (this.url !== model.url)
|
|
2548
|
+
return false;
|
|
2549
|
+
if (this.projection !== model.projection)
|
|
2550
|
+
return false;
|
|
2551
|
+
if (this.opacity !== model.opacity)
|
|
2552
|
+
return false;
|
|
2553
|
+
if (this.requestHeaders !== model.requestHeaders)
|
|
2554
|
+
return false;
|
|
2555
|
+
if (this.operation !== model.operation)
|
|
2556
|
+
return false;
|
|
2557
|
+
return true;
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
class RasterTileLayerFactory {
|
|
2562
|
+
build(settings) {
|
|
2563
|
+
const source = new XYZ({
|
|
2564
|
+
tileSize: 256,
|
|
2565
|
+
maxZoom: settings.maxZoom || 14,
|
|
2566
|
+
minZoom: settings.minZoom || 1,
|
|
2567
|
+
projection: get(settings.projection),
|
|
2568
|
+
tileUrlFunction: this.getTileFunc(settings),
|
|
2569
|
+
crossOrigin: 'Anonymous',
|
|
2570
|
+
tileLoadFunction: !!settings.requestHeaders
|
|
2571
|
+
? (tile, src) => this.tileLoader(tile, src, settings.requestHeaders)
|
|
2572
|
+
: undefined,
|
|
2573
|
+
});
|
|
2574
|
+
const raster = new RasterSource({
|
|
2575
|
+
sources: [source],
|
|
2576
|
+
operationType: 'image',
|
|
2577
|
+
operation: settings.operation,
|
|
2578
|
+
});
|
|
2579
|
+
return new ImageLayer({ source: raster, opacity: settings.opacity });
|
|
2580
|
+
}
|
|
2581
|
+
getTileFunc(settings) {
|
|
2582
|
+
return (tileCoord) => {
|
|
2583
|
+
const zoom = tileCoord[0];
|
|
2584
|
+
const x = tileCoord[1];
|
|
2585
|
+
const y = tileCoord[2];
|
|
2586
|
+
const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
|
|
2587
|
+
const bound = 1 << zoom;
|
|
2588
|
+
return settings.url
|
|
2589
|
+
.replace('{x}', String((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.x) || x))
|
|
2590
|
+
.replace('{z}', String(zoom))
|
|
2591
|
+
.replace('{y}', String(bound - ((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.y) || y) - 1));
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
tileLoader(tile, src, headers) {
|
|
2595
|
+
const client = new XMLHttpRequest();
|
|
2596
|
+
client.open('GET', src);
|
|
2597
|
+
client.responseType = 'arraybuffer';
|
|
2598
|
+
Object.keys(headers).forEach((k) => client.setRequestHeader(k, headers[k]));
|
|
2599
|
+
client.onload = function () {
|
|
2600
|
+
if (this.response !== undefined) {
|
|
2601
|
+
const arrayBufferView = new Uint8Array(this.response);
|
|
2602
|
+
const blob = new Blob([arrayBufferView], { type: 'image/png' });
|
|
2603
|
+
const urlCreator = window.URL || window.webkitURL;
|
|
2604
|
+
tile.getImage().src = urlCreator.createObjectURL(blob);
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2607
|
+
client.send();
|
|
2608
|
+
}
|
|
2609
|
+
getNormalizedCoord(coord, zoom) {
|
|
2610
|
+
const y = coord.y;
|
|
2611
|
+
let x = coord.x;
|
|
2612
|
+
const tileRange = 1 << zoom;
|
|
2613
|
+
if (y < 0 || y >= tileRange)
|
|
2614
|
+
return null;
|
|
2615
|
+
if (x < 0 || x >= tileRange)
|
|
2616
|
+
x = ((x % tileRange) + tileRange) % tileRange;
|
|
2617
|
+
return { x: x, y: y };
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
RasterTileLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2621
|
+
RasterTileLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerFactory, providedIn: 'root' });
|
|
2622
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerFactory, decorators: [{
|
|
2623
|
+
type: Injectable,
|
|
2624
|
+
args: [{
|
|
2625
|
+
providedIn: 'root',
|
|
2626
|
+
}]
|
|
2627
|
+
}] });
|
|
2628
|
+
|
|
2629
|
+
class RasterTileLayerComponent extends DestructibleComponent {
|
|
2630
|
+
constructor(postboy, factory) {
|
|
2631
|
+
super();
|
|
2632
|
+
this.postboy = postboy;
|
|
2633
|
+
this.factory = factory;
|
|
2634
|
+
this._settings = new RasterTileLayerSettings();
|
|
2635
|
+
this.onDestroy = () => this.removeLayer();
|
|
2636
|
+
}
|
|
2637
|
+
set settings(value) {
|
|
2638
|
+
if (!value || this._settings.isSame(value))
|
|
2639
|
+
return;
|
|
2640
|
+
this._settings = value;
|
|
2641
|
+
this.initLayer();
|
|
2642
|
+
}
|
|
2643
|
+
ngOnInit() {
|
|
2644
|
+
this.postboy
|
|
2645
|
+
.sub(MapRenderedEvent)
|
|
2646
|
+
.pipe(filter((m) => !!m), first())
|
|
2647
|
+
.subscribe((m) => this.initLayer());
|
|
2648
|
+
}
|
|
2649
|
+
initLayer() {
|
|
2650
|
+
this.removeLayer();
|
|
2651
|
+
this.layer = this.factory.build(this._settings);
|
|
2652
|
+
this.postboy.fire(new AddRasterTileCommand(this.layer));
|
|
2653
|
+
}
|
|
2654
|
+
removeLayer() {
|
|
2655
|
+
if (this.layer)
|
|
2656
|
+
this.postboy.fire(new RemoveRasterTileCommand(this.layer));
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
RasterTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerComponent, deps: [{ token: MapPostboyService }, { token: RasterTileLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
2660
|
+
RasterTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: RasterTileLayerComponent, selector: "art-raster-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2661
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerComponent, decorators: [{
|
|
2662
|
+
type: Component,
|
|
2663
|
+
args: [{ selector: 'art-raster-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
2664
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: RasterTileLayerFactory }]; }, propDecorators: { settings: [{
|
|
2665
|
+
type: Input
|
|
2666
|
+
}] } });
|
|
2667
|
+
|
|
2154
2668
|
class MapPlateFactory {
|
|
2155
2669
|
build(settings) {
|
|
2156
2670
|
return new Map({
|
|
@@ -2628,14 +3142,18 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
|
|
|
2628
3142
|
TooltipComponent,
|
|
2629
3143
|
PolygonsComponent,
|
|
2630
3144
|
ClusterLayerComponent,
|
|
2631
|
-
MapControlZoomComponent
|
|
3145
|
+
MapControlZoomComponent,
|
|
3146
|
+
ImageLayerComponent,
|
|
3147
|
+
RasterTileLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
|
|
2632
3148
|
FeatureLayerComponent,
|
|
2633
3149
|
MarkersComponent,
|
|
2634
3150
|
TileLayerComponent,
|
|
2635
3151
|
TooltipComponent,
|
|
2636
3152
|
PolygonsComponent,
|
|
2637
3153
|
ClusterLayerComponent,
|
|
2638
|
-
MapControlZoomComponent
|
|
3154
|
+
MapControlZoomComponent,
|
|
3155
|
+
ImageLayerComponent,
|
|
3156
|
+
RasterTileLayerComponent] });
|
|
2639
3157
|
MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
|
|
2640
3158
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
|
|
2641
3159
|
type: NgModule,
|
|
@@ -2652,6 +3170,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2652
3170
|
PolygonsComponent,
|
|
2653
3171
|
ClusterLayerComponent,
|
|
2654
3172
|
MapControlZoomComponent,
|
|
3173
|
+
ImageLayerComponent,
|
|
3174
|
+
RasterTileLayerComponent,
|
|
2655
3175
|
],
|
|
2656
3176
|
exports: [
|
|
2657
3177
|
MapPlateComponent,
|
|
@@ -2662,6 +3182,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2662
3182
|
PolygonsComponent,
|
|
2663
3183
|
ClusterLayerComponent,
|
|
2664
3184
|
MapControlZoomComponent,
|
|
3185
|
+
ImageLayerComponent,
|
|
3186
|
+
RasterTileLayerComponent,
|
|
2665
3187
|
],
|
|
2666
3188
|
}]
|
|
2667
3189
|
}] });
|
|
@@ -2858,5 +3380,5 @@ class StringifyFeatureHelper {
|
|
|
2858
3380
|
* Generated bundle index. Do not edit.
|
|
2859
3381
|
*/
|
|
2860
3382
|
|
|
2861
|
-
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, PolygonSelfIntersectionExecutor, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
3383
|
+
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, ImageLayerComponent, ImageLayerSettings, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapModule, 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 };
|
|
2862
3384
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|