kaapo.project.graphics
Class LineHead

java.lang.Object
  extended by kaapo.project.graphics.LineHead
Direct Known Subclasses:
FilledArrowHead, LineArrowHead

public abstract class LineHead
extends Object

Abstract base class for line heads. For line head geometry, see the image nuoli-geometria.png which should be included with the project.

Author:
hkovaska

Field Summary
protected  double preferredHeadLength
           
 
Constructor Summary
LineHead(double preferredHeadLength)
          Constructs the head with given preferred length.
 
Method Summary
 double getPreferredLength()
          Returns the preferred length of the head.
 GeneralPath makeHead(double startX, double startY, double endX, double endY)
          Generates a line head that goes from the start point to the end point.
 GeneralPath makeHead(Point2D startPoint, Point2D endPoint)
          Generates a line head to coordinates from two poins.
protected abstract  GeneralPath makeHeadImpl(double startX, double startY, double endX, double endY)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preferredHeadLength

protected double preferredHeadLength
Constructor Detail

LineHead

public LineHead(double preferredHeadLength)
Constructs the head with given preferred length.

Parameters:
preferredHeadLength - Preferred length of the head in pixels. The head can be drawn to a length different from preferred length, but normally preferred length should be obeyed.
Method Detail

getPreferredLength

public double getPreferredLength()
Returns the preferred length of the head. The head should be drawn to preferred length, but it can be drawn to any length.


makeHeadImpl

protected abstract GeneralPath makeHeadImpl(double startX,
                                            double startY,
                                            double endX,
                                            double endY)

makeHead

public GeneralPath makeHead(double startX,
                            double startY,
                            double endX,
                            double endY)
Generates a line head that goes from the start point to the end point. Notice that the requested head may have a length different from preferred length.

Parameters:
startX - X coordinate of the start point
startY - Y coordinate of the start point
endX - X coordinate of the end point
endY - Y coordinate of the end point
Returns:
shape of the head

makeHead

public GeneralPath makeHead(Point2D startPoint,
                            Point2D endPoint)
Generates a line head to coordinates from two poins.

Parameters:
startPoint - startpoint
endPoint - endpoint
Returns:
shape of the head