V
- the vertex typeE
- the edge typepublic abstract class AbstractLayout<V,E> extends java.lang.Object implements Layout<V,E>
Layout
. It handles some of the
basic functions: storing coordinates, maintaining the dimensions, initializing
the locations, maintaining locked vertices.Modifier and Type | Field and Description |
---|---|
protected Graph<V,E> |
graph |
protected boolean |
initialized |
protected java.util.Map<V,java.awt.geom.Point2D> |
locations |
protected java.awt.Dimension |
size |
Modifier | Constructor and Description |
---|---|
protected |
AbstractLayout()
Creates an instance which does not initialize the vertex locations.
|
protected |
AbstractLayout(Graph<V,E> graph)
Creates an instance which does not initialize the vertex locations.
|
protected |
AbstractLayout(Graph<V,E> graph,
java.awt.Dimension size) |
protected |
AbstractLayout(Graph<V,E> graph,
org.apache.commons.collections15.Transformer<V,java.awt.geom.Point2D> initializer) |
protected |
AbstractLayout(Graph<V,E> graph,
org.apache.commons.collections15.Transformer<V,java.awt.geom.Point2D> initializer,
java.awt.Dimension size) |
Modifier and Type | Method and Description |
---|---|
Graph<V,E> |
getGraph()
Accessor for the graph that represets all vertices.
|
java.awt.Dimension |
getSize()
Returns the current size of the visualization space, accoring to the
last call to resize().
|
double |
getX(V v)
Returns the x coordinate of the vertex from the Coordinates object.
|
double |
getY(V v)
Returns the y coordinate of the vertex from the Coordinates object.
|
boolean |
isLocked(V v)
Returns
true if the position of vertex v
is locked. |
void |
lock(boolean lock)
Locks all vertices in place if
lock is true , otherwise unlocks all vertices. |
void |
lock(V v,
boolean state)
Locks
v in place if state is true , otherwise unlocks it. |
protected void |
offsetVertex(V v,
double xOffset,
double yOffset) |
void |
setGraph(Graph<V,E> graph)
setter for graph
|
void |
setInitializer(org.apache.commons.collections15.Transformer<V,java.awt.geom.Point2D> initializer)
provides initial locations for all vertices.
|
void |
setLocation(V picked,
double x,
double y)
Forcibly moves a vertex to the (x,y) location by setting its x and y
locations to the inputted location.
|
void |
setLocation(V picked,
java.awt.geom.Point2D p)
set the location of a vertex
|
void |
setSize(java.awt.Dimension size)
When a visualization is resized, it presumably wants to fix the
locations of the vertices and possibly to reinitialize its data.
|
java.awt.geom.Point2D |
transform(V v) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialize, reset
protected java.awt.Dimension size
protected boolean initialized
protected java.util.Map<V,java.awt.geom.Point2D> locations
protected AbstractLayout()
protected AbstractLayout(Graph<V,E> graph)
graph
- the graph for which the layout algorithm is to be created.protected AbstractLayout(Graph<V,E> graph, org.apache.commons.collections15.Transformer<V,java.awt.geom.Point2D> initializer)
public void setGraph(Graph<V,E> graph)
Layout
public void setSize(java.awt.Dimension size)
public boolean isLocked(V v)
Layout
true
if the position of vertex v
is locked.public void setInitializer(org.apache.commons.collections15.Transformer<V,java.awt.geom.Point2D> initializer)
Layout
setInitializer
in interface Layout<V,E>
public java.awt.Dimension getSize()
public java.awt.geom.Point2D transform(V v)
transform
in interface org.apache.commons.collections15.Transformer<V,java.awt.geom.Point2D>
public double getX(V v)
public double getY(V v)
protected void offsetVertex(V v, double xOffset, double yOffset)
v
- xOffset
- yOffset
- public void setLocation(V picked, double x, double y)
public void setLocation(V picked, java.awt.geom.Point2D p)
Layout
setLocation
in interface Layout<V,E>
public void lock(V v, boolean state)
v
in place if state
is true
, otherwise unlocks it.public void lock(boolean lock)
lock
is true
, otherwise unlocks all vertices.Copyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence