net.surveyos.sourceforge.jtswarped.angles
Class BasicSurveyorsAngle

java.lang.Object
  extended by net.surveyos.sourceforge.jtswarped.angles.BasicSurveyorsAngle
All Implemented Interfaces:
SurveyorsAngle

public class BasicSurveyorsAngle
extends java.lang.Object
implements SurveyorsAngle

Provides a basic implementation of the SurveyorsAngle interface. This class adds three (3) constructors that can be used to create angle objects, and also adds methods to test for equality and for comparison.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.surveyos.sourceforge.jtswarped.angles.SurveyorsAngle
SurveyorsAngle.AngleUnit, SurveyorsAngle.ValuePartType
 
Constructor Summary
BasicSurveyorsAngle()
          Creates a BasicSurveyorsAngle object with an agle equal to zero.
BasicSurveyorsAngle(DegreesMinutesSecondsValue argDmsv)
          Creates a BasicSurveyorsAnlge from a DegreesMinutesSecondsValue object.
BasicSurveyorsAngle(int argDegrees, int argMinutes, int argSeconds, double argFractionalSeconds)
          Creates a BasicSurveyorsAngle using the values provided.
BasicSurveyorsAngle(SurveyorsAngle argTarget)
          This is a copy constructor that creates a new BasicSurveyorsAngle using the values for degrees, minutes, seconds, and fractional seconds provided in the SurveyorsAngle provided as an argument.
 
Method Summary
 double convertToDecimalDegrees()
           
 double convertToRadians()
           
 BasicSurveyorsAngle decrease(SurveyorsAngle argAmount)
          Returns a new SurveyorsAngle whose angle value is calculated by decreasing the angle value of this angle by the angle passed as an argument.
 double getCosin()
          Returns the Cosin (or Cosine) of this angle.
 int getDegrees()
          Returns the whole degrees of this angle as an int.
 double getFractionalSeconds()
          Returns the fractional seconds of this angle as an double with a value equal to or greater than zero but less than 1.0.
 int getMinutes()
          Returns the whole minutes of this angle as an int.
 int getSeconds()
          Returns the whole seconds of this angle as an int.
 double getSin()
          Returns the sin (or sine) of this angle.
 double getTangent()
          Returns the tangent of this angle.
 BasicSurveyorsAngle increase(SurveyorsAngle argAmount)
          Returns a new SurveyorsAngle whose angle value is calculated by increasing the angle value of this angle by the angle passed as an argument.
 boolean isAcute()
          Indicates if this angle is acute.
 boolean isGreaterThan(SurveyorsAngle argTarget)
          Indicates if this angle is greater than the angle supplied as an argument.
 boolean isLessThan(SurveyorsAngle argTarget)
          Indicates if this angle is less than the angle supplied as an argument.
 boolean isObtuse()
          Indicates if this angle is obtuse.
 boolean isRightAngle()
          Indicates if this angle is a right angle.
 void rotateGeometry(com.vividsolutions.jts.geom.Geometry argTarget, com.vividsolutions.jts.geom.Coordinate argBasePoint, boolean argIncrease)
          Rotates the Geometry argument using the Coordinate provided as the base point for the rotation.
 int testEquality(SurveyorsAngle argAngle, double argTolerance)
          Test this angle for equality with another angle.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicSurveyorsAngle

public BasicSurveyorsAngle()
Creates a BasicSurveyorsAngle object with an agle equal to zero.


BasicSurveyorsAngle

public BasicSurveyorsAngle(int argDegrees,
                           int argMinutes,
                           int argSeconds,
                           double argFractionalSeconds)
Creates a BasicSurveyorsAngle using the values provided. The first int argument is the number of degrees. This value should be between 0 and 359. The second int argument is the number of minutes. This value should be between 0 and 59. The third value is the number of seconds. This value should be between 0 and 59. The double argument is the number of fractional seconds. This value should be 0 or greater, but less than 1.0.


BasicSurveyorsAngle

public BasicSurveyorsAngle(SurveyorsAngle argTarget)
This is a copy constructor that creates a new BasicSurveyorsAngle using the values for degrees, minutes, seconds, and fractional seconds provided in the SurveyorsAngle provided as an argument.


BasicSurveyorsAngle

public BasicSurveyorsAngle(DegreesMinutesSecondsValue argDmsv)
Creates a BasicSurveyorsAnlge from a DegreesMinutesSecondsValue object.

Method Detail

decrease

