VertexType
- the type of the vertices of the graphEdgeType
- the type of the edges of the graphpublic abstract class StdLayout<VertexType,EdgeType>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected class |
StdLayout.VisVertex |
Modifier and Type | Field and Description |
---|---|
protected GraphLibrary<VertexType,EdgeType> |
graph |
protected java.lang.String |
lstLayoutParams |
Constructor and Description |
---|
StdLayout() |
Modifier and Type | Method and Description |
---|---|
EdgeVisualData<VertexType,EdgeType> |
addEdgeVisualData(EdgeType edge)
Creates visual data for the given edge and registers it
|
protected void |
addVertex(StdLayout.VisVertex vertex) |
StdLayout.VisVertex |
addVertex(VertexType vertex)
Creates visualization data for the given vertex and registers it
|
StdLayout.VisVertex |
addVertexData(StdLayout.VisVertex visData)
Registers the given visual data
|
VertexVisualData<VertexType,EdgeType> |
addVertexData(VertexType vertex)
Creates visual data out of the given vertex and registers it.
|
StdLayout.VisVertex |
addVertexData(VertexType vertex,
double posX,
double posY)
Creates visual data out of the given arguments and registers it
|
protected boolean |
allPositionsSet(java.lang.Iterable<StdLayout.VisVertex> vertices) |
void |
arrangeVertices(java.lang.String layoutParams)
Arranges the vertices
|
protected abstract void |
arrangeVertices(java.lang.String layoutParams,
java.lang.Iterable<StdLayout.VisVertex> vertices,
java.lang.Iterable<EdgeVisualData<VertexType,EdgeType>> edges) |
void |
clearArrangement()
Clears the arrangement by removing all visual data
|
StdLayout.VisVertex |
getEndVisVertex(EdgeType edge)
Returns the visual data of the end vertex of the given edge
|
GraphLibrary<VertexType,EdgeType> |
getGraph() |
StdLayout.VisVertex |
getStartVisVertex(EdgeType edge)
Returns the visual data of the start vertex of the given edge
|
StdLayout.VisVertex |
getVisualData(VertexType vertex)
Returns the visual data associated with the given vertex
|
java.lang.Iterable<EdgeVisualData<VertexType,EdgeType>> |
getVisualEdges()
Returns an Iterable to iterate over the visual edge data
|
java.lang.Iterable<StdLayout.VisVertex> |
getVisualVertices()
Returns an Iterable to iterate over the visual vertex data
|
StdLayout.VisVertex |
getVisVertexByIdent(java.lang.String ident)
Returns the visual data associated with the vertex which has the given identifier
|
boolean |
hasVisualData(VertexType vertex)
Tells whether or not, there is visual data associated with the given vertex
|
StdLayout<VertexType,EdgeType> |
init(GraphLibrary<VertexType,EdgeType> graph)
Initializes the layout and assigns it to the given graph.
|
void |
rearrange()
Arranges the vertices with the same settings as used for the previous arrangement
|
void |
removeEdgeVisData(EdgeType edge)
Removes the visual data associated with the given edge
|
void |
removeVertexVisData(VertexType vertex)
Removes the visual data associated with the given vertex
|
void |
updateVisEdges()
Updates the visual data like start and end points of the edges
|
protected GraphLibrary<VertexType,EdgeType> graph
protected java.lang.String lstLayoutParams
protected abstract void arrangeVertices(java.lang.String layoutParams, java.lang.Iterable<StdLayout.VisVertex> vertices, java.lang.Iterable<EdgeVisualData<VertexType,EdgeType>> edges) throws ArrangeException
ArrangeException
protected void addVertex(StdLayout.VisVertex vertex) throws ArrangeException
ArrangeException
public StdLayout.VisVertex addVertex(VertexType vertex) throws ArrangeException
vertex
- the vertex to addArrangeException
public void updateVisEdges()
public final void arrangeVertices(java.lang.String layoutParams) throws ArrangeException
layoutParams
- the arguments to configure the arrangement encoded as a string. The parameters depend on
the concrete layoutArrangeException
public EdgeVisualData<VertexType,EdgeType> addEdgeVisualData(EdgeType edge)
edge
- the edge to addpublic StdLayout<VertexType,EdgeType> init(GraphLibrary<VertexType,EdgeType> graph)
graph
- the graph from which to get vertices, edges etc.public final java.lang.Iterable<StdLayout.VisVertex> getVisualVertices()
public final java.lang.Iterable<EdgeVisualData<VertexType,EdgeType>> getVisualEdges()
public StdLayout.VisVertex getStartVisVertex(EdgeType edge)
public StdLayout.VisVertex getEndVisVertex(EdgeType edge)
public final StdLayout.VisVertex getVisualData(VertexType vertex)
public final boolean hasVisualData(VertexType vertex)
public final void clearArrangement()
public final StdLayout.VisVertex addVertexData(StdLayout.VisVertex visData)
public final StdLayout.VisVertex addVertexData(VertexType vertex, double posX, double posY)
vertex
- the vertex with which to associate the visual dataposX
- the graphical x position of the vertexposY
- the graphical y position of the vertexpublic final VertexVisualData<VertexType,EdgeType> addVertexData(VertexType vertex)
vertex
- the vertex with which to associate the visual datapublic final void removeVertexVisData(VertexType vertex)
public final void removeEdgeVisData(EdgeType edge)
public StdLayout.VisVertex getVisVertexByIdent(java.lang.String ident)
protected boolean allPositionsSet(java.lang.Iterable<StdLayout.VisVertex> vertices)
public GraphLibrary<VertexType,EdgeType> getGraph()
public void rearrange() throws ArrangeException
ArrangeException