fix: createGeometryFromData Polygon

This commit is contained in:
liqikun 2024-05-24 17:49:41 +08:00
parent 4139d7d74a
commit a9d0534b8a
2 changed files with 9 additions and 1 deletions

View File

@ -870,6 +870,7 @@ export default class Base {
createGraphic(points: CesiumTypeOnly.Cartesian3[]): CesiumTypeOnly.Cartesian3[] {
//Abstract method that must be implemented by subclasses.
return [new this.cesium.Cartesian3()];
// return [new this.cesium.Cartesian3()];
return points;
}
}

View File

@ -51,6 +51,13 @@ export default class Polygon extends Base {
this.drawPolygon();
}
createGraphic(positions: Cartesian3[]) {
const lnglatPoints = positions.map(this.cartesianToLnglat);
const coords = lnglatPoints.flat();
const cartesianPoints = this.cesium.Cartesian3.fromDegreesArray(coords);
return cartesianPoints;
}
getPoints() {
return this.points;
}