use of au.gov.asd.tac.constellation.graph.interaction.animation.PanAnimation in project constellation by constellation-app.
the class ResetViewPlugin method edit.
@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
// Get a copy of the graph's curent camera
final int cameraAttribute = VisualConcept.GraphAttribute.CAMERA.get(graph);
if (cameraAttribute != Graph.NOT_FOUND) {
final Camera oldCamera = graph.getObjectValue(cameraAttribute, 0);
final Camera camera = new Camera(oldCamera);
final BoundingBox boundingBox = new BoundingBox();
BoundingBoxUtilities.recalculateFromGraph(boundingBox, graph, false);
// Refocus the copied camera appropriately.
final String axis = parameters.getStringValue(AXIS_PARAMETER_ID);
final boolean negative = parameters.getBooleanValue(NEGATIVE_PARAMETER_ID);
switch(axis.toLowerCase()) {
case "x":
CameraUtilities.refocusOnXAxis(camera, boundingBox, negative);
break;
case "y":
CameraUtilities.refocusOnYAxis(camera, boundingBox, negative);
break;
case "z":
default:
CameraUtilities.refocusOnZAxis(camera, boundingBox, negative);
break;
}
// add an animation to the refocused camera so that it pans from the old position.
Animation.startAnimation(new PanAnimation("Reset View", oldCamera, camera, parameters.getBooleanValue(SIGNIFICANT_PARAMETER_ID)));
}
}
use of au.gov.asd.tac.constellation.graph.interaction.animation.PanAnimation in project constellation by constellation-app.
the class RotateCameraPlugin method edit.
@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
final float xrot = parameters.getFloatValue(X_PARAMETER_ID);
final float yrot = parameters.getFloatValue(Y_PARAMETER_ID);
final float zrot = parameters.getFloatValue(Z_PARAMETER_ID);
final boolean animate = parameters.getBooleanValue(ANIMATE_PARAMETER_ID);
// Get a copy of the graph's current camera.
final int cameraAttribute = VisualConcept.GraphAttribute.CAMERA.get(graph);
if (cameraAttribute != Graph.NOT_FOUND) {
final Camera oldCamera = graph.getObjectValue(cameraAttribute, 0);
final Camera camera = new Camera(oldCamera);
CameraUtilities.rotate(camera, xrot, yrot, zrot);
if (animate) {
Animation.startAnimation(new PanAnimation("Rotate camera", oldCamera, camera, true));
} else {
// Don't do an animation; we don't want to be asynchronous.
// Just set the camera value back on the graph.
graph.setObjectValue(cameraAttribute, 0, camera);
}
}
}
use of au.gov.asd.tac.constellation.graph.interaction.animation.PanAnimation in project constellation by constellation-app.
the class ZoomToSelectionPlugin method edit.
@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
final Camera oldCamera = VisualGraphUtilities.getCamera(graph);
final BoundingBox box = new BoundingBox();
final Camera camera = new Camera(oldCamera);
BoundingBoxUtilities.recalculateFromGraph(box, graph, true);
CameraUtilities.zoomToBoundingBox(camera, box);
Animation.startAnimation(new PanAnimation("Zoom to Selection", oldCamera, camera, true));
}
use of au.gov.asd.tac.constellation.graph.interaction.animation.PanAnimation in project constellation by constellation-app.
the class ZoomToVerticesPlugin method edit.
@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
final int[] vertices = verticesParam(parameters);
final Camera oldCamera = VisualGraphUtilities.getCamera(graph);
final BoundingBox box = new BoundingBox();
final Camera camera = new Camera(oldCamera);
BoundingBoxUtilities.encompassSpecifiedElements(box, graph, vertices);
CameraUtilities.zoomToBoundingBox(camera, box);
Animation.startAnimation(new PanAnimation("Zoom to Vertices", oldCamera, camera, true));
}
Aggregations