@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.
Files changed (78) hide show
  1. package/dist/esm2020/map/helpers/text-style.helper.mjs +15 -7
  2. package/dist/esm2020/map/map-plate/layers/index.mjs +3 -1
  3. package/dist/esm2020/map/map-plate/layers/raster-tile/raster-tile-layer.component.mjs +49 -0
  4. package/dist/esm2020/map/map-plate/layers/raster-tile/raster-tile-layer.factory.mjs +74 -0
  5. package/dist/esm2020/map/map-plate/layers/raster-tile/raster-tile-layer.settings.mjs +151 -0
  6. package/dist/esm2020/map/map.module.mjs +8 -3
  7. package/dist/esm2020/map/messages/commands/add-raster-tile-command.mjs +9 -0
  8. package/dist/esm2020/map/messages/commands/remove-raster-tile.command.mjs +9 -0
  9. package/dist/esm2020/map/messages/commands/start-drawing.command.mjs +1 -1
  10. package/dist/esm2020/map/messages/executors/generate-draw.executor.mjs +1 -1
  11. package/dist/esm2020/map/messages/executors/get-geometry-length.executor.mjs +16 -0
  12. package/dist/esm2020/map/messages/index.mjs +2 -1
  13. package/dist/esm2020/map/models/drawing-type.enum.mjs +2 -1
  14. package/dist/esm2020/map/ol-proxy.mjs +6 -0
  15. package/dist/esm2020/map/public-api.mjs +2 -2
  16. package/dist/esm2020/map/services/drawing/drawing-generation.service.mjs +2 -2
  17. package/dist/esm2020/map/services/map-management.service.mjs +18 -9
  18. package/dist/esm2020/map/services/message-registrator.service.mjs +7 -1
  19. package/dist/esm2020/src/map/helpers/text-style.helper.mjs +15 -7
  20. package/dist/esm2020/src/map/map-plate/layers/index.mjs +3 -1
  21. package/dist/esm2020/src/map/map-plate/layers/raster-tile/raster-tile-layer.component.mjs +49 -0
  22. package/dist/esm2020/src/map/map-plate/layers/raster-tile/raster-tile-layer.factory.mjs +74 -0
  23. package/dist/esm2020/src/map/map-plate/layers/raster-tile/raster-tile-layer.settings.mjs +151 -0
  24. package/dist/esm2020/src/map/map.module.mjs +8 -3
  25. package/dist/esm2020/src/map/messages/commands/add-raster-tile-command.mjs +9 -0
  26. package/dist/esm2020/src/map/messages/commands/remove-raster-tile.command.mjs +9 -0
  27. package/dist/esm2020/src/map/messages/commands/start-drawing.command.mjs +1 -1
  28. package/dist/esm2020/src/map/messages/executors/generate-draw.executor.mjs +1 -1
  29. package/dist/esm2020/src/map/messages/executors/get-geometry-length.executor.mjs +16 -0
  30. package/dist/esm2020/src/map/messages/index.mjs +2 -1
  31. package/dist/esm2020/src/map/models/drawing-type.enum.mjs +2 -1
  32. package/dist/esm2020/src/map/ol-proxy.mjs +6 -0
  33. package/dist/esm2020/src/map/public-api.mjs +2 -2
  34. package/dist/esm2020/src/map/services/drawing/drawing-generation.service.mjs +2 -2
  35. package/dist/esm2020/src/map/services/map-management.service.mjs +18 -9
  36. package/dist/esm2020/src/map/services/message-registrator.service.mjs +7 -1
  37. package/dist/fesm2015/maps-components-src-map.mjs +340 -23
  38. package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
  39. package/dist/fesm2015/maps-components.mjs +340 -23
  40. package/dist/fesm2015/maps-components.mjs.map +1 -1
  41. package/dist/fesm2020/maps-components-src-map.mjs +340 -23
  42. package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
  43. package/dist/fesm2020/maps-components.mjs +340 -23
  44. package/dist/fesm2020/maps-components.mjs.map +1 -1
  45. package/dist/map/helpers/text-style.helper.d.ts +10 -6
  46. package/dist/map/map-plate/layers/index.d.ts +2 -0
  47. package/dist/map/map-plate/layers/raster-tile/raster-tile-layer.component.d.ts +21 -0
  48. package/dist/map/map-plate/layers/raster-tile/raster-tile-layer.factory.d.ts +12 -0
  49. package/dist/map/map-plate/layers/raster-tile/raster-tile-layer.settings.d.ts +108 -0
  50. package/dist/map/map.module.d.ts +3 -2
  51. package/dist/map/messages/commands/add-raster-tile-command.d.ts +8 -0
  52. package/dist/map/messages/commands/remove-raster-tile.command.d.ts +8 -0
  53. package/dist/map/messages/commands/start-drawing.command.d.ts +3 -3
  54. package/dist/map/messages/executors/generate-draw.executor.d.ts +3 -3
  55. package/dist/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  56. package/dist/map/messages/index.d.ts +1 -0
  57. package/dist/map/models/drawing-type.enum.d.ts +2 -1
  58. package/dist/map/ol-proxy.d.ts +7 -0
  59. package/dist/map/public-api.d.ts +1 -1
  60. package/dist/map/services/map-management.service.d.ts +0 -1
  61. package/dist/package.json +1 -1
  62. package/dist/src/map/helpers/text-style.helper.d.ts +10 -6
  63. package/dist/src/map/map-plate/layers/index.d.ts +2 -0
  64. package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.component.d.ts +21 -0
  65. package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.factory.d.ts +12 -0
  66. package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.settings.d.ts +108 -0
  67. package/dist/src/map/map.module.d.ts +3 -2
  68. package/dist/src/map/messages/commands/add-raster-tile-command.d.ts +8 -0
  69. package/dist/src/map/messages/commands/remove-raster-tile.command.d.ts +8 -0
  70. package/dist/src/map/messages/commands/start-drawing.command.d.ts +3 -3
  71. package/dist/src/map/messages/executors/generate-draw.executor.d.ts +3 -3
  72. package/dist/src/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  73. package/dist/src/map/messages/index.d.ts +1 -0
  74. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  75. package/dist/src/map/ol-proxy.d.ts +7 -0
  76. package/dist/src/map/public-api.d.ts +1 -1
  77. package/dist/src/map/services/map-management.service.d.ts +0 -1
  78. 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() {
@@ -268,6 +274,7 @@ var DrawingType;
268
274
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
269
275
  DrawingType[DrawingType["Square"] = 3] = "Square";
270
276
  DrawingType[DrawingType["Box"] = 4] = "Box";
277
+ DrawingType[DrawingType["LineString"] = 5] = "LineString";
271
278
  })(DrawingType || (DrawingType = {}));
