Package org.geotools.mbstyle.layer
Enum SymbolMBLayer.TextAnchor
- Object
-
- Enum<SymbolMBLayer.TextAnchor>
-
- TextAnchor
-
- All Implemented Interfaces:
Serializable
,Comparable<SymbolMBLayer.TextAnchor>
- Enclosing class:
- SymbolMBLayer
public static enum SymbolMBLayer.TextAnchor extends Enum<SymbolMBLayer.TextAnchor>
Text justification options.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BOTTOM
The bottom of the text is placed closest to the anchor.BOTTOM_LEFT
The bottom left corner of the text is placed closest to the anchor.BOTTOM_RIGHT
The bottom right corner of the text is placed closest to the anchor.CENTER
The center of the text is placed closest to the anchor.LEFT
The left side of the text is placed closest to the anchor.RIGHT
The right side of the text is placed closest to the anchor.TOP
The top of the text is placed closest to the anchor.TOP_LEFT
The top left corner of the text is placed closest to the anchor.TOP_RIGHT
The top right corner of the text is placed closest to the anchor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double
getAnchorX(String jsonString)
Quickly grab x justification for jsonString.static double
getAnchorY(String jsonString)
Quickly grab y justification for jsonString.double
getX()
Horizontal justification.double
getY()
Vertical justification.String
json()
The json representation of this TextAnchor.static SymbolMBLayer.TextAnchor
parse(String jsonString)
Parse provided jsonString as a TextAnchor.static SymbolMBLayer.TextAnchor
valueOf(String name)
Returns the enum constant of this type with the specified name.static SymbolMBLayer.TextAnchor[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CENTER
public static final SymbolMBLayer.TextAnchor CENTER
The center of the text is placed closest to the anchor.
-
LEFT
public static final SymbolMBLayer.TextAnchor LEFT
The left side of the text is placed closest to the anchor.
-
RIGHT
public static final SymbolMBLayer.TextAnchor RIGHT
The right side of the text is placed closest to the anchor.
-
TOP
public static final SymbolMBLayer.TextAnchor TOP
The top of the text is placed closest to the anchor.
-
BOTTOM
public static final SymbolMBLayer.TextAnchor BOTTOM
The bottom of the text is placed closest to the anchor.
-
TOP_LEFT
public static final SymbolMBLayer.TextAnchor TOP_LEFT
The top left corner of the text is placed closest to the anchor.
-
TOP_RIGHT
public static final SymbolMBLayer.TextAnchor TOP_RIGHT
The top right corner of the text is placed closest to the anchor.
-
BOTTOM_LEFT
public static final SymbolMBLayer.TextAnchor BOTTOM_LEFT
The bottom left corner of the text is placed closest to the anchor.
-
BOTTOM_RIGHT
public static final SymbolMBLayer.TextAnchor BOTTOM_RIGHT
The bottom right corner of the text is placed closest to the anchor.
-
-
Method Detail
-
values
public static SymbolMBLayer.TextAnchor[] 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 (SymbolMBLayer.TextAnchor c : SymbolMBLayer.TextAnchor.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SymbolMBLayer.TextAnchor 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
-
getX
public double getX()
Horizontal justification.- Returns:
- horizontal alignment between 0.0 and 1.0.
-
getY
public double getY()
Vertical justification.- Returns:
- vertical alignment between 0.0 and 1.0.
-
parse
public static SymbolMBLayer.TextAnchor parse(String jsonString)
Parse provided jsonString as a TextAnchor.One of center, left, right, top, bottom, top-left, top-right, bottom-left, bottom-right. Defaults to center.
- Parameters:
jsonString
- text anchor definition- Returns:
- TextAnchor, defaults TextAnchor#CENTER if undefined
-
json
public String json()
The json representation of this TextAnchor.- Returns:
- json representation
-
getAnchorY
public static double getAnchorY(String jsonString)
Quickly grab y justification for jsonString.- Parameters:
jsonString
- text anchor definition- Returns:
- vertical anchor, defaults to 0.5
-
getAnchorX
public static double getAnchorX(String jsonString)
Quickly grab x justification for jsonString.- Parameters:
jsonString
- text anchor definition- Returns:
- horizontal anchor, defaults to 0.5
-
-