Compare commits

...

2 Commits

  1. 47
      KGIS_DLTB/App.config
  2. 176
      KGIS_DLTB/GPHelper/ExeGPForProces.cs
  3. 394
      KGIS_DLTB/GPHelper/GeoprocessorHelper.cs
  4. 709
      KGIS_DLTB/Helper/BaseIDG.cs
  5. 1677
      KGIS_DLTB/Helper/CZCDYDHelper.cs
  6. 2729
      KGIS_DLTB/Helper/DLTB_IDGHelper.cs
  7. 111
      KGIS_DLTB/Helper/MsgHelper.cs
  8. 179
      KGIS_DLTB/KGIS_DLTB.csproj
  9. 128
      KGIS_DLTB/Program.cs
  10. 36
      KGIS_DLTB/Properties/AssemblyInfo.cs
  11. 4
      KGIS_DLTB/packages.config
  12. 24
      KIngo.DataProcessing/App.config
  13. 217
      KIngo.DataProcessing/GdalConfiguration.cs
  14. 218
      KIngo.DataProcessing/KIngo.DataProcessing.csproj
  15. BIN
      KIngo.DataProcessing/NewIcon.ico
  16. 302
      KIngo.DataProcessing/Program.cs
  17. 36
      KIngo.DataProcessing/Properties/AssemblyInfo.cs
  18. 70
      KIngo.DataProcessing/Properties/Resources.Designer.cs
  19. 117
      KIngo.DataProcessing/Properties/Resources.resx
  20. 29
      KIngo.DataProcessing/Properties/Settings.Designer.cs
  21. 7
      KIngo.DataProcessing/Properties/Settings.settings
  22. 72
      KIngo.DataProcessing/Properties/app.manifest
  23. BIN
      KIngo.DataProcessing/TBBG.ico
  24. 16
      KIngo.DataProcessing/packages.config
  25. 24
      Kingo.BuildDB.sln
  26. 18
      Kingo.PluginClient/Program.cs
  27. 8
      Kingo.PluginServiceInterface/Kingo.PluginServiceInterface.csproj
  28. 5
      Kingo.PluginServiceInterface/packages.config
  29. 520
      Kingo.Plugins/Kingo.Plugin.MapView/Commands/CmdCopyFileData.cs
  30. 1
      Kingo.Plugins/Kingo.Plugin.MapView/Kingo.Plugin.MapView.csproj
  31. 11
      Kingo.Plugins/Kingo.Plugin.MapView/Manifest.xml
  32. 2
      Kingo.ThreadManager/Kingo.ThreadManager.csproj

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="ProductCodeAdvanced" value="false" />
<add key="RepairFeatureClass" value="false" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Sqlite" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.4.0" newVersion="8.0.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SQLitePCLRaw.core" publicKeyToken="1488e028ca7ab535" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.8.2226" newVersion="2.1.8.2226" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>

