Hello,
As part of a large project I need to implement rubberbanding. However, in my implementation it works but flickers a lot when rubberbanding. Also, I noticed that it is slow. As far as I understand DynamicProperty cannot be used because it is strictly for annimations where values are predefined and are provided as a time history.
I thought that the correct way to do it is to use Entity API like the following example (see below).
Can somebody shed the light on this?
Thank you very much,
Greg
//I intentionally made it rubber-band on mouse move event for simplicity
viewer = new Cesium.Viewer('cesiumContainer');
redLine = viewer.entities.add({
name : 'Red line on the surface',
polyline : {
positions : Cesium.Cartesian3.fromDegreesArray([-75, 35,
-125, 35]),
width : 5,
material : Cesium.Color.RED
}
});
function onMouseMove(evt)
{
var ellipsoid = viewer.scene.globe.ellipsoid;
var cartesian = viewer.camera.pickEllipsoid(evt.endPosition, ellipsoid);
var positions = redLine.polyline.positions;
var positions1 = Cesium.Cartesian3.fromDegreesArray([-75, 35, -125, 35]);
positions1[0] = positions._value[0];
positions1[1] = positions._value[1];
positions1[0]=cartesian;
redLine.polyline.positions = positions1;
}
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(onMouseMove, Cesium.ScreenSpaceEventType.MOUSE_MOVE);