cesium-drawhelper icon indicating copy to clipboard operation
cesium-drawhelper copied to clipboard

RectanglePrimitive has been deprecated

Open gezonthenet opened this issue 8 years ago • 7 comments

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.

gezonthenet avatar Jan 20 '16 05:01 gezonthenet

@getardretard did you manage to figure out a way of solving this?

mgiraldo avatar Jan 28 '16 19:01 mgiraldo

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.

gezonthenet avatar Jan 28 '16 22:01 gezonthenet

I just changed extent = new Cesium.RectanglePrimitive(); to extent = new Cesium.Primitive();

brackmayhall avatar May 18 '16 19:05 brackmayhall

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

raghuburgala avatar Jun 16 '16 09:06 raghuburgala

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.

gezonthenet avatar Jul 05 '16 14:07 gezonthenet

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.

raghuburgala avatar Jul 05 '16 18:07 raghuburgala

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.

chillgis avatar Aug 18 '16 07:08 chillgis