Enum Direction
- java.lang.Object
-
- java.lang.Enum<Direction>
-
- org.hortonmachine.gears.libs.modules.Direction
-
- All Implemented Interfaces:
Serializable,Comparable<Direction>
public enum Direction extends Enum<Direction>
The possible flowdirections.The normal (exiting) flowdirection schema defines in which cell the drop flows if it has a particular value.
-1 0 1 +-----+-----+-----+ -1 | 4 | 3 | 2 | +-----+-----+-----+ 0 | 5 | x | 1 | +-----+-----+-----+ 1 | 6 | 7 | 8 | +-----+-----+-----+The entering flowdirection schema defines what value the neighbour cell has to have to flow into the current (center) cell.-1 0 1 +-----+-----+-----+ -1 | 8 | 7 | 6 | +-----+-----+-----+ 0 | 1 | x | 5 | +-----+-----+-----+ 1 | 2 | 3 | 4 | +-----+-----+-----+- Author:
- Andrea Antonello (www.hydrologis.com)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DirectionforFlow(int flowValue)Get theDirectionby its exiting flow.static DirectiongetDir(int col, int row)Get the dir for a particular col/row of the directions schema.doublegetDistance(double xRes, double yRes)intgetEnteringFlow()intgetFlow()static Direction[]getOrderedDirs()static intgetOutletValue()static DirectionvalueOf(String name)Returns the enum constant of this type with the specified name.static Direction[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
E
public static final Direction E
-
EN
public static final Direction EN
-
N
public static final Direction N
-
NW
public static final Direction NW
-
W
public static final Direction W
-
WS
public static final Direction WS
-
S
public static final Direction S
-
SE
public static final Direction SE
-
-
Method Detail
-
values
public static Direction[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Direction c : Direction.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Direction valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getFlow
public int getFlow()
-
getEnteringFlow
public int getEnteringFlow()
-
getOutletValue
public static int getOutletValue()
-
getDir
public static Direction getDir(int col, int row)
Get the dir for a particular col/row of the directions schema.- Parameters:
col- the col [-1, 1].row- the row [1, 1].- Returns:
- the direction or
nullfor illegal values.
-
getOrderedDirs
public static Direction[] getOrderedDirs()
- Returns:
- the array of directions, starting from the most eastern, going counterclockwise.
-
forFlow
public static Direction forFlow(int flowValue)
Get theDirectionby its exiting flow.- Parameters:
flowValue- the value of the (exiting) flow.- Returns:
- the direction.
-
getDistance
public double getDistance(double xRes, double yRes)
-
-