@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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/geom/Polygon'), require('ol/control'), require('ol/proj'), require('@artstesh/postboy'), require('ol/interaction'), require('ol/interaction/Draw'), require('ol/sphere'), require('rxjs'), require('rxjs/operators'), require('@artstesh/collections'), require('ol/source'), require('ol/layer/Tile'), require('ol/source/OSM'), require('ol/layer'), require('ol/loadingstrategy'), require('ol/source/Cluster'), require('ol/source/ImageStatic'), require('ol/layer/Image'), require('ol/Map'), require('ol/View'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style'), require('ol/proj/epsg4326')) :
3
- typeof define === 'function' && define.amd ? define('maps-components/src/map', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/geom/Polygon', 'ol/control', 'ol/proj', '@artstesh/postboy', 'ol/interaction', 'ol/interaction/Draw', 'ol/sphere', 'rxjs', 'rxjs/operators', '@artstesh/collections', 'ol/source', 'ol/layer/Tile', 'ol/source/OSM', 'ol/layer', 'ol/loadingstrategy', 'ol/source/Cluster', 'ol/source/ImageStatic', 'ol/layer/Image', 'ol/Map', 'ol/View', 'ol/Overlay', 'ol/style/Style', 'ol/style', 'ol/proj/epsg4326'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["maps-components"] = global["maps-components"] || {}, global["maps-components"].src = global["maps-components"].src || {}, global["maps-components"].src.map = {}), global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.Polygon, global.control, global.proj, global.postboy, global.interaction, global.Draw, global.Sphere, global.rxjs, global.rxjs.operators, global.collections, global.source, global.TileLayer, global.OSM, global.layer, global.loadingstrategy, global.Cluster, global.Static, global.ImageLayer, global.Map, global.View, global.Overlay, global.Style, global.style, global.epsg4326));
5
- })(this, (function (exports, i0, i6, ol, geom, format, extent, Polygon, control, proj, postboy, interaction, Draw, Sphere, rxjs, operators, collections, source, TileLayer, OSM, layer, loadingstrategy, Cluster, Static, ImageLayer, Map, View, Overlay, Style, style, epsg4326) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/geom/Polygon'), require('ol/control'), require('ol/proj'), require('@artstesh/postboy'), require('ol/sphere'), require('ol/interaction'), require('ol/interaction/Draw'), require('rxjs'), require('rxjs/operators'), require('@artstesh/collections'), require('ol/source'), require('ol/layer/Tile'), require('ol/source/OSM'), require('ol/layer'), require('ol/loadingstrategy'), require('ol/source/Cluster'), require('ol/source/ImageStatic'), require('ol/layer/Image'), require('ol/source/Raster'), require('ol/Map'), require('ol/View'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style'), require('ol/proj/epsg4326'), require('ol/style/Circle')) :
3
+ typeof define === 'function' && define.amd ? define('maps-components/src/map', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/geom/Polygon', 'ol/control', 'ol/proj', '@artstesh/postboy', 'ol/sphere', 'ol/interaction', 'ol/interaction/Draw', 'rxjs', 'rxjs/operators', '@artstesh/collections', 'ol/source', 'ol/layer/Tile', 'ol/source/OSM', 'ol/layer', 'ol/loadingstrategy', 'ol/source/Cluster', 'ol/source/ImageStatic', 'ol/layer/Image', 'ol/source/Raster', 'ol/Map', 'ol/View', 'ol/Overlay', 'ol/style/Style', 'ol/style', 'ol/proj/epsg4326', 'ol/style/Circle'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["maps-components"] = global["maps-components"] || {}, global["maps-components"].src = global["maps-components"].src || {}, global["maps-components"].src.map = {}), global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.Polygon, global.control, global.proj, global.postboy, global.Sphere, global.interaction, global.Draw, global.rxjs, global.rxjs.operators, global.collections, global.source, global.TileLayer, global.OSM, global.layer, global.loadingstrategy, global.Cluster, global.Static, global.ImageLayer, global.RasterSource, global.Map, global.View, global.Overlay, global.Style, global.style, global.epsg4326, global.Circle));
5
+ })(this, (function (exports, i0, i6, ol, geom, format, extent, Polygon, control, proj, postboy, Sphere, interaction, Draw, rxjs, operators, collections, source, TileLayer, OSM, layer, loadingstrategy, Cluster, Static, ImageLayer, RasterSource, Map, View, Overlay, Style, style, epsg4326, Circle) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -33,10 +33,12 @@
33
33
  var Cluster__default = /*#__PURE__*/_interopDefaultLegacy(Cluster);
34
34
  var Static__default = /*#__PURE__*/_interopDefaultLegacy(Static);
35
35
  var ImageLayer__default = /*#__PURE__*/_interopDefaultLegacy(ImageLayer);
36
+ var RasterSource__default = /*#__PURE__*/_interopDefaultLegacy(RasterSource);
36
37
  var Map__default = /*#__PURE__*/_interopDefaultLegacy(Map);
37
38
  var View__default = /*#__PURE__*/_interopDefaultLegacy(View);
38
39
  var Overlay__default = /*#__PURE__*/_interopDefaultLegacy(Overlay);
39
40
  var Style__default = /*#__PURE__*/_interopDefaultLegacy(Style);
41
+ var Circle__namespace = /*#__PURE__*/_interopNamespace(Circle);
40
42
 
41
43
  var DestructibleComponent = /** @class */ (function () {
42
44
  function DestructibleComponent() {
@@ -763,6 +765,7 @@
763
765
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
764
766
  DrawingType[DrawingType["Square"] = 3] = "Square";
765
767
  DrawingType[DrawingType["Box"] = 4] = "Box";
768
+ DrawingType[DrawingType["LineString"] = 5] = "LineString";
766
769
  })(exports.DrawingType || (exports.DrawingType = {}));
767
770
 
768
771
  /**
@@ -1265,6 +1268,27 @@
1265
1268
  }(postboy.PostboyGenericMessage));
1266
1269
  FitToFeaturesCommand.ID = '04d67609-0b4c-4f52-aa53-ad0a3db967dc';
1267
1270
 
1271
+ var GetGeometryLengthExecutor = /** @class */ (function (_super) {
1272
+ __extends(GetGeometryLengthExecutor, _super);
1273
+ function GetGeometryLengthExecutor(geometry, projection) {
1274
+ if (projection === void 0) { projection = 'EPSG:4326'; }
1275
+ var _this = _super.call(this) || this;
1276
+ _this.geometry = geometry;
1277
+ _this.projection = projection;
1278
+ return _this;
1279
+ }
1280
+ return GetGeometryLengthExecutor;
1281
+ }(postboy.PostboyExecutor));
1282
+ GetGeometryLengthExecutor.ID = '763146df-6d93-4dc2-a532-0e9ba2b2d023';
1283
+ var GetGeometryLengthExecutorHandler = /** @class */ (function () {
1284
+ function GetGeometryLengthExecutorHandler() {
1285
+ }
1286
+ GetGeometryLengthExecutorHandler.prototype.handle = function (executor) {
1287
+ return Math.round(Sphere.getLength(executor.geometry, { projection: executor.projection }) * 100) / 100;
1288
+ };
1289
+ return GetGeometryLengthExecutorHandler;
1290
+ }());
1291
+
1268
1292
  var AddLayerCommand = /** @class */ (function (_super) {
1269
1293
  __extends(AddLayerCommand, _super);
1270
1294
  function AddLayerCommand(layer) {
@@ -1347,7 +1371,7 @@
1347
1371
  DrawingGenerationService.getDraw = function (ev) {
1348
1372
  return new interaction.Draw({
1349
1373
  source: ev.layer.getSource(),
1350
- type: ev.type === exports.DrawingType.Polygon ? 'Polygon' : 'Circle',
1374
+ type: ev.type === exports.DrawingType.Polygon ? 'Polygon' : ev.type === exports.DrawingType.LineString ? 'LineString' : 'Circle',
1351
1375
  style: ev.style,
1352
1376
  geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
1353
1377
  });
@@ -1504,6 +1528,28 @@
1504
1528
  }(postboy.PostboyGenericMessage));
1505
1529
  RemoveImageLayerCommand.ID = 'c8e7efdb-17ff-4cf9-89be-e688b8de3b95';
1506
1530
 
1531
+ var AddRasterTileCommand = /** @class */ (function (_super) {
1532
+ __extends(AddRasterTileCommand, _super);
1533
+ function AddRasterTileCommand(layer) {
1534
+ var _this = _super.call(this) || this;
1535
+ _this.layer = layer;
1536
+ return _this;
1537
+ }
1538
+ return AddRasterTileCommand;
1539
+ }(postboy.PostboyGenericMessage));
1540
+ AddRasterTileCommand.ID = 'd33447fe-eec0-4205-9b5d-0d79ddc74ad7';
1541
+
1542
+ var RemoveRasterTileCommand = /** @class */ (function (_super) {
1543
+ __extends(RemoveRasterTileCommand, _super);
1544
+ function RemoveRasterTileCommand(layer) {
1545
+ var _this = _super.call(this) || this;
1546
+ _this.layer = layer;
1547
+ return _this;
1548
+ }
1549
+ return RemoveRasterTileCommand;
1550
+ }(postboy.PostboyGenericMessage));
1551
+ RemoveRasterTileCommand.ID = 'd1c4bf6a-e2f2-4385-a7a2-cecb525f8939';
1552
+
1507
1553
  var MapPostboyService = /** @class */ (function (_super) {
1508
1554
  __extends(MapPostboyService, _super);
1509
1555
  function MapPostboyService() {
@@ -1534,20 +1580,11 @@
1534
1580
  this.observeRemoveLayer();
1535
1581
  this.observePlaceFeatures();
1536
1582
  this.observeAddTile();
1537
- this.observeRemoveTile();
1538
1583
  this.observeLayerQuery();
1539
1584
  this.observeFeaturesInArea();
1540
1585
  this.observeFeaturesInPoint();
1541
1586
  this.observeImageLayer();
1542
1587
  };
1543
- MapManagementService.prototype.observeRemoveTile = function () {
1544
- var _this = this;
1545
- this.postboy.sub(RemoveTileCommand).subscribe(function (c) {
1546
- if (!_this.map)
1547
- return;
1548
- _this.map.removeLayer(c.layer);
1549
- });
1550
- };
1551
1588
  MapManagementService.prototype.observeLayerQuery = function () {
1552
1589
  var _this = this;
1553
1590
  this.postboy.sub(GetLayerQuery).subscribe(function (ev) { return ev.finish(_this.layers.take(ev.name)); });
@@ -1559,6 +1596,21 @@
1559
1596
  return;
1560
1597
  _this.map.addLayer(c.layer);
1561
1598
  });
1599
+ this.postboy.sub(RemoveTileCommand).subscribe(function (c) {
1600
+ if (!_this.map)
1601
+ return;
1602
+ _this.map.removeLayer(c.layer);
1603
+ });
1604
+ this.postboy.sub(AddRasterTileCommand).subscribe(function (c) {
1605
+ if (!_this.map)
1606
+ return;
1607
+ _this.map.addLayer(c.layer);
1608
+ });
1609
+ this.postboy.sub(RemoveRasterTileCommand).subscribe(function (c) {
1610
+ if (!_this.map)
1611
+ return;
1612
+ _this.map.removeLayer(c.layer);
1613
+ });
1562
1614
  };
1563
1615
  MapManagementService.prototype.observeImageLayer = function () {
1564
1616
  var _this = this;
@@ -2054,6 +2106,8 @@
2054
2106
  this.recordSubject(AddLayerCommand);
2055
2107
  this.recordSubject(RemoveLayerCommand);
2056
2108
  this.recordSubject(AddTileCommand);
2109
+ this.recordSubject(AddRasterTileCommand);
2110
+ this.recordSubject(RemoveRasterTileCommand);
2057
2111
  this.recordSubject(RemoveImageLayerCommand);
2058
2112
  this.recordSubject(AddImageLayerCommand);
2059
2113
  this.recordSubject(RemoveTileCommand);
@@ -2084,6 +2138,7 @@
2084
2138
  this.recordExecutor(GenerateDrawExecutor, function (e) { return DrawingGenerationService.getDraw(e); });
2085
2139
  this.recordExecutor(GenerateZoomControlExecutor, function (e) { return ZoomControlFactory.build(e.settings); });
2086
2140
  this.recordExecutor(GetMapPositionExecutor, function () { return _this.state.getMapPosition(); });
2141
+ this.recordExecutor(GetGeometryLengthExecutor, function (e) { return new GetGeometryLengthExecutorHandler().handle(e); });
2087
2142
  };
2088
2143
  return MessageRegistratorService;
2089
2144
  }(postboy.PostboyAbstractRegistrator));
@@ -3135,6 +3190,283 @@
3135
3190
  type: i0.Input
3136
3191
  }] } });
