zoukankan      html  css  js  c++  java
  • Delphi版 ArcEngine 根据属性查询要素

    function SearchByPropInfo(pLayer: ILayer; sWhere: string; out iCounts: Integer): IFeatureCursor;
    var
       pQueryFilter: IQueryFilter;
       pFeatureLayer: IFeatureLayer;
       pFeatureSelection: IFeatureSelection;

       pSymbol  : ISymbol;
       pFillSymbol: ISimpleFillSymbol;
       pLineSymbol: ISimpleLineSymbol;
       pMarkerSymbol: ISimpleMarkerSymbol;

       pColor   : IRgbColor;
    begin
       pFeatureLayer := pLayer as IFeatureLayer;

       pQueryFilter := CoQueryFilter.Create as IQueryFilter;
       pQueryFilter.WhereClause := sWhere;

       Result := pFeatureLayer.Search(pQueryFilter, False);

       pColor := CoRgbColor.Create as IRgbColor;
       pColor := getRGB(0, 255, 255, 255);
       //得到图层要素的几何类型
       case pFeatureLayer.FeatureClass.ShapeType of
          esriGeometryPoint, esriGeometryMultipoint:
             begin
                pMarkerSymbol := CoSimpleMarkerSymbol.Create as ISimpleMarkerSymbol;
                pMarkerSymbol.Color := pColor as IColor;
                pMarkerSymbol.Style := esriSMSCircle;

                pSymbol := pMarkerSymbol as ISymbol;
             end;
          esriGeometryPolygon:
             begin
                pFillSymbol := CoSimpleFillSymbol.Create as ISimpleFillSymbol;
                pFillSymbol.Color := pColor as IColor;
                pFillSymbol.Style := esriSFSDiagonalCross;

                pSymbol := pFillSymbol as ISymbol;
             end;
          esriGeometryPolyline:
             begin
                pLineSymbol := CoSimpleLineSymbol.Create as ISimpleLineSymbol;
                pLineSymbol.Color := pColor as IColor;
                pLineSymbol.Style := esriSLSSolid;
                pLineSymbol.Width := 2;
                pSymbol := pLineSymbol as ISymbol;
             end;
       end;

       pFeatureSelection := pLayer as IFeatureSelection;
       pFeatureSelection.SetSelectionSymbol := True;
       pFeatureSelection.SelectionSymbol := pSymbol;
       pFeatureSelection.SelectFeatures(pQueryFilter, esriSelectionResultNew, False);
       //得到被选的要素的个数
       iCounts := pFeatureSelection.SelectionSet.Count;
    end;
  • 相关阅读:
    docker 介绍,安装,镜像操作, docker换源
    go语言5 接口, 并发与并行, go协程, 信道, 缓冲信道, 异常处理, python进程线程
    [编织消息框架]目录
    2017总结
    赚钱方法[信息红利]
    面单 全单 单板 批发吉他民谣 知乎 百度知道 百度贴吧 吉他批发
    看第三部杀破狼感想
    海豚极货店 淘宝店开张啦
    我上头条了
    尤克里里 ukulele 单板 非kaka tom uma
  • 原文地址:https://www.cnblogs.com/chinacodegear/p/1414745.html
Copyright © 2011-2022 走看看