Package com.powsybl.sld.force.layout
Class ForceLayout<V,E>
- java.lang.Object
-
- com.powsybl.sld.force.layout.ForceLayout<V,E>
-
public class ForceLayout<V,E> extends Object
The following algorithm is a force layout algorithm. It seeks to place the nodes of a graph in such a way that the nodes are well spaced and that there are no unnecessary crossings. The algorithm uses an analogy with physics where the nodes of the graph are particles with mass and the edges are springs. Force calculations are used to place the nodes. The algorithm is taken from: https://github.com/dhotson/springy- Author:
- Mathilde Grapin
-
-
Constructor Summary
Constructors Constructor Description ForceLayout(org.jgrapht.Graph<V,E> graph)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
Set<Spring>
getSprings()
Vector
getStablePosition(V vertex)
ForceLayout<V,E>
setDamping(double damping)
ForceLayout<V,E>
setDeltaTime(double deltaTime)
ForceLayout<V,E>
setMaxSpeed(double maxSpeed)
ForceLayout<V,E>
setMaxSteps(int maxSteps)
ForceLayout<V,E>
setMinEnergyThreshold(double minEnergyThreshold)
ForceLayout<V,E>
setRepulsion(double repulsion)
void
toSVG(Function<V,String> tooltip, Writer writer)
void
toSVG(Function<V,String> tooltip, Path path)
-
-
-
Method Detail
-
setMaxSteps
public ForceLayout<V,E> setMaxSteps(int maxSteps)
-
setMinEnergyThreshold
public ForceLayout<V,E> setMinEnergyThreshold(double minEnergyThreshold)
-
setDeltaTime
public ForceLayout<V,E> setDeltaTime(double deltaTime)
-
setRepulsion
public ForceLayout<V,E> setRepulsion(double repulsion)
-
setDamping
public ForceLayout<V,E> setDamping(double damping)
-
setMaxSpeed
public ForceLayout<V,E> setMaxSpeed(double maxSpeed)
-
execute
public void execute()
-
toSVG
public void toSVG(Function<V,String> tooltip, Path path) throws IOException
- Throws:
IOException
-
-