-
- Type Parameters:
V
- the vertex type
- All Known Implementing Classes:
ListenableLayoutModel2D
,MapLayoutModel2D
public interface LayoutModel2D<V> extends Iterable<Map.Entry<V,Point2D>>
A general interface for the 2D layout model. The layout model provides the necessary components to aLayoutAlgorithm2D
in order to draw a graph. Its responsibility is to provide the available drawable area, to be able to store and answer queries about vertex coordinates, and to allow someone to fix (make permanent) a vertex location.- Author:
- Dimitrios Michail
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Map<V,Point2D>
collect()
Collect a map of all vertices locations.Point2D
get(V vertex)
Get the last location of a particular vertex in the model.Box2D
getDrawableArea()
Get the drawable area of the model.boolean
isFixed(V vertex)
Check whether a vertex is a fixed point.Iterator<Map.Entry<V,Point2D>>
iterator()
Get an iterator with all vertices' locations.Point2D
put(V vertex, Point2D point)
Set the location of a vertex.void
setDrawableArea(Box2D drawableArea)
Set the drawable area of the model.void
setFixed(V vertex, boolean fixed)
Set a point as being a "fixed-point" or not.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
getDrawableArea
Box2D getDrawableArea()
Get the drawable area of the model.- Returns:
- the drawable area of the model
-
setDrawableArea
void setDrawableArea(Box2D drawableArea)
Set the drawable area of the model.- Parameters:
drawableArea
- the drawable area to use
-
get
Point2D get(V vertex)
Get the last location of a particular vertex in the model. May return null if the vertex has not been assigned a location or if the particular implementation does not store the coordinates.- Parameters:
vertex
- the graph vertex- Returns:
- the last location of the vertex
-
put
Point2D put(V vertex, Point2D point)
Set the location of a vertex.- Parameters:
vertex
- the graph vertexpoint
- the location- Returns:
- the previous location or null if the vertex did not have a previous location or if the model does not store locations
-
setFixed
void setFixed(V vertex, boolean fixed)
Set a point as being a "fixed-point" or not. It is the model's responsibility to make sure that changing the coordinates of a fixed point by callingput(Object, Point2D)
has no effect.- Parameters:
vertex
- a vertexfixed
- whether it is a fixed point or not.
-
isFixed
boolean isFixed(V vertex)
Check whether a vertex is a fixed point. It is the model's responsibility to make sure that changing the coordinates of a fixed point by callingput(Object, Point2D)
has no effect.- Parameters:
vertex
- the vertex- Returns:
- true if a fixed point, false otherwise
-
collect
default Map<V,Point2D> collect()
Collect a map of all vertices locations. May return null if the model does not store locations.- Returns:
- a map with all the locations
-
-