use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultInteractionEventHandler method performFreeformSelection.
/**
* Performs a selection based on a given polygon in the freeformModel.
*
* @param appendSelection whether or not the selection will be appended to
* the current selection
* @param toggleSelection whether or not the selection will toggle the
* current selection. Note that if appendSelection is true, this parameter
* has no effect.
*/
private void performFreeformSelection(final GraphReadMethods rg, final boolean appendSelection, final boolean toggleSelection) {
final float[] boxCameraCoordinates = visualInteraction.windowBoxToCameraBox(freeformModel.getLeftMost(), freeformModel.getRightMost(), freeformModel.getTopMost(), freeformModel.getBottomMost());
freeformModel.setWindowBoxToCameraBox(boxCameraCoordinates);
final Float[] transformedVertices = freeformModel.getTransformedVertices();
final Plugin plugin = new FreeformSelectionPlugin(appendSelection, toggleSelection, VisualGraphUtilities.getCamera(rg), boxCameraCoordinates, transformedVertices, freeformModel.getNumPoints());
PluginExecution.withPlugin(plugin).executeLater(graph);
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultInteractionEventHandler method createVertex.
/**
* Creates a vertex on the graph at a specified point.
* <p>
* The vertex will be created via a plugin which will run later (after the
* event handler gives up its current lock).
*
* @param camera The current camera
* @param createAt The point at which the vertex should be created.
*/
private void createVertex(final Camera camera, final Point createAt) {
Vector3f position = visualInteraction.windowToGraphCoordinates(camera, createAt);
Plugin plugin = PluginRegistry.get(InteractiveGraphPluginRegistry.CREATE_VERTEX);
PluginParameters parameters = DefaultPluginParameters.getDefaultParameters(plugin);
parameters.getParameters().get(CreateVertexPlugin.X_PARAMETER_ID).setObjectValue(position.getX());
parameters.getParameters().get(CreateVertexPlugin.Y_PARAMETER_ID).setObjectValue(position.getY());
parameters.getParameters().get(CreateVertexPlugin.Z_PARAMETER_ID).setObjectValue(position.getZ());
PluginExecution.withPlugin(plugin).withParameters(parameters).interactively(false).executeLater(graph);
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class DefaultInteractionEventHandler method createTransaction.
/**
* Creates a transaction on the graph between the specified vertices.
* <p>
* The vertex will be created via a plugin which will synchronously, holding
* up the event handler until it is finished. The reason for this is that
* otherwise the new transaction will not be visible until the event handler
* gives up its current lock (which if we are creating multiple transactions
* with the shift/control key down, could be indefinitely).
*
* @param fromVertex The graph id of the source vertex
* @param toVertex The graph id of the destination vertex
* @param directed Whether or not the transaction should be directed.
* @param wg Write access to the graph, corresponding to the lock on which
* gestures are currently being processed.
*/
private void createTransaction(final GraphWriteMethods wg, final int fromVertex, final int toVertex, final boolean directed) {
Plugin plugin = PluginRegistry.get(InteractiveGraphPluginRegistry.CREATE_TRANSACTION);
PluginParameters parameters = DefaultPluginParameters.getDefaultParameters(plugin);
parameters.getParameters().get(CreateTransactionPlugin.SOURCE_PARAMETER_ID).setObjectValue(fromVertex);
parameters.getParameters().get(CreateTransactionPlugin.DESTINATION_PARAMETER_ID).setObjectValue(toVertex);
parameters.getParameters().get(CreateTransactionPlugin.DIRECTED_PARAMETER_ID).setObjectValue(directed);
try {
PluginExecution.withPlugin(plugin).withParameters(parameters).interactively(false).executeNow(wg);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
} catch (PluginException ex) {
}
announceNextFlush = true;
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class PointSelectionPluginNGTest method testOnlyVerticesSelectedAndVertexSelected.
/**
* Tests when a vertex is selected and; only vertices are selected, toggle
* selection is true, and clear selection is true.
*
* @throws Exception
*/
@Test
public void testOnlyVerticesSelectedAndVertexSelected() throws Exception {
selectAllAndAssert(GraphElementType.VERTEX, true);
vxIds.add(vxId1);
Plugin selectPoint = new PointSelectionPlugin(vxIds, txIds, true, true);
PluginExecution.withPlugin(selectPoint).executeNow(storeGraph);
assertTrue(storeGraph.getBooleanValue(vAttrId, vxId1));
assertFalse(storeGraph.getBooleanValue(vAttrId, vxId2));
assertFalse(storeGraph.getBooleanValue(vAttrId, vxId3));
assertFalse(storeGraph.getBooleanValue(tAttrId, txId1));
assertFalse(storeGraph.getBooleanValue(tAttrId, txId2));
assertFalse(storeGraph.getBooleanValue(tAttrId, txId3));
}
use of au.gov.asd.tac.constellation.plugins.Plugin in project constellation by constellation-app.
the class PointSelectionPluginNGTest method testNoElementsSelectedAndTransactionSelected.
/**
* Tests when a transaction is selected and; all vertices and transaction
* are unselected, toggle selection is true, and clear selection is true.
*
* @throws Exception
*/
@Test
public void testNoElementsSelectedAndTransactionSelected() throws Exception {
txIds.add(txId1);
Plugin selectPoint = new PointSelectionPlugin(vxIds, txIds, true, true);
PluginExecution.withPlugin(selectPoint).executeNow(storeGraph);
assertFalse(storeGraph.getBooleanValue(vAttrId, vxId1));
assertFalse(storeGraph.getBooleanValue(vAttrId, vxId2));
assertFalse(storeGraph.getBooleanValue(vAttrId, vxId3));
assertTrue(storeGraph.getBooleanValue(tAttrId, txId1));
assertFalse(storeGraph.getBooleanValue(tAttrId, txId2));
assertFalse(storeGraph.getBooleanValue(tAttrId, txId3));
}
Aggregations