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

public abstract class DirectionSymbol extends PointFeatureSymbol
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

    Constructors
    Constructor
    Description
    Creates a new direction symbol.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    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
    draw(Graphics gc, int x, int y)
     
    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
    main(String[] argv)
    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

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DirectionSymbol

      public DirectionSymbol(EarthTransform2D trans)
      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

      public abstract void drawVector(Graphics gc, int x, int y, double magnitude, double direction)
      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

      public double 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. 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

      public void draw(Graphics gc, int x, int y)
      Specified by:
      draw in class jahuwaldt.plot.PlotSymbol
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception