用于居中显示记录集对应的若干空间对象,并通过设置 ratio来指定显示的比率。地图当前显示范围的中心点始终为包含记录集中的所有记录所对应的空间对象的最小外接矩形所构成的最小矩形的中心点。操作成功返回 true。

命名空间:  SuperMap.Mapping
程序集:  SuperMap.Mapping (in SuperMap.Mapping)
版本: dll

语法

C#
public bool EnsureVisible(
	Recordset recordset,
	double ratio
)

参数

recordset
Type: SuperMap.Data..::.Recordset
需要居中显示的几何对象所对应的记录集。
ratio
Type: System..::.Double
指定的显示比率,默认值为1.0,该比率对点对象无效。

返回值

成功返回true,失败返回false。

示例

以下代码示范了如何按照一定比率显示某部分记录。 假设打开了一个工作空间workspace对象,工作空间中存在一幅地图并已被打开。
CopyC#
private void ButtonEnsureVisibleRecordset_Click(Object sender, EventArgs e)
{

    //设定显示比率
    Double ratio = 1.0;
    String queryString = "smid>=5";

    //从地图中的给定图层中按照给定的查询条件查询得到记录集
    Layer layer = map.Layers[0];
    DatasetVector dataset = layer.Dataset as DatasetVector;
    Recordset recordset = dataset.Query(queryString, CursorType.Static);

    //按照给定比率显示得到的记录集
    map.EnsureVisible(recordset, ratio);
    map.Refresh();

    //释放资源
    recordset.Dispose();

}

请参见