@artstesh/maps 1.1.26 → 1.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.
Files changed (77) hide show
  1. package/dist/bundles/maps-components-src-map.umd.js +402 -22
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +402 -22
  4. package/dist/bundles/maps-components.umd.js.map +1 -1
  5. package/dist/esm2015/map/helpers/text-style.helper.js +15 -7
  6. package/dist/esm2015/map/map-plate/layers/index.js +3 -1
  7. package/dist/esm2015/map/map-plate/layers/raster-tile/raster-tile-layer.component.js +54 -0
  8. package/dist/esm2015/map/map-plate/layers/raster-tile/raster-tile-layer.factory.js +74 -0
  9. package/dist/esm2015/map/map-plate/layers/raster-tile/raster-tile-layer.settings.js +151 -0
  10. package/dist/esm2015/map/map.module.js +8 -3
  11. package/dist/esm2015/map/messages/commands/add-raster-tile-command.js +9 -0
  12. package/dist/esm2015/map/messages/commands/remove-raster-tile.command.js +9 -0
  13. package/dist/esm2015/map/messages/commands/start-drawing.command.js +1 -1
  14. package/dist/esm2015/map/messages/executors/generate-draw.executor.js +1 -1
  15. package/dist/esm2015/map/messages/executors/get-geometry-length.executor.js +16 -0
  16. package/dist/esm2015/map/messages/index.js +2 -1
  17. package/dist/esm2015/map/models/drawing-type.enum.js +2 -1
  18. package/dist/esm2015/map/ol-proxy.js +6 -0
  19. package/dist/esm2015/map/public-api.js +2 -2
  20. package/dist/esm2015/map/services/drawing/drawing-generation.service.js +2 -2
  21. package/dist/esm2015/map/services/map-management.service.js +18 -9
  22. package/dist/esm2015/map/services/message-registrator.service.js +7 -1
  23. package/dist/esm2015/src/map/helpers/text-style.helper.js +15 -7
  24. package/dist/esm2015/src/map/map-plate/layers/index.js +3 -1
  25. package/dist/esm2015/src/map/map-plate/layers/raster-tile/raster-tile-layer.component.js +54 -0
  26. package/dist/esm2015/src/map/map-plate/layers/raster-tile/raster-tile-layer.factory.js +74 -0
  27. package/dist/esm2015/src/map/map-plate/layers/raster-tile/raster-tile-layer.settings.js +151 -0
  28. package/dist/esm2015/src/map/map.module.js +8 -3
  29. package/dist/esm2015/src/map/messages/commands/add-raster-tile-command.js +9 -0
  30. package/dist/esm2015/src/map/messages/commands/remove-raster-tile.command.js +9 -0
  31. package/dist/esm2015/src/map/messages/commands/start-drawing.command.js +1 -1
  32. package/dist/esm2015/src/map/messages/executors/generate-draw.executor.js +1 -1
  33. package/dist/esm2015/src/map/messages/executors/get-geometry-length.executor.js +16 -0
  34. package/dist/esm2015/src/map/messages/index.js +2 -1
  35. package/dist/esm2015/src/map/models/drawing-type.enum.js +2 -1
  36. package/dist/esm2015/src/map/ol-proxy.js +6 -0
  37. package/dist/esm2015/src/map/public-api.js +2 -2
  38. package/dist/esm2015/src/map/services/drawing/drawing-generation.service.js +2 -2
  39. package/dist/esm2015/src/map/services/map-management.service.js +18 -9
  40. package/dist/esm2015/src/map/services/message-registrator.service.js +7 -1
  41. package/dist/fesm2015/maps-components-src-map.js +345 -23
  42. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  43. package/dist/fesm2015/maps-components.js +345 -23
  44. package/dist/fesm2015/maps-components.js.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/src/map/helpers/text-style.helper.d.ts +10 -6
  62. package/dist/src/map/map-plate/layers/index.d.ts +2 -0
  63. package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.component.d.ts +21 -0
  64. package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.factory.d.ts +12 -0
  65. package/dist/src/map/map-plate/layers/raster-tile/raster-tile-layer.settings.d.ts +108 -0
  66. package/dist/src/map/map.module.d.ts +3 -2
  67. package/dist/src/map/messages/commands/add-raster-tile-command.d.ts +8 -0
  68. package/dist/src/map/messages/commands/remove-raster-tile.command.d.ts +8 -0
  69. package/dist/src/map/messages/commands/start-drawing.command.d.ts +3 -3
  70. package/dist/src/map/messages/executors/generate-draw.executor.d.ts +3 -3
  71. package/dist/src/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  72. package/dist/src/map/messages/index.d.ts +1 -0
  73. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  74. package/dist/src/map/ol-proxy.d.ts +7 -0
  75. package/dist/src/map/public-api.d.ts +1 -1
  76. package/dist/src/map/services/map-management.service.d.ts +0 -1
  77. package/package.json +2 -2
