com.bbn.openmap.omGraphics
Class OMArrowHead

java.lang.Object
  extended by com.bbn.openmap.omGraphics.OMArrowHead
All Implemented Interfaces:
java.io.Serializable

public class OMArrowHead
extends java.lang.Object
implements java.io.Serializable

Basic implementation of arrowhead graphics. This class expects intimate knowledge of an OMLine, and is used to add Arrowhead shapes to the actual OMLine internal Shape object. You don't have to know about this class, just call the OMLine methods that create arrowheads and the OMLine will take care of the rest.

See Also:
Serialized Form

Field Summary
protected  int arrowDirectionType
           
static int ARROWHEAD_DIRECTION_BACKWARD
           
static int ARROWHEAD_DIRECTION_BOTH
           
static int ARROWHEAD_DIRECTION_FORWARD
           
protected static int DEFAULT_WINGLENGTH
           
protected static int DEFAULT_WINGTIP
           
protected  int location
           
protected  java.awt.Shape shape
           
protected  int wingLength
           
protected  int wingTip
           
 
Constructor Summary
OMArrowHead(int arrowDirectionType, int location)
           
OMArrowHead(int arrowDirectionType, int location, int wingtip, int winglength)
           
 
Method Summary
static void addArrowHeads(int arrowDirectionType, int location, OMAbstractLine line)
           
protected static java.awt.geom.GeneralPath createArrowHead(java.awt.geom.Point2D from, java.awt.geom.Point2D to, int wingTip, int wingLength)
           
static java.awt.geom.GeneralPath createArrowHeads(int arrowDirectionType, int location, OMAbstractLine line)
          Create an arrowhead for the provided line
static java.awt.geom.GeneralPath createArrowHeads(int arrowDirectionType, int location, OMAbstractLine line, int wingTip, int wingLength)
          Create an arrowhead for the provided line
 void generate(OMAbstractLine omal)
           
 int getArrowDirectionType()
           
 int getLocation()
           
 java.awt.Shape getShape()
           
 int getWingLength()
           
 int getWingTip()
           
protected static java.awt.geom.Point2D[] locateArrowHeads(int arrowDirection, int arrowLocation, OMAbstractLine line)
          Create the ArrowHead objects for the lines, based on the settings.
 void render(java.awt.Graphics g)
           
 void setArrowDirectionType(int arrowDirectionType)
           
 void setLocation(int location)
           
 void setShape(java.awt.Shape shape)
           
 void setWingLength(int wingLength)
           
 void setWingTip(int wingTip)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARROWHEAD_DIRECTION_FORWARD

public static final int ARROWHEAD_DIRECTION_FORWARD
See Also:
Constant Field Values

ARROWHEAD_DIRECTION_BACKWARD

public static final int ARROWHEAD_DIRECTION_BACKWARD
See Also:
Constant Field Values

ARROWHEAD_DIRECTION_BOTH

public static final int ARROWHEAD_DIRECTION_BOTH
See Also:
Constant Field Values

DEFAULT_WINGTIP

protected static int DEFAULT_WINGTIP

DEFAULT_WINGLENGTH

protected static int DEFAULT_WINGLENGTH

shape

protected transient java.awt.Shape shape

arrowDirectionType

protected int arrowDirectionType

location

protected int location

wingTip

protected int wingTip

wingLength

protected int wingLength
Constructor Detail

OMArrowHead

public OMArrowHead(int arrowDirectionType,
                   int location)

OMArrowHead

public OMArrowHead(int arrowDirectionType,
                   int location,
                   int wingtip,
                   int winglength)
Method Detail

generate

public void generate(OMAbstractLine omal)

render

public void render(java.awt.Graphics g)

createArrowHeads

public static java.awt.geom.GeneralPath createArrowHeads(int arrowDirectionType,
                                                         int location,
                                                         OMAbstractLine line)
Create an arrowhead for the provided line

Parameters:
arrowDirectionType - ARROWHEAD_DIRECTION_FORWARD for the arrowhead pointing to the last coordinate of the OMLine, ARROWHEAD_DIRECTION_BACKWARD for the arrowhead pointing to the first coordinate in the OMLine, and ARROWHEAD_DIRECTION_BOTH for the arrowhead on both ends.
location - A number between 0-100, reflecting the percentage of the line traversed before placing the arrowhead. For ARROWHEAD_DIRECTION_FORWARD and a location of 100, the arrowhead will be placed all the way at the end of the line. For a location of 50, the arrowhead will be placed in the middle of the line.
line - OMLine to use to place arrowhead.
Returns:
the GeneralPath for the arrowhead.

createArrowHeads

public static java.awt.geom.GeneralPath createArrowHeads(int arrowDirectionType,
                                                         int location,
                                                         OMAbstractLine line,
                                                         int wingTip,
                                                         int wingLength)
Create an arrowhead for the provided line

Parameters:
arrowDirectionType - ARROWHEAD_DIRECTION_FORWARD for the arrowhead pointing to the last coordinate of the OMLine, ARROWHEAD_DIRECTION_BACKWARD for the arrowhead pointing to the first coordinate in the OMLine, and ARROWHEAD_DIRECTION_BOTH for the arrowhead on both ends.
location - A number between 0-100, reflecting the percentage of the line traversed before placing the arrowhead. For ARROWHEAD_DIRECTION_FORWARD and a location of 100, the arrowhead will be placed all the way at the end of the line. For a location of 50, the arrowhead will be placed in the middle of the line.
line - OMLine to use to place arrowhead.
wingTip - Number of pixels to push the side of the arrowhead away from the line.
wingLength - Number of pixels reflecting the arrowhead length.
Returns:
the GeneralPath for the arrowhead.

addArrowHeads

public static void addArrowHeads(int arrowDirectionType,
                                 int location,
                                 OMAbstractLine line)

createArrowHead

protected static java.awt.geom.GeneralPath createArrowHead(java.awt.geom.Point2D from,
                                                           java.awt.geom.Point2D to,
                                                           int wingTip,
                                                           int wingLength)

locateArrowHeads

protected static java.awt.geom.Point2D[] locateArrowHeads(int arrowDirection,
                                                          int arrowLocation,
                                                          OMAbstractLine line)
Create the ArrowHead objects for the lines, based on the settings. This function is called while OMLine is being generated. User's don't need to call this function. In fact, it assumes that generate() has been called (or is being called) on the OMLine. It adds the ArrowHeads to the GeneralPath Shape object.


getArrowDirectionType

public int getArrowDirectionType()

setArrowDirectionType

public void setArrowDirectionType(int arrowDirectionType)

getLocation

public int getLocation()

setLocation

public void setLocation(int location)

getShape

public java.awt.Shape getShape()

setShape

public void setShape(java.awt.Shape shape)

getWingLength

public int getWingLength()

setWingLength

public void setWingLength(int wingLength)

getWingTip

public int getWingTip()

setWingTip

public void setWingTip(int wingTip)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details