I would like to now see if it is possible to move the camera to look at something in Cesium, and by clicking a button, save the current camera settings so that they can be reloaded at a later time.
Has anyone done this before, or does anyone have any ideas on what exactly needs to be persisted from the combination of camera/scene/etc. to be able to reproduce a camera view?
--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
var StoredView = function()
{
this.position = undefined;
this.direction = undefined;
this.up = undefined;
this.right = undefined;
this.transform = undefined;
this.frustum = undefined;
};
StoredView.prototype.save = function(camera)
{
this.position = Cesium.Cartesian3.clone(camera.positionWC, this.position);
this.heading = camera.heading;
this.picth = camera.pitch;
this.roll = camera.roll;
this.transform = Cesium.Matrix4.clone(camera.transform, this.transform);
};
StoredView.prototype.load = function(camera)
{
camera.position = Cesium.Cartesian3.clone(this.position, camera.position);
camera.heading = this.heading;
camera.pitch = this.pitch;
camera.roll = this.roll;
camera.transform = Cesium.Matrix4.clone(this.transform, camera.transform);
};
viewer.camera.setView({
destination : cartesianPosition,
orientation: {
heading : Cesium.Math.toRadians(90.0), // east, default value is 0.0 (north)
pitch : Cesium.Math.toRadians(-90), // default value (looking down)
roll : 0.0 // default value
}
});