@artstesh/maps 4.1.8 → 4.1.9

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 (101) hide show
  1. package/dist/esm2020/map/helpers/marker-style.helper.mjs +27 -1
  2. package/dist/esm2020/map/helpers/polygon-style.helper.mjs +22 -1
  3. package/dist/esm2020/map/helpers/stringify-feature.helper.mjs +24 -21
  4. package/dist/esm2020/map/helpers/text-style.helper.mjs +12 -1
  5. package/dist/esm2020/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +24 -7
  6. package/dist/esm2020/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +72 -1
  7. package/dist/esm2020/map/map-plate/features/markers/markers.component.mjs +11 -1
  8. package/dist/esm2020/map/map-plate/features/polygons/polygons.component.mjs +11 -1
  9. package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +15 -7
  10. package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +79 -1
  11. package/dist/esm2020/map/map-plate/layers/feature-layer/feature-layer.component.mjs +7 -7
  12. package/dist/esm2020/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +37 -17
  13. package/dist/esm2020/map/map-plate/layers/tile-layer/tile-layer.component.mjs +7 -7
  14. package/dist/esm2020/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +76 -1
  15. package/dist/esm2020/map/map-plate/map-plate.component.mjs +2 -2
  16. package/dist/esm2020/map/map-plate/tooltips/tooltip/tooltip.component.mjs +19 -19
  17. package/dist/esm2020/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +1 -1
  18. package/dist/esm2020/map/messages/commands/fit-to-polygons.command.mjs +1 -1
  19. package/dist/esm2020/map/models/map-control.mjs +2 -2
  20. package/dist/esm2020/map/models/marker-model.mjs +1 -1
  21. package/dist/esm2020/map/models/polygon.model.mjs +11 -11
  22. package/dist/esm2020/map/services/feature.service.mjs +6 -6
  23. package/dist/esm2020/map/services/map-click.service.mjs +9 -9
  24. package/dist/esm2020/map/services/map-feature.service.mjs +1 -1
  25. package/dist/esm2020/map/services/map-state.service.mjs +2 -3
  26. package/dist/esm2020/src/map/helpers/marker-style.helper.mjs +27 -1
  27. package/dist/esm2020/src/map/helpers/polygon-style.helper.mjs +22 -1
  28. package/dist/esm2020/src/map/helpers/stringify-feature.helper.mjs +24 -21
  29. package/dist/esm2020/src/map/helpers/text-style.helper.mjs +12 -1
  30. package/dist/esm2020/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +24 -7
  31. package/dist/esm2020/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +72 -1
  32. package/dist/esm2020/src/map/map-plate/features/markers/markers.component.mjs +11 -1
  33. package/dist/esm2020/src/map/map-plate/features/polygons/polygons.component.mjs +11 -1
  34. package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +15 -7
  35. package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +79 -1
  36. package/dist/esm2020/src/map/map-plate/layers/feature-layer/feature-layer.component.mjs +7 -7
  37. package/dist/esm2020/src/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +37 -17
  38. package/dist/esm2020/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +7 -7
  39. package/dist/esm2020/src/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +76 -1
  40. package/dist/esm2020/src/map/map-plate/map-plate.component.mjs +2 -2
  41. package/dist/esm2020/src/map/map-plate/tooltips/tooltip/tooltip.component.mjs +19 -19
  42. package/dist/esm2020/src/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +1 -1
  43. package/dist/esm2020/src/map/messages/commands/fit-to-polygons.command.mjs +1 -1
  44. package/dist/esm2020/src/map/models/map-control.mjs +2 -2
  45. package/dist/esm2020/src/map/models/marker-model.mjs +1 -1
  46. package/dist/esm2020/src/map/models/polygon.model.mjs +11 -11
  47. package/dist/esm2020/src/map/services/feature.service.mjs +6 -6
  48. package/dist/esm2020/src/map/services/map-click.service.mjs +9 -9
  49. package/dist/esm2020/src/map/services/map-feature.service.mjs +1 -1
  50. package/dist/esm2020/src/map/services/map-state.service.mjs +2 -3
  51. package/dist/fesm2015/maps-components-src-map.mjs +457 -106
  52. package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
  53. package/dist/fesm2015/maps-components.mjs +457 -106
  54. package/dist/fesm2015/maps-components.mjs.map +1 -1
  55. package/dist/fesm2020/maps-components-src-map.mjs +454 -103
  56. package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
  57. package/dist/fesm2020/maps-components.mjs +454 -103
  58. package/dist/fesm2020/maps-components.mjs.map +1 -1
  59. package/dist/map/helpers/marker-style.helper.d.ts +26 -0
  60. package/dist/map/helpers/polygon-style.helper.d.ts +21 -0
  61. package/dist/map/helpers/stringify-feature.helper.d.ts +18 -0
  62. package/dist/map/helpers/text-style.helper.d.ts +11 -0
  63. package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +20 -3
  64. package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +71 -0
  65. package/dist/map/map-plate/features/markers/markers.component.d.ts +10 -0
  66. package/dist/map/map-plate/features/polygons/polygons.component.d.ts +10 -0
  67. package/dist/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +10 -2
  68. package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +78 -0
  69. package/dist/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +2 -2
  70. package/dist/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +36 -16
  71. package/dist/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +1 -1
  72. package/dist/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +75 -0
  73. package/dist/map/map-plate/map-plate.component.d.ts +2 -2
  74. package/dist/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +5 -5
  75. package/dist/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +1 -1
  76. package/dist/map/models/map-control.d.ts +1 -1
  77. package/dist/map/models/polygon.model.d.ts +2 -2
  78. package/dist/map/services/feature.service.d.ts +1 -1
  79. package/dist/map/services/map-click.service.d.ts +1 -1
  80. package/dist/src/map/helpers/marker-style.helper.d.ts +26 -0
  81. package/dist/src/map/helpers/polygon-style.helper.d.ts +21 -0
  82. package/dist/src/map/helpers/stringify-feature.helper.d.ts +18 -0
  83. package/dist/src/map/helpers/text-style.helper.d.ts +11 -0
  84. package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +20 -3
  85. package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +71 -0
  86. package/dist/src/map/map-plate/features/markers/markers.component.d.ts +10 -0
  87. package/dist/src/map/map-plate/features/polygons/polygons.component.d.ts +10 -0
  88. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +10 -2
  89. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +78 -0
  90. package/dist/src/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +2 -2
  91. package/dist/src/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +36 -16
  92. package/dist/src/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +1 -1
  93. package/dist/src/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +75 -0
  94. package/dist/src/map/map-plate/map-plate.component.d.ts +2 -2
  95. package/dist/src/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +5 -5
  96. package/dist/src/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +1 -1
  97. package/dist/src/map/models/map-control.d.ts +1 -1
  98. package/dist/src/map/models/polygon.model.d.ts +2 -2
  99. package/dist/src/map/services/feature.service.d.ts +1 -1
  100. package/dist/src/map/services/map-click.service.d.ts +1 -1
  101. package/package.json +1 -1