272
279
 
273
280
  /**
@@ -688,6 +695,20 @@ class FitToFeaturesCommand extends PostboyGenericMessage {
688
695
  }
689
696
  FitToFeaturesCommand.ID = '04d67609-0b4c-4f52-aa53-ad0a3db967dc';
690
697
 
698
+ class GetGeometryLengthExecutor extends PostboyExecutor {
699
+ constructor(geometry, projection = 'EPSG:4326') {
700
+ super();
701
+ this.geometry = geometry;
702
+ this.projection = projection;
703
+ }
704
+ }
705
+ GetGeometryLengthExecutor.ID = '763146df-6d93-4dc2-a532-0e9ba2b2d023';
706
+ class GetGeometryLengthExecutorHandler {
707
+ handle(executor) {
708
+ return Math.round(getLength(executor.geometry, { projection: executor.projection }) * 100) / 100;
709
+ }
710
+ }
711
+
691
712
  class AddLayerCommand extends PostboyGenericMessage {
692
713
  constructor(layer) {
693
714
  super();
@@ -745,7 +766,7 @@ class DrawingGenerationService {
745
766
  static getDraw(ev) {
746
767
  return new Draw({
747
768
  source: ev.layer.getSource(),
748
- type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
769
+ type: ev.type === DrawingType.Polygon ? 'Polygon' : ev.type === DrawingType.LineString ? 'LineString' : 'Circle',
749
770
  style: ev.style,
750
771
  geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
751
772
  });
@@ -884,6 +905,22 @@ class RemoveImageLayerCommand extends PostboyGenericMessage {
884
905
  }
885
906
  RemoveImageLayerCommand.ID = 'c8e7efdb-17ff-4cf9-89be-e688b8de3b95';
886
907
 
908
+ class AddRasterTileCommand extends PostboyGenericMessage {
909
+ constructor(layer) {
910
+ super();
911
+ this.layer = layer;
912
+ }
913
+ }
914
+ AddRasterTileCommand.ID = 'd33447fe-eec0-4205-9b5d-0d79ddc74ad7';
915
+
916
+ class RemoveRasterTileCommand extends PostboyGenericMessage {
917
+ constructor(layer) {
918
+ super();
919
+ this.layer = layer;
920
+ }
921
+ }
922
+ RemoveRasterTileCommand.ID = 'd1c4bf6a-e2f2-4385-a7a2-cecb525f8939';
923
+
887
924
  class MapPostboyService extends PostboyService {
888
925
  constructor() {
889
926
  super();
@@ -911,19 +948,11 @@ class MapManagementService {
911
948
  this.observeRemoveLayer();
912
949
  this.observePlaceFeatures();
913
950
  this.observeAddTile();
914
- this.observeRemoveTile();
915
951
  this.observeLayerQuery();
916
952
  this.observeFeaturesInArea();
917
953
  this.observeFeaturesInPoint();
918
954
  this.observeImageLayer();
919
955
  }
920
- observeRemoveTile() {
921
- this.postboy.sub(RemoveTileCommand).subscribe((c) => {
922
- if (!this.map)
923
- return;
924
- this.map.removeLayer(c.layer);
925
- });
926
- }
927
956
  observeLayerQuery() {
928
957
  this.postboy.sub(GetLayerQuery).subscribe((ev) => ev.finish(this.layers.take(ev.name)));
929
958
  }
@@ -933,6 +962,21 @@ class MapManagementService {
933
962
  return;
934
963
  this.map.addLayer(c.layer);
935
964
  });
965
+ this.postboy.sub(RemoveTileCommand).subscribe((c) => {
966
+ if (!this.map)
967
+ return;
968
+ this.map.removeLayer(c.layer);
969
+ });
970
+ this.postboy.sub(AddRasterTileCommand).subscribe((c) => {
971
+ if (!this.map)
972
+ return;
973
+ this.map.addLayer(c.layer);
974
+ });
975
+ this.postboy.sub(RemoveRasterTileCommand).subscribe((c) => {
976
+ if (!this.map)
977
+ return;
978
+ this.map.removeLayer(c.layer);
979
+ });
936
980
  }
937
981
  observeImageLayer() {
938
982
  this.postboy.sub(AddImageLayerCommand).subscribe((c) => {
@@ -1376,6 +1420,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1376
1420
  this.recordSubject(AddLayerCommand);
1377
1421
  this.recordSubject(RemoveLayerCommand);
1378
1422
  this.recordSubject(AddTileCommand);
1423
+ this.recordSubject(AddRasterTileCommand);
1424
+ this.recordSubject(RemoveRasterTileCommand);
1379
1425
  this.recordSubject(RemoveImageLayerCommand);
1380
1426
  this.recordSubject(AddImageLayerCommand);
1381
1427
  this.recordSubject(RemoveTileCommand);
@@ -1405,6 +1451,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1405
1451
  this.recordExecutor(GenerateDrawExecutor, (e) => DrawingGenerationService.getDraw(e));
1406
1452
  this.recordExecutor(GenerateZoomControlExecutor, (e) => ZoomControlFactory.build(e.settings));
1407
1453
  this.recordExecutor(GetMapPositionExecutor, () => this.state.getMapPosition());
1454
+ this.recordExecutor(GetGeometryLengthExecutor, (e) => new GetGeometryLengthExecutorHandler().handle(e));
1408
1455
  }
1409
1456
  }
1410
1457
  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 });
@@ -2360,6 +2407,264 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2360
2407
  type: Input
2361
2408
  }] } });
2362
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) => d[0] ?? [];
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({ ...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({ ...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({ ...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({ ...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({ ...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({ ...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({ ...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?.x || x))
2590
+ .replace('{z}', String(zoom))
2591
+ .replace('{y}', String(bound - (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
+
2363
2668
  class MapPlateFactory {
2364
2669
  build(settings) {
2365
2670
  return new Map({
@@ -2835,7 +3140,8 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
2835
3140
  PolygonsComponent,
2836
3141
  ClusterLayerComponent,
2837
3142
  MapControlZoomComponent,
2838
- ImageLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
3143
+ ImageLayerComponent,
3144
+ RasterTileLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
2839
3145
  FeatureLayerComponent,
2840
3146
  MarkersComponent,
2841
3147
  TileLayerComponent,
@@ -2843,7 +3149,8 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
2843
3149
  PolygonsComponent,
2844
3150
  ClusterLayerComponent,
2845
3151
  MapControlZoomComponent,
2846
- ImageLayerComponent] });
3152
+ ImageLayerComponent,
3153
+ RasterTileLayerComponent] });
2847
3154
  MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
2848
3155
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
2849
3156
  type: NgModule,
@@ -2861,6 +3168,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2861
3168
  ClusterLayerComponent,
2862
3169
  MapControlZoomComponent,
2863
3170
  ImageLayerComponent,
3171
+ RasterTileLayerComponent,
2864
3172
  ],
2865
3173
  exports: [
2866
3174
  MapPlateComponent,
@@ -2872,6 +3180,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2872
3180
  ClusterLayerComponent,
2873
3181
  MapControlZoomComponent,
2874
3182
  ImageLayerComponent,
3183
+ RasterTileLayerComponent,
2875
3184
  ],
2876
3185
  }]
2877
3186
  }] });
@@ -2909,7 +3218,7 @@ class MarkerStyleHelper {
2909
3218
  */
