@jorgmoritz/gis-manager 0.1.32 → 0.1.33

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.
package/dist/index.cjs CHANGED
@@ -13,7 +13,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
13
13
  // package.json
14
14
  var package_default = {
15
15
  name: "@jorgmoritz/gis-manager",
16
- version: "0.1.31"};
16
+ version: "0.1.33"};
17
17
 
18
18
  // src/utils/version.ts
19
19
  var version = package_default.version;
@@ -8197,7 +8197,7 @@ var PolygonEditor = class {
8197
8197
  if (!polygon) return [];
8198
8198
  const hierarchy = typeof polygon.hierarchy?.getValue === "function" ? polygon.hierarchy.getValue(C.JulianDate.now()) : polygon.hierarchy;
8199
8199
  const positions = hierarchy?.positions ?? hierarchy ?? [];
8200
- return positions.map((cartesian) => {
8200
+ const points = positions.map((cartesian) => {
8201
8201
  const cartographic = C.Cartographic.fromCartesian(cartesian);
8202
8202
  return {
8203
8203
  lon: C.Math.toDegrees(cartographic.longitude),
@@ -8205,6 +8205,14 @@ var PolygonEditor = class {
8205
8205
  height: cartographic.height
8206
8206
  };
8207
8207
  });
8208
+ if (points.length > 0) {
8209
+ const first = points[0];
8210
+ const last = points[points.length - 1];
8211
+ if (first.lon !== last.lon || first.lat !== last.lat || first.height !== last.height) {
8212
+ points.push({ ...first });
8213
+ }
8214
+ }
8215
+ return points;
8208
8216
  }
8209
8217
  /**
8210
8218
  * 辅助方法:获取实体所属的 DataSource
@@ -10330,7 +10338,15 @@ var CZMLManager = class {
10330
10338
  const hProp = entity.polygon.hierarchy;
10331
10339
  const hVal = typeof hProp?.getValue === "function" ? hProp.getValue(now) : hProp;
10332
10340
  const outer = Array.isArray(hVal) ? hVal : hVal?.positions ?? [];
10333
- return outer.map(toLonLatHeight);
10341
+ const points = outer.map(toLonLatHeight);
10342
+ if (points.length > 0) {
10343
+ const first = points[0];
10344
+ const last = points[points.length - 1];
10345
+ if (first.lon !== last.lon || first.lat !== last.lat || first.height !== last.height) {
10346
+ points.push({ ...first });
10347
+ }
10348
+ }
10349
+ return points;
10334
10350
  }
10335
10351
  if (entity?.polyline?.positions) {
10336
10352
  const pProp = entity.polyline.positions;