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


C# ESRI.Search方法代码示例

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


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

示例1: GetFeaturesWithCoincidentVertices

        /// <summary>
        /// Returns all features from a given feature class that have a vertex or endpoint coincident with a given point 
        /// </summary>
        /// <param name="point">IPoint to use as the spatial filter</param>
        /// <param name="searchFtClass">IFeatureClass to search in</param>
        /// <param name="linearEndpointsOnly">Flag to use only the endpoints of a line instead of all vertices</param>
        /// <param name="buffer">Search geometry buffer in map units</param>
        /// <returns>List of IFeature</returns>
        public static List<ESRI.ArcGIS.Geodatabase.IFeature> GetFeaturesWithCoincidentVertices(ESRI.ArcGIS.Geometry.IPoint point, ESRI.ArcGIS.Geodatabase.IFeatureClass searchFtClass, bool linearEndpointsOnly, double buffer)
        {
            List<ESRI.ArcGIS.Geodatabase.IFeature> result = new List<ESRI.ArcGIS.Geodatabase.IFeature>();

            using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
            {
                ESRI.ArcGIS.Geodatabase.ISpatialFilter filter = new ESRI.ArcGIS.Geodatabase.SpatialFilterClass();
                releaser.ManageLifetime(filter);

                ESRI.ArcGIS.Geometry.IEnvelope filterGeometry = point.Envelope;
                if (0 < buffer)
                {
                    filterGeometry.Expand(buffer, buffer, false);
                }

                filter.SpatialRel = ESRI.ArcGIS.Geodatabase.esriSpatialRelEnum.esriSpatialRelIntersects;
                filter.Geometry = filterGeometry;

                ESRI.ArcGIS.Geodatabase.IFeatureCursor fts = searchFtClass.Search(filter, false);
                releaser.ManageLifetime(fts);

                ESRI.ArcGIS.Geodatabase.IFeature ft = fts.NextFeature();
                while (null != ft)
                {
                    if (searchFtClass.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
                    {
                        result.Add(ft);
                    }
                    else if (searchFtClass.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline && linearEndpointsOnly)
                    {
                        ESRI.ArcGIS.Geometry.IPolyline polyline = (ESRI.ArcGIS.Geometry.IPolyline)ft.Shape;
                        ESRI.ArcGIS.Geometry.IRelationalOperator fromPoint = polyline.FromPoint as ESRI.ArcGIS.Geometry.IRelationalOperator;
                        ESRI.ArcGIS.Geometry.IRelationalOperator toPoint = polyline.ToPoint as ESRI.ArcGIS.Geometry.IRelationalOperator;

                        if (fromPoint.Equals(point) || toPoint.Equals(point))
                        {
                            result.Add(ft);
                        }
                    }
                    else
                    {
                        ESRI.ArcGIS.Geometry.IPointCollection pointCollection = ft.Shape as ESRI.ArcGIS.Geometry.IPointCollection;
                        if (null != pointCollection)
                        {
                            for (int i = 0; i < pointCollection.PointCount; i++)
                            {
                                ESRI.ArcGIS.Geometry.IRelationalOperator testPoint = pointCollection.get_Point(i) as ESRI.ArcGIS.Geometry.IRelationalOperator;
                                if (testPoint.Equals(point))
                                {
                                    result.Add(ft);
                                    break;
                                }
                            }
                        }
                    }

                    ft = fts.NextFeature();
                }
            }

            return result;
        }
开发者ID:rkBiswal,项目名称:utilities-telecom-desktop-addins,代码行数:70,代码来源:GdbUtils.cs

示例2: getDictionaryValues

 private static Dictionary<string, double[][]> getDictionaryValues(ESRI.ArcGIS.Geodatabase.IFeatureClass pointFtr, ESRI.ArcGIS.Geodatabase.IField[] fldsToSummarize, IFunctionRasterDataset strataRaster, geoDatabaseUtility geoUtil, rasterUtil rsUtil)
 {
     IRaster2 rs2 = (IRaster2)rsUtil.createRaster(strataRaster);
     int[] ptfldIndex = new int[fldsToSummarize.Length];
     for (int i = 0; i < ptfldIndex.Length; i++)
     {
         ptfldIndex[i] = pointFtr.FindField(fldsToSummarize[i].Name);
     }
     Dictionary<string, double[][]> outDic = new Dictionary<string, double[][]>();
     IFeatureCursor sCur = pointFtr.Search(null, true);
     IFeature sFtr = sCur.NextFeature();
     while (sFtr != null)
     {
         IGeometry geo = sFtr.Shape;
         IPoint pnt = (IPoint)geo;
         int clm, rw;
         rs2.MapToPixel(pnt.X, pnt.Y,out clm, out rw);
         object strataVlObj = rs2.GetPixelValue(0, clm, rw);
         if(strataVlObj!=null)
         {
             string strataVl = strataVlObj.ToString();
             double[][] vlArr;
             if (outDic.TryGetValue(strataVl, out vlArr))
             {
                 for (int i = 0; i < ptfldIndex.Length; i++)
                 {
                     object vlObj = sFtr.get_Value(ptfldIndex[i]);
                     if (vlObj != null)
                     {
                         double vl = System.Convert.ToDouble(vlObj);
                         vlArr[i][0] += vl;
                         vlArr[i][1] += (vl * vl);
                         vlArr[i][2] += 1;
                     }
                 }
             }
             else
             {
                 vlArr = new double[fldsToSummarize.Length][];
                 for (int i = 0; i < ptfldIndex.Length; i++)
                 {
                     double[] vlSumArr = new double[3];
                     object vlObj =sFtr.get_Value(ptfldIndex[i]);
                     if (vlObj != null)
                     {
                         double vl =  System.Convert.ToDouble(vlObj);
                         vlSumArr[0] = vl;
                         vlSumArr[1] = (vl * vl);
                         vlSumArr[2] = 1;
                     }
                     vlArr[i] = vlSumArr;
                 }
                 outDic[strataVl] = vlArr;
             }
         }
         sFtr = sCur.NextFeature();
     }
     System.Runtime.InteropServices.Marshal.ReleaseComObject(sCur);
     return outDic;
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:60,代码来源:fiaIntegration.cs

示例3: GetNextSplice

        /// <summary>
        /// Looks for a fiber splice record at one end of a given cable
        /// </summary>
        /// <param name="fiberSpliceTable">Fiber splice table</param>
        /// <param name="cableId">Cable ID of the cable we are checking</param>
        /// <param name="fiberNumber">Fiber Number we are checking</param>
        /// <param name="checkFromEnd">Which end of the cable are we checking?</param>
        /// <param name="nextCableId">(out) Cable ID of the cable spliced on this end, or string.Empty if none</param>
        /// <param name="nextFiberNumber">(out) Fiber Number of spliced on this end, or -1 if none</param>
        /// <param name="spliceClosureIpid">(out) IPID of Splice Closure</param>
        /// <param name="isNextFromEnd">(out) Is the result cable spliced on its from end or its to end?</param>
        /// <returns>The splice record</returns>
        private ESRI.ArcGIS.Geodatabase.IRow GetNextSplice(ESRI.ArcGIS.Geodatabase.ITable fiberSpliceTable, string cableId, int fiberNumber, bool checkFromEnd, out string nextCableId, out int nextFiberNumber, out string spliceClosureIpid, out bool isNextFromEnd)
        {
            ESRI.ArcGIS.Geodatabase.IRow spliceRow = null;

            spliceClosureIpid = string.Empty;
            nextCableId = cableId;
            nextFiberNumber = fiberNumber;
            isNextFromEnd = checkFromEnd;

            using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
            {
                ESRI.ArcGIS.Geodatabase.IQueryFilter filter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
                filter.WhereClause = string.Format("({0}='{1}' AND {2}={3} AND {4}='{5}')"
                    + " OR ({6}='{1}' AND {7}={3} AND {8}='{5}')",
                    ConfigUtil.ACableIdFieldName,
                    cableId,
                    ConfigUtil.AFiberNumberFieldName,
                    fiberNumber,
                    ConfigUtil.IsAFromEndFieldName,
                    (checkFromEnd ? "T" : "F"),
                    ConfigUtil.BCableIdFieldName,
                    ConfigUtil.BFiberNumberFieldName,
                    ConfigUtil.IsBFromEndFieldName);

                releaser.ManageLifetime(filter);

                // TODO: should we give a warning if the rowcount is more than 1? We should technically only find one splice
                // record on this end of the fiber...

                ESRI.ArcGIS.Geodatabase.ICursor search = fiberSpliceTable.Search(filter, false);
                releaser.ManageLifetime(search);

                spliceRow = search.NextRow();
                if (null != spliceRow)
                {
                    object scIpidValue = spliceRow.get_Value(_spliceClosureIpidIdx);
                    if (DBNull.Value != scIpidValue)
                    {
                        spliceClosureIpid = scIpidValue.ToString();
                    }

                    string aCableId = spliceRow.get_Value(_aCableIdx).ToString();
                    if (0 == string.Compare(aCableId, cableId))
                    {
                        // b is the one we want to return
                        nextCableId = spliceRow.get_Value(_bCableIdx).ToString();
                        nextFiberNumber = (int)spliceRow.get_Value(_bFiberNumIdx);
                        isNextFromEnd = spliceRow.get_Value(_isBFromIdx).ToString() == "T" ? true : false;
                    }
                    else
                    {
                        // a is the one we want to return
                        nextCableId = aCableId;
                        nextFiberNumber = (int)spliceRow.get_Value(_aFiberNumIdx);
                        isNextFromEnd = spliceRow.get_Value(_isAFromIdx).ToString() == "T" ? true : false;
                    }
                }
            }

            return spliceRow;
        }
开发者ID:jorik041,项目名称:utilities-telecom-desktop-addins,代码行数:73,代码来源:FiberTraceHelper.cs


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