|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
using ESRI.ArcGIS.DataSourcesGDB;
|
|
|
|
|
using ESRI.ArcGIS.esriSystem;
|
|
|
|
|
using ESRI.ArcGIS.Geodatabase;
|
|
|
|
|
using IDEParameter;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace GPHelper
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//LogAPI.Debug("GP分析开始");
|
|
|
|
|
//args = new string[1] { "PFhNTFBlcnNpc3RlZE9iamVjdCB4c2k6dHlwZT0ndHlwZW5zOlhNTFBlcnNpc3RlZE9iamVjdCcgeG1sbnM6eHNpPSdodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZScgeG1sbnM6eHM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hJyB4bWxuczp0eXBlbnM9J2h0dHA6Ly93d3cuZXNyaS5jb20vc2NoZW1hcy9BcmNHSVMvMTAuMSc+PEJ5dGVzPmRBUXZkcUxzVzBlWjlDWm5qWGxEYmdBQUFBQUJBQVlBQUFBTkFBQUFBQUFBQUFBQUFBQUFBQUFBVWFaajVxMkswQkcreHdDQVgzeEMNCmFBRUFBQUFpQUJJQUFBQXdWM3Q4L2xhUlpmUm1zR1hIand0NkFBQStBQUFBUmdCcEFHd0FaUUFnQUVjQVpRQnZBR1FBWVFCMEFHRUENCllnQmhBSE1BWlFBZ0FFWUFaUUJoQU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EENCkFBQUFFQUFBQUVJQVJ3QlJBRVFBVEFCQ0FFMEFBQUF0cnJxaW01YlNFYTUzQ0FBSjdITXFGQUFBQUFRQS8vOEFBQkFBQUFEWVUvUm0NClRWSXdWM3Q4Rm44QmVBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFQLy8vLy8vL3dBQUFBQVFBQUFBUWdCSEFGRUFSQUJNQUUwQVF3QUENCkFDMnV1cUtibHRJUnJuY0lBQW5zY3lvVkFBQUFCQUQvL3dBQUVBQUFBTmhUOUdaTlVqQlhlM3dOVlBCNUFBQUFBQUFBQUFBQUFBQUENCkFBQUFBQUFBLy8vL
|
|
|
|
|
if (!KGIS.Framework.AE.AELicense.AoInit())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string arguments = Environment.GetEnvironmentVariable("MY_ARGS");
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(arguments))
|
|
|
|
|
args[0] = arguments;
|
|
|
|
|
GeoprocessorHelper helper = new GeoprocessorHelper();
|
|
|
|
|
GPParamClass gPParamClass = new GPParamClass();
|
|
|
|
|
|
|
|
|
|
string strParm = args[0];
|
|
|
|
|
byte[] base64ToByte = Convert.FromBase64String(strParm.Trim());
|
|
|
|
|
strParm = Encoding.UTF8.GetString(base64ToByte);
|
|
|
|
|
IVariantArray parameters = KGIS.Framework.AE.GeoDBAPI.DeSerialzedPersist(strParm) as IVariantArray;
|
|
|
|
|
if (parameters != null)
|
|
|
|
|
{
|
|
|
|
|
string mType = parameters.Element[parameters.Count - 1].ToString();
|
|
|
|
|
parameters.Remove(parameters.Count - 1);
|
|
|
|
|
|
|
|
|
|
if (mType == "ZLDB")
|
|
|
|
|
{
|
|
|
|
|
IFeatureLayer layer = parameters.Element[parameters.Count - 1] as IFeatureLayer;
|
|
|
|
|
ESRI.ArcGIS.Geometry.ISpatialReference sp = (layer.FeatureClass as IGeoDataset).SpatialReference;
|
|
|
|
|
parameters.Element[parameters.Count - 1] = sp;
|
|
|
|
|
|
|
|
|
|
helper.ZLDataCheck(parameters);
|
|
|
|
|
Marshal.ReleaseComObject(parameters);
|
|
|
|
|
Console.WriteLine("增量数据检查,执行成功!");
|
|
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
|
|
}
|
|
|
|
|
else if (mType == "BGDB")
|
|
|
|
|
{
|
|
|
|
|
IFeatureLayer layer = parameters.Element[1] as IFeatureLayer;
|
|
|
|
|
ESRI.ArcGIS.Geometry.ISpatialReference sp = (layer.FeatureClass as IGeoDataset).SpatialReference;
|
|
|
|
|
parameters.Element[parameters.Count - 1] = sp;
|
|
|
|
|
helper.BGDataCheck(parameters);
|
|
|
|
|
Marshal.ReleaseComObject(parameters);
|
|
|
|
|
Console.WriteLine("变更数据检查,执行成功!");
|
|
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
|
|
}
|
|
|
|
|
else if (mType == "CJDCQBG")
|
|
|
|
|
{
|
|
|
|
|
helper.CJDCQBG(parameters);
|
|
|
|
|
Console.WriteLine("村级调查区处理,执行成功!");
|
|
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
|
|
}
|
|
|
|
|
else if (mType == "CJDCQJX")
|
|
|
|
|
{
|
|
|
|
|
helper.CJDCQJX(parameters);
|
|
|
|
|
Console.WriteLine("村级调查区界线处理,执行成功!");
|
|
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
|
|
}
|
|
|
|
|
else if (mType == "XZQBG")
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("行政区处理,执行开始!");
|
|
|
|
|
helper.XZQBG(parameters);
|
|
|
|
|
Console.WriteLine("行政区处理,执行成功!");
|
|
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
|
|
}
|
|
|
|
|
else if (mType == "XZQJX")
|
|
|
|
|
{
|
|
|
|
|
helper.XZQJX(parameters);
|
|
|
|
|
Console.WriteLine("行政区界线处理,执行成功!");
|
|
|
|
|
Process.GetCurrentProcess().Kill();
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (args != null && args.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
//string strParm = args[0];
|
|
|
|
|
//byte[] base64ToByte = Convert.FromBase64String(strParm);
|
|
|
|
|
//strParm = Encoding.UTF8.GetString(base64ToByte);
|
|
|
|
|
gPParamClass = SerializeAPI.DeserializeToObject<GPParamClass>(strParm);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//string parm = Console.ReadLine();
|
|
|
|
|
//byte[] base64ToByte = Convert.FromBase64String(parm);
|
|
|
|
|
//parm = Encoding.UTF8.GetString(base64ToByte);
|
|
|
|
|
//gPParamClass = SerializeAPI.DeserializeToObject<GPParamClass>(parm);
|
|
|
|
|
//if (gPParamClass == null) return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IFeatureLayer _Layer = null;
|
|
|
|
|
switch (gPParamClass.GPType)
|
|
|
|
|
{
|
|
|
|
|
case EnumGPType.Default:
|
|
|
|
|
helper.RepairGeo(gPParamClass);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.Dissolve:
|
|
|
|
|
helper.DissolveAnalysis(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.Union:
|
|
|
|
|
helper.UnionAnalysis(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.FcToFc:
|
|
|
|
|
helper.FeatureClassToFeatureClass(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.Intersect:
|
|
|
|
|
helper.IntersectAnalysis(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.Erase:
|
|
|
|
|
helper.EraseAnalysis(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.PolygonToLine:
|
|
|
|
|
helper.PolygonToLine(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.UnsplitLine:
|
|
|
|
|
helper.UnsplitLine(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.SelectLayerByLocation:
|
|
|
|
|
{
|
|
|
|
|
helper.MakeFeatureLayer(gPParamClass, ref _Layer);
|
|
|
|
|
gPParamClass.FirstFeatureLayer2 = _Layer;
|
|
|
|
|
IFeatureLayer tempLayer = null;
|
|
|
|
|
helper.SelectLayerByLocationAnalysis(gPParamClass, ref tempLayer);
|
|
|
|
|
FeatureClass fc = (_Layer.FeatureClass as FeatureClass);
|
|
|
|
|
string path = gPParamClass.TempGDBPath;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(path))
|
|
|
|
|
{
|
|
|
|
|
path = CreateTempDB("GP");
|
|
|
|
|
path = Path.Combine(path, "TempGDB.gdb");
|
|
|
|
|
}
|
|
|
|
|
gPParamClass = new GPParamClass();
|
|
|
|
|
gPParamClass.FirstFeatureLayer2 = _Layer;
|
|
|
|
|
gPParamClass.OutFeatureClassPath = path;
|
|
|
|
|
gPParamClass.FcName = fc.Name;
|
|
|
|
|
gPParamClass.IsGetOutPutFeature = true;
|
|
|
|
|
helper.FeatureClassToFeatureClass(gPParamClass, ref _Layer);
|
|
|
|
|
gPParamClass.OutFeatureClassPath = Path.Combine(path, gPParamClass.FcName);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case EnumGPType.SelectLayerByAttribute:
|
|
|
|
|
{
|
|
|
|
|
helper.MakeFeatureLayer(gPParamClass, ref _Layer);
|
|
|
|
|
gPParamClass.FirstFeatureLayer2 = _Layer;
|
|
|
|
|
//IFeatureLayer tempLayer = null;
|
|
|
|
|
helper.SelectLayerByAttributeAnalysis(gPParamClass);
|
|
|
|
|
FeatureClass fc = (_Layer.FeatureClass as FeatureClass);
|
|
|
|
|
string FcName = string.IsNullOrWhiteSpace(gPParamClass.FcName) ? fc.Name : gPParamClass.FcName;
|
|
|
|
|
string path = gPParamClass.TempGDBPath;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(path))
|
|
|
|
|
{
|
|
|
|
|
path = CreateTempDB("GP");
|
|
|
|
|
path = Path.Combine(path, "TempGDB.gdb");
|
|
|
|
|
}
|
|
|
|
|
gPParamClass = new GPParamClass();
|
|
|
|
|
gPParamClass.FirstFeatureLayer2 = _Layer;
|
|
|
|
|
gPParamClass.OutFeatureClassPath = path;
|
|
|
|
|
gPParamClass.FcName = FcName;
|
|
|
|
|
gPParamClass.IsGetOutPutFeature = true;
|
|
|
|
|
helper.FeatureClassToFeatureClass(gPParamClass, ref _Layer);
|
|
|
|
|
gPParamClass.OutFeatureClassPath = Path.Combine(path, FcName);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case EnumGPType.MultipartToSinglePath:
|
|
|
|
|
helper.MultipartToSinglePath(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.SpatialJoin:
|
|
|
|
|
helper.SpatialJoinAnalysis(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.Identify:
|
|
|
|
|
helper.IdentifyAnalysis(gPParamClass, ref _Layer);
|
|
|
|
|
break;
|
|
|
|
|
case EnumGPType.BGTBYCL:
|
|
|
|
|
{
|
|
|
|
|
//helper.BGTBYCL(gPParamClass);
|
|
|
|
|
helper.CreateTempGDBForGP(gPParamClass);
|
|
|
|
|
System.IO.FileInfo info = new System.IO.FileInfo(gPParamClass.TempGDBPath);
|
|
|
|
|
Console.WriteLine(Path.Combine(gPParamClass.TempGDBPath, info.Name + ".gdb", "GXGC_Multipart"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
case EnumGPType.YBG:
|
|
|
|
|
{
|
|
|
|
|
helper.YBG(gPParamClass);
|
|
|
|
|
Console.WriteLine(Path.Combine(gPParamClass.TempGDBPath, "GXGC_Multipart"));
|
|
|
|
|
//helper.CreateTempGDBForGP(gPParamClass);
|
|
|
|
|
//System.IO.FileInfo info = new System.IO.FileInfo(gPParamClass.TempGDBPath);
|
|
|
|
|
//Console.WriteLine(Path.Combine(gPParamClass.TempGDBPath, info.Name + ".gdb"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
case EnumGPType.CZCYCL:
|
|
|
|
|
{
|
|
|
|
|
helper.CZCYCL(gPParamClass);
|
|
|
|
|
Console.WriteLine(Path.Combine(gPParamClass.TempGDBPath, gPParamClass.FcName));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
case EnumGPType.CZCBG:
|
|
|
|
|
{
|
|
|
|
|
helper.CZCBG(gPParamClass);
|
|
|
|
|
Console.WriteLine(Path.Combine(gPParamClass.TempGDBPath, gPParamClass.FcName));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
case EnumGPType.CJDCQBG:
|
|
|
|
|
{
|
|
|
|
|
helper.CJDCQBG(gPParamClass);
|
|
|
|
|
Console.WriteLine(Path.Combine(gPParamClass.TempGDBPath, "CJDCQGXGC"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
case EnumGPType.XZQBG:
|
|
|
|
|
{
|
|
|
|
|
helper.XZQBG(gPParamClass);
|
|
|
|
|
Console.WriteLine(Path.Combine(gPParamClass.TempGDBPath, "XZQGXGC"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine(gPParamClass.OutFeatureClassPath);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(ex.Message);
|
|
|
|
|
LogAPI.Debug(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
//Console.ReadKey();
|
|
|
|
|
}
|
|
|
|
|
//Console.ReadKey();
|
|
|
|
|
}
|
|
|
|
|
static string CreateTempDB(string pType)
|
|
|
|
|
{
|
|
|
|
|
string result = string.Empty;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string gdbFolder = Directory.GetCurrentDirectory() + "\\Temp\\" + pType;
|
|
|
|
|
if (!Directory.Exists(gdbFolder))
|
|
|
|
|
Directory.CreateDirectory(gdbFolder);
|
|
|
|
|
try
|
|
|
|
|
{ DelectDirect(gdbFolder); }
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
//删除临时数据异常 不做处理
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IWorkspaceFactory pFtWsFct = new FileGDBWorkspaceFactory();
|
|
|
|
|
string gdbFileName = Guid.NewGuid().ToString();
|
|
|
|
|
string path = System.IO.Path.Combine(gdbFolder, gdbFileName);
|
|
|
|
|
|
|
|
|
|
pFtWsFct.Create(path, "TempGDB", null, 0);
|
|
|
|
|
result = path;// System.IO.Path.Combine(path, "TempGDB.gdb");//临时数据存放路径
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("创建临时数据库失败!");
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
private static void DelectDirect(string srcPath)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DirectoryInfo dir = new DirectoryInfo(srcPath);
|
|
|
|
|
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录
|
|
|
|
|
foreach (FileSystemInfo i in fileinfo)
|
|
|
|
|
{
|
|
|
|
|
if (i is DirectoryInfo) //判断是否文件夹
|
|
|
|
|
{
|
|
|
|
|
DirectoryInfo subdir = new DirectoryInfo(i.FullName);
|
|
|
|
|
subdir.Delete(true); //删除子目录和文件
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
File.Delete(i.FullName); //删除指定文件
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|