Class ClassBreaksRenderer.ClassBreak

  • All Implemented Interfaces:
    JsonSerializable
    Enclosing class:
    ClassBreaksRenderer

    public static final class ClassBreaksRenderer.ClassBreak
    extends java.lang.Object
    implements JsonSerializable
    Defines a single class break as used by ClassBreaksRenderer. ClassBreak is used to categorize a group of values that fall within a range defined by getMinValue() and getMaxValue(). A value is determined to be within the range if it is greater than the minimum value but less than or equal to the maximum value. Written as an algebraic equation, it would look like ClassBreak.getMinValue < value <= ClassBreak.getMaxValue.

    This class defines the min and max values for the renderer to use, the description, a label for use in a legend, and the symbol that will be displayed. If a renderer is to be used with continuous class breaks, you only need to set the maximum value of each break. The minimum value will be defined by the maximum of the preceding class break. The first class break's minimum will be defined by ClassBreaksRenderer.setMinValue(double).

    For example, assume you wanted to create a set of ClassBreak categories based on the following integers (0, 0, 1, 1, 2, 4, 6, 6, 7, 10). The following table would be helpful in defining the ClassBreak range settings:

    ClassBreak Range Settings
    categorized group of values count label minValue maxValue
    0 2 none -1 0
    1-2 3 one to two 0 2
    3-5 1 three to five 2 5
    6-10 4 six to ten 5 10
    Since:
    100.0.0
    See Also:
    ClassBreaksRenderer
    • Constructor Summary

      Constructors 
      Constructor Description
      ClassBreak()
      Creates a new class break object.
      ClassBreak​(java.lang.String description, java.lang.String label, double minValue, double maxValue, Symbol symbol)
      Creates a new ClassBreak instance with the specified description, legend label, min and max values and the symbol that will be displayed.
      ClassBreak​(java.lang.String description, java.lang.String label, double minValue, double maxValue, Symbol symbol, java.lang.Iterable<Symbol> alternateSymbols)
      Creates a new class break object with alternate symbols.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ClassBreaksRenderer.ClassBreak fromJson​(java.lang.String json)
      Creates a ClassBreak instance from a JSON string.
      java.util.List<Symbol> getAlternateSymbols()
      Gets the alternate symbols for the class break's primary symbol.
      java.lang.String getDescription()
      Gets the description of the class break.
      java.lang.String getLabel()
      Gets a label for the class break.
      double getMaxValue()
      Gets the class max value for the range that defines this class break.
      double getMinValue()
      Gets the class min value for the range that defines this class break.
      Symbol getSymbol()
      Gets the symbol used to represent elements in this ClassBreak in a GeoView.
      java.util.Map<java.lang.String,​java.lang.Object> getUnknownJson()
      If this object was created from JSON, this method gets unknown data from the source JSON.
      java.util.Map<java.lang.String,​java.lang.Object> getUnsupportedJson()
      If this object was created from JSON, this method gets unsupported data from the source JSON.
      void setDescription​(java.lang.String description)
      Sets the description of the class break.
      void setLabel​(java.lang.String label)
      Sets the legend label for the class break.
      void setMaxValue​(double maxValue)
      Sets the class max value for the range that defines this class break.
      void setMinValue​(double minValue)
      Sets the class min value for the range that defines this class break.
      void setSymbol​(Symbol symbol)
      Sets the symbol used to represent elements in this ClassBreak in a GeoView.
      java.lang.String toJson()
      Serializes this object to a JSON string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClassBreak

        public ClassBreak()
        Creates a new class break object.
        Since:
        100.0.0
      • ClassBreak

        public ClassBreak​(java.lang.String description,
                          java.lang.String label,
                          double minValue,
                          double maxValue,
                          Symbol symbol)
        Creates a new ClassBreak instance with the specified description, legend label, min and max values and the symbol that will be displayed.
        Parameters:
        description - A description of the class break. For example: "Cities with a population under 100,000"
        label - A label for the class break. For example: "0 - 100000"
        minValue - the min value for the range that defines this class break. minValue is exclusive (>).
        maxValue - the max value for the range that defines this class break. maxValue is inclusive (<=).
        symbol - a symbol used to represent elements in the class break.
        Throws:
        java.lang.NullPointerException - if symbol is null.
        Since:
        100.0.0
      • ClassBreak

        public ClassBreak​(java.lang.String description,
                          java.lang.String label,
                          double minValue,
                          double maxValue,
                          Symbol symbol,
                          java.lang.Iterable<Symbol> alternateSymbols)
        Creates a new class break object with alternate symbols.

        A class break can have alternate symbols to the primary symbol. Alternate symbols allow you to tailor the visualization of class break at different scales by selecting different symbol for different scales. Alternate symbols are supported only when class break's primary symbol and other symbols in alternate symbol list are of type MultilayerSymbol and have SymbolReferenceProperties defining valid min max scales at which the symbol becomes visible. Renderer will pick only one symbol at a given map scale. If primary symbol's scale range falls within the map's scale, primary symbol is used. If not, then symbols in alternate symbols list are iterated through and first symbol matching the current map scale is picked for rendering. A symbol becomes visible if the map scale is less than or equal to symbol's minimum scale and greater than symbol's maximum scale. For more information on Scale-based symbol classes and alternate symbols see the "Scale based Symbols documentation"

        Parameters:
        description - a description of the class break. "Cities with a population under 100,000", for example.
        label - a label for the class break. "0 - 100000", for example.
        minValue - the minimum value of the range that defines the break
        maxValue - the maximum value of the range that defines the break
        symbol - a symbol used to represent elements in the class break, may be null
        alternateSymbols - the alternate symbols for the class break. Only MultilayerSymbol are supported as alternates. This param may be null.
        Since:
        100.13.0
    • Method Detail

      • fromJson

        public static ClassBreaksRenderer.ClassBreak fromJson​(java.lang.String json)
        Creates a ClassBreak instance from a JSON string.
        Parameters:
        json - a JSON string that represents a ClassBreak
        Returns:
        a ClassBreak instance
        Throws:
        java.lang.IllegalArgumentException - if json is null or empty
        Since:
        100.0.0
      • getAlternateSymbols

        public java.util.List<Symbol> getAlternateSymbols()
        Gets the alternate symbols for the class break's primary symbol. Symbols in this list should be of type MultilayerSymbol and must have SymbolReferenceProperties set with valid minimum and maximum scale at which symbol becomes visible. Renderer will pick only one symbol at a given map scale. If primary symbol's scale range falls within the map's scale, primary symbol is used. If not, then symbols in alternate symbols list are iterated through and first symbol matching the current map scale is picked for rendering. A symbol becomes visible if the map scale is less than or equal to symbol's minimum scale and greater than symbol's maximum scale.
        Returns:
        the alternate symbols for the class break's primary symbol.
        Since:
        100.13.0
      • toJson

        public java.lang.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 java.util.Map<java.lang.String,​java.lang.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 java.util.Map<java.lang.String,​java.lang.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
      • getMinValue

        public double getMinValue()
        Gets the class min value for the range that defines this class break.
        Returns:
        the class min value
        Since:
        100.0.0
        See Also:
        setMinValue(double)
      • setMinValue

        public void setMinValue​(double minValue)
        Sets the class min value for the range that defines this class break. The min value is exclusive (>).
        Parameters:
        minValue - the new class min value
        Since:
        100.0.0
        See Also:
        getMinValue()
      • getMaxValue

        public double getMaxValue()
        Gets the class max value for the range that defines this class break.
        Returns:
        the class max value
        Since:
        100.0.0
        See Also:
        setMaxValue(double)
      • setMaxValue

        public void setMaxValue​(double maxValue)
        Sets the class max value for the range that defines this class break. The max value is inclusive (<=).
        Parameters:
        maxValue - the new class max value
        Since:
        100.0.0
        See Also:
        getMaxValue()
      • getDescription

        public java.lang.String getDescription()
        Gets the description of the class break.
        Returns:
        the description
        Since:
        100.0.0
        See Also:
        setDescription(String)
      • setDescription

        public void setDescription​(java.lang.String description)
        Sets the description of the class break. For example: "Cities with population under 100,000."
        Parameters:
        description - the description
        Since:
        100.0.0
        See Also:
        getDescription()
      • getLabel

        public java.lang.String getLabel()
        Gets a label for the class break. Suitable for showing in a legend.
        Returns:
        the label
        Since:
        100.0.0
        See Also:
        setLabel(String)
      • setLabel

        public void setLabel​(java.lang.String label)
        Sets the legend label for the class break. For example: "0 - 100000".
        Parameters:
        label - the new label
        Since:
        100.0.0
        See Also:
        getLabel()
      • getSymbol

        public Symbol getSymbol()
        Gets the symbol used to represent elements in this ClassBreak in a GeoView.
        Returns:
        the symbol
        Since:
        100.0.0
      • setSymbol

        public void setSymbol​(Symbol symbol)
        Sets the symbol used to represent elements in this ClassBreak in a GeoView. If symbol is null, the features in the ClassBreak will not be drawn and are thus invisible.
        Parameters:
        symbol - the symbol
        Since:
        100.0.0