@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.
@@ -598,7 +598,7 @@ class MapManagementService {
598
598
  if (!!source['getSource'])
599
599
  source = source?.getSource();
600
600
  source?.clear();
601
- source?.addFeatures(c.features);
601
+ !!c.features?.length && source?.addFeatures(c.features);
602
602
  });
603
603
  }
604
604
  observeRemoveLayer() {
@@ -1119,13 +1119,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1119
1119
  type: Input
1120
1120
  }] } });
1121
1121
 
1122
+ /**
1123
+ * A layer that is responsible for showing and styling main features on the map, such as markers and polygons
1124
+ */
1122
1125
  class FeatureLayerSettings {
1123
1126
  constructor() {
1127
+ /**
1128
+ * The identifier of the field, it is autogenerated by default, but can be set manually
1129
+ */
1124
1130
  this.name = IdGenerator.get();
1131
+ /**
1132
+ * The priority of showing - layers with higher zIndex cover others in case of collisions
1133
+ */
1125
1134
  this.zIndex = 1;
1135
+ /**
1136
+ * The maximum zoom at which the layer is visible. 19 by default
1137
+ */
1126
1138
  this.maxZoom = 19;
1139
+ /**
1140
+ * The minimum zoom at which the layer is visible. 0 by default
1141
+ */
1127
1142
  this.minZoom = 0;
1128
1143
  }
1144
+ /**
1145
+ * Creates a clone of the existing settings
1146
+ * @param model
1147
+ */
1129
1148
  static copy(model) {
1130
1149
  const result = new FeatureLayerSettings();
1131
1150
  result.name = model.name;
@@ -1135,21 +1154,45 @@ class FeatureLayerSettings {
1135
1154
  result.style = model.style;
1136
1155
  return result;
1137
1156
  }
1157
+ /**
1158
+ Setter for {@link FeatureLayerSettings.zIndex}
1159
+ * @param zIndex
1160
+ */
1138
1161
  setZIndex(zIndex) {
1139
1162
  return FeatureLayerSettings.copy({ ...this, zIndex });
1140
1163
  }
1164
+ /**
1165
+ * Setter for {@link FeatureLayerSettings.name}
1166
+ * @param name
1167
+ */
1141
1168
  setName(name) {
1142
1169
  return FeatureLayerSettings.copy({ ...this, name });
1143
1170
  }
1171
+ /**
1172
+ * Setter for {@link FeatureLayerSettings.maxZoom}
1173
+ * @param maxZoom
1174
+ */
1144
1175
  setMaxZoom(maxZoom) {
1145
1176
  return FeatureLayerSettings.copy({ ...this, maxZoom });
1146
1177
  }
1178
+ /**
1179
+ * Setter for {@link FeatureLayerSettings.minZoom}
1180
+ * @param minZoom
1181
+ */
1147
1182
  setMinZoom(minZoom) {
1148
1183
  return FeatureLayerSettings.copy({ ...this, minZoom });
1149
1184
  }
1185
+ /**
1186
+ * Setter for {@link FeatureLayerSettings.style}
1187
+ * @param style
1188
+ */
1150
1189
  setStyle(style) {
1151
1190
  return FeatureLayerSettings.copy({ ...this, style });
1152
1191
  }
1192
+ /**
1193
+ * Checks if the model has the same content
1194
+ * @param model - the object to compare
1195
+ */
1153
1196
  isSame(model) {
1154
1197
  if (this.maxZoom !== model.maxZoom)
1155
1198
  return false;
@@ -1517,7 +1560,7 @@ class MarkersComponent extends DestructibleComponent {
1517
1560
  this._markers = [];
1518
1561
  }
1519
1562
  set markers(value) {
1520
- this._markers = value;
1563
+ this._markers = value ?? [];
1521
1564
  this.putMarkers();
1522
1565
  }
1523
1566
  ngOnInit() {
@@ -1527,7 +1570,7 @@ class MarkersComponent extends DestructibleComponent {
1527
1570
  .subscribe(() => this.putMarkers());
1528
1571
  }
1529
1572
  putMarkers() {
1530
- if (!this._markers?.length)
1573
+ if (!this._markers)
1531
1574
  return;
1532
1575
  this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
1533
1576
  }
@@ -1647,7 +1690,7 @@ class PolygonsComponent extends DestructibleComponent {
1647
1690
  this._polygons = [];
1648
1691
  }
1649
1692
  set polygons(value) {
1650
- this._polygons = value;
1693
+ this._polygons = value ?? [];
1651
1694
  this.putPolygons();
1652
1695
  }
1653
1696
  ngOnInit() {