@artstesh/maps 1.1.9 → 1.1.11

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.
@@ -998,6 +998,26 @@
998
998
  }(postboy.PostboyExecutor));
999
999
  GetMapPositionExecutor.ID = '52c95689-d09b-4082-ba58-9183ea96a213';
1000
1000
 
1001
+ var GetFeaturesInAreaQuery = /** @class */ (function (_super) {
1002
+ __extends(GetFeaturesInAreaQuery, _super);
1003
+ function GetFeaturesInAreaQuery(area, ignore) {
1004
+ if (ignore === void 0) { ignore = new Set(); }
1005
+ var _this = _super.call(this) || this;
1006
+ _this.area = area;
1007
+ _this.ignore = ignore;
1008
+ return _this;
1009
+ }
1010
+ Object.defineProperty(GetFeaturesInAreaQuery.prototype, "id", {
1011
+ get: function () {
1012
+ return GetFeaturesInAreaQuery.ID;
1013
+ },
1014
+ enumerable: false,
1015
+ configurable: true
1016
+ });
1017
+ return GetFeaturesInAreaQuery;
1018
+ }(postboy.PostboyCallbackMessage));
1019
+ GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
1020
+
1001
1021
  var AddLayerCommand = /** @class */ (function (_super) {
1002
1022
  __extends(AddLayerCommand, _super);
1003
1023
  function AddLayerCommand(layer) {
@@ -1191,26 +1211,6 @@
1191
1211
  return FeatureService;
1192
1212
  }());
1193
1213
 
1194
- var GetFeaturesInAreaQuery = /** @class */ (function (_super) {
1195
- __extends(GetFeaturesInAreaQuery, _super);
1196
- function GetFeaturesInAreaQuery(area, ignore) {
1197
- if (ignore === void 0) { ignore = new Set(); }
1198
- var _this = _super.call(this) || this;
1199
- _this.area = area;
1200
- _this.ignore = ignore;
1201
- return _this;
1202
- }
1203
- Object.defineProperty(GetFeaturesInAreaQuery.prototype, "id", {
1204
- get: function () {
1205
- return GetFeaturesInAreaQuery.ID;
1206
- },
1207
- enumerable: false,
1208
- configurable: true
1209
- });
1210
- return GetFeaturesInAreaQuery;
1211
- }(postboy.PostboyCallbackMessage));
1212
- GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
1213
-
1214
1214
  var FilterFeaturesInAreaExecutor = /** @class */ (function (_super) {
1215
1215
  __extends(FilterFeaturesInAreaExecutor, _super);
1216
1216
  function FilterFeaturesInAreaExecutor(area, features) {
@@ -1855,6 +1855,13 @@
1855
1855
  * @default 'EPSG:3857'
1856
1856
  */
1857
1857
  this.projection = 'EPSG:3857';
1858
+ /**
1859
+ * Additional headers that should be added to each tile request
1860
+ *
1861
+ * @type {Record<string, string>}
1862
+ * @default An empty array
1863
+ */
1864
+ this.requestHeaders = null;
1858
1865
  }
1859
1866
  /**
1860
1867
  * Creates a copy of the given tile layer settings.
@@ -1869,6 +1876,7 @@
1869
1876
  result.projection = model.projection;
1870
1877
  result.opacity = model.opacity;
1871
1878
  result.url = model.url;
1879
+ result.requestHeaders = model.requestHeaders;
1872
1880
  return result;
1873
1881
  };
1874
1882
  /**
@@ -1880,6 +1888,15 @@
1880
1888
  TileLayerSettings.prototype.setUrl = function (url) {
1881
1889
  return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { url: url }));
1882
1890
  };
1891
+ /**
1892
+ * Sets the requestHeaders of the TileLayerSettings object.
1893
+ *
1894
+ * @param {Record<string, string>} requestHeaders - The headers which should be provided.
1895
+ * @return {TileLayerSettings} - The updated TileLayerSettings object.
1896
+ */
1897
+ TileLayerSettings.prototype.setRequestHeaders = function (requestHeaders) {
1898
+ return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { requestHeaders: requestHeaders }));
1899
+ };
1883
1900
  /**
1884
1901
  * Sets the maximum zoom level for the tile layer.
1885
1902
  *
@@ -1933,6 +1950,8 @@
1933
1950
  return false;
1934
1951
  if (this.opacity !== model.opacity)
1935
1952
  return false;
1953
+ if (this.requestHeaders !== model.requestHeaders)
1954
+ return false;
1936
1955
  return true;
1937
1956
  };
1938
1957
  return TileLayerSettings;
@@ -1942,6 +1961,7 @@
1942
1961
  function TileLayerFactory() {
1943
1962
  }
1944
1963
  TileLayerFactory.prototype.build = function (settings) {
1964
+ var _this = this;
1945
1965
  var source$1 = new source.XYZ({
1946
1966
  tileSize: 256,
1947
1967
  maxZoom: settings.maxZoom || 14,
@@ -1949,6 +1969,9 @@
1949
1969
  projection: proj.get(settings.projection),
1950
1970
  tileUrlFunction: this.getTileFunc(settings),
1951
1971
  crossOrigin: 'Anonymous',
1972
+ tileLoadFunction: !!settings.requestHeaders
1973
+ ? function (tile, src) { return _this.tileLoader(tile, src, settings.requestHeaders); }
1974
+ : undefined,
1952
1975
  });
1953
1976
  return new TileLayer__default["default"]({ source: source$1, opacity: settings.opacity });
1954
1977
  };
@@ -1966,6 +1989,21 @@
1966
1989
  .replace('{y}', String(bound - ((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.y) || y) - 1));
1967
1990
  };
1968
1991
  };
1992
+ TileLayerFactory.prototype.tileLoader = function (tile, src, headers) {
1993
+ var client = new XMLHttpRequest();
1994
+ client.open('GET', src);
1995
+ client.responseType = 'arraybuffer';
1996
+ Object.keys(headers).forEach(function (k) { return client.setRequestHeader(k, headers[k]); });
1997
+ client.onload = function () {
1998
+ if (this.response !== undefined) {
1999
+ var arrayBufferView = new Uint8Array(this.response);
2000
+ var blob = new Blob([arrayBufferView], { type: 'image/png' });
2001
+ var urlCreator = window.URL || window.webkitURL;
2002
+ tile.getImage().src = urlCreator.createObjectURL(blob);
2003
+ }
2004
+ };
2005
+ client.send();
2006
+ };
1969
2007
  TileLayerFactory.prototype.getNormalizedCoord = function (coord, zoom) {
1970
2008
  var y = coord.y;
1971
2009
  var x = coord.x;
@@ -3402,6 +3440,7 @@
3402
3440
  exports.FeatureLayerComponent = FeatureLayerComponent;
3403
3441
  exports.FeatureLayerSettings = FeatureLayerSettings;
3404
3442
  exports.FitToPolygonsCommand = FitToPolygonsCommand;
3443
+ exports.GetFeaturesInAreaQuery = GetFeaturesInAreaQuery;
3405
3444
  exports.GetMapPositionExecutor = GetMapPositionExecutor;
3406
3445
  exports.MapClickEvent = MapClickEvent;
3407
3446
  exports.MapControl = MapControl;