@artstesh/maps 4.1.27 → 4.1.29
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/helpers/text-style.helper.mjs +15 -7
- package/dist/esm2020/map/map-plate/layers/index.mjs +3 -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 +8 -3
- package/dist/esm2020/map/messages/commands/add-raster-tile-command.mjs +9 -0
- package/dist/esm2020/map/messages/commands/remove-raster-tile.command.mjs +9 -0
- package/dist/esm2020/map/messages/commands/start-drawing.command.mjs +1 -1
- package/dist/esm2020/map/messages/executors/generate-draw.executor.mjs +1 -1
- package/dist/esm2020/map/messages/executors/get-geometry-length.executor.mjs +16 -0
- package/dist/esm2020/map/messages/index.mjs +2 -1
- package/dist/esm2020/map/models/drawing-type.enum.mjs +2 -1
- package/dist/esm2020/map/ol-proxy.mjs +6 -0
- package/dist/esm2020/map/public-api.mjs +2 -2
- package/dist/esm2020/map/services/drawing/drawing-generation.service.mjs +2 -2
- package/dist/esm2020/map/services/map-management.service.mjs +18 -9
- package/dist/esm2020/map/services/message-registrator.service.mjs +7 -1
- package/dist/esm2020/src/map/helpers/text-style.helper.mjs +15 -7
- package/dist/esm2020/src/map/map-plate/layers/index.mjs +3 -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 +8 -3
- package/dist/esm2020/src/map/messages/commands/add-raster-tile-command.mjs +9 -0
- package/dist/esm2020/src/map/messages/commands/remove-raster-tile.command.mjs +9 -0
- package/dist/esm2020/src/map/messages/commands/start-drawing.command.mjs +1 -1
- package/dist/esm2020/src/map/messages/executors/generate-draw.executor.mjs +1 -1
- package/dist/esm2020/src/map/messages/executors/get-geometry-length.executor.mjs +16 -0
- package/dist/esm2020/src/map/messages/index.mjs +2 -1
- package/dist/esm2020/src/map/models/drawing-type.enum.mjs +2 -1
- package/dist/esm2020/src/map/ol-proxy.mjs +6 -0
- package/dist/esm2020/src/map/public-api.mjs +2 -2
- package/dist/esm2020/src/map/services/drawing/drawing-generation.service.mjs +2 -2
- package/dist/esm2020/src/map/services/map-management.service.mjs +18 -9
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +7 -1
- package/dist/fesm2015/maps-components-src-map.mjs +340 -23
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +340 -23
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +340 -23
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +340 -23
- package/dist/fesm2020/maps-components.mjs.map +1 -1
- package/dist/map/helpers/text-style.helper.d.ts +10 -6
- package/dist/map/map-plate/layers/index.d.ts +2 -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 +3 -2
- package/dist/map/messages/commands/add-raster-tile-command.d.ts +8 -0
- package/dist/map/messages/commands/remove-raster-tile.command.d.ts +8 -0
- package/dist/map/messages/commands/start-drawing.command.d.ts +3 -3
- package/dist/map/messages/executors/generate-draw.executor.d.ts +3 -3
- package/dist/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
- package/dist/map/messages/index.d.ts +1 -0
- package/dist/map/models/drawing-type.enum.d.ts +2 -1
- package/dist/map/ol-proxy.d.ts +7 -0
- package/dist/map/public-api.d.ts +1 -1
- package/dist/map/services/map-management.service.d.ts +0 -1
- package/dist/package.json +1 -1
- package/dist/src/map/helpers/text-style.helper.d.ts +10 -6
- package/dist/src/map/map-plate/layers/index.d.ts +2 -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 +3 -2
- package/dist/src/map/messages/commands/add-raster-tile-command.d.ts +8 -0
- package/dist/src/map/messages/commands/remove-raster-tile.command.d.ts +8 -0
- package/dist/src/map/messages/commands/start-drawing.command.d.ts +3 -3
- package/dist/src/map/messages/executors/generate-draw.executor.d.ts +3 -3
- package/dist/src/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
- package/dist/src/map/messages/index.d.ts +1 -0
- package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
- package/dist/src/map/ol-proxy.d.ts +7 -0
- package/dist/src/map/public-api.d.ts +1 -1
- package/dist/src/map/services/map-management.service.d.ts +0 -1
- package/package.json +2 -2
|
@@ -3,16 +3,19 @@ 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';
|
|
8
|
+
export { Geometry, LineString, Point } from 'ol/geom';
|
|
7
9
|
import { GeoJSON, WKT } from 'ol/format';
|
|
8
10
|
import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
9
11
|
import Polygon, { circular, fromExtent } from 'ol/geom/Polygon';
|
|
10
12
|
import { Control, Zoom } from 'ol/control';
|
|
11
13
|
import { get, useGeographic, transform } from 'ol/proj';
|
|
12
14
|
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
15
|
+
import * as Sphere from 'ol/sphere';
|
|
16
|
+
import { getLength } from 'ol/sphere';
|
|
13
17
|
import { Draw, Modify, Translate, defaults } from 'ol/interaction';
|
|
14
18
|
import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
|
|
15
|
-
import * as Sphere from 'ol/sphere';
|
|
16
19
|
import { Subject, combineLatest } from 'rxjs';
|
|
17
20
|
import { first, debounceTime, filter, auditTime } from 'rxjs/operators';
|
|
18
21
|
import { Dictionary } from '@artstesh/collections';
|
|
@@ -24,13 +27,16 @@ import { bbox } from 'ol/loadingstrategy';
|
|
|
24
27
|
import Cluster from 'ol/source/Cluster';
|
|
25
28
|
import Static from 'ol/source/ImageStatic';
|
|
26
29
|
import ImageLayer from 'ol/layer/Image';
|
|
30
|
+
import RasterSource from 'ol/source/Raster';
|
|
27
31
|
import Map from 'ol/Map';
|
|
28
32
|
import View from 'ol/View';
|
|
29
33
|
import Overlay from 'ol/Overlay';
|
|
30
34
|
import Style from 'ol/style/Style';
|
|
31
|
-
import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
|
|
32
|
-
export { Style } from 'ol/style';
|
|
35
|
+
import { Icon, Circle as Circle$1, Fill, Stroke, Text } from 'ol/style';
|
|
36
|
+
export { Fill, RegularShape, Stroke, Style, Text } from 'ol/style';
|
|
33
37
|
import { METERS_PER_UNIT } from 'ol/proj/epsg4326';
|
|
38
|
+
import * as Circle from 'ol/style/Circle';
|
|
39
|
+
export { Circle as CircleStyle };
|
|
34
40
|
|
|
35
41
|
class DestructibleComponent {
|
|
36
42
|
constructor() {
|
|
@@ -269,6 +275,7 @@ var DrawingType;
|
|
|
269
275
|
DrawingType[DrawingType["Circle"] = 2] = "Circle";
|
|
270
276
|
DrawingType[DrawingType["Square"] = 3] = "Square";
|
|
271
277
|
DrawingType[DrawingType["Box"] = 4] = "Box";
|
|
278
|
+
DrawingType[DrawingType["LineString"] = 5] = "LineString";
|
|
272
279
|
})(DrawingType || (DrawingType = {}));
|
|
273
280
|
|
|
274
281
|
/**
|
|
@@ -689,6 +696,20 @@ class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
|
689
696
|
}
|
|
690
697
|
FitToFeaturesCommand.ID = '04d67609-0b4c-4f52-aa53-ad0a3db967dc';
|
|
691
698
|
|
|
699
|
+
class GetGeometryLengthExecutor extends PostboyExecutor {
|
|
700
|
+
constructor(geometry, projection = 'EPSG:4326') {
|
|
701
|
+
super();
|
|
702
|
+
this.geometry = geometry;
|
|
703
|
+
this.projection = projection;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
GetGeometryLengthExecutor.ID = '763146df-6d93-4dc2-a532-0e9ba2b2d023';
|
|
707
|
+
class GetGeometryLengthExecutorHandler {
|
|
708
|
+
handle(executor) {
|
|
709
|
+
return Math.round(getLength(executor.geometry, { projection: executor.projection }) * 100) / 100;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
692
713
|
class AddLayerCommand extends PostboyGenericMessage {
|
|
693
714
|
constructor(layer) {
|
|
694
715
|
super();
|
|
@@ -746,7 +767,7 @@ class DrawingGenerationService {
|
|
|
746
767
|
static getDraw(ev) {
|
|
747
768
|
return new Draw({
|
|
748
769
|
source: ev.layer.getSource(),
|
|
749
|
-
type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
|
|
770
|
+
type: ev.type === DrawingType.Polygon ? 'Polygon' : ev.type === DrawingType.LineString ? 'LineString' : 'Circle',
|
|
750
771
|
style: ev.style,
|
|
751
772
|
geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
|
|
752
773
|
});
|
|
@@ -885,6 +906,22 @@ class RemoveImageLayerCommand extends PostboyGenericMessage {
|
|
|
885
906
|
}
|
|
886
907
|
RemoveImageLayerCommand.ID = 'c8e7efdb-17ff-4cf9-89be-e688b8de3b95';
|
|
887
908
|
|
|
909
|
+
class AddRasterTileCommand extends PostboyGenericMessage {
|
|
910
|
+
constructor(layer) {
|
|
911
|
+
super();
|
|
912
|
+
this.layer = layer;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
AddRasterTileCommand.ID = 'd33447fe-eec0-4205-9b5d-0d79ddc74ad7';
|
|
916
|
+
|
|
917
|
+
class RemoveRasterTileCommand extends PostboyGenericMessage {
|
|
918
|
+
constructor(layer) {
|
|
919
|
+
super();
|
|
920
|
+
this.layer = layer;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
RemoveRasterTileCommand.ID = 'd1c4bf6a-e2f2-4385-a7a2-cecb525f8939';
|
|
924
|
+
|
|
888
925
|
class MapPostboyService extends PostboyService {
|
|
889
926
|
constructor() {
|
|
890
927
|
super();
|
|
@@ -912,19 +949,11 @@ class MapManagementService {
|
|
|
912
949
|
this.observeRemoveLayer();
|
|
913
950
|
this.observePlaceFeatures();
|
|
914
951
|
this.observeAddTile();
|
|
915
|
-
this.observeRemoveTile();
|
|
916
952
|
this.observeLayerQuery();
|
|
917
953
|
this.observeFeaturesInArea();
|
|
918
954
|
this.observeFeaturesInPoint();
|
|
919
955
|
this.observeImageLayer();
|
|
920
956
|
}
|
|
921
|
-
observeRemoveTile() {
|
|
922
|
-
this.postboy.sub(RemoveTileCommand).subscribe((c) => {
|
|
923
|
-
if (!this.map)
|
|
924
|
-
return;
|
|
925
|
-
this.map.removeLayer(c.layer);
|
|
926
|
-
});
|
|
927
|
-
}
|
|
928
957
|
observeLayerQuery() {
|
|
929
958
|
this.postboy.sub(GetLayerQuery).subscribe((ev) => ev.finish(this.layers.take(ev.name)));
|
|
930
959
|
}
|
|
@@ -934,6 +963,21 @@ class MapManagementService {
|
|
|
934
963
|
return;
|
|
935
964
|
this.map.addLayer(c.layer);
|
|
936
965
|
});
|
|
966
|
+
this.postboy.sub(RemoveTileCommand).subscribe((c) => {
|
|
967
|
+
if (!this.map)
|
|
968
|
+
return;
|
|
969
|
+
this.map.removeLayer(c.layer);
|
|
970
|
+
});
|
|
971
|
+
this.postboy.sub(AddRasterTileCommand).subscribe((c) => {
|
|
972
|
+
if (!this.map)
|
|
973
|
+
return;
|
|
974
|
+
this.map.addLayer(c.layer);
|
|
975
|
+
});
|
|
976
|
+
this.postboy.sub(RemoveRasterTileCommand).subscribe((c) => {
|
|
977
|
+
if (!this.map)
|
|
978
|
+
return;
|
|
979
|
+
this.map.removeLayer(c.layer);
|
|
980
|
+
});
|
|
937
981
|
}
|
|
938
982
|
observeImageLayer() {
|
|
939
983
|
this.postboy.sub(AddImageLayerCommand).subscribe((c) => {
|
|
@@ -1391,6 +1435,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1391
1435
|
this.recordSubject(AddLayerCommand);
|
|
1392
1436
|
this.recordSubject(RemoveLayerCommand);
|
|
1393
1437
|
this.recordSubject(AddTileCommand);
|
|
1438
|
+
this.recordSubject(AddRasterTileCommand);
|
|
1439
|
+
this.recordSubject(RemoveRasterTileCommand);
|
|
1394
1440
|
this.recordSubject(RemoveImageLayerCommand);
|
|
1395
1441
|
this.recordSubject(AddImageLayerCommand);
|
|
1396
1442
|
this.recordSubject(RemoveTileCommand);
|
|
@@ -1420,6 +1466,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1420
1466
|
this.recordExecutor(GenerateDrawExecutor, (e) => DrawingGenerationService.getDraw(e));
|
|
1421
1467
|
this.recordExecutor(GenerateZoomControlExecutor, (e) => ZoomControlFactory.build(e.settings));
|
|
1422
1468
|
this.recordExecutor(GetMapPositionExecutor, () => this.state.getMapPosition());
|
|
1469
|
+
this.recordExecutor(GetGeometryLengthExecutor, (e) => new GetGeometryLengthExecutorHandler().handle(e));
|
|
1423
1470
|
}
|
|
1424
1471
|
}
|
|
1425
1472
|
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: FeatureModificationService }, { token: ControlsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -2380,6 +2427,264 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2380
2427
|
type: Input
|
|
2381
2428
|
}] } });
|
|
2382
2429
|
|
|
2430
|
+
class RasterTileLayerSettings {
|
|
2431
|
+
constructor() {
|
|
2432
|
+
/**
|
|
2433
|
+
* The maximum zoom level for a map view.
|
|
2434
|
+
*
|
|
2435
|
+
* @type {number}
|
|
2436
|
+
* @default 19
|
|
2437
|
+
*/
|
|
2438
|
+
this.maxZoom = 19;
|
|
2439
|
+
/**
|
|
2440
|
+
* The minimum zoom level allowed.
|
|
2441
|
+
*
|
|
2442
|
+
* @type {number}
|
|
2443
|
+
*/
|
|
2444
|
+
this.minZoom = 0;
|
|
2445
|
+
/**
|
|
2446
|
+
* The opacity of an element.
|
|
2447
|
+
*
|
|
2448
|
+
* @type {number}
|
|
2449
|
+
* @default 0.6
|
|
2450
|
+
*/
|
|
2451
|
+
this.opacity = 0.6;
|
|
2452
|
+
/**
|
|
2453
|
+
* Represents the tiles URL.
|
|
2454
|
+
* @typedef {string} url
|
|
2455
|
+
*
|
|
2456
|
+
* @example
|
|
2457
|
+
* 'https://example.ex/{z}/{x}/{y}.png'
|
|
2458
|
+
*/
|
|
2459
|
+
this.url = '';
|
|
2460
|
+
/**
|
|
2461
|
+
* The projection of the coordinate system.
|
|
2462
|
+
*
|
|
2463
|
+
* @type {string}
|
|
2464
|
+
* @default 'EPSG:3857'
|
|
2465
|
+
*/
|
|
2466
|
+
this.projection = 'EPSG:3857';
|
|
2467
|
+
/**
|
|
2468
|
+
* Additional headers that should be added to each tile request
|
|
2469
|
+
*
|
|
2470
|
+
* @type {Record<string, string>}
|
|
2471
|
+
* @default An empty array
|
|
2472
|
+
*/
|
|
2473
|
+
this.requestHeaders = null;
|
|
2474
|
+
this.operation = (d) => { var _a; return (_a = d[0]) !== null && _a !== void 0 ? _a : []; };
|
|
2475
|
+
}
|
|
2476
|
+
/**
|
|
2477
|
+
* Creates a copy of the given tile layer settings.
|
|
2478
|
+
*
|
|
2479
|
+
* @param {RasterTileLayerSettings} model - The tile layer settings to be copied.
|
|
2480
|
+
* @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the same properties as the model.
|
|
2481
|
+
*/
|
|
2482
|
+
static copy(model) {
|
|
2483
|
+
const result = new RasterTileLayerSettings();
|
|
2484
|
+
result.maxZoom = model.maxZoom;
|
|
2485
|
+
result.minZoom = model.minZoom;
|
|
2486
|
+
result.projection = model.projection;
|
|
2487
|
+
result.opacity = model.opacity;
|
|
2488
|
+
result.url = model.url;
|
|
2489
|
+
result.requestHeaders = model.requestHeaders;
|
|
2490
|
+
result.operation = model.operation;
|
|
2491
|
+
return result;
|
|
2492
|
+
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Sets the URL of the RasterTileLayerSettings object.
|
|
2495
|
+
*
|
|
2496
|
+
* @param {string} url - The URL to be set.
|
|
2497
|
+
* @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
|
|
2498
|
+
*/
|
|
2499
|
+
setUrl(url) {
|
|
2500
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { url }));
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Sets the operation to apply on raster tile data.
|
|
2504
|
+
*
|
|
2505
|
+
* @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.
|
|
2506
|
+
* @return {RasterTileLayerSettings} A new instance of RasterTileLayerSettings with the updated operation.
|
|
2507
|
+
*/
|
|
2508
|
+
setOperation(operation) {
|
|
2509
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { operation }));
|
|
2510
|
+
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Sets the requestHeaders of the RasterTileLayerSettings object.
|
|
2513
|
+
*
|
|
2514
|
+
* @param {Record<string, string>} requestHeaders - The headers which should be provided.
|
|
2515
|
+
* @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
|
|
2516
|
+
*/
|
|
2517
|
+
setRequestHeaders(requestHeaders) {
|
|
2518
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { requestHeaders }));
|
|
2519
|
+
}
|
|
2520
|
+
/**
|
|
2521
|
+
* Sets the maximum zoom level for the tile layer.
|
|
2522
|
+
*
|
|
2523
|
+
* @param {number} maxZoom - The maximum zoom level.
|
|
2524
|
+
* @returns {RasterTileLayerSettings} - The updated tile layer settings object.
|
|
2525
|
+
*/
|
|
2526
|
+
setMaxZoom(maxZoom) {
|
|
2527
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
2528
|
+
}
|
|
2529
|
+
/**
|
|
2530
|
+
* Sets the minimum zoom level for the Tile Layer.
|
|
2531
|
+
*
|
|
2532
|
+
* @param {number} minZoom - The minimum zoom level to be set.
|
|
2533
|
+
* @return {RasterTileLayerSettings} The modified RasterTileLayerSettings object with the updated minimum zoom level.
|
|
2534
|
+
*/
|
|
2535
|
+
setMinZoom(minZoom) {
|
|
2536
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
2537
|
+
}
|
|
2538
|
+
/**
|
|
2539
|
+
* Sets the opacity of the RasterTileLayerSettings.
|
|
2540
|
+
*
|
|
2541
|
+
* @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
|
|
2542
|
+
* @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the opacity set.
|
|
2543
|
+
*/
|
|
2544
|
+
setOpacity(opacity) {
|
|
2545
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity }));
|
|
2546
|
+
}
|
|
2547
|
+
/**
|
|
2548
|
+
* Sets the projection for the tile layer settings.
|
|
2549
|
+
*
|
|
2550
|
+
* @param {string} projection - The desired projection for the tile layer settings.
|
|
2551
|
+
* @return {RasterTileLayerSettings} - The updated tile layer settings with the new projection.
|
|
2552
|
+
*/
|
|
2553
|
+
setProjection(projection) {
|
|
2554
|
+
return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { projection }));
|
|
2555
|
+
}
|
|
2556
|
+
/**
|
|
2557
|
+
* Checks if the current instance of RasterTileLayerSettings is equal to the given model.
|
|
2558
|
+
* @param {RasterTileLayerSettings} model - The model to compare against.
|
|
2559
|
+
* @return {boolean} - True if all properties of the current instance matches the properties of the model;
|
|
2560
|
+
* otherwise, false.
|
|
2561
|
+
*/
|
|
2562
|
+
isSame(model) {
|
|
2563
|
+
if (this.maxZoom !== model.maxZoom)
|
|
2564
|
+
return false;
|
|
2565
|
+
if (this.minZoom !== model.minZoom)
|
|
2566
|
+
return false;
|
|
2567
|
+
if (this.url !== model.url)
|
|
2568
|
+
return false;
|
|
2569
|
+
if (this.projection !== model.projection)
|
|
2570
|
+
return false;
|
|
2571
|
+
if (this.opacity !== model.opacity)
|
|
2572
|
+
return false;
|
|
2573
|
+
if (this.requestHeaders !== model.requestHeaders)
|
|
2574
|
+
return false;
|
|
2575
|
+
if (this.operation !== model.operation)
|
|
2576
|
+
return false;
|
|
2577
|
+
return true;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
class RasterTileLayerFactory {
|
|
2582
|
+
build(settings) {
|
|
2583
|
+
const source = new XYZ({
|
|
2584
|
+
tileSize: 256,
|
|
2585
|
+
maxZoom: settings.maxZoom || 14,
|
|
2586
|
+
minZoom: settings.minZoom || 1,
|
|
2587
|
+
projection: get(settings.projection),
|
|
2588
|
+
tileUrlFunction: this.getTileFunc(settings),
|
|
2589
|
+
crossOrigin: 'Anonymous',
|
|
2590
|
+
tileLoadFunction: !!settings.requestHeaders
|
|
2591
|
+
? (tile, src) => this.tileLoader(tile, src, settings.requestHeaders)
|
|
2592
|
+
: undefined,
|
|
2593
|
+
});
|
|
2594
|
+
const raster = new RasterSource({
|
|
2595
|
+
sources: [source],
|
|
2596
|
+
operationType: 'image',
|
|
2597
|
+
operation: settings.operation,
|
|
2598
|
+
});
|
|
2599
|
+
return new ImageLayer({ source: raster, opacity: settings.opacity });
|
|
2600
|
+
}
|
|
2601
|
+
getTileFunc(settings) {
|
|
2602
|
+
return (tileCoord) => {
|
|
2603
|
+
const zoom = tileCoord[0];
|
|
2604
|
+
const x = tileCoord[1];
|
|
2605
|
+
const y = tileCoord[2];
|
|
2606
|
+
const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
|
|
2607
|
+
const bound = 1 << zoom;
|
|
2608
|
+
return settings.url
|
|
2609
|
+
.replace('{x}', String((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.x) || x))
|
|
2610
|
+
.replace('{z}', String(zoom))
|
|
2611
|
+
.replace('{y}', String(bound - ((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.y) || y) - 1));
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
tileLoader(tile, src, headers) {
|
|
2615
|
+
const client = new XMLHttpRequest();
|
|
2616
|
+
client.open('GET', src);
|
|
2617
|
+
client.responseType = 'arraybuffer';
|
|
2618
|
+
Object.keys(headers).forEach((k) => client.setRequestHeader(k, headers[k]));
|
|
2619
|
+
client.onload = function () {
|
|
2620
|
+
if (this.response !== undefined) {
|
|
2621
|
+
const arrayBufferView = new Uint8Array(this.response);
|
|
2622
|
+
const blob = new Blob([arrayBufferView], { type: 'image/png' });
|
|
2623
|
+
const urlCreator = window.URL || window.webkitURL;
|
|
2624
|
+
tile.getImage().src = urlCreator.createObjectURL(blob);
|
|
2625
|
+
}
|
|
2626
|
+
};
|
|
2627
|
+
client.send();
|
|
2628
|
+
}
|
|
2629
|
+
getNormalizedCoord(coord, zoom) {
|
|
2630
|
+
const y = coord.y;
|
|
2631
|
+
let x = coord.x;
|
|
2632
|
+
const tileRange = 1 << zoom;
|
|
2633
|
+
if (y < 0 || y >= tileRange)
|
|
2634
|
+
return null;
|
|
2635
|
+
if (x < 0 || x >= tileRange)
|
|
2636
|
+
x = ((x % tileRange) + tileRange) % tileRange;
|
|
2637
|
+
return { x: x, y: y };
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
RasterTileLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2641
|
+
RasterTileLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerFactory, providedIn: 'root' });
|
|
2642
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerFactory, decorators: [{
|
|
2643
|
+
type: Injectable,
|
|
2644
|
+
args: [{
|
|
2645
|
+
providedIn: 'root',
|
|
2646
|
+
}]
|
|
2647
|
+
}] });
|
|
2648
|
+
|
|
2649
|
+
class RasterTileLayerComponent extends DestructibleComponent {
|
|
2650
|
+
constructor(postboy, factory) {
|
|
2651
|
+
super();
|
|
2652
|
+
this.postboy = postboy;
|
|
2653
|
+
this.factory = factory;
|
|
2654
|
+
this._settings = new RasterTileLayerSettings();
|
|
2655
|
+
this.onDestroy = () => this.removeLayer();
|
|
2656
|
+
}
|
|
2657
|
+
set settings(value) {
|
|
2658
|
+
if (!value || this._settings.isSame(value))
|
|
2659
|
+
return;
|
|
2660
|
+
this._settings = value;
|
|
2661
|
+
this.initLayer();
|
|
2662
|
+
}
|
|
2663
|
+
ngOnInit() {
|
|
2664
|
+
this.postboy
|
|
2665
|
+
.sub(MapRenderedEvent)
|
|
2666
|
+
.pipe(filter((m) => !!m), first())
|
|
2667
|
+
.subscribe((m) => this.initLayer());
|
|
2668
|
+
}
|
|
2669
|
+
initLayer() {
|
|
2670
|
+
this.removeLayer();
|
|
2671
|
+
this.layer = this.factory.build(this._settings);
|
|
2672
|
+
this.postboy.fire(new AddRasterTileCommand(this.layer));
|
|
2673
|
+
}
|
|
2674
|
+
removeLayer() {
|
|
2675
|
+
if (this.layer)
|
|
2676
|
+
this.postboy.fire(new RemoveRasterTileCommand(this.layer));
|
|
2677
|
+
}
|
|
2678
|
+
}
|
|
2679
|
+
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 });
|
|
2680
|
+
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 });
|
|
2681
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RasterTileLayerComponent, decorators: [{
|
|
2682
|
+
type: Component,
|
|
2683
|
+
args: [{ selector: 'art-raster-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
2684
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: RasterTileLayerFactory }]; }, propDecorators: { settings: [{
|
|
2685
|
+
type: Input
|
|
2686
|
+
}] } });
|
|
2687
|
+
|
|
2383
2688
|
class MapPlateFactory {
|
|
2384
2689
|
build(settings) {
|
|
2385
2690
|
return new Map({
|
|
@@ -2858,7 +3163,8 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
|
|
|
2858
3163
|
PolygonsComponent,
|
|
2859
3164
|
ClusterLayerComponent,
|
|
2860
3165
|
MapControlZoomComponent,
|
|
2861
|
-
ImageLayerComponent
|
|
3166
|
+
ImageLayerComponent,
|
|
3167
|
+
RasterTileLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
|
|
2862
3168
|
FeatureLayerComponent,
|
|
2863
3169
|
MarkersComponent,
|
|
2864
3170
|
TileLayerComponent,
|
|
@@ -2866,7 +3172,8 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
|
|
|
2866
3172
|
PolygonsComponent,
|
|
2867
3173
|
ClusterLayerComponent,
|
|
2868
3174
|
MapControlZoomComponent,
|
|
2869
|
-
ImageLayerComponent
|
|
3175
|
+
ImageLayerComponent,
|
|
3176
|
+
RasterTileLayerComponent] });
|
|
2870
3177
|
MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
|
|
2871
3178
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
|
|
2872
3179
|
type: NgModule,
|
|
@@ -2884,6 +3191,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2884
3191
|
ClusterLayerComponent,
|
|
2885
3192
|
MapControlZoomComponent,
|
|
2886
3193
|
ImageLayerComponent,
|
|
3194
|
+
RasterTileLayerComponent,
|
|
2887
3195
|
],
|
|
2888
3196
|
exports: [
|
|
2889
3197
|
MapPlateComponent,
|
|
@@ -2895,6 +3203,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2895
3203
|
ClusterLayerComponent,
|
|
2896
3204
|
MapControlZoomComponent,
|
|
2897
3205
|
ImageLayerComponent,
|
|
3206
|
+
RasterTileLayerComponent,
|
|
2898
3207
|
],
|
|
2899
3208
|
}]
|
|
2900
3209
|
}] });
|
|
@@ -2932,7 +3241,7 @@ class MarkerStyleHelper {
|
|
|
2932
3241
|
*/
|
|
2933
3242
|
static circle(radius, fill, strokeColor, strokeWidth = 1) {
|
|
2934
3243
|
return new Style({
|
|
2935
|
-
image: new Circle({
|
|
3244
|
+
image: new Circle$1({
|
|
2936
3245
|
radius,
|
|
2937
3246
|
fill: new Fill({ color: fill }),
|
|
2938
3247
|
stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
|
|
@@ -2987,7 +3296,7 @@ class PolygonStyleHelper {
|
|
|
2987
3296
|
*/
|
|
2988
3297
|
static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
|
|
2989
3298
|
return new Style({
|
|
2990
|
-
image: new Circle({
|
|
3299
|
+
image: new Circle$1({
|
|
2991
3300
|
fill: new Fill({
|
|
2992
3301
|
color: stroke,
|
|
2993
3302
|
}),
|
|
@@ -3009,14 +3318,18 @@ class PolygonStyleHelper {
|
|
|
3009
3318
|
*/
|
|
3010
3319
|
class TextStyleHelper {
|
|
3011
3320
|
/**
|
|
3012
|
-
* Creates a new
|
|
3321
|
+
* Creates and returns a new Text instance with specified styling properties.
|
|
3013
3322
|
*
|
|
3014
|
-
* @param {string} text - The text content
|
|
3015
|
-
* @param {string} font - The font style
|
|
3016
|
-
* @param {string} color - The color of the
|
|
3017
|
-
* @
|
|
3323
|
+
* @param {string} text - The text content to display.
|
|
3324
|
+
* @param {string} font - The font style to use for the text.
|
|
3325
|
+
* @param {string} color - The color of the text.
|
|
3326
|
+
* @param {string|null|undefined} [backColor] - The background color of the text. Optional.
|
|
3327
|
+
* @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
|
|
3328
|
+
* @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
|
|
3329
|
+
* @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
|
|
3330
|
+
* @return {Text} A new Text instance configured with the specified properties.
|
|
3018
3331
|
*/
|
|
3019
|
-
static get(text, font, color) {
|
|
3332
|
+
static get(text, font, color, backColor, padding, textBaseline, offsetY) {
|
|
3020
3333
|
return new Text({
|
|
3021
3334
|
text: text,
|
|
3022
3335
|
font: font,
|
|
@@ -3024,6 +3337,10 @@ class TextStyleHelper {
|
|
|
3024
3337
|
fill: new Fill({
|
|
3025
3338
|
color: color,
|
|
3026
3339
|
}),
|
|
3340
|
+
backgroundFill: backColor ? new Fill({ color: backColor }) : undefined,
|
|
3341
|
+
padding: padding !== null && padding !== void 0 ? padding : undefined,
|
|
3342
|
+
textBaseline: textBaseline !== null && textBaseline !== void 0 ? textBaseline : undefined,
|
|
3343
|
+
offsetY: offsetY !== null && offsetY !== void 0 ? offsetY : undefined,
|
|
3027
3344
|
});
|
|
3028
3345
|
}
|
|
3029
3346
|
}
|
|
@@ -3095,5 +3412,5 @@ class StringifyFeatureHelper {
|
|
|
3095
3412
|
* Generated bundle index. Do not edit.
|
|
3096
3413
|
*/
|
|
3097
3414
|
|
|
3098
|
-
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, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
3415
|
+
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, 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 };
|
|
3099
3416
|
//# sourceMappingURL=maps-components.mjs.map
|