diff --git a/src/base.ts b/src/base.ts index 4d38881..82f7155 100644 --- a/src/base.ts +++ b/src/base.ts @@ -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; } } diff --git a/src/polygon/polygon.ts b/src/polygon/polygon.ts index 3d447b5..2726caa 100644 --- a/src/polygon/polygon.ts +++ b/src/polygon/polygon.ts @@ -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; }