Package org.openstreetmap.josm.tools
Interface RotationAngle
-
- All Known Implementing Classes:
RotationAngle.StaticRotationAngle
,RotationAngle.WayDirectionRotationAngle
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface RotationAngle
Determines how an icon is to be rotated depending on the primitive to be displayed.- Since:
- 8199 (creation), 10599 (functional interface), 12756 (moved from
gui.util
package)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
RotationAngle.StaticRotationAngle
A static rotationstatic class
RotationAngle.WayDirectionRotationAngle
The rotation along a way.
-
Field Summary
Fields Modifier and Type Field Description static RotationAngle
NO_ROTATION
A no-rotation angle that always returns 0.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static RotationAngle
buildStaticRotation(double angle)
Always returns the fixedangle
.static RotationAngle
buildStaticRotation(java.lang.String string)
Parses the rotation angle from the specifiedstring
.static RotationAngle
buildWayDirectionRotation()
Computes the angle depending on the referencing way segment, or0
if none exists.double
getRotationAngle(IPrimitive p)
Calculates the rotation angle depending on the primitive to be displayed.static double
parseCardinalRotation(java.lang.String cardinal)
Converts an angle given in cardinal directions to radians.
-
-
-
Field Detail
-
NO_ROTATION
static final RotationAngle NO_ROTATION
A no-rotation angle that always returns 0.- Since:
- 11726
-
-
Method Detail
-
getRotationAngle
double getRotationAngle(IPrimitive p)
Calculates the rotation angle depending on the primitive to be displayed.- Parameters:
p
- primitive- Returns:
- rotation angle in radians, clockwise starting from up/north
- Since:
- 13623 (signature)
-
buildStaticRotation
static RotationAngle buildStaticRotation(double angle)
Always returns the fixedangle
.- Parameters:
angle
- angle- Returns:
- rotation angle
-
buildStaticRotation
static RotationAngle buildStaticRotation(java.lang.String string)
Parses the rotation angle from the specifiedstring
.- Parameters:
string
- angle as string- Returns:
- rotation angle
-
parseCardinalRotation
static double parseCardinalRotation(java.lang.String cardinal)
Converts an angle given in cardinal directions to radians. The following values are supported:n
,north
,ne
,northeast
,e
,east
,se
,southeast
,s
,south
,sw
,southwest
,w
,west
,nw
,northwest
.- Parameters:
cardinal
- the angle in cardinal directions- Returns:
- the angle in radians
-
buildWayDirectionRotation
static RotationAngle buildWayDirectionRotation()
Computes the angle depending on the referencing way segment, or0
if none exists.- Returns:
- rotation angle
-
-