3. arcengine拓扑:将要素类的要素追加到另一个要素类

1. 向现有要素类中追加fc要素类的要素

  /// 
        /// 面追加
        /// 
        /// 
        /// 
        /// 
        /// 
        public static bool AppEndFeatureClass(string fc, string outputName)
        {
            Geoprocessor gp = null;
            IGeoProcessorResult result = null;
            Append pCheckCeom = null;
            try
            {
                pCheckCeom = new Append();
                pCheckCeom.inputs = fc;
                pCheckCeom.target = outputName;
                pCheckCeom.schema_type = "NO_TEST";
                gp = new Geoprocessor();
                gp.OverwriteOutput = true;
                gp.TemporaryMapLayers = false;
                result = (IGeoProcessorResult)gp.Execute(pCheckCeom, null);
                object sev = 2;
                string messages = gp.GetMessages(ref sev);
                if (result != null)
                    return true;
                else
                    return false;
            }
            catch
            {
                string str = ReturnMessages(gp);
                return false;
            }
            finally
            {
                if (pCheckCeom != null)
                {

                    pCheckCeom = null;

                }
                if (result != null)
                {

                    result = null;

                }
                if (gp != null)
                {

                    gp = null;

                }
                GC.Collect();
                GC.WaitForFullGCComplete();
            }
        }


        ///方法2
        /// 
        /// 面追加
        /// 
        /// 
        /// 
        /// 
        /// 
        public static bool AppEndFeatureClass(IFeatureClass fc, IFeatureClass outputName)
        {
            Geoprocessor gp = null;
            IGeoProcessorResult result = null;
            Append pCheckCeom = null;
            try
            {
                pCheckCeom = new Append();
                pCheckCeom.inputs = fc;
                pCheckCeom.target = outputName;
                pCheckCeom.schema_type = "NO_TEST";
                gp = new Geoprocessor();
                gp.OverwriteOutput = true;
                gp.TemporaryMapLayers = false;
                result = (IGeoProcessorResult)gp.Execute(pCheckCeom, null);
                object sev = 2;
                string messages = gp.GetMessages(ref sev);
                if (result != null)
                    return true;
                else
                    return false;
            }
            catch
            {
                string str = ReturnMessages(gp);
                return false;
            }
            finally
            {
                if (pCheckCeom != null)
                {

                    pCheckCeom = null;

                }
                if (result != null)
                {

                    result = null;

                }
                if (gp != null)
                {

                    gp = null;

                }
                GC.Collect();
                GC.WaitForFullGCComplete();
            }
        }

你可能感兴趣的:(3. arcengine拓扑:将要素类的要素追加到另一个要素类)