com.supermap.data

类 SpatialIndexInfo

  • java.lang.Object
    • com.supermap.data.InternalHandle
      • com.supermap.data.InternalHandleDisposable
        • com.supermap.data.SpatialIndexInfo
  • 所有已实现的接口:
    IDisposable


    public class SpatialIndexInfo
    extends com.supermap.data.InternalHandleDisposable
    空间索引信息类。

    该类提供了创建空间索引的所需信息,包括空间索引的类型、叶结点个数、图幅字段、图幅宽高和多级网格的大小等信息。

    示范代码:
    以下代码示范如何为数据集创建索引。
     public void spatialIndexInfoTest(){
            // 假设打开一个工作空间 workspace 对象,工作空间中存在一个数据库型数据源 datasource 对象
            // 取出该数据源中一个没有空间索引的数据集 dataset
            // 构造一个空间索引信息对象
            DatasetVector dataset = (DatasetVector) datasource.getDatasets().get(
                    "world");
            SpatialIndexInfo spatialIndexInfo = new SpatialIndexInfo();
    
            // 设置空间索引信息对象的信息
            spatialIndexInfo.setGridCenter(dataset.getBounds().getCenter());
            spatialIndexInfo.setGridSize0(10000);
            spatialIndexInfo.setGridSize1(2500);
            spatialIndexInfo.setGridSize2(625);
            spatialIndexInfo.setType(SpatialIndexType.MULTI_LEVEL_GRID);
            System.out.println("空间索引信息为: " + spatialIndexInfo.toString());
    
            // 为数据集创建索引
            dataset.buildSpatialIndex(spatialIndexInfo);
        }
     
    • 构造器详细资料

      • SpatialIndexInfo

        public SpatialIndexInfo()
        构造一个新的 SpatialIndexInfo 对象。
      • SpatialIndexInfo

        public SpatialIndexInfo(SpatialIndexType type)
        根据指定的参数来构造一个 SpatialIndexInfo 的新对象。
        参数:
        type - 指定的空间索引类型,有关详情请参见 SpatialIndexType 枚举类。
      • SpatialIndexInfo

        public SpatialIndexInfo(int leafObjectCount)
        根据指定的参数来构造一个 SpatialIndexInfo 的新对象。
        参数:
        leafObjectCount - 指定的叶结点的个数。
      • SpatialIndexInfo

        public SpatialIndexInfo(String tileField)
        根据指定的参数来构造一个 SpatialIndexInfo 的新对象。
        参数:
        tileField - 指定的图幅字段对象。
      • SpatialIndexInfo

        public SpatialIndexInfo(double tileWidth,
                                double tileHeight)
        根据指定的参数来构造一个 SpatialIndexInfo 的新对象。
        参数:
        tileWidth - 指定的图幅宽度。单位与数据集范围的单位一致。
        tileHeight - 指定的图幅高度。单位与数据集范围的单位一致。
      • SpatialIndexInfo

        public SpatialIndexInfo(Point2D gridCenter,
                                double gridSize0,
                                double gridSize1,
                                double gridSize2)
        根据指定的参数来构造一个 SpatialIndexInfo 的新对象。
        参数:
        gridCenter - 指定的网格中心点。
        gridSize0 - 指定的一级网格的大小。单位与数据集同。
        gridSize1 - 指定的二级网格的大小。单位与数据集同。
        gridSize2 - 指定的三级网格的大小。单位与数据集同。
      • SpatialIndexInfo

        public SpatialIndexInfo(SpatialIndexInfo spatialIndexInfo)
        根据给定的 SpatialIndexInfo 对象构造一个与其完全相同的新对象。
        参数:
        spatialIndexInfo - 索引信息类对象。
    • 方法详细资料

      • dispose

        public void dispose()
        释放该对象所占用的资源。当调用该方法之后,此对象不再可用。
      • clone

        public SpatialIndexInfo clone()
        克隆当前 SpatialIndexInfo 对象,返回一个完全相同的 SpatialIndexInfo 新对象。
        覆盖:
        clone 在类中 Object
        返回:
        空间索引信息对象。
      • setType

        public void setType(SpatialIndexType type)
        设置空间索引的类型。

        有关空间索引类型的详情,请参见 SpatialIndexType 枚举类。

        参数:
        type - 空间索引的类型。
      • getLeafObjectCount

        public int getLeafObjectCount()
        返回 R 树空间索引中叶结点的个数。
        返回:
        R 树空间索引中叶结点的个数。
        默认值:
        默认值为 -1。
      • setLeafObjectCount

        public void setLeafObjectCount(int value)
        设置 R 树空间索引中叶结点的个数。
        参数:
        value - R 树空间索引中叶结点的个数。
      • getTileField

        @Deprecated
        public String getTileField()
        已过时。 返回空间索引的图幅字段。该字段用于图幅空间索引。
        返回:
        空间索引的图幅字段。
        默认值:
        默认值为空字符串。
      • setTileField

        @Deprecated
        public void setTileField(String value)
        已过时。 设置空间索引的图幅字段。该字段用于图幅空间索引。
        参数:
        value - 空间索引的图幅字段。
      • getTileWidth

        public double getTileWidth()
        返回空间索引的图幅宽度。单位与数据集范围的单位一致。
        返回:
        空间索引的图幅宽度。单位与数据集范围的单位一致。
        默认值:
        默认值为 0。
      • setTileWidth

        public void setTileWidth(double value)
        设置空间索引的图幅宽度。单位与数据集范围的单位一致。
        参数:
        value - 空间索引的图幅宽度。单位与数据集范围的单位一致。
      • getTileHeight

        public double getTileHeight()
        返回空间索引的图幅高度。单位与数据集范围的单位一致。
        返回:
        空间索引的图幅高度。单位与数据集范围的单位一致。
        默认值:
        默认值为 0。
      • setTileHeight

        public void setTileHeight(double value)
        设置空间索引的图幅高度。单位与数据集范围的单位一致。
        参数:
        value - 空间索引的图幅高度。单位与数据集范围的单位一致。
      • getGridCenter

        public Point2D getGridCenter()
        返回网格索引的中心点。一般为数据集的中心点。
        返回:
        网格索引的中心点。
        默认值:
        默认值为 {X = 0,Y = 0}。
      • setGridCenter

        public void setGridCenter(Point2D value)
        设置网格索引的中心点。一般为数据集的中心点。
        参数:
        value - 网格索引的中心点。
      • getGridSize0

        public double getGridSize0()
        返回多级网格索引的第一层网格的大小。此参数不能为 0。单位与数据集的单位一致。
        返回:
        多级网格索引的第一层网格的大小。
        默认值:
        默认值为 0。
      • setGridSize0

        public void setGridSize0(double value)
        设置多级网格索引的第一层网格的大小。此参数不能为 0。单位与数据集的单位一致。
        参数:
        value - 多级网格索引的第一层网格的大小。
      • getGridSize1

        public double getGridSize1()
        返回多级网格索引的第二级索引网格的大小。单位与数据集的单位一致。
        返回:
        多级网格索引的第二级索引网格的大小。
        默认值:
        默认值为 0。
      • setGridSize1

        public void setGridSize1(double value)
        设置多级网格索引的第二级索引网格的大小。单位与数据集的单位一致。
        参数:
        value - 多级网格索引的第二级索引网格的大小。
      • getGridSize2

        public double getGridSize2()
        返回多级网格索引的第三级索引网格的大小。单位与数据集的单位一致。
        返回:
        多级网格索引的第三级索引网格的大小。
        默认值:
        默认值为 0。
      • setGridSize2

        public void setGridSize2(double value)
        设置多级网格索引的第三级索引网格的大小。单位与数据集的单位一致。
        参数:
        value - 多级网格索引的第三级索引网格的大小。
      • toString

        public String toString()
        将空间索引信息对象输出为字符串。
        覆盖:
        toString 在类中 Object
        返回:
        表示空间索引信息对象的字符串。

Copyright © 2021–2024 SuperMap. All rights reserved.