|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
using ESRI.ArcGIS.Geodatabase;
|
|
|
|
|
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.Plugin.DLTB_IDG.EntiyModel;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using Kingo.RuleCheck;
|
|
|
|
|
using KUI.Windows;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using UIShell.OSGi;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.DLTB_IDG.View
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国家质检错误信息列表 的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class UCDataAnalysis : UserControl, IDockPanel3
|
|
|
|
|
{
|
|
|
|
|
private Dictionary<string, List<object>> fieldValueDict = null;
|
|
|
|
|
public IFeatureClass ExternalFeatureClass { get; set; }
|
|
|
|
|
public UCDataAnalysis()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
DevExpress.Xpf.Core.ThemeManager.SetTheme(this, DevExpress.Xpf.Core.Theme.Office2013LightGray);
|
|
|
|
|
DockAreas = DockStyle.DockRight | DockStyle.DockBottom | DockStyle.DockLeft;
|
|
|
|
|
FloatSize = new System.Drawing.Size(1600, 660);
|
|
|
|
|
DockHeight = 380;
|
|
|
|
|
DefaultArea = DockStyle.DockBottom;
|
|
|
|
|
ShowCloseButton = true;
|
|
|
|
|
ShowAutoHideButton = false;
|
|
|
|
|
Title = "定性图斑检查";
|
|
|
|
|
IsShowInMap = true;
|
|
|
|
|
this.Loaded += LoadViewData;
|
|
|
|
|
}
|
|
|
|
|
private Dictionary<string, string> ErrItems = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
private void LoadViewData(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
List<string> groupName = new List<string>() { "CKSJ", "JCSJ" };
|
|
|
|
|
#region 获取年初数据与参考数据中的图层信息
|
|
|
|
|
IDataCatalogService _DataCatalog = null;
|
|
|
|
|
_DataCatalog = BundleRuntime.Instance.GetFirstOrDefaultService<IDataCatalogService>();
|
|
|
|
|
LayerCfg GroupLayerInfo = null;
|
|
|
|
|
List<RelatedLayer> layers = new List<RelatedLayer>();
|
|
|
|
|
if (_DataCatalog != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var Name in groupName)
|
|
|
|
|
{
|
|
|
|
|
ILayer layer = MapsManager.Instance.MapService.GetGroupLayer(Name);
|
|
|
|
|
_DataCatalog.GetNodeByLayer(layer);
|
|
|
|
|
LayerCfg rootLayer = _DataCatalog.CurrentLayers as LayerCfg;
|
|
|
|
|
List<LayerCfg> AllLayers = rootLayer.GetAllItem();
|
|
|
|
|
GroupLayerInfo = AllLayers.FirstOrDefault(f => f.LayerName == layer.Name);
|
|
|
|
|
if (GroupLayerInfo != null && GroupLayerInfo.Layers.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in GroupLayerInfo.Layers)
|
|
|
|
|
layers.Add(new RelatedLayer { FcName = item.FcName, FcPath = item.FcPath, Name = $"{layer.Name}---{item.LayerName}" });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
RelatedCombox.DisplayMember = "Name";
|
|
|
|
|
RelatedCombox.ItemsSource = layers;
|
|
|
|
|
KGIS.Framework.DBOperator.IRDBHelper rdbHelper = null;
|
|
|
|
|
ErrItems.Clear();
|
|
|
|
|
//rdbHelper = RDBFactory.CreateDbHelper($"{DbPath}", DatabaseType.SQLite);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//if (rdbHelper.TableIsExist("ErrorTC"))
|
|
|
|
|
//{
|
|
|
|
|
// DataTable ErrorLayerdt = rdbHelper.ExecuteDatatable("ErrorTC", "SELECT DISTINCT ErrorLayer FROM ErrorTC WHERE ErrorLayer<>''", true);
|
|
|
|
|
// if (ErrorLayerdt != null && ErrorLayerdt.Rows.Count > 0)
|
|
|
|
|
// {
|
|
|
|
|
// ErrItems.Add("ErrorTC", "错误图层");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//if (rdbHelper.TableIsExist("ErrorBGYLB"))
|
|
|
|
|
//{
|
|
|
|
|
// DataTable ErrorLayerdt = rdbHelper.ExecuteDatatable("ErrorBGYLB", "SELECT DISTINCT ErrorType FROM ErrorBGYLB WHERE ErrorType<>''", true);
|
|
|
|
|
// if (ErrorLayerdt != null && ErrorLayerdt.Rows.Count > 0)
|
|
|
|
|
// {
|
|
|
|
|
// ErrItems.Add("ErrorBGYLB", "一览表错误");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//if (rdbHelper.TableIsExist("ErrorBasic"))
|
|
|
|
|
//{
|
|
|
|
|
// DataTable ErrorLayerdt = rdbHelper.ExecuteDatatable("ErrorBasic", "SELECT DISTINCT ErrorDescription FROM ErrorBasic WHERE ErrorDescription<>'' ORDER by ErrorDescription", true);
|
|
|
|
|
// if (ErrorLayerdt != null && ErrorLayerdt.Rows.Count > 0)
|
|
|
|
|
// {
|
|
|
|
|
// ErrItems.Add("ErrorBasic", "基本错误");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//if (rdbHelper.TableIsExist("ErrorReport"))
|
|
|
|
|
//{
|
|
|
|
|
// DataTable ErrorLayerdt = rdbHelper.ExecuteDatatable("ErrorReport", "SELECT DISTINCT StatisticalReport FROM ErrorReport WHERE StatisticalReport<>''", true);
|
|
|
|
|
// if (ErrorLayerdt != null && ErrorLayerdt.Rows.Count > 0)
|
|
|
|
|
// {
|
|
|
|
|
// ErrItems.Add("ErrorReport", "错误报表");
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("国家质检绑定错误类型异常:" + ex);
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
if (ErrItems.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Dictionary<string, string> ErrItem = new Dictionary<string, string>();
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误报表选择事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void ErrBBComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<CheckErrorInfo> checkErrorInfos = new List<CheckErrorInfo>();
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误类型选择事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void ErrLXComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region IDockPanel接口属性
|
|
|
|
|
public event EventHandler CloseViewHandler;
|
|
|
|
|
|
|
|
|
|
public bool IsDockToPanel { get; set; }
|
|
|
|
|
public DockStyle DockToPanelStyle { get; set; }
|
|
|
|
|
public bool IsShowInMap { get; set; }
|
|
|
|
|
public Guid ID { get; set; }
|
|
|
|
|
public DockStyle DockAreas { get; set; }
|
|
|
|
|
public System.Drawing.Size FloatSize { get; set; }
|
|
|
|
|
public int DockWidth { get; set; }
|
|
|
|
|
public int DockHeight { get; set; }
|
|
|
|
|
public DockStyle DefaultArea { get; set; }
|
|
|
|
|
public bool ShowCloseButton { get; set; }
|
|
|
|
|
public bool ShowAutoHideButton { get; set; }
|
|
|
|
|
public string Title { get; set; }
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 双击定位-仅为矢量可定位数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void TvAttr_RowDoubleClick(object sender, DevExpress.Xpf.Grid.RowDoubleClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//错误图层定位逻辑
|
|
|
|
|
if (dgTableMapping.SelectedItem is CheckErrorInfo checkErrorInfo && checkErrorInfo.CheckType.Equals("ErrorTC") && !string.IsNullOrWhiteSpace(checkErrorInfo.ErrorLayer))
|
|
|
|
|
{
|
|
|
|
|
IQueryFilter queryFilter = new QueryFilterClass()
|
|
|
|
|
{
|
|
|
|
|
WhereClause = $"BSM='{checkErrorInfo.BSM}'"
|
|
|
|
|
};
|
|
|
|
|
string ErrorLayerName = checkErrorInfo.ErrorLayer;
|
|
|
|
|
switch (checkErrorInfo.ErrorLayer)
|
|
|
|
|
{
|
|
|
|
|
case "城镇村等用地更新":
|
|
|
|
|
ErrorLayerName = "城镇村更新";
|
|
|
|
|
break;
|
|
|
|
|
case "城镇村等用地更新过程":
|
|
|
|
|
ErrorLayerName = "城镇村更新过程";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
IFeatureLayer layer = KGIS.Framework.Maps.MapsManager.Instance.MapService.GetFeatureLayerByLayerName(ErrorLayerName);
|
|
|
|
|
if (layer != null)
|
|
|
|
|
{
|
|
|
|
|
IFeatureCursor featureCursor = layer.Search(queryFilter, true);
|
|
|
|
|
IFeature feature = featureCursor.NextFeature();
|
|
|
|
|
if (feature != null)
|
|
|
|
|
{
|
|
|
|
|
KGIS.Framework.Maps.MapsManager.Instance.MapService.SelectFeature(((IDataset)layer.FeatureClass).Name, feature.OID.ToString());
|
|
|
|
|
//根据错误编码执行质检库
|
|
|
|
|
List<RuleEntity> ruleEntities = RuleCheck.XJRuleCheck.RuleCheckOpertion_DTB.StartGJZJJGCheck(feature, new List<Tuple<string>>() { Tuple.Create(checkErrorInfo.ErrorCode) });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("错误图层定位逻辑" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowPanel()
|
|
|
|
|
{
|
|
|
|
|
Platform.Instance.OpenView(this, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ClosePanel()
|
|
|
|
|
{
|
|
|
|
|
Platform.Instance.CloseView(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ClosePanelInvoke()
|
|
|
|
|
{
|
|
|
|
|
CloseViewHandler?.Invoke(null, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnExternalData_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//try
|
|
|
|
|
//{
|
|
|
|
|
// OpenDataDialog pDialog = new OpenDataDialog();
|
|
|
|
|
// ISpatialDataObjectFilter pOFilter;
|
|
|
|
|
// pOFilter = new FilterDatasetsAndLayers();
|
|
|
|
|
// pDialog.AddFilter(pOFilter, true);
|
|
|
|
|
// pDialog.Title = "选择导入的数据";
|
|
|
|
|
// pDialog.AllowMultiSelect = false;
|
|
|
|
|
// pDialog.RestoreLocation = true;
|
|
|
|
|
// pDialog.StartLocation = pDialog.FinalLocation;
|
|
|
|
|
// System.Windows.Forms.DialogResult dialogResult = pDialog.ShowDialog();
|
|
|
|
|
// if (dialogResult == System.Windows.Forms.DialogResult.OK && pDialog.Selection.Count != 0)
|
|
|
|
|
// {
|
|
|
|
|
// foreach (ISpatialDataObject distObj in pDialog.Selection)
|
|
|
|
|
// {
|
|
|
|
|
// if (distObj.DatasetType == esriDatasetType.esriDTFeatureClass)
|
|
|
|
|
// {
|
|
|
|
|
// ExternalFeatureClass = (distObj.DatasetName as IName).Open() as IFeatureClass;
|
|
|
|
|
// externalDataPath.Text = distObj.FullName;
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//catch (Exception ex)
|
|
|
|
|
//{
|
|
|
|
|
// LogAPI.Debug("btnExternalData_Click异常:" + ex.Message);
|
|
|
|
|
// LogAPI.Debug("btnExternalData_Click异常:" + ex.StackTrace);
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnAnalysis_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ProjectInfo projectInfo = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
|
|
|
|
|
if (projectInfo == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips($"请先打开工程。");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(projectInfo.ZLDatabase))
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips($"未找到增量数据,请先创建增量数据库");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IFeatureClass featureClass = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBGX");
|
|
|
|
|
if (featureClass == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips($"未找到地类图斑更新图层,请检查图层是否存在");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (featureClass.FeatureCount(null) == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips($"地类图斑更新图层数据未空,无法进行对比分析");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (RelatedCombox.SelectedItems.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips($"请选择要对比分析的参考图层数据。");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<DataModel> RelDataList = new List<DataModel>();
|
|
|
|
|
foreach (RelatedLayer item in RelatedCombox.SelectedItems.ToList())
|
|
|
|
|
{
|
|
|
|
|
RelDataList.Add(new DataModel() { SFFX = true, SJLJ = item.FcPath, TCMC = item.FcName, XZQDM = projectInfo.CODE, ZD = "BSM", SX = "DLBM,DLMC,QSXZ,QSDWDM,QSDWMC,ZLDWDM,ZLDWMC,GDLX,GDPDJB,XZDWKD,TBXHDM,TBXHMC,ZZSXDM,ZZSXMC,GDDB,CZCSXM" });
|
|
|
|
|
}
|
|
|
|
|
List<DataModel> TaskList = new List<DataModel>()
|
|
|
|
|
{
|
|
|
|
|
new DataModel() { SFFX = true, SJLJ = projectInfo.ZLDatabase, TCMC="DLTBGX",XZQDM=projectInfo.CODE,ZD="BSM",SX="DLBM,DLMC,QSXZ,QSDWDM,QSDWMC,ZLDWDM,ZLDWMC,GDLX,GDPDJB,XZDWKD,TBXHDM,TBXHMC,ZZSXDM,ZZSXMC,GDDB,CZCSXM"}
|
|
|
|
|
};
|
|
|
|
|
string OutDB = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Temp", "Temp.sqlite");
|
|
|
|
|
if (File.Exists(OutDB))
|
|
|
|
|
{
|
|
|
|
|
File.Delete(OutDB);
|
|
|
|
|
}
|
|
|
|
|
File.Copy(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Template", "Temp.sqlite"), OutDB);
|
|
|
|
|
string insertDB = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Temp", "InsertTemp.sqlite");
|
|
|
|
|
if (File.Exists(insertDB))
|
|
|
|
|
{
|
|
|
|
|
File.Delete(insertDB);
|
|
|
|
|
}
|
|
|
|
|
File.Copy(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Template", "Temp.sqlite"), insertDB);
|
|
|
|
|
BaseAnalysisData cfg = new BaseAnalysisData()
|
|
|
|
|
{
|
|
|
|
|
OutDB = OutDB,//输出db文件路径
|
|
|
|
|
Code = projectInfo.CODE,//行政区代码
|
|
|
|
|
TaskList = TaskList.ToArray(),
|
|
|
|
|
RelDataList = RelDataList.ToArray(),
|
|
|
|
|
GDBInputDB = insertDB
|
|
|
|
|
};
|
|
|
|
|
this.ShowLoading("正在进行数据分析......", 0, 0);
|
|
|
|
|
ProcesHelper.Instance.MuitProcessAnalyssis(cfg);
|
|
|
|
|
//ProcesHelper.Instance.MuitProcessAnalyssis_end(cfg);
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
//KGIS.Framework.DBOperator.IRDBHelper dbHelper = null;
|
|
|
|
|
//dbHelper = RDBFactory.CreateDbHelper(OutDB, DatabaseType.SQLite);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
this.CloseLoading();
|
|
|
|
|
LogAPI.Debug("定性图斑检查分析错误:" + ex.Message);
|
|
|
|
|
LogAPI.Debug("定性图斑检查分析错误:" + ex.StackTrace);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class RelatedLayer
|
|
|
|
|
{
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public string FcName { get; set; }
|
|
|
|
|
public string FcPath { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|