public static void dolayout( Graph2D graph, CycleEnum cycleType, byte partitionLayoutStyle, int maxDevAngle, boolean fromSketch, boolean enableOnlyCore, boolean groupNodeHiding, boolean selfLoopLayouter, boolean parallelEdgeLayouter, boolean subgraphLayouter, boolean labelLayouter, boolean componentLayouter, boolean orientationLayouter) { CircularLayouter clo = new CircularLayouter(); switch (cycleType) { case SINGLE_CYCLE: clo.setLayoutStyle(CircularLayouter.SINGLE_CYCLE); break; case BCC_ISOLATED: clo.setLayoutStyle(CircularLayouter.BCC_ISOLATED); break; case BCC_COMPACT: clo.setLayoutStyle(CircularLayouter.BCC_COMPACT); break; case CIRCULAR_CUSTOM_GROUPS: clo.setLayoutStyle(CircularLayouter.CIRCULAR_CUSTOM_GROUPS); break; default: clo.setLayoutStyle(CircularLayouter.BCC_COMPACT); break; } clo.setMaximalDeviationAngle(maxDevAngle); clo.setPartitionLayoutStyle(partitionLayoutStyle); clo.setFromSketchModeEnabled(fromSketch); if (enableOnlyCore) { clo.enableOnlyCore(); } clo.setLabelLayouterEnabled(labelLayouter); clo.setSubgraphLayouterEnabled(subgraphLayouter); clo.setSelfLoopLayouterEnabled(selfLoopLayouter); clo.setComponentLayouterEnabled(componentLayouter); clo.setParallelEdgeLayouterEnabled(parallelEdgeLayouter); clo.setOrientationLayouterEnabled(orientationLayouter); clo.setGroupNodeHidingEnabled(groupNodeHiding); try { new BufferedLayouter(clo).doLayout(graph); } catch (ArrayIndexOutOfBoundsException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
@Override protected void layout(Graph2D graph) { // graph.addDataProvider(Layouter.,Selections.createSelectionNodeMap(graph)); CircularLayouter clo = new CircularLayouter(); switch (f_cycleType) { case SINGLE_CYCLE: clo.setLayoutStyle(CircularLayouter.SINGLE_CYCLE); // SingleCycleLayouter cycleLayouter = clo.getSingleCycleLayouter(); // cycleLayouter.enableOnlyCore(); // cycleLayouter.setAutomaticRadius(CHOOSE_RADIUS_AUTOMATICALLY); // cycleLayouter.setMinimalNodeDistance(MINIMAL_NODE_DISTANCE); // cycleLayouter.setFixedRadius(FIXED_RADIUS); // cycleLayouter.setGroupNodeHider(null); // cycleLayouter.setComponentLayouterEnabled(true); // cycleLayouter.setSelfLoopLayouterEnabled(true); // cycleLayouter.setSubgraphLayouterEnabled(true); // cycleLayouter.setParallelEdgeLayouterEnabled(false); // cycleLayouter.setOrientationLayouterEnabled(true); // cycleLayouter.setMinimalRadius(100); // cycleLayouter.setLabelLayouterEnabled(true); // cycleLayouter.setConsiderNodeLabelsEnabled(HANDLE_NODE_LABELS); // cycleLayouter.setPlaceChildrenOnCommonRadiusEnabled(PLACE_CHILDREN_ON_COMMON_RADIUS); break; case BCC_ISOLATED: clo.setLayoutStyle(CircularLayouter.BCC_ISOLATED); break; case BCC_COMPACT: clo.setLayoutStyle(CircularLayouter.BCC_COMPACT); break; case CIRCULAR_CUSTOM_GROUPS: // Custom Groups // The node partitions that form circles will be given by the user. // To specify the partitions, a data provider holding such supplemental layout data must be // bound to the graph. // The data provider is expected to be registered with the graph using key // CIRCULAR_CUSTOM_GROUPS_DPKEY. clo.setLayoutStyle(CircularLayouter.CIRCULAR_CUSTOM_GROUPS); break; default: clo.setLayoutStyle(CircularLayouter.BCC_COMPACT); break; } clo.setMaximalDeviationAngle(MAXIMAL_DEVIATION_ANGLE); clo.setPartitionLayoutStyle(PARTITION_LAYOUT_STYLE); clo.setFromSketchModeEnabled(FROM_SKETCH_MODE); if (ENABLE_ONLY_CORE) { clo.enableOnlyCore(); } clo.setLabelLayouterEnabled(ENABLE_LABEL_LAYOUTER); clo.setSubgraphLayouterEnabled(ENABLE_SUBGRAPH_LAYOUTER); clo.setSelfLoopLayouterEnabled(ENABLE_SELF_LOOP_LAYOUTER); clo.setComponentLayouterEnabled(ENABLE_COMPONENT_LAYOUTER); clo.setParallelEdgeLayouterEnabled(ENABLE_PARALLEL_EDGE_LAYOUTER); clo.setOrientationLayouterEnabled(ENABLE_ORIENTATION_LAYOUTER); clo.setGroupNodeHidingEnabled(ENABLE_GROUP_NODE_HIDING); try { new BufferedLayouter(clo).doLayout(graph); } catch (ArrayIndexOutOfBoundsException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (OutOfMemoryError e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }