Search in sources :

Example 21 with Camera

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));
}
Also used : PanAnimation(au.gov.asd.tac.constellation.graph.interaction.animation.PanAnimation) BoundingBox(au.gov.asd.tac.constellation.utilities.camera.BoundingBox) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera)

Example 22 with Camera

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));
}
Also used : PanAnimation(au.gov.asd.tac.constellation.graph.interaction.animation.PanAnimation) BoundingBox(au.gov.asd.tac.constellation.utilities.camera.BoundingBox) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera)

Example 23 with Camera

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);
}
Also used : Camera(au.gov.asd.tac.constellation.utilities.camera.Camera) Test(org.testng.annotations.Test)

Example 24 with Camera

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)));
}
Also used : Vector3f(au.gov.asd.tac.constellation.utilities.graphics.Vector3f) Camera(au.gov.asd.tac.constellation.utilities.camera.Camera) Test(org.testng.annotations.Test)

Example 25 with Camera

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);
}
Also used : Camera(au.gov.asd.tac.constellation.utilities.camera.Camera)

Aggregations

Camera (au.gov.asd.tac.constellation.utilities.camera.Camera)32 Vector3f (au.gov.asd.tac.constellation.utilities.graphics.Vector3f)11 Test (org.testng.annotations.Test)8 Point (java.awt.Point)5 PanAnimation (au.gov.asd.tac.constellation.graph.interaction.animation.PanAnimation)4 Frame (au.gov.asd.tac.constellation.utilities.graphics.Frame)4 Matrix44f (au.gov.asd.tac.constellation.utilities.graphics.Matrix44f)4 BoundingBox (au.gov.asd.tac.constellation.utilities.camera.BoundingBox)3 WritableGraph (au.gov.asd.tac.constellation.graph.WritableGraph)2 Matrix33f (au.gov.asd.tac.constellation.utilities.graphics.Matrix33f)2 BitSet (java.util.BitSet)2 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)1 SelectionBoxModel (au.gov.asd.tac.constellation.graph.interaction.visual.renderables.SelectionBoxModel)1 DualGraph (au.gov.asd.tac.constellation.graph.locking.DualGraph)1 Blaze (au.gov.asd.tac.constellation.graph.schema.visual.attribute.objects.Blaze)1 DeveloperPreferenceKeys (au.gov.asd.tac.constellation.preferences.DeveloperPreferenceKeys)1 Graphics3DUtilities (au.gov.asd.tac.constellation.utilities.camera.Graphics3DUtilities)1 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)1 Vector4f (au.gov.asd.tac.constellation.utilities.graphics.Vector4f)1 InfoTextPanel (au.gov.asd.tac.constellation.utilities.gui.InfoTextPanel)1