com.supermap.data

Class Maps

  • java.lang.Object
    • com.supermap.data.Maps


  • public class Maps
    extends java.lang.Object

    Map collection class.

    Stores all the maps saved in the workspace where the map collection object is located, but only the names of the maps contained in the current workspace can be accessed. Access to maps and operations must be done through the SuperMap.Mapping classMap.

    This class is used to manage all the maps in a workspace, including adding, deleting, modifying maps in the workspace, and so on. Where the name of the map is unique and can not be repeated. Even if the data referenced by the map or the data source is deleted, the layer still exists in the workspace, but the layer does not display the content, but when the map is connected to another data source, the map can still be displayed.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int add(java.lang.String name, java.lang.String xml)
      Add map to this Maps object.
      void clear()
      Clears all the maps in this Maps object, that is deletes all the maps in the workspace.
      java.lang.String get(int index)
      Returns the name of the specified map in this Maps object.
      int getCount()
      Returns the count of maps in this Maps object.
      int indexOf(java.lang.String name)
      Returns the index of the map with the specified name in this Maps object.
      boolean remove(int index)
      Delete the map of the specified serial number in this map collection object.
      boolean remove(java.lang.String name)
      Delete the map of the specified name in this map collection object.
      boolean setMapXML(int index, java.lang.String xml)
      Replaces the map with the specified index with the map that represented by the specified XML string.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • add

        public int add(java.lang.String name,
                       java.lang.String xml)
        Add map to this Maps object. The XML string contains all necessary information of a map (including the name of the map, whether the background of the map is opaque or not, the properties, information about layers and thematic map etc.), and it can be got by invoking the ToXML method of the Map object. To save the map, you need to firstly get the XML string for the map using ToXML, and then add the map to the Maps object through this method.
        Parameters:
        name - The specified map name. The name is not case sensitive.
        xml - An XML string representing the map to be added.
        Returns:
        The number of the newly added map in this map collection object.
      • getCount

        public int getCount()
        Returns the count of maps in this Maps object.
        Returns:
        The total number of map objects in the current map collection.
        Default:
        The default value is 0.
      • get

        public java.lang.String get(int index)
        Returns the name of the specified map in this Maps object.
        Parameters:
        index - Specify the serial number of the map.
        Returns:
        The name of the map that specifies the serial number in the map collection object.
        Throws:
        java.lang.IndexOutOfBoundsException - If index is less than 0 or index is greater than or equal to count, where count is the total number of maps in the map collection.
      • clear

        public void clear()
        Clears all the maps in this Maps object, that is deletes all the maps in the workspace.
      • indexOf

        public int indexOf(java.lang.String name)
        Returns the index of the map with the specified name in this Maps object.
        Parameters:
        name - The specified map name. The name is not case sensitive.
        Returns:
        The serial number of the map in the current map collection object.
      • remove

        public boolean remove(int index)
        Delete the map of the specified serial number in this map collection object. Returns true if successful, false otherwise.
        Parameters:
        index - The number of the map to be deleted.
        Returns:
        Returns true if the delete succeeds, false otherwise.
      • remove

        public boolean remove(java.lang.String name)
        Delete the map of the specified name in this map collection object.
        Parameters:
        name - The name of the map to be deleted.
        Returns:
        Returns true if the delete succeeds, false otherwise.
      • setMapXML

        public boolean setMapXML(int index,
                                 java.lang.String xml)
        Replaces the map with the specified index with the map that represented by the specified XML string.
        Parameters:
        index - The specified serial number.
        xml - The XML string representation of the new map used to replace the specified map.
        Returns:
        Returns true if the operation succeeds; false otherwise.
        Throws:
        java.lang.IndexOutOfBoundsException - If index is less than 0 or index is greater than or equal to count, where count is the total number of maps in the map collection.