use of au.gov.asd.tac.constellation.plugins.arrangements.grid.GridArranger in project constellation by constellation-app.
the class ArrangeByNodeAttributePlugin method edit.
@Override
public void edit(final GraphWriteMethods wg, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException {
final boolean threeD = parameters.getParameters().get(THREE_D_PARAMETER_ID).getBooleanValue();
final String attribute = parameters.getParameters().get(ATTRIBUTE_PARAMETER_ID).getStringValue();
if (threeD) {
if (attribute != null) {
final SelectedInclusionGraph selectedGraph = new SelectedInclusionGraph(wg, SelectedInclusionGraph.Connections.NONE);
final Attribute attr = new GraphAttribute(wg, wg.getAttribute(GraphElementType.VERTEX, attribute));
selectedGraph.addAttributeToCopy(attr);
final GraphWriteMethods ig = selectedGraph.getInclusionGraph();
final int iattrId = ig.getAttribute(GraphElementType.VERTEX, attribute);
final LayerArranger arranger = new LayerArranger();
arranger.setLevelAttr(iattrId);
arranger.setMaintainMean(!selectedGraph.isArrangingAll());
arranger.arrange(ig);
selectedGraph.retrieveCoords();
}
} else {
if (attribute != null) {
final Arranger inner = new GridArranger();
final Arranger outer = new GridArranger();
final GraphTaxonomyArranger arranger = new ArrangeByGroupTaxonomy(inner, outer, Connections.NONE, attribute);
arranger.setMaintainMean(true);
final SelectedInclusionGraph selectedGraph = new SelectedInclusionGraph(wg, Connections.NONE);
selectedGraph.addAttributeToCopy(new GraphAttribute(wg, wg.getAttribute(GraphElementType.VERTEX, attribute)));
arranger.arrange(selectedGraph.getInclusionGraph());
selectedGraph.retrieveCoords();
}
}
}
use of au.gov.asd.tac.constellation.plugins.arrangements.grid.GridArranger in project constellation by constellation-app.
the class SpectralArrangementPlugin method edit.
@Override
protected void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
interaction.setProgress(0, 0, "Arranging...", true);
if (graph.getVertexCount() > 0) {
final SetRadiusForArrangement radiusSetter = new SetRadiusForArrangement(graph);
radiusSetter.setRadii();
final Arranger inner = new SpectralArranger();
final Arranger outer = new GridArranger();
final GraphTaxonomyArranger arranger = new GraphComponentArranger(inner, outer, Connections.LINKS);
arranger.setSingletonArranger(new GridArranger());
arranger.setDoubletArranger(new GridArranger());
arranger.setInteraction(interaction);
arranger.setMaintainMean(true);
final SelectedInclusionGraph selectedGraph = new SelectedInclusionGraph(graph, Connections.LINKS);
arranger.arrange(selectedGraph.getInclusionGraph());
selectedGraph.retrieveCoords();
}
interaction.setProgress(1, 0, "Finished", true);
}
use of au.gov.asd.tac.constellation.plugins.arrangements.grid.GridArranger in project constellation by constellation-app.
the class ArrangeInTreesPlugin method edit.
@Override
protected void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
interaction.setProgress(0, 0, "Arranging...", true);
if (graph.getVertexCount() > 0) {
final SetRadiusForArrangement radiusSetter = new SetRadiusForArrangement(graph);
radiusSetter.setRadii();
final Arranger inner = new CircTreeArranger(CircTreeChoiceParameters.getDefaultParameters());
final Arranger middle = new MdsArranger(MDSChoiceParameters.getDefaultParameters());
final GridChoiceParameters outerGcParams = GridChoiceParameters.getDefaultParameters();
outerGcParams.setRowOffsets(false);
final Arranger outer = new GridArranger(outerGcParams);
final GridChoiceParameters innerGcParams = GridChoiceParameters.getDefaultParameters();
final GraphTaxonomyArranger arranger2 = new TreeTaxonArranger(inner, middle);
arranger2.setInteraction(interaction);
// Push the MDS parts further away from each other.
final UncollideArrangement unc = new UncollideArrangement(2);
unc.setMinPadding(4);
arranger2.setUncollider(unc);
final GraphTaxonomyArranger arranger1 = new GraphComponentArranger(arranger2, outer, Connections.LINKS);
arranger1.setSingletonArranger(new GridArranger(innerGcParams));
arranger1.setDoubletArranger(new GridArranger(innerGcParams, true));
arranger1.setInteraction(interaction);
final SelectedInclusionGraph selectedGraph = new SelectedInclusionGraph(graph, SelectedInclusionGraph.Connections.LINKS);
final boolean maintainMean = !selectedGraph.isArrangingAll();
arranger1.setMaintainMean(maintainMean);
arranger1.arrange(selectedGraph.getInclusionGraph());
selectedGraph.retrieveCoords();
}
interaction.setProgress(1, 0, "Finished", true);
}
use of au.gov.asd.tac.constellation.plugins.arrangements.grid.GridArranger in project constellation by constellation-app.
the class HighDimensionEmbeddingPlugin method edit.
@Override
public void edit(final GraphWriteMethods wg, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
final int dimensions = parameters.getParameters().get(DIMENSIONS_PARAMETER_ID).getIntegerValue();
if (wg.getVertexCount() > 0) {
final SetRadiusForArrangement radiusSetter = new SetRadiusForArrangement(wg);
radiusSetter.setRadii();
final GridChoiceParameters innerGcParams = GridChoiceParameters.getDefaultParameters();
final Arranger inner = new HighDimensionEmbeddingArranger(dimensions);
final GridChoiceParameters outerGcParams = GridChoiceParameters.getDefaultParameters();
outerGcParams.setRowOffsets(false);
final Arranger outer = new GridArranger(outerGcParams);
final GraphTaxonomyArranger arranger = new GraphComponentArranger(inner, outer, Connections.LINKS);
arranger.setSingletonArranger(new GridArranger(innerGcParams));
arranger.setDoubletArranger(new GridArranger(innerGcParams, true));
arranger.setInteraction(interaction);
arranger.setMaintainMean(true);
// We need to include links to discover the components.
final SelectedInclusionGraph selectedGraph = new SelectedInclusionGraph(wg, Connections.LINKS);
arranger.arrange(selectedGraph.getInclusionGraph());
selectedGraph.retrieveCoords();
PluginExecution.withPlugin(InteractiveGraphPluginRegistry.RESET_VIEW).executeNow(wg);
}
}
use of au.gov.asd.tac.constellation.plugins.arrangements.grid.GridArranger in project constellation by constellation-app.
the class ArrangeInHierarchyPlugin method edit.
@Override
protected void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
// roots will be a set of integers, which extends object type
@SuppressWarnings("unchecked") final Set<Integer> roots = (Set<Integer>) parameters.getParameters().get(ROOTS_PARAMETER_ID).getObjectValue();
if (graph.getVertexCount() > 0) {
final SetRadiusForArrangement radiusSetter = new SetRadiusForArrangement(graph);
radiusSetter.setRadii();
final GridChoiceParameters innerGcParams = GridChoiceParameters.getDefaultParameters();
final Arranger inner = new HierarchicalArranger(roots);
final GridChoiceParameters outerGcParams = GridChoiceParameters.getDefaultParameters();
outerGcParams.setRowOffsets(false);
final Arranger outer = new GridArranger(outerGcParams);
final GraphTaxonomyArranger arranger = new GraphComponentArranger(inner, outer, Connections.LINKS);
arranger.setSingletonArranger(new GridArranger(innerGcParams));
arranger.setDoubletArranger(new GridArranger(innerGcParams, true));
arranger.setInteraction(interaction);
arranger.setMaintainMean(true);
final SelectedInclusionGraph selectedGraph = new SelectedInclusionGraph(graph, Connections.LINKS);
arranger.arrange(selectedGraph.getInclusionGraph());
selectedGraph.retrieveCoords();
}
}
Aggregations