|
@@ -77,27 +77,25 @@ export function loadGeoJSON(geom, yanse, adata, fun) {
|
|
// };
|
|
// };
|
|
}
|
|
}
|
|
if (adata.name && entity.polygon) {
|
|
if (adata.name && entity.polygon) {
|
|
- let center = getCentroid(geojson, ei);
|
|
|
|
- entity.position = Cesium.Cartesian3.fromDegrees(
|
|
|
|
- center[0],
|
|
|
|
- center[1],
|
|
|
|
- adata.lab_height || 0
|
|
|
|
- );
|
|
|
|
- entity.label = {
|
|
|
|
- font: "bolder 18px sans-serif",
|
|
|
|
- distanceDisplayCondition: new Cesium.DistanceDisplayCondition(100, adata.lab_max || 10000),
|
|
|
|
- style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
|
|
- text: adata.name, //图标名称
|
|
|
|
- fillColor: Cesium.Color.fromCssColorString(yanse),
|
|
|
|
- pixelOffset: new Cesium.Cartesian2(0, -20),
|
|
|
|
- zIndex: 3,
|
|
|
|
- };
|
|
|
|
- console.log(entity, adata.name, '---')
|
|
|
|
|
|
+ if (!adata.lab_pos || !ei) {
|
|
|
|
+ let center = adata.lab_pos ? parse(adata.lab_pos).coordinates : getCentroid(geojson, ei);
|
|
|
|
+ entity.position = Cesium.Cartesian3.fromDegrees(
|
|
|
|
+ center[0],
|
|
|
|
+ center[1],
|
|
|
|
+ adata.lab_height || 0
|
|
|
|
+ );
|
|
|
|
+ entity.label = {
|
|
|
|
+ font: "bolder 18px sans-serif",
|
|
|
|
+ distanceDisplayCondition: new Cesium.DistanceDisplayCondition(100, adata.lab_max || 10000),
|
|
|
|
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
|
|
+ text: adata.name, //图标名称
|
|
|
|
+ fillColor: Cesium.Color.fromCssColorString(yanse),
|
|
|
|
+ pixelOffset: new Cesium.Cartesian2(0, -20),
|
|
|
|
+ zIndex: 3,
|
|
|
|
+ };
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
});
|
|
});
|
|
-
|
|
|
|
-
|
|
|
|
});
|
|
});
|
|
// let polygon = Cesium.GeoJsonDataSource.load(geojson, {
|
|
// let polygon = Cesium.GeoJsonDataSource.load(geojson, {
|
|
// clampToGround: true,
|
|
// clampToGround: true,
|