|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.whatswrong.AbstractEdgeLayout
public abstract class AbstractEdgeLayout
An AbstractEdgeLayout serves as a base class for edge layout classes. It mostly stores properties associated with drawing edge layouts, such as whether lines should be curved or not.
Field Summary | |
---|---|
protected int |
baseline
Where do we start to draw |
protected boolean |
curve
Should the edges be curved. |
protected java.util.HashMap<Edge,java.awt.Point> |
from
A mapping from edges to their start points in the layout. |
protected int |
heightPerLevel
How many pixels to use per height level |
protected int |
maxHeight
The height of the layout. |
protected int |
maxWidth
The width of the layout. |
protected java.util.HashMap<java.awt.Shape,Edge> |
shapes
A mapping from edge shapes to the corresponding edge objects. |
protected java.util.HashMap<Edge,java.awt.Point> |
to
A mapping from edges to their end points in the layout. |
protected int |
vertexExtraSpace
How many extra pixels to start and end arrows from. |
protected java.util.HashSet<Edge> |
visible
The set of visisible edges. |
Constructor Summary | |
---|---|
AbstractEdgeLayout()
|
Method Summary | |
---|---|
void |
addToSelection(Edge edge)
Add an edge to the selection. |
protected int |
calculateDepth(HashMultiMapLinkedList<Edge,Edge> dominates,
Counter<Edge> depth,
Edge root)
Calculate the number of edges under each edge and returns the max. |
void |
clearSelection()
Remove all edges from the selection. |
int |
getBaseline()
The number of pixels below the graph (between the tokens and the edges). |
java.awt.Color |
getColor(java.lang.String type)
Return the color for edges of the given type. |
Edge |
getEdgeAt(java.awt.geom.Point2D p,
int radius)
Get the Edge at a given location. |
java.awt.Point |
getFrom(Edge edge)
Return the point at the start of the given edge. |
int |
getHeight()
Return the height of the graph layout. |
int |
getHeightPerLevel()
The number of pixels per graph layer. |
java.util.Set<Edge> |
getSelected()
Returns the set of selected edges. |
java.awt.BasicStroke |
getStroke(Edge edge)
Get the stroke for a given edge. |
java.awt.BasicStroke |
getStroke(java.lang.String type)
Returns the stroke for a given type. |
java.awt.Point |
getTo(Edge edge)
Return the point at the end of the given edge. |
int |
getVertexExtraSpace()
The extra number of pixels around a token vertex we can use for starting and end points of edges. |
int |
getWidth()
Return the width of the graph layout. |
boolean |
isCurve()
Should edges be curved |
void |
onlyShow(java.util.Collection<Edge> edges)
Show only the given edges. |
void |
removeFromSelection(Edge edge)
Remove an edge from the selection. |
void |
select(Edge edge)
Select only one edge and remove all other edges from the selection. |
void |
setBaseline(int baseline)
At how many pixels from the bottom should the graph start. |
void |
setColor(java.lang.String type,
java.awt.Color color)
Set the color for edges of a certain type. |
void |
setCurve(boolean curve)
Should edges be curved |
void |
setHeightPerLevel(int heightPerLevel)
Sets the number of pixels for each graph layer. |
void |
setStroke(java.lang.String type,
java.awt.BasicStroke stroke)
Set the stroke type for edges of a certain type. |
void |
setVertexExtraSpace(int vertexExtraSpace)
The extra number of pixels around a token vertex we can use for starting and end points of edges. |
void |
showAll()
Show all edges. |
void |
toggleSelection(Edge edge)
Change whether the given edge is selected or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int baseline
protected int heightPerLevel
protected int vertexExtraSpace
protected boolean curve
protected java.util.HashMap<Edge,java.awt.Point> from
protected java.util.HashMap<Edge,java.awt.Point> to
protected java.util.HashMap<java.awt.Shape,Edge> shapes
protected java.util.HashSet<Edge> visible
protected int maxHeight
EdgeLayout.layout(java.util.Collection,
TokenLayout, java.awt.Graphics2D)
method after the layout process.
protected int maxWidth
EdgeLayout.layout(java.util.Collection,
TokenLayout, java.awt.Graphics2D)
method after the layout process.
Constructor Detail |
---|
public AbstractEdgeLayout()
Method Detail |
---|
public void setColor(java.lang.String type, java.awt.Color color)
type
- the type of the edges we want to change the color for.color
- the color of the edges of the given type.public void setStroke(java.lang.String type, java.awt.BasicStroke stroke)
type
- the type to change the stroke for.stroke
- the stroke for edges of the given type.public java.awt.BasicStroke getStroke(Edge edge)
edge
- the edge we need the stroke for.
public java.awt.BasicStroke getStroke(java.lang.String type)
type
- the type of edges to get the stroke for.
public java.awt.Color getColor(java.lang.String type)
type
- the type for which we want the color for.
public void addToSelection(Edge edge)
edge
- the edge to add to the selection.public void removeFromSelection(Edge edge)
edge
- the edge to remove.public void clearSelection()
public void onlyShow(java.util.Collection<Edge> edges)
edges
- the edges to show.public void showAll()
public void toggleSelection(Edge edge)
edge
- the edge to add or remove from the selection.public java.util.Set<Edge> getSelected()
public void select(Edge edge)
edge
- the edge to select.public Edge getEdgeAt(java.awt.geom.Point2D p, int radius)
p
- the location of the edge.radius
- the radius around the point which the edge should cross.
protected int calculateDepth(HashMultiMapLinkedList<Edge,Edge> dominates, Counter<Edge> depth, Edge root)
dominates
- a map from edges to the edges it dominates.depth
- the resulting depths of each edge.root
- the root of the graph.
public java.awt.Point getFrom(Edge edge)
edge
- the edge to get the starting point from.
public java.awt.Point getTo(Edge edge)
edge
- the edge to get the end point from.
public int getHeight()
EdgeLayout.getHeight()
public int getWidth()
EdgeLayout.getWidth()
public int getHeightPerLevel()
public boolean isCurve()
public void setCurve(boolean curve)
curve
- true iff if graph should be curved.public void setBaseline(int baseline)
baseline
- how many pixels from the bottom should the graph start.public void setHeightPerLevel(int heightPerLevel)
heightPerLevel
- number of pixels for each graph layer.public void setVertexExtraSpace(int vertexExtraSpace)
vertexExtraSpace
- The extra number of pixels around a token vertex we can use for starting and end points of
edges.public int getVertexExtraSpace()
public int getBaseline()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |