@artstesh/maps 4.1.1 → 4.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.
@@ -593,13 +593,14 @@ class MapManagementService {
593
593
  }
594
594
  observePlaceFeatures() {
595
595
  this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe((c) => {
596
+ var _a;
596
597
  if (!this.layers.has(c.layer))
597
598
  return;
598
599
  let source = this.layers.take(c.layer).getSource();
599
600
  if (!!source['getSource'])
600
601
  source = source === null || source === void 0 ? void 0 : source.getSource();
601
602
  source === null || source === void 0 ? void 0 : source.clear();
602
- source === null || source === void 0 ? void 0 : source.addFeatures(c.features);
603
+ !!((_a = c.features) === null || _a === void 0 ? void 0 : _a.length) && (source === null || source === void 0 ? void 0 : source.addFeatures(c.features));
603
604
  });
604
605
  }
605
606
  observeRemoveLayer() {
@@ -1133,13 +1134,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1133
1134
  type: Input
1134
1135
  }] } });
1135
1136
 
1137
+ /**
1138
+ * A layer that is responsible for showing and styling main features on the map, such as markers and polygons
1139
+ */
1136
1140
  class FeatureLayerSettings {
1137
1141
  constructor() {
1142
+ /**
1143
+ * The identifier of the field, it is autogenerated by default, but can be set manually
1144
+ */
1138
1145
  this.name = IdGenerator.get();
1146
+ /**
1147
+ * The priority of showing - layers with higher zIndex cover others in case of collisions
1148
+ */
1139
1149
  this.zIndex = 1;
1150
+ /**
1151
+ * The maximum zoom at which the layer is visible. 19 by default
1152
+ */
1140
1153
  this.maxZoom = 19;
1154
+ /**
1155
+ * The minimum zoom at which the layer is visible. 0 by default
1156
+ */
1141
1157
  this.minZoom = 0;
1142
1158
  }
1159
+ /**
1160
+ * Creates a clone of the existing settings
1161
+ * @param model
1162
+ */
1143
1163
  static copy(model) {
1144
1164
  const result = new FeatureLayerSettings();
1145
1165
  result.name = model.name;
@@ -1149,21 +1169,45 @@ class FeatureLayerSettings {
1149
1169
  result.style = model.style;
1150
1170
  return result;
1151
1171
  }
1172
+ /**
1173
+ Setter for {@link FeatureLayerSettings.zIndex}
1174
+ * @param zIndex
1175
+ */
1152
1176
  setZIndex(zIndex) {
1153
1177
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
1154
1178
  }
1179
+ /**
1180
+ * Setter for {@link FeatureLayerSettings.name}
1181
+ * @param name
1182
+ */
1155
1183
  setName(name) {
1156
1184
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { name }));
1157
1185
  }
1186
+ /**
1187
+ * Setter for {@link FeatureLayerSettings.maxZoom}
1188
+ * @param maxZoom
1189
+ */
1158
1190
  setMaxZoom(maxZoom) {
1159
1191
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
1160
1192
  }
1193
+ /**
1194
+ * Setter for {@link FeatureLayerSettings.minZoom}
1195
+ * @param minZoom
1196
+ */
1161
1197
  setMinZoom(minZoom) {
1162
1198
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
1163
1199
  }
1200
+ /**
1201
+ * Setter for {@link FeatureLayerSettings.style}
1202
+ * @param style
1203
+ */
1164
1204
  setStyle(style) {
1165
1205
  return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { style }));
1166
1206
  }
1207
+ /**
1208
+ * Checks if the model has the same content
1209
+ * @param model - the object to compare
1210
+ */
1167
1211
  isSame(model) {
1168
1212
  if (this.maxZoom !== model.maxZoom)
1169
1213
  return false;
@@ -1535,7 +1579,7 @@ class MarkersComponent extends DestructibleComponent {
1535
1579
  this._markers = [];
1536
1580
  }
1537
1581
  set markers(value) {
1538
- this._markers = value;
1582
+ this._markers = value !== null && value !== void 0 ? value : [];
1539
1583
  this.putMarkers();
1540
1584
  }
1541
1585
  ngOnInit() {
@@ -1545,8 +1589,7 @@ class MarkersComponent extends DestructibleComponent {
1545
1589
  .subscribe(() => this.putMarkers());
1546
1590
  }
1547
1591
  putMarkers() {
1548
- var _a;
1549
- if (!((_a = this._markers) === null || _a === void 0 ? void 0 : _a.length))
1592
+ if (!this._markers)
1550
1593
  return;
1551
1594
  this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
1552
1595
  }
@@ -1669,7 +1712,7 @@ class PolygonsComponent extends DestructibleComponent {
1669
1712
  this._polygons = [];
1670
1713
  }
1671
1714
  set polygons(value) {
1672
- this._polygons = value;
1715
+ this._polygons = value !== null && value !== void 0 ? value : [];
1673
1716
  this.putPolygons();
1674
1717
  }
1675
1718
  ngOnInit() {