@@ -3,16 +3,19 @@ import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgMod
3
3
  import * as i6 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) => {
@@ -1392,6 +1436,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1392
1436
  this.recordSubject(AddLayerCommand);
1393
1437
  this.recordSubject(RemoveLayerCommand);
1394
1438
  this.recordSubject(AddTileCommand);
1439
+ this.recordSubject(AddRasterTileCommand);
1440
+ this.recordSubject(RemoveRasterTileCommand);
1395
1441
  this.recordSubject(RemoveImageLayerCommand);
1396
1442
  this.recordSubject(AddImageLayerCommand);
1397
1443
  this.recordSubject(RemoveTileCommand);
@@ -1421,6 +1467,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1421
1467
  this.recordExecutor(GenerateDrawExecutor, (e) => DrawingGenerationService.getDraw(e));
1422
1468
  this.recordExecutor(GenerateZoomControlExecutor, (e) => ZoomControlFactory.build(e.settings));
1423
1469
  this.recordExecutor(GetMapPositionExecutor, () => this.state.getMapPosition());
1470
+ this.recordExecutor(GetGeometryLengthExecutor, (e) => new GetGeometryLengthExecutorHandler().handle(e));
1424
1471
  }
1425
1472
  }
1426
1473
  MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", 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 });
@@ -2406,6 +2453,269 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
2406
2453
  type: Input
2407
2454
  }] } });
2408
2455
 
