edu.uci.ics.jung.visualization.renderers
Class ReshapingEdgeRenderer<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.visualization.renderers.BasicEdgeRenderer<V,E>
      extended by edu.uci.ics.jung.visualization.renderers.ReshapingEdgeRenderer<V,E>
Type Parameters:
V -
E -
All Implemented Interfaces:
Renderer.Edge<V,E>

public class ReshapingEdgeRenderer<V,E>
extends BasicEdgeRenderer<V,E>
implements Renderer.Edge<V,E>

uses a flatness argument to break edges into smaller segments. This produces a more detailed transformation of the edge shape

Author:
Tom Nelson - tomnelson@dev.java.net

Nested Class Summary
 
Nested classes/interfaces inherited from interface edu.uci.ics.jung.visualization.renderers.Renderer.Edge
Renderer.Edge.NOOP
 
Constructor Summary
ReshapingEdgeRenderer()
           
 
Method Summary
protected  void drawSimpleEdge(RenderContext<V,E> rc, Layout<V,E> layout, E e)
          Draws the edge e, whose endpoints are at (x1,y1) and (x2,y2), on the graphics context g.
 AffineTransform getArrowTransform(RenderContext<V,E> rc, 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(RenderContext<V,E> rc, 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
protected  Line2D getFirstOutsideSegment(Line2D line, Shape shape)
          Passed Line's point1 must be inside the passed shape or an IllegalArgumentException is thrown
protected  Line2D getLastOutsideSegment(Line2D line, Shape shape)
          Passed Line's point2 must be inside the passed shape or an IllegalArgumentException is thrown
 AffineTransform getReverseArrowTransform(RenderContext<V,E> rc, 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(RenderContext<V,E> rc, 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(RenderContext<V,E> rc, 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
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.renderers.BasicEdgeRenderer
paintEdge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.uci.ics.jung.visualization.renderers.Renderer.Edge
paintEdge
 

Constructor Detail

ReshapingEdgeRenderer

public ReshapingEdgeRenderer()
Method Detail

drawSimpleEdge

protected void drawSimpleEdge(RenderContext<V,E> rc,
                              Layout<V,E> layout,
                              E e)
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).

Overrides:
drawSimpleEdge in class BasicEdgeRenderer<V,E>

getArrowTransform

public AffineTransform getArrowTransform(RenderContext<V,E> rc,
                                         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.

Overrides:
getArrowTransform in class BasicEdgeRenderer<V,E>

getReverseArrowTransform

public AffineTransform getReverseArrowTransform(RenderContext<V,E> rc,
                                                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.

Overrides:
getReverseArrowTransform in class BasicEdgeRenderer<V,E>

getReverseArrowTransform

public AffineTransform getReverseArrowTransform(RenderContext<V,E> rc,
                                                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.

Overrides:
getReverseArrowTransform in class BasicEdgeRenderer<V,E>
Parameters:
edgeShape -
vertexShape -
passedGo - - used only for Loop edges

getArrowTransform

public AffineTransform getArrowTransform(RenderContext<V,E> rc,
                                         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

Overrides:
getArrowTransform in class BasicEdgeRenderer<V,E>
Parameters:
edgeShape -
vertexShape -
Returns:

getReverseArrowTransform

protected AffineTransform getReverseArrowTransform(RenderContext<V,E> rc,
                                                   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

Overrides:
getReverseArrowTransform in class BasicEdgeRenderer<V,E>
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

Overrides:
getLastOutsideSegment in class BasicEdgeRenderer<V,E>
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

Overrides:
getFirstOutsideSegment in class BasicEdgeRenderer<V,E>
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

Overrides:
subdivide in class BasicEdgeRenderer<V,E>
Parameters:
src - the line to divide
left - the left side, or null
right - the right side, or null


Copyright © 2009. All Rights Reserved.