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 its ArcadeExpression.getExpression() property.

Since:
100.11.0
  • Constructor Details

    • LabelAngle

      public LabelAngle(ArcadeExpression arcadeExpression)
      Creates a LabelAngle with the specified ArcadeExpression.

      The getRotationType() will be defaulted to LabelAngleRotationType.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 a LabelAngle with the specified ArcadeExpression and LabelAngleRotationType. 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 null
      IllegalArgumentException - if rotationType is null
      Since:
      100.11.0
  • Method Details

    • 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.

      Warning: If the expression attempts to use attributes which don't exist then no label will be produced. This is distinct from the attribute existing but having a null or empty value, which will be interpreted as a zero angle.

      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 as LabelAngleRotationType.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 interface JsonSerializable
      Returns:
      a JSON string
    • getUnknownJson

      public Map<String,Object> getUnknownJson()
      Description copied from interface: JsonSerializable
      Gets unknown data from the source JSON.

      Unknown JSON is a Map of values not defined in the ArcGIS specification used to create this object but found in the source JSON. If the object is written back to JSON, any unknown JSON data is not persisted. The ArcGIS specification may be for a web map, web scene, REST API, and so on.

      Specified by:
      getUnknownJson in interface JsonSerializable
      Returns:
      an unmodifiable Map containing unknown data from the source JSON
    • getUnsupportedJson

      public Map<String,Object> getUnsupportedJson()
      Description copied from interface: JsonSerializable
      Gets unsupported data from the source JSON.

      Unsupported JSON is a Map of values defined in the ArcGIS specification used to create this object but not currently used in this API. If the object is written back to JSON, any unsupported JSON data is persisted. The ArcGIS specification may be from a web map, web scene, REST API, and so on.

      Specified by:
      getUnsupportedJson in interface JsonSerializable
      Returns:
      an unmodifiable Map containing unsupported data from the source JSON