@@ -3,7 +3,7 @@ import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgMod
3
3
  import * as i4 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { Feature, Collection } from 'ol';
6
- import { Point, LineString } from 'ol/geom';
6
+ import { Point } from 'ol/geom';
7
7
  import { GeoJSON, WKT } from 'ol/format';
8
8
  import { getCenter, createEmpty, extend } from 'ol/extent';
9
9
  import { Control, Zoom } from 'ol/control';
@@ -157,16 +157,6 @@ class MarkerModel {
157
157
  }
158
158
 
159
159
  class PolygonModel {
160
- static fromGeoJson(id, json, info) {
161
- let feature = new GeoJSON().readFeature(json);
162
- feature.setId(id);
163
- return new PolygonModel(feature, id, info);
164
- }
165
- static fromWKT(id, wkt, info) {
166
- let feature = new WKT().readFeature(wkt);
167
- feature.setId(id);
168
- return new PolygonModel(feature, id, info);
169
- }
170
160
  constructor(feature, id, info) {
171
161
  this.info = info;
172
162
  this.id = id == null ? IdGenerator.get() : id;
@@ -178,6 +168,16 @@ class PolygonModel {
178
168
  get feature() {
179
169
  return this._feature;
180
170
  }
171
+ static fromGeoJson(id, json, info) {
172
+ let feature = new GeoJSON().readFeature(json);
173
+ feature.setId(id);
174
+ return new PolygonModel(feature, id, info);
175
+ }
176
+ static fromWKT(id, wkt, info) {
177
+ let feature = new WKT().readFeature(wkt);
178
+ feature.setId(id);
179
+ return new PolygonModel(feature, id, info);
180
+ }
181
181
  }
182
182
 
183
183
  var DrawingType;
@@ -196,7 +196,7 @@ var FeatureOutputFormat;
196
196
 
197
197
  /**
198
198
  *
199
- * A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
199
+ * A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default, these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
200
200
  * This is the base class for controls. You can use it for simple custom controls by creating the element with listeners, creating an instance:
201
201
  * var myControl = new Control({element: myElement}); and then adding this to the map.
202
202
  * The main advantage of having this as a control rather than a simple separate DOM element is that preventing propagation is handled for you. Controls will also be objects in a module:ol/Collection~Collection, so you can use their methods.
@@ -491,6 +491,11 @@ class FeatureService {
491
491
  static filterFeaturesInArea(query) {
492
492
  return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
493
493
  }
494
+ static calculateArea(g) {
495
+ if (!g)
496
+ return 0;
497
+ return Sphere.getArea(g, { projection: 'EPSG:4326' });
498
+ }
494
499
  static booleanIntersects(g1, g2) {
495
500
  if (g2.getType() === 'Point')
496
501
  return g1.intersectsCoordinate(g2.getCoordinates());
@@ -500,11 +505,6 @@ class FeatureService {
500
505
  return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
501
506
  return false;
502
507
  }
503
- static calculateArea(g) {
504
- if (!g)
505
- return 0;
506
- return Sphere.getArea(g, { projection: 'EPSG:4326' });
507
- }
508
508
  }
509
509
 
510
510
  class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
@@ -754,14 +754,6 @@ class MapClickService {
754
754
  up() {
755
755
  this.observeMapRender();
756
756
  }
757
- observeMapRender() {
758
- this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
759
- this.map = m.map;
760
- this.map?.on('singleclick', (e) => {
761
- this.postboy.fire(this.onClick(e));
762
- });
763
- });
764
- }
765
757
  onClick(ev) {
766
758
  const model = new MapClickEvent(ev.coordinate, {}, {});
767
759
  this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
@@ -779,6 +771,14 @@ class MapClickService {
779
771
  });
780
772
  return model;
781
773
  }
774
+ observeMapRender() {
775
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
776
+ this.map = m.map;
777
+ this.map?.on('singleclick', (e) => {
778
+ this.postboy.fire(this.onClick(e));
779
+ });
780
+ });
781
+ }
782
782
  getFeatureCollectionWithInner(features) {
783
783
  const result = [];
784
784
  features?.forEach((f) => {
@@ -1036,14 +1036,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1036
1036
  type: Injectable
1037
1037
  }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }, { type: ControlsService }]; } });
1038
1038
 
1039
+ /**
1040
+ * Class representing settings for a tile layer.
1041
+ */
1039
1042
  class TileLayerSettings {
1040
1043
  constructor() {
1044
+ /**
1045
+ * The maximum zoom level for a map view.
1046
+ *
1047
+ * @type {number}
1048
+ * @default 19
1049
+ */
1041
1050
  this.maxZoom = 19;
1051
+ /**
1052
+ * The minimum zoom level allowed.
1053
+ *
1054
+ * @type {number}
1055
+ */
1042
1056
  this.minZoom = 0;
1057
+ /**
1058
+ * The opacity of an element.
1059
+ *
1060
+ * @type {number}
1061
+ * @default 0.6
1062
+ */
1043
1063
  this.opacity = 0.6;
1064
+ /**
1065
+ * Represents the tiles URL.
1066
+ * @typedef {string} url
1067
+ *
1068
+ * @example
1069
+ * 'https://example.ex/{z}/{x}/{y}.png'
1070
+ */
1044
1071
  this.url = '';
1072
+ /**
1073
+ * The projection of the coordinate system.
1074
+ *
1075
+ * @type {string}
1076
+ * @default 'EPSG:3857'
1077
+ */
1045
1078
  this.projection = 'EPSG:3857';
1046
1079
  }
1080
+ /**
1081
+ * Creates a copy of the given tile layer settings.
1082
+ *
1083
+ * @param {TileLayerSettings} model - The tile layer settings to be copied.
1084
+ * @return {TileLayerSettings} - A new instance of TileLayerSettings with the same properties as the model.
1085
+ */
1047
1086
  static copy(model) {
1048
1087
  const result = new TileLayerSettings();
1049
1088
  result.maxZoom = model.maxZoom;
@@ -1053,21 +1092,57 @@ class TileLayerSettings {
1053
1092
  result.url = model.url;
1054
1093
  return result;
1055
1094
  }
1095
+ /**
1096
+ * Sets the URL of the TileLayerSettings object.
1097
+ *
1098
+ * @param {string} url - The URL to be set.
1099
+ * @return {TileLayerSettings} - The updated TileLayerSettings object.
1100
+ */
1056
1101
  setUrl(url) {
1057
1102
  return TileLayerSettings.copy({ ...this, url });
1058
1103
  }
1104
+ /**
1105
+ * Sets the maximum zoom level for the tile layer.
1106
+ *
1107
+ * @param {number} maxZoom - The maximum zoom level.
1108
+ * @returns {TileLayerSettings} - The updated tile layer settings object.
1109
+ */
1059
1110
  setMaxZoom(maxZoom) {
1060
1111
  return TileLayerSettings.copy({ ...this, maxZoom });
1061
1112
  }
1113
+ /**
1114
+ * Sets the minimum zoom level for the Tile Layer.
1115
+ *
1116
+ * @param {number} minZoom - The minimum zoom level to be set.
1117
+ * @return {TileLayerSettings} The modified TileLayerSettings object with the updated minimum zoom level.
1118
+ */
1062
1119
  setMinZoom(minZoom) {
1063
1120
  return TileLayerSettings.copy({ ...this, minZoom });
1064
1121
  }
1122
+ /**
1123
+ * Sets the opacity of the TileLayerSettings.
1124
+ *
1125
+ * @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
1126
+ * @return {TileLayerSettings} - A new instance of TileLayerSettings with the opacity set.
1127
+ */
1065
1128
  setOpacity(opacity) {
1066
1129
  return TileLayerSettings.copy({ ...this, opacity });
1067
1130
  }
1131
+ /**
1132
+ * Sets the projection for the tile layer settings.
1133
+ *
1134
+ * @param {string} projection - The desired projection for the tile layer settings.
1135
+ * @return {TileLayerSettings} - The updated tile layer settings with the new projection.
1136
+ */
1068
1137
  setProjection(projection) {
1069
1138
  return TileLayerSettings.copy({ ...this, projection });
1070
1139
  }
1140
+ /**
1141
+ * Checks if the current instance of TileLayerSettings is equal to the given model.
1142
+ * @param {TileLayerSettings} model - The model to compare against.
1143
+ * @return {boolean} - True if all properties of the current instance matches the properties of the model;
1144
+ * otherwise, false.
1145
+ */
1071
1146
  isSame(model) {
1072
1147
  if (this.maxZoom !== model.maxZoom)
1073
1148
  return false;
@@ -1136,18 +1211,18 @@ class TileLayerComponent extends DestructibleComponent {
1136
1211
  this._settings = new TileLayerSettings();
1137
1212
  this.onDestroy = () => this.removeLayer();
1138
1213
  }
1139
- ngOnInit() {
1140
- this.postboy
1141
- .subscribe(MapRenderedEvent.ID)
1142
- .pipe(filter((m) => !!m), first())
1143
- .subscribe((m) => this.initLayer());
1144
- }
1145
1214
  set settings(value) {
1146
1215
  if (!value || this._settings.isSame(value))
1147
1216
  return;
1148
1217
  this._settings = value;
1149
1218
  this.initLayer();
1150
1219
  }
1220
+ ngOnInit() {
1221
+ this.postboy
1222
+ .subscribe(MapRenderedEvent.ID)
1223
+ .pipe(filter((m) => !!m), first())
1224
+ .subscribe((m) => this.initLayer());
1225
+ }
1151
1226
  initLayer() {
1152
1227
  this.removeLayer();
1153
1228
  this.layer = this.factory.build(this._settings);
@@ -1231,17 +1306,24 @@ class FeatureLayerSettings {
1231
1306
  */
1232
1307
  this.zIndex = 1;
1233
1308
  /**
1234
- * The maximum zoom at which the layer is visible. 19 by default
1309
+ The maximum view zoom level (inclusive) at which this layer will be visible.
1310
+
1311
+ @type {number}
1312
+ @default 19
1235
1313
  */
1236
1314
  this.maxZoom = 19;
1237
1315
  /**
1238
- * The minimum zoom at which the layer is visible. 0 by default
1316
+ The minimum view zoom level (exclusive) at which this layer will be visible.
1317
+
1318
+ @type {number}
1239
1319
  */
1240
1320
  this.minZoom = 0;
1241
1321
  }
1242
1322
  /**
1243
- * Creates a clone of the existing settings
1244
- * @param model
1323
+ * Copies the given FeatureLayerSettings object
1324
+ *
1325
+ * @param {FeatureLayerSettings} model - The FeatureLayerSettings object to be copied
1326
+ * @returns {FeatureLayerSettings} - A copy of the FeatureLayerSettings object
1245
1327
  */
1246
1328
  static copy(model) {
1247
1329
  const result = new FeatureLayerSettings();
@@ -1253,43 +1335,56 @@ class FeatureLayerSettings {
1253
1335
  return result;
1254
1336
  }
1255
1337
  /**
1256
- Setter for {@link FeatureLayerSettings.zIndex}
1257
- * @param zIndex
1338
+ * Sets the z-index value for the FeatureLayerSettings object.
1339
+ *
1340
+ * @param {number} zIndex - The new z-index value.
1341
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
1258
1342
  */
1259
1343
  setZIndex(zIndex) {
1260
1344
  return FeatureLayerSettings.copy({ ...this, zIndex });
1261
1345
  }
1262
1346
  /**
1263
- * Setter for {@link FeatureLayerSettings.name}
1264
- * @param name
1347
+ * Sets the name of the FeatureLayerSettings.
1348
+ *
1349
+ * @param {string} name - The name to set for the FeatureLayerSettings.
1350
+ *
1351
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new name.
1265
1352
  */
1266
1353
  setName(name) {
1267
1354
  return FeatureLayerSettings.copy({ ...this, name });
1268
1355
  }
1269
1356
  /**
1270
- * Setter for {@link FeatureLayerSettings.maxZoom}
1271
- * @param maxZoom
1357
+ * Sets the maximum zoom level for the FeatureLayerSettings.
1358
+ *
1359
+ * @param {number} maxZoom - The maximum zoom level.
1360
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
1272
1361
  */
1273
1362
  setMaxZoom(maxZoom) {
1274
1363
  return FeatureLayerSettings.copy({ ...this, maxZoom });
1275
1364
  }
1276
1365
  /**
1277
- * Setter for {@link FeatureLayerSettings.minZoom}
1278
- * @param minZoom
1366
+ * Sets the minimum zoom level for the feature layer.
1367
+ *
1368
+ * @param {number} minZoom The minimum zoom level to be set.
1369
+ * @returns {FeatureLayerSettings} The updated feature layer settings object.
1279
1370
  */
1280
1371
  setMinZoom(minZoom) {
1281
1372
  return FeatureLayerSettings.copy({ ...this, minZoom });
1282
1373
  }
1283
1374
  /**
1284
- * Setter for {@link FeatureLayerSettings.style}
1285
- * @param style
1375
+ * Sets the style for the FeatureLayerSettings object.
1376
+ *
1377
+ * @param {Style | StyleFunction} style - The new style to set. It can be either a Style object or a StyleFunction.
1378
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new style.
1286
1379
  */
1287
1380
  setStyle(style) {
1288
1381
  return FeatureLayerSettings.copy({ ...this, style });
1289
1382
  }
1290
1383
  /**
1291
- * Checks if the model has the same content
1292
- * @param model - the object to compare
1384
+ * Checks if the given FeatureLayerSettings object is identical to the current object.
1385
+ *
1386
+ * @param {FeatureLayerSettings} model - The FeatureLayerSettings object to compare with.
1387
+ * @return {boolean} - Returns true if the given object is identical to the current object, otherwise false.
1293
1388
  */
1294
1389
  isSame(model) {
1295
1390
  if (this.maxZoom !== model.maxZoom)
@@ -1339,18 +1434,18 @@ class FeatureLayerComponent extends DestructibleComponent {
1339
1434
  this._settings = new FeatureLayerSettings();
1340
1435
  this.onDestroy = () => this.removeLayer();
1341
1436
  }
1342
- ngOnInit() {
1343
- this.postboy
1344
- .subscribe(MapRenderedEvent.ID)
1345
- .pipe(filter((m) => !!m), first())
1346
- .subscribe((m) => this.initLayer());
1347
- }
1348
1437
  set settings(value) {
1349
1438
  if (!value || this._settings.isSame(value))
1350
1439
  return;
1351
1440
  this._settings = value;
1352
1441
  this.initLayer();
1353
1442
  }
1443
+ ngOnInit() {
1444
+ this.postboy
1445
+ .subscribe(MapRenderedEvent.ID)
1446
+ .pipe(filter((m) => !!m), first())
1447
+ .subscribe((m) => this.initLayer());
1448
+ }
1354
1449
  initLayer() {
1355
1450
  this.removeLayer();
1356
1451
  this.layer = this.factory.build(this._settings);
@@ -1374,12 +1469,34 @@ class ClusterLayerSettings {
1374
1469
  constructor() {
1375
1470
  this.name = IdGenerator.get();
1376
1471
  this.zIndex = 1;
1472
+ /**
1473
+ * The maximum view zoom level (inclusive) at which this layer will be visible.
1474
+ *
1475
+ * @type {number}
1476
+ * @default 19
1477
+ */
1377
1478
  this.maxZoom = 19;
1479
+ /**
1480
+ * The minimum view zoom level (exclusive) at which this layer will be visible.
1481
+ *
1482
+ * @type {number}
1483
+ */
1378
1484
  this.minZoom = 0;
1485
+ /**
1486
+ * Distance in pixels within which features will be clustered together.
1487
+ *
1488
+ * @type {number}
1489
+ */
1379
1490
  this.distance = 20;
1380
1491
  this.bbox = false;
1381
1492
  this.clusterCancel = 14;
1382
1493
  }
1494
+ /**
1495
+ * Creates a copy of the given ClusterLayerSettings object.
1496
+ *
1497
+ * @param {ClusterLayerSettings} model - The ClusterLayerSettings object to be copied.
1498
+ * @returns {ClusterLayerSettings} - A new ClusterLayerSettings object that is a copy of the original object.
1499
+ */
1383
1500
  static copy(model) {
1384
1501
  const result = new ClusterLayerSettings();
1385
1502
  result.name = model.name;
@@ -1392,30 +1509,86 @@ class ClusterLayerSettings {
1392
1509
  result.style = model.style;
1393
1510
  return result;
1394
1511
  }
1512
+ /**
1513
+ * Set the z-index for the ClusterLayer.
1514
+ *
1515
+ * @param {number} zIndex - The new z-index for the ClusterLayer.
1516
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1517
+ */
1395
1518
  setZIndex(zIndex) {
1396
1519
  return ClusterLayerSettings.copy({ ...this, zIndex });
1397
1520
  }
1521
+ /**
1522
+ * Sets the distance value for ClusterLayerSettings.
1523
+ *
1524
+ * @param {number} distance - The distance value to be set.
1525
+ * @return {ClusterLayerSettings} - The modified ClusterLayerSettings object.
1526
+ */
1398
1527
  setDistance(distance) {
1399
1528
  return ClusterLayerSettings.copy({ ...this, distance });
1400
1529
  }
1530
+ /**
1531
+ * Sets the name of the ClusterLayerSettings object.
1532
+ *
1533
+ * @param {string} name - The name to set for the ClusterLayerSettings.
1534
+ * @return {ClusterLayerSettings} - A new ClusterLayerSettings object with the updated name.
1535
+ */
1401
1536
  setName(name) {
1402
1537
  return ClusterLayerSettings.copy({ ...this, name });
1403
1538
  }
1539
+ /**
1540
+ * Sets the maximum zoom level for the Cluster Layer.
1541
+ *
1542
+ * @param {number} maxZoom - The maximum zoom level to be set.
1543
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1544
+ */
1404
1545
  setMaxZoom(maxZoom) {
1405
1546
  return ClusterLayerSettings.copy({ ...this, maxZoom });
1406
1547
  }
1548
+ /**
1549
+ * Sets the minimum zoom level for the ClusterLayerSettings.
1550
+ *
1551
+ * @param {number} minZoom - The minimum zoom level to set.
1552
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1553
+ */
1407
1554
  setMinZoom(minZoom) {
1408
1555
  return ClusterLayerSettings.copy({ ...this, minZoom });
1409
1556
  }
1557
+ /**
1558
+ * Sets the cluster cancel number for the ClusterLayerSettings.
1559
+ *
1560
+ * @param {number} clusterCancel - The new cluster cancel number.
1561
+ * @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1562
+ */
1410
1563
  setClusterCancel(clusterCancel) {
1411
1564
  return ClusterLayerSettings.copy({ ...this, clusterCancel });
1412
1565
  }
1566
+ /**
1567
+ * Sets the value of 'bbox' property in the ClusterLayerSettings object.
1568
+ *
1569
+ * @param {boolean} bbox - A boolean value indicating whether to include bounding box calculation in the cluster layer settings.
1570
+ * @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object with the newly set 'bbox' value.
1571
+ */
1413
1572
  setBbox(bbox) {
1414
1573
  return ClusterLayerSettings.copy({ ...this, bbox });
1415
1574
  }
1575
+ /**
1576
+ * Sets the style for the ClusterLayerSettings.
1577
+ *
1578
+ * @param {function} style - A function that takes an array of identified features as input and returns a Style or StyleFunction.
1579
+ *
1580
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object with the new style applied.
1581
+ */
1416
1582
  setStyle(style) {
1417
1583
  return ClusterLayerSettings.copy({ ...this, style });
1418
1584
  }
1585
+ /**
1586
+ * Checks if the current ClusterLayerSettings object is the same as the specified model.
1587
+ *
1588
+ * @param {ClusterLayerSettings} model - The model to compare with the current object.
1589
+ *
1590
+ * @return {boolean} - Returns true if the current ClusterLayerSettings object is the same as the specified model, otherwise false.
1591
+ */
1419
1592
  isSame(model) {
1420
1593
  if (this.maxZoom !== model.maxZoom)
1421
1594
  return false;
@@ -1517,6 +1690,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1517
1690
  }]
1518
1691
  }] });
1519
1692
 
1693
+ /**
1694
+ * Represents a cluster layer component.
1695
+ */
1520
1696
  class ClusterLayerComponent extends DestructibleComponent {
1521
1697
  constructor(postboy, factory) {
1522
1698
  super();
@@ -1526,18 +1702,23 @@ class ClusterLayerComponent extends DestructibleComponent {
1526
1702
  this._settings = new ClusterLayerSettings();
1527
1703
  this.onDestroy = () => this.removeLayer();
1528
1704
  }
1529
- ngOnInit() {
1530
- this.postboy
1531
- .subscribe(MapRenderedEvent.ID)
1532
- .pipe(filter((m) => !!m), first())
1533
- .subscribe((m) => this.initLayer());
1534
- }
1705
+ /**
1706
+ * Sets the settings for the cluster layer.
1707
+ *
1708
+ * @param {ClusterLayerSettings | undefined} value - The settings for the cluster layer.
1709
+ */
1535
1710
  set settings(value) {
1536
1711
  if (!value || this._settings.isSame(value))
1537
1712
  return;
1538
1713
  this._settings = value;
1539
1714
  this.initLayer();
1540
1715
  }
1716
+ ngOnInit() {
1717
+ this.postboy
1718
+ .subscribe(MapRenderedEvent.ID)
1719
+ .pipe(filter((m) => !!m), first())
1720
+ .subscribe((m) => this.initLayer());
1721
+ }
1541
1722
  initLayer() {
1542
1723
  this.removeLayer();
1543
1724
  this.manager = this.factory.build(this._settings, this.postboy);
@@ -1589,8 +1770,8 @@ class MapPlateComponent extends DestructibleComponent {
1589
1770
  this.registrator = registrator;
1590
1771
  this.detector = detector;
1591
1772
  this.osmUrl = '';
1592
- this._settings = new MapSettings();
1593
1773
  this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
1774
+ this._settings = new MapSettings();
1594
1775
  this.onDestroy = () => {
1595
1776
  this.registrator.down();
1596
1777
  };
@@ -1652,6 +1833,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1652
1833
  type: Input
1653
1834
  }] } });
1654
1835
 
1836
+ /**
1837
+ * MarkersComponent is a component that displays markers on a map.
1838
+ * It listens for changes in the `markers` input property and
1839
+ * automatically puts the markers on the map using the MapPostboyService.
1840
+ */
1655
1841
  class MarkersComponent extends DestructibleComponent {
1656
1842
  constructor(postboy) {
1657
1843
  super();
@@ -1659,6 +1845,11 @@ class MarkersComponent extends DestructibleComponent {
1659
1845
  this.layerName = '';
1660
1846
  this._markers = [];
1661
1847
  }
1848
+ /**
1849
+ * Sets the markers property.
1850
+ *
1851
+ * @param {MarkerModel[]} value - The array of MarkerModel objects to set as markers.
1852
+ */
1662
1853
  set markers(value) {
1663
1854
  this._markers = value ?? [];
1664
1855
  this.putMarkers();
@@ -1716,22 +1907,12 @@ class TooltipSettings {
1716
1907
  }
1717
1908
 
1718
1909
  class TooltipComponent extends DestructibleComponent {
1719
- set settings(value) {
1720
- if (!value || this._settings.isSame(value))
1721
- return;
1722
- this._settings = value;
1723
- this.detector.detectChanges();
1724
- }
1725
1910
  constructor(postboy, detector) {
1726
1911
  super();
1727
1912
  this.postboy = postboy;
1728
1913
  this.detector = detector;
1729
- this._settings = new TooltipSettings();
1730
1914
  this.show = false;
1731
- this.removeOverlay = () => {
1732
- !!this.overlay && this.map?.removeOverlay(this.overlay);
1733
- this.show = false;
1734
- };
1915
+ this._settings = new TooltipSettings();
1735
1916
  this.options = (coordinates) => {
1736
1917
  return {
1737
1918
  element: this.container?.nativeElement,
@@ -1740,12 +1921,29 @@ class TooltipComponent extends DestructibleComponent {
1740
1921
  position: coordinates,
1741
1922
  };
1742
1923
  };
1924
+ this.removeOverlay = () => {
1925
+ !!this.overlay && this.map?.removeOverlay(this.overlay);
1926
+ this.show = false;
1927
+ };
1928
+ }
1929
+ set settings(value) {
1930
+ if (!value || this._settings.isSame(value))
1931
+ return;
1932
+ this._settings = value;
1933
+ this.detector.detectChanges();
1743
1934
  }
1744
1935
  ngOnInit() {
1745
1936
  this.subs.push(this.observeMapRender());
1746
1937
  this.subs.push(this.observeMapClick());
1747
1938
  this.subs.push(this.observeClose());
1748
1939
  }
1940
+ addOverlay(coordinates) {
1941
+ this.removeOverlay();
1942
+ this.overlay = new Overlay(this.options(coordinates));
1943
+ this.map?.addOverlay(this.overlay);
1944
+ this.show = true;
1945
+ this.detector.detectChanges();
1946
+ }
1749
1947
  observeMapClick() {
1750
1948
  return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
1751
1949
  this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
@@ -1762,13 +1960,6 @@ class TooltipComponent extends DestructibleComponent {
1762
1960
  this.map = m.map;
1763
1961
  });
1764
1962
  }
1765
- addOverlay(coordinates) {
1766
- this.removeOverlay();
1767
- this.overlay = new Overlay(this.options(coordinates));
1768
- this.map?.addOverlay(this.overlay);
1769
- this.show = true;
1770
- this.detector.detectChanges();
1771
- }
1772
1963
  }
1773
1964
  TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1774
1965
  TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TooltipComponent, selector: "art-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -1782,6 +1973,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1782
1973
  type: Input
1783
1974
  }] } });
1784
1975
 
1976
+ /**
1977
+ * Component for rendering polygons on a map.
1978
+ * It listens for changes in the `polygons` input property and
1979
+ * automatically puts the polygons on the map using the MapPostboyService.
1980
+ */
1785
1981
  class PolygonsComponent extends DestructibleComponent {
1786
1982
  constructor(postboy) {
1787
1983
  super();
@@ -1789,6 +1985,11 @@ class PolygonsComponent extends DestructibleComponent {
1789
1985
  this.layerName = '';
1790
1986
  this._polygons = [];
1791
1987
  }
1988
+ /**
1989
+ * Sets the value of polygons.
1990
+ *
1991
+ * @param {PolygonModel[]} value - The new value for polygons.
1992
+ */
1792
1993
  set polygons(value) {
1793
1994
  this._polygons = value ?? [];
1794
1995
  this.putPolygons();
@@ -1816,14 +2017,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1816
2017
  type: Input
1817
2018
  }] } });
1818
2019
 
2020
+ /**
2021
+ * Represents the settings for a zoom control.
2022
+ */
1819
2023
  class ZoomControlSettings {
1820
2024
  constructor() {
2025
+ /**
2026
+ * The CSS class name of the control element.
2027
+ *
2028
+ * @type {string}
2029
+ */
1821
2030
  this.controlClass = 'ol-zoom';
2031
+ /**
2032
+ * The CSS class name for zoom in button.
2033
+ * @type {string}
2034
+ */
1822
2035
  this.zoomInClass = 'ol-zoom-in';
2036
+ /**
2037
+ * The CSS class name for the zoom out button element.
2038
+ *
2039
+ * @type {string}
2040
+ */
1823
2041
  this.zoomOutClass = 'ol-zoom-out';
2042
+ /**
2043
+ * The label for the zoom in action.
2044
+ *
2045
+ * @type {string}
2046
+ */
1824
2047
  this.zoomInLabel = 'Zoom In';
2048
+ /**
2049
+ * The label for the zoom out control.
2050
+ *
2051
+ * @type {string}
2052
+ */
1825
2053
  this.zoomOutLabel = 'Zoom Out';
1826
2054
  }
2055
+ /**
2056
+ * Copies the provided ZoomControlSettings object.
2057
+ *
2058
+ * @param {ZoomControlSettings} model - The ZoomControlSettings object to be copied.
2059
+ * @return {ZoomControlSettings} - The copied ZoomControlSettings object.
2060
+ */
1827
2061
  static copy(model) {
1828
2062
  const result = new ZoomControlSettings();
1829
2063
  result.controlClass = model.controlClass;
@@ -1833,6 +2067,13 @@ class ZoomControlSettings {
1833
2067
  result.zoomOutLabel = model.zoomOutLabel;
1834
2068
  return result;
1835
2069
  }
2070
+ /**
2071
+ * Checks if the current ZoomControlSettings object is equal to the given model.
2072
+ *
2073
+ * @param {ZoomControlSettings} model - The ZoomControlSettings object to compare with.
2074
+ *
2075
+ * @return {boolean} - true if the current object is equal to the given model, false otherwise.
2076
+ */
1836
2077
  isSame(model) {
1837
2078
  if (this.zoomInClass !== model.zoomInClass)
1838
2079
  return false;
@@ -1846,30 +2087,61 @@ class ZoomControlSettings {
1846
2087
  return false;
1847
2088
  return true;
1848
2089
  }
2090
+ /**
2091
+ * Sets the zoom in label of the Zoom Control Settings.
2092
+ *
2093
+ * @param {string} zoomInLabel - The label for the zoom in button.
2094
+ * @return {ZoomControlSettings} - The new Zoom Control Settings object with the updated zoom in label.
2095
+ */
1849
2096
  setZoomInLabel(zoomInLabel) {
1850
2097
  return ZoomControlSettings.copy({ ...this, zoomInLabel });
1851
2098
  }
2099
+ /**
2100
+ * Sets the zoomOutClass property of the ZoomControlSettings object.
2101
+ *
2102
+ * @param {string} zoomOutClass - The CSS class to be assigned to the zoom out button.
2103
+ * @return {ZoomControlSettings} - The updated ZoomControlSettings object with the new zoomOutClass value.
2104
+ */
1852
2105
  setZoomOutClass(zoomOutClass) {
1853
2106
  return ZoomControlSettings.copy({ ...this, zoomOutClass });
1854
2107
  }
2108
+ /**
2109
+ * Sets the zoom in class for the zoom control settings.
2110
+ *
2111
+ * @param {string} zoomInClass - The new zoom in class to be set.
2112
+ * @return {ZoomControlSettings} - The updated zoom control settings.
2113
+ */
1855
2114
  setZoomInClass(zoomInClass) {
1856
2115
  return ZoomControlSettings.copy({ ...this, zoomInClass });
1857
2116
  }
2117
+ /**
2118
+ * Set the label for the zoom out control.
2119
+ *
2120
+ * @param {string} zoomOutLabel - The label for the zoom out control.
2121
+ * @returns {ZoomControlSettings} - The updated zoom control settings.
2122
+ */
1858
2123
  setZoomOutLabel(zoomOutLabel) {
1859
2124
  return ZoomControlSettings.copy({ ...this, zoomOutLabel });
1860
2125
  }
2126
+ /**
2127
+ * Sets the control class for the ZoomControlSettings.
2128
+ *
2129
+ * @param {string} controlClass - The class name of the control to be set.
2130
+ *
2131
+ * @return {ZoomControlSettings} - The modified ZoomControlSettings object.
2132
+ */
1861
2133
  setControlClass(controlClass) {
1862
2134
  return ZoomControlSettings.copy({ ...this, controlClass });
1863
2135
  }
1864
2136
  }
1865
2137
 
2138
+ /**
2139
+ * @class
2140
+ * @classdesc Represents a component for the Zoom control on a map.
2141
+ * @extends DestructibleComponent
2142
+ * @implements OnInit
2143
+ */
1866
2144
  class MapControlZoomComponent extends DestructibleComponent {
1867
- set settings(value) {
1868
- if (!value || this._settings.isSame(value))
1869
- return;
1870
- this._settings = value;
1871
- this.setControl();
1872
- }
1873
2145
  constructor(postboy) {
1874
2146
  super();
1875
2147
  this.postboy = postboy;
@@ -1879,6 +2151,23 @@ class MapControlZoomComponent extends DestructibleComponent {
1879
2151
  };
1880
2152
  this.eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
1881
2153
  }
2154
+ /**
2155
+ * Sets the settings for the Zoom Control.
2156
+ *
2157
+ * @param {ZoomControlSettings | undefined} value - The new settings for the Zoom Control.
2158
+ *
2159
+ * @description
2160
+ * This method sets the settings for the Zoom Control. It takes a parameter `value` which should be an object of type `ZoomControlSettings` or `undefined`.
2161
+ *
2162
+ * If the `value` is `undefined` or the same as the current settings, the method will return without making any changes.
2163
+ *
2164
+ */
2165
+ set settings(value) {
2166
+ if (!value || this._settings.isSame(value))
2167
+ return;
2168
+ this._settings = value;
2169
+ this.setControl();
2170
+ }
1882
2171
  ngOnInit() {
1883
2172
  this.postboy
1884
2173
  .subscribe(MapRenderedEvent.ID)
@@ -1954,7 +2243,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
1954
2243
  }]
1955
2244
  }] });
