use of org.cesiumjs.cs.js.JsArray in project gwt-cs by iSergio.
the class CirclePrimitive method getPositions.
public Cartesian3[] getPositions() {
EllipsePositionsOptions options = new EllipsePositionsOptions();
options.semiMajorAxis = getRadius();
options.semiMinorAxis = getRadius();
options.center = getCenter();
options.granularity = granularity;
options.rotation = 0;
JsObject jsObject = EllipseGeometryLibrary.computeEllipsePositions(options, false, true);
if (jsObject.getObject("outerPositions") == null) {
return null;
}
List<Cartesian3> positions = new ArrayList<>();
JsArray<Number> nativePositions = (JsArray<Number>) jsObject.getObject("outerPositions");
for (int i = 0; i < nativePositions.length(); i += 3) {
double x = JsObject.getNumber(nativePositions, i).doubleValue();
double y = JsObject.getNumber(nativePositions, i + 1).doubleValue();
double z = JsObject.getNumber(nativePositions, i + 2).doubleValue();
positions.add(new Cartesian3(x, y, z));
}
return positions.toArray(new Cartesian3[positions.size()]);
}
Aggregations