edu.uci.ics.jung.visualization
Class PluggableRenderer

java.lang.Object
  extended by edu.uci.ics.jung.visualization.AbstractRenderer
      extended by edu.uci.ics.jung.visualization.PluggableRenderer
All Implemented Interfaces:
HasShapeFunctions, PickedInfo, Renderer

public class PluggableRenderer
extends AbstractRenderer
implements PickedInfo, HasShapeFunctions

A renderer with all sorts of buttons to press and dials to turn. Using the appropriate methods, the user can override the default properties/behaviors for vertex paint, stroke, shape, label, label font, and label centering; and for edge paint, stroke, label, arrows, label font, label positioning, and drawing.

Notes on these decorators:

By default, self-loops are drawn as circles.

By default, undirected edges are drawn as straight lines, directed edges are drawn as bent lines, and parallel edges are drawn on top of one another.

Arrowheads are drawn so that the point of the arrow is at the boundary of the vertex shapes. In the current implementation, finding the place where arrows are drawn is fairly slow; for large graphs, this should be turned off.

Setting a stroke width other than 1, or using transparency, may slow down rendering of the visualization.

Author:
Danyel Fisher, Joshua O'Madadhain, Tom Nelson

Field Summary
protected  float arrow_placement_tolerance
           
protected  boolean centerVertexLabel
           
static Stroke DASHED
          A stroke for a dashed line: 1 pixel width, square caps, beveled joins, and an array of {5.0f}.
protected static float[] dashing
           
static Stroke DOTTED
          A stroke for a dotted line: 1 pixel width, round caps, round joins, and an array of {1.0f, 3.0f}.
protected static float[] dotting
           
protected  EdgeArrowFunction edgeArrowFunction
           
protected  Predicate edgeArrowPredicate
           
protected  EdgeFontFunction edgeFontFunction
           
protected  Predicate edgeIncludePredicate
           
protected  NumberEdgeValue edgeLabelClosenessFunction
           
protected  EdgePaintFunction edgePaintFunction
           
protected  EdgeShapeFunction edgeShapeFunction
           
protected  EdgeStringer edgeStringer
           
protected  EdgeStrokeFunction edgeStrokeFunction
           
protected  GraphLabelRenderer graphLabelRenderer
          A default GraphLabelRenderer - picked Vertex labels are blue, picked edge labels are cyan
static int LABEL_OFFSET
          Specifies the offset for the edge labels.
protected static int MAX_ITERATIONS
          Specifies the maximum number of iterations to run the edge subdivision loop in getLastOutsideSegment; this is done to fix the arrow orientation problem noted in bug report #1450529.
protected  ParallelEdgeIndexFunction parallelEdgeIndexFunction
           
protected  CellRendererPane rendererPane
          The CellRendererPane is used here just as it is in JTree and JTable, to allow a pluggable JLabel-based renderer for Vertex and Edge label strings and icons.
protected  JComponent screenDevice
          the JComponent that this Renderer will display the graph on
protected static EdgePredicate self_loop
           
protected  VertexFontFunction vertexFontFunction
           
protected  VertexIconFunction vertexIconFunction
           
protected  Predicate vertexIncludePredicate
           
protected  VertexPaintFunction vertexPaintFunction
           
protected  VertexShapeFunction vertexShapeFunction
           
protected  VertexStringer vertexStringer
           
protected  VertexStrokeFunction vertexStrokeFunction
           
protected  MutableTransformer viewTransformer
           
 
Constructor Summary
PluggableRenderer()
           
 
Method Summary
protected  void drawSimpleEdge(Graphics2D g, Edge e, int x1, int y1, int x2, int y2)
          Draws the edge e, whose endpoints are at (x1,y1) and (x2,y2), on the graphics context g.
 AffineTransform getArrowTransform(GeneralPath edgeShape, Shape vertexShape)
          Returns a transform to position the arrowhead on this edge shape at the point where it intersects the passed vertex shape.
 AffineTransform getArrowTransform(Line2D edgeShape, Shape vertexShape)
          This is used for the arrow of a directed and for one of the arrows for non-directed edges Get a transform to place the arrow shape on the passed edge at the point where it intersects the passed shape
 EdgeArrowFunction getEdgeArrowFunction()
           
 Predicate getEdgeArrowPredicate()
           
 EdgeFontFunction getEdgeFontFunction()
           
 Predicate getEdgeIncludePredicate()
           
 NumberEdgeValue getEdgeLabelClosenessFunction()
           
 EdgePaintFunction getEdgePaintFunction()
           
 EdgeShapeFunction getEdgeShapeFunction()
           
 EdgeStringer getEdgeStringer()
           
 EdgeStrokeFunction getEdgeStrokeFunction()
           
