• C#+AE 对于做属性查询的一定总结


    本人刚做了有关属性查询的一些功能的实现,在这总结一下。

    有错误之处和不专业之处还希望GIS和AE开发的高手们给以指点。

    //******其中第二部分发生了点错误,现在已更改***********//

    ①:据FeatureLayer得到Feature的方法:

    代码如下:

                    ILayer pLayer;
                    pLayer = frm1.axMapControl1.Map.get_Layer(LayerBoxEdit.SelectedIndex) as ILayer;//frm1和LayerBoxEdit.SelectedIndex都是变量
                    IFeatureLayer pFeatureLayer;
                    pFeatureLayer = pLayer as IFeatureLayer;
                    if (pFeatureLayer == null)
                    {
                        return;
                    }

                   
                  
                    IFeatureCursor pFeatureCursor;
                    pFeatureCursor = pFeatureLayer.Search(null, false);
                    IFeature pFeature;
                    pFeature = pFeatureCursor.NextFeature();

    ②:据FeatureClass得到Feature的方法:

                

     IFeatureLayer pFeatureLayer;
                    pFeatureLayer = frm1.axMapControl1.Map.get_Layer(0) as IFeatureLayer;
                    IFeatureClass pFeatureClass;
                    pFeatureClass = pFeatureLayer.FeatureClass;
                    IQueryFilter pQueryFilter;
                    pQueryFilter = new QueryFilterClass();
                  //  pQueryFilter.WhereClause = "";

                    IFeature pFeature;

             for(int j=0;j< pFeatureClass.FeatureCount(pQueryFilter); j++)

                {

                     pFeature = pFeatureClass.GetFeature(j);
                }

                  ③:在TreeList中点击子节点得到Feature的方法:

                          

      if (e.Node.HasChildren)
                    {
                        return;
                    }

    if (!(e.Node.HasChildren)) //***********//这个存在bug,若节点超过两级则出错
                    {

                 

     for (int i = 0; i < this.axMapControl1.LayerCount; i++)
                        {

                            //如果父节点名称和图层名相同,获取索引
                            if (e.Node.ParentNode.GetValue(0).ToString() == this.axMapControl1.get_Layer(i).Name)
                            {
                                layerIndex = i;
                                IFeature pFeature;                             
     
                               pFeature = (this.axMapControl1.get_Layer(layerIndex) as IFeatureLayer).FeatureClass.GetFeature(int.Parse(this.treeList1.FocusedNode.GetValue(0).ToString())); ;

                             }

                         }

  • 相关阅读:
    设计模式(观察者模式,MVC模式)
    设计模式(单例,委托模式)
    iOS API
    iOS介绍
    多种服饰颜色搭配
    国内npm镜像使用
    iOS开发拓展篇—应用之间的跳转和数据传
    iOS开发网络篇—使用ASI框架进行文件下载
    iOS开发网络篇—数据缓存(使用NSURLCache)
    iOS开发网络篇—发送json数据给服务器以及多值参数
  • 原文地址:https://www.cnblogs.com/yanhan/p/2706860.html
Copyright © 2020-2023  润新知