3137
3192
 
3193
+ var RasterTileLayerSettings = /** @class */ (function () {
3194
+ function RasterTileLayerSettings() {
3195
+ /**
3196
+ * The maximum zoom level for a map view.
3197
+ *
3198
+ * @type {number}
3199
+ * @default 19
3200
+ */
3201
+ this.maxZoom = 19;
3202
+ /**
3203
+ * The minimum zoom level allowed.
3204
+ *
3205
+ * @type {number}
3206
+ */
3207
+ this.minZoom = 0;
3208
+ /**
3209
+ * The opacity of an element.
3210
+ *
3211
+ * @type {number}
3212
+ * @default 0.6
3213
+ */
3214
+ this.opacity = 0.6;
3215
+ /**
3216
+ * Represents the tiles URL.
3217
+ * @typedef {string} url
3218
+ *
3219
+ * @example
3220
+ * 'https://example.ex/{z}/{x}/{y}.png'
3221
+ */
3222
+ this.url = '';
3223
+ /**
3224
+ * The projection of the coordinate system.
3225
+ *
3226
+ * @type {string}
3227
+ * @default 'EPSG:3857'
3228
+ */
3229
+ this.projection = 'EPSG:3857';
3230
+ /**
3231
+ * Additional headers that should be added to each tile request
3232
+ *
3233
+ * @type {Record<string, string>}
3234
+ * @default An empty array
3235
+ */
3236
+ this.requestHeaders = null;
3237
+ this.operation = function (d) { var _a; return (_a = d[0]) !== null && _a !== void 0 ? _a : []; };
3238
+ }
3239
+ /**
3240
+ * Creates a copy of the given tile layer settings.
3241
+ *
3242
+ * @param {RasterTileLayerSettings} model - The tile layer settings to be copied.
3243
+ * @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the same properties as the model.
3244
+ */
3245
+ RasterTileLayerSettings.copy = function (model) {
3246
+ var result = new RasterTileLayerSettings();
3247
+ result.maxZoom = model.maxZoom;
3248
+ result.minZoom = model.minZoom;
3249
+ result.projection = model.projection;
3250
+ result.opacity = model.opacity;
3251
+ result.url = model.url;
3252
+ result.requestHeaders = model.requestHeaders;
3253
+ result.operation = model.operation;
3254
+ return result;
3255
+ };
3256
+ /**
3257
+ * Sets the URL of the RasterTileLayerSettings object.
3258
+ *
3259
+ * @param {string} url - The URL to be set.
3260
+ * @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
3261
+ */
3262
+ RasterTileLayerSettings.prototype.setUrl = function (url) {
3263
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { url: url }));
3264
+ };
3265
+ /**
3266
+ * Sets the operation to apply on raster tile data.
3267
+ *
3268
+ * @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.
3269
+ * @return {RasterTileLayerSettings} A new instance of RasterTileLayerSettings with the updated operation.
3270
+ */
3271
+ RasterTileLayerSettings.prototype.setOperation = function (operation) {
3272
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { operation: operation }));
3273
+ };
3274
+ /**
3275
+ * Sets the requestHeaders of the RasterTileLayerSettings object.
3276
+ *
3277
+ * @param {Record<string, string>} requestHeaders - The headers which should be provided.
3278
+ * @return {RasterTileLayerSettings} - The updated RasterTileLayerSettings object.
3279
+ */
3280
+ RasterTileLayerSettings.prototype.setRequestHeaders = function (requestHeaders) {
3281
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { requestHeaders: requestHeaders }));
3282
+ };
3283
+ /**
3284
+ * Sets the maximum zoom level for the tile layer.
3285
+ *
3286
+ * @param {number} maxZoom - The maximum zoom level.
3287
+ * @returns {RasterTileLayerSettings} - The updated tile layer settings object.
3288
+ */
3289
+ RasterTileLayerSettings.prototype.setMaxZoom = function (maxZoom) {
3290
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom: maxZoom }));
3291
+ };
3292
+ /**
3293
+ * Sets the minimum zoom level for the Tile Layer.
3294
+ *
3295
+ * @param {number} minZoom - The minimum zoom level to be set.
3296
+ * @return {RasterTileLayerSettings} The modified RasterTileLayerSettings object with the updated minimum zoom level.
3297
+ */
3298
+ RasterTileLayerSettings.prototype.setMinZoom = function (minZoom) {
3299
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom: minZoom }));
3300
+ };
3301
+ /**
3302
+ * Sets the opacity of the RasterTileLayerSettings.
3303
+ *
3304
+ * @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
3305
+ * @return {RasterTileLayerSettings} - A new instance of RasterTileLayerSettings with the opacity set.
3306
+ */
3307
+ RasterTileLayerSettings.prototype.setOpacity = function (opacity) {
3308
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity: opacity }));
3309
+ };
3310
+ /**
3311
+ * Sets the projection for the tile layer settings.
3312
+ *
3313
+ * @param {string} projection - The desired projection for the tile layer settings.
3314
+ * @return {RasterTileLayerSettings} - The updated tile layer settings with the new projection.
3315
+ */
3316
+ RasterTileLayerSettings.prototype.setProjection = function (projection) {
3317
+ return RasterTileLayerSettings.copy(Object.assign(Object.assign({}, this), { projection: projection }));
3318
+ };
3319
+ /**
3320
+ * Checks if the current instance of RasterTileLayerSettings is equal to the given model.
3321
+ * @param {RasterTileLayerSettings} model - The model to compare against.
3322
+ * @return {boolean} - True if all properties of the current instance matches the properties of the model;
3323
+ * otherwise, false.
3324
+ */
3325
+ RasterTileLayerSettings.prototype.isSame = function (model) {
3326
+ if (this.maxZoom !== model.maxZoom)
3327
+ return false;
3328
+ if (this.minZoom !== model.minZoom)
3329
+ return false;
3330
+ if (this.url !== model.url)
3331
+ return false;
3332
+ if (this.projection !== model.projection)
3333
+ return false;
3334
+ if (this.opacity !== model.opacity)
3335
+ return false;
3336
+ if (this.requestHeaders !== model.requestHeaders)
3337
+ return false;
3338
+ if (this.operation !== model.operation)
3339
+ return false;
3340
+ return true;
3341
+ };
3342
+ return RasterTileLayerSettings;
3343
+ }());
3344
+
3345
+ var RasterTileLayerFactory = /** @class */ (function () {
3346
+ function RasterTileLayerFactory() {
3347
+ }
3348
+ RasterTileLayerFactory.prototype.build = function (settings) {
3349
+ var _this = this;
3350
+ var source$1 = new source.XYZ({
3351
+ tileSize: 256,
3352
+ maxZoom: settings.maxZoom || 14,
3353
+ minZoom: settings.minZoom || 1,
3354
+ projection: proj.get(settings.projection),
3355
+ tileUrlFunction: this.getTileFunc(settings),
3356
+ crossOrigin: 'Anonymous',
3357
+ tileLoadFunction: !!settings.requestHeaders
3358
+ ? function (tile, src) { return _this.tileLoader(tile, src, settings.requestHeaders); }
3359
+ : undefined,
3360
+ });
3361
+ var raster = new RasterSource__default["default"]({
3362
+ sources: [source$1],
3363
+ operationType: 'image',
3364
+ operation: settings.operation,
3365
+ });
3366
+ return new ImageLayer__default["default"]({ source: raster, opacity: settings.opacity });
3367
+ };
3368
+ RasterTileLayerFactory.prototype.getTileFunc = function (settings) {
3369
+ var _this = this;
3370
+ return function (tileCoord) {
3371
+ var zoom = tileCoord[0];
3372
+ var x = tileCoord[1];
3373
+ var y = tileCoord[2];
3374
+ var normalizedCoord = _this.getNormalizedCoord({ x: x, y: y }, zoom);
3375
+ var bound = 1 << zoom;
3376
+ return settings.url
3377
+ .replace('{x}', String((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.x) || x))
3378
+ .replace('{z}', String(zoom))
3379
+ .replace('{y}', String(bound - ((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.y) || y) - 1));
3380
+ };
3381
+ };
3382
+ RasterTileLayerFactory.prototype.tileLoader = function (tile, src, headers) {
3383
+ var client = new XMLHttpRequest();
3384
+ client.open('GET', src);
3385
+ client.responseType = 'arraybuffer';
3386
+ Object.keys(headers).forEach(function (k) { return client.setRequestHeader(k, headers[k]); });
3387
+ client.onload = function () {
3388
+ if (this.response !== undefined) {
3389
+ var arrayBufferView = new Uint8Array(this.response);
3390
+ var blob = new Blob([arrayBufferView], { type: 'image/png' });
3391
+ var urlCreator = window.URL || window.webkitURL;
3392
+ tile.getImage().src = urlCreator.createObjectURL(blob);
3393
+ }
3394
+ };
3395
+ client.send();
3396
+ };
3397
+ RasterTileLayerFactory.prototype.getNormalizedCoord = function (coord, zoom) {
3398
+ var y = coord.y;
3399
+ var x = coord.x;
3400
+ var tileRange = 1 << zoom;
3401
+ if (y < 0 || y >= tileRange)
3402
+ return null;
3403
+ if (x < 0 || x >= tileRange)
3404
+ x = ((x % tileRange) + tileRange) % tileRange;
3405
+ return { x: x, y: y };
3406
+ };
3407
+ return RasterTileLayerFactory;
3408
+ }());
3409
+ RasterTileLayerFactory.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RasterTileLayerFactory, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
3410
+ RasterTileLayerFactory.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RasterTileLayerFactory, providedIn: 'root' });
3411
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RasterTileLayerFactory, decorators: [{
3412
+ type: i0.Injectable,
3413
+ args: [{
3414
+ providedIn: 'root',
3415
+ }]
3416
+ }] });
3417
+
3418
+ var RasterTileLayerComponent = /** @class */ (function (_super) {
3419
+ __extends(RasterTileLayerComponent, _super);
3420
+ function RasterTileLayerComponent(postboy, factory) {
3421
+ var _this = _super.call(this) || this;
3422
+ _this.postboy = postboy;
3423
+ _this.factory = factory;
3424
+ _this._settings = new RasterTileLayerSettings();
3425
+ _this.onDestroy = function () { return _this.removeLayer(); };
3426
+ return _this;
3427
+ }
3428
+ Object.defineProperty(RasterTileLayerComponent.prototype, "settings", {
3429
+ set: function (value) {
3430
+ if (!value || this._settings.isSame(value))
3431
+ return;
3432
+ this._settings = value;
3433
+ this.initLayer();
3434
+ },
3435
+ enumerable: false,
3436
+ configurable: true
3437
+ });
3438
+ RasterTileLayerComponent.prototype.ngOnInit = function () {
3439
+ var _this = this;
3440
+ this.postboy
3441
+ .sub(MapRenderedEvent)
3442
+ .pipe(operators.filter(function (m) { return !!m; }), operators.first())
3443
+ .subscribe(function (m) { return _this.initLayer(); });
3444
+ };
3445
+ RasterTileLayerComponent.prototype.initLayer = function () {
3446
+ this.removeLayer();
3447
+ this.layer = this.factory.build(this._settings);
3448
+ this.postboy.fire(new AddRasterTileCommand(this.layer));
3449
+ };
3450
+ RasterTileLayerComponent.prototype.removeLayer = function () {
3451
+ if (this.layer)
3452
+ this.postboy.fire(new RemoveRasterTileCommand(this.layer));
3453
+ };
3454
+ return RasterTileLayerComponent;
3455
+ }(DestructibleComponent));
3456
+ RasterTileLayerComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RasterTileLayerComponent, deps: [{ token: MapPostboyService }, { token: RasterTileLayerFactory }], target: i0__namespace.ɵɵFactoryTarget.Component });
3457
+ RasterTileLayerComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RasterTileLayerComponent, selector: "art-raster-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0__namespace, template: '', isInline: true, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
3458
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RasterTileLayerComponent, decorators: [{
3459
+ type: i0.Component,
3460
+ args: [{
3461
+ selector: 'art-raster-tile-layer',
3462
+ template: '',
3463
+ styleUrls: [],
3464
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
3465
+ }]
3466
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: RasterTileLayerFactory }]; }, propDecorators: { settings: [{
3467
+ type: i0.Input
3468
+ }] } });
3469
+
3138
3470
  var MapPlateFactory = /** @class */ (function () {
3139
3471
  function MapPlateFactory() {
3140
3472
  }
@@ -3690,7 +4022,8 @@
3690
4022
  PolygonsComponent,
3691
4023
  ClusterLayerComponent,
3692
4024
  MapControlZoomComponent,
3693
- ImageLayerComponent], imports: [i6.CommonModule], exports: [MapPlateComponent,
4025
+ ImageLayerComponent,
4026
+ RasterTileLayerComponent], imports: [i6.CommonModule], exports: [MapPlateComponent,
3694
4027
  FeatureLayerComponent,
3695
4028
  MarkersComponent,
3696
4029
  TileLayerComponent,
@@ -3698,7 +4031,8 @@
3698
4031
  PolygonsComponent,
3699
4032
  ClusterLayerComponent,
3700
4033
  MapControlZoomComponent,
3701
- ImageLayerComponent] });
4034
+ ImageLayerComponent,
4035
+ RasterTileLayerComponent] });
3702
4036
  MapModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, imports: [[i6.CommonModule]] });
3703
4037
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MapModule, decorators: [{
3704
4038
  type: i0.NgModule,
@@ -3716,6 +4050,7 @@
3716
4050
  ClusterLayerComponent,
3717
4051
  MapControlZoomComponent,
3718
4052
  ImageLayerComponent,
4053
+ RasterTileLayerComponent,
3719
4054
  ],
3720
4055
  exports: [
3721
4056
  MapPlateComponent,
@@ -3727,6 +4062,7 @@
3727
4062
  ClusterLayerComponent,
3728
4063
  MapControlZoomComponent,
3729
4064
  ImageLayerComponent,
4065
+ RasterTileLayerComponent,
3730
4066
  ],
3731
4067
  }]
3732
4068
  }] });
@@ -3855,14 +4191,18 @@
3855
4191
  function TextStyleHelper() {
3856
4192
  }
3857
4193
  /**
3858
- * Creates a new instance of the Text class with the specified properties.
4194
+ * Creates and returns a new Text instance with specified styling properties.
3859
4195
  *
3860
- * @param {string} text - The text content of the Text object.
3861
- * @param {string} font - The font style of the Text object.
3862
- * @param {string} color - The color of the Text object.
3863
- * @return {Text} A new instance of the Text class.
4196
+ * @param {string} text - The text content to display.
4197
+ * @param {string} font - The font style to use for the text.
4198
+ * @param {string} color - The color of the text.
4199
+ * @param {string|null|undefined} [backColor] - The background color of the text. Optional.
4200
+ * @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
4201
+ * @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
4202
+ * @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
4203
+ * @return {Text} A new Text instance configured with the specified properties.
3864
4204
  */