protected  Line2D getFirstOutsideSegment(Line2D line, Shape shape)
          Passed Line's point1 must be inside the passed shape or an IllegalArgumentException is thrown
 GraphLabelRenderer getGraphLabelRenderer()
           
protected  Line2D getLastOutsideSegment(Line2D line, Shape shape)
          Passed Line's point2 must be inside the passed shape or an IllegalArgumentException is thrown
 ParallelEdgeIndexFunction getParallelEdgeIndexFunction()
           
 CellRendererPane getRendererPane()
           
 AffineTransform getReverseArrowTransform(GeneralPath edgeShape, Shape vertexShape)
          Returns a transform to position the arrowhead on this edge shape at the point where it intersects the passed vertex shape.
 AffineTransform getReverseArrowTransform(GeneralPath edgeShape, Shape vertexShape, boolean passedGo)
          Returns a transform to position the arrowhead on this edge shape at the point where it intersects the passed vertex shape.
protected  AffineTransform getReverseArrowTransform(Line2D edgeShape, Shape vertexShape)
          This is used for the reverse-arrow of a non-directed edge get a transform to place the arrow shape on the passed edge at the point where it intersects the passed shape
 JComponent getScreenDevice()
           
 VertexFontFunction getVertexFontFunction()
           
 VertexIconFunction getVertexIconFunction()
           
 Predicate getVertexIncludePredicate()
           
 boolean getVertexLabelCentering()
           
 VertexPaintFunction getVertexPaintFunction()
           
 VertexShapeFunction getVertexShapeFunction()
          Returns the VertexShapeFunction currently being used by this instance.
 VertexStringer getVertexStringer()
           
 VertexStrokeFunction getVertexStrokeFunction()
           
 boolean isPicked(ArchetypeEdge e)
          Deprecated. Use an independent PickedInfo instead of this version, which relies on the Renderer to supply an instance.
 boolean isPicked(ArchetypeVertex v)
          Deprecated. Use an independent PickedInfo instead of this version, which relies on the Renderer to supply an instance.
protected  void labelEdge(Graphics2D g2d, Edge e, String label, int x1, int x2, int y1, int y2)
          Labels the specified non-self-loop edge with the specified label.
