net.surveyos.sourceforge.jtswarped.angles
Class BasicSurveyorsDirection

java.lang.Object
  extended by net.surveyos.sourceforge.jtswarped.angles.BasicSurveyorsDirection
All Implemented Interfaces:
SurveyorsDirection

public class BasicSurveyorsDirection
extends java.lang.Object
implements SurveyorsDirection

Provides a basic implementation of the SurveyorsDirection interface. This implementation of that interface adds two (2) constructors and two (2) utility methods.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.surveyos.sourceforge.jtswarped.angles.SurveyorsDirection
SurveyorsDirection.Quadrant
 
Constructor Summary
BasicSurveyorsDirection()
          Creates a direction with a value of 0, or pointing due north.
BasicSurveyorsDirection(BasicSurveyorsAngle argValue)
          Creates a direction with the angle value provided.
BasicSurveyorsDirection(com.vividsolutions.jts.geom.Coordinate argFirst, com.vividsolutions.jts.geom.Coordinate argSecond)
          Creates a direction representing the direction of the straight line between the two (2) coordinates provided.
BasicSurveyorsDirection(java.lang.String argValue)
          Creates a BasicSurveyorsDirection from the provided String.
BasicSurveyorsDirection(SurveyorsAngle argValue)
          Creates a direction with the angle value provided.
 
Method Summary
 void flop180Degrees()
          Flops this direction 180 degrees.
 com.vividsolutions.jts.geom.Coordinate getCoordinateAtEndOfVector(com.vividsolutions.jts.geom.Coordinate argStartPoint, double argDistance)
          Returns a Coordinate at the end of the vector created when this direction is combined with the distance specified in the double argument.
 com.vividsolutions.jts.geom.LineString getLineStringAlongDirection(com.vividsolutions.jts.geom.Coordinate argStartPoint, double argDistance)
          Returns a LineString along this direction.
 SurveyorsDirection.Quadrant getQuadrant()
          Returns the quadrant in which this direction lies.
 SurveyorsAngle getValue()
          Returns the value of this direction as a SurveyorsAngle.
 java.lang.String getValueAsBearingString(int argNumberOfDigitsRightOfDecimal)
          Creates a String representing this direction as a bearing in degrees-minutes-seconds format.Leading zeros are added to the minutes and seconds values if they are less than 10.
 java.lang.String getValueAsString(int argNumberOfDigitsRight)
           
 void rotate(BasicSurveyorsAngle argAngle, boolean argIncrease)
          Rotates this direction by the amount specified in the first angle.
 void rotateBackward90Degrees()
          Rotates this bearing backward (counterclockwise) 90 degrees.
 void rotateForward90Degrees()
          Rotates this bearing forward (clockwise) 90 degrees.
 java.lang.String toString()
          Returns this direction as a String.
 java.lang.String toString(int argNumberOfDigitsRight)
          Returns this direction as a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicSurveyorsDirection

public BasicSurveyorsDirection(SurveyorsAngle argValue)
Creates a direction with the angle value provided.


BasicSurveyorsDirection

public BasicSurveyorsDirection(BasicSurveyorsAngle argValue)
Creates a direction with the angle value provided.


BasicSurveyorsDirection

public BasicSurveyorsDirection()
Creates a direction with a value of 0, or pointing due north.


BasicSurveyorsDirection

public BasicSurveyorsDirection(com.vividsolutions.jts.geom.Coordinate argFirst,
                               com.vividsolutions.jts.geom.Coordinate argSecond)
Creates a direction representing the direction of the straight line between the two (2) coordinates provided.


BasicSurveyorsDirection

public BasicSurveyorsDirection(java.lang.String argValue)
Creates a BasicSurveyorsDirection from the provided String. The String must be in the format 119-02-42.3, where 119 is the degrees of the direction in azimuth format, 02 is the minutes, and 42.3 is the seconds. Leading zeros should be provided for degree, minute, or second values that are less than 10. A string in this format can be obtained from the getValueAsString method defined in this class.

Method Detail

flop180Degrees

public void flop180Degrees()
Description copied from interface: SurveyorsDirection
Flops this direction 180 degrees.

Specified by:
flop180Degrees in interface SurveyorsDirection

getQuadrant

public SurveyorsDirection.Quadrant getQuadrant()
Description copied from interface: SurveyorsDirection
Returns the quadrant in which this direction lies.

Specified by:
getQuadrant in interface SurveyorsDirection

getValue

public SurveyorsAngle getValue()
Description copied from interface: SurveyorsDirection
Returns the value of this direction as a SurveyorsAngle. This value represents the revolution turned from the zero direction (typically 'north") to this direction. In JTS Warped the zero direction is always due north or along the Y (or northing) axis of the cartesian (2D grid) coordinate system.

Specified by:
getValue in interface SurveyorsDirection

rotateBackward90Degrees

public void rotateBackward90Degrees()
Description copied from interface: SurveyorsDirection
Rotates this bearing backward (counterclockwise) 90 degrees. This is useful for creating perpendicular directions.

Specified by:
rotateBackward90Degrees in interface SurveyorsDirection

rotateForward90Degrees

public void rotateForward90Degrees()
Description copied from interface: SurveyorsDirection
Rotates this bearing forward (clockwise) 90 degrees. This is useful for creating perpendicular directions.

Specified by:
rotateForward90Degrees in interface SurveyorsDirection

rotate

public void rotate(BasicSurveyorsAngle argAngle,
                   boolean argIncrease)
Description copied from interface: SurveyorsDirection
Rotates this direction by the amount specified in the first angle. If the boolean argument is true, the bearing is rotated in a clockwise direction. If the boolean argument is false, the bearing is rotated in a counter clockwise direction.

Specified by:
rotate in interface SurveyorsDirection

getLineStringAlongDirection

public com.vividsolutions.jts.geom.LineString getLineStringAlongDirection(com.vividsolutions.jts.geom.Coordinate argStartPoint,
                                                                          double argDistance)
Returns a LineString along this direction. The LineString starts at the coordinate provided and extends along this direction the distance specified by the double argument.


getCoordinateAtEndOfVector

public com.vividsolutions.jts.geom.Coordinate getCoordinateAtEndOfVector(com.vividsolutions.jts.geom.Coordinate argStartPoint,
                                                                         double argDistance)
Returns a Coordinate at the end of the vector created when this direction is combined with the distance specified in the double argument.


toString

public java.lang.String toString(int argNumberOfDigitsRight)
Returns this direction as a String. The string displays the value as an azimuth. (If you want a bearing instead, use the getValueAsBearingString method defined in this class.) This method will add leading zeros to bearing, minute, or second values less than 10. Example Output: SurveyorsDirection as Azimuth: 119-02-42.354


toString

public java.lang.String toString()
Returns this direction as a String. The string displays the value as an azimuth. (If you want a bearing instead, use the getValueAsBearingString method defined in this class.) This method will add leading zeros to bearing, minute, or second values less than 10. It always trims the number of places displayed beyond the decimal point in the seconds value to 1 place. Example Output: SurveyorsDirection as Azimuth: 119-02-42.3

Overrides:
toString in class java.lang.Object

getValueAsBearingString

public java.lang.String getValueAsBearingString(int argNumberOfDigitsRightOfDecimal)
Creates a String representing this direction as a bearing in degrees-minutes-seconds format.Leading zeros are added to the minutes and seconds values if they are less than 10. The int argument to the method specifies how many places should be shown beyond the decimal in the seconds value. For example: The revolution value of 0.25 would be returned as "North 45-00-00.0 East".


getValueAsString

public java.lang.String getValueAsString(int argNumberOfDigitsRight)