2910
3219
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
2911
3220
  return new Style({
2912
- image: new Circle({
3221
+ image: new Circle$1({
2913
3222
  radius,
2914
3223
  fill: new Fill({ color: fill }),
2915
3224
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -2964,7 +3273,7 @@ class PolygonStyleHelper {
2964
3273
  */
2965
3274
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
2966
3275
  return new Style({
2967
- image: new Circle({
3276
+ image: new Circle$1({
2968
3277
  fill: new Fill({
2969
3278
  color: stroke,
2970
3279
  }),
@@ -2986,14 +3295,18 @@ class PolygonStyleHelper {
2986
3295
  */
2987
3296
  class TextStyleHelper {
2988
3297
  /**
2989
- * Creates a new instance of the Text class with the specified properties.
3298
+ * Creates and returns a new Text instance with specified styling properties.
2990
3299
  *
2991
- * @param {string} text - The text content of the Text object.
2992
- * @param {string} font - The font style of the Text object.
2993
- * @param {string} color - The color of the Text object.
2994
- * @return {Text} A new instance of the Text class.
3300
+ * @param {string} text - The text content to display.
3301
+ * @param {string} font - The font style to use for the text.
3302
+ * @param {string} color - The color of the text.
3303
+ * @param {string|null|undefined} [backColor] - The background color of the text. Optional.
3304
+ * @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
3305
+ * @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
3306
+ * @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
3307
+ * @return {Text} A new Text instance configured with the specified properties.
2995
3308
  */
2996
- static get(text, font, color) {
3309
+ static get(text, font, color, backColor, padding, textBaseline, offsetY) {
2997
3310
  return new Text({
2998
3311
  text: text,
2999
3312
  font: font,
@@ -3001,6 +3314,10 @@ class TextStyleHelper {
3001
3314
  fill: new Fill({
3002
3315
  color: color,
3003
3316
  }),
3317
+ backgroundFill: backColor ? new Fill({ color: backColor }) : undefined,
3318
+ padding: padding ?? undefined,
3319
+ textBaseline: textBaseline ?? undefined,
3320
+ offsetY: offsetY ?? undefined,
3004
3321
  });
3005
3322
  }
3006
3323
  }
@@ -3068,5 +3385,5 @@ class StringifyFeatureHelper {
3068
3385
  * Generated bundle index. Do not edit.
3069
3386
  */
3070
3387
 
3071
- 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 };
3388
+ 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 };
3072
3389
  //# sourceMappingURL=maps-components-src-map.mjs.map