Enum Class Heading
- All Implemented Interfaces:
Serializable
,Comparable<Heading>
,Constable
Compass headings.
Keep in mind that unlike screen coordinates, planar coordinate values increase as one moves "up" (north).
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionint
static Heading
fromDegrees
(double degrees) Returns the Heading closest to the given compass heading in degrees (0 = north, 90 = east, etc.)id()
int
static Coordinate
project
(double angle, double distance) Determines theCoordinate
that lies a given distance from the center of the plane, in a givenHeading
static LineSegment
project
(double angle, double distance, Coordinate from) static LineString
projectedLine
(GeometryFactory factory, double angle, double distance, Coordinate from) reversed()
Returns the oppositeHeading
.int
Heading
in degrees.toString()
turnedBy
(double degrees) static double
turnedBy
(double fromDegrees, double byDegrees) static Heading
Returns the enum constant of this class with the specified name.static Heading[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NORTH
-
NORTHEAST
-
EAST
-
SOUTHEAST
-
SOUTH
-
SOUTHWEST
-
WEST
-
NORTHWEST
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
toString
-
id
-
northFactor
public int northFactor() -
eastFactor
public int eastFactor() -
toDegrees
public int toDegrees()Heading
in degrees.- Returns:
- 0 = north, 90 = east, etc.
-
reversed
Returns the oppositeHeading
.- Returns:
- the heading that lies 180 degrees opposite.
-
turnedBy
-
fromDegrees
Returns the Heading closest to the given compass heading in degrees (0 = north, 90 = east, etc.)- Parameters:
degrees
- (must be 0 <= degrees < 360)- Returns:
-
turnedBy
public static double turnedBy(double fromDegrees, double byDegrees) -
project
Determines theCoordinate
that lies a given distance from the center of the plane, in a givenHeading
- Parameters:
angle
- heading in degrees (0 = north, 90 = east)distance
- distance- Returns:
- the JTS
Coordinate
-
project
- Parameters:
angle
-distance
-from
-- Returns:
-
projectedLine
public static LineString projectedLine(GeometryFactory factory, double angle, double distance, Coordinate from)
-