zoukankan      html  css  js  c++  java
  • arcgis engine空间查询与属性查询的主要代码 (转)

    转自:http://blog.csdn.net/qinyilang/article/details/6321079


    属性查询是在当前map的layer中获取符合条件的feature的集合,实现过程是获取featurelayer的featureclass。然后定义过滤条件。在featureclass中执行search函数。获取查询结果。主要代码:

    ILayer layer = axMapControl1.get_Layer(0);
    IFeatureLayer featureLayer = layer as IFeatureLayer;
    //获取featureLayer的featureClass
    IFeatureClass featureClass = featureLayer.FeatureClass;
    IFeature feature = null;

    IQueryFilter queryFilter = new QueryFilterClass();

    IFeatureCursor featureCusor;
    queryFilter.WhereClause = "name = '" + searchName + "'";
    featureCusor = featureClass.Search(queryFilter, true);

    //search的参数第一个为过滤条件,第二个为是否重复执行。

    feature = featureCusor.NextFeature();

    if (feature != null)
    {
    axMapControl1.Map.SelectFeature(axMapControl1.get_Layer(0), feature);
    axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
    }

    空间查询实现起来比较简单,使用arcgis封装好的函数即可,主要是获取选取的geometry对象:

    axMapControl1.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerCrosshair;
    IGeometry geometry = null;
    switch (actionFlag)
    {
    case flag.POINTSELECT://点选
    ESRI.ArcGIS.Geometry.Point pt = new ESRI.ArcGIS.Geometry.Point();
    pt.X = e.mapX;
    pt.Y = e.mapY;
    geometry = pt as IGeometry;
    break;
    case flag.CIRCLESELECT://圆选
    geometry = axMapControl1.TrackCircle();
    break;
    case flag.RECTSELECT://长方形选取
    geometry = axMapControl1.TrackRectangle();
    break;
    case flag.POLYGONSELECT://多边形选取
    geometry = axMapControl1.TrackPolygon();
    break;
    }
    axMapControl1.Map.SelectByShape(geometry, null, false);
    axMapControl1.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);


    from:http://blog.csdn.net/zzjiadw/article/details/7669382
  • 相关阅读:
    Linux (x86) Exploit 开发系列教程之三(Off-By-One 漏洞 (基于栈))
    Linux (x86) Exploit 开发系列教程之二(整数溢出)
    Linux (x86) Exploit 开发系列教程之一(典型的基于堆栈的缓冲区溢出)
    Linux (x86) Exploit 开发系列教程之四(使用return-to-libc绕过NX bit)
    xss level11
    f.select
    jquery.backstretch
    linux目录或文件权限
    pradino 命令
    Padrino 博客开发示例
  • 原文地址:https://www.cnblogs.com/yuxuetaoxp/p/2751037.html
Copyright © 2011-2022 走看看