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);
}
}
}
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;
}
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);
}
}
Aggregations