ilog.views.maps
Class IlvAngularUnit

java.lang.Object
  extended by ilog.views.maps.IlvUnit
      extended by ilog.views.maps.IlvAngularUnit
All Implemented Interfaces:
IlvPersistentObject

public class IlvAngularUnit
extends IlvUnit

This class defines angular units. Angular units are used to measure planar angles. The kernel unit of IlvAngularUnit is the radian.
IlvAngularUnit has constants defining usual units:


Additional linear units can be retrieved using the GetRegisteredUnit method, or listed using the GetRegisteredUnits method of the superclass, IlvUnit.

Since:
JViews 5.0
See Also:
IlvUnit

Field Summary
static IlvAngularUnit DEGREE
          The unit representing degrees.
static IlvAngularUnit GRAD
          The unit representing grads.
static IlvAngularUnit RADIAN
          The unit representing radians.
 
Constructor Summary
IlvAngularUnit(double radiansPerUnit, String abbreviation, String name)
          Constructs a new angular unit.
IlvAngularUnit(IlvAngularUnit source)
          Constructs a new angular unit by copying an existing one.
IlvAngularUnit(IlvInputStream stream)
          Reads the object from an IlvInputStream object.
 
Method Summary
 IlvUnit copy()
          Returns a copy of this IlvAngularUnit.
 boolean equivalent(IlvUnit unit)
          Returns true if the specified unit is equivalent to this one.
 double fromDMS(String value)
          Converts a string specifying an angle in degrees, minutes, and seconds to this angular unit.
 double fromKernel(double value)
          Converts the value specified in the kernel unit of the quantity measured by this unit, to values in this unit.
 double fromRadians(double radians)
          Converts radians to this unit.
 double getRadiansPerUnit()
          Returns the number of radians per unit.
 String toDMS(double angle, boolean lat)
          Converts a double representing an angle expressed in this unit to its DMS (Degree, Minute, Second) representation.
 double toKernel(double value)
          Converts the value specified in the units of this IlvUnit to the kernel unit (that is, radians).
 double toRadians(double unit)
          Converts this unit to radians.
 void write(IlvOutputStream stream)
          Writes the object to the specified IlvOutputStream.
 
Methods inherited from class ilog.views.maps.IlvUnit
equals, getAbbreviation, getName, GetRegisteredUnit, GetRegisteredUnits, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RADIAN

public static final IlvAngularUnit RADIAN
The unit representing radians.


DEGREE

public static final IlvAngularUnit DEGREE
The unit representing degrees.


GRAD

public static final IlvAngularUnit GRAD
The unit representing grads.

Constructor Detail

IlvAngularUnit

public IlvAngularUnit(double radiansPerUnit,
                      String abbreviation,
                      String name)
Constructs a new angular unit.

Parameters:
name - The name of the unit.
abbreviation - The abbreviation of the unit.
radiansPerUnit - The number of radians per unit.

IlvAngularUnit

public IlvAngularUnit(IlvAngularUnit source)
Constructs a new angular unit by copying an existing one.

Parameters:
source - The source unit.

IlvAngularUnit

public IlvAngularUnit(IlvInputStream stream)
               throws IlvReadFileException
Reads the object from an IlvInputStream object.

Parameters:
stream - The input stream.
Throws:
IlvReadFileException - If the format is not correct.
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the object to the specified IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvUnit
Parameters:
stream - The stream to write this unit to.
Throws:
IOException - If an I/O error occurs.

getRadiansPerUnit

public double getRadiansPerUnit()
Returns the number of radians per unit.


fromRadians

public double fromRadians(double radians)
Converts radians to this unit.

Parameters:
radians - The value to convert, expressed in radians.
Returns:
The value in this unit.

toRadians

public double toRadians(double unit)
Converts this unit to radians.

Parameters:
unit - The value to convert, expressed in this unit.
Returns:
The value in radians.

toKernel

public double toKernel(double value)
Converts the value specified in the units of this IlvUnit to the kernel unit (that is, radians).

Specified by:
toKernel in class IlvUnit
Parameters:
value - The value to convert.
Returns:
The value converted to kernel units.

fromKernel

public double fromKernel(double value)
Converts the value specified in the kernel unit of the quantity measured by this unit, to values in this unit.

Specified by:
fromKernel in class IlvUnit
Parameters:
value - The value expressed in kernel units.
Returns:
The value converted to the units represented by this object.

copy

public IlvUnit copy()
Returns a copy of this IlvAngularUnit.


equivalent

public boolean equivalent(IlvUnit unit)
Returns true if the specified unit is equivalent to this one.

Specified by:
equivalent in class IlvUnit
Parameters:
unit - The unit to compare to.
Returns:
true if the two units are equivalent.

toDMS

public String toDMS(double angle,
                    boolean lat)
Converts a double representing an angle expressed in this unit to its DMS (Degree, Minute, Second) representation. The format is xxDxx'xx"L where L is one of the following: N, S, E, W. The appended letter depends on the value of the lat parameter (N or S if lat is true, E or W otherwise).

Parameters:
angle - The value to be converted.
lat - true, if the angle is a latitude, and false if the angle is a longitude.

fromDMS

public double fromDMS(String value)
Converts a string specifying an angle in degrees, minutes, and seconds to this angular unit. The usual format of the string is [+/-]xxDxx'xx" (for example, 25D33'25"N).

Parameters:
value - The string defining the angle in DMS.
Returns:
The angle value in radian, or 0 if value is null, or the empty string.
Throws:
IllegalArgumentException - If a string format error occurs.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.