use of org.cesiumjs.cs.scene.GroundPrimitive in project gwt-cs by iSergio.
the class AbstractPrimitive method initialize.
@JsOverlay
public final void initialize() {
createPrimitive = true;
_ellipsoid = (Ellipsoid) JsObject.undefined();
_granularity = Double.MAX_VALUE;
_primitive = (GroundPrimitive) JsObject.undefined();
update = new Update() {
@Override
public void function(Object frameState) {
if (!Cesium.defined(ellipsoid)) {
throw new DeveloperError("ellipsoid is required option and must be defined.");
}
if (!Cesium.defined(appearance)) {
throw new DeveloperError("appearance is required option and myst be defined");
}
if (granularity < 0.0) {
throw new DeveloperError("granularity and scene2D/scene3D overrides must be greater than zero.");
}
if (!show) {
return;
}
if (!createPrimitive && !Cesium.defined(_primitive)) {
return;
}
if (createPrimitive || same()) {
Geometry geometry = getGeometry.function();
if (geometry == null) {
return;
}
createPrimitive = false;
_ellipsoid = ellipsoid;
_granularity = granularity;
if (Cesium.defined(_primitive)) {
_primitive.destroy();
_primitive = (GroundPrimitive) JsObject.undefined();
}
GeometryInstanceOptions instanceOptions = new GeometryInstanceOptions();
instanceOptions.geometry = geometry;
instanceOptions.attributes = new Object();
JsObject.setProperty(instanceOptions.attributes, "color", ColorGeometryInstanceAttribute.fromColor(options.color));
GroundPrimitiveOptions primitiveOptions = new GroundPrimitiveOptions();
primitiveOptions.geometryInstances = new GeometryInstance[] { new GeometryInstance(instanceOptions) };
primitiveOptions.asynchronous = false;
_primitive = new GroundPrimitive(primitiveOptions);
}
GroundPrimitive primitive = _primitive;
primitive.debugShowBoundingVolume = debugShowBoundingVolume;
primitive.update(frameState);
}
};
destroy = new Destroy() {
@Override
public void function() {
if (Cesium.defined(_primitive)) {
_primitive.destroy();
_primitive = (GroundPrimitive) JsObject.undefined();
}
Cesium.destroyObject(this);
}
};
}
Aggregations