use of au.gov.asd.tac.constellation.utilities.camera.BoundingBox 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.utilities.camera.BoundingBox 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.utilities.camera.BoundingBox 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