Search in sources :

Example 1 with CircularLayouter

use of y.layout.circular.CircularLayouter in project binnavi by google.

the class CGraphDialogs method showGraphSettingsDialog.

/**
   * Shows the graph settings dialog for a given graph.
   *
   * @param parent Parent window of the dialog.
   * @param graph Graph whose settings are edited in the dialog.
   */
public static void showGraphSettingsDialog(final JFrame parent, final ZyGraph graph) {
    final CGraphSettingsDialog dlg = new CGraphSettingsDialog(parent, "Graph Settings", graph.getSettings(), false, false);
    dlg.setVisible(true);
    if (!dlg.wasCanceled()) {
        if (graph.getSettings().getLayoutSettings().getCurrentLayouter() instanceof CircularLayouter) {
            graph.getSettings().getLayoutSettings().setDefaultGraphLayout(LayoutStyle.CIRCULAR);
        } else if (graph.getSettings().getLayoutSettings().getCurrentLayouter() instanceof IncrementalHierarchicLayouter) {
            graph.getSettings().getLayoutSettings().setDefaultGraphLayout(LayoutStyle.HIERARCHIC);
        } else if (graph.getSettings().getLayoutSettings().getCurrentLayouter() instanceof OrthogonalLayouter) {
            graph.getSettings().getLayoutSettings().setDefaultGraphLayout(LayoutStyle.ORTHOGONAL);
        }
        if (dlg.needsLayouting()) {
            CGraphLayouter.refreshLayout(parent, graph);
        }
    }
}
Also used : CircularLayouter(y.layout.circular.CircularLayouter) IncrementalHierarchicLayouter(y.layout.hierarchic.IncrementalHierarchicLayouter) OrthogonalLayouter(y.layout.orthogonal.OrthogonalLayouter) CGraphSettingsDialog(com.google.security.zynamics.binnavi.Gui.GraphSettings.CGraphSettingsDialog)

Example 2 with CircularLayouter

use of y.layout.circular.CircularLayouter in project binnavi by google.

the class ZyGraphLayouter method createCircularLayouter.

public static CanonicMultiStageLayouter createCircularLayouter(final CircularStyle style, final long minNodeDist) {
    Preconditions.checkNotNull(style, "Internal Error: Layout style can't be null");
    Preconditions.checkArgument(minNodeDist >= 0, "Internal Error: Minimum node distance can't be negative");
    final CircularLayouter layouter = new CircularLayouter();
    switch(style) {
        case COMPACT:
            layouter.setLayoutStyle(CircularLayouter.BCC_COMPACT);
            break;
        case ISOLATED:
            layouter.setLayoutStyle(CircularLayouter.BCC_ISOLATED);
            break;
        case SINGLE_CIRCLE:
            layouter.setLayoutStyle(CircularLayouter.SINGLE_CYCLE);
            break;
        default:
            throw new IllegalStateException("Internal Error: Unknown layout style");
    }
    layouter.setPartitionLayoutStyle(CircularLayouter.PARTITION_LAYOUTSTYLE_CYCLIC);
    final SingleCycleLayouter cycleLayouter = layouter.getSingleCycleLayouter();
    cycleLayouter.setAutomaticRadius(true);
    cycleLayouter.setMinimalNodeDistance((int) minNodeDist);
    final BalloonLayouter bl = layouter.getBalloonLayouter();
    bl.setMinimalEdgeLength((int) minNodeDist);
    bl.setAllowOverlaps(false);
    return layouter;
}
Also used : CircularLayouter(y.layout.circular.CircularLayouter) SingleCycleLayouter(y.layout.circular.SingleCycleLayouter) BalloonLayouter(y.layout.tree.BalloonLayouter)

Example 3 with CircularLayouter

use of y.layout.circular.CircularLayouter in project binnavi by google.

the class LayoutFunctions method recalculatePorts.

public static void recalculatePorts(final CanonicMultiStageLayouter layouter, final Graph2D graph) {
    if (layouter instanceof CircularLayouter) {
        // Port correction
        LayoutTool.clipEdgesOnBB(graph);
        // Recalculate ports (necessary for circular proximity nodes)
        final PortCalculator pc = new PortCalculator();
        final NodeRealizerIntersectionCalculator nrics = new NodeRealizerIntersectionCalculator(graph, true);
        graph.addDataProvider(IntersectionCalculator.SOURCE_INTERSECTION_CALCULATOR_DPKEY, nrics);
        final NodeRealizerIntersectionCalculator nrict = new NodeRealizerIntersectionCalculator(graph, false);
        graph.addDataProvider(IntersectionCalculator.TARGET_INTERSECTION_CALCULATOR_DPKEY, nrict);
        pc.doLayout(graph);
    }
}
Also used : CircularLayouter(y.layout.circular.CircularLayouter) PortCalculator(y.layout.PortCalculator) NodeRealizerIntersectionCalculator(y.view.NodeRealizerIntersectionCalculator)

Aggregations

CircularLayouter (y.layout.circular.CircularLayouter)3 CGraphSettingsDialog (com.google.security.zynamics.binnavi.Gui.GraphSettings.CGraphSettingsDialog)1 PortCalculator (y.layout.PortCalculator)1 SingleCycleLayouter (y.layout.circular.SingleCycleLayouter)1 IncrementalHierarchicLayouter (y.layout.hierarchic.IncrementalHierarchicLayouter)1 OrthogonalLayouter (y.layout.orthogonal.OrthogonalLayouter)1 BalloonLayouter (y.layout.tree.BalloonLayouter)1 NodeRealizerIntersectionCalculator (y.view.NodeRealizerIntersectionCalculator)1