protected  void labelVertex(Graphics g, Vertex v, String label, int x, int y)
          Labels the specified vertex with the specified label.
 void paintEdge(Graphics g, Edge e, int x1, int y1, int x2, int y2)
          Paints e, whose endpoints are at (x1,y1) and (x2,y2), on the graphics context g.
 void paintIconForVertex(Graphics g, Vertex v, int x, int y)
          Paint v's icon on g at (x,y).
 void paintShapeForVertex(Graphics2D g2d, Vertex v, Shape shape)
           
 void paintVertex(Graphics g, Vertex v, int x, int y)
          Paints the vertex v at the location (x,y) on the graphics context g_gen.
 Component prepareRenderer(GraphLabelRenderer renderer, Object value, boolean isSelected, Edge edge)
           
 Component prepareRenderer(GraphLabelRenderer graphLabelRenderer, Object value, boolean isSelected, Vertex vertex)
           
 void setArrowPlacementTolerance(float tolerance)
          Specifies the smallest (squared) distance that an arrowhead must be moved in order for the placement code to decide that it's "close enough".
 void setEdgeArrowFunction(EdgeArrowFunction eaf)
          Sets the EdgeArrowFunction that specifies the Shape of the arrowheads for each edge.
 void setEdgeArrowPredicate(Predicate p)
          Sets the EdgeArrowPredicate that specifies whether arrowheads should be drawn for each edge.
 void setEdgeColorFunction(EdgeColorFunction ecf)
          Deprecated. Use setEdgePaintFunction instead
 void setEdgeFontFunction(EdgeFontFunction eff)
          Sets the EdgeFontFunction that specifies the font to use for drawing each edge label.
 void setEdgeIncludePredicate(Predicate p)
          Sets the Predicate that specifies whether each edge should be drawn; only those edges for which this predicate returns true will be drawn.
 void setEdgeLabelClosenessFunction(NumberEdgeValue nev)
          Sets the NumberEdgeValue that specifies where to draw the label for each edge.
 void setEdgePaintFunction(EdgePaintFunction impl)
           
 void setEdgeShapeFunction(EdgeShapeFunction impl)
          setter for the EdgeShapeFunction
 void setEdgeStringer(EdgeStringer es)
          Sets the EdgeStringer that specifies the label to draw for each edge.
 void setEdgeStrokeFunction(EdgeStrokeFunction esf)
          Sets the EdgeStrokeFunction that specifies the Stroke to use when drawing each edge.
 void setGraphLabelRenderer(GraphLabelRenderer graphLabelRenderer)
           
 void setParallelEdgeIndexFunction(ParallelEdgeIndexFunction parallelEdgeIndexFunction)
           
 void setRendererPane(CellRendererPane rendererPane)
           
 void setScreenDevice(JComponent screenDevice)
          The screen device is the JComponent on which the renderer will display the graph.
 void setVertexColorFunction(VertexColorFunction vcf)
          Deprecated. Use setVertexPaintFunction with a VertexPaintFunction if you can
 void setVertexFontFunction(VertexFontFunction vff)
          Sets the VertexFontFunction that specifies the font to use for drawing each vertex label.
 void setVertexIconFunction(VertexIconFunction vertexIconFunction)
           
 void setVertexIncludePredicate(Predicate p)
          Sets the Predicate that specifies whether each vertex should be drawn; only those vertices for which this predicate returns true will be drawn.
 void setVertexLabelCentering(boolean b)
          Specifies whether vertex labels are drawn centered on the vertex position (true) or offset to one side (false).
 void setVertexPaintFunction(VertexPaintFunction vpf)
          Sets the VertexPaintFunction which specifies the draw (border and text) and fill (interior) Paint for each vertex.
 void setVertexShapeFunction(VertexShapeFunction vsf)
          Sets the VertexShapeFunction, which specifies the Shape for each vertex.
 void setVertexStringer(VertexStringer vs)
          Sets the VertexStringer that specifies the label to draw for each vertex.
 void setVertexStrokeFunction(VertexStrokeFunction vsf)
          Sets the VertexStrokeFunction which specifies the Stroke to use when drawing each vertex border.
 void setViewTransformer(MutableTransformer viewTransformer)
           
protected  void subdivide(Line2D src, Line2D left, Line2D right)
          divide a Line2D into 2 new Line2Ds that are returned in the passed left and right instances, if non-null
 
Methods inherited from class edu.uci.ics.jung.visualization.AbstractRenderer
getPickedKey, setPickedKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arrow_placement_tolerance

protected float arrow_placement_tolerance

dotting

protected static final float[] dotting

DOTTED

public static final Stroke DOTTED
A stroke for a dotted line: 1 pixel width, round caps, round joins, and an array of {1.0f, 3.0f}.


dashing

protected static final float[] dashing

DASHED

public static final Stroke DASHED
A stroke for a dashed line: 1 pixel width, square caps, beveled joins, and an array of {5.0f}.


LABEL_OFFSET

public static final int LABEL_OFFSET
Specifies the offset for the edge labels.

See Also:
Constant Field Values

MAX_ITERATIONS

protected static final int MAX_ITERATIONS
Specifies the maximum number of iterations to run the edge subdivision loop in getLastOutsideSegment; this is done to fix the arrow orientation problem noted in bug report #1450529.

See Also:
Constant Field Values

vertexIncludePredicate

protected Predicate vertexIncludePredicate

vertexStrokeFunction

protected VertexStrokeFunction vertexStrokeFunction

vertexShapeFunction

protected VertexShapeFunction vertexShapeFunction

vertexStringer

protected VertexStringer vertexStringer

vertexIconFunction

protected VertexIconFunction vertexIconFunction

vertexFontFunction

protected VertexFontFunction vertexFontFunction

centerVertexLabel

protected boolean centerVertexLabel

vertexPaintFunction

protected VertexPaintFunction vertexPaintFunction

edgeStringer

protected EdgeStringer edgeStringer

edgeStrokeFunction

protected EdgeStrokeFunction edgeStrokeFunction

edgeArrowFunction

protected EdgeArrowFunction edgeArrowFunction

edgeArrowPredicate

protected Predicate edgeArrowPredicate

edgeIncludePredicate

protected Predicate edgeIncludePredicate

edgeFontFunction

protected EdgeFontFunction edgeFontFunction

