cesium-drawhelper
cesium-drawhelper copied to clipboard
RectanglePrimitive has been deprecated
As of Cesium 1.17 RectanglePrimitve has been deprecated so this will need to be updated as the Extent primitive can no longer be drawn.
@getardretard did you manage to figure out a way of solving this?
I am no expert but I updated this section:
if (extent == null) {
//extent = new Cesium.RectanglePrimitive();
//extent.asynchronous = false;
//primitives.add(extent);
extent = new Cesium.Primitive({
geometryInstances : new Cesium.RectangleGeometry()
//appearance : new Cesium.EllipsoidSurfaceAppearance({
// material : Cesium.Material.fromType('Checkerboard')
//})
});
extent.asynchronous = false;
primitives.add(extent);
}
extent.geometryInstances.rectangle = value;
But I cannot get the rectangle to be yellow when it is first drawn. When I add the appearance option (just to test) I get an error saying there is an undefined Worker.
I just changed extent = new Cesium.RectanglePrimitive(); to extent = new Cesium.Primitive();
Hi @getardretard, I am using following but still not getting rectangle while drawing.. did you get any solution for this.
if(extent == null) { var rectangleInstance = new Cesium.GeometryInstance({ geometry : new Cesium.RectangleGeometry({ rectangle : value, vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT }), attributes : { color : new Cesium.ColorGeometryInstanceAttribute(0.0, 1.0, 1.0, 0.5) } });
extent = new Cesium.Primitive({
geometryInstances : rectangleInstance,
appearance : new Cesium.PerInstanceColorAppearance(),
releaseGeometryInstances: false
});
//extent.material = options.material;
extent.asynchronous = false;
primitives.add(extent);
}
extent.geometryInstances.geometry._rectangle = value;
Thanks
Hi @raghuburgala, I still use the code I posted above. I haven't seen any update to this. It seems to do the job for me. Cheers.
Hi @getardretard, I resolved my issue by using following code.
if(extent == null) { extent = new DrawHelper.ExtentPrimitive({ extent : value, material : options.material, }); extent.asynchronous = false; primitives.add(extent); } extent.setExtent(value);
Thanks.
cesium version 1.24 can't find the api of RectanglePrimitive or ExtentPrimitive. replace it GroundPrimitive,and i find it works! http://cesiumjs.org/Cesium/Build/Documentation/GroundPrimitive.html?classFilter=GroundPrimitive
Thanks.