1956
2245
 
2246
+ /**
2247
+ * Helper class to create and modify marker styles.
2248
+ */
1957
2249
  class MarkerStyleHelper {
2250
+ /**
2251
+ * Creates a new Style object from an SVG.
2252
+ * @param {string} svg - The SVG string.
2253
+ * @param {Array<number>} [size=[30, 30]] - The size of the icon image.
2254
+ * @param {number} [zIndex=400] - The zIndex of the style.
2255
+ * @returns {Style} A new Style object.
2256
+ */
1958
2257
  static fromSvg(svg, size = [30, 30], zIndex = 400) {
1959
2258
  let image = new Image();
1960
2259
  image.src = 'data:image/svg+xml,' + escape(svg);
@@ -1966,6 +2265,15 @@ class MarkerStyleHelper {
1966
2265
  zIndex,
1967
2266
  });
1968
2267
  }
2268
+ /**
2269
+ * Returns a Style object with a circle style.
2270
+ *
2271
+ * @param {number} radius - The radius of the circle.
2272
+ * @param {string} fill - The fill color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
2273
+ * @param {string} strokeColor - The stroke color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
2274
+ * @param {number} [strokeWidth=1] - The width of the stroke. Default is 1.
2275
+ * @returns {Style} - A Style object with a Circle image.
2276
+ */
1969
2277
  static circle(radius, fill, strokeColor, strokeWidth = 1) {
1970
2278
  return new Style({
1971
2279
  image: new Circle({
@@ -1975,13 +2283,32 @@ class MarkerStyleHelper {
1975
2283
  }),
1976
2284
  });
1977
2285
  }
2286
+ /**
2287
+ * Applies the given Text to the provided Style.
2288
+ *
2289
+ * @param {Style} style - The Style to modify.
2290
+ * @param {Text} text - The Text to apply to the Style.
2291
+ * @return {Style} - The modified Style with the applied Text.
2292
+ */
1978
2293
  static withText(style, text) {
1979
2294
  style.setText(text);
1980
2295
  return style;
1981
2296
  }
1982
2297
  }