edgeLabelClosenessFunction

protected NumberEdgeValue edgeLabelClosenessFunction

edgeShapeFunction

protected EdgeShapeFunction edgeShapeFunction

edgePaintFunction

protected EdgePaintFunction edgePaintFunction

parallelEdgeIndexFunction

protected ParallelEdgeIndexFunction parallelEdgeIndexFunction

viewTransformer

protected MutableTransformer viewTransformer

screenDevice

protected JComponent screenDevice
the JComponent that this Renderer will display the graph on


rendererPane

protected CellRendererPane rendererPane
The CellRendererPane is used here just as it is in JTree and JTable, to allow a pluggable JLabel-based renderer for Vertex and Edge label strings and icons.


graphLabelRenderer

protected GraphLabelRenderer graphLabelRenderer
A default GraphLabelRenderer - picked Vertex labels are blue, picked edge labels are cyan


self_loop

protected static final EdgePredicate self_loop
Constructor Detail

PluggableRenderer

public PluggableRenderer()
Method Detail

getEdgeArrowFunction

public EdgeArrowFunction getEdgeArrowFunction()
Returns:
Returns the edgeArrowFunction.

getEdgeArrowPredicate

public Predicate getEdgeArrowPredicate()
Returns:
Returns the edgeArrowPredicate.

getEdgeFontFunction

public EdgeFontFunction getEdgeFontFunction()
Returns:
Returns the edgeFontFunction.

getEdgeIncludePredicate

public Predicate getEdgeIncludePredicate()
Returns:
Returns the edgeIncludePredicate.

getEdgeLabelClosenessFunction

public NumberEdgeValue getEdgeLabelClosenessFunction()
Returns:
Returns the edgeLabelClosenessFunction.

getEdgePaintFunction

public EdgePaintFunction getEdgePaintFunction()
Returns:
Returns the edgePaintFunction.

getEdgeStringer

public EdgeStringer getEdgeStringer()
Returns:
Returns the edgeStringer.

getEdgeStrokeFunction

public EdgeStrokeFunction getEdgeStrokeFunction()
Returns:
Returns the edgeStrokeFunction.

getScreenDevice

public JComponent getScreenDevice()
Returns:
Returns the screenDevice.

getVertexFontFunction

public VertexFontFunction getVertexFontFunction()
Returns:
Returns the vertexFontFunction.

getVertexIncludePredicate

public Predicate getVertexIncludePredicate()
Returns:
Returns the vertexIncludePredicate.

getVertexPaintFunction

public VertexPaintFunction getVertexPaintFunction()
Returns:
Returns the vertexPaintFunction.

getVertexStringer

public VertexStringer getVertexStringer()
Returns:
Returns the vertexStringer.

getVertexIconFunction

public VertexIconFunction getVertexIconFunction()
Returns:
Returns the vertexIconFunction

setVertexIconFunction

public void setVertexIconFunction(VertexIconFunction vertexIconFunction)
Parameters:
vertexIconFunction - The VertexIconFunction to set.

getVertexStrokeFunction

public VertexStrokeFunction getVertexStrokeFunction()
Returns:
Returns the vertexStrokeFunction.

setScreenDevice

public void setScreenDevice(JComponent screenDevice)
The screen device is the JComponent on which the renderer will display the graph. It is used here to assist with removing unnecessary calls to position and draw graph elements that will not be visible in the display. It is also used as the container for the CellRendererPane.

Parameters:
screenDevice -

setArrowPlacementTolerance

public void setArrowPlacementTolerance(float tolerance)
Specifies the smallest (squared) distance that an arrowhead must be moved in order for the placement code to decide that it's "close enough". Default value is 1.


setEdgeArrowFunction

public void setEdgeArrowFunction(EdgeArrowFunction eaf)
Sets the EdgeArrowFunction that specifies the Shape of the arrowheads for each edge. The same shape will be used for both ends of an undirected edge. The default arrow-drawing implementations assume that arrows are drawn with their base on the y-axis, pointed left (in the negative x-direction), centered on the x-axis. Note that the EdgeArrowFunction must return a valid shape for any edge for which the edge arrow Predicate returns true.
Default: wedge arrows for undirected edges, notched arrows for directed edges (DirectionalEdgeArrowFunction)

See Also:
edu.uci.ics.jung.decorators.EdgeArrowFunction, ArrowFactory

getGraphLabelRenderer

