com.supermap.mapping

Class ThemeGridRange



  • public class ThemeGridRange
    extends Theme
    The grid ranges map.

    The grid ranges map subdivides the values into a number of ranges. Pixels with values within the same range are assigned the same color. Grid ranges map is generally used to reflect the quantity or level characteristics of continuous distribution phenomena. For example, the grid data generated after interpolating the observations of various meteorological stations is displayed range by range in the national precipitation distribution map of one year. This class is similar to the Class ranges map, except that the operation object of ranges map is vector data, whereas that of grid ranges map is grid data.

    • Constructor Summary

      Constructors 
      Constructor and Description
      ThemeGridRange()
      The default constructor for constructing a new ThemeGridRange object.
      ThemeGridRange(ThemeGridRange themeGridRange)
      Constructs a new object identical to the given ThemeGridRange object.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean addToHead(ThemeGridRangeItem item)
      Adds an ThemeGridRangeItem object to the head of the range list.
      boolean addToHead(ThemeGridRangeItem item, boolean normalize)
      Adds an ThemeGridRangeItem object to the head of the range list.
      boolean addToTail(ThemeGridRangeItem item)
      Adds an ThemeGridRangeItem object to the tail of the range list.
      boolean addToTail(ThemeGridRangeItem item, boolean normalize)
      Adds an ThemeGridRangeItem object to the tail of the range list.
      void clear()
      Clears all the items of the grid ranges map.
      void dispose()
      Release the resource occupy by this object.
      boolean fromXML(java.lang.String xml)
      Imports the information of the thematic map from XML strings.
      int getCount()
      Returns the count of the ranges in the grid ranges map.
      ThemeGridRangeItem getItem(int index)
      Returns the grid ranges map item with the specified index in range thematic map.
      RangeMode getRangeMode()
      Gets the range mode of the current thematic map.
      int GetSpecialValue()
      Return the given transparent value.
      int indexOf(double value)
      Returns the index of the ranges map item with the specified field value in the item list.
      boolean isSpecialValueTransparent()
      Return whether to display the grid map with given transparent value.
      static ThemeGridRange makeDefault(DatasetGrid dataset, RangeMode rangeMode, double rangeParameter)
      Makes the default grid map with the given dataset, rangeMode, rangeParameter and colorGradientType.
      static ThemeGridRange makeDefault(DatasetGrid dataset, RangeMode rangeMode, double rangeParameter, ColorGradientType colorGradientType)
      Makes the default grid map with the given dataset, rangeMode, rangeParameter and colorGradientType.
      boolean merge(int index, int count, Color color, java.lang.String caption)
      Merges the specified counts of grid ranges map items from the specified index and assign the color and caption to the new item.
      void reverseColor()
      Displays the ThemeRange object with the reverse style in the label map.
      void setSpecialValue(int nSpecialValue)
      Set the given transparent value.
      void setSpecialValueTransparent(boolean bSpecialValueTransparent)
      Set whether to display the grid map with given transparent value.
      boolean split(int index, double splitValue, Color color1, java.lang.String caption1, Color color2, java.lang.String caption2)
      Splits a grid ranges map item with a specified index into items with separate colors and names.
      java.lang.String toString()
      Outputs the formatted string for the thematic map.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ThemeGridRange

        public ThemeGridRange()
        The default constructor for constructing a new ThemeGridRange object.
      • ThemeGridRange

        public ThemeGridRange(ThemeGridRange themeGridRange)
        Constructs a new object identical to the given ThemeGridRange object.
        Parameters:
        themeGridRange - The given ThemeGridRange object.
    • Method Detail

      • getRangeMode

        public RangeMode getRangeMode()
        Gets the range mode of the current thematic map.

        StdDeviation mode and Quantile mode do not support the grid data.

        Returns:
        Return the range mode of the current thematic map.
      • getItem

        public ThemeGridRangeItem getItem(int index)
        Returns the grid ranges map item with the specified index in range thematic map. Fore more details about the grid ranges map item, please refer to .
        Parameters:
        index - The index of the specified grid ranges map item.
        Returns:
        The grid ranges map item with the specified index.
      • getCount

        public int getCount()
        Returns the count of the ranges in the grid ranges map.
        Returns:
        Returns the count of the ranges in the grid ranges map. The default is 0.
      • addToHead

        public boolean addToHead(ThemeGridRangeItem item)
        Adds an ThemeGridRangeItem object to the head of the range list.
        Parameters:
        item - The grid ranges map item to be added.
        Returns:
        True, if successful; otherwise, false.
      • addToTail

        public boolean addToTail(ThemeGridRangeItem item)
        Adds an ThemeGridRangeItem object to the tail of the range list.
        Parameters:
        item - The grid ranges map item to be added.
        Returns:
        True, if successful; otherwise, false.
      • addToHead

        public boolean addToHead(ThemeGridRangeItem item,
                                 boolean normalize)
        Adds an ThemeGridRangeItem object to the head of the range list.
        Parameters:
        item - The grid ranges map item to be added.
        normalize - Whether to normalize or not. If true, normalize the value of item if it is invalid; otherwise, throw an exception if the value of item is invalid.
        Returns:
        True, if successful; otherwise, false.
      • addToTail

        public boolean addToTail(ThemeGridRangeItem item,
                                 boolean normalize)
        Adds an ThemeGridRangeItem object to the tail of the range list.
        Parameters:
        item - The grid ranges map item to be added.
        normalize - Whether to normalize or not. If true, normalize the value of item if it is invalid; otherwise, throw an exception if the value of item is invalid.
        Returns:
        True, if successful; otherwise, false.
      • split

        public boolean split(int index,
                             double splitValue,
                             Color color1,
                             java.lang.String caption1,
                             Color color2,
                             java.lang.String caption2)
        Splits a grid ranges map item with a specified index into items with separate colors and names. Note: The splitValue must be in the grid range for split, that is, greater than the start value and less than the end value of the grid ranges map item to split. If the condition is not satisfied, an exception will be thrown.
        Parameters:
        index - The index of the specified grid ranges map item.
        splitValue - The specified value for splitting ranges.
        color1 - The name of one of the two split grid ranges map items.
        caption1 - The name of one of the two split grid ranges map items.
        color2 - The name of one of the two split ranges map items.
        caption2 - The name of one of the two split grid ranges map items.
        Returns:
        Returns true if successful; otherwise returns false.
      • merge

        public boolean merge(int index,
                             int count,
                             Color color,
                             java.lang.String caption)
        Merges the specified counts of grid ranges map items from the specified index and assign the color and caption to the new item. Those merged items will be disposed after calling this method.
        Parameters:
        index - The index of the specified grid ranges map item. This index serves as the start index.
        count - The count of grid ranges map items to be merged, counting from the specified index.
        color - the grid ranges map item color after merged.
        caption - The caption of the merged ThemeGridRangeItem..
        Returns:
        If merging successfully, returns true; otherwise false.
      • clear

        public void clear()
        Clears all the items of the grid ranges map. All the ThemeGridRangeItem objects will be disposed after calling this method.
      • makeDefault

        public static ThemeGridRange makeDefault(DatasetGrid dataset,
                                                 RangeMode rangeMode,
                                                 double rangeParameter,
                                                 ColorGradientType colorGradientType)
        Makes the default grid map with the given dataset, rangeMode, rangeParameter and colorGradientType.
        Parameters:
        dataset - the grid dataset
        rangeMode - Range mode. It supports equal interval, square root, logarithm and custom interval.
        rangeParameter - Range parameters. If the mode is equal interval or square root or logarithm, this parameter is the range count; if the mode is custom interval, this parameter is the custom distance.
        colorGradientType - Color gradient type.
        Returns:
        Creates a new instance of the ThemeGridRange class.
      • makeDefault

        public static ThemeGridRange makeDefault(DatasetGrid dataset,
                                                 RangeMode rangeMode,
                                                 double rangeParameter)
        Makes the default grid map with the given dataset, rangeMode, rangeParameter and colorGradientType.
        Parameters:
        dataset - the grid dataset
        rangeMode - Range mode. It supports equal interval, square root, logarithm and custom interval.
        rangeParameter - Range parameters. If the mode is equal interval or square root or logarithm, this parameter is the range count; if the mode is custom interval, this parameter is the custom distance.
        Returns:
        Creates a new instance of the ThemeGridRange class.
      • indexOf

        public int indexOf(double value)
        Returns the index of the ranges map item with the specified field value in the item list. If the datasource does not exist, returns -1.
        Parameters:
        value - The given field values for segmentation.
        Returns:
        The index number of the item of the ranges. If the item of the ranges does not exist, returns -1.
      • reverseColor

        public void reverseColor()
        Displays the ThemeRange object with the reverse style in the label map.
      • toString

        public java.lang.String toString()
        Description copied from class: Theme
        Outputs the formatted string for the thematic map. The formatted string provides the information about the thematic map settings and it cannot be used for import and display of the thematic map like what the XML string can do.
        1. For raster ranges map, the format is {Caption="china", Start=10 End=20, Visible=true?false, Style={linestyle=,markerstyle=,fillstyle=} };
        2. For raster unique map, the format is {Caption="china", Unique =20, Visible=true?false, Style={linestyle=,markerstyle=,fillstyle=} };
        3. For labels map, the format is {Caption="China", Start=10 End=20, Visible=true, Style={name=,width=,height=,color=()} };
        4. For ranges map, the format is {Caption="china", Start=10 End=20, Visible=true?false, Style={linestyle=,markerstyle=,fillstyle=} };
        5. For unqiue values map, the format is {Caption="china", Unique =20, Visible=true?false, Style={linestyle=,markerstyle=,fillstyle=} };
        Specified by:
        toString in class Theme
        Returns:
        The formatted string for the thematic map.
        See Also:
        Theme.toString()
      • dispose

        public void dispose()
        Release the resource occupy by this object.
      • fromXML

        public boolean fromXML(java.lang.String xml)
        Description copied from class: Theme
        Imports the information of the thematic map from XML strings.

        In SuperMap, the settings of any type of thematic map can be export to the XML strings, and these XML strings record all the settings of this thematic map. For example, in the XML strings of a label map, the settings of type of the thematic map, visible scale, styles, whether avoiding overlapping, which field or expression is used as thematic variable and so forth will be recorded. This XML strings can then be imported to set a thematic map.

        Overrides:
        fromXML in class Theme
        Parameters:
        xml - The XML strings that contains the information about a thematic map.
        Returns:
        A boolean, return true if it is removed successfully; false otherwise.
        See Also:
        Theme.fromXML(java.lang.String)
      • setSpecialValueTransparent

        public void setSpecialValueTransparent(boolean bSpecialValueTransparent)
        Set whether to display the grid map with given transparent value.
        Parameters:
        bSpecialValueTransparent - whether to display the grid map with given transparent value.
      • isSpecialValueTransparent

        public boolean isSpecialValueTransparent()
        Return whether to display the grid map with given transparent value.
        Returns:
        Return true if display on the basis of given transparent value; otherwise, false.
      • setSpecialValue

        public void setSpecialValue(int nSpecialValue)
        Set the given transparent value.
        Parameters:
        nSpecialValue - the given transparent value.
      • GetSpecialValue

        public int GetSpecialValue()
        Return the given transparent value.
        Returns:
        Return the given transparent value.