use of au.gov.asd.tac.constellation.utilities.camera.Camera 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.Camera 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));
}
use of au.gov.asd.tac.constellation.utilities.camera.Camera in project constellation by constellation-app.
the class BoxSelectionPluginNGTest method testEdit.
/**
* Test of edit method, of class BoxSelectionPlugin.
*/
@Test
public void testEdit() throws InterruptedException, PluginException, IOException {
System.out.println("edit");
// test with 0 mix ratio in every boolean value arrangement
camera = new Camera();
camera.setMixRatio(0);
runBoxSelectTests(true, true);
runBoxSelectTests(true, false);
runBoxSelectTests(false, true);
runBoxSelectTests(false, false);
// Test with 1 mix ratio in every boolean value arrangement
camera = new Camera();
camera.setMixRatio(1);
runBoxSelectTests(true, true);
runBoxSelectTests(true, false);
runBoxSelectTests(false, true);
runBoxSelectTests(false, false);
// test with 0 mix ratio and VxVisibility in every boolean value arrangement
VisualConcept.VertexAttribute.VISIBILITY.ensure(graph);
camera = new Camera();
camera.setMixRatio(0);
runBoxSelectTests(true, true);
runBoxSelectTests(true, false);
runBoxSelectTests(false, true);
runBoxSelectTests(false, false);
}
use of au.gov.asd.tac.constellation.utilities.camera.Camera in project constellation by constellation-app.
the class PreviousViewPluginNGTest method testEdit.
/**
* Test of edit method, of class PreviousViewPlugin.
*/
@Test
public void testEdit() throws Exception {
System.out.println("edit");
// Create some vecs to add to the original camera
final Vector3f lookAtCentre = new Vector3f(10, 10, 10);
final Vector3f lookAtEye = new Vector3f(5, 10, 5);
final Vector3f lookAtUp = new Vector3f(2, 2, 2);
// Start with a default camera
final Camera originalCamera = new Camera();
graph.setObjectValue(cameraAttribute, 0, originalCamera);
assertTrue(originalCamera.areSame(graph.getObjectValue(cameraAttribute, 0)));
// Deep copy the default camera before adding vecs to it
final Camera clonedCamera = new Camera(originalCamera);
clonedCamera.lookAtCentre.add(lookAtCentre);
clonedCamera.lookAtEye.add(lookAtEye);
clonedCamera.lookAtUp.add(lookAtUp);
// Set the previous positions to the original camera
clonedCamera.lookAtPreviousEye.set(originalCamera.lookAtEye);
clonedCamera.lookAtPreviousCentre.set(originalCamera.lookAtCentre);
clonedCamera.lookAtPreviousUp.set(originalCamera.lookAtUp);
graph.setObjectValue(cameraAttribute, 0, clonedCamera);
// Assert that the camera is set correctly to the cloned, changed camera
assertTrue(clonedCamera.areSame(graph.getObjectValue(cameraAttribute, 0)));
// Create a plugin and run it, asserting that the camera is now back to the original camera
final PreviousViewPlugin instance = new PreviousViewPlugin();
instance.edit(graph, null, null);
assertTrue(originalCamera.areSame(graph.getObjectValue(cameraAttribute, 0)));
}
use of au.gov.asd.tac.constellation.utilities.camera.Camera in project constellation by constellation-app.
the class PreviousViewPlugin method edit.
@Override
public void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
final Camera camera = new Camera(VisualGraphUtilities.getCamera(graph));
CameraUtilities.setCurrentToPrevious(camera);
VisualGraphUtilities.setCamera(graph, camera);
}
Aggregations