public GraphLabelRenderer getGraphLabelRenderer()
Returns:
Returns the graphLabelRenderer.

setGraphLabelRenderer

public void setGraphLabelRenderer(GraphLabelRenderer graphLabelRenderer)
Parameters:
graphLabelRenderer - The graphLabelRenderer to set.

setEdgeArrowPredicate

public void setEdgeArrowPredicate(Predicate p)
Sets the EdgeArrowPredicate that specifies whether arrowheads should be drawn for each edge. If the predicate evaluates to true for a specified edge, arrows should be drawn for that edge.
Default: only directed edges have arrows (Graph.DIRECTED_EDGE instance)

See Also:
EdgeArrowFunction

setEdgeColorFunction

public void setEdgeColorFunction(EdgeColorFunction ecf)
Deprecated. Use setEdgePaintFunction instead

Sets the EdgeColorFunction that specifies the paint to draw each edge.
Default: Color.BLACK

See Also:
Color

setEdgeFontFunction

public void setEdgeFontFunction(EdgeFontFunction eff)
Sets the EdgeFontFunction that specifies the font to use for drawing each edge label. This can be used (for example) to emphasize (or to de-emphasize) edges that have a specific property.
Default: 12-point Helvetica

See Also:
EdgeFontFunction

setEdgeIncludePredicate

public void setEdgeIncludePredicate(Predicate p)
Sets the Predicate that specifies whether each edge should be drawn; only those edges for which this predicate returns true will be drawn. This can be used to selectively display only those edges that have a specific property, such as a particular decoration or value, or only those edges of a specific type (such as directed edges, or everything except self-loops).
Default: all edges drawn (TruePredicate instance)

See Also:
Predicate

setEdgeLabelClosenessFunction

public void setEdgeLabelClosenessFunction(NumberEdgeValue nev)
Sets the NumberEdgeValue that specifies where to draw the label for each edge. A value of 0 draws the label on top of the edge's first vertex; a value of 1.0 draws the label on top of the edge's second vertex; values between 0 and 1 split the difference (i.e., a value of 0.5 draws the label halfway in between the two vertices). The effect of values outside the range [0,1] is undefined. This function is not used for self-loops.
Default: 0.5 for undirected edges, 0.75 for directed edges (ConstantDirectionalEdgeValue)

See Also:
NumberEdgeValue

setEdgePaintFunction

public void setEdgePaintFunction(EdgePaintFunction impl)
Parameters:
impl -

setEdgeShapeFunction

public void setEdgeShapeFunction(EdgeShapeFunction impl)
setter for the EdgeShapeFunction

Parameters:
impl -

getEdgeShapeFunction

public EdgeShapeFunction getEdgeShapeFunction()
Specified by:
getEdgeShapeFunction in interface HasShapeFunctions
Returns:
Returns the EdgeShapeFunction that .

setEdgeStringer

public void setEdgeStringer(EdgeStringer es)
Sets the EdgeStringer that specifies the label to draw for each edge.
Default: no labels (ConstantEdgeStringer)

See Also:
EdgeStringer

setEdgeStrokeFunction

public void setEdgeStrokeFunction(EdgeStrokeFunction esf)
Sets the EdgeStrokeFunction that specifies the Stroke to use when drawing each edge.
Default: 1-pixel-width basic stroke (ConstantEdgeStrokeFunction)

See Also:
Stroke, EdgeStrokeFunction

setVertexColorFunction

public void setVertexColorFunction(VertexColorFunction vcf)
Deprecated. Use setVertexPaintFunction with a VertexPaintFunction if you can

Sets the VertexPaintFunction to the parameter

See Also:
setVertexPaintFunction(VertexPaintFunction), VertexColorFunction, VertexColorToVertexPaintConverter

setVertexPaintFunction

public void setVertexPaintFunction(VertexPaintFunction vpf)

Sets the VertexPaintFunction which specifies the draw (border and text) and fill (interior) Paint for each vertex.

If users want the VertexPaintFunction implementation to highlight selected vertices, they should take this PluggableRenderer instance as a constructor parameter, and call the isPicked method on it to identify selected vertices.

Default: black borders, red foreground (selected vertex is orange).


getVertexShapeFunction

public VertexShapeFunction getVertexShapeFunction()
Returns the VertexShapeFunction currently being used by this instance.

Specified by:
getVertexShapeFunction in interface HasShapeFunctions

setVertexFontFunction

