Back to index

moin  1.9.0~rc2
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
CH.ifa.draw.figures.ArrowTip Class Reference

An arrow tip line decoration. More...

Inheritance diagram for CH.ifa.draw.figures.ArrowTip:
Inheritance graph
[legend]
Collaboration diagram for CH.ifa.draw.figures.ArrowTip:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ArrowTip ()
 ArrowTip (double angle, double outerRadius, double innerRadius)
 Constructs an arrow tip with the given angle and radius.
void draw (Graphics g, int x1, int y1, int x2, int y2)
 Draws the arrow tip in the direction specified by the given two points.
Polygon outline (int x1, int y1, int x2, int y2)
 Calculates the outline of an arrow tip.
void write (StorableOutput dw)
 Stores the arrow tip to a StorableOutput.
String getMap ()
 Writes a map image of the object.
void read (StorableInput dr) throws IOException
 Reads the arrow tip from a StorableInput.
void write (StorableOutput dw)
 Writes the object to the StorableOutput.
void read (StorableInput dr) throws IOException
 Reads the object from the StorableInput.

Private Member Functions

Polygon outline (int x, int y, double direction)
void addPointRelative (Polygon shape, int x, int y, double radius, double angle)

Private Attributes

double fAngle
double fOuterRadius
double fInnerRadius
int arrowTipSerializedDataVersion = 1

Static Private Attributes

static final long serialVersionUID = -3459171428373823638L

Detailed Description

An arrow tip line decoration.

See also:
PolyLineFigure

Definition at line 19 of file ArrowTip.java.


Constructor & Destructor Documentation

Definition at line 31 of file ArrowTip.java.

                         {
           fAngle = 0.40;//0.35;
           fOuterRadius = 8;//15;
           fInnerRadius = 8;//12;
       }
CH.ifa.draw.figures.ArrowTip.ArrowTip ( double  angle,
double  outerRadius,
double  innerRadius 
) [inline]

Constructs an arrow tip with the given angle and radius.

Definition at line 40 of file ArrowTip.java.

                                                                             {
           fAngle = angle;
           fOuterRadius = outerRadius;
           fInnerRadius = innerRadius;
       }

Member Function Documentation

void CH.ifa.draw.figures.ArrowTip.addPointRelative ( Polygon  shape,
int  x,
int  y,
double  radius,
double  angle 
) [inline, private]

Definition at line 75 of file ArrowTip.java.

                                                                                            {
        shape.addPoint(
            x + (int) (radius * Math.cos(angle)),
            y - (int) (radius * Math.sin(angle)));
    }

Here is the caller graph for this function:

void CH.ifa.draw.figures.ArrowTip.draw ( Graphics  g,
int  x1,
int  y1,
int  x2,
int  y2 
) [inline, virtual]

Draws the arrow tip in the direction specified by the given two points.

Implements CH.ifa.draw.figures.LineDecoration.

Definition at line 50 of file ArrowTip.java.

                                                                 {
        // TBD: reuse the Polygon object
        Polygon p = outline(x1, y1, x2, y2);
        g.fillPolygon(p.xpoints, p.ypoints, p.npoints);
    }

Here is the call graph for this function:

Writes a map image of the object.

Implements CH.ifa.draw.util.Storable.

Definition at line 87 of file ArrowTip.java.

                           {
       return "";
    }
Polygon CH.ifa.draw.figures.ArrowTip.outline ( int  x1,
int  y1,
int  x2,
int  y2 
) [inline]

Calculates the outline of an arrow tip.

Definition at line 59 of file ArrowTip.java.

                                                           {
        double dir = Math.PI/2 - Math.atan2(x2-x1, y1-y2);
        return outline(x1, y1, dir);
    }

Here is the caller graph for this function:

Polygon CH.ifa.draw.figures.ArrowTip.outline ( int  x,
int  y,
double  direction 
) [inline, private]

Definition at line 64 of file ArrowTip.java.

                                                            {
        Polygon shape = new Polygon();

        shape.addPoint(x, y);
        addPointRelative(shape, x, y, fOuterRadius, direction - fAngle);
        addPointRelative(shape, x, y, fInnerRadius, direction);
        addPointRelative(shape, x, y, fOuterRadius, direction + fAngle);
        shape.addPoint(x,y); // Closing the polygon (TEG 97-04-23)
        return shape;
    }

Here is the call graph for this function:

void CH.ifa.draw.util.Storable.read ( StorableInput  dr) throws IOException [inherited]

Reads the object from the StorableInput.

Here is the caller graph for this function:

void CH.ifa.draw.figures.ArrowTip.read ( StorableInput  dr) throws IOException [inline]

Reads the arrow tip from a StorableInput.

Definition at line 94 of file ArrowTip.java.

                                                          {
    }

Here is the caller graph for this function:

Writes the object to the StorableOutput.

Here is the caller graph for this function:

void CH.ifa.draw.figures.ArrowTip.write ( StorableOutput  dw) [inline]

Stores the arrow tip to a StorableOutput.

Definition at line 84 of file ArrowTip.java.

                                         {
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 29 of file ArrowTip.java.

Definition at line 21 of file ArrowTip.java.

Definition at line 23 of file ArrowTip.java.

Definition at line 22 of file ArrowTip.java.

final long CH.ifa.draw.figures.ArrowTip.serialVersionUID = -3459171428373823638L [static, private]

Definition at line 28 of file ArrowTip.java.


The documentation for this class was generated from the following file: