@jorgmoritz/gis-manager 0.1.37 → 0.1.38
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 +48 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +48 -10
- package/dist/index.js.map +1 -1
- package/dist/vue/index.cjs +47 -9
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js +47 -9
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
16
|
+
version: "0.1.37"};
|
|
17
17
|
|
|
18
18
|
// src/utils/version.ts
|
|
19
19
|
var version = package_default.version;
|
|
@@ -8316,7 +8316,9 @@ var PolygonEditor = class {
|
|
|
8316
8316
|
polygon: {
|
|
8317
8317
|
hierarchy: positions,
|
|
8318
8318
|
material: faceColor,
|
|
8319
|
-
outline: false
|
|
8319
|
+
outline: false,
|
|
8320
|
+
// 🔧 修复:设置 heightReference 使多边形贴合地形
|
|
8321
|
+
heightReference: C.HeightReference.CLAMP_TO_GROUND
|
|
8320
8322
|
}
|
|
8321
8323
|
});
|
|
8322
8324
|
const ring = positions.slice();
|
|
@@ -8329,15 +8331,51 @@ var PolygonEditor = class {
|
|
|
8329
8331
|
width: 1,
|
|
8330
8332
|
material: lineColor,
|
|
8331
8333
|
clampToGround: true
|
|
8334
|
+
// 轮廓线已经设置了 clampToGround
|
|
8332
8335
|
},
|
|
8333
8336
|
properties: { _ownerId: id, _type: "polygon-outline" }
|
|
8334
8337
|
});
|
|
8335
8338
|
this.applyDashedOutlineStyle(outlineEntity, lineColor, 3, 10);
|
|
8336
8339
|
const displayText = name.includes("_") ? name.split("_")[1] : name;
|
|
8340
|
+
const firstPoint = points[0];
|
|
8341
|
+
this.createLabelWithTerrainHeight(
|
|
8342
|
+
layer,
|
|
8343
|
+
id,
|
|
8344
|
+
displayText,
|
|
8345
|
+
firstPoint.lon,
|
|
8346
|
+
firstPoint.lat,
|
|
8347
|
+
lineColor
|
|
8348
|
+
);
|
|
8349
|
+
return entity;
|
|
8350
|
+
} catch (err) {
|
|
8351
|
+
console.error(`[PolygonEditor] \u521B\u5EFA\u591A\u8FB9\u5F62\u5931\u8D25:`, err);
|
|
8352
|
+
return null;
|
|
8353
|
+
}
|
|
8354
|
+
}
|
|
8355
|
+
/**
|
|
8356
|
+
* 辅助方法:使用地形采样创建标签
|
|
8357
|
+
* 先尝试获取地形高度,如果失败则使用 heightReference
|
|
8358
|
+
*/
|
|
8359
|
+
async createLabelWithTerrainHeight(layer, ownerId, displayText, lon, lat, lineColor) {
|
|
8360
|
+
const C = this.CesiumNS;
|
|
8361
|
+
try {
|
|
8362
|
+
let terrainHeight = 0;
|
|
8363
|
+
const terrainProvider = this.viewer.terrainProvider;
|
|
8364
|
+
if (terrainProvider && typeof C.sampleTerrainMostDetailed === "function") {
|
|
8365
|
+
try {
|
|
8366
|
+
const positions = [C.Cartographic.fromDegrees(lon, lat)];
|
|
8367
|
+
const updatedPositions = await C.sampleTerrainMostDetailed(terrainProvider, positions);
|
|
8368
|
+
if (updatedPositions && updatedPositions[0] && updatedPositions[0].height !== void 0) {
|
|
8369
|
+
terrainHeight = updatedPositions[0].height;
|
|
8370
|
+
}
|
|
8371
|
+
} catch (e) {
|
|
8372
|
+
}
|
|
8373
|
+
}
|
|
8374
|
+
const labelPosition = C.Cartesian3.fromDegrees(lon, lat, terrainHeight + 1);
|
|
8337
8375
|
layer.entities.add({
|
|
8338
|
-
id: `${
|
|
8376
|
+
id: `${ownerId}-label`,
|
|
8339
8377
|
name: "Polygon Label",
|
|
8340
|
-
position:
|
|
8378
|
+
position: labelPosition,
|
|
8341
8379
|
label: {
|
|
8342
8380
|
text: displayText,
|
|
8343
8381
|
font: "bold 16px Microsoft YaHei, SimHei, sans-serif",
|
|
@@ -8347,14 +8385,14 @@ var PolygonEditor = class {
|
|
|
8347
8385
|
style: C.LabelStyle.FILL_AND_OUTLINE,
|
|
8348
8386
|
verticalOrigin: C.VerticalOrigin.BOTTOM,
|
|
8349
8387
|
pixelOffset: new C.Cartesian2(0, -10),
|
|
8350
|
-
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
8388
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
|
8389
|
+
// 仍然设置 heightReference 作为备用
|
|
8390
|
+
heightReference: C.HeightReference.CLAMP_TO_GROUND
|
|
8351
8391
|
},
|
|
8352
|
-
properties: { _ownerId:
|
|
8392
|
+
properties: { _ownerId: ownerId, _type: "polygon-label" }
|
|
8353
8393
|
});
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
console.error(`[PolygonEditor] \u521B\u5EFA\u591A\u8FB9\u5F62\u5931\u8D25:`, err);
|
|
8357
|
-
return null;
|
|
8394
|
+
} catch (e) {
|
|
8395
|
+
console.warn(`[PolygonEditor] \u521B\u5EFA\u6807\u7B7E\u5931\u8D25:`, e);
|
|
8358
8396
|
}
|
|
8359
8397
|
}
|
|
8360
8398
|
/**
|