2456
+ class RasterTileLayerSettings {
2457
+ constructor() {
2458
+ /**
2459
+ * The maximum zoom level for a map view.
2460
+ *
2461
+ * @type {number}
2462
+ * @default 19
2463
+ */
2464
+ this.maxZoom = 19;
2465
+ /**
2466
+ * The minimum zoom level allowed.
2467
+ *
2468
+ * @type {number}
2469
+ */
2470
+ this.minZoom = 0;
2471
+ /**
2472
+ * The opacity of an element.
2473
+ *
2474
+ * @type {number}
2475
+ * @default 0.6
2476
+ */
2477
+ this.opacity = 0.6;
2478
+ /**
2479
+ * Represents the tiles URL.
2480
+ * @typedef {string} url
2481
+ *
2482
+ * @example
2483
+ * 'https://example.ex/{z}/{x}/{y}.png'
2484
+ */
2485
+ this.url = '';
2486
+ /**
2487
+ * The projection of the coordinate system.
2488
+ *
2489
+ * @type {string}
2490
+ * @default 'EPSG:3857'
2491
+ */
2492
+ this.projection = 'EPSG:3857';
2493
+ /**
2494
+ * Additional headers that should be added to each tile request
2495
+ *
2496
+ * @type {Record<string, string>}
2497
+ * @default An empty array
2498
+ */
2499
+ this.requestHeaders = null;
2500
+ this.operation = (d) => { var _a; return (_a = d[0]) !== null && _a !== void 0 ? _a : []; };
2501
+ }
2502
+ /**
2503
+ * Creates a copy of the given tile layer settings.
2504
+ *
2505
+ * @param {RasterTileLayerSettings} model - The tile layer settings to be copied.
2506
+ * @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the same properties as the model.
2507
+ */
2508
+ static copy(model) {
2509
+ const result = new RasterTileLayerSettings();
2510
+ result.maxZoom = model.maxZoom;
2511
+ result.minZoom = model.minZoom;
2512
+ result.projection = model.projection;
2513
+ result.opacity = model.opacity;
2514
+ result.url = model.url;
2515
+ result.requestHeaders = model.requestHeaders;
2516
+ result.operation = model.operation;
2517
+ return result;
2518
+ }
2519
+ /**
2520
+ * Sets the URL of the RasterTileLayerSettings object.
2521
+ *
2522
+ * @param {string} url - The URL to be set.
2523
+ * @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
2524
+ */
2525
+ setUrl(url) {
2526
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { url }));
2527
+ }
2528
+ /**
2529
+ * Sets the operation to apply on raster tile data.
2530
+ *
2531
+ * @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.
2532
+ * @return {RasterTileLayerSettings} A new instance of RasterTileLayerSettings with the updated operation.
2533
+ */
2534
+ setOperation(operation) {
2535
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { operation }));
2536
+ }
2537
+ /**
2538
+ * Sets the requestHeaders of the RasterTileLayerSettings object.
2539
+ *
2540
+ * @param {Record<string, string>} requestHeaders - The headers which should be provided.
2541
+ * @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
2542
+ */
2543
+ setRequestHeaders(requestHeaders) {
2544
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { requestHeaders }));
2545
+ }
2546
+ /**
2547
+ * Sets the maximum zoom level for the tile layer.
2548
+ *
2549
+ * @param {number} maxZoom - The maximum zoom level.
2550
+ * @returns {RasterTileLayerSettings} - The updated tile layer settings object.
2551
+ */
2552
+ setMaxZoom(maxZoom) {
2553
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
2554
+ }
2555
+ /**
2556
+ * Sets the minimum zoom level for the Tile Layer.
2557
+ *
2558
+ * @param {number} minZoom - The minimum zoom level to be set.
2559
+ * @return {RasterTileLayerSettings} The modified RasterTileLayerSettings object with the updated minimum zoom level.
2560
+ */
2561
+ setMinZoom(minZoom) {
2562
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
2563
+ }
2564
+ /**
2565
+ * Sets the opacity of the RasterTileLayerSettings.
2566
+ *
2567
+ * @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
2568
+ * @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the opacity set.
2569
+ */
2570
+ setOpacity(opacity) {
2571
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity }));
2572
+ }
2573
+ /**
2574
+ * Sets the projection for the tile layer settings.
2575
+ *
2576
+ * @param {string} projection - The desired projection for the tile layer settings.
2577
+ * @return {RasterTileLayerSettings} - The updated tile layer settings with the new projection.
2578
+ */
2579
+ setProjection(projection) {
2580
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { projection }));
2581
+ }
2582
+ /**
2583
+ * Checks if the current instance of RasterTileLayerSettings is equal to the given model.
2584
+ * @param {RasterTileLayerSettings} model - The model to compare against.
2585
+ * @return {boolean} - True if all properties of the current instance matches the properties of the model;
2586
+ * otherwise, false.
2587
+ */
2588
+ isSame(model) {
2589
+ if (this.maxZoom !== model.maxZoom)
2590
+ return false;
2591
+ if (this.minZoom !== model.minZoom)
2592
+ return false;
2593
+ if (this.url !== model.url)
2594
+ return false;
2595
+ if (this.projection !== model.projection)
2596
+ return false;
2597
+ if (this.opacity !== model.opacity)
2598
+ return false;
2599
+ if (this.requestHeaders !== model.requestHeaders)
2600
+ return false;
2601
+ if (this.operation !== model.operation)
2602
+ return false;
2603
+ return true;
2604
+ }
2605
+ }
2606
+
2607
+ class RasterTileLayerFactory {
2608
+ build(settings) {
2609
+ const source = new XYZ({
2610
+ tileSize: 256,
2611
+ maxZoom: settings.maxZoom || 14,
2612
+ minZoom: settings.minZoom || 1,
2613
+ projection: get(settings.projection),
2614
+ tileUrlFunction: this.getTileFunc(settings),
2615
+ crossOrigin: 'Anonymous',
2616
+ tileLoadFunction: !!settings.requestHeaders
2617
+ ? (tile, src) => this.tileLoader(tile, src, settings.requestHeaders)
2618
+ : undefined,
2619
+ });
2620
+ const raster = new RasterSource({
2621
+ sources: [source],
2622
+ operationType: 'image',
2623
+ operation: settings.operation,
2624
+ });
2625
+ return new ImageLayer({ source: raster, opacity: settings.opacity });
2626
+ }
2627
+ getTileFunc(settings) {
2628
+ return (tileCoord) => {
2629
+ const zoom = tileCoord[0];
2630
+ const x = tileCoord[1];
2631
+ const y = tileCoord[2];
2632
+ const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
2633
+ const bound = 1 << zoom;
2634
+ return settings.url
2635
+ .replace('{x}', String((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.x) || x))
2636
+ .replace('{z}', String(zoom))
2637
+ .replace('{y}', String(bound - ((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.y) || y) - 1));
2638
+ };
2639
+ }
2640
+ tileLoader(tile, src, headers) {
2641
+ const client = new XMLHttpRequest();
2642
+ client.open('GET', src);
2643
+ client.responseType = 'arraybuffer';
2644
+ Object.keys(headers).forEach((k) => client.setRequestHeader(k, headers[k]));
2645
+ client.onload = function () {
2646
+ if (this.response !== undefined) {
2647
+ const arrayBufferView = new Uint8Array(this.response);
2648
+ const blob = new Blob([arrayBufferView], { type: 'image/png' });
2649
+ const urlCreator = window.URL || window.webkitURL;
2650
+ tile.getImage().src = urlCreator.createObjectURL(blob);
2651
+ }
2652
+ };
2653
+ client.send();
2654
+ }
2655
+ getNormalizedCoord(coord, zoom) {
2656
+ const y = coord.y;
2657
+ let x = coord.x;
2658
+ const tileRange = 1 << zoom;
2659
+ if (y < 0 || y >= tileRange)
2660
+ return null;
2661
+ if (x < 0 || x >= tileRange)
2662
+ x = ((x % tileRange) + tileRange) % tileRange;
2663
+ return { x: x, y: y };
2664
+ }
2665
+ }
2666
+ RasterTileLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RasterTileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2667
+ RasterTileLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RasterTileLayerFactory, providedIn: 'root' });
2668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RasterTileLayerFactory, decorators: [{
2669
+ type: Injectable,
2670
+ args: [{
2671
+ providedIn: 'root',
2672
+ }]
2673
+ }] });
2674
+
2675
+ class RasterTileLayerComponent extends DestructibleComponent {
2676
+ constructor(postboy, factory) {
2677
+ super();
2678
+ this.postboy = postboy;
2679
+ this.factory = factory;
2680
+ this._settings = new RasterTileLayerSettings();
2681
+ this.onDestroy = () => this.removeLayer();
2682
+ }
2683
+ set settings(value) {
2684
+ if (!value || this._settings.isSame(value))
2685
+ return;
2686
+ this._settings = value;
2687
+ this.initLayer();
2688
+ }
2689
+ ngOnInit() {
2690
+ this.postboy
2691
+ .sub(MapRenderedEvent)
2692
+ .pipe(filter((m) => !!m), first())
2693
+ .subscribe((m) => this.initLayer());
2694
+ }
2695
+ initLayer() {
2696
+ this.removeLayer();
2697
+ this.layer = this.factory.build(this._settings);
2698
+ this.postboy.fire(new AddRasterTileCommand(this.layer));
2699
+ }
2700
+ removeLayer() {
2701
+ if (this.layer)
2702
+ this.postboy.fire(new RemoveRasterTileCommand(this.layer));
2703
+ }
2704
+ }
2705
+ RasterTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RasterTileLayerComponent, deps: [{ token: MapPostboyService }, { token: RasterTileLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
2706
+ RasterTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RasterTileLayerComponent, selector: "art-raster-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2707
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: RasterTileLayerComponent, decorators: [{
2708
+ type: Component,
2709
+ args: [{
2710
+ selector: 'art-raster-tile-layer',
2711
+ template: '',
2712
+ styleUrls: [],
2713
+ changeDetection: ChangeDetectionStrategy.OnPush,
2714
+ }]
2715
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: RasterTileLayerFactory }]; }, propDecorators: { settings: [{
2716
+ type: Input
2717
+ }] } });
2718
+
2409
2719
  class MapPlateFactory {
2410
2720
  build(settings) {
2411
2721
  return new Map({
@@ -2910,7 +3220,8 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.
2910
3220
  PolygonsComponent,
2911
3221
  ClusterLayerComponent,
2912
3222
  MapControlZoomComponent,
2913
- ImageLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
3223
+ ImageLayerComponent,
3224
+ RasterTileLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
2914
3225
  FeatureLayerComponent,
2915
3226
  MarkersComponent,
2916
3227
  TileLayerComponent,
@@ -2918,7 +3229,8 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.
2918
3229
  PolygonsComponent,
2919
3230
  ClusterLayerComponent,
2920
3231
  MapControlZoomComponent,
2921
- ImageLayerComponent] });
3232
+ ImageLayerComponent,
3233
+ RasterTileLayerComponent] });
2922
3234
  MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapModule, imports: [[CommonModule]] });
