com.supermap.data

Class SpatialIndexInfo



  • public class SpatialIndexInfo
    extends InternalHandleDisposable

    Spatial index information class

    The SpatialIndexInfo class. This class provides the information of building spatial index, such as type of spatial index, count of leaf object, field of tile, width and height of tile, and size of multi-grid.

    Example:
    The following example demonstrates how to build spatial index for the dataset:
         public void spatialIndexInfoTest(){
             //Suppose open a workspace which contains a database datasource. The datasource contains a dataset named "World"(dataset).
             // Get a dataset without any spatial index in this datasource.
             // Instantiate a SpatialIndexInfo object.
             DatasetVector dataset = (DatasetVector) datasource.getDatasets().get("world");
             SpatialIndexInfo spatialIndexInfo = new SpatialIndexInfo();
             // Set the information of the spatial index.
             spatialIndexInfo.setGridCenter(dataset.getBounds().getCenter());
             spatialIndexInfo.setGridSize0(10000);
             spatialIndexInfo.setGridSize1(2500);
             spatialIndexInfo.setGridSize2(625);
             spatialIndexInfo.setType(SpatialIndexType.MULTI_LEVEL_GRID);
             System.out.println("The information of the spatial index is: " + spatialIndexInfo.toString());
             // Build spatial index for the dataset.
             dataset.buildSpatialIndex(spatialIndexInfo);
         }
         
    • Constructor Summary

      Constructors 
      Constructor and Description
      SpatialIndexInfo()
      Constructs a new SpatialIndexInfo object.
      SpatialIndexInfo(double tileWidth, double tileHeight)
      Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
      SpatialIndexInfo(int leafObjectCount)
      Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
      SpatialIndexInfo(Point2D gridCenter, double gridSize0, double gridSize1, double gridSize2)
      Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
      SpatialIndexInfo(SpatialIndexInfo spatialIndexInfo)
      Initializes a new instance of the SpatialIndexInfo class which is a copy of the specified Route object.
      SpatialIndexInfo(SpatialIndexType type)
      Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
      SpatialIndexInfo(java.lang.String tileField)
      Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      SpatialIndexInfo clone()
      Clones a new object
      void dispose()
      Dispose this object resource.
      Point2D getGridCenter()
      Return the center point of the grid.
      double getGridSize0()
      Returns the size of the first level grid.
      double getGridSize1()
      Return the size of the second level grid.
      double getGridSize2()
      Return the size of the third level grid.
      int getLeafObjectCount()
      Returns the count of leaf objects of R tree spatial index.
      java.lang.String getTileField()
      Returns the field of tile which applies to the tile spatial index.
      double getTileHeight()
      Return the tile height of the spatial index.
      double getTileWidth()
      Return the tile width of the spatial index.
      SpatialIndexType getType()
      Return spatial index type.
      void setGridCenter(Point2D value)
      Set the center point of the grid.
      void setGridSize0(double value)
      Sets the size of the first level grid.
      void setGridSize1(double value)
      Set the size of the second level grid.
      void setGridSize2(double value)
      Set the size of the third level grid.
      void setLeafObjectCount(int value)
      Set the count of leaf objects of R tree spatial index.
      void setTileField(java.lang.String value)
      Sets the field of tile which applies to the tile spatial index.
      void setTileHeight(double value)
      Set the tile height of the spatial index.
      void setTileWidth(double value)
      Set the tile width of the spatial index.
      void setType(SpatialIndexType type)
      Set spatial index type.
      java.lang.String toString()
      Output spatial index information to strings.
      • Methods inherited from class java.lang.Object

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

      • SpatialIndexInfo

        public SpatialIndexInfo()
        Constructs a new SpatialIndexInfo object.
      • SpatialIndexInfo

        public SpatialIndexInfo(SpatialIndexType type)
        Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
        Parameters:
        type - The specified spatial index type. Please see enumeration of {link@SpatialIndexType}
      • SpatialIndexInfo

        public SpatialIndexInfo(int leafObjectCount)
        Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
        Parameters:
        leafObjectCount - the specifeid leaf object count
      • SpatialIndexInfo

        public SpatialIndexInfo(java.lang.String tileField)
        Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
        Parameters:
        tileField - the specified tile filed object.
      • SpatialIndexInfo

        public SpatialIndexInfo(double tileWidth,
                                double tileHeight)
        Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
        Parameters:
        tileWidth - the tile width of the spatial index. The unit is the same with the dataset extent.
        tileHeight - the tile height of the spatial index. The unit is the same with the dataset extent.
      • SpatialIndexInfo

        public SpatialIndexInfo(Point2D gridCenter,
                                double gridSize0,
                                double gridSize1,
                                double gridSize2)
        Initializes a new SpatialIndexInfo object identical to the given SpatialIndexInfo object.
        Parameters:
        gridCenter - the center point of the grid.
        gridSize0 - the size of the first level grid. The unit is identical with the dataset.
        gridSize1 - the size of the second level grid. The unit is identical with the dataset.
        gridSize2 - the size of the third level grid. The unit is identical with the dataset.
      • SpatialIndexInfo

        public SpatialIndexInfo(SpatialIndexInfo spatialIndexInfo)
        Initializes a new instance of the SpatialIndexInfo class which is a copy of the specified Route object.
        Parameters:
        spatialIndexInfo - the specified SpatialIndexInfo object.
    • Method Detail

      • dispose

        public void dispose()
        Dispose this object resource.
      • clone

        public SpatialIndexInfo clone()
        Clones a new object
        Overrides:
        clone in class java.lang.Object
        Returns:
        return a new object of the cloned SpatialIndexInfo.
      • getType

        public SpatialIndexType getType()
        Return spatial index type.
        Returns:
        Return spatial index type. The default value is {link@SpatialIndexType#MULTI_LEVEL_GRID}
      • setType

        public void setType(SpatialIndexType type)
        Set spatial index type.
        Parameters:
        type - spatial index type.
      • getLeafObjectCount

        public int getLeafObjectCount()
        Returns the count of leaf objects of R tree spatial index.
        Returns:
        the count of leaf objects of R tree spatial index.
      • setLeafObjectCount

        public void setLeafObjectCount(int value)
        Set the count of leaf objects of R tree spatial index.
        Parameters:
        value - the count of leaf objects of R tree spatial index.
      • getTileField

        public java.lang.String getTileField()
        Returns the field of tile which applies to the tile spatial index. This filed is used for tile spatial index.
        Returns:
        the field of tile which applies to the tile spatial index. the default value is null string.
      • setTileField

        public void setTileField(java.lang.String value)
        Sets the field of tile which applies to the tile spatial index. This filed is used for tile spatial index.
        Parameters:
        value - the field of tile which applies to the tile spatial index.
      • getTileWidth

        public double getTileWidth()
        Return the tile width of the spatial index. The unit is the same with the dataset extent.
        Returns:
        the tile width of the spatial index. The unit is the same with the dataset extent.
      • setTileWidth

        public void setTileWidth(double value)
        Set the tile width of the spatial index. The unit is the same with the dataset extent.
        Parameters:
        value - the tile width of the spatial index. The unit is the same with the dataset extent.
      • getTileHeight

        public double getTileHeight()
        Return the tile height of the spatial index. The unit is the same with the dataset extent.
        Returns:
        the tile height of the spatial index. The unit is the same with the dataset extent. The default is 0
      • setTileHeight

        public void setTileHeight(double value)
        Set the tile height of the spatial index. The unit is the same with the dataset extent.
        Parameters:
        value - the tile height of the spatial index. The unit is the same with the dataset extent.
      • getGridCenter

        public Point2D getGridCenter()
        Return the center point of the grid. Generally, the center point is specified with the center point of dataset.
        Returns:
        the center point of the grid. The default is {X = 0,Y = 0}
      • setGridCenter

        public void setGridCenter(Point2D value)
        Set the center point of the grid. Generally, the center point is specified with the center point of dataset.
        Parameters:
        value - the grid index center point.
      • getGridSize0

        public double getGridSize0()
        Returns the size of the first level grid. This parameter can not be zero and unit is identical with the dataset.
        Returns:
        the size of the first level grid. The default is 0.
      • setGridSize0

        public void setGridSize0(double value)
        Sets the size of the first level grid. This parameter can not be zero and unit is identical with the dataset.
        Parameters:
        value - the size of the first level grid from multi-tier grid index.
      • getGridSize1

        public double getGridSize1()
        Return the size of the second level grid. The unit is identical with the dataset.
        Returns:
        the size of the second level grid.
      • setGridSize1

        public void setGridSize1(double value)
        Set the size of the second level grid. The unit is identical with the dataset.
        Parameters:
        value - the size of the second level grid.
      • getGridSize2

        public double getGridSize2()
        Return the size of the third level grid. The unit is identical with the dataset.
        Returns:
        the size of the third level grid. The default is 0.
      • setGridSize2

        public void setGridSize2(double value)
        Set the size of the third level grid. The unit is identical with the dataset.
        Parameters:
        value - the size of the third level grid.
      • toString

        public java.lang.String toString()
        Output spatial index information to strings.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the string of spatial index objects