3865
- TextStyleHelper.get = function (text, font, color) {
4205
+ TextStyleHelper.get = function (text, font, color, backColor, padding, textBaseline, offsetY) {
3866
4206
  return new style.Text({
3867
4207
  text: text,
3868
4208
  font: font,
@@ -3870,6 +4210,10 @@
3870
4210
  fill: new style.Fill({
3871
4211
  color: color,
3872
4212
  }),
4213
+ backgroundFill: backColor ? new style.Fill({ color: backColor }) : undefined,
4214
+ padding: padding !== null && padding !== void 0 ? padding : undefined,
4215
+ textBaseline: textBaseline !== null && textBaseline !== void 0 ? textBaseline : undefined,
4216
+ offsetY: offsetY !== null && offsetY !== void 0 ? offsetY : undefined,
3873
4217
  });
3874
4218
  };
3875
4219
  return TextStyleHelper;
@@ -3940,10 +4284,43 @@
3940
4284
  * Generated bundle index. Do not edit.
3941
4285
  */
3942
4286
 
4287
+ Object.defineProperty(exports, 'Feature', {
4288
+ enumerable: true,
4289
+ get: function () { return ol.Feature; }
4290
+ });
4291
+ Object.defineProperty(exports, 'Geometry', {
4292
+ enumerable: true,
4293
+ get: function () { return geom.Geometry; }
4294
+ });
4295
+ Object.defineProperty(exports, 'LineString', {
4296
+ enumerable: true,
4297
+ get: function () { return geom.LineString; }
4298
+ });
4299
+ Object.defineProperty(exports, 'Point', {
4300
+ enumerable: true,
4301
+ get: function () { return geom.Point; }
4302
+ });
4303
+ Object.defineProperty(exports, 'Fill', {
4304
+ enumerable: true,
4305
+ get: function () { return style.Fill; }
4306
+ });
4307
+ Object.defineProperty(exports, 'RegularShape', {
4308
+ enumerable: true,
4309
+ get: function () { return style.RegularShape; }
4310
+ });
4311
+ Object.defineProperty(exports, 'Stroke', {
4312
+ enumerable: true,
4313
+ get: function () { return style.Stroke; }
4314
+ });
3943
4315
  Object.defineProperty(exports, 'Style', {
3944
4316
  enumerable: true,
3945
4317
  get: function () { return style.Style; }
3946
4318
  });
4319
+ Object.defineProperty(exports, 'Text', {
4320
+ enumerable: true,
4321
+ get: function () { return style.Text; }
4322
+ });
4323
+ exports.CircleStyle = Circle__namespace;
3947
4324
  exports.AddControlCommand = AddControlCommand;
3948
4325
  exports.CalculateAreaExecutor = CalculateAreaExecutor;
3949
4326
  exports.CancelDrawingCommand = CancelDrawingCommand;
@@ -3960,6 +4337,7 @@
3960
4337
  exports.FitToPolygonsCommand = FitToPolygonsCommand;
3961
4338
  exports.GetFeaturesInAreaQuery = GetFeaturesInAreaQuery;
3962
4339
  exports.GetFeaturesInPointQuery = GetFeaturesInPointQuery;
4340
+ exports.GetGeometryLengthExecutor = GetGeometryLengthExecutor;
3963
4341
  exports.GetMapPositionExecutor = GetMapPositionExecutor;
3964
4342
  exports.ImageLayerComponent = ImageLayerComponent;
3965
4343
  exports.ImageLayerSettings = ImageLayerSettings;
@@ -3986,6 +4364,8 @@
3986
4364
  exports.PolygonSelfIntersectionExecutor = PolygonSelfIntersectionExecutor;
3987
4365
  exports.PolygonStyleHelper = PolygonStyleHelper;
3988
4366
  exports.PolygonsComponent = PolygonsComponent;
4367
+ exports.RasterTileLayerComponent = RasterTileLayerComponent;
4368
+ exports.RasterTileLayerSettings = RasterTileLayerSettings;
3989
4369
  exports.RemoveControlCommand = RemoveControlCommand;
3990
4370
  exports.SetMapCenterCommand = SetMapCenterCommand;
3991
4371
  exports.StartDrawingCommand = StartDrawingCommand;