@ -1,176 +0,0 @@
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using KGIS.Framework.AE.GPHelper;
using KGIS.Framework.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KGIS_DLTB
{
public class GPHelper
{
public static GPHelper Instance { get; } = new GPHelper();
public GPHelper()
{ }
public string ExeGPForProces(string args1, string args2, string args3, string args4, string args5)
{
if (string.IsNullOrWhiteSpace(args1))
args1 = "null";
if (string.IsNullOrWhiteSpace(args2))
args2 = "null";
if (string.IsNullOrWhiteSpace(args3))
args3 = "null";
if (string.IsNullOrWhiteSpace(args4))
args4 = "null";
if (string.IsNullOrWhiteSpace(args5))
args5 = "null";
var psi = new ProcessStartInfo("GPHelper.exe", string.Format("{0} {1} {2} {3} {4}", args1, args2, args3, args4, args5));
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
var pes = Process.Start(psi);
var sbuffer = new StringBuilder();
var sout = pes.StandardOutput;
while (!sout.EndOfStream)
{
var line = sout.ReadLine();
if (String.IsNullOrEmpty(line)) continue;
sbuffer.AppendLine(line);
}
pes.WaitForExit();
pes.Close();
String res = sbuffer.ToString();
sbuffer.Clear();
return res;
}
public string ExeGPForProces(string arg)
{
string result = string.Empty;
Byte[] toEncryptArray = Encoding.UTF8.GetBytes(arg);
string strParm = Convert.ToBase64String(toEncryptArray);
//Console.WriteLine(strParm);
var psi = new ProcessStartInfo("GPHelper.exe", "GP调用");
psi.EnvironmentVariables["MY_ARGS"] = strParm;
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
var pes = Process.Start(psi);
var sbuffer = new StringBuilder();
var sout = pes.StandardOutput;
while (!sout.EndOfStream)
{
result = sout.ReadLine();
if (String.IsNullOrEmpty(result)) continue;
sbuffer.AppendLine(result);
}
pes.WaitForExit();
pes.Close();
String res = sbuffer.ToString();
sbuffer.Clear();
//Console.WriteLine(res);
return result;
}
public void ExeGPForProces(GPParamClass gPParam, ref IFeatureLayer result)
{
string outPath = string.Empty;
try
{
string strParm = SerializeAPI.SerializeToXML<GPParamClass>(gPParam);
outPath = ExeGPForProces(strParm);
lock (this)
{
if (gPParam.GPType == EnumGPType.Default)
{
return;
}
if (outPath.ToLower() == "error")
{
}
else
{
if (string.IsNullOrWhiteSpace(outPath))
outPath = gPParam.OutFeatureClassPath;
result = new FeatureLayer();
FileInfo file = new FileInfo(outPath.Replace("\r\n", ""));
string dbPath = file.DirectoryName;
string fcName = file.Name;
if (file.Name.ToLower().EndsWith(".gdb") && gPParam.FcName != null)
{
dbPath = file.FullName;
fcName = gPParam.FcName;
}
else if (fcName.ToLower().EndsWith(".shp"))
{
KGIS.Framework.AE.IWorkspaceAPI wsAPI = new KGIS.Framework.AE.WorkspaceAPI(dbPath, KGIS.Framework.AE.Enum.WorkspaceTypeEnum.ShapeFile);
KGIS.Framework.AE.IFeatureClassAPI fcAPI = wsAPI.OpenFeatureClass(fcName.Replace(".shp", ""));
result.FeatureClass = fcAPI.FeatureClass;
}
{
KGIS.Framework.AE.IWorkspaceAPI wsAPI = new KGIS.Framework.AE.WorkspaceAPI(dbPath, KGIS.Framework.AE.Enum.WorkspaceTypeEnum.GDBFile, true);
KGIS.Framework.AE.IFeatureClassAPI fcAPI = wsAPI.OpenFeatureClass(fcName);
result.FeatureClass = fcAPI.FeatureClass;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(outPath);
Console.WriteLine(ex.Message);
}
}
public void ExeGp(IVariantArray pParam)
{
string outPath = string.Empty;
try
{
string strParm = KGIS.Framework.AE.GeoDBAPI.SerialzedPersist(pParam);
outPath = ExeGPForProces(strParm);
}
catch (Exception ex)
{
Console.WriteLine(outPath);
Console.WriteLine(ex.Message);
}
}
public bool ValidityLic()
{
try
{
#if DEBUG
Console.WriteLine("Log:数据信息校验_False!");
return true;
#else
string jkrjSQ = System.IO.Path.Combine(SysAppPath.GetCurrentAppPath(), "jkrj.lic");
cvvOrpfAU3EHNwACbeT.WD3DgyfSL927cnSHeKI ProcessingValidity = new cvvOrpfAU3EHNwACbeT.WD3DgyfSL927cnSHeKI("KGIS_SJJK", "6x", jkrjSQ);
bool v = ProcessingValidity.BbOJCFj78PyoadK1iYD();
return v;
#endif
}
catch (Exception ex)
{
Console.WriteLine("Err:数据信息校验异常_KGIS_DLTB:" + ex.StackTrace + ex.Message);
Console.WriteLine("Err:数据信息校验异常_KGIS_DLTB!");
return false;
}
}
}
}

@ -1,394 +0,0 @@
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.DataManagementTools;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geoprocessing;
using ESRI.ArcGIS.Geoprocessor;
using KGIS.Framework.AE.GPHelper;
//using KGIS.Framework.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
namespace GPHelper
{
public class CustomGPHelper
{
public static void DLTBBGDissolve_Tool(IVariantArray pParam)
{
object sev = null;
//1-定义GeoProcessor对象
IGeoProcessor gp = new GeoProcessorClass();
try
{
//2-设置参数
gp.OverwriteOutput = true;
string strPath = AppDomain.CurrentDomain.BaseDirectory;
if (!strPath.EndsWith(@"\"))
{
strPath += @"\";
}
string toolPath = System.IO.Path.Combine(strPath, @"Resource\ZLDatabaseTool" + ".tbx");
if (!System.IO.File.Exists(toolPath))
{
throw new Exception("未找到预变更工具!");
}
//3-设置工具箱所在的路径
gp.AddToolbox(toolPath);
//5-执行工具
IGeoProcessorResult result = gp.Execute("DLTBBGDissolve", pParam, null);
if (result != null && result.Status != esriJobStatus.esriJobSucceeded)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += "$" + gp.GetMessage(Count) + "\n\n";
}
}
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (gp.MessageCount > 0)
gp.GetMessages(ref sev).ToString();
}
}
/// <summary>
/// 地类图斑更新层数据变更
/// </summary>
/// <param name="pParam"></param>
public static void DLTBGXDissolve_Tool(IVariantArray pParam)
{
object sev = null;
//1-定义GeoProcessor对象
IGeoProcessor gp = new GeoProcessorClass();
try
{
//2-设置参数
gp.OverwriteOutput = true;
string strPath = AppDomain.CurrentDomain.BaseDirectory;
if (!strPath.EndsWith(@"\"))
{
strPath += @"\";
}
string toolPath = System.IO.Path.Combine(strPath, @"Resource\ZLDatabaseTool" + ".tbx");
if (!System.IO.File.Exists(toolPath))
{
throw new Exception("未找到预变更工具!");
}
//3-设置工具箱所在的路径
gp.AddToolbox(toolPath);
//5-执行工具
IGeoProcessorResult result = gp.Execute("DLTBGXDissolve", pParam, null);
if (result != null && result.Status != esriJobStatus.esriJobSucceeded)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += "$" + gp.GetMessage(Count) + "\n\n";
}
}
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (gp.MessageCount > 0)
gp.GetMessages(ref sev).ToString();
}
}
public static void SetGDPDJB_Tool(IVariantArray pParam)
{
object sev = null;
//1-定义GeoProcessor对象
IGeoProcessor gp = new GeoProcessorClass();
try
{
//2-设置参数
gp.OverwriteOutput = true;
string strPath = AppDomain.CurrentDomain.BaseDirectory;
if (!strPath.EndsWith(@"\"))
{
strPath += @"\";
}
string toolPath = System.IO.Path.Combine(strPath, @"Resource\ZLDatabaseTool" + ".tbx");
if (!System.IO.File.Exists(toolPath))
{
throw new Exception("未找到预变更工具!");
}
//3-设置工具箱所在的路径
gp.AddToolbox(toolPath);
//5-执行工具
IGeoProcessorResult result = gp.Execute("SetGDPDJBTool", pParam, null);
if (result != null && result.Status != esriJobStatus.esriJobSucceeded)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += "$" + gp.GetMessage(Count) + "\n\n";
}
}
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (gp.MessageCount > 0)
gp.GetMessages(ref sev).ToString();
}
}
public static void DLTBBG_Tool(IVariantArray pParam)
{
object sev = null;
//1-定义GeoProcessor对象
IGeoProcessor gp = new GeoProcessorClass();
try
{
//2-设置参数
gp.OverwriteOutput = true;
string strPath = AppDomain.CurrentDomain.BaseDirectory;
if (!strPath.EndsWith(@"\"))
{
strPath += @"\";
}
string toolPath = System.IO.Path.Combine(strPath, @"Resource\ZLDatabaseTool" + ".tbx");
if (!System.IO.File.Exists(toolPath))
{
throw new Exception("未找到预变更工具!");
}
//3-设置工具箱所在的路径
gp.AddToolbox(toolPath);
//5-执行工具
IGeoProcessorResult result = gp.Execute("DLTBBGTool", pParam, null);
if (result != null && result.Status != esriJobStatus.esriJobSucceeded)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += "$" + gp.GetMessage(Count) + "\n\n";
}
}
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (gp.MessageCount > 0)
gp.GetMessages(ref sev).ToString();
}
}
public static void GDTBBG_Tool(IVariantArray pParam)
{
object sev = null;
//1-定义GeoProcessor对象
IGeoProcessor gp = new GeoProcessorClass();
try
{
//2-设置参数
gp.OverwriteOutput = true;
string strPath = AppDomain.CurrentDomain.BaseDirectory;
if (!strPath.EndsWith(@"\"))
{
strPath += @"\";
}
string toolPath = System.IO.Path.Combine(strPath, @"Resource\ZLDatabaseTool" + ".tbx");
if (!System.IO.File.Exists(toolPath))
{
throw new Exception("未找到预变更工具!");
}
//3-设置工具箱所在的路径
gp.AddToolbox(toolPath);
//5-执行工具
IGeoProcessorResult result = gp.Execute("GDTBBGTool", pParam, null);
if (result != null && result.Status != esriJobStatus.esriJobSucceeded)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += "$" + gp.GetMessage(Count) + "\n\n";
}
}
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (gp.MessageCount > 0)
gp.GetMessages(ref sev).ToString();
}
}
public static void RepairGeo(GPParamClass gPParam)
{
Geoprocessor gp = new Geoprocessor();
try
{
RepairGeometry repairgeo = new RepairGeometry();
repairgeo.in_features = gPParam.FirstFeatureLayer.FeatureClass;
//repairgeo.out_feature_class = outFC;
repairgeo.delete_null = "TRUE";
IGeoProcessorResult tGeoResult = (IGeoProcessorResult)gp.Execute(repairgeo, null);
if (tGeoResult == null || tGeoResult.Status != esriJobStatus.esriJobSucceeded)
{
//LogAPI.Debug("检查图形失败:");
throw new Exception(ReturnMessages(gp));
}
string msg = ReturnMessages(gp);
}
catch (Exception ex)
{
throw new Exception(ReturnMessages(gp));
}
}
public static void RepairGeo(IFeatureClass pFc)
{
Geoprocessor gp = new Geoprocessor();
try
{
RepairGeometry repairgeo = new RepairGeometry();
repairgeo.in_features = pFc;
//repairgeo.out_feature_class = outFC;
repairgeo.delete_null = "TRUE";
IGeoProcessorResult tGeoResult = (IGeoProcessorResult)gp.Execute(repairgeo, null);
if (tGeoResult == null || tGeoResult.Status != esriJobStatus.esriJobSucceeded)
{
//LogAPI.Debug("检查图形失败:");
throw new Exception(ReturnMessages(gp));
}
string msg = ReturnMessages(gp);
}
catch (Exception ex)
{
throw new Exception(ReturnMessages(gp));
}
}
public static void DLTBGXGC_Tool(IVariantArray pParam)
{
object sev = null;
//1-定义GeoProcessor对象
IGeoProcessor gp = new GeoProcessorClass();
try
{
//2-设置参数
gp.OverwriteOutput = true;
string strPath = AppDomain.CurrentDomain.BaseDirectory;
if (!strPath.EndsWith(@"\"))
{
strPath += @"\";
}
string toolPath = System.IO.Path.Combine(strPath, @"Resource\ZLDatabaseTool" + ".tbx");
if (!System.IO.File.Exists(toolPath))
{
throw new Exception("未找到预变更工具!");
}
//3-设置工具箱所在的路径
gp.AddToolbox(toolPath);
//5-执行工具
IGeoProcessorResult result = gp.Execute("DLTBGXGCTool", pParam, null);
if (result != null && result.Status != esriJobStatus.esriJobSucceeded)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += "$" + gp.GetMessage(Count) + "\n\n";
}
}
}
gp.RemoveToolbox(toolPath);
Marshal.ReleaseComObject(gp);
}
catch (Exception ex)
{
throw ex;
}
finally
{
//if (gp.MessageCount > 0)
// gp.GetMessages(ref sev).ToString();
}
}
public static void TableToTable(IFeatureLayer pLayer, string pOutLocal, string pOutName)
{
try
{
//for (int i = 0; i < listFeatureClass.Count(); i++)
//{
ESRI.ArcGIS.Geoprocessor.Geoprocessor geoprocessor = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
geoprocessor.OverwriteOutput = true;
ESRI.ArcGIS.ConversionTools.TableToTable TbToTb = new ESRI.ArcGIS.ConversionTools.TableToTable();
TbToTb.in_rows = pLayer.FeatureClass;
TbToTb.out_path = pOutLocal;
TbToTb.out_name = pOutName;
IGeoProcessorResult tGeoResult = (IGeoProcessorResult)geoprocessor.Execute(TbToTb, null);
if (tGeoResult == null || tGeoResult.Status != ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded)
{
string msg = ReturnMessages(geoprocessor);
throw new Exception(msg);
}
//}
}
catch (Exception ex)
{
//LogAPI.Debug("将一个或多个属性表导出excel 时失败,异常原因: " + ex + " ; ");
throw ex;
}
}
/// <summary>
/// 获取GP任务执行信息
/// </summary>
/// <param name="gp"></param>
/// <returns></returns>
private static string ReturnMessages(Geoprocessor gp)
{
string ms = "";
if (gp.MessageCount > 0)
{
for (int Count = 0; Count <= gp.MessageCount - 1; Count++)
{
ms += "$" + gp.GetMessage(Count) + "\n\n";
}
}
return ms;
}
}
}

@ -1,709 +0,0 @@
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
using KGIS.Framework.AE;
using KGIS.Framework.AE.Enum;
using KGIS.Framework.AE.GPHelper;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.ExtensionMethod;
using Kingo.PluginServiceInterface;
using Kingo.PluginServiceInterface.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
namespace KGIS_DLTB
{
public class BaseIDG : IDisposable
{
//private IFeatureLayer jCLayer;
internal IFeatureLayer _jcTbLayer;
internal IFeatureLayer _gxgcTBLayer;
internal IFeatureLayer _gxTbLayer;
internal IFeatureLayer _bgTbLayer;
internal IFeatureLayer _cjqTbLayer;
internal IFeatureLayer _jcCjdcqLayer;
internal IFeatureLayer _jcCjdcqJxLayer;
internal IFeatureLayer _gxCjdcqLayer;
internal IFeatureLayer _gxgcCjdcqLayer;
internal IFeatureLayer _gxCjdcqJxLayer;
internal IFeatureLayer _jcXzqLayer;
internal IFeatureLayer _jcXzqJxLayer;
internal IFeatureLayer _gxXzqLayer;
internal IFeatureLayer _gxgcXzqLayer;
internal IFeatureLayer _gxXzqJxLayer;
internal IFeatureLayer _jcCzcLayer;
internal IFeatureLayer _gxCzcLayer;
internal IFeatureLayer _gxgcCzcLayer;
internal IFeatureLayer _jcGddbLayer;
internal IFeatureLayer _gxGddbLayer;
internal IFeatureLayer _jcPdtLayer;
internal IFeatureLayer _gxPdtLayer;
internal IFeatureLayer _nmTbLayer;
public IWorkspaceAPI BgWsAPI { get; set; }
public Dictionary<string, IWorkspaceAPI> DicWsAPI { get; set; }
public IWorkspaceAPI ZlWsAPI { get; set; }
public IWorkspaceAPI NmWsAPI { get; set; }
public IWorkspaceAPI JCWsAPI { get; set; }
//public IFeatureLayer JCLayer { get => jCLayer; set => jCLayer = value; }
//public IFeatureLayer GXLayer { get => gXLayer; set => gXLayer = value; }
public IFeatureLayer NmTbLayer { get => _nmTbLayer; set => _nmTbLayer = value; }
#region 地类图斑
public IFeatureLayer JcTbLayer { get => _jcTbLayer; }
public IFeatureLayer JcPdtLayer { get => _jcPdtLayer; }
public IFeatureLayer GxgcTBLayer { get => _gxgcTBLayer; }
public IFeatureLayer GxTbLayer { get => _gxTbLayer; }
public IFeatureLayer GxPdtLayer { get => _gxPdtLayer; }
public IFeatureLayer BgTbLayer { get => _bgTbLayer; }
public IFeatureLayer CJQTbLayer { get => _cjqTbLayer; }
#endregion
#region 村级调查区
public IFeatureLayer JcCjdcqLayer { get => _jcCjdcqLayer; set => _jcCjdcqLayer = value; }
public IFeatureLayer JcCjdcqJxLayer { get => _jcCjdcqJxLayer; }
public IFeatureLayer GxCjdcqLayer { get => _gxCjdcqLayer; }
public IFeatureLayer GxgcCjdcqLayer { get => _gxgcCjdcqLayer; }
public IFeatureLayer GxCjdcqJxLayer { get => _gxCjdcqJxLayer; }
#endregion
#region 行政区
public IFeatureLayer JcXzqLayer { get => _jcXzqLayer; set => _jcXzqLayer = value; }
public IFeatureLayer JcXzqJxLayer { get => _jcXzqJxLayer; }
public IFeatureLayer GxXzqLayer { get => _gxXzqLayer; }
public IFeatureLayer GxgcXzqLayer { get => _gxgcXzqLayer; }
public IFeatureLayer GxXzqJxLayer { get => _gxXzqJxLayer; }
#endregion
#region 城镇村
public IFeatureLayer JcCzcLayer { get => _jcCzcLayer; }
public IFeatureLayer GxCzcLayer { get => _gxCzcLayer; }
public IFeatureLayer GxgcCzcLayer { get => _gxgcCzcLayer; }
#endregion
#region 耕地等别
public IFeatureLayer JcGddbLayer { get => _jcGddbLayer; }
public IFeatureLayer GxGddbLayer { get => _gxGddbLayer; }
#endregion
public virtual void CreateNMK2(IDGParameter parm)
{
try
{
IFeatureLayer TempNMKLayer = null;
GPParamClass gPParamClass = new GPParamClass();
gPParamClass.FirstFeatureLayer = JcTbLayer;//基础地类图斑要素类
gPParamClass.SecondFeatureLayer = GxTbLayer;//地类图斑更新要素类
gPParamClass.OutFeatureClassPath = parm.PrjInfo.NMDatabase + "\\" + "DLTB_NMK";//要添加的要素类图层
gPParamClass.IsGetOutPutFeature = true;//是否获取GP工具生成后的图层
gPParamClass.GPType = EnumGPType.Erase;
GPHelper.Instance.ExeGPForProces(gPParamClass, ref TempNMKLayer);//擦除/相减分析
IFeatureClassAPI fcAPI = new FeatureClassAPI(TempNMKLayer.FeatureClass);
fcAPI.AddField("XZQDM", esriFieldType.esriFieldTypeString, "行政区代码");
fcAPI.AddField("XZQTZLX", esriFieldType.esriFieldTypeInteger, "行政区调整类型");
//fcAPI.FcToFc(NMKLayer.FeatureClass, null, false);
fcAPI = new FeatureClassAPI(GxTbLayer.FeatureClass);
fcAPI.FcToFc(TempNMKLayer.FeatureClass, null, false);
ITable nmkTable = TempNMKLayer.FeatureClass as ITable;
//更新后年末库
ICursor nmkCur = nmkTable.Update(null, true);
IRow nmkRow = null;
int bsmIdx = nmkTable.FindField("BSM");
int zldwIdx = nmkTable.FindField("ZLDWDM");
int xzqdmIdx = nmkTable.FindField("XZQDM");
int XZQTZLXmIdx = nmkTable.FindField("XZQTZLX");
int HDMCIdx = nmkTable.FindField("HDMC");
while ((nmkRow = nmkCur.NextRow()) != null)
{
//string bsm = nmkRow.Value[bsmIdx].ToTrim();
//if (hcbghbsm.Contains(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 2;
//}
//else if (msbghbsm.Contains(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 4;
//}
//else if (msbgqbsm.Contains(bsm) && !bghbsmDic.ContainsKey(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 4;
//}
//if (bhxxDic.ContainsKey(bsm))
//{
// for (int i = 0; i < nmkRow.Fields.FieldCount; i++)
// {
// IField field = nmkRow.Fields.Field[i];
// string bghField = "BGH" + field.Name;
// DataRow dr = bhxxDic[bsm];
// if (!dr.Table.Columns.Contains(bghField))
// bghField = "BGHTB" + field.Name;
// if (dr.Table.Columns.Contains(bghField))
// {
// if (field.Type == esriFieldType.esriFieldTypeString)
// {
// nmkRow.Value[i] = msbghbsm.Contains(bsm) ? "" : dr[bghField];
// }
// else if (field.Type == esriFieldType.esriFieldTypeDouble)
// {
// nmkRow.Value[i] = msbghbsm.Contains(bsm) ? 0 : dr[bghField].ToDouble();
// }
// }
// }
//}
if (zldwIdx != -1 && xzqdmIdx != -1)
{
string zldwdm = nmkRow.Value[zldwIdx].ToTrim();
if (!string.IsNullOrWhiteSpace(zldwdm) && zldwdm.Length > 9)
{
nmkRow.Value[xzqdmIdx] = zldwdm.Substring(0, 9);
}
}
if (HDMCIdx != -1)
nmkRow.Value[HDMCIdx] = nmkRow.Value[HDMCIdx].ToString().ToTrim() == "" ? "" : nmkRow.Value[HDMCIdx].ToString().ToTrim();
nmkCur.UpdateRow(nmkRow);
}
nmkCur.Flush();
nmkTable.DeleteSearchedRows(new QueryFilterClass() { WhereClause = "XZQTZLX=4 or XZQTZLX=2" });
_nmTbLayer = TempNMKLayer;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 生成年末库图层-GP创建年末库图层
/// </summary>
/// <param name="parm"></param>
public virtual void CreateNMK3(IDGParameter parm)
{
IFeatureCursor _cursor = null;
try
{
IFeatureLayer TempNMKLayer = null;
GPParamClass gPParamClass = new GPParamClass();
gPParamClass.FirstFeatureLayer = JcTbLayer;//基础地类图斑要素类
//gPParamClass.SecondFeatureLayer = GxTbLayer;//地类图斑更新要素类
gPParamClass.OutFeatureClassPath = parm.PrjInfo.NMDatabase;// + "\\" + "DLTB_NMK";//要添加的要素类图层
gPParamClass.IsGetOutPutFeature = true;//是否获取GP工具生成后的图层
gPParamClass.GPType = EnumGPType.FcToFc;
gPParamClass.FcName = "DLTB_NMK";
GPHelper.Instance.ExeGPForProces(gPParamClass, ref TempNMKLayer);//擦除/相减分析
_cursor = GxgcTBLayer.FeatureClass.Search(new QueryFilterClass() { SubFields = "BGQTBBSM" }, true);
Dictionary<string, int> DicJcBSMs = new Dictionary<string, int>();
IFeature f = null;
int idx = GxgcTBLayer.FeatureClass.FindField("BGQTBBSM");
if (idx == -1) return;
while ((f = _cursor.NextFeature()) != null)
{
string jcbsm = f.Value[idx].ToTrim();
if (!DicJcBSMs.ContainsKey(jcbsm))
DicJcBSMs.Add(jcbsm, 0);
}
_cursor = TempNMKLayer.FeatureClass.Update(null, true);
idx = TempNMKLayer.FeatureClass.FindField("BSM");
if (idx == -1) return;
while ((f = _cursor.NextFeature()) != null)
{
string bsm = f.Value[idx].ToTrim();
if (DicJcBSMs.ContainsKey(bsm))
{
f.Value[idx] = "-1";
_cursor.UpdateFeature(f);
}
}
_cursor.Flush();
(TempNMKLayer.FeatureClass as ITable).DeleteSearchedRows(new QueryFilterClass() { WhereClause = "BSM = '-1'" });
IFeatureClassAPI fcAPI = new FeatureClassAPI(GxTbLayer.FeatureClass);
fcAPI.FcToFc(TempNMKLayer.FeatureClass, null, false);
fcAPI = new FeatureClassAPI(TempNMKLayer.FeatureClass);
fcAPI.AddField("XZQDM", esriFieldType.esriFieldTypeString, "行政区代码");
fcAPI.AddField("XZQTZLX", esriFieldType.esriFieldTypeInteger, "行政区调整类型");
////fcAPI.FcToFc(NMKLayer.FeatureClass, null, false);
//fcAPI = new FeatureClassAPI(GxTbLayer.FeatureClass);
//fcAPI.FcToFc(TempNMKLayer.FeatureClass, null, false);
ITable nmkTable = TempNMKLayer.FeatureClass as ITable;
//更新后年末库
ICursor nmkCur = nmkTable.Update(null, true);
IRow nmkRow = null;
int bsmIdx = nmkTable.FindField("BSM");
int zldwIdx = nmkTable.FindField("ZLDWDM");
int xzqdmIdx = nmkTable.FindField("XZQDM");
int XZQTZLXmIdx = nmkTable.FindField("XZQTZLX");
int HDMCIdx = nmkTable.FindField("HDMC");
while ((nmkRow = nmkCur.NextRow()) != null)
{
//string bsm = nmkRow.Value[bsmIdx].ToTrim();
//if (hcbghbsm.Contains(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 2;
//}
//else if (msbghbsm.Contains(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 4;
//}
//else if (msbgqbsm.Contains(bsm) && !bghbsmDic.ContainsKey(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 4;
//}
//if (bhxxDic.ContainsKey(bsm))
//{
// for (int i = 0; i < nmkRow.Fields.FieldCount; i++)
// {
// IField field = nmkRow.Fields.Field[i];
// string bghField = "BGH" + field.Name;
// DataRow dr = bhxxDic[bsm];
// if (!dr.Table.Columns.Contains(bghField))
// bghField = "BGHTB" + field.Name;
// if (dr.Table.Columns.Contains(bghField))
// {
// if (field.Type == esriFieldType.esriFieldTypeString)
// {
// nmkRow.Value[i] = msbghbsm.Contains(bsm) ? "" : dr[bghField];
// }
// else if (field.Type == esriFieldType.esriFieldTypeDouble)
// {
// nmkRow.Value[i] = msbghbsm.Contains(bsm) ? 0 : dr[bghField].ToDouble();
// }
// }
// }
//}
if (zldwIdx != -1 && xzqdmIdx != -1)
{
string zldwdm = nmkRow.Value[zldwIdx].ToTrim();
if (!string.IsNullOrWhiteSpace(zldwdm) && zldwdm.Length > 9)
{
nmkRow.Value[xzqdmIdx] = zldwdm.Substring(0, 9);
}
}
if (HDMCIdx != -1)
nmkRow.Value[HDMCIdx] = nmkRow.Value[HDMCIdx].ToString().ToTrim() == "" ? "" : nmkRow.Value[HDMCIdx].ToString().ToTrim();
nmkCur.UpdateRow(nmkRow);
}
nmkCur.Flush();
//nmkTable.DeleteSearchedRows(new QueryFilterClass() { WhereClause = "XZQTZLX=4 or XZQTZLX=2" });
_nmTbLayer = TempNMKLayer;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 生成年末库数据(BUG:新增 年末库 图层)
/// </summary>
/// <param name="parm"></param>
public virtual void CreateNMK(IDGParameter parm)
{
IFeatureCursor _cursor = null;
try
{
//if (NmWsAPI.OpenFeatureClass("DLTB_NMK").FeatureClass is IFeatureClass ClassFC)
// NmTbLayer = new FeatureLayer() { Name = ClassFC.AliasName, FeatureClass = ClassFC };
if (NmTbLayer == null) return;
(NmTbLayer.FeatureClass as ITable).DeleteSearchedRows(null);
IFeatureClassAPI featureClassAPI = new FeatureClassAPI(JcTbLayer.FeatureClass);
featureClassAPI.FcToFc(NmTbLayer.FeatureClass, new QueryFilterClass() { WhereClause = " (XZQTZLX <> '2' and XZQTZLX <> '4') or XZQTZLX Is NULL " }, false);
_cursor = GxgcTBLayer.FeatureClass.Search(new QueryFilterClass() { SubFields = "BGQTBBSM" }, true);
Dictionary<string, int> DicJcBSMs = new Dictionary<string, int>();
IFeature f = null;
int idx = GxgcTBLayer.FeatureClass.FindField("BGQTBBSM");
if (idx == -1) return;
while ((f = _cursor.NextFeature()) != null)
{
string jcbsm = f.Value[idx].ToTrim();
if (!DicJcBSMs.ContainsKey(jcbsm))
DicJcBSMs.Add(jcbsm, 0);
}
_cursor = NmTbLayer.FeatureClass.Update(null, true);
idx = NmTbLayer.FeatureClass.FindField("BSM");
if (idx == -1) return;
while ((f = _cursor.NextFeature()) != null)
{
string bsm = f.Value[idx].ToTrim();
if (DicJcBSMs.ContainsKey(bsm))
{
f.Value[idx] = "-1";
_cursor.UpdateFeature(f);
}
}
_cursor.Flush();
(NmTbLayer.FeatureClass as ITable).DeleteSearchedRows(new QueryFilterClass() { WhereClause = "BSM = '-1'" });
IFeatureClassAPI fcAPI = new FeatureClassAPI(GxTbLayer.FeatureClass);
fcAPI.FcToFc(NmTbLayer.FeatureClass, null, false);
ITable nmkTable = NmTbLayer.FeatureClass as ITable;
//更新后年末库
ICursor nmkCur = nmkTable.Update(null, true);
IRow nmkRow = null;
int bsmIdx = nmkTable.FindField("BSM");
int zldwIdx = nmkTable.FindField("ZLDWDM");
int xzqdmIdx = nmkTable.FindField("XZQDM");
int XZQTZLXmIdx = nmkTable.FindField("XZQTZLX");
int HDMCIdx = nmkTable.FindField("HDMC");
while ((nmkRow = nmkCur.NextRow()) != null)
{
if (zldwIdx != -1 && xzqdmIdx != -1)
{
string zldwdm = nmkRow.Value[zldwIdx].ToTrim();
if (!string.IsNullOrWhiteSpace(zldwdm) && zldwdm.Length > 9)
{
nmkRow.Value[xzqdmIdx] = zldwdm.Substring(0, 9);
}
}
if (HDMCIdx != -1)
nmkRow.Value[HDMCIdx] = nmkRow.Value[HDMCIdx].ToString().ToTrim() == "" ? "" : nmkRow.Value[HDMCIdx].ToString().ToTrim();
nmkCur.UpdateRow(nmkRow);
}
nmkCur.Flush();
}
catch (Exception ex)
{
Console.WriteLine("Err:地类图斑数据提取-生成年末库数据异常!" + ex.Message);
Console.WriteLine("Err:地类图斑数据提取-生成年末库数据异常!" + ex.StackTrace);
throw ex;
}
finally
{
if (_cursor != null)
Marshal.ReleaseComObject(_cursor);
}
}
public virtual void CreateNMK(DBLayerSourceHelper pLayerSource)
{
IFeatureCursor _cursor = null;
try
{
//GeoprocessorHelper gpHelper = new GeoprocessorHelper();
//string path = Path.Combine(parm.PrjInfo.ProjDir, "NMDB" + ".gdb");
//FileInfo fileInfo = new FileInfo(parm.PrjInfo.BGDatabase);
//string path = Path.Combine(fileInfo.DirectoryName, "NMDB" + ".gdb");
//if (JcTbLayer == null || GxTbLayer == null)
// OpenDB(parm);
IFeatureLayer TempNMKLayer = null;
GPParamClass gPParamClass = new GPParamClass();
gPParamClass.FirstFeatureLayer = pLayerSource.JcTbLayer;//基础地类图斑要素类
//gPParamClass.SecondFeatureLayer = GxTbLayer;//地类图斑更新要素类
gPParamClass.OutFeatureClassPath = pLayerSource.NmWsAPI.CurrentWorkspace.PathName;// + "\\" + "DLTB_NMK";//要添加的要素类图层
gPParamClass.IsGetOutPutFeature = true;//是否获取GP工具生成后的图层
gPParamClass.GPType = EnumGPType.FcToFc;
gPParamClass.FcName = "DLTB_NMK";
GPHelper.Instance.ExeGPForProces(gPParamClass, ref TempNMKLayer);//擦除/相减分析
_cursor = pLayerSource.GxgcTBLayer.FeatureClass.Search(new QueryFilterClass() { SubFields = "BGQTBBSM" }, true);
Dictionary<string, int> DicJcBSMs = new Dictionary<string, int>();
IFeature f = null;
int idx = pLayerSource.GxgcTBLayer.FeatureClass.FindField("BGQTBBSM");
if (idx == -1) return;
while ((f = _cursor.NextFeature()) != null)
{
string jcbsm = f.Value[idx].ToTrim();
if (!DicJcBSMs.ContainsKey(jcbsm))
DicJcBSMs.Add(jcbsm, 0);
}
_cursor = TempNMKLayer.FeatureClass.Update(null, true);
idx = TempNMKLayer.FeatureClass.FindField("BSM");
if (idx == -1) return;
while ((f = _cursor.NextFeature()) != null)
{
string bsm = f.Value[idx].ToTrim();
if (DicJcBSMs.ContainsKey(bsm))
{
f.Value[idx] = "-1";
_cursor.UpdateFeature(f);
}
}
_cursor.Flush();
(TempNMKLayer.FeatureClass as ITable).DeleteSearchedRows(new QueryFilterClass() { WhereClause = "BSM = '-1'" });
IFeatureClassAPI fcAPI = new FeatureClassAPI(pLayerSource.GxTbLayer.FeatureClass);
fcAPI.FcToFc(TempNMKLayer.FeatureClass, null, false);
fcAPI = new FeatureClassAPI(TempNMKLayer.FeatureClass);
fcAPI.AddField("XZQDM", esriFieldType.esriFieldTypeString, "行政区代码");
fcAPI.AddField("XZQTZLX", esriFieldType.esriFieldTypeInteger, "行政区调整类型");
////fcAPI.FcToFc(NMKLayer.FeatureClass, null, false);
//fcAPI = new FeatureClassAPI(pLayerSource.GxTbLayer.FeatureClass);
//fcAPI.FcToFc(TempNMKLayer.FeatureClass, null, false);
ITable nmkTable = TempNMKLayer.FeatureClass as ITable;
//更新后年末库
ICursor nmkCur = nmkTable.Update(null, true);
IRow nmkRow = null;
int bsmIdx = nmkTable.FindField("BSM");
int zldwIdx = nmkTable.FindField("ZLDWDM");
int xzqdmIdx = nmkTable.FindField("XZQDM");
int XZQTZLXmIdx = nmkTable.FindField("XZQTZLX");
int HDMCIdx = nmkTable.FindField("HDMC");
while ((nmkRow = nmkCur.NextRow()) != null)
{
//string bsm = nmkRow.Value[bsmIdx].ToTrim();
//if (hcbghbsm.Contains(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 2;
//}
//else if (msbghbsm.Contains(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 4;
//}
//else if (msbgqbsm.Contains(bsm) && !bghbsmDic.ContainsKey(bsm))
//{
// nmkRow.Value[XZQTZLXmIdx] = 4;
//}
//if (bhxxDic.ContainsKey(bsm))
//{
// for (int i = 0; i < nmkRow.Fields.FieldCount; i++)
// {
// IField field = nmkRow.Fields.Field[i];
// string bghField = "BGH" + field.Name;
// DataRow dr = bhxxDic[bsm];
// if (!dr.Table.Columns.Contains(bghField))
// bghField = "BGHTB" + field.Name;
// if (dr.Table.Columns.Contains(bghField))
// {
// if (field.Type == esriFieldType.esriFieldTypeString)
// {
// nmkRow.Value[i] = msbghbsm.Contains(bsm) ? "" : dr[bghField];
// }
// else if (field.Type == esriFieldType.esriFieldTypeDouble)
// {
// nmkRow.Value[i] = msbghbsm.Contains(bsm) ? 0 : dr[bghField].ToDouble();
// }
// }
// }
//}
if (zldwIdx != -1 && xzqdmIdx != -1)
{
string zldwdm = nmkRow.Value[zldwIdx].ToTrim();
if (!string.IsNullOrWhiteSpace(zldwdm) && zldwdm.Length > 9)
{
nmkRow.Value[xzqdmIdx] = zldwdm.Substring(0, 9);
}
}
if (HDMCIdx != -1)
nmkRow.Value[HDMCIdx] = nmkRow.Value[HDMCIdx].ToString().ToTrim() == "" ? "" : nmkRow.Value[HDMCIdx].ToString().ToTrim();
nmkCur.UpdateRow(nmkRow);
}
nmkCur.Flush();
//nmkTable.DeleteSearchedRows(new QueryFilterClass() { WhereClause = "XZQTZLX=4 or XZQTZLX=2" });
_nmTbLayer = TempNMKLayer;
}
catch (Exception ex)
{
throw ex;
}
}
internal IFeatureLayer OpenLayer(LayerCfg pLayerInfo)
{
try
{
if (pLayerInfo == null)
return null;
if (string.IsNullOrWhiteSpace(pLayerInfo.FcPath) || string.IsNullOrWhiteSpace(pLayerInfo.FcName))
return null;
if (!File.Exists(pLayerInfo.FcPath) && !Directory.Exists(pLayerInfo.FcPath))
return null;
FileInfo fInfo = new FileInfo(pLayerInfo.FcPath);
WorkspaceTypeEnum wsType = WorkspaceTypeEnum.GDBFile;
if (fInfo.FullName.EndsWith(".gdb"))
wsType = WorkspaceTypeEnum.GDBFile;
else if (fInfo.FullName.EndsWith(".mdb"))
wsType = WorkspaceTypeEnum.MDBFile;
else
wsType = WorkspaceTypeEnum.ShapeFile;
if (DicWsAPI == null)
DicWsAPI = new Dictionary<string, IWorkspaceAPI>();
if (!DicWsAPI.ContainsKey(fInfo.FullName))
{
IWorkspaceAPI wsAPI = null;
if (wsType == WorkspaceTypeEnum.GDBFile)
wsAPI = new WorkspaceAPI(fInfo.FullName, wsType, true);
else
wsAPI = new WorkspaceAPI(fInfo.FullName, wsType);
DicWsAPI.Add(fInfo.FullName, wsAPI);
}
IFeatureClassAPI fcAPI = DicWsAPI[fInfo.FullName].OpenFeatureClass(pLayerInfo.FcName);
return new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = fcAPI.FeatureClass.AliasName };
}
catch (Exception ex)
{
LogAPI.Debug(ex.Message + ex.StackTrace);
throw ex;
}
}
internal IFeatureLayer OpenLayer(IWorkspaceAPI pWsAPI, string pLayerName)
{
try
{
if (string.IsNullOrWhiteSpace(pLayerName))
return null;
if (pWsAPI != null && pWsAPI.CurrentWorkspace != null)
{
IFeatureClassAPI fcAPI = pWsAPI.OpenFeatureClass(pLayerName);
return new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = fcAPI.FeatureClass.AliasName };
}
return null;
}
catch (Exception)
{
Console.WriteLine(string.Format("Err:{0}图层获取失败", pLayerName));
return null;
}
}
public string GetTime(DateTime timeA)
{
//timeA 表示需要计算
DateTime timeB = DateTime.Now; //获取当前时间
TimeSpan ts = timeB - timeA; //计算时间差
//string time = ts.TotalSeconds.ToString(); //将时间差转换为秒
string str = "";
if (ts.Hours > 0)
{
str = String.Format("{0:00}", ts.Hours) + ":" + String.Format("{0:00}", ts.Minutes) + ":" + String.Format("{0:00}", ts.Seconds);
}
if (ts.Hours == 0 && ts.Minutes > 0)
{
str = "00:" + String.Format("{0:00}", ts.Minutes) + ":" + String.Format("{0:00}", ts.Seconds);
}
if (ts.Hours == 0 && ts.Minutes == 0)
{
str = "00:00:" + String.Format("{0:00}", ts.Seconds);
}
return str;
}
private bool disposed = false;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
// 释放其他托管资源(如数据库连接等)
}
// 释放非托管资源
#region 释放数据库链接
ZlWsAPI?.CloseWorkspace();
JCWsAPI?.CloseWorkspace();
NmWsAPI?.CloseWorkspace();
#endregion
if (_jcCzcLayer != null)
Marshal.ReleaseComObject(_jcCzcLayer);
_jcCzcLayer = null;
disposed = true;
}
}
}
public class DBLayerSourceHelper
{
public Dictionary<string, IWorkspaceAPI> DicWsAPI { get; set; }
public IWorkspaceAPI BgWsAPI { get; set; }
public IWorkspaceAPI ZlWsAPI { get; set; }
public IWorkspaceAPI NmWsAPI { get; set; }
//public IFeatureLayer JCLayer { get => jCLayer; set => jCLayer = value; }
//public IFeatureLayer GXLayer { get => gXLayer; set => gXLayer = value; }
public IFeatureLayer NmTbLayer { get; set; }
#region 地类图斑
public IFeatureLayer JcTbLayer { get; set; }
public IFeatureLayer JcPdtLayer { get; set; }
public IFeatureLayer GxgcTBLayer { get; set; }
public IFeatureLayer GxTbLayer { get; set; }
public IFeatureLayer GxPdtLayer { get; set; }
public IFeatureLayer BgTbLayer { get; set; }
#endregion
#region 村级调查区
public IFeatureLayer JcCjdcqLayer { get; set; }
public IFeatureLayer JcCjdcqJxLayer { get; set; }
public IFeatureLayer GxCjdcqLayer { get; set; }
public IFeatureLayer GxgcCjdcqLayer { get; set; }
public IFeatureLayer GxCjdcqJxLayer { get; set; }
#endregion
#region 行政区
public IFeatureLayer JcXzqLayer { get; set; }
public IFeatureLayer JcXzqJxLayer { get; set; }
public IFeatureLayer GxXzqLayer { get; set; }
public IFeatureLayer GxgcXzqLayer { get; set; }
public IFeatureLayer GxXzqJxLayer { get; set; }
#endregion
#region 城镇村
public IFeatureLayer JcCzcLayer { get; set; }
public IFeatureLayer GxCzcLayer { get; set; }
public IFeatureLayer GxgcCzcLayer { get; set; }
#endregion
#region 耕地等别
public IFeatureLayer JcGddbLayer { get; set; }
public IFeatureLayer GxGddbLayer { get; set; }
#endregion
public IFeatureLayer OpenLayer(LayerCfg pLayerInfo)
{
if (pLayerInfo == null)
return null;
if (string.IsNullOrWhiteSpace(pLayerInfo.FcPath) || string.IsNullOrWhiteSpace(pLayerInfo.FcName))
return null;
if (!File.Exists(pLayerInfo.FcPath) && !Directory.Exists(pLayerInfo.FcPath))
return null;
FileInfo fInfo = new FileInfo(pLayerInfo.FcPath);
WorkspaceTypeEnum wsType = WorkspaceTypeEnum.GDBFile;
if (fInfo.FullName.EndsWith(".gdb"))
wsType = WorkspaceTypeEnum.GDBFile;
else if (fInfo.FullName.EndsWith(".mdb"))
wsType = WorkspaceTypeEnum.MDBFile;
else
wsType = WorkspaceTypeEnum.ShapeFile;
if (DicWsAPI == null)
DicWsAPI = new Dictionary<string, IWorkspaceAPI>();
if (!DicWsAPI.ContainsKey(fInfo.FullName))
{
IWorkspaceAPI wsAPI = new WorkspaceAPI(fInfo.FullName, wsType);
DicWsAPI.Add(fInfo.FullName, wsAPI);
}
IFeatureClassAPI fcAPI = DicWsAPI[fInfo.FullName].OpenFeatureClass(pLayerInfo.FcName);
return new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = fcAPI.FeatureClass.AliasName };
}
public IFeatureLayer OpenLayer(IWorkspaceAPI pWsAPI, string pLayerName)
{
try
{
if (string.IsNullOrWhiteSpace(pLayerName))
return null;
if (pWsAPI != null && pWsAPI.CurrentWorkspace != null)
{
IFeatureClassAPI fcAPI = pWsAPI.OpenFeatureClass(pLayerName);
return new FeatureLayerClass() { FeatureClass = fcAPI.FeatureClass, Name = fcAPI.FeatureClass.AliasName };
}
return null;
}
catch (Exception ex)
{
Console.WriteLine(string.Format("Err:{0}图层获取失败", pLayerName));
return null;
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,111 +0,0 @@
using KGIS.Framework.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IDGForNDBG
{
/// <summary>
/// Start()
/// Msg()
/// Log()
/// Err()
/// End()
/// </summary>
public class MsgHelper
{
private int MsgNum { get; set; }
public DateTime InitTime { get; set; }
public DateTime ItemStartTime { get; set; }
public void Start(string pMsg)
{
MsgNum++;
InitTime = DateTime.Now;
ItemStartTime = InitTime;
string _msg = string.Empty;
for (int i = 0; i < MsgNum; i++)
{
_msg += " ";
}
_msg += MsgNum + ":↓↓↓↓↓↓开始执行:" + pMsg + " - " + InitTime + " ↓↓↓↓↓↓ ";
Console.WriteLine(_msg);
Msg(pMsg, true);
//Console.WriteLine(pMsg);
}
public void Msg(string pMsg, bool pIsLog = true)
{
string _msg = string.Empty;
for (int i = 0; i < MsgNum; i++)
{
_msg += " ";
}
_msg += MsgNum + "正在执行:" + pMsg;
Console.WriteLine("Msg:正在执行 " + pMsg);
if (pIsLog)
Log(pMsg);
}
public void Log(string pMsg)
{
string _msg = string.Empty;
for (int i = 0; i < MsgNum; i++)
{
_msg += " ";
}
_msg += MsgNum + "正在执行:" + pMsg;
string time = GetTime(ItemStartTime);
LogAPI.Debug(_msg + " - 耗时:" + time);
}
public void Err(string pMsg)
{
string _msg = string.Empty;
for (int i = 0; i < MsgNum; i++)
{
_msg += " ";
}
_msg += MsgNum + "Err:" + pMsg;
string time = GetTime(ItemStartTime);
LogAPI.Debug(_msg + " - 耗时:" + time);
}
public void Throw()
{
string time = GetTime(InitTime);
string _msg = string.Empty;
for (int i = 0; i < MsgNum; i++)
{
_msg += " ";
}
_msg += MsgNum + ":------- 程序异常 ------";
Console.WriteLine(_msg);
Err(_msg);
MsgNum = 1;
End();
}
public void End()
{
string time = GetTime(InitTime);
string _msg = string.Empty;
for (int i = 0; i < MsgNum; i++)
{
_msg += " ";
}
_msg += MsgNum + ":↑↑↑↑↑↑执行完成,总耗时:" + time + "↑↑↑↑↑↑";
Console.WriteLine(_msg);
MsgNum--;
}
private string GetTime(DateTime timeA)
{
//ItemStartTime = DateTime.Now;
//timeA 表示需要计算
DateTime timeB = DateTime.Now; //获取当前时间
TimeSpan ts = timeB - timeA; //计算时间差
string time = ts.TotalSeconds.ToString(); //将时间差转换为秒
ItemStartTime = timeB;
return time;
}
}
}

@ -1,179 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D900B82F-E8D3-45BD-985C-CE6A64DD4322}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>KGIS_DLTB</RootNamespace>
<AssemblyName>KGIS_DLTB</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Apps\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Apps\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>JKRJ.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="ESRI.ArcGIS.Carto, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.Carto.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.ConversionTools, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.ConversionTools.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.DataManagementTools, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.DataManagementTools.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ESRI.ArcGIS.DataSourcesGDB, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.DataSourcesGDB.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.Display, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.Display.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.Geodatabase, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.Geodatabase.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.Geometry, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.Geometry.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.Geoprocessing, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.Geoprocessing.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.Geoprocessor, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.Geoprocessor.dll</HintPath>
</Reference>
<Reference Include="ESRI.ArcGIS.System, Version=10.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>False</EmbedInteropTypes>
<HintPath>..\Lib\ESRI\ESRI.ArcGIS.System.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.AE, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\KGIS.Framework.AE.1.0.6\lib\KGIS.Framework.AE.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.DBOperator, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\KGIS.Framework.DBOperator.1.0.0\lib\KGIS.Framework.DBOperator.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Platform, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Kingo.Plugins\在线建库\周报统计表\lib\KGIS.Framework.Platform.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Utils">
<HintPath>..\Apps\KGIS.Framework.Utils.dll</HintPath>
</Reference>
<Reference Include="Kingo.Core.FlowManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=608efb5f401b6024, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\授权dll\授权校验\Kingo.Core.FlowManager.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\KGIS.Framework.AE.1.0.6\lib\stdole.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\KGIS.Framework.DBOperator.1.0.0\lib\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GPHelper\ExeGPForProces.cs" />
<Compile Include="GPHelper\GeoprocessorHelper.cs" />
<Compile Include="Helper\BaseIDG.cs" />
<Compile Include="Helper\DLTB_IDGHelper.cs" />
<Compile Include="Helper\MsgHelper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="JKRJ.pfx" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Kingo.PluginServiceInterface\Kingo.PluginServiceInterface.csproj">
<Project>{5e1f7e10-99ea-4893-8d52-a38b9491896d}</Project>
<Name>Kingo.PluginServiceInterface</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

@ -1,128 +0,0 @@
using KGIS.Framework.Utils;
using Kingo.PluginServiceInterface;
using Kingo.PluginServiceInterface.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Xml.Linq;
namespace KGIS_DLTB
{
class Program
{
[STAThread]
static void Main(string[] args)
{
try
{
if (IsAdministrator())
{
Console.WriteLine("IsAdministrator_True");
}
else
{
Console.WriteLine("IsAdministrator_False");
}
#region 授权校验及GIS授权校验
bool v = GPHelper.Instance.ValidityLic();
if (!KGIS.Framework.AE.AELicense.AoInit())
{
Console.WriteLine("Err:获取GIS授权信息失效!");
return;
}
else if (!v)
{
Console.WriteLine("Err:获取工程数据配置信息失败KGISDLTB!");
return;
}
#endregion
//args = new string[] { "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iZ2IyMzEyIj8+PElER1BhcmFtZXRlciB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIj48QWxsb3dVbmlvbj50cnVlPC9BbGxvd1VuaW9uPjxBdXRvQ2FsY0dES0NTWD50cnVlPC9BdXRvQ2FsY0dES0NTWD48QXV0b1NldEdETFg+dHJ1ZTwvQXV0b1NldEdETFg+PEFsbG93UERGWj50cnVlPC9BbGxvd1BERlo+PFN0clByb2pJbmZvPkY6XOW7uuW6k+i9r+S7tuW3peeoi+ebruW9lVwwMuS7iuWlpeW3peeoi+WQiOmbhlzlvrfmg6DluIIoMjIwMTgzKVzlt6XnqIvnm67lvZVc5b635oOgNi4w54mI5pys5rWL6K+VXOW+t+aDoDYuMOeJiOacrOa1i+ivlS5LQkc8L1N0clByb2pJbmZvPjxFeGVETFRCPnRydWU8L0V4ZURMVEI+PEV4ZUdEREI+ZmFsc2U8L0V4ZUdEREI+PEV4ZUNKRENRPmZhbHNlPC9FeGVDSkRDUT48RXhlWFpRPmZhbHNlPC9FeGVYWlE+PEV4ZUNaQz5mYWxzZTwvRXhlQ1pDPjxFeGVaTEhaPmZhbHNlPC9FeGVaTEhaPjwvSURHUGFyYW1ldGVyPg==" };
if (args.Length == 1)
{
Exe(args[0]);
}
//Console.WriteLine(DateTime.Now.ToString());
//Console.WriteLine(GetTime(s_dt));
//Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine("Main_fila" + ex.Message + ex.StackTrace);
Console.ReadKey();
}
}
public static bool IsAdministrator()
{
WindowsIdentity current = WindowsIdentity.GetCurrent();
WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current);
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
}
static void Exe(string pParm)
{
try
{
DateTime s_dt = DateTime.Now;
byte[] base64ToByte = Convert.FromBase64String(pParm);
string strParm = Encoding.UTF8.GetString(base64ToByte);
IDGParameter gPParamClass = SerializeAPI.DeserializeToObject<IDGParameter>(strParm);
if (gPParamClass == null)
{
return;
}
if (!string.IsNullOrWhiteSpace(gPParamClass.StrProjInfo) && File.Exists(gPParamClass.StrProjInfo))
{
gPParamClass.PrjInfo = ProjectInfo.OpenProject(gPParamClass.StrProjInfo);
if (gPParamClass.PrjInfo == null)
{
Console.WriteLine("Err:获取工程信息失败!");
}
}
Dictionary<string, decimal> _kcxsDic = new Dictionary<string, decimal>();//《字符串-数字》字典集合
string strPath = gPParamClass.PrjInfo.ProjDir + "\\BG_GDLXConfig.xml";//获取配置文件路径
if (string.IsNullOrWhiteSpace(strPath) || !File.Exists(strPath))
strPath = SysAppPath.GetBGGDLXConfigPath();
XDocument xDoc = XDocument.Load(strPath);
foreach (XElement xElement in xDoc.Descendants("Item"))
{
string gdlx = xElement.Attributes("GDLX").Single().Value;
string gdpdjb = xElement.Attributes("GDPDJB").Single().Value;
string strKcdlxs = xElement.Attributes("KCDLXS").Single().Value;
decimal kcdlxs = Convert.ToDecimal(xElement.Attributes("KCDLXS").Single().Value == "" ? "0" : xElement.Attributes("KCDLXS").Single().Value);
string key = string.Format("{0}-{1}", gdlx, gdpdjb);
_kcxsDic.Add(key, kcdlxs);
}
gPParamClass.KCXSDic = _kcxsDic;
if (gPParamClass.PrjInfo.ListZLXXInfo == null)
gPParamClass.PrjInfo.ListZLXXInfo = new System.Collections.ObjectModel.ObservableCollection<Kingo.PluginServiceInterface.ZLXXInfo>();
if (gPParamClass.ExeDLTB)
{
DLTB_IDGHelper helper = new DLTB_IDGHelper();
Console.WriteLine($"Msg:正在执行地类图斑数据提取");
Console.WriteLine($"Log:正在执行【{gPParamClass.PrjInfo.CodeName}_{gPParamClass.PrjInfo.ProjName}】变更成果数据提取");
helper.Execute(gPParamClass);
}
Console.Clear();
Console.WriteLine("执行完成,耗时:" + GetTime(s_dt) + "秒");
Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public static string GetTime(DateTime timeA)
{
//timeA 表示需要计算
DateTime timeB = DateTime.Now; //获取当前时间
TimeSpan ts = timeB - timeA; //计算时间差
string time = ts.TotalSeconds.ToString(); //将时间差转换为秒
return time;
}
}
}

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("KGIS_DLTB")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KGIS_DLTB")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("d900b82f-e8d3-45bd-985c-ce6a64dd4322")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="KGIS.Framework.AE" version="1.0.6" targetFramework="net472" />
</packages>

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="LicenseType" value="F" />
<add key="APPID" value="7F609D5F-1C39-402A-B900-5C4C36B043CD" />
<add key="APPName" value="内 业 数 据 处 理 软 件 V3.0" />
<add key="APPType" value="TBBG" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.112.0" newVersion="1.0.112.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -1,217 +0,0 @@
/******************************************************************************
*
* Name: GdalConfiguration.cs.pp
* Project: GDAL CSharp Interface
* Purpose: A static configuration utility class to enable GDAL/OGR.
* Author: Felix Obermaier
*
******************************************************************************
* Copyright (c) 2012-2018, Felix Obermaier
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using Gdal = OSGeo.GDAL.Gdal;
using Ogr = OSGeo.OGR.Ogr;
namespace KIngo.DataProcessing
{
public static partial class GdalConfiguration
{
private static volatile bool _configuredOgr;
private static volatile bool _configuredGdal;
private static volatile bool _usable;
[DllImport("kernel32", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool SetDefaultDllDirectories(uint directoryFlags);
// LOAD_LIBRARY_SEARCH_DEFAULT_DIRS
private const uint DllSearchFlags = 0x00001000;
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AddDllDirectory(string lpPathName);
/// <summary>
/// Construction of Gdal/Ogr
/// </summary>
static GdalConfiguration()
{
string executingDirectory = null, gdalPath = null, nativePath = null;
try
{
if (!IsWindows)
{
const string notSet = "_Not_set_";
string tmp = Gdal.GetConfigOption("GDAL_DATA", notSet);
_usable = tmp != notSet;
return;
}
string executingAssemblyFile = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;
executingDirectory = Path.GetDirectoryName(executingAssemblyFile);
if (string.IsNullOrEmpty(executingDirectory))
throw new InvalidOperationException("cannot get executing directory");
// modify search place and order
//SetDefaultDllDirectories(DllSearchFlags);
gdalPath = Path.Combine(executingDirectory, "gdal");
nativePath = Path.Combine(gdalPath, GetPlatform());
if (!Directory.Exists(nativePath))
throw new DirectoryNotFoundException($"GDAL native directory not found at '{nativePath}'");
if (!File.Exists(Path.Combine(nativePath, "gdal_wrap.dll")))
throw new FileNotFoundException(
$"GDAL native wrapper file not found at '{Path.Combine(nativePath, "gdal_wrap.dll")}'");
// Add directories
//AddDllDirectory(nativePath);
//AddDllDirectory(Path.Combine(nativePath, "plugins"));
// Set the additional GDAL environment variables.
string gdalData = Path.Combine(gdalPath, "data");
Environment.SetEnvironmentVariable("GDAL_DATA", gdalData);
Gdal.SetConfigOption("GDAL_DATA", gdalData);
string driverPath = Path.Combine(nativePath, "plugins");
Environment.SetEnvironmentVariable("GDAL_DRIVER_PATH", driverPath);
Gdal.SetConfigOption("GDAL_DRIVER_PATH", driverPath);
Environment.SetEnvironmentVariable("GEOTIFF_CSV", gdalData);
Gdal.SetConfigOption("GEOTIFF_CSV", gdalData);
string projSharePath = Path.Combine(gdalPath, "share");
Environment.SetEnvironmentVariable("PROJ_LIB", projSharePath);
Gdal.SetConfigOption("PROJ_LIB", projSharePath);
OSGeo.OSR.Osr.SetPROJSearchPaths(new[] { projSharePath });
OSGeo.OSR.Osr.SetPROJSearchPath(@"./gdal/share");
_usable = true;
}
catch (Exception e)
{
_usable = false;
Trace.WriteLine(e, "error");
Trace.WriteLine($"Executing directory: {executingDirectory}", "error");
Trace.WriteLine($"gdal directory: {gdalPath}", "error");
Trace.WriteLine($"native directory: {nativePath}", "error");
//throw;
}
}
/// <summary>
/// Gets a value indicating if the GDAL package is set up properly.
/// </summary>
public static bool Usable
{
get { return _usable; }
}
/// <summary>
/// Method to ensure the static constructor is being called.
/// </summary>
/// <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks>
public static void ConfigureOgr()
{
if (!_usable) return;
if (_configuredOgr) return;
// Register drivers
Ogr.RegisterAll();
_configuredOgr = true;
PrintDriversOgr();
}
/// <summary>
/// Method to ensure the static constructor is being called.
/// </summary>
/// <remarks>Be sure to call this function before using Gdal/Ogr/Osr</remarks>
public static void ConfigureGdal()
{
if (!_usable) return;
if (_configuredGdal) return;
// Register drivers
Gdal.AllRegister();
_configuredGdal = true;
PrintDriversGdal();
}
/// <summary>
/// Function to determine which platform we're on
/// </summary>
private static string GetPlatform()
{
return Environment.Is64BitProcess ? "x64" : "x86";
}
/// <summary>
/// Gets a value indicating if we are on a windows platform
/// </summary>
private static bool IsWindows
{
get
{
var res = !(Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == PlatformID.MacOSX);
return res;
}
}
private static void PrintDriversOgr()
{
#if DEBUG
if (_usable)
{
var num = Ogr.GetDriverCount();
for (var i = 0; i < num; i++)
{
var driver = Ogr.GetDriver(i);
Trace.WriteLine($"OGR {i}: {driver.GetName()}", "Debug");
}
}
#endif
}
private static void PrintDriversGdal()
{
#if DEBUG
if (_usable)
{
var num = Gdal.GetDriverCount();
for (var i = 0; i < num; i++)
{
var driver = Gdal.GetDriver(i);
Trace.WriteLine($"GDAL {i}: {driver.ShortName}-{driver.LongName}");
}
}
#endif
}
}
}

@ -1,218 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>KIngo.DataProcessing</RootNamespace>
<AssemblyName>KIngo.DataProcessing</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<LargeAddressAware>True</LargeAddressAware>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Apps\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>JKRJ.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>NewIcon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="gdalconst_csharp, Version=3.5.0.0, Culture=neutral, PublicKeyToken=db5a52b08dc5b321, processorArchitecture=MSIL">
<HintPath>..\packages\GDAL.3.5.0\lib\netstandard2.0\gdalconst_csharp.dll</HintPath>
</Reference>
<Reference Include="gdal_csharp, Version=3.5.0.0, Culture=neutral, PublicKeyToken=db5a52b08dc5b321, processorArchitecture=MSIL">
<HintPath>..\packages\GDAL.3.5.0\lib\netstandard2.0\gdal_csharp.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.AE, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\KGIS.Framework.AE.1.0.6\lib\KGIS.Framework.AE.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Commands, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibrary.2.1.3\lib\KGIS.Framework.Commands.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Core, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibrary.2.1.3\lib\KGIS.Framework.Core.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Maps, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibraryForMap.2.0.6\lib\KGIS.Framework.Maps.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Menus, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibrary.2.1.3\lib\KGIS.Framework.Menus.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.OpenData, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\KGIS.Framework.OpenData.1.0.0\lib\KGIS.Framework.OpenData.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Platform, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibrary.2.1.3\lib\KGIS.Framework.Platform.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Utils, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibrary.2.1.3\lib\KGIS.Framework.Utils.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.Views, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibrary.2.1.3\lib\KGIS.Framework.Views.dll</HintPath>
</Reference>
<Reference Include="Kingo.Core.Authorize, Version=1.1.9.0, Culture=neutral, PublicKeyToken=49863d91e6d94444, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.Core.Authorize.1.1.15\lib\net452\Kingo.Core.Authorize.dll</HintPath>
</Reference>
<Reference Include="Kingo.Core.SntlAuthorize, Version=0.0.0.0, Culture=neutral, PublicKeyToken=49863d91e6d94444, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.Core.SntlAuthorize.1.0.5\lib\net452\Kingo.Core.SntlAuthorize.dll</HintPath>
</Reference>
<Reference Include="KUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<HintPath>..\packages\KUI.2.0.5\lib\KUI.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Windows.Shell, Version=3.5.41019.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\KUI.2.0.5\lib\Microsoft.Windows.Shell.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ogr_csharp, Version=3.5.0.0, Culture=neutral, PublicKeyToken=db5a52b08dc5b321, processorArchitecture=MSIL">
<HintPath>..\packages\GDAL.3.5.0\lib\netstandard2.0\ogr_csharp.dll</HintPath>
</Reference>
<Reference Include="osr_csharp, Version=3.5.0.0, Culture=neutral, PublicKeyToken=db5a52b08dc5b321, processorArchitecture=MSIL">
<HintPath>..\packages\GDAL.3.5.0\lib\netstandard2.0\osr_csharp.dll</HintPath>
</Reference>
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\packages\KGIS.Framework.AE.1.0.6\lib\stdole.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.112.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\KGIS.Framework.AE.1.0.6\lib\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Utility, Version=3.0.0.1, Culture=neutral, PublicKeyToken=71fa2eff70283245, processorArchitecture=x86">
<HintPath>..\packages\KUI.2.0.5\lib\System.Utility.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="UIShell.OSGi, Version=1.2.2.5, Culture=neutral, PublicKeyToken=c86472448ee87261, processorArchitecture=MSIL">
<HintPath>..\packages\Kingo.PluginLibrary.2.1.3\lib\UIShell.OSGi.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="GdalConfiguration.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="JKRJ.pfx" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.7.2 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Content Include="NewIcon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\GDAL.Native.3.5.0\build\netstandard2.0\GDAL.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GDAL.Native.3.5.0\build\netstandard2.0\GDAL.Native.targets'))" />
<Error Condition="!Exists('..\packages\LargeAddressAware.1.0.5\build\LargeAddressAware.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LargeAddressAware.1.0.5\build\LargeAddressAware.targets'))" />
<Error Condition="!Exists('..\packages\Kingo.Core.SntlAuthorize.1.0.5\build\Kingo.Core.SntlAuthorize.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Kingo.Core.SntlAuthorize.1.0.5\build\Kingo.Core.SntlAuthorize.targets'))" />
<Error Condition="!Exists('..\packages\Kingo.Core.Authorize.1.1.15\build\Kingo.Core.Authorize.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Kingo.Core.Authorize.1.1.15\build\Kingo.Core.Authorize.targets'))" />
</Target>
<Import Project="..\packages\GDAL.Native.3.5.0\build\netstandard2.0\GDAL.Native.targets" Condition="Exists('..\packages\GDAL.Native.3.5.0\build\netstandard2.0\GDAL.Native.targets')" />
<Import Project="..\packages\LargeAddressAware.1.0.5\build\LargeAddressAware.targets" Condition="Exists('..\packages\LargeAddressAware.1.0.5\build\LargeAddressAware.targets')" />
<Import Project="..\packages\Kingo.Core.SntlAuthorize.1.0.5\build\Kingo.Core.SntlAuthorize.targets" Condition="Exists('..\packages\Kingo.Core.SntlAuthorize.1.0.5\build\Kingo.Core.SntlAuthorize.targets')" />
<Import Project="..\packages\Kingo.Core.Authorize.1.1.15\build\Kingo.Core.Authorize.targets" Condition="Exists('..\packages\Kingo.Core.Authorize.1.1.15\build\Kingo.Core.Authorize.targets')" />
</Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

@ -1,302 +0,0 @@
using KGIS.Framework.Core.Services;
using KGIS.Framework.Platform;
using KGIS.Framework.Platform.Interface;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using Kingo;
using Kingo.Core.Authorize;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Management;
using System.Reflection;
using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Threading;
using System.Windows.Forms;
using UIShell.OSGi;
namespace KIngo.DataProcessing
{
static class Program
{
internal delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
private extern static IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
private static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
internal static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
internal static extern int GetWindowThreadProcessId(IntPtr hWnd, out IntPtr lpdwProcessId);
[DllImport("User32.dll", CharSet = CharSet.Auto)]
internal static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);
[DllImport("USER32.DLL")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
public static bool v = false;
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
GdalConfiguration.ConfigureGdal();
GdalConfiguration.ConfigureOgr();
//Application.Run(platform.Instance);
Platform.Instance.SystemType = SystemTypeEnum.TBBG;
Mutex instance = new Mutex(true, $"{Platform.Instance.SystemType}_30", out bool createdNew);
if (createdNew)
{
}
else
{
//MessageHelper.ShowTips("已经打开该应用程序,请先关闭!");
Process curr = Process.GetCurrentProcess();
List<Process> process = Process.GetProcessesByName(curr.ProcessName).ToList();//.
//Where(p => p.Id != curr.Id && p.GetCommandLine().Contains($"{Platform.Instance.SystemType}_30")).ToList();
if (process != null && process.Count > 0)
{
foreach (Process item in process)
{
//IntPtr mainPtr = GetProcessHandle(item.Id);
//ShowWindow(mainPtr, 3);
ShowWindow(item.MainWindowHandle, 1);
SetForegroundWindow(item.MainWindowHandle);
break;
}
}
Application.Exit();
return;
}
try
{
ServiceController sc = new ServiceController("ArcGIS License Manager");
if (!KGIS.Framework.AE.AELicense.AoInit(true) || sc.Status == ServiceControllerStatus.Stopped)
{
MessageHelper.Show("ArcGIS授权服务未启动或已到期,请检查ArcGIS授权!");
return;
}
}
catch (Exception EX)
{
MessageHelper.Show("ArcGIS授权服务未启动或已到期,请检查ArcGIS授权!");
LogAPI.Debug(EX.Message);
return;
}
using (var bundleRuntime = new BundleRuntime())
{
#region
int loadedBundleCount = 0;
Action<bool> action = null;
IAsyncResult asyncResult = null;
IPluginStart startPlugin = null;
List<IBundle> bundles = new List<IBundle>();
//插件状态发生改变事件,用来加载启动插件的进度
EventHandler<BundleStateChangedEventArgs> bundleStateChangeEventHandler = (sender, e) =>
{
if (e.CurrentState != BundleState.Starting || e.Bundle.Name == "SystemBundle")
return;
if (startPlugin == null)
startPlugin = bundleRuntime.GetFirstOrDefaultService<IPluginStart>();
string[] Name_ID = e.Bundle.Name.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
if (startPlugin != null)
{
startPlugin.SetTitle(ConfigurationManager.AppSettings.Get("APPName"));
startPlugin.SetSystemType(SystemTypeEnum.TBBG.ToString());
if (Name_ID.Length == 2)
{
if (!Name_ID[1].Contains(SystemTypeEnum.TBBG.ToString()))
{
bundles.Add(e.Bundle);
//e.Bundle.Stop(BundleStopOptions.Transient);
}
}
//}
if (!startPlugin.IsShow)
{
action = (ar) =>
{
if (ar)
{
startPlugin.ShowDialog();
}
else
{
}
//isWelcomeShow = true;
};
asyncResult = action.BeginInvoke(true, null, null);
//等待启动界面打开
while (!startPlugin.IsShow)
{
Thread.Sleep(50);
}
loadedBundleCount++;
startPlugin.SetPercent(loadedBundleCount, bundleRuntime.Framework.Bundles.Count - 1, Name_ID[0]);
}
else
{
loadedBundleCount++;
startPlugin.SetPercent(loadedBundleCount, bundleRuntime.Framework.Bundles.Count - 1, Name_ID[0]);
}
}
else
{
LogAPI.Debug("000000");
}
//e.Bundle.BundleID
};
#if DEBUG
Validity(bundleRuntime);
#else
Validity(bundleRuntime);
#endif
if (!v)
return;
//注册插件状态事件
bundleRuntime.Framework.EventManager.AddBundleEventListener(bundleStateChangeEventHandler, true);
//开始启动插件
bundleRuntime.Start();
//取消插件状态的事件
bundleRuntime.Framework.EventManager.RemoveBundleEventListener(bundleStateChangeEventHandler, true);
#endregion
foreach (IBundle item in bundles)
{
LogAPI.Debug("Del:" + item.Name);
item.Stop(BundleStopOptions.Transient);
}
var platform = bundleRuntime.GetFirstOrDefaultService<IPlatformService>();
if (platform != null)
{
//platform.InitService();
Platform.Instance.Open();
platform.InitUI(null);
if (startPlugin != null)
startPlugin.CloseForm();
ExtensionShowWindow.MainWinForm = platform.Instance;
Platform.Instance.OutputMsg("系统初始化完成。");
Platform.Instance.UpdateStateBar("系统初始化完成");
Application.Run(platform.Instance);
RunIDService.Dispose();
}
else
{
LogAPI.Debug("IPlatformService接口获取失败!");
}
}
}
private static void Validity(object obj)
{
try
{
//判断授权方式
var type = ConfigurationManager.AppSettings.Get("LicenseType");
if (type == "F")//本地授权
{
Attribute guid_attr = Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(GuidAttribute));
string guid = ((GuidAttribute)guid_attr).Value;
try
{
string[] licpath = System.IO.Directory.GetFiles(System.Environment.CurrentDirectory, "*.lic", System.IO.SearchOption.TopDirectoryOnly);
if (licpath.Length == 0)
{
MessageHelper.ShowError("授权校验失败!");
}
if (licpath.Length == 0 || !RunIDService2.Instance.Verify(AuthorizeType., "BGDCPRO", "300", "3x", "", "10eaa61"))
{
KGIS.PlatformPlugin.Views.License.LicenseView lic = new KGIS.PlatformPlugin.Views.License.LicenseView(obj, "BGDCPRO", "300", "3x");
lic.Code = "10eaa61";
int num = -1;
//lic.DocValidity = Validity;
DialogResult dialog = lic.ShowDialog();
if (dialog != DialogResult.Yes && dialog != DialogResult.OK)
{
v = false;
return;
}
}
else
{
v = true;
return;
}
}
catch (Exception ex)
{
MessageHelper.Show(ex.Message);
LogAPI.Debug(ex);
KGIS.PlatformPlugin.Views.License.LicenseView lic = new KGIS.PlatformPlugin.Views.License.LicenseView(obj, "BGDCPRO", "300", "3x");
lic.Code = "10eaa61";
int num = -1;
//lic.DocValidity = Validity;
DialogResult dialog = lic.ShowDialog();
if (dialog != DialogResult.Yes || dialog != DialogResult.OK)
{
v = false;
return;
}
}
}
else if (type == "D")
{
if (!RunIDService2.Instance.Verify("BGDCPRO", "300", "3x"))
{
KGIS.PlatformPlugin.Views.License.LicenseView lic = new KGIS.PlatformPlugin.Views.License.LicenseView(obj, "BGDCPRO", "300", "3x");
DialogResult dialog = lic.ShowDialog();
if (dialog != DialogResult.Yes && dialog != DialogResult.OK)
{
v = false;
return;
}
}
}
else
{
KGIS.PlatformPlugin.Views.License.LicenseView lic = new KGIS.PlatformPlugin.Views.License.LicenseView(obj, "BGDCPRO", "300", "3x");
int num = -1;
lic.DocValidity = Validity;
DialogResult dialog = lic.ShowDialog();
if (dialog != DialogResult.Yes || dialog != DialogResult.OK)
{
v = false;
return;
}
}
v = true;
}
catch (Exception ex)
{
LogAPI.Debug(ex);
}
}
private static string GetCommandLine(this Process process)
{
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id))
using (ManagementObjectCollection objects = searcher.Get())
{
return objects.Cast<ManagementBaseObject>().SingleOrDefault()?["CommandLine"]?.ToString();
}
}
}
}

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("KIngo.DataProcessing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KIngo.DataProcessing")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("1572a6eb-ae63-42b0-b3a4-63d69c56c74a")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -1,70 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace KIngo.DataProcessing.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KIngo.DataProcessing.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -1,29 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace KIngo.DataProcessing.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GDAL" version="3.5.0" targetFramework="net472" />
<package id="GDAL.Native" version="3.5.0" targetFramework="net472" />
<package id="KGIS.Framework.AE" version="1.0.6" targetFramework="net472" />
<package id="KGIS.Framework.OpenData" version="1.0.0" targetFramework="net472" />
<package id="Kingo.Core.Authorize" version="1.1.15" targetFramework="net472" />
<package id="Kingo.Core.SntlAuthorize" version="1.0.5" targetFramework="net472" />
<package id="Kingo.PluginLibrary" version="2.1.3" targetFramework="net472" />
<package id="Kingo.PluginLibraryForMap" version="2.0.6" targetFramework="net472" />
<package id="KUI" version="2.0.5" targetFramework="net472" />
<package id="LargeAddressAware" version="1.0.5" targetFramework="net472" />
<package id="log4net" version="2.0.12" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="UIShell.OSGi" version="1.2.2.5" targetFramework="net472" />
</packages>

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.0.11123.170
# Visual Studio Version 17
VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kingo.BuildDB", "Kingo.PluginClient\Kingo.BuildDB.csproj", "{08716CF2-16E4-445A-8FD6-CB50010EAA61}"
EndProject
@ -23,16 +23,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kingo.PluginServiceInterfac
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KGIS.Plugin.LayerProperty", "Kingo.Plugins\KGIS.Plugin.LayerProperty\KGIS.Plugin.LayerProperty.csproj", "{9CC2C7EC-6E24-4C13-9927-83C48E0E6C66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KIngo.DataProcessing", "KIngo.DataProcessing\KIngo.DataProcessing.csproj", "{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Kingo.Framework.LayerStyleConvert", "Kingo.Plugins\Kingo.Framework.LayerStyleConvert\Kingo.Framework.LayerStyleConvert.csproj", "{2592A112-78AE-448D-A828-4DB3C5300E92}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "IDEParameter", "IDEParameter\IDEParameter.shproj", "{BFF9CCC3-7B6D-4984-BC9A-CF7E90807C0A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GPHelper", "GPHelper\GPHelper.csproj", "{D1BB1EC2-2112-4BE2-AB12-5F4394D8BEE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KGIS_DLTB", "KGIS_DLTB\KGIS_DLTB.csproj", "{D900B82F-E8D3-45BD-985C-CE6A64DD4322}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JKRJ_Startup", "JKRJ_Startup\JKRJ_Startup.csproj", "{1533760F-9DE6-4313-9DDF-B82A345D1397}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Kingo.ThreadManager", "Kingo.ThreadManager\Kingo.ThreadManager.csproj", "{E94D3521-CDCF-4E00-80BB-0C81EF14C85C}"
@ -125,14 +121,6 @@ Global
{9CC2C7EC-6E24-4C13-9927-83C48E0E6C66}.Release|Any CPU.Build.0 = Release|Any CPU
{9CC2C7EC-6E24-4C13-9927-83C48E0E6C66}.Release|x86.ActiveCfg = Release|x86
{9CC2C7EC-6E24-4C13-9927-83C48E0E6C66}.Release|x86.Build.0 = Release|x86
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Debug|x86.ActiveCfg = Debug|Any CPU
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Debug|x86.Build.0 = Debug|Any CPU
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Release|Any CPU.Build.0 = Release|Any CPU
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Release|x86.ActiveCfg = Release|Any CPU
{1572A6EB-AE63-42B0-B3A4-63D69C56C74A}.Release|x86.Build.0 = Release|Any CPU
{2592A112-78AE-448D-A828-4DB3C5300E92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2592A112-78AE-448D-A828-4DB3C5300E92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2592A112-78AE-448D-A828-4DB3C5300E92}.Debug|x86.ActiveCfg = Debug|Any CPU
@ -149,14 +137,6 @@ Global
{D1BB1EC2-2112-4BE2-AB12-5F4394D8BEE8}.Release|Any CPU.Build.0 = Release|Any CPU
{D1BB1EC2-2112-4BE2-AB12-5F4394D8BEE8}.Release|x86.ActiveCfg = Release|Any CPU
{D1BB1EC2-2112-4BE2-AB12-5F4394D8BEE8}.Release|x86.Build.0 = Release|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Debug|x86.ActiveCfg = Debug|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Debug|x86.Build.0 = Debug|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Release|Any CPU.Build.0 = Release|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Release|x86.ActiveCfg = Release|Any CPU
{D900B82F-E8D3-45BD-985C-CE6A64DD4322}.Release|x86.Build.0 = Release|Any CPU
{1533760F-9DE6-4313-9DDF-B82A345D1397}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1533760F-9DE6-4313-9DDF-B82A345D1397}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1533760F-9DE6-4313-9DDF-B82A345D1397}.Debug|x86.ActiveCfg = Debug|Any CPU

@ -1,12 +1,4 @@
using Fleck;
using KGIS.Framework.Core.Services;
using KGIS.Framework.Platform;
using KGIS.Framework.Platform.Interface;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using Kingo.PluginServiceInterface;
using Microsoft.Win32;
using System;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
@ -15,6 +7,14 @@ using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Threading;
using System.Windows.Forms;
using Fleck;
using KGIS.Framework.Core.Services;
using KGIS.Framework.Platform;
using KGIS.Framework.Platform.Interface;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using Kingo.PluginServiceInterface;
using Microsoft.Win32;
using UIShell.OSGi;
namespace Kingo.BuildDB

@ -115,9 +115,11 @@
<HintPath>..\Lib\GDAL.CSharp.dll</HintPath>
</Reference>
<Reference Include="GeoAPI, Version=1.7.5.0, Culture=neutral, PublicKeyToken=a1a0da7def465678, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\GeoAPI.Core.1.7.5\lib\net45\GeoAPI.dll</HintPath>
</Reference>
<Reference Include="GeoAPI.CoordinateSystems, Version=1.7.5.0, Culture=neutral, PublicKeyToken=a1a0da7def465678, processorArchitecture=MSIL">
<HintPath>..\packages\GeoAPI.CoordinateSystems.1.7.5\lib\net45\GeoAPI.CoordinateSystems.dll</HintPath>
</Reference>
<Reference Include="KGIS.Framework.AE, Version=1.0.1.0, Culture=neutral, PublicKeyToken=4b1e5714b0a20e90, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\KGIS.Framework.AE.1.0.6\lib\KGIS.Framework.AE.dll</HintPath>
@ -188,9 +190,11 @@
<HintPath>..\packages\KUI.2.0.5\lib\Microsoft.Windows.Shell.dll</HintPath>
</Reference>
<Reference Include="NetTopologySuite, Version=1.15.3.0, Culture=neutral, PublicKeyToken=f580a05016ebada1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NetTopologySuite.Core.1.15.3\lib\net45\NetTopologySuite.dll</HintPath>
</Reference>
<Reference Include="NetTopologySuite.CoordinateSystems, Version=1.15.3.0, Culture=neutral, PublicKeyToken=f580a05016ebada1, processorArchitecture=MSIL">
<HintPath>..\packages\NetTopologySuite.CoordinateSystems.1.15.3\lib\net45\NetTopologySuite.CoordinateSystems.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>

@ -1,12 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fleck" version="1.2.0" targetFramework="net472" />
<package id="GeoAPI.CoordinateSystems" version="1.7.5" targetFramework="net472" />
<package id="GeoAPI.Core" version="1.7.5" targetFramework="net472" />
<package id="KGIS.Framework.DBOperator" version="1.0.0" targetFramework="net472" />
<package id="Kingo.Core.Authorize" version="1.1.15" targetFramework="net472" />
<package id="Kingo.Core.SntlAuthorize" version="1.0.5" targetFramework="net472" />
<package id="Kingo.PluginLibrary" version="2.1.3" targetFramework="net472" />
<package id="KUI" version="2.0.5" targetFramework="net472" />
<package id="Microsoft.Data.Sqlite.Core" version="8.0.4" targetFramework="net472" />
<package id="NetTopologySuite" version="1.15.3" targetFramework="net472" />
<package id="NetTopologySuite.CoordinateSystems" version="1.15.3" targetFramework="net472" />
<package id="NetTopologySuite.Core" version="1.15.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="SQLitePCLRaw.bundle_sqlcipher" version="1.1.14" targetFramework="net472" />
<package id="SQLitePCLRaw.core" version="2.1.8" targetFramework="net472" />

@ -1,520 +0,0 @@
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Geodatabase;
using KGIS.Framework.AE;
using KGIS.Framework.Commands;
using KGIS.Framework.DBOperator;
using KGIS.Framework.Maps;
using KGIS.Framework.Platform;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using KGIS.Framework.Views;
using Kingo.PluginServiceInterface;
using KUI.Windows;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using UIShell.OSGi;
namespace Kingo.Plugin.MapView.Commands
{
/// <summary>
/// 同步模板数据
/// </summary>
public class CmdCopyFileData : BaseMenuCommand
{
private IEngineEditor m_Editor;
public IHookHelper m_hookHelper { get; set; }
private ProjectInfo projectInfo = null;
public override void OnClick()
{
projectInfo = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
CopyFileData();
}
public override void OnCreate(object Hook)
{
try
{
if (m_hookHelper == null)
{
m_hookHelper = new HookHelper
{
Hook = Hook
};
}
if (m_Editor == null)
m_Editor = new EngineEditorClass();
}
catch (Exception ex)
{
LogAPI.Debug("初始化 同步模板数据 时异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("初始化 同步模板数据 时异常信息结束");
}
}
public override bool Enabled
{
get
{
//验证是否打开工程
object ProInfo = KGIS.Framework.Maps.MapsManager.Instance.MapService.GetProjectInfo();
if (ProInfo == null)
return false;
else
return true;
}
}
private void CopyFileData()
{
try
{
this.ShowLoading("正在进行同步模板数据.......", 0, 0);
//GDB 1、BGDB.gdb 2、NMDB.gdb 3、Scheme0.gdb 4、Scheme-YCL.gdb 5、ZLDB.gdb
CopyGDB("BGDB");
CopyGDB("ZLDB");
CopyGDB("NMDB");
CopyGDB("Scheme0");
CopyGDB("Scheme-YCL");
//BGTJ.sqlite 里面的表格
CopySqlite();
//变更成果模板
CopyBGCG();
//dic.mdb ReportData.db 变更成果检查.xls 检查数据.xls 土地变更一览表.xls
CopyFile();
//DataCheckrResult.db
CopyDataCheckrResultDB();
//QualityCheckResult.db
CopyQualityCheckResultDB();
this.CloseLoading();
MessageHelper.ShowTips("同步模板数据完成!");
}
catch (Exception ex)
{
this.CloseLoading();
LogAPI.Debug("同步工程模板数据异常:" + ex.Message);
LogAPI.Debug("同步工程模板数据异常:" + ex.StackTrace);
MessageHelper.ShowTips("同步工程模板数据异常:" + ex.Message);
}
}
private void CopyGDB(string GDBFileName)
{
IWorkspaceAPI templatewsAPI = null;
IWorkspaceAPI projectwsAPI = null;
try
{
string templateBGDBPath = SysAppPath.GetCurrentAppPath() + string.Format("工作空间\\模板\\新建变更工程\\{0}\\{1}.gdb", (int)Math.Floor(Math.Round(10 / projectInfo.XYResolution)), GDBFileName);
if (GDBFileName.Contains("Scheme0") || GDBFileName.Contains("Scheme-YCL"))
templateBGDBPath = SysAppPath.GetCurrentAppPath() + string.Format("工作空间DTBJK\\DatabaseTemplate\\{0}.gdb", GDBFileName);
string projectBGDBPath = Path.Combine(projectInfo.ProjDir, $"{GDBFileName}.gdb");
//先判定工程中GDB是否有数据
//若没有数据 则直接copy
//若有数据 则遍历模板GDB中字段 再遍历工程中GDB字段 判断是否一样
if (!Directory.Exists(templateBGDBPath)) return;
templatewsAPI = new WorkspaceAPI(templateBGDBPath, KGIS.Framework.AE.Enum.WorkspaceTypeEnum.GDBFile, true);
List<IFeatureClass> templatefeatureClasses = templatewsAPI.GetAllFeatureClass(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTAny);
if (templatefeatureClasses != null)
{
if (!Directory.Exists(projectBGDBPath))
{
PluginServiceInterface.CommonHelper.DirectoryCopy(templateBGDBPath, projectInfo.ProjDir);
return;
}
projectwsAPI = new WorkspaceAPI(projectBGDBPath, KGIS.Framework.AE.Enum.WorkspaceTypeEnum.GDBFile, true);
List<IFeatureClass> projectfeatureClasses = projectwsAPI.GetAllFeatureClass(ESRI.ArcGIS.Geodatabase.esriDatasetType.esriDTAny);
if (projectfeatureClasses != null)
{
bool isEmpty = true;
foreach (IFeatureClass projectfeatureClass in projectfeatureClasses)
{
if (projectfeatureClass.FeatureCount(null) > 0)
{
isEmpty = false;
break;
}
}
if (isEmpty)
{
PluginServiceInterface.CommonHelper.DirectoryCopy(templateBGDBPath, projectInfo.ProjDir);
}
else
{
//判断增删IFeatureClass
foreach (IFeatureClass projectfeatureClass in projectfeatureClasses)
{
if (templatefeatureClasses.FirstOrDefault(a => (a as FeatureClass).BrowseName == (projectfeatureClass as FeatureClass).BrowseName) == null)
{
//需删除
projectwsAPI.DeleteFeatureClass((projectfeatureClass as FeatureClass).BrowseName);
projectfeatureClasses.Remove(projectfeatureClass);
}
}
foreach (IFeatureClass templatefeatureClass in templatefeatureClasses)
{
if (projectfeatureClasses.FirstOrDefault(a => (a as FeatureClass).BrowseName == (templatefeatureClass as FeatureClass).BrowseName) == null)
{
//需添加
IFeatureClass newFeatureClass = projectwsAPI.CreateFeatureClass((templatefeatureClass as FeatureClass).BrowseName, projectfeatureClasses[0].FeatureDataset, (projectfeatureClasses[0] as IGeoDataset).SpatialReference, ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon, templatefeatureClass.Fields).FeatureClass;
Marshal.ReleaseComObject(newFeatureClass);
}
}
//判断每一个IFeatureClass中的字段
foreach (IFeatureClass projectfeatureClass in projectfeatureClasses)
{
string featureName = (projectfeatureClass as FeatureClass).BrowseName;
IFeatureClass currentTempFeatureClass = templatefeatureClasses.FirstOrDefault(a => (a as FeatureClass).BrowseName == featureName);
if (currentTempFeatureClass == null) currentTempFeatureClass = templatefeatureClasses.FirstOrDefault(a => a.AliasName == projectfeatureClass.AliasName);
for (int i = 0; i < currentTempFeatureClass.Fields.FieldCount; i++)
{
IField field = currentTempFeatureClass.Fields.get_Field(i);
if (projectfeatureClass.FindField(field.Name) == -1)
{
projectfeatureClass.AddField(field);
}
}
for (int i = projectfeatureClass.Fields.FieldCount - 1; i >= 0; i--)
{
IField field = projectfeatureClass.Fields.get_Field(i);
if (currentTempFeatureClass.FindField(field.Name) == -1)
{
projectfeatureClass.DeleteField(field);
}
}
}
}
}
}
}
catch (Exception ex)
{
LogAPI.Debug("同步工程GDB模板数据异常:" + ex.Message);
LogAPI.Debug("同步工程GDB模板数据异常:" + ex.StackTrace);
}
finally
{
if (templatewsAPI != null)
templatewsAPI.CloseWorkspace();
if (projectwsAPI != null)
projectwsAPI.CloseWorkspace();
}
}
private void CopyTable(string sourceDatabase, string targetDatabase, string tableName)
{
SQLiteConnection sourceConnection = new SQLiteConnection($"Data Source={sourceDatabase}");
SQLiteConnection targetConnection = new SQLiteConnection($"Data Source={targetDatabase}");
try
{
// 打开源数据库连接
sourceConnection.Open();
// 打开目标数据库连接
targetConnection.Open();
// 创建SELECT语句查询源表的数据
string selectQuery = $"SELECT * FROM {tableName}";
SQLiteCommand selectCommand = new SQLiteCommand(selectQuery, sourceConnection);
// 执行SELECT语句并读取数据
SQLiteDataReader reader = selectCommand.ExecuteReader();
// 获取源表的列名
List<string> columnNames = new List<string>();
for (int i = 0; i < reader.FieldCount; i++)
{
columnNames.Add(reader.GetName(i));
}
// 构建INSERT语句和参数
StringBuilder insertQuery = new StringBuilder();
insertQuery.Append($"INSERT INTO {tableName} (");
StringBuilder columninsertQuery = new StringBuilder();
foreach (string columnName in columnNames)
{
columninsertQuery.Append($"{columnName}, ");
}
columninsertQuery.Length -= 2; // 移除最后一个逗号和空格
insertQuery.Append(columninsertQuery);
insertQuery.Append(") VALUES (");
foreach (string columnName in columnNames)
{
insertQuery.Append($"@{columnName}, ");
}
insertQuery.Length -= 2; // 移除最后一个逗号和空格
insertQuery.Append(")");
SQLiteCommand insertCommand = new SQLiteCommand(insertQuery.ToString(), targetConnection);
//insertCommand.ExecuteNonQuery();
// 根据源表的列名设置参数
foreach (string columnName in columnNames)
{
insertCommand.Parameters.AddWithValue($"@{columnName}", null);
}
// 创建CREATE TABLE语句查询源表的结构
string createTableQuery = "CREATE TABLE if not exists " + tableName + "(" + columninsertQuery + ");";
SQLiteCommand createTableCommand = new SQLiteCommand(createTableQuery, targetConnection);
// 执行CREATE TABLE语句
createTableCommand.ExecuteNonQuery();
// 遍历源表数据并插入到目标表
while (reader.Read())
{
foreach (string columnName in columnNames)
{
insertCommand.Parameters[$"@{columnName}"].Value = reader[columnName];
}
int aaa = insertCommand.ExecuteNonQuery();
}
// 关闭数据读取器和连接对象
reader.Close();
sourceConnection.Close();
targetConnection.Close();
}
catch (Exception ex)
{
throw ex;
}
}
private void CopySqlite()
{
IRDBHelper rdbHelper = null;
List<string> tableNames = new List<string>() { "AttributeCheckRule", "CheckingRule", "Sys_DicDetail", "Sys_DicManage" };
try
{
string templateFilePath = SysAppPath.GetCurrentAppPath() + "工作空间\\模板\\新建变更工程\\BGTJ.sqlite";
string projectFilePath = projectInfo.ProjDir + "\\BGTJ.sqlite";
if (File.Exists(templateFilePath))
{
if (File.Exists(projectFilePath))
{
rdbHelper = RDBFactory.CreateDbHelper(projectFilePath, DatabaseType.SQLite);
foreach (string tableName in tableNames)
{
if (rdbHelper.TableIsExist(tableName))
rdbHelper.ExecuteSQL($" drop TABLE {tableName} ");
CopyTable(templateFilePath, projectFilePath, tableName);
}
}
else
File.Copy(templateFilePath, projectFilePath, true);
}
}
catch (Exception ex)
{
LogAPI.Debug("同步工程模板CopySqlite异常:" + ex.Message);
LogAPI.Debug("同步工程模板CopySqlite异常:" + ex.StackTrace);
}
finally
{
if (rdbHelper != null && rdbHelper.Connect())
rdbHelper.DisConnect();
}
}
private void CopyBGCG()
{
try
{
string templateFilePath = SysAppPath.GetCurrentAppPath() + "工作空间\\模板\\变更成果模板";
string projectFilePath = projectInfo.ProjDir + "\\变更成果模板";
if (Directory.Exists(templateFilePath))
{
PluginServiceInterface.CommonHelper.DirectoryCopy(templateFilePath, projectFilePath);
}
}
catch (Exception ex)
{
LogAPI.Debug("同步工程模板CopyBGCG异常:" + ex.Message);
LogAPI.Debug("同步工程模板CopyBGCG异常:" + ex.StackTrace);
}
}
private void CopyFile()
{
string templateFilePath = string.Empty;
string projectFilePath = string.Empty;
try
{
List<string> fileNames = new List<string>() { "dic.mdb", "ReportData.db", "变更成果检查.xls", "检查数据.xls", "土地变更一览表.xls" };
foreach (string fileName in fileNames)
{
templateFilePath = SysAppPath.GetCurrentAppPath() + $"工作空间\\模板\\新建变更工程\\{fileName}";
projectFilePath = projectInfo.ProjDir + $"\\{fileName}";
if (!File.Exists(templateFilePath)) continue;
File.Copy(templateFilePath, projectFilePath, true);
}
}
catch (Exception ex)
{
LogAPI.Debug("同步工程模板CopyFile异常:" + ex.Message);
LogAPI.Debug("同步工程模板CopyFile异常:" + ex.StackTrace);
}
}
private void CopyDataCheckrResultDB()
{
string templateFilePath = string.Empty;
string projectFilePath = string.Empty;
IRDBHelper rdbHelper = null;
IRDBHelper rdbHelperTemplate = null;
try
{
List<string> tableNames = new List<string>() { "DelectFJ", "ErrorInfo" };
templateFilePath = SysAppPath.GetCurrentAppPath() + "工作空间\\模板\\新建变更工程\\DataCheckrResult.db";
projectFilePath = projectInfo.ProjDir + "\\DataCheckrResult.db";
if (File.Exists(templateFilePath))
{
if (File.Exists(projectFilePath))
{
rdbHelperTemplate = RDBFactory.CreateDbHelper(templateFilePath, DatabaseType.SQLite);
rdbHelper = RDBFactory.CreateDbHelper(projectFilePath, DatabaseType.SQLite);
foreach (string tableName in tableNames)
{
if (!rdbHelper.TableIsExist(tableName))
{
CopyTable(templateFilePath, projectFilePath, tableName);
continue;
}
DataTable templatedataTable = rdbHelperTemplate.ExecuteDatatable(tableName + "Temp", $"select * from {tableName}", true);
DataTable dataTable = rdbHelper.ExecuteDatatable(tableName, $"select * from {tableName}", true);
if (dataTable != null)
{
for (int i = 0; i < templatedataTable.Columns.Count; i++)
{
if (!dataTable.Columns.Contains(templatedataTable.Columns[i].ColumnName))
{
dataTable.Columns.Add(templatedataTable.Columns[i]);
}
}
for (int i = dataTable.Columns.Count - 1; i >= 0; i--)
{
if (!templatedataTable.Columns.Contains(dataTable.Columns[i].ColumnName))
{
dataTable.Columns.Remove(dataTable.Columns[i]);
}
}
}
else
CopyTable(templateFilePath, projectFilePath, tableName);
}
}
else
File.Copy(templateFilePath, projectFilePath, true);
}
}
catch (Exception ex)
{
LogAPI.Debug("同步工程模板CopyDataCheckrResultDB异常:" + ex.Message);
LogAPI.Debug("同步工程模板CopyDataCheckrResultDB异常:" + ex.StackTrace);
}
finally
{
if (rdbHelper != null && rdbHelper.Connect())
rdbHelper.DisConnect();
if (rdbHelperTemplate != null && rdbHelperTemplate.Connect())
rdbHelperTemplate.DisConnect();
}
}
private void CopyQualityCheckResultDB()
{
string templateFilePath = string.Empty;
string projectFilePath = string.Empty;
IRDBHelper rdbHelper = null;
IRDBHelper rdbHelperTemplate = null;
try
{
List<string> tableNames = new List<string>() { "ErrorBGYLB", "ErrorBGYLBSM", "ErrorBasic", "ErrorReport", "ErrorTC" };
templateFilePath = SysAppPath.GetCurrentAppPath() + "工作空间\\模板\\新建变更工程\\QualityCheckResult.db";
projectFilePath = projectInfo.ProjDir + "\\QualityCheckResult.db";
if (File.Exists(templateFilePath))
{
if (File.Exists(projectFilePath))
{
rdbHelperTemplate = RDBFactory.CreateDbHelper(templateFilePath, DatabaseType.SQLite);
rdbHelper = RDBFactory.CreateDbHelper(projectFilePath, DatabaseType.SQLite);
foreach (string tableName in tableNames)
{
if (!rdbHelper.TableIsExist(tableName))
{
CopyTable(templateFilePath, projectFilePath, tableName);
continue;
}
DataTable templatedataTable = rdbHelperTemplate.ExecuteDatatable(tableName + "Temp", $"select * from {tableName}", true);
DataTable dataTable = rdbHelper.ExecuteDatatable(tableName, $"select * from {tableName}", true);
if (dataTable != null)
{
for (int i = 0; i < templatedataTable.Columns.Count; i++)
{
if (!dataTable.Columns.Contains(templatedataTable.Columns[i].ColumnName))
{
dataTable.Columns.Add(templatedataTable.Columns[i]);
}
}
for (int i = dataTable.Columns.Count - 1; i >= 0; i--)
{
if (!templatedataTable.Columns.Contains(dataTable.Columns[i].ColumnName))
{
dataTable.Columns.Remove(dataTable.Columns[i]);
}
}
}
else
CopyTable(templateFilePath, projectFilePath, tableName);
}
}
else
File.Copy(templateFilePath, projectFilePath, true);
}
}
catch (Exception ex)
{
LogAPI.Debug("同步工程模板CopyQualityCheckResultDB异常:" + ex.Message);
LogAPI.Debug("同步工程模板CopyQualityCheckResultDB异常:" + ex.StackTrace);
}
finally
{
if (rdbHelper != null && rdbHelper.Connect())
rdbHelper.DisConnect();
if (rdbHelperTemplate != null && rdbHelperTemplate.Connect())
rdbHelperTemplate.DisConnect();
}
}
}
}

@ -414,7 +414,6 @@
<Compile Include="Commands\ClearAllGraphicsCommand.cs" />
<Compile Include="Commands\ClearFeatureCmd.cs" />
<Compile Include="Commands\CmdAddGroupLayer.cs" />
<Compile Include="Commands\CmdCopyFileData.cs" />
<Compile Include="Commands\CmdCloseProject.cs" />
<Compile Include="Commands\CmdCreateProject.cs" />
<Compile Include="Commands\CmdOpenAerialView.cs" />

@ -343,17 +343,6 @@
ShortcutKeys=""
LocationUri="Menu.Start.Group.ProjManage"
CommandId="Kingo.Plugin.MapView.Commands.CmdCloseProject"/>
<MenuItem Id="KGIS.UI.Menu.CopyFileData"
Order="5"
Name="同步模板"
Tooltip="同步新版本中的工程数据"
ItemType="CmdItem"
SmallImage="\Resources\同步.png"
LargeImage="\Resources\同步.png"
TextImageRelation=""
ShortcutKeys=""
LocationUri="Menu.Start.Group.ProjManage"
CommandId="Kingo.Plugin.MapView.Commands.CmdCopyFileData"/>
<MenuItem Id="KGIS.UI.Menu.ShortcutKey"
Order="9"
Name="快捷键"

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>G:\今奥工作目录\代码管理\24年建库软件\NDBGJK5.0\GPHelper\JKRJ.pfx</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>JKRJ.pfx</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>

Loading…
Cancel
Save