1. 向现有要素类中追加fc要素类的要素
/// <summary>
/// 面追加
/// </summary>
/// <param name="fc"></param>
/// <param name="outputName"></param>
/// <param name="tolerance"></param>
/// <returns></returns>
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
/// <summary>
/// 面追加
/// </summary>
/// <param name="fc"></param>
/// <param name="outputName"></param>
/// <param name="tolerance"></param>
/// <returns></returns>
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();
}
}