Package noaa.coastwatch.render
Class DirectionSymbol
java.lang.Object
jahuwaldt.plot.PlotSymbol
noaa.coastwatch.render.PointFeatureSymbol
noaa.coastwatch.render.DirectionSymbol
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
ArrowSymbol
,WindBarbSymbol
A
DirectionSymbol
is a PointFeatureSymbol
that renders a directional vector.- Since:
- 3.2.0
- Author:
- Peter Hollemans
- See Also:
-
Field Summary
Fields inherited from class noaa.coastwatch.render.PointFeatureSymbol
feature
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
convertAngle
(double inAngle, EarthLocation earthLoc) Converts a direction angle that is clockwise relative to north to a direction angle that is counterclockwise relative to the x axis of the earth transform.void
abstract void
drawVector
(Graphics gc, int x, int y, double magnitude, double direction) Draws a direction symbol with the specified properties.abstract double
Gets the direction angle of the vector feature.boolean
Gets the direction-is-from flag.abstract double
Gets the magnitude of the vector feature.static void
Tests this class.void
setDirectionIsFrom
(boolean flag) Sets the direction-is-from flag.Methods inherited from class noaa.coastwatch.render.PointFeatureSymbol
setFeature
Methods inherited from class jahuwaldt.plot.PlotSymbol
clone, getBorderColor, getFillColor, getSize, setBorderColor, setFillColor, setSize
-
Constructor Details
-
DirectionSymbol
Creates a new direction symbol.- Parameters:
trans
- the earth transform used for converting directions.
-
-
Method Details
-
setDirectionIsFrom
public void setDirectionIsFrom(boolean flag) Sets the direction-is-from flag. If true, the direction angle is taken to be the angle from which the vector comes, not the angle to which it points. By default, the flag is false.- Parameters:
flag
- the new direction-is-from flag value.
-
getDirectionIsFrom
public boolean getDirectionIsFrom()Gets the direction-is-from flag.- See Also:
-
drawVector
Draws a direction symbol with the specified properties.- Parameters:
gc
- the graphics context for drawing.x
- the x position of the base.y
- the y position of the base.magnitude
- the magnitude of the vector.direction
- the direction angle of the vector in radians, clockwise with respect to the graphics x-axis.
-
getMagnitude
public abstract double getMagnitude()Gets the magnitude of the vector feature. -
getDirection
public abstract double getDirection()Gets the direction angle of the vector feature.- Returns:
- the direction angle of the vector in radians, clockwise with respect to the graphics x-axis.
-
convertAngle
Converts a direction angle that is clockwise relative to north to a direction angle that is counterclockwise relative to the x axis of the earth transform. For example, suppose that the passed direction is 45 deg WRT north, meaning directly northeast. But suppose that in the earth transform, north is in the positive x direction and east is in the negative y direction (positive x is right and positive y is up). Then the 45 deg WRT north direction angle is converted to -45 deg WRT the earth transform.- Parameters:
inAngle
- the input direction angle in radians.earthLoc
- the earth location at which the direction applies.- Returns:
- the converted angle, or
Double.NaN
if the angle could not be converted.
-
draw
- Specified by:
draw
in classjahuwaldt.plot.PlotSymbol
-
main
Tests this class.- Parameters:
argv
- the array of command line parameters.- Throws:
Exception
-