|
@@ -350,7 +350,7 @@ export default {
|
|
entity.polygon.outlineColor = Cesium.Color.BLACK;
|
|
entity.polygon.outlineColor = Cesium.Color.BLACK;
|
|
entity.polygon.outlineWidth = 1.0;
|
|
entity.polygon.outlineWidth = 1.0;
|
|
// if (!addlabel) {
|
|
// if (!addlabel) {
|
|
- let center = this.getCentroid(geojson, ei).geometry.coordinates;
|
|
|
|
|
|
+ let center = this.getCentroid(geojson, ei);
|
|
|
|
|
|
var polycenter = Cesium.Cartesian3.fromDegrees(
|
|
var polycenter = Cesium.Cartesian3.fromDegrees(
|
|
center[0],
|
|
center[0],
|
|
@@ -388,10 +388,10 @@ export default {
|
|
geojson = geojson.geometry;
|
|
geojson = geojson.geometry;
|
|
}
|
|
}
|
|
if (turf.getType(geojson) === "Polygon") {
|
|
if (turf.getType(geojson) === "Polygon") {
|
|
- return turf.centroid(geojson);
|
|
|
|
|
|
+ return turf.centroid(geojson).geometry.coordinates;
|
|
} else if (turf.getType(geojson) === "MultiPolygon") {
|
|
} else if (turf.getType(geojson) === "MultiPolygon") {
|
|
let polygon = turf.polygon(geojson.coordinates[eindex]);
|
|
let polygon = turf.polygon(geojson.coordinates[eindex]);
|
|
- return turf.centroid(polygon);
|
|
|
|
|
|
+ return turf.centroid(polygon).geometry.coordinates;
|
|
} else {
|
|
} else {
|
|
throw new Error("Unsupported geometry type");
|
|
throw new Error("Unsupported geometry type");
|
|
}
|
|
}
|
|
@@ -479,9 +479,15 @@ export default {
|
|
this.loadGeoJSON(parse(item.geom), "#000000", upid, height, item.dkbm);
|
|
this.loadGeoJSON(parse(item.geom), "#000000", upid, height, item.dkbm);
|
|
else {
|
|
else {
|
|
let entities = dataSources[upid].entities.values;
|
|
let entities = dataSources[upid].entities.values;
|
|
- entities.forEach((entity) => {
|
|
|
|
|
|
+ entities.forEach((entity, ei) => {
|
|
if (height && entity.polygon) {
|
|
if (height && entity.polygon) {
|
|
entity.polygon.extrudedHeight = height;
|
|
entity.polygon.extrudedHeight = height;
|
|
|
|
+ let center = this.getCentroid(parse(item.geom), ei);
|
|
|
|
+ entity.position = Cesium.Cartesian3.fromDegrees(
|
|
|
|
+ center[0],
|
|
|
|
+ center[1],
|
|
|
|
+ height
|
|
|
|
+ );
|
|
}
|
|
}
|
|
});
|
|
});
|
|
viewer.flyTo(dataSources[upid], {
|
|
viewer.flyTo(dataSources[upid], {
|