@artstesh/maps 1.1.1 → 1.1.2

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.
@@ -1270,14 +1270,14 @@
1270
1270
  MapManagementService.prototype.observePlaceFeatures = function () {
1271
1271
  var _this = this;
1272
1272
  this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe(function (c) {
1273
- var _a;
1273
+ var _a, _b;
1274
1274
  if (!_this.layers.has(c.layer))
1275
1275
  return;
1276
1276
  var source = _this.layers.take(c.layer).getSource();
1277
1277
  if (!!source['getSource'])
1278
1278
  source = (_a = source) === null || _a === void 0 ? void 0 : _a.getSource();
1279
1279
  source === null || source === void 0 ? void 0 : source.clear();
1280
- source === null || source === void 0 ? void 0 : source.addFeatures(c.features);
1280
+ !!((_b = c.features) === null || _b === void 0 ? void 0 : _b.length) && (source === null || source === void 0 ? void 0 : source.addFeatures(c.features));
1281
1281
  });
1282
1282
  };
1283
1283
  MapManagementService.prototype.observeRemoveLayer = function () {
@@ -1871,13 +1871,32 @@
1871
1871
  type: i0.Input
1872
1872
  }] } });
1873
1873
 
1874
+ /**
1875
+ * A layer that is responsible for showing and styling main features on the map, such as markers and polygons
1876
+ */
1874
1877
  var FeatureLayerSettings = /** @class */ (function () {
1875
1878
  function FeatureLayerSettings() {
1879
+ /**
1880
+ * The identifier of the field, it is autogenerated by default, but can be set manually
1881
+ */
1876
1882
  this.name = IdGenerator.get();
1883
+ /**
1884
+ * The priority of showing - layers with higher zIndex cover others in case of collisions
1885
+ */
1877
1886
  this.zIndex = 1;
1887
+ /**
1888
+ * The maximum zoom at which the layer is visible. 19 by default
1889
+ */
1878
1890
  this.maxZoom = 19;
1891
+ /**
1892
+ * The minimum zoom at which the layer is visible. 0 by default
1893
+ */
1879
1894
  this.minZoom = 0;
1880
1895
  }
1896
+ /**
1897
+ * Creates a clone of the existing settings
1898
+ * @param model
1899
+ */
1881
1900
  FeatureLayerSettings.copy = function (model) {
1882
1901
  var result = new FeatureLayerSettings();
1883
1902
  result.name = model.name;
@@ -1887,21 +1906,45 @@
1887
1906
  result.style = model.style;
1888
1907
  return result;
1889
1908
  };
1909
+ /**
1910
+ Setter for {@link FeatureLayerSettings.zIndex}
1911
+ * @param zIndex
1912
+ */
1890
1913
  FeatureLayerSettings.prototype.setZIndex = function (zIndex) {
1891
1914
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex: zIndex }));
1892
1915
  };
1916
+ /**
1917
+ * Setter for {@link FeatureLayerSettings.name}
1918
+ * @param name
1919
+ */
1893
1920
  FeatureLayerSettings.prototype.setName = function (name) {
1894
1921
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { name: name }));
1895
1922
  };
1923
+ /**
1924
+ * Setter for {@link FeatureLayerSettings.maxZoom}
1925
+ * @param maxZoom
1926
+ */
1896
1927
  FeatureLayerSettings.prototype.setMaxZoom = function (maxZoom) {
1897
1928
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom: maxZoom }));
1898
1929
  };
1930
+ /**
1931
+ * Setter for {@link FeatureLayerSettings.minZoom}
1932
+ * @param minZoom
1933
+ */
1899
1934
  FeatureLayerSettings.prototype.setMinZoom = function (minZoom) {
1900
1935
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom: minZoom }));
1901
1936
  };
1937
+ /**
1938
+ * Setter for {@link FeatureLayerSettings.style}
1939
+ * @param style
1940
+ */
1902
1941
  FeatureLayerSettings.prototype.setStyle = function (style) {
1903
1942
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { style: style }));
1904
1943
  };
1944
+ /**
1945
+ * Checks if the model has the same content
1946
+ * @param model - the object to compare
1947
+ */
1905
1948
  FeatureLayerSettings.prototype.isSame = function (model) {
1906
1949
  if (this.maxZoom !== model.maxZoom)
1907
1950
  return false;
@@ -2331,7 +2374,7 @@
2331
2374
  }
2332
2375
  Object.defineProperty(MarkersComponent.prototype, "markers", {
2333
2376
  set: function (value) {
2334
- this._markers = value;
2377
+ this._markers = value !== null && value !== void 0 ? value : [];
2335
2378
  this.putMarkers();
2336
2379
  },
2337
2380
  enumerable: false,
@@ -2345,8 +2388,7 @@
2345
2388
  .subscribe(function () { return _this.putMarkers(); });
2346
2389
  };
2347
2390
  MarkersComponent.prototype.putMarkers = function () {
2348
- var _a;
2349
- if (!((_a = this._markers) === null || _a === void 0 ? void 0 : _a.length))
2391
+ if (!this._markers)
2350
2392
  return;
2351
2393
  this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map(function (m) { return m.feature; })));
2352
2394
  };
@@ -2494,7 +2536,7 @@
2494
2536
  }
2495
2537
  Object.defineProperty(PolygonsComponent.prototype, "polygons", {
2496
2538
  set: function (value) {
2497
- this._polygons = value;
2539
+ this._polygons = value !== null && value !== void 0 ? value : [];
2498
2540
  this.putPolygons();
2499
2541
  },
2500
2542
  enumerable: false,