1983
2298
 
2299
+ /**
2300
+ * A helper class for creating polygon styles.
2301
+ * @class
2302
+ */
1984
2303
  class PolygonStyleHelper {
2304
+ /**
2305
+ * Creates a Style object with the given fill color, stroke color, and stroke width.
2306
+ *
2307
+ * @param {string} fill - The fill color in hexadecimal or RGB format.
2308
+ * @param {string} stroke - The stroke color in hexadecimal or RGB format.
2309
+ * @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
2310
+ * @return {Style} The created Style object.
2311
+ */
1985
2312
  static simple(fill, stroke, strokeWidth = 1) {
1986
2313
  return new Style({
1987
2314
  fill: new Fill({
@@ -1993,6 +2320,15 @@ class PolygonStyleHelper {
1993
2320
  }),
1994
2321
  });
1995
2322
  }
2323
+ /**
2324
+ * Creates a new Style object with the given fill, stroke, stroke width, and pin radius.
2325
+ *
2326
+ * @param {string} fill - The color to use for the fill of the style.
2327
+ * @param {string} stroke - The color to use for the stroke of the style.
2328
+ * @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
2329
+ * @param {number} [pinRadius=5] - The radius of the circle used as the image for the style. Defaults to 5.
2330
+ * @returns {Style} - The newly created Style object.
2331
+ */
1996
2332
  static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
1997
2333
  return new Style({
1998
2334
  image: new Circle({
@@ -2012,7 +2348,18 @@ class PolygonStyleHelper {
2012
2348
  }
2013
2349
  }
2014
2350
 
2351
+ /**
2352
+ * Helper class for creating text styles.
2353
+ */
2015
2354
  class TextStyleHelper {
2355
+ /**
2356
+ * Creates a new instance of the Text class with the specified properties.
2357
+ *
2358
+ * @param {string} text - The text content of the Text object.
2359
+ * @param {string} font - The font style of the Text object.
2360
+ * @param {string} color - The color of the Text object.
2361
+ * @return {Text} A new instance of the Text class.
2362
+ */
2016
2363
  static get(text, font, color) {
2017
2364
  return new Text({
2018
2365
  text: text,
@@ -2025,37 +2372,41 @@ class TextStyleHelper {
2025
2372
  }
2026
2373
  }
2027
2374
 
2375
+ /**
2376
+ * A helper class for converting and stringify features.
2377
+ */
2028
2378
  class StringifyFeatureHelper {
2029
2379
  static polygon(feature, format = FeatureOutputFormat.GeoJson) {
2030
2380
  return format === FeatureOutputFormat.GeoJson
2031
2381
  ? new GeoJSON().writeFeature(feature)
2032
2382
  : new WKT().writeFeature(feature);
2033
2383
  }
2384
+ /**
2385
+ * Creates a polygon feature representing a circle based on a given feature with a circle geometry.
2386
+ *
2387
+ * @param {Feature<Geometry>} feature - The input feature with a circle geometry.
2388
+ * @param {FeatureOutputFormat} format - The format for outputting the polygon feature. (default: FeatureOutputFormat.GeoJson)
2389
+ *
2390
+ * @return {string} - The string representation of the polygon feature.
2391
+ */
2034
2392
  static circle(feature, format = FeatureOutputFormat.GeoJson) {
2035
- // const clone = feature.clone();
2036
- // clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
2037
- const tetemp = feature.getGeometryName();
2038
2393
  const circle = feature.getGeometry();
2039
- // const temp = StringifyFeatureHelper.drawCircle(circle.getCenter(), circle.getRadius());
2040
- const ttt = feature.getGeometry().getExtent();
2041
- const eastPoint = [ttt[2], (ttt[1] + ttt[3]) / 2];
2042
- const aaa = [
2043
- ...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
2044
- ...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
2394
+ const ext = feature.getGeometry().getExtent();
2395
+ const coords = [
2396
+ ...transform([ext[0], ext[1]], 'EPSG:4326', 'EPSG:3857'),
2397
+ ...transform([ext[2], ext[3]], 'EPSG:4326', 'EPSG:3857'),
2045
2398
  ];
2046
- const radius = (aaa[2] - aaa[0]) / 2;
2047
- const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
2399
+ const radius = (coords[2] - coords[0]) / 2;
2048
2400
  const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
2049
- // var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
2050
- // var wgs84Sphere = new Sphere(6378137);
2051
2401
  return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
2052
- // const rad = circle.getRadius();
2053
- // const degrees = 180 / Math.PI; // radians to degrees
2054
- // const radians = Math.PI / 180; // degrees to radians
2055
- // const rlat = rad * degrees * 1000;
2056
- // const rlng = rad * radians;
2057
- // return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
2058
2402
  }
2403
+ /**
2404
+ * Draw a circle based on a center point and radius.
2405
+ *
2406
+ * @param {number[]} point - The center point coordinates in EPSG:4326 format.
2407
+ * @param {number} radius - The radius of the circle in meters.
2408
+ * @return {Coordinate[][]} - The coordinates of the circle boundary in EPSG:4326 format.
2409
+ */
2059
2410
  static drawCircle(point, radius) {
2060
2411
  const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
2061
2412
  // const tetetemp = point;