public BasicSurveyorsAngle decrease(SurveyorsAngle argAmount)
Description copied from interface: SurveyorsAngle
Returns a new SurveyorsAngle whose angle value is calculated by decreasing the angle value of this angle by the angle passed as an argument. Angles with a value less than 0 are wrapped back up.

Specified by:
decrease in interface SurveyorsAngle

increase

public BasicSurveyorsAngle increase(SurveyorsAngle argAmount)
Description copied from interface: SurveyorsAngle
Returns a new SurveyorsAngle whose angle value is calculated by increasing the angle value of this angle by the angle passed as an argument. Angles with a value greater than 360 are wrapped back down.

Specified by:
increase in interface SurveyorsAngle

getDegrees

public int getDegrees()
Description copied from interface: SurveyorsAngle
Returns the whole degrees of this angle as an int. This will be a value between 0 and 359.

Specified by:
getDegrees in interface SurveyorsAngle

getMinutes

public int getMinutes()
Description copied from interface: SurveyorsAngle
Returns the whole minutes of this angle as an int. This will be a value between 0 and 59.

Specified by:
getMinutes in interface SurveyorsAngle

getSeconds

public int getSeconds()
Description copied from interface: SurveyorsAngle
Returns the whole seconds of this angle as an int. This will be a value between 0 and 59.

Specified by:
getSeconds in interface SurveyorsAngle

getFractionalSeconds

public double getFractionalSeconds()
Description copied from interface: SurveyorsAngle
Returns the fractional seconds of this angle as an double with a value equal to or greater than zero but less than 1.0.

Specified by:
getFractionalSeconds in interface SurveyorsAngle

convertToRadians

public double convertToRadians()

convertToDecimalDegrees

public double convertToDecimalDegrees()

getCosin

public double getCosin()
Description copied from interface: SurveyorsAngle
Returns the Cosin (or Cosine) of this angle.

Specified by:
getCosin in interface SurveyorsAngle

getSin

public double getSin()
Description copied from interface: SurveyorsAngle
Returns the sin (or sine) of this angle.

Specified by:
getSin in interface SurveyorsAngle

getTangent

public double getTangent()
Description copied from interface: SurveyorsAngle
Returns the tangent of this angle.

Specified by:
getTangent in interface SurveyorsAngle

isAcute

public boolean isAcute()
Description copied from interface: SurveyorsAngle
Indicates if this angle is acute. It is considered to be acute if its value is less than 180 degrees.

Specified by:
isAcute in interface SurveyorsAngle

isObtuse

public boolean isObtuse()
Description copied from interface: SurveyorsAngle
Indicates if this angle is obtuse. It is considered to be obtuse if its value is creater than 180 degrees.

Specified by:
isObtuse in interface SurveyorsAngle

isRightAngle

public boolean isRightAngle()
Description copied from interface: SurveyorsAngle
Indicates if this angle is a right angle. It is considered to be a right angle if it is exactly 90 degrees.

Specified by:
isRightAngle in interface SurveyorsAngle

rotateGeometry

public void rotateGeometry(com.vividsolutions.jts.geom.Geometry argTarget,
                           com.vividsolutions.jts.geom.Coordinate argBasePoint,
                           boolean argIncrease)
Description copied from interface: SurveyorsAngle
Rotates the Geometry argument using the Coordinate provided as the base point for the rotation. If the boolean argument is true, the geometry will be rotated in a clockwise direction, if the boolean argument is false it will be rotated in a counterclockwise direction.

Specified by:
rotateGeometry in interface SurveyorsAngle

testEquality

public int testEquality(SurveyorsAngle argAngle,
                        double argTolerance)
Test this angle for equality with another angle. An int is returned to communicate the level of equality. If the int has a value of 0 the angles are not equal. If the int has a value of 1 the degrees of the angle are equal. If the int has a value of 2 the degrees and minutes of the angle are equal. If the int has a value of 3 the degrees, minutes, and whole seconds of the angle are equal. If the int has a value of 4 the degrees, minutes, whole seconds, and fractional seconds of the angle are equal. The tolerance specified is the amount of seconds the two angles can be different while still being considered equal by this method. This tolerance is needed because trigonometric calculations with double (floating point numbers) is not exact. Slop of a couple seconds is not unsual.

Parameters:
argAngle - The angle used in the test for equality with this angle.

isLessThan

public boolean isLessThan(SurveyorsAngle argTarget)
Indicates if this angle is less than the angle supplied as an argument.


isGreaterThan

public boolean isGreaterThan(SurveyorsAngle argTarget)
Indicates if this angle is greater than the angle supplied as an argument.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object