public void setVertexFontFunction(VertexFontFunction vff)
Sets the VertexFontFunction that specifies the font to use for drawing each vertex label. This can be used (for example) to emphasize (or to de-emphasize) vertices that have a specific property.
Default: 12-point Helvetica

See Also:
VertexFontFunction

setVertexIncludePredicate

public void setVertexIncludePredicate(Predicate p)
Sets the Predicate that specifies whether each vertex should be drawn; only those vertices for which this predicate returns true will be drawn. This can be used to selectively display only those vertices that have a specific property, such as a particular decoration or value.
Default: all vertices drawn (TruePredicate instance)

See Also:
Predicate

setVertexLabelCentering

public void setVertexLabelCentering(boolean b)
Specifies whether vertex labels are drawn centered on the vertex position (true) or offset to one side (false).
Default: offset


getVertexLabelCentering

public boolean getVertexLabelCentering()
Returns:
whether the vertex labels should be centered in the vertex

setVertexShapeFunction

public void setVertexShapeFunction(VertexShapeFunction vsf)
Sets the VertexShapeFunction, which specifies the Shape for each vertex. Users that wish to independently change the size and aspect ratio of a vertex's shape should take a look at the SettableVertexShapeFunction interface and the AbstractVertexShapeFunction abstract class.
Default: 8-pixel-diameter circle (EllipseVertexShapeFunction)

See Also:
Shape, VertexShapeFunction

setVertexStringer

public void setVertexStringer(VertexStringer vs)
Sets the VertexStringer that specifies the label to draw for each vertex.
Default: no labels (ConstantVertexStringer)

See Also:
VertexStringer

setVertexStrokeFunction

public void setVertexStrokeFunction(VertexStrokeFunction vsf)
Sets the VertexStrokeFunction which specifies the Stroke to use when drawing each vertex border.
Default: 1-pixel-width basic stroke.

See Also:
Stroke, VertexStrokeFunction

paintEdge

public void paintEdge(Graphics g,
                      Edge e,
                      int x1,
                      int y1,
                      int x2,
                      int y2)
Paints e, whose endpoints are at (x1,y1) and (x2,y2), on the graphics context g. Uses the paint and stroke specified by this instance's EdgeColorFunction and EdgeStrokeFunction, respectively. (If the paint is unspecified, the existing paint for the graphics context is used; the same applies to stroke.) The details of the actual rendering are delegated to drawSelfLoop or drawSimpleEdge, depending on the type of the edge. Note that (x1, y1) is the location of e.getEndpoints.getFirst() and (x2, y2) is the location of e.getEndpoints.getSecond().

Specified by:
paintEdge in interface Renderer
Specified by:
paintEdge in class AbstractRenderer

drawSimpleEdge

protected void drawSimpleEdge(Graphics2D g,
                              Edge e,
                              int x1,
                              int y1,
                              int x2,
                              int y2)
Draws the edge e, whose endpoints are at (x1,y1) and (x2,y2), on the graphics context g. The Shape provided by the EdgeShapeFunction instance is scaled in the x-direction so that its width is equal to the distance between (x1,y1) and (x2,y2).


getArrowTransform

public AffineTransform getArrowTransform(GeneralPath edgeShape,
                                         Shape vertexShape)
Returns a transform to position the arrowhead on this edge shape at the point where it intersects the passed vertex shape.


getReverseArrowTransform

public AffineTransform getReverseArrowTransform(GeneralPath edgeShape,
                                                Shape vertexShape)
Returns a transform to position the arrowhead on this edge shape at the point where it intersects the passed vertex shape.


getReverseArrowTransform

public AffineTransform getReverseArrowTransform(GeneralPath edgeShape,
                                                Shape vertexShape,
                                                boolean passedGo)

Returns a transform to position the arrowhead on this edge shape at the point where it intersects the passed vertex shape.

The Loop edge is a special case because its staring point is not inside the vertex. The passedGo flag handles this case.

Parameters:
edgeShape -
vertexShape -
passedGo - - used only for Loop edges

getArrowTransform

public AffineTransform getArrowTransform(Line2D edgeShape,
                                         Shape vertexShape)
This is used for the arrow of a directed and for one of the arrows for non-directed edges Get a transform to place the arrow shape on the passed edge at the point where it intersects the passed shape

Parameters:
edgeShape -
vertexShape -
Returns:

getReverseArrowTransform

protected AffineTransform getReverseArrowTransform(Line2D edgeShape,
                                                   Shape vertexShape)
This is used for the reverse-arrow of a non-directed edge get a transform to place the arrow shape on the passed edge at the point where it intersects the passed shape

Parameters:
edgeShape -
vertexShape -
Returns:

getLastOutsideSegment

protected Line2D getLastOutsideSegment(Line2D line,
                                       Shape shape)
Passed Line's point2 must be inside the passed shape or an IllegalArgumentException is thrown

Parameters:
line - line to subdivide
shape - shape to compare with line
Returns:
a line that intersects the shape boundary
Throws:
IllegalArgumentException - if the passed line's point1 is not inside the shape

getFirstOutsideSegment

protected Line2D getFirstOutsideSegment(Line2D line,
                                        Shape shape)
Passed Line's point1 must be inside the passed shape or an IllegalArgumentException is thrown

Parameters:
line - line to subdivide
shape - shape to compare with line
Returns:
a line that intersects the shape boundary
Throws:
IllegalArgumentException - if the passed line's point1 is not inside the shape

subdivide

protected void subdivide(Line2D src,
                         Line2D left,
                         Line2D right)
divide a Line2D into 2 new Line2Ds that are returned in the passed left and right instances, if non-null

Parameters:
src - the line to divide
left - the left side, or null
right - the right side, or null

prepareRenderer

public Component prepareRenderer(GraphLabelRenderer graphLabelRenderer,
                                 Object value,
                                 boolean isSelected,
                                 Vertex vertex)

prepareRenderer

public Component prepareRenderer(GraphLabelRenderer renderer,
                                 Object value,
                                 boolean isSelected,
                                 Edge edge)

labelEdge

protected void labelEdge(Graphics2D g2d,
                         Edge e,
                         String label,
                         int x1,
                         int x2,
                         int y1,
                         int y2)
Labels the specified non-self-loop edge with the specified label. Uses the font specified by this instance's EdgeFontFunction. (If the font is unspecified, the existing font for the graphics context is used.) Positions the label between the endpoints according to the coefficient returned by this instance's edge label closeness function.


paintVertex

public void paintVertex(Graphics g,
                        Vertex v,
                        int x,
                        int y)
Paints the vertex v at the location (x,y) on the graphics context g_gen. The vertex is painted using the shape returned by this instance's VertexShapeFunction, and the foreground and background (border) colors provided by this instance's VertexColorFunction. Delegates drawing the label (if any) for this vertex to labelVertex.

Specified by:
paintVertex in interface Renderer
Specified by:
paintVertex in class AbstractRenderer

paintShapeForVertex

public void paintShapeForVertex(Graphics2D g2d,
                                Vertex v,
                                Shape shape)

paintIconForVertex

public void paintIconForVertex(Graphics g,
                               Vertex v,
                               int x,
                               int y)
Paint v's icon on g at (x,y).


labelVertex

protected void labelVertex(Graphics g,
                           Vertex v,
                           String label,
                           int x,
                           int y)
Labels the specified vertex with the specified label. Uses the font specified by this instance's VertexFontFunction. (If the font is unspecified, the existing font for the graphics context is used.) If vertex label centering is active, the label is centered on the position of the vertex; otherwise the label is offset slightly.


isPicked

public boolean isPicked(ArchetypeVertex v)
Deprecated. Use an independent PickedInfo instead of this version, which relies on the Renderer to supply an instance.

Specified by:
isPicked in interface PickedInfo
Overrides:
isPicked in class AbstractRenderer
See Also:
AbstractRenderer#isPicked(Vertex)

isPicked

public boolean isPicked(ArchetypeEdge e)
Deprecated. Use an independent PickedInfo instead of this version, which relies on the Renderer to supply an instance.

Specified by:
isPicked in interface PickedInfo
Overrides:
isPicked in class AbstractRenderer
See Also:
AbstractRenderer#isPicked(Edge)

getRendererPane

public CellRendererPane getRendererPane()
Returns:
Returns the rendererPane.

setRendererPane

public void setRendererPane(CellRendererPane rendererPane)
Parameters:
rendererPane - The rendererPane to set.

getParallelEdgeIndexFunction

public ParallelEdgeIndexFunction getParallelEdgeIndexFunction()

setParallelEdgeIndexFunction

public void setParallelEdgeIndexFunction(ParallelEdgeIndexFunction parallelEdgeIndexFunction)

setViewTransformer

public void setViewTransformer(MutableTransformer viewTransformer)