Class 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 Detail

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