Fixed spelling mistake

This commit is contained in:
dragonmacher 2021-09-21 10:40:11 -04:00
parent 9ad8582225
commit f07c144db9
3 changed files with 20 additions and 25 deletions

View file

@ -124,7 +124,7 @@ class LayoutFunction
case HIERACHICAL:
return EdgeAwareTreeLayoutAlgorithm
.<AttributedVertex, AttributedEdge>edgeAwareBuilder();
case COMPACT_HIERACHICAL:
case COMPACT_HIERARCHICAL:
default:
return TidierTreeLayoutAlgorithm
.<AttributedVertex, AttributedEdge> edgeAwareBuilder()

View file

@ -62,18 +62,17 @@ class LayoutTransitionManager {
* Create an instance with passed parameters
* @param visualizationServer displays the graph
* @param rootPredicate selects root vertices
* @param edgeTypePriorityList a {@code List} of EdgeType names in priority order
* @param favoredEdgePredicate q {@code Predicate} that will cause certain EdgeTypes to be favored during layout
* @param renderer the graph renderer
*/
public LayoutTransitionManager(
VisualizationServer<AttributedVertex, AttributedEdge> visualizationServer,
Predicate<AttributedVertex> rootPredicate,
GraphRenderer renderer) {
Predicate<AttributedVertex> rootPredicate, GraphRenderer renderer) {
this.visualizationServer = visualizationServer;
this.rootPredicate = rootPredicate;
this.renderContext = visualizationServer.getRenderContext();
this.vertexBoundsFunction = visualizationServer.getRenderContext().getVertexBoundsFunction();
this.vertexBoundsFunction =
visualizationServer.getRenderContext().getVertexBoundsFunction();
this.layoutFunction = new LayoutFunction(renderer);
}
@ -81,22 +80,22 @@ class LayoutTransitionManager {
* set the layout in order to configure the requested {@link LayoutAlgorithm}
* @param layoutName the name of the layout algorithm to use
*/
@SuppressWarnings("unchecked")
public void setLayout(String layoutName) {
LayoutAlgorithm.Builder<AttributedVertex, ?, ?> builder = layoutFunction.apply(layoutName);
LayoutAlgorithm<AttributedVertex> layoutAlgorithm = builder.build();
// layout algorithm considers the size of vertices
if (layoutAlgorithm instanceof VertexBoundsFunctionConsumer) {
((VertexBoundsFunctionConsumer<AttributedVertex>) layoutAlgorithm)
.setVertexBoundsFunction(vertexBoundsFunction);
.setVertexBoundsFunction(vertexBoundsFunction);
}
// mincross layouts are 'layered'. put some bounds on the number of
// iterations of the level cross function based on the size of the graph
// very large graphs do not improve enough to out-weigh the cost of
// repeated iterations
if (layoutAlgorithm instanceof Layered) {
((Layered<AttributedVertex, AttributedEdge>) layoutAlgorithm)
.setMaxLevelCrossFunction(g ->
Math.max(1, Math.min(10, 500 / g.vertexSet().size())));
((Layered<AttributedVertex, AttributedEdge>) layoutAlgorithm).setMaxLevelCrossFunction(
g -> Math.max(1, Math.min(10, 500 / g.vertexSet().size())));
}
// tree layouts need a way to determine which vertices are roots
// especially when the graph is not a DAG
@ -108,22 +107,18 @@ class LayoutTransitionManager {
removePaintable(radialLayoutRings);
removePaintable(balloonLayoutRings);
if (layoutAlgorithm instanceof BalloonLayoutAlgorithm) {
balloonLayoutRings =
new LayoutPaintable.BalloonRings<>(
visualizationServer,
(BalloonLayoutAlgorithm<AttributedVertex>) layoutAlgorithm);
balloonLayoutRings = new LayoutPaintable.BalloonRings<>(visualizationServer,
(BalloonLayoutAlgorithm<AttributedVertex>) layoutAlgorithm);
visualizationServer.addPreRenderPaintable(balloonLayoutRings);
}
if (layoutAlgorithm instanceof RadialTreeLayout) {
radialLayoutRings =
new LayoutPaintable.RadialRings<>(
visualizationServer, (RadialTreeLayout<AttributedVertex>) layoutAlgorithm);
radialLayoutRings = new LayoutPaintable.RadialRings<>(visualizationServer,
(RadialTreeLayout<AttributedVertex>) layoutAlgorithm);
visualizationServer.addPreRenderPaintable(radialLayoutRings);
}
// apply the layout algorithm
LayoutAlgorithmTransition.apply(visualizationServer,
layoutAlgorithm);
LayoutAlgorithmTransition.apply(visualizationServer, layoutAlgorithm);
}
private void removePaintable(VisualizationServer.Paintable paintable) {
@ -134,15 +129,15 @@ class LayoutTransitionManager {
/**
* Supplies the {@code LayoutAlgorithm} to be used for the initial @{code Graph} visualization
* @return
* @return the algorithm
*/
@SuppressWarnings("unchecked")
public LayoutAlgorithm<AttributedVertex> getInitialLayoutAlgorithm() {
LayoutAlgorithm<AttributedVertex> initialLayoutAlgorithm =
layoutFunction.apply(LayoutAlgorithmNames.COMPACT_HIERACHICAL).build();
layoutFunction.apply(LayoutAlgorithmNames.COMPACT_HIERARCHICAL).build();
if (initialLayoutAlgorithm instanceof TreeLayout) {
((TreeLayout<AttributedVertex>) initialLayoutAlgorithm)
.setRootPredicate(rootPredicate);
((TreeLayout<AttributedVertex>) initialLayoutAlgorithm).setRootPredicate(rootPredicate);
}
if (initialLayoutAlgorithm instanceof VertexBoundsFunctionConsumer) {
((VertexBoundsFunctionConsumer<AttributedVertex>) initialLayoutAlgorithm)