org.graffiti.plugins.views.defaults
Class LineEdgeShape

java.lang.Object
  extended by org.graffiti.plugins.views.defaults.LineEdgeShape
All Implemented Interfaces:
Shape, EdgeShape, GraffitiShape, GraphElementShape
Direct Known Subclasses:
PolyLineEdgeShape, StraightLineEdgeShape

public abstract class LineEdgeShape
extends Object
implements EdgeShape

Class representing an edge as one straight line.

Version:
$Revision: 5766 $

Field Summary
 
Fields inherited from interface org.graffiti.plugin.view.EdgeShape
CLICK_TOLERANCE
 
Constructor Summary
LineEdgeShape()
          The constructor creates a line using default values.
 
Method Summary
abstract  void buildShape(EdgeGraphicAttribute graphics, NodeShape source, NodeShape target)
          Called when one of the nodes belonging to this edge has changed.
abstract  boolean contains(double x, double y)
          Decides whether or not a point lies within this shape.
 boolean contains(double x, double y, double w, double h)
          Checks whether or not a rectangle lies entirely within this shape.
 boolean contains(Point2D p)
          DOCUMENT ME!
 boolean contains(Rectangle2D r)
          DOCUMENT ME!
 Rectangle getBounds()
          DOCUMENT ME!
 Rectangle2D getBounds2D()
          DOCUMENT ME!
 Shape getHeadArrow()
          Returns the arrow at the target side.
 GeneralPath getLinePath()
           
 PathIterator getPathIterator(AffineTransform t)
          DOCUMENT ME!
 PathIterator getPathIterator(AffineTransform t, double d)
          DOCUMENT ME!
 Rectangle2D getRealBounds2D()
          Returns the correct bounding box with coordinates relative to the view.
 Shape getTailArrow()
          Returns the arrow at the source side.
 boolean intersects(double x, double y, double w, double h)
          DOCUMENT ME!
 boolean intersects(Rectangle2D r)
          DOCUMENT ME!
 boolean lineContains(Line2D line, double x, double y)
          Checks whether or not a point is said to be locateds on a line.
 void setTrimArrows(boolean trimArrows)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineEdgeShape

public LineEdgeShape()
The constructor creates a line using default values. The shapes of the source and target nodes are given to enable the edge to paint itself correctly between those nodes. The line is painted between the centers of the source and target shape. No arrows are painted.

Method Detail

getBounds

public Rectangle getBounds()
DOCUMENT ME!

Specified by:
getBounds in interface Shape
Returns:
DOCUMENT ME!

getBounds2D

public Rectangle2D getBounds2D()
DOCUMENT ME!

Specified by:
getBounds2D in interface Shape
Returns:
DOCUMENT ME!

getHeadArrow

public Shape getHeadArrow()
Returns the arrow at the target side.

Specified by:
getHeadArrow in interface EdgeShape
Returns:
the arrow at the target side.

getPathIterator

public PathIterator getPathIterator(AffineTransform t,
                                    double d)
DOCUMENT ME!

Specified by:
getPathIterator in interface Shape
Parameters:
t - DOCUMENT ME!
d - DOCUMENT ME!
Returns:
DOCUMENT ME!

getPathIterator

public PathIterator getPathIterator(AffineTransform t)
DOCUMENT ME!

Specified by:
getPathIterator in interface Shape
Parameters:
t - DOCUMENT ME!
Returns:
DOCUMENT ME!

getRealBounds2D

public Rectangle2D getRealBounds2D()
Returns the correct bounding box with coordinates relative to the view.

Specified by:
getRealBounds2D in interface GraphElementShape
Returns:
the correct bounding box with coordinates relative to the view.

buildShape

public abstract void buildShape(EdgeGraphicAttribute graphics,
                                NodeShape source,
                                NodeShape target)
                         throws ShapeNotFoundException
Called when one of the nodes belonging to this edge has changed.

Specified by:
buildShape in interface EdgeShape
Parameters:
graphics - the attribute that has changed
source - the NodeShape of the source node
target - the NodeShape of the target node
Throws:
ShapeNotFoundException

getTailArrow

public Shape getTailArrow()
Returns the arrow at the source side.

Specified by:
getTailArrow in interface EdgeShape
Returns:
the arrow at the source side.

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Checks whether or not a rectangle lies entirely within this shape.

Specified by:
contains in interface Shape
Parameters:
x - the x-coordinate of the point to check.
y - the y-coordinate of the point to check.
w - width
h - height
Returns:
true if the point lies within this shape.
Throws:
RuntimeException - DOCUMENT ME!

contains

public abstract boolean contains(double x,
                                 double y)
Decides whether or not a point lies within this shape.

Specified by:
contains in interface Shape
Parameters:
x - the x-coordinate of the point to check.
y - the y-coordinate of the point to check.
Returns:
true if the point lies within this shape.

contains

public boolean contains(Point2D p)
DOCUMENT ME!

Specified by:
contains in interface Shape
Parameters:
p - DOCUMENT ME!
Returns:
DOCUMENT ME!

contains

public boolean contains(Rectangle2D r)
DOCUMENT ME!

Specified by:
contains in interface Shape
Parameters:
r - DOCUMENT ME!
Returns:
DOCUMENT ME!

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
DOCUMENT ME!

Specified by:
intersects in interface Shape
Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
w - DOCUMENT ME!
h - DOCUMENT ME!
Returns:
DOCUMENT ME!

intersects

public boolean intersects(Rectangle2D r)
DOCUMENT ME!

Specified by:
intersects in interface Shape
Parameters:
r - DOCUMENT ME!
Returns:
DOCUMENT ME!

lineContains

public boolean lineContains(Line2D line,
                            double x,
                            double y)
Checks whether or not a point is said to be locateds on a line. It uses the field LINE_TOLERANCE as a certain tolerance, i.e. it really checks whether or not the point lies inside a rectangle around the line.

Parameters:
line -
x -
y -
Returns:
DOCUMENT ME!

setTrimArrows

public void setTrimArrows(boolean trimArrows)

getLinePath

public GeneralPath getLinePath()


Generated at 2012-05-30 11:01:25 PM CEST