21import java.awt.Dimension;
22import java.awt.geom.Point2D;
24import java.util.concurrent.ExecutionException;
26import com.google.common.base.Function;
27import com.google.common.base.Functions;
29import denoptim.gui.GraphViewerPanel.JVertex;
30import edu.uci.ics.jung.algorithms.layout.SpringLayout2;
31import edu.uci.ics.jung.algorithms.layout.util.RandomLocationTransformer;
32import edu.uci.ics.jung.graph.Graph;
56 @SuppressWarnings(
"unchecked")
59 super(g, (Function<E,Integer>)Functions.<Integer>constant(60));
60 setForceMultiplier(1);
61 setRepulsionRange(200);
69 this.lockInitialPositions = lock;
70 this.oldVertexPosition = vertexPosition;
73 for (Point2D p : vertexPosition.values())
81 this.oldRange.width = (int) maxX;
82 this.oldRange.height = (int) maxY;
100 for (V v : this.graph.getVertices())
118 new RandomLocationTransformer<>(
new Dimension(
oldRange));
148 return locations.get(vertex);
Map< String, Point2D > vertexPosition
RandomLocationTransformer< V > randomPosition
RecreateKnownPositions(Map< String, Point2D > vertexPosition)
This layout extends the SpringLayout to change its behaviour.
void step()
Relaxation step.
Point2D getVertexPosition(V vertex)
Returns the current value of the position of the given vertex.
void setInitialLocations(Map< String, Point2D > vertexPosition, boolean lock)
Map< String, Point2D > oldVertexPosition
boolean lockInitialPositions
a vertex in the JUNG Graph.