2923
3235
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapModule, decorators: [{
2924
3236
  type: NgModule,
@@ -2936,6 +3248,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
2936
3248
  ClusterLayerComponent,
2937
3249
  MapControlZoomComponent,
2938
3250
  ImageLayerComponent,
3251
+ RasterTileLayerComponent,
2939
3252
  ],
2940
3253
  exports: [
2941
3254
  MapPlateComponent,
@@ -2947,6 +3260,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
2947
3260
  ClusterLayerComponent,
2948
3261
  MapControlZoomComponent,
2949
3262
  ImageLayerComponent,
3263
+ RasterTileLayerComponent,
2950
3264
  ],
2951
3265
  }]
2952
3266
  }] });
@@ -2984,7 +3298,7 @@ class MarkerStyleHelper {
2984
3298
  */
2985
3299
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
2986
3300
  return new Style({
2987
- image: new Circle({
3301
+ image: new Circle$1({
2988
3302
  radius,
2989
3303
  fill: new Fill({ color: fill }),
2990
3304
  stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
@@ -3039,7 +3353,7 @@ class PolygonStyleHelper {
3039
3353
  */
3040
3354
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
3041
3355
  return new Style({
3042
- image: new Circle({
3356
+ image: new Circle$1({
3043
3357
  fill: new Fill({
3044
3358
  color: stroke,
3045
3359
  }),
@@ -3061,14 +3375,18 @@ class PolygonStyleHelper {
3061
3375
  */
3062
3376
  class TextStyleHelper {
3063
3377
  /**
3064
- * Creates a new instance of the Text class with the specified properties.
3378
+ * Creates and returns a new Text instance with specified styling properties.
3065
3379
  *
3066
- * @param {string} text - The text content of the Text object.
3067
- * @param {string} font - The font style of the Text object.
3068
- * @param {string} color - The color of the Text object.
3069
- * @return {Text} A new instance of the Text class.
3380
+ * @param {string} text - The text content to display.
3381
+ * @param {string} font - The font style to use for the text.
3382
+ * @param {string} color - The color of the text.
3383
+ * @param {string|null|undefined} [backColor] - The background color of the text. Optional.
3384
+ * @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
3385
+ * @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
3386
+ * @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
3387
+ * @return {Text} A new Text instance configured with the specified properties.
3070
3388
  */
3071
- static get(text, font, color) {
3389
+ static get(text, font, color, backColor, padding, textBaseline, offsetY) {
3072
3390
  return new Text({
3073
3391
  text: text,
3074
3392
  font: font,
@@ -3076,6 +3394,10 @@ class TextStyleHelper {
3076
3394
  fill: new Fill({
3077
3395
  color: color,
3078
3396
  }),
3397
+ backgroundFill: backColor ? new Fill({ color: backColor }) : undefined,
3398
+ padding: padding !== null && padding !== void 0 ? padding : undefined,
3399
+ textBaseline: textBaseline !== null && textBaseline !== void 0 ? textBaseline : undefined,
3400
+ offsetY: offsetY !== null && offsetY !== void 0 ? offsetY : undefined,
3079
3401
  });
3080
3402
  }
3081
3403
  }
@@ -3143,5 +3465,5 @@ class StringifyFeatureHelper {
3143
3465
  * Generated bundle index. Do not edit.
3144
3466
  */
3145
3467
 
3146
- 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 };
3468
+ 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 };
3147
3469
  //# sourceMappingURL=maps-components-src-map.js.map