Class LabelAngle
- java.lang.Object
-
- com.esri.arcgisruntime.mapping.labeling.LabelAngle
-
- All Implemented Interfaces:
JsonSerializable
public final class LabelAngle extends Object implements JsonSerializable
Specifies how to calculate the angular position and layout direction for labels on or around point feature symbols.This may be different for each feature (driven by one or more feature attributes) or constant for all features (specified by a fixed number).
These properties will only be used if the
getAngleExpression()
has an Arcade expression set into itsArcadeExpression.getExpression()
property.- Since:
- 100.11.0
-
-
Constructor Summary
Constructors Constructor Description LabelAngle(ArcadeExpression arcadeExpression)
Creates aLabelAngle
with the specifiedArcadeExpression
.LabelAngle(ArcadeExpression arcadeExpression, LabelAngleRotationType rotationType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LabelAngle
fromJson(String json)
Creates a LabelAngle instance from a JSON string.ArcadeExpression
getAngleExpression()
Gets how the angle (in degrees) is calculated from the feature attributes, using an Arcade expression.LabelAngleRotationType
getRotationType()
Gets whether the angle should be interpreted as arithmetic or geographic.Map<String,Object>
getUnknownJson()
If this object was created from JSON, this method gets unknown data from the source JSON.Map<String,Object>
getUnsupportedJson()
If this object was created from JSON, this method gets unsupported data from the source JSON.void
setAngleExpression(ArcadeExpression angleExpression)
Sets how the angle (in degrees) is calculated from the feature attributes, using an Arcade expression.void
setRotationType(LabelAngleRotationType rotationType)
Sets whether the angle should be interpreted as arithmetic or geographic.String
toJson()
Serializes this object to a JSON string.
-
-
-
Constructor Detail
-
LabelAngle
public LabelAngle(ArcadeExpression arcadeExpression)
Creates aLabelAngle
with the specifiedArcadeExpression
.The
getRotationType()
will be defaulted toLabelAngleRotationType.AUTOMATIC
.- Parameters:
arcadeExpression
- The Arcade expression script. The expression is expected to be a complete, self-contained Arcade expression that calculates an angle in degrees.- Throws:
IllegalArgumentException
- if arcadeExpression is null- Since:
- 100.11.0
-
LabelAngle
public LabelAngle(ArcadeExpression arcadeExpression, LabelAngleRotationType rotationType)
Creates aLabelAngle
with the specifiedArcadeExpression
andLabelAngleRotationType
. The expression is expected to be a complete, self-contained Arcade expression that calculates an angle in degrees.- Parameters:
arcadeExpression
- The Arcade expression script. The expression is expected to be a complete, self-contained Arcade expression that calculates an angle in degrees.rotationType
- specifies whether the angle should be interpreted as arithmetic or geographic- Throws:
IllegalArgumentException
- if arcadeExpression is nullIllegalArgumentException
- if rotationType is null- Since:
- 100.11.0
-
-
Method Detail
-
getAngleExpression
public ArcadeExpression getAngleExpression()
Gets how the angle (in degrees) is calculated from the feature attributes, using an Arcade expression.The calculation may use attributes, fixed numbers, or a combination of both. The default value is an ArcadeExpression containing an empty expression string, which will produce a zero angle when evaluated.
- Returns:
- the Arcade expression
- Since:
- 100.11.0
-
setAngleExpression
public void setAngleExpression(ArcadeExpression angleExpression)
Sets how the angle (in degrees) is calculated from the feature attributes, using an Arcade expression.The calculation may use attributes, fixed numbers, or a combination of both.
- Parameters:
angleExpression
- The Arcade expression to use. If the expression within it is an empty string, then the LabelAngle will not modify the position or layout of the label.- Throws:
IllegalArgumentException
- if angleExpression is null- Since:
- 100.11.0
-
getRotationType
public LabelAngleRotationType getRotationType()
Gets whether the angle should be interpreted as arithmetic or geographic.The default value is
LabelAngleRotationType.AUTOMATIC
(which will be interpreted asLabelAngleRotationType.ARITHMETIC
).- Returns:
- whether the angle should be interpreted as arithmetic or geographic
- Since:
- 100.11.0
-
setRotationType
public void setRotationType(LabelAngleRotationType rotationType)
Sets whether the angle should be interpreted as arithmetic or geographic.- Parameters:
rotationType
- whether the angle should be interpreted as arithmetic or geographic- Throws:
IllegalArgumentException
- if rotationType is null- Since:
- 100.11.0
-
fromJson
public static LabelAngle fromJson(String json)
Creates a LabelAngle instance from a JSON string.- Parameters:
json
- a JSON string that represents a LabelAngle- Returns:
- a LabelAngle instance
- Throws:
IllegalArgumentException
- if json is null or empty- Since:
- 100.11.0
-
toJson
public String toJson()
Description copied from interface:JsonSerializable
Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.- Specified by:
toJson
in interfaceJsonSerializable
- Returns:
- a JSON string
-
getUnknownJson
public Map<String,Object> getUnknownJson()
Description copied from interface:JsonSerializable
If this object was created from JSON, this method gets unknown data from the source JSON. Unknown JSON is a Map of values that were in the source JSON but are not known by the Runtime and therefore not exposed in the API.- Specified by:
getUnknownJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unknown JSON data. The keys are Strings containing names. The types of
the values depend on the types of tokens within the JSON as follows:
- a
Map<String, Object>
represents an object in the JSON - a
List<Object>
represents an array in the JSON - a
String
represents a string in the JSON - a
Double
represents a number in the JSON - a
Boolean
represents true or false in the JSON null
represents null in the JSON
- a
-
getUnsupportedJson
public Map<String,Object> getUnsupportedJson()
Description copied from interface:JsonSerializable
If this object was created from JSON, this method gets unsupported data from the source JSON. Unsupported JSON is a Map of values that are supported by webmaps and known to the version of the webmap specification the API supports (see system requirements), but are not explicitly exposed through the Runtime API.- Specified by:
getUnsupportedJson
in interfaceJsonSerializable
- Returns:
- an unmodifiable Map containing unsupported JSON data. The keys are Strings containing names. The types of
the values depend on the types of tokens within the JSON as follows:
- a
Map<String, Object>
represents an object in the JSON - a
List<Object>
represents an array in the JSON - a
String
represents a string in the JSON - a
Double
represents a number in the JSON - a
Boolean
represents true or false in the JSON null
represents null in the JSON
- a
-
-