当前位置: 首页>>代码示例>>C#>>正文


C# IFeatureLayer.Search方法代码示例

本文整理汇总了C#中IFeatureLayer.Search方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureLayer.Search方法的具体用法?C# IFeatureLayer.Search怎么用?C# IFeatureLayer.Search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFeatureLayer的用法示例。


在下文中一共展示了IFeatureLayer.Search方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetDynamicValues


//.........这里部分代码省略.........

                                                            AAState.WriteLine("                  " + intRecFound + " rows found using " + sqlString);

                                                            if (intRecFound != 1)
                                                            {

                                                                pQFilt.WhereClause = sqlStringUpper;

                                                                AAState.WriteLine("                  " + pQFilt.WhereClause + " used to search for matching record");
                                                                if (sourceLayer == null)
                                                                {
                                                                    intRecFound = pTbl.Table.RowCount(pQFilt);
                                                                }
                                                                else
                                                                {
                                                                    intRecFound = sourceLayer.FeatureClass.FeatureCount(pQFilt);
                                                                }
                                                                AAState.WriteLine("                  " + intRecFound + " rows found");

                                                                if (intRecFound == 0)
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain19"));
                                                                    AAState._editor.AbortOperation();
                                                                    return false;

                                                                }

                                                                else
                                                                {
                                                                    AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain20"));
                                                                    ICursor pCurs = null;
                                                                    if (sourceLayer == null)
                                                                    {
                                                                        pCurs = pTbl.Table.Search(pQFilt, true);
                                                                    }
                                                                    else
                                                                    {
                                                                        pCurs = sourceLayer.FeatureClass.Search(pQFilt, true) as ICursor;
                                                                    }

                                                                    pQFilt = null;

                                                                    List<string> pLst = Globals.CursorToList(ref pCurs, sourceFieldNums);
                                                                    if (pCurs != null)
                                                                        Marshal.ReleaseComObject(pCurs);
                                                                    pCurs = null;

                                                                    string disFld = "";
                                                                    for (int j = 0; j < sourceFieldNames.Length - 1; j++)
                                                                    {
                                                                        disFld = disFld == "" ? sourceFieldNames[j] : disFld + "|" + sourceFieldNames[j];

                                                                    }
                                                                    string selectVal = Globals.showOptionsForm(pLst, A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain21") + disFld, ComboBoxStyle.DropDownList);
                                                                    if (selectVal == "||Cancelled||")
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain19"));
                                                                        AAState._editor.AbortOperation();
                                                                        return false;

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain22") + selectVal);
                                                                        string[] strVals = selectVal.Split('|');
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:66,代码来源:AttributeAssistantEditorExtension.cs

示例2: HatchDraw

        //���ƣȣ��ԣã�
        public static void HatchDraw(AxMapControl ppAxMapControl, ISimpleLineSymbol pHatchSymMajor, ISimpleLineSymbol pHatchSymMinor, ITextSymbol pTxtSym, IFeatureLayer pFeatLayer, bool bEnds, bool bEndsOnly, double dHatchLen, double dTxtInterval, double dHatchOffset, double dMajorAngle, bool bOverRideMajor, string graphicslayername)
        {
            //����ͼ��ͼ��ΪSEWER TV���ͼ��
            IFeatureCursor pFeatCursor = pFeatLayer.Search(null, true);
            SetGraphicsLayer(ppAxMapControl, pFeatLayer.Name, graphicslayername);
            //����SEWER TV���ͼ��ͼ��
            IGraphicsContainer pGraphicsContainer = ppAxMapControl.ActiveView.FocusMap.ActiveGraphicsLayer as IGraphicsContainer;
            //���ͼ��ͼ��
            pGraphicsContainer.DeleteAllElements();

            IFeature pFeature = pFeatCursor.NextFeature();
            IPolyline pMajorHatchPL = new PolylineClass();
            IPolyline pMinorHatchPL = new PolylineClass();
            IPolyline pPL;
            IMAware pPLM;
            //IMCollection pMColl;
            IGeometryCollection pGeomColl;
            ILineElement pLineElement;
            IElement pElement = null;
            int cnt;
            IPath pPath;
            string txt;
            double txtlen;
            IPath pTxtPath;
            double angle;
            //IPoint pTxtPt;
            ISegmentCollection pSC;
            ISegment pSeg;
            ISegmentM pSegM;
            double m1 = 0;
            //double m2 = 0;
            //IPoint pFromPt;
            //IMarkerSymbol pMSym;
            IMask pMask;
            ITextElement pTextElement;
            ISegmentCollection pSegment;
            ISegmentCollection pPolyline;
            while (pFeature != null)
            {
                pPL = pFeature.Shape as IPolyline;
                pPLM = pPL as IMAware;
                if (pPLM.MAware)
                {
                    if (bEndsOnly)
                    {
                        MakeHatchesEndsOnly(pPL, bEnds, pMajorHatchPL, pMinorHatchPL, dHatchLen, dTxtInterval, dHatchOffset);
                    }
                    else
                    {

                    }
                    // Draw the major hatches if they are lines
                    if (pHatchSymMajor is ILineSymbol)
                    {
                        pLineElement = new LineElementClass();
                        pLineElement.Symbol = pHatchSymMajor;
                        pElement = pLineElement as IElement;
                        pElement.Geometry = pMajorHatchPL as IGeometry;
                        pGraphicsContainer.AddElement(pElement, 0);
                    }
                    // Draw the major hatches if they are markers and the text...
                    pGeomColl = pMajorHatchPL as IGeometryCollection;
                    cnt = pGeomColl.GeometryCount - 1;
                    for (int j = 0; j <= cnt; j++)
                    {
                        pPath = pGeomColl.get_Geometry(j) as IPath;
                        if (bOverRideMajor)
                            angle = dMajorAngle;
                        else
                            angle = GetAngle(pPath) + dMajorAngle;
                        pSC = pPath as ISegmentCollection;
                        pSeg = pSC.get_Segment(0);
                        pSegM = pSeg as ISegmentM;
                        txt = Convert.ToString(Math.Round(m1, 1));
                        txtlen = pTxtSym.Size;
                        angle = GetAngle(pPath as ICurve);
                        if (ShouldFlip(angle))
                        {
                            pTxtPath = MakeTextPath(pPath, txtlen * 2);
                            angle += 180;
                            pTxtSym.RightToLeft = false;
                            pTxtSym.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
                            pTxtSym.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter;

                        }
                        else
                        {
                            //angle = angle;
                            pTxtPath = MakeTextPath(pPath, txtlen);
                            pTxtSym.RightToLeft = false;
                            pTxtSym.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
                            pTxtSym.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter;
                        }
                        pTxtSym.Angle = angle;
                        //Ϊ�ı�����MASK�����û�з��ţ�����Ϊ����
                        pMask = pTxtSym as IMask;
                        pMask.MaskSize = 2;
                        pMask.MaskStyle = esriMaskStyle.esriMSHalo;

//.........这里部分代码省略.........
开发者ID:lovelll,项目名称:MyDatapreMenu,代码行数:101,代码来源:UtilityFunction.cs

示例3: SearchFeature

        private void SearchFeature(ISpatialFilter pSpatialFilter, IFeatureLayer pFeatureLyr)
        {
            ISpatialFilter pFilter;
            pFilter = pSpatialFilter;
            IFeatureLayer pFeatureLayer;
            pFeatureLayer = pFeatureLyr;
            IFeatureClass pFC = pFeatureLayer.FeatureClass;
            IFeatureCursor pFeatureCursor;
            pFeatureCursor = pFeatureLayer.Search(pFilter, true);

            IFeature pFeature;
            pFeature = pFeatureCursor.NextFeature();
            IGeometry pShape;
            switch (pFC.ShapeType)
            {
                case esriGeometryType.esriGeometryPolyline:
                    while (pFeature != null)
                    {
                        ISimpleLineSymbol pFillsyl;
                        pFillsyl = new SimpleLineSymbolClass();
                        pFillsyl.Color = getRGB(220, 100, 50);
                        object oFillsyl;
                        oFillsyl = pFillsyl;
                        pShape = pFeature.Shape as IPolyline;
                        m_mapControl.FlashShape(pShape, 15, 20, pFillsyl);
                        m_mapControl.DrawShape(pShape, ref oFillsyl);
                        pFeature = pFeatureCursor.NextFeature();
                    }
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    while (pFeature != null)
                    {
                        ISimpleFillSymbol pFillsyl;
                        pFillsyl = new SimpleFillSymbolClass();
                        pFillsyl.Color = getRGB(220, 100, 50);
                        object oFillsyl;
                        oFillsyl = pFillsyl;
                        pShape = pFeature.Shape as IPolygon;
                        m_mapControl.FlashShape(pShape, 15, 20, pFillsyl);
                        m_mapControl.DrawShape(pShape, ref oFillsyl);
                        pFeature = pFeatureCursor.NextFeature();
                    }
                    break;

                case esriGeometryType.esriGeometryPoint:
                    while (pFeature != null)
                    {
                        ISimpleMarkerSymbol pFillsyl;
                        pFillsyl = new SimpleMarkerSymbolClass();
                        pFillsyl.Color = getRGB(220, 100, 50);
                        object oFillsyl;
                        oFillsyl = pFillsyl;
                        pShape = pFeature.Shape as IPoint;
                        m_mapControl.FlashShape(pShape, 15, 20, pFillsyl);
                        m_mapControl.DrawShape(pShape, ref oFillsyl);
                        pFeature = pFeatureCursor.NextFeature();
                    }
                    break;
            }
        }
开发者ID:chinasio,项目名称:minegis,代码行数:61,代码来源:SelectByLocation.cs

示例4: DeleteFeaturesAtPoint

        private static void DeleteFeaturesAtPoint(IFeatureLayer targetLineFLayer, IPoint point, IFeatureLayer targetPointFLayer, int targetLineSubtype, double tolerenceForDelete, bool searchOnLayer)
        {
            ITopologicalOperator topoOp = null;
            IPolygon poly = null;
            ISpatialFilter sFilter = null;
            INetworkClass netClass = null;
            IFeatureClass orphanFC = null;
            INetworkFeature netFeature = null;
            IFeatureCursor fCursor = null;
            IFeature feature = null;
            IPolyline line = null;
            IEdgeFeature edgeFeature = null;
            ISimpleJunctionFeature toJunctionFeature = null;
            ISimpleJunctionFeature fromJunctionFeature = null;
            ISubtypes subt = null;
            try
            {

                topoOp = point as ITopologicalOperator;
                poly = topoOp.Buffer(tolerenceForDelete) as IPolygon;
                sFilter = new SpatialFilterClass();
                sFilter.Geometry = poly;
                sFilter.GeometryField = targetLineFLayer.FeatureClass.ShapeFieldName;
                sFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;

                netClass = targetLineFLayer.FeatureClass as INetworkClass;
                orphanFC = netClass.GeometricNetwork.OrphanJunctionFeatureClass;

                if (searchOnLayer)
                    fCursor = targetLineFLayer.Search(sFilter, false);
                else
                    fCursor = targetLineFLayer.FeatureClass.Search(sFilter, false);

                while ((feature = fCursor.NextFeature()) != null)
                {
                    //Find connecting junctions
                    netFeature = feature as INetworkFeature;
                    if (netFeature != null)
                    {
                        edgeFeature = netFeature as IEdgeFeature;
                        if (edgeFeature != null)
                        {
                            toJunctionFeature = edgeFeature.ToJunctionFeature as ISimpleJunctionFeature;
                            fromJunctionFeature = edgeFeature.ToJunctionFeature as ISimpleJunctionFeature;
                        }
                    }

                    //If subtypes are specified for the new lateral lines, delete only existing laterals with that subtype
                    subt = feature as ISubtypes;
                    line = feature.ShapeCopy as IPolyline;
                    if (targetLineSubtype > -1 && subt != null)
                    {
                        int? thisSubtype = feature.get_Value(subt.SubtypeFieldIndex) as int?;
                        if (thisSubtype != null && thisSubtype == targetLineSubtype)
                        {
                            feature.Delete();

                            DeleteTargetPoints(targetPointFLayer.FeatureClass, line, tolerenceForDelete);
                            DeleteExisitingJunction(toJunctionFeature, targetLineFLayer);
                            DeleteOrphanJunctions(orphanFC, line, tolerenceForDelete);
                        }
                    }

                    //Otherwise, just delete each feature
                    else
                    {
                        feature.Delete();
                        DeleteTargetPoints(targetPointFLayer.FeatureClass, line, tolerenceForDelete);
                        DeleteExisitingJunction(toJunctionFeature, targetLineFLayer);
                        DeleteOrphanJunctions(orphanFC, line, tolerenceForDelete);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("DeleteFeatureAtPoint\r\n" + ex.Message);

            }
            finally
            {

                if (fCursor != null)
                    Marshal.ReleaseComObject(fCursor);
                topoOp = null;
                poly = null;
                sFilter = null;
                netClass = null;
                orphanFC = null;
                netFeature = null;
                fCursor = null;
                feature = null;
                line = null;
                edgeFeature = null;
                toJunctionFeature = null;
                fromJunctionFeature = null;
                subt = null;
            }
        }
开发者ID:tuyndv,项目名称:local-government-desktop-addins,代码行数:98,代码来源:ConstructionTools.cs

示例5: GetPointElevation

        private double GetPointElevation(IFeatureLayer pDepthSoundings, IFeatureLayer pLineLayer, IPoint ppoint, string strDepthField)
        {
            IEnvelope pCombinedEnvelope = CombineExtents(pDepthSoundings.FeatureClass, pLineLayer.FeatureClass);

                //if (IsPointCoincident(ppoint ,pDepthSoundings))
                //{

                IFeatureCursor pDepthCursor = pDepthSoundings.Search(null, false);
                IFeatureIndex2 pFtrInd = new FeatureIndexClass();
                pFtrInd.FeatureClass = pDepthSoundings.FeatureClass;
                pFtrInd.FeatureCursor = pDepthCursor;
                pFtrInd.Index(null, pCombinedEnvelope);
                IIndexQuery2 pIndQry = pFtrInd as IIndexQuery2;

                int FtdID = 0;
                double dDist2Ftr = 0;
                pIndQry.NearestFeature(ppoint, out FtdID, out dDist2Ftr);

                IFeature pCloseFeature = pDepthSoundings.FeatureClass.GetFeature(FtdID);
                return Convert.ToDouble(pCloseFeature.get_Value(pCloseFeature.Fields.FindField(strDepthField)));
                //}
                //else{

                //    return 0;
                //}
        }
开发者ID:chinasio,项目名称:BathymetryTools10,代码行数:26,代码来源:clsDeepInterpolation.cs

示例6: SetDynamicValues


//.........这里部分代码省略.........
                                                                //{
                                                                //    pQFilt.WhereClause = "1=1";
                                                                //}
                                                                //else
                                                                //{
                                                                pQFilt.WhereClause = sqlStringUpper;

                                                                // }
                                                                AAState.WriteLine("                  " + pQFilt.WhereClause + " used to search for matching record");
                                                                if (sourceLayer == null)
                                                                {
                                                                    intRecFound = pTbl.Table.RowCount(pQFilt);
                                                                }
                                                                else
                                                                {
                                                                    intRecFound = sourceLayer.FeatureClass.FeatureCount(pQFilt);
                                                                }
                                                                AAState.WriteLine("                  " + intRecFound + " rows found");

                                                                if (intRecFound == 0)
                                                                {
                                                                    AAState.WriteLine("                     Abort Edit");
                                                                    AAState._editor.AbortOperation();
                                                                    return false;

                                                                }

                                                                else
                                                                {
                                                                    AAState.WriteLine("                  Prompting for user input");
                                                                    ICursor pCurs = null;
                                                                    if (sourceLayer == null)
                                                                    {
                                                                        pCurs = pTbl.Table.Search(pQFilt, true);
                                                                    }
                                                                    else
                                                                    {
                                                                        pCurs = sourceLayer.FeatureClass.Search(pQFilt, true) as ICursor;
                                                                    }

                                                                    pQFilt = null;

                                                                    List<string> pLst = Globals.CursorToList(ref pCurs, sourceFieldNums);
                                                                    if (pCurs != null)
                                                                        Marshal.ReleaseComObject(pCurs);
                                                                    pCurs = null;

                                                                    string selectVal = Globals.showOptionsForm(pLst, "Select an value to store", ComboBoxStyle.DropDownList);
                                                                    if (selectVal == "||Cancelled||")
                                                                    {
                                                                        AAState.WriteLine("                     Abort Edit");
                                                                        AAState._editor.AbortOperation();
                                                                        return false;

                                                                    }
                                                                    else
                                                                    {
                                                                        AAState.WriteLine("                  Value selected: " + selectVal);
                                                                        string[] strVals = selectVal.Split('|');

                                                                        for (int i = 0; i < sourceFieldNums.Length; i++)
                                                                        {
                                                                            inObject.set_Value(intFldIdxs[i], strVals[i]);
                                                                        }

                                                                    }
开发者ID:riordabr,项目名称:3d-cities-template,代码行数:67,代码来源:AttributeAssistantEditorExtension.cs

示例7: GetSeartchFeatures

 /// <summary>
 /// ��ȡ��ѯҪ��
 /// </summary>
 /// <param name="pFeatureLayer">Ҫ��ͼ��</param>
 /// <param name="pGeometry">ͼ�η�Χ����</param>
 /// <returns>��������Ҫ�ؼ���</returns>
 public List<IFeature> GetSeartchFeatures(IFeatureLayer pFeatureLayer, IGeometry pGeometry)
 {
     try
     {
         List<IFeature> pList = new List<IFeature>();
         //����SpatialFilter�ռ����������
         ISpatialFilter pSpatialFilter = new SpatialFilterClass();
         IQueryFilter pQueryFilter = pSpatialFilter as ISpatialFilter;
         //���ù�������Geometry
         pSpatialFilter.Geometry = pGeometry;
         //���ÿռ��ϵ����
         pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;
         //��ȡFeatureCursor�α�
         IFeatureCursor pFeatureCursor = pFeatureLayer.Search(pQueryFilter, false);
         //����FeatureCursor
         IFeature pFeature = pFeatureCursor.NextFeature();
         while (pFeature != null)
         {
             //��ȡҪ�ض���
             pList.Add(pFeature);
             pFeature = pFeatureCursor.NextFeature();
         }
         System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);
         return pList;
     }
     catch (Exception Err)
     {
         MessageBox.Show(Err.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return null;
     }
 }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:37,代码来源:ArcGisPublic.cs

示例8: GetStartElevation

        private double GetStartElevation(IFeatureLayer pDepthSoundings, IFeatureLayer pLineLayer, IFeature pLineFeature, string DepthPointDepthField)
        {
            IEnvelope pCombinedEnvelope = CombineExtents(pDepthSoundings.FeatureClass, pLineLayer.FeatureClass);

            IFeatureCursor pDepthCursor = pDepthSoundings.Search(null, false);
            IFeatureIndex2 pFtrInd = new FeatureIndexClass();
            pFtrInd.FeatureClass = pDepthSoundings.FeatureClass;
            pFtrInd.FeatureCursor = pDepthCursor;
            pFtrInd.Index(null, pCombinedEnvelope);
            IIndexQuery2 pIndQry = pFtrInd as IIndexQuery2;

            int FtdID = 0;
            double dDist2Ftr = 0;
            pIndQry.NearestFeature(pLineFeature.Shape, out FtdID, out dDist2Ftr);

            IFeature pCloseFeature = pDepthSoundings.FeatureClass.GetFeature(FtdID);
            return Convert.ToDouble(pCloseFeature.get_Value(pCloseFeature.Fields.FindField(DepthPointDepthField)));
        }
开发者ID:chinasio,项目名称:BathymetryTools10,代码行数:18,代码来源:clsInterpFunctions.cs

示例9: AttributeQuery

        private void AttributeQuery()
        {
            //定义图层,要素游标,查询过滤器,要素
            IFeatureCursor pFeatureCursor;
            IQueryFilter pQueryFilter;
            IFeature pFeature;
            IPoint pPoint;
            IEnvelope pEnv;
            pEnv = Global.mainmap.ActiveView.Extent;
            pPoint = new PointClass();

            pPoint.X = pEnv.XMin + pEnv.Width / 2;
            pPoint.Y = pEnv.YMin + pEnv.Height / 2;
            if (Global.mainmap.LayerCount <= 0)
                return;
            //获取图层
            mFeatureLayer = Global.mainmap.get_Layer(0) as IFeatureLayer;
            //清除上次查询结果
            Global.mainmap.Map.ClearSelection();
            Global.mainmap.ActiveView.Refresh();
            //pQueryFilter的实例化
            pQueryFilter = new QueryFilterClass();
            //设置查询过滤条件
            pQueryFilter.WhereClause = "NAME" + "='" + Global.keyword + "'";
            //查询
            pFeatureCursor = mFeatureLayer.Search(pQueryFilter, true);
            //获取查询到的要素
            pFeature = pFeatureCursor.NextFeature();

            Global.ifeature = pFeature;

            //判断是否获取到要素
            if (pFeature != null)
            {
                //选择要素
                Global.mainmap.Map.SelectFeature(mFeatureLayer, pFeature);
                //放大到要素

                pFeature.Shape.Envelope.CenterAt(pPoint);
                Global.mainmap.Extent = pFeature.Shape.Envelope;

            }
            else
            {
                //没有得到pFeature的提示
                MessageBox.Show("没有找到相关要素!", "提示");
            }
        }
开发者ID:gistop,项目名称:aegis,代码行数:48,代码来源:Home.cs

示例10: selectfeature

        //筛选函数
        private IFeatureClass selectfeature(IFeatureLayer featureLayer, string whereclause)
        {
            IFeatureClass featureclass = null;
            try
            {

                IQueryFilter pQueryFilter = new QueryFilterClass();
                IFeatureCursor pFeatureCursor = featureLayer.Search(pQueryFilter, false);
                IFeature pFeature = pFeatureCursor.NextFeature();
                // while (pFeature != null)//遍历线图层的name,将线图层中的name和点图层中的lineName加入选择集并对两个选择集进行near,勾选location生成nearX和nearY
                // {
                IFeatureSelection featureSelection = featureLayer as IFeatureSelection;

                //string name = pFeature.get_Value(2).ToString();//线图层的name字段
                pQueryFilter.WhereClause = whereclause;// string.Format("name='{0}'", name);
                featureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);//选择线路名为name的线要素


                featureLayer = featureSelection as IFeatureLayer;

                //这里这样写是不时就选好了那个WhereClause  另一个也是这么执行的 就是想当于你选好的  输入同的参数选择不同的  你稍等我下
                //pFeature = pFeatureCursor.NextFeature();
                //  }
                ESRI.ArcGIS.DataManagementTools.CopyFeatures copyFeatures = new CopyFeatures();
                copyFeatures.in_features = featureLayer.FeatureClass;
                copyFeatures.out_feature_class = @"D:\测试\searchResult1.shp";
                gp.OverwriteOutput = true;
                gp.Execute(copyFeatures, null);
                //featureclass = featureLayer.FeatureClass;



                return featureclass;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }
        }
开发者ID:AgentWord,项目名称:DataConverV2.0,代码行数:41,代码来源:DataConverTool.cs

示例11: WalkLine

        private IFeature WalkLine(IFeatureLayer pDepthSoundings, IFeatureLayer pLineLayer, IFeature pLineFeature)
        {
            try
            {
                IEnvelope pCombinedEnvelope = CombineExtents(pDepthSoundings.FeatureClass, pLineLayer.FeatureClass);

                IPointCollection4 pPointColl = pLineFeature.Shape as IPointCollection4;
                IPoint ppoint = new PointClass();

                IFeatureCursor pDepthCursor = pDepthSoundings.Search(null, false);
                IFeatureIndex2 pFtrInd = new FeatureIndexClass();
                pFtrInd.FeatureClass = pDepthSoundings.FeatureClass;
                pFtrInd.FeatureCursor = pDepthCursor;
                pFtrInd.Index(null, pCombinedEnvelope);
                IIndexQuery2 pIndQry = pFtrInd as IIndexQuery2;

                int FtdID = 0;
                double dDist2Ftr = 0;
                pIndQry.NearestFeature(ppoint, out FtdID, out dDist2Ftr);

                IFeature pCloseFeature = pDepthSoundings.FeatureClass.GetFeature(FtdID);
                return pCloseFeature;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                MessageBox.Show(ex.StackTrace);
                return null;
            }
        }
开发者ID:chinasio,项目名称:BathymetryTools10,代码行数:31,代码来源:clsAutoInterpolate.cs

示例12: GetStartElevation

        private double GetStartElevation(IFeatureLayer pDepthSoundings, IFeatureLayer pLineLayer, IFeature pLineFeature, string strDepthField)
        {
            try
            {
                IEnvelope pCombinedEnvelope = CombineExtents(pDepthSoundings.FeatureClass, pLineLayer.FeatureClass);

                IPointCollection4 pPointColl = pLineFeature.Shape as IPointCollection4;
                IPoint ppoint = new PointClass();

                //pPointColl.QueryPoint(0, ppoint);

                ppoint = pPointColl.get_Point(0);

                IFeatureCursor pDepthCursor = pDepthSoundings.Search(null, false);
                IFeatureIndex2 pFtrInd = new FeatureIndexClass();
                pFtrInd.FeatureClass = pDepthSoundings.FeatureClass;
                pFtrInd.FeatureCursor = pDepthCursor;
                pFtrInd.Index(null, pCombinedEnvelope);
                IIndexQuery2 pIndQry = pFtrInd as IIndexQuery2;

                int FtdID = 0;
                double dDist2Ftr = 0;
                pIndQry.NearestFeature(ppoint, out FtdID, out dDist2Ftr);

                IFeature pCloseFeature = pDepthSoundings.FeatureClass.GetFeature(FtdID);
                return Convert.ToDouble(pCloseFeature.get_Value(pCloseFeature.Fields.FindField(strDepthField)));
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                MessageBox.Show(ex.StackTrace);
                return 0;
            }
        }
开发者ID:chinasio,项目名称:BathymetryTools10,代码行数:35,代码来源:clsAutoInterpolate.cs

示例13: SearchHightlight

        void SearchHightlight(IMap _pMap,IFeatureLayer _pFeatureLayer, IQueryFilter _pQuery, bool _Bool)
        {
            IFeatureCursor pFtCursor = _pFeatureLayer.Search(_pQuery, _Bool);

            IFeature pFt = pFtCursor.NextFeature();

            while (pFt != null)
            {
                _pMap.SelectFeature(_pFeatureLayer as ILayer, pFt);

                pFt = pFtCursor.NextFeature();

            }
        }
开发者ID:esrichina,项目名称:Engine10DevApplication,代码行数:14,代码来源:MainForm.cs


注:本文中的IFeatureLayer.Search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。