Beispiel #1
0
        /// <summary>
        /// Search to see if the feature class is there
        /// </summary>
        /// <param name="featureClass"></param>
        /// <param name="sWhereClause"></param>
        /// <returns></returns>
        public List <FeatureResults> SeachFeatureClass(string featureClass, string sWhereClause)
        {
            IFeatureClass featClass = GetFeatureClass(featureClass);

            if (featClass == null)
            {
                return(null);
            }

            IQueryFilter queryFilter = (IQueryFilter)_serverContext.CreateObject("esriGeoDatabase.QueryFilter");

            queryFilter.WhereClause = sWhereClause;
            IFeatureCursor pFeatCursor = featClass.Search(queryFilter, true);

            // Get Directory Server info
            IEnumServerDirectoryInfo pEnumSDirInfo = _SOM.GetServerDirectoryInfos();
            IServerDirectoryInfo     pSDirInfo     = pEnumSDirInfo.Next();

            IFeature pFeature;
            List <FeatureResults> pFeatureCollection = new List <FeatureResults>();

            while ((pFeature = pFeatCursor.NextFeature()) != null)
            {
                FeatureResults Result = new FeatureResults();
                Result.Feature = pFeature;
                pFeatureCollection.Add(Result);
            }

            return(pFeatureCollection);
        }
        /// <summary>
        /// Search to see if the feature class is there
        /// </summary>
        /// <param name="featureClass"></param>
        /// <param name="sWhereClause"></param>
        /// <returns></returns>
        public List<FeatureResults> SeachFeatureClass(string featureClass, string sWhereClause)
        {
            IFeatureClass featClass = GetFeatureClass(featureClass);

            if (featClass == null)
                return null;

            IQueryFilter queryFilter = (IQueryFilter)_serverContext.CreateObject("esriGeoDatabase.QueryFilter");
            queryFilter.WhereClause = sWhereClause;
            IFeatureCursor pFeatCursor = featClass.Search(queryFilter, true);

            // Get Directory Server info
            IEnumServerDirectoryInfo pEnumSDirInfo = _SOM.GetServerDirectoryInfos();
            IServerDirectoryInfo pSDirInfo = pEnumSDirInfo.Next();

            IFeature pFeature;
            List<FeatureResults> pFeatureCollection = new List<FeatureResults>();
            while ((pFeature = pFeatCursor.NextFeature()) != null)
            {
                FeatureResults Result = new FeatureResults();
                Result.Feature = pFeature;
                pFeatureCollection.Add(Result);
            }
                        
            return pFeatureCollection;
        }