|
@@ -59,8 +59,9 @@ export function loadGeoJSON(geom, yanse, adata, fun) {
|
|
|
offset: new Cesium.HeadingPitchRange(0, -45),
|
|
|
});
|
|
|
fun(data)
|
|
|
- if (!geojson.type.includes("Polygon")) {
|
|
|
- data.entities.values.forEach((entity, ei) => {
|
|
|
+ console.log(adata.name, '---')
|
|
|
+ data.entities.values.forEach((entity, ei) => {
|
|
|
+ if (!geojson.type.includes("Polygon")) {
|
|
|
if (entity.billboard) {
|
|
|
entity.billboard = new Cesium.BillboardGraphics({
|
|
|
image: "@/.././static/images/flypng/hos_point.png",
|
|
@@ -69,13 +70,32 @@ export function loadGeoJSON(geom, yanse, adata, fun) {
|
|
|
scale: 1.0,
|
|
|
pixelOffset: new Cesium.Cartesian2(0, -16),
|
|
|
});
|
|
|
- // entity.point = {
|
|
|
- // pixelsize: 20,
|
|
|
- // color: Cesium.Color.fromCssColorString(colors),
|
|
|
- // };
|
|
|
}
|
|
|
- });
|
|
|
- }
|
|
|
+ // entity.point = {
|
|
|
+ // pixelsize: 20,
|
|
|
+ // color: Cesium.Color.fromCssColorString(colors),
|
|
|
+ // };
|
|
|
+ }
|
|
|
+ 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",
|
|
|
+ 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, '---')
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
});
|
|
|
// let polygon = Cesium.GeoJsonDataSource.load(geojson, {
|