|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using DevExpress.Xpf.Editors.Settings;
|
|
|
|
|
using DevExpress.Xpf.Grid;
|
|
|
|
|
using ESRI.ArcGIS.Carto;
|
|
|
|
|
using ESRI.ArcGIS.DataSourcesGDB;
|
|
|
|
|
using ESRI.ArcGIS.esriSystem;
|
|
|
|
|
using ESRI.ArcGIS.Geodatabase;
|
|
|
|
|
using ESRI.ArcGIS.Geometry;
|
|
|
|
|
using KGIS.Framework.AE;
|
|
|
|
|
using KGIS.Framework.AE.Enum;
|
|
|
|
|
using KGIS.Framework.AE.GPHelper;
|
|
|
|
|
using KGIS.Framework.AE.ExtensionMethod;
|
|
|
|
|
using KGIS.Framework.Maps;
|
|
|
|
|
using KGIS.Framework.OpenData.Control;
|
|
|
|
|
using KGIS.Framework.OpenData.Filter;
|
|
|
|
|
using KGIS.Framework.OpenData.InterFace;
|
|
|
|
|
using KGIS.Framework.Platform;
|
|
|
|
|
using KGIS.Framework.Platform.Helper;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using KGIS.Framework.Utils.ExtensionMethod;
|
|
|
|
|
using KGIS.Framework.Utils.Helper;
|
|
|
|
|
using KGIS.Framework.Views;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using KGIS.Plugin.BoundaryReadjust;
|
|
|
|
|
using ESRI.ArcGIS.ADF;
|
|
|
|
|
using Kingo.Plugin.BoundaryReadjust.EntityModel;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.BoundaryReadjust.View
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国界,零米线调整的交互逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class UCGJAndLMXAdjust : UserControl, IDockPanel2
|
|
|
|
|
{
|
|
|
|
|
private IFeatureLayer XZDLTB_Layer = null;
|
|
|
|
|
private IFeatureLayer XJXZQJX_Layer = null;
|
|
|
|
|
private IFeatureLayer JCDLTB_Layer = null;
|
|
|
|
|
private IFeatureLayer JCXZQ_Layer = null;
|
|
|
|
|
private IFeatureClass XJKZJX_FC = null;
|
|
|
|
|
public UCGJAndLMXAdjust()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
IsShowInMap = true;
|
|
|
|
|
DockAreas = DockStyle.DockBottom;
|
|
|
|
|
DockHeight = 380;
|
|
|
|
|
DefaultArea = DockStyle.DockBottom;
|
|
|
|
|
ShowCloseButton = true;
|
|
|
|
|
ShowAutoHideButton = false;
|
|
|
|
|
Title = "国界、零米线调整";
|
|
|
|
|
DevExpress.Xpf.Core.ThemeManager.SetTheme(this, DevExpress.Xpf.Core.Theme.Office2013LightGray);
|
|
|
|
|
txtBGHKZMJ.Text = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).DCMJ.ToTrim();
|
|
|
|
|
txtBGHHDKZMJ.Text = (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo).DCMJHD.ToTrim();
|
|
|
|
|
|
|
|
|
|
XJKZJX_FC = MapsManager.Instance.MapService.GetFeatureClassByName("XJKZJX");
|
|
|
|
|
XJXZQJX_Layer = GeoDBAPI.CreateFeatureLayerInmemeory("XJKZJX", "县级控制界线", (XJKZJX_FC as IGeoDataset).SpatialReference, XJKZJX_FC.ShapeType, XJKZJX_FC.Fields);
|
|
|
|
|
JXTZBGHelper.InsertDataToMemeoryLayer(XJKZJX_FC, XJXZQJX_Layer.FeatureClass, null);
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 自定义/继承字段
|
|
|
|
|
private DataTable IntoData { get; set; }
|
|
|
|
|
private IFeatureClass targetFc { get; set; }
|
|
|
|
|
private List<DataModel> Data { 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; }
|
|
|
|
|
System.Drawing.Size IDockPanel.FloatSize { get; set; }
|
|
|
|
|
|
|
|
|
|
public event EventHandler CloseViewHandler;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 坐落单位字典
|
|
|
|
|
/// </summary>
|
|
|
|
|
private List<DataDicTionary> ZLDMdataDic = null;
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增的地类图斑
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void btnSelectXZDLTB_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string xzdltbPaths = "";
|
|
|
|
|
IFeatureClass dltbFc = GetFeatureClass("请选择新增的地类图斑数据", ref xzdltbPaths);
|
|
|
|
|
if (dltbFc != null)
|
|
|
|
|
{
|
|
|
|
|
this.btnSelectedDLTBPath.EditValue = xzdltbPaths;
|
|
|
|
|
XZDLTB_Layer = GeoDBAPI.CreateFeatureLayerInmemeory("XZDLTB", "新增地类图斑数据", (dltbFc as IGeoDataset).SpatialReference, dltbFc.ShapeType, dltbFc.Fields);
|
|
|
|
|
(XZDLTB_Layer.FeatureClass as ITable).DeleteSearchedRows(null);
|
|
|
|
|
JXTZBGHelper.InsertDataToMemeoryLayer(dltbFc, XZDLTB_Layer.FeatureClass, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 列表勾选数目
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void CheckBox_Click_1(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (dgInto.SelectedItem != null)
|
|
|
|
|
{
|
|
|
|
|
DataRowView dr = dgInto.SelectedItem as DataRowView;
|
|
|
|
|
if ((sender as CheckBox).IsChecked == true)
|
|
|
|
|
{
|
|
|
|
|
dr["IsValid"] = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
dr["IsValid"] = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int length = 0;
|
|
|
|
|
foreach (DataRow item in (dgInto.ItemsSource as DataTable).Rows)
|
|
|
|
|
{
|
|
|
|
|
if (item[0].ToString() == "True")
|
|
|
|
|
{
|
|
|
|
|
length++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
lblCount.Content = "总条数:" + IntoData.Rows.Count + "/" + length;
|
|
|
|
|
|
|
|
|
|
int checknum = 0;
|
|
|
|
|
DataRow[] drs = (dgInto.ItemsSource as DataTable).Select("XZQTZLX='3'");
|
|
|
|
|
for (int i = 0; i < drs.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
if (drs[i][0].ToString() == "True")
|
|
|
|
|
{
|
|
|
|
|
checknum++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.ckbCheckAll.IsChecked == true && drs.Length != checknum)
|
|
|
|
|
{
|
|
|
|
|
this.ckbCheckAll.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
else if (this.ckbCheckAll.IsChecked == false && drs.Length == checknum)
|
|
|
|
|
{
|
|
|
|
|
this.ckbCheckAll.IsChecked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 得到要素类集合
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title"></param>
|
|
|
|
|
/// <param name="paths">路径集合</param>
|
|
|
|
|
public IFeatureClass GetFeatureClass(string title, ref string paths)
|
|
|
|
|
{
|
|
|
|
|
IFeatureClass result = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 获取源数据
|
|
|
|
|
OpenDataDialog pDialog = new OpenDataDialog();
|
|
|
|
|
ISpatialDataObjectFilter pOFilter;
|
|
|
|
|
pOFilter = new FilterFeatureDatasetsAndFeatureClasses();
|
|
|
|
|
pDialog.AddFilter(pOFilter, true);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(title))
|
|
|
|
|
pDialog.Title = title;
|
|
|
|
|
else
|
|
|
|
|
pDialog.Title = "选择数据";
|
|
|
|
|
pDialog.AllowMultiSelect = false;
|
|
|
|
|
pDialog.RestoreLocation = true;
|
|
|
|
|
pDialog.StartLocation = pDialog.FinalLocation;
|
|
|
|
|
if (pDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK && pDialog.Selection.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
List<ISpatialDataObject> distObj = pDialog.Selection;
|
|
|
|
|
foreach (var obj in distObj)
|
|
|
|
|
{
|
|
|
|
|
if (obj.DatasetType == esriDatasetType.esriDTFeatureClass)
|
|
|
|
|
{
|
|
|
|
|
IFeatureClass featureclass = (obj.DatasetName as IName).Open() as IFeatureClass;
|
|
|
|
|
result = featureclass;
|
|
|
|
|
paths += obj.FullName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("选择数据失败:" + ex.Message.ToString());
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DgInto_CustomColumnGroup(object sender, CustomColumnSortEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DgInto_AutoGeneratedColumns(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
GridControl grid = sender as GridControl;
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
{
|
|
|
|
|
if (IntoData.Columns.Contains(column.FieldName))
|
|
|
|
|
{
|
|
|
|
|
string caption = IntoData.Columns[column.FieldName].Caption;
|
|
|
|
|
|
|
|
|
|
if (caption != null)
|
|
|
|
|
{
|
|
|
|
|
column.EditSettings = new TextEditSettings() { HorizontalContentAlignment = EditSettingsHorizontalAlignment.Left };
|
|
|
|
|
column.Header = caption;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double BGQLDKZMJ = 0;
|
|
|
|
|
private double BGHLDKZMJ = 0;
|
|
|
|
|
private double BGQHDKZMJ = 0;
|
|
|
|
|
private double BGHHDKZMJ = 0;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 确定按钮-提取数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void btnExtractData_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
IFeatureClass jcdltbFC = null;//基础地类图斑
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//变更前后的陆地和海岛的控制总面积
|
|
|
|
|
BGQLDKZMJ = txtBGQKZMJ.Text.ToDouble(2);
|
|
|
|
|
BGQHDKZMJ = txtBGQHDKZMJ.Text.ToDouble(2);
|
|
|
|
|
BGHLDKZMJ = txtBGHKZMJ.Text.ToDouble(2);
|
|
|
|
|
BGHHDKZMJ = txtBGHHDKZMJ.Text.ToDouble(2);
|
|
|
|
|
//初始加载的县级控制界限
|
|
|
|
|
if (XJXZQJX_Layer == null || XJXZQJX_Layer.FeatureClass.FeatureCount(null) == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("未获取到县级控制界线图层/选择的调整后县级控制界线数据为空!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
jcdltbFC = MapsManager.Instance.MapService.GetFeatureClassByName("DLTB");//基础地类图斑
|
|
|
|
|
if (jcdltbFC == null || jcdltbFC.FeatureCount(null) == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("未获取到基础地类图斑/基础地类图斑数据为空.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//在内存上创建一个基础地类图斑用于后续操作
|
|
|
|
|
JCDLTB_Layer = GeoDBAPI.CreateFeatureLayerInmemeory("JC_DLTB", "基础地类图斑", (jcdltbFC as IGeoDataset).SpatialReference, jcdltbFC.ShapeType, jcdltbFC.Fields);
|
|
|
|
|
(JCDLTB_Layer.FeatureClass as ITable).DeleteSearchedRows(null);
|
|
|
|
|
JXTZBGHelper.InsertDataToMemeoryLayer(jcdltbFC, JCDLTB_Layer.FeatureClass, null);
|
|
|
|
|
//基础行政区与上同理
|
|
|
|
|
IFeatureClass xzqFc = MapsManager.Instance.MapService.GetFeatureClassByName("XZQ");
|
|
|
|
|
JCXZQ_Layer = GeoDBAPI.CreateFeatureLayerInmemeory("JCXZQ", "基础行政区", (xzqFc as IGeoDataset).SpatialReference, xzqFc.ShapeType, xzqFc.Fields);
|
|
|
|
|
(JCXZQ_Layer.FeatureClass as ITable).DeleteSearchedRows(null);
|
|
|
|
|
JXTZBGHelper.InsertDataToMemeoryLayer(xzqFc, JCXZQ_Layer.FeatureClass, null);
|
|
|
|
|
btnImportXZDLTB_Click();
|
|
|
|
|
Marshal.ReleaseComObject(JCDLTB_Layer.FeatureClass);
|
|
|
|
|
Marshal.ReleaseComObject(JCXZQ_Layer.FeatureClass);
|
|
|
|
|
Marshal.ReleaseComObject(JCDLTB_Layer);
|
|
|
|
|
Marshal.ReleaseComObject(JCXZQ_Layer);
|
|
|
|
|
JCDLTB_Layer = null;
|
|
|
|
|
JCXZQ_Layer = null;
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
LogAPI.Debug("行政区提取灭失图斑数据失败,异常信息如下:");
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
MessageHelper.ShowError("行政区提取灭失图斑数据失败:" + ex.Message.ToString());
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (jcdltbFC != null)
|
|
|
|
|
Marshal.ReleaseComObject(jcdltbFC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 导入新增地类图斑
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void btnImportXZDLTB_Click()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//存放结果在APP运行目录下
|
|
|
|
|
string gdbFolder = Directory.GetCurrentDirectory() + "\\Temp\\GJLMXTZ";
|
|
|
|
|
if (!Directory.Exists(gdbFolder))
|
|
|
|
|
Directory.CreateDirectory(gdbFolder);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DelectDir(gdbFolder);//能删除就删除 删除报错不处理
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{ }
|
|
|
|
|
string gdbFileName = Guid.NewGuid().ToString() + ".gdb";
|
|
|
|
|
string path = System.IO.Path.Combine(gdbFolder, gdbFileName);
|
|
|
|
|
IWorkspaceFactory pFtWsFct = new FileGDBWorkspaceFactory();
|
|
|
|
|
IWorkspaceName workspaceName = pFtWsFct.Create(gdbFolder, gdbFileName, null, 0);
|
|
|
|
|
GPParamClass gPParamClass = new GPParamClass();
|
|
|
|
|
IWorkspaceAPI psTempWorkspaceAPI = new WorkspaceAPI(path, WorkspaceTypeEnum.GDBFile, true);
|
|
|
|
|
//将合并后的基础行政区与调整后控制界线进行联合
|
|
|
|
|
IFeatureLayer tempUnionxzqLayer = null;
|
|
|
|
|
gPParamClass = new GPParamClass
|
|
|
|
|
{
|
|
|
|
|
FirstFeatureLayer = XJXZQJX_Layer,
|
|
|
|
|
SecondFeatureLayer = JCXZQ_Layer,
|
|
|
|
|
OutFeatureClassPath = path + "\\" + "TempXZQUnion",
|
|
|
|
|
IsGetOutPutFeature = true
|
|
|
|
|
};
|
|
|
|
|
GeoprocessorHelper.UnionAnalysis(gPParamClass, ref tempUnionxzqLayer);//获取灭失和新增的图斑
|
|
|
|
|
Data = new List<DataModel>();
|
|
|
|
|
IQueryFilter queryfilter = new QueryFilterClass();
|
|
|
|
|
queryfilter.WhereClause = string.Format("FID_XJKZJX=-1");//获取灭失图形
|
|
|
|
|
IFeatureCursor msCursor = tempUnionxzqLayer.FeatureClass.Search(queryfilter, true);
|
|
|
|
|
IFeature msxzqFearure = null;
|
|
|
|
|
while ((msxzqFearure = msCursor.NextFeature()) != null)
|
|
|
|
|
{
|
|
|
|
|
ExtractMSData(msxzqFearure.ShapeCopy);//暂存在DATA中
|
|
|
|
|
Marshal.ReleaseComObject(msxzqFearure);
|
|
|
|
|
}
|
|
|
|
|
//陆地-海岛灭失数据-陆地-海岛新增图斑
|
|
|
|
|
double LDMSMJ = Data.Where(w => w.IsOut && w.MSSM == "00").Sum(s => s.BGMJ);
|
|
|
|
|
double HDMSMJ = Data.Where(w => w.IsOut && w.MSSM == "01").Sum(s => s.BGMJ);
|
|
|
|
|
double LDXZMJ = Math.Round(BGHLDKZMJ - (BGQLDKZMJ - LDMSMJ).ToDouble(2), 2);
|
|
|
|
|
double HDXZMJ = Math.Round(BGHHDKZMJ - (BGQHDKZMJ - HDMSMJ).ToDouble(2), 2);
|
|
|
|
|
|
|
|
|
|
if (tempUnionxzqLayer.FeatureClass.FeatureCount(queryfilter) != 0) MSDataInsertXZQTQTB();
|
|
|
|
|
|
|
|
|
|
queryfilter.WhereClause = string.Format("FID_JCXZQ=-1");//获取新增图形
|
|
|
|
|
IFeatureCursor xzCursor = tempUnionxzqLayer.FeatureClass.Search(queryfilter, true);
|
|
|
|
|
IFeature xzxzqFearure = null;
|
|
|
|
|
while ((xzxzqFearure = xzCursor.NextFeature()) != null)
|
|
|
|
|
{
|
|
|
|
|
ExtractXZData(xzxzqFearure.ShapeCopy);//添加新增数据到Data
|
|
|
|
|
Marshal.ReleaseComObject(xzxzqFearure);
|
|
|
|
|
}
|
|
|
|
|
//新增陆地/海岛面积
|
|
|
|
|
double PCQ_LDXZMJ = Data.Where(w => w.IsAdd && w.MSSM == "00").Sum(s => s.BGMJ);
|
|
|
|
|
double PCQ_HDXZMJ = Data.Where(w => w.IsAdd && w.MSSM == "01").Sum(s => s.BGMJ);
|
|
|
|
|
#region 新增地类图斑面积平差
|
|
|
|
|
while ((PCQ_LDXZMJ - LDXZMJ).ToDecimal(2) != 0)
|
|
|
|
|
{
|
|
|
|
|
double mjc = Math.Round(LDXZMJ - PCQ_LDXZMJ, 2);
|
|
|
|
|
Data = Data.OrderByDescending(o => o.BGMJ).ToList();
|
|
|
|
|
foreach (var item in Data)
|
|
|
|
|
{
|
|
|
|
|
if (!item.IsAdd) continue;
|
|
|
|
|
if (mjc < 0)
|
|
|
|
|
{
|
|
|
|
|
item.BGMJ = Math.Round(item.BGMJ - 0.01, 2);
|
|
|
|
|
mjc = Math.Round(mjc + 0.01, 2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
item.BGMJ = Math.Round(item.BGMJ + 0.01, 2);
|
|
|
|
|
mjc = Math.Round(mjc - 0.01, 2);
|
|
|
|
|
}
|
|
|
|
|
if (mjc == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
PCQ_LDXZMJ = Data.Where(w => w.IsAdd && w.MSSM == "00").Sum(s => s.BGMJ);
|
|
|
|
|
}
|
|
|
|
|
while ((PCQ_HDXZMJ - HDXZMJ).ToDecimal(2) != 0)
|
|
|
|
|
{
|
|
|
|
|
double mjc = Math.Round(HDXZMJ - PCQ_HDXZMJ, 2);
|
|
|
|
|
Data = Data.OrderByDescending(o => o.BGMJ).ToList();
|
|
|
|
|
foreach (var item in Data)
|
|
|
|
|
{
|
|
|
|
|
if (!item.IsAdd) continue;
|
|
|
|
|
if (mjc < 0)
|
|
|
|
|
{
|
|
|
|
|
item.BGMJ = Math.Round(item.BGMJ - 0.01, 2);
|
|
|
|
|
mjc = Math.Round(mjc + 0.01, 2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
item.BGMJ = Math.Round(item.BGMJ + 0.01, 2);
|
|
|
|
|
mjc = Math.Round(mjc - 0.01, 2);
|
|
|
|
|
}
|
|
|
|
|
if (mjc == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
PCQ_HDXZMJ = Data.Where(w => w.IsAdd && w.MSSM == "01").Sum(s => s.BGMJ);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
if (tempUnionxzqLayer.FeatureClass.FeatureCount(queryfilter) != 0)
|
|
|
|
|
{
|
|
|
|
|
XZDataInsertXZQTQTB();
|
|
|
|
|
}
|
|
|
|
|
LoadData();
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
MessageHelper.Show("国界零米线调整完成!!");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
LogAPI.Debug("国界零米线调整失败,异常信息如下:");
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
MessageHelper.ShowError("国界零米线调整失败:" + ex.Message.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除文件夹以及子文件夹与子文件-
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="srcPath"></param>
|
|
|
|
|
private void DelectDir(string srcPath)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DirectoryInfo dir = new DirectoryInfo(srcPath);
|
|
|
|
|
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录
|
|
|
|
|
foreach (FileSystemInfo i in fileinfo)
|
|
|
|
|
{
|
|
|
|
|
if (i is DirectoryInfo) //判断是否文件夹
|
|
|
|
|
{
|
|
|
|
|
DirectoryInfo subdir = new DirectoryInfo(i.FullName);
|
|
|
|
|
subdir.Delete(true); //删除子目录和文件
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
File.Delete(i.FullName); //删除指定文件
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
throw;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 提取灭失图斑
|
|
|
|
|
private void ExtractMSData(IGeometry msGeo)
|
|
|
|
|
{
|
|
|
|
|
IGeometry tempGeo = msGeo;
|
|
|
|
|
ITopologicalOperator topo = msGeo as ITopologicalOperator;
|
|
|
|
|
tempGeo = topo.Buffer(-.01);
|
|
|
|
|
List<IFeature> features = FeatureAPI.Identify(tempGeo, JCDLTB_Layer);
|
|
|
|
|
IGeometry tempGeo_B = topo.Buffer(0.01);
|
|
|
|
|
IRelationalOperator rele = tempGeo_B as IRelationalOperator;
|
|
|
|
|
int zldmindex = JCDLTB_Layer.FeatureClass.FindField("ZLDWDM");
|
|
|
|
|
int zlmcindex = JCDLTB_Layer.FeatureClass.FindField("ZLDWMC");
|
|
|
|
|
int tbmjindex = JCDLTB_Layer.FeatureClass.FindField("TBMJ");
|
|
|
|
|
int mssmindex = JCDLTB_Layer.FeatureClass.FindField("MSSM");
|
|
|
|
|
int completeCount = 0;
|
|
|
|
|
double completeSumMJ = 0;
|
|
|
|
|
int splitCount = 0;
|
|
|
|
|
double splitSumMJ = 0;
|
|
|
|
|
foreach (var f in features)
|
|
|
|
|
{
|
|
|
|
|
DataModel modelItem = new DataModel();
|
|
|
|
|
modelItem.TC = "DLTB";
|
|
|
|
|
if (rele.Contains(f.ShapeCopy))//灭失图斑是否包含当前压盖到的基础地类图斑;
|
|
|
|
|
{
|
|
|
|
|
Data.Add(modelItem);
|
|
|
|
|
modelItem.IsCompleteOut = true;
|
|
|
|
|
modelItem.DLTBOid = f.OID;
|
|
|
|
|
modelItem.IsOut = true;
|
|
|
|
|
if (zldmindex != -1)
|
|
|
|
|
{
|
|
|
|
|
modelItem.CJDCQInfo = f.Value[zlmcindex].ToTrim() + "-" + f.Value[zldmindex].ToTrim().Substring(0, 12);
|
|
|
|
|
modelItem.XZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 9);
|
|
|
|
|
modelItem.XJXZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 6);
|
|
|
|
|
}
|
|
|
|
|
modelItem.BGMJ = f.Value[tbmjindex].ToDouble();
|
|
|
|
|
modelItem.MSSM = f.Value[mssmindex].ToTrim();
|
|
|
|
|
modelItem.Geo = f.ShapeCopy;
|
|
|
|
|
|
|
|
|
|
completeCount++;
|
|
|
|
|
completeSumMJ += modelItem.BGMJ;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
double kzmj = f.Value[tbmjindex].ToDouble();
|
|
|
|
|
splitCount++;
|
|
|
|
|
IGeometry geo = FeatureAPI.InterSect(f.ShapeCopy, msGeo);//取地类图斑与,灭失图斑相交的部分
|
|
|
|
|
List<IGeometry> geoList = FeatureAPI.DissolveGeometryByRing(geo);
|
|
|
|
|
List<DataModel> dataList = new List<DataModel>();
|
|
|
|
|
foreach (var item in geoList)
|
|
|
|
|
{
|
|
|
|
|
DataModel model = new DataModel();
|
|
|
|
|
dataList.Add(model);
|
|
|
|
|
model.TC = "DLTB";
|
|
|
|
|
model.Geo = item;
|
|
|
|
|
model.BGMJ = (item as IPolygon).GetEllipseArea();
|
|
|
|
|
model.IsOut = true;
|
|
|
|
|
model.DLTBOid = f.OID;
|
|
|
|
|
model.CJDCQInfo = f.Value[zlmcindex].ToTrim() + "-" + f.Value[zldmindex].ToTrim().Substring(0, 12);
|
|
|
|
|
model.XZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 9);
|
|
|
|
|
model.XJXZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 6);
|
|
|
|
|
model.MSSM = f.Value[mssmindex].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
IGeometry geo_out = FeatureAPI.Difference(f.ShapeCopy, msGeo);//地类图斑擦除灭失图斑
|
|
|
|
|
geoList = FeatureAPI.DissolveGeometryByRing(geo_out);
|
|
|
|
|
foreach (var item in geoList)
|
|
|
|
|
{
|
|
|
|
|
DataModel model = new DataModel();
|
|
|
|
|
dataList.Add(model);
|
|
|
|
|
model.TC = "DLTB";
|
|
|
|
|
model.Geo = item;
|
|
|
|
|
model.BGMJ = (item as IPolygon).GetEllipseArea();
|
|
|
|
|
model.DLTBOid = f.OID;
|
|
|
|
|
model.CJDCQInfo = f.Value[zlmcindex].ToTrim() + "-" + f.Value[zldmindex].ToTrim().Substring(0, 12);
|
|
|
|
|
model.XZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 9);
|
|
|
|
|
model.XJXZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 6);
|
|
|
|
|
model.MSSM = f.Value[mssmindex].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
JXTZBGHelper.AreaAdjustment<DataModel>(dataList, "BGMJ", kzmj);
|
|
|
|
|
splitSumMJ += dataList.Where(w => w.IsOut).Sum(s => s.BGMJ);
|
|
|
|
|
Data.AddRange(dataList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void ExtractXZData(IGeometry msGeo)
|
|
|
|
|
{
|
|
|
|
|
IGeometry tempGeo = msGeo;
|
|
|
|
|
ITopologicalOperator topo = msGeo as ITopologicalOperator;
|
|
|
|
|
tempGeo = topo.Buffer(-.01);
|
|
|
|
|
//压盖的是新增地类图斑
|
|
|
|
|
List<IFeature> features = FeatureAPI.Identify(tempGeo, XZDLTB_Layer);
|
|
|
|
|
IGeometry tempGeo_B = topo.Buffer(0.01);
|
|
|
|
|
IRelationalOperator rele = tempGeo_B as IRelationalOperator;
|
|
|
|
|
int zldmindex = XZDLTB_Layer.FeatureClass.FindField("ZLDWDM");
|
|
|
|
|
int zlmcindex = XZDLTB_Layer.FeatureClass.FindField("ZLDWMC");
|
|
|
|
|
int tbmjindex = XZDLTB_Layer.FeatureClass.FindField("TBMJ");
|
|
|
|
|
int mssmindex = XZDLTB_Layer.FeatureClass.FindField("MSSM");
|
|
|
|
|
int completeCount = 0;
|
|
|
|
|
double completeSumMJ = 0;
|
|
|
|
|
int splitCount = 0;
|
|
|
|
|
double splitSumMJ = 0;
|
|
|
|
|
//Data.Clear();
|
|
|
|
|
foreach (var f in features)
|
|
|
|
|
{
|
|
|
|
|
DataModel modelItem = new DataModel();
|
|
|
|
|
modelItem.TC = "DLTB";
|
|
|
|
|
if (rele.Contains(f.ShapeCopy))//rele灭失图斑
|
|
|
|
|
{
|
|
|
|
|
Data.Add(modelItem);
|
|
|
|
|
modelItem.IsCompleteOut = true;
|
|
|
|
|
modelItem.DLTBOid = f.OID;
|
|
|
|
|
modelItem.IsAdd = true;
|
|
|
|
|
if (zldmindex != -1)
|
|
|
|
|
{
|
|
|
|
|
string zldm = f.Value[zldmindex].ToTrim();
|
|
|
|
|
modelItem.CJDCQInfo = f.Value[zlmcindex].ToTrim() + "-" + (zldm.Length > 12 ? zldm.Substring(0, 12) : zldm);
|
|
|
|
|
modelItem.XZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 9);
|
|
|
|
|
modelItem.XJXZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 6);
|
|
|
|
|
}
|
|
|
|
|
modelItem.BGMJ = (f.ShapeCopy as IPolygon).GetEllipseArea();
|
|
|
|
|
if (mssmindex != -1)
|
|
|
|
|
modelItem.MSSM = f.Value[mssmindex].ToTrim();
|
|
|
|
|
modelItem.Geo = f.ShapeCopy;
|
|
|
|
|
|
|
|
|
|
completeCount++;
|
|
|
|
|
completeSumMJ += modelItem.BGMJ;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
double kzmj = f.Value[tbmjindex].ToDouble();
|
|
|
|
|
|
|
|
|
|
splitCount++;
|
|
|
|
|
IGeometry geo = FeatureAPI.InterSect(f.ShapeCopy, msGeo);
|
|
|
|
|
List<IGeometry> geoList = FeatureAPI.DissolveGeometryByRing(geo);
|
|
|
|
|
List<DataModel> dataList = new List<DataModel>();
|
|
|
|
|
foreach (var item in geoList)
|
|
|
|
|
{
|
|
|
|
|
DataModel model = new DataModel();
|
|
|
|
|
dataList.Add(model);
|
|
|
|
|
model.TC = "DLTB";
|
|
|
|
|
model.Geo = item;
|
|
|
|
|
model.BGMJ = (item as IPolygon).GetEllipseArea();
|
|
|
|
|
model.IsAdd = true;
|
|
|
|
|
model.DLTBOid = f.OID;
|
|
|
|
|
model.CJDCQInfo = f.Value[zlmcindex].ToTrim() + "-" + f.Value[zldmindex].ToTrim().Substring(0, 12);
|
|
|
|
|
model.XZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 9);
|
|
|
|
|
model.XJXZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 6);
|
|
|
|
|
if (mssmindex != -1)
|
|
|
|
|
modelItem.MSSM = f.Value[mssmindex].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
IGeometry geo_out = FeatureAPI.Difference(f.ShapeCopy, msGeo);
|
|
|
|
|
geoList = FeatureAPI.DissolveGeometryByRing(geo_out);
|
|
|
|
|
foreach (var item in geoList)
|
|
|
|
|
{
|
|
|
|
|
DataModel model = new DataModel();
|
|
|
|
|
dataList.Add(model);
|
|
|
|
|
model.TC = "DLTB";
|
|
|
|
|
model.Geo = item;
|
|
|
|
|
model.IsOut = false;
|
|
|
|
|
model.BGMJ = (item as IPolygon).GetEllipseArea();
|
|
|
|
|
model.DLTBOid = f.OID;
|
|
|
|
|
model.CJDCQInfo = f.Value[zlmcindex].ToTrim() + "-" + f.Value[zldmindex].ToTrim().Substring(0, 12);
|
|
|
|
|
model.XZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 9);
|
|
|
|
|
model.XJXZQInfo = f.Value[zldmindex].ToTrim().Substring(0, 6);
|
|
|
|
|
if (mssmindex != -1)
|
|
|
|
|
modelItem.MSSM = f.Value[mssmindex].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
JXTZBGHelper.AreaAdjustment<DataModel>(dataList, "BGMJ", kzmj);
|
|
|
|
|
splitSumMJ += dataList.Where(w => w.IsOut).Sum(s => s.BGMJ);
|
|
|
|
|
|
|
|
|
|
foreach (var item in dataList)
|
|
|
|
|
{
|
|
|
|
|
if (item.IsOut)
|
|
|
|
|
Data.Add(item);
|
|
|
|
|
}
|
|
|
|
|
//Data.AddRange(dataList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 灭失数据导入变更层
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void MSDataInsertXZQTQTB()
|
|
|
|
|
{
|
|
|
|
|
IFeatureClass jcFc = JCDLTB_Layer.FeatureClass;
|
|
|
|
|
IFeatureClass tzFc = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBBG");
|
|
|
|
|
IFeatureCursor tzCursor = tzFc.Insert(true);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
(tzFc as ITable).DeleteSearchedRows(new QueryFilterClass() { WhereClause = "XZQTZLX='4'" });
|
|
|
|
|
foreach (var item in Data)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (item.IsOut)
|
|
|
|
|
{
|
|
|
|
|
IFeature jc_f = jcFc.GetFeature(item.DLTBOid);
|
|
|
|
|
IFeatureBuffer gxBuff = CreateXzqGxFeature(jc_f, item.Geo, tzFc, false, "");
|
|
|
|
|
int index = gxBuff.Fields.FindField("XZQTZLX");
|
|
|
|
|
if (index != -1)
|
|
|
|
|
gxBuff.Value[index] = "4";
|
|
|
|
|
int bgmjIndex = gxBuff.Fields.FindField("TBMJ");
|
|
|
|
|
if (bgmjIndex != -1)
|
|
|
|
|
gxBuff.Value[bgmjIndex] = item.BGMJ;
|
|
|
|
|
tzCursor.InsertFeature(gxBuff);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tzCursor.Flush();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
MessageHelper.ShowError(ex.Message);
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (tzCursor != null)
|
|
|
|
|
Marshal.ReleaseComObject(tzCursor);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void XZDataInsertXZQTQTB()
|
|
|
|
|
{
|
|
|
|
|
IFeatureClass jcFc = XZDLTB_Layer.FeatureClass;
|
|
|
|
|
IFeatureClass tzFc = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBBG");
|
|
|
|
|
IFeatureCursor tzCursor = tzFc.Insert(true);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
(tzFc as ITable).DeleteSearchedRows(new QueryFilterClass() { WhereClause = "XZQTZLX='3'" });
|
|
|
|
|
foreach (var item in Data)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (item.IsAdd)
|
|
|
|
|
{
|
|
|
|
|
IFeature jc_f = jcFc.GetFeature(item.DLTBOid);
|
|
|
|
|
IFeatureBuffer gxBuff = CreateXzqGxFeature(jc_f, item.Geo, tzFc, false, "");
|
|
|
|
|
int index = gxBuff.Fields.FindField("XZQTZLX");
|
|
|
|
|
if (index != -1)
|
|
|
|
|
gxBuff.Value[index] = "3";
|
|
|
|
|
int bgmjIndex = gxBuff.Fields.FindField("TBMJ");
|
|
|
|
|
if (bgmjIndex != -1)
|
|
|
|
|
gxBuff.Value[bgmjIndex] = item.BGMJ;
|
|
|
|
|
tzCursor.InsertFeature(gxBuff);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tzCursor.Flush();
|
|
|
|
|
IFeatureClass _XZQTZQJCTB = MapsManager.Instance.MapService.GetFeatureClassByName("XZQTZQJCTB");
|
|
|
|
|
IQueryFilter filter = new QueryFilterClass();
|
|
|
|
|
filter.WhereClause = "XZQTZLX = '3'";
|
|
|
|
|
(_XZQTZQJCTB as ITable).DeleteSearchedRows(null);
|
|
|
|
|
JXTZBGHelper.InsertDataToMemeoryLayer(tzFc, _XZQTZQJCTB, filter);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ProgressHelper.CloseProcessBar();
|
|
|
|
|
MessageHelper.ShowError(ex.Message);
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (tzCursor != null)
|
|
|
|
|
Marshal.ReleaseComObject(tzCursor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private IFeatureBuffer CreateXzqGxFeature(IFeature jc_F, IGeometry Geo, IFeatureClass gxFc, bool IsTXBG, string strXZQDM)
|
|
|
|
|
{
|
|
|
|
|
IFeatureBuffer buff = gxFc.CreateFeatureBuffer();
|
|
|
|
|
buff.Shape = Geo;
|
|
|
|
|
for (int i = 0; i < buff.Fields.FieldCount; i++)
|
|
|
|
|
{
|
|
|
|
|
IField field = buff.Fields.Field[i];
|
|
|
|
|
if (field.Name.ToUpper().Contains("SHAPE") || !field.Editable) continue;
|
|
|
|
|
|
|
|
|
|
int _Index = -1;// jc_F.Fields.FindField("XZQDM");
|
|
|
|
|
if (IsTXBG && field.Name == "BSM")
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (field.Name == "DCMJ")
|
|
|
|
|
{
|
|
|
|
|
_Index = jc_F.Fields.FindField(field.Name);
|
|
|
|
|
double bgqdcmj = jc_F.Value[_Index].ToDouble(2);
|
|
|
|
|
if (strXZQDM.Length == 9)
|
|
|
|
|
buff.Value[i] = (bgqdcmj - Data.Where(w => w.XZQInfo.Contains(strXZQDM) && w.IsOut).Sum(s => s.BGMJ)).ToDouble(2);
|
|
|
|
|
else if (strXZQDM.Length >= 12)
|
|
|
|
|
buff.Value[i] = (bgqdcmj - Data.Where(w => w.CJDCQInfo.Contains(strXZQDM.Substring(0, 12)) && w.IsOut).Sum(s => s.BGMJ)).ToDouble(2);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_Index = jc_F.Fields.FindField(field.Name);
|
|
|
|
|
if (_Index != -1)
|
|
|
|
|
{
|
|
|
|
|
buff.Value[i] = jc_F.Value[_Index];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return buff;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 定位按钮
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void KFontIconButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataRowView obj = (sender as KUI.KFontIconButton).Tag as DataRowView;
|
|
|
|
|
string layerName = "DLTBBG";
|
|
|
|
|
|
|
|
|
|
MapsManager.Instance.MapService.SelectFeature(layerName, obj["OBJECTID"].ToTrim(), true);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.Show("定位失败!" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 全选行政区调整类型为3的数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void ckbCheckAll_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataRow[] drs = (dgInto.ItemsSource as DataTable).Select("XZQTZLX='3'");
|
|
|
|
|
if (this.ckbCheckAll.IsChecked == true)
|
|
|
|
|
{
|
|
|
|
|
if (drs != null && drs.Length != 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < drs.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
DataRow row = drs[i];
|
|
|
|
|
row["IsValid"] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (drs != null && drs.Length != 0)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < drs.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
DataRow row = drs[i];
|
|
|
|
|
row["IsValid"] = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("新增地类图斑坐落统赋:" + ex);
|
|
|
|
|
MessageHelper.ShowError("新增地类图斑坐落统赋:" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增图斑坐落统赋
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void SetZLDW_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (cobZLDW.SelectedItemValue != null)
|
|
|
|
|
{
|
|
|
|
|
DataRow[] drs = (dgInto.ItemsSource as DataTable).Select("IsValid=True");
|
|
|
|
|
if (drs.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.Show("未选中需要坐落统赋的新增图斑!!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string where = string.Format("XZQTZLX='3'");
|
|
|
|
|
SetAttribute("ZLDWDM", (cobZLDW.SelectedItem as DataDicTionary).CODE, where);
|
|
|
|
|
SetAttribute("ZLDWMC", (cobZLDW.SelectedItem as DataDicTionary).NAME, where);
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("请选择坐落单位!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("新增地类图斑坐落统赋:" + ex);
|
|
|
|
|
MessageHelper.ShowError("新增地类图斑坐落统赋:" + ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 设置属性
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pFieldName">字段名称</param>
|
|
|
|
|
/// <param name="pValue">赋予值</param>
|
|
|
|
|
/// <param name="pWhere">赋值条件</param>
|
|
|
|
|
/// <param name="pJCFieldName">基础库字段名称</param>
|
|
|
|
|
private void SetAttribute(string pFieldName, string pValue, string pWhere = "", string pJCFieldName = "")
|
|
|
|
|
{
|
|
|
|
|
DataRow[] drs = (dgInto.ItemsSource as DataTable).Select("IsValid=True");
|
|
|
|
|
IQueryFilter filter = null;
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(pWhere))
|
|
|
|
|
filter = new QueryFilterClass() { WhereClause = pWhere };
|
|
|
|
|
IFeatureCursor cursor = targetFc.Update(filter, true);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
IFeature f = null;
|
|
|
|
|
int index = targetFc.Fields.FindField(pFieldName);
|
|
|
|
|
if (index == -1)
|
|
|
|
|
return;
|
|
|
|
|
while ((f = cursor.NextFeature()) != null)
|
|
|
|
|
{
|
|
|
|
|
drs = (dgInto.ItemsSource as DataTable).Select("OBJECTID=" + f.Value[targetFc.FindField("OBJECTID")]);
|
|
|
|
|
if (drs != null && drs.Length > 0 && drs[0]["IsValid"].ToString() != "True")
|
|
|
|
|
continue;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(pValue) && !string.IsNullOrWhiteSpace(pJCFieldName))
|
|
|
|
|
{
|
|
|
|
|
int sIndex = targetFc.FindField(pJCFieldName);
|
|
|
|
|
if (sIndex != -1)
|
|
|
|
|
f.Value[index] = f.Value[sIndex];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
f.Value[index] = pValue;
|
|
|
|
|
}
|
|
|
|
|
cursor.UpdateFeature(f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 新增图斑权属统赋
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void SetQSDW_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DataRow[] drs = (dgInto.ItemsSource as DataTable).Select("IsValid=True");
|
|
|
|
|
if (drs.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.Show("未选中需要权属统赋的新增图斑!!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string where = string.Format("XZQTZLX='3'");
|
|
|
|
|
object o = cobQSDWLX.EditValue;
|
|
|
|
|
switch (o.ToTrim())
|
|
|
|
|
{
|
|
|
|
|
case "随坐落变化":
|
|
|
|
|
SetAttribute("QSDWDM", "", where, "ZLDWDM");
|
|
|
|
|
SetAttribute("QSDWMC", "", where, "ZLDWMC");
|
|
|
|
|
SetAttribute("FRDBS", "0", where);
|
|
|
|
|
break;
|
|
|
|
|
case "随坐落变化(飞入地除外)":
|
|
|
|
|
where = string.Format("XZQTZLX='3' and FRDBS = '0'");
|
|
|
|
|
SetAttribute("QSDWDM", "", where, "ZLDWDM");
|
|
|
|
|
SetAttribute("QSDWMC", "", where, "ZLDWMC");
|
|
|
|
|
break;
|
|
|
|
|
case "继承原有权属":
|
|
|
|
|
SetAttribute("QSDWDM", "", where, "QSDWDM");
|
|
|
|
|
SetAttribute("QSDWMC", "", where, "QSDWMC");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
LoadData();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("新增地类图斑权属统赋失败:" + ex);
|
|
|
|
|
MessageHelper.ShowError("新增地类图斑权属统赋失败:" + ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载视图数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void LoadData()
|
|
|
|
|
{
|
|
|
|
|
IFeatureCursor cursor = null;
|
|
|
|
|
IFeature xzqtqtbFeature = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
targetFc = MapsManager.Instance.MapService.GetFeatureClassByName("DLTBBG");
|
|
|
|
|
if (targetFc == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
IntoData = new DataTable();
|
|
|
|
|
ConstructColumn(targetFc.Fields);
|
|
|
|
|
IQueryFilter queryfilter = new QueryFilterClass();
|
|
|
|
|
queryfilter.WhereClause = string.Format("XZQTZLX='3' or XZQTZLX='4'");
|
|
|
|
|
cursor = targetFc.Search(queryfilter, true);
|
|
|
|
|
while ((xzqtqtbFeature = cursor.NextFeature()) != null)
|
|
|
|
|
{
|
|
|
|
|
DataRow dr = IntoData.NewRow();
|
|
|
|
|
bool IsInto = true;
|
|
|
|
|
dr[0] = false;
|
|
|
|
|
for (int i = 0; i < IntoData.Columns.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (i == 0)
|
|
|
|
|
{
|
|
|
|
|
dr[i] = false;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
object obj = xzqtqtbFeature.get_Value((int)IntoData.Columns[i].ExtendedProperties["index"]);
|
|
|
|
|
if (obj == null)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ((obj.ToString()).Contains("1899/12/30 0:00:00"))
|
|
|
|
|
{
|
|
|
|
|
obj = System.DBNull.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (obj is string)
|
|
|
|
|
{
|
|
|
|
|
obj = obj.ToString().Trim();
|
|
|
|
|
}
|
|
|
|
|
dr[i] = obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IsInto)
|
|
|
|
|
IntoData.Rows.Add(dr);
|
|
|
|
|
Marshal.ReleaseComObject(xzqtqtbFeature);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dgInto.ItemsSource = null;
|
|
|
|
|
dgInto.ItemsSource = IntoData;
|
|
|
|
|
dgInto.ClearGrouping();
|
|
|
|
|
dgInto.GroupBy("XZQTZLX", true);
|
|
|
|
|
lblCount.Content = "总条数:" + IntoData.Rows.Count + "/0";
|
|
|
|
|
if (this.ckbCheckAll.IsChecked == true)
|
|
|
|
|
{
|
|
|
|
|
this.ckbCheckAll.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//绑定权属字典
|
|
|
|
|
if (ZLDMdataDic == null)
|
|
|
|
|
{
|
|
|
|
|
ZLDMdataDic = Platform.Instance.DicHelper.GetNoGroupDic(DicTypeEnum.QSDM);
|
|
|
|
|
if (ZLDMdataDic == null)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.Show("权属字典未生成!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ZLDMdataDic = ZLDMdataDic.Where(x => x.CODE.Length == 19).ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
cobZLDW.ItemsSource = ZLDMdataDic;
|
|
|
|
|
cobZLDW.DisplayMember = "NAME";
|
|
|
|
|
cobZLDW.ValueMember = "CODE";
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
LogAPI.Debug("加载行政区提取图斑层数据失败,异常信息如下:");
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
MessageHelper.ShowError("加载行政区提取图斑层数据失败:" + ex.Message);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
if (cursor != null)
|
|
|
|
|
{
|
|
|
|
|
Marshal.ReleaseComObject(cursor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造列获取记录条数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fields"></param>
|
|
|
|
|
private void ConstructColumn(IFields fields)
|
|
|
|
|
{
|
|
|
|
|
if (fields != null)
|
|
|
|
|
{
|
|
|
|
|
IntoData = new DataTable();
|
|
|
|
|
DataColumn col1 = new DataColumn();
|
|
|
|
|
col1.ColumnName = "IsValid";
|
|
|
|
|
col1.Caption = "选中";
|
|
|
|
|
col1.DataType = typeof(bool);
|
|
|
|
|
IntoData.Columns.Add(col1);
|
|
|
|
|
for (int i = 0; i < fields.FieldCount; i++)
|
|
|
|
|
{
|
|
|
|
|
IField field = fields.get_Field(i);
|
|
|
|
|
if (field.Name.ToUpper().StartsWith("SHAPE"))
|
|
|
|
|
continue;
|
|
|
|
|
DataColumn col = new DataColumn();
|
|
|
|
|
col.ExtendedProperties.Add("index", i);
|
|
|
|
|
col.ColumnName = field.Name;
|
|
|
|
|
col.Caption = field.AliasName;
|
|
|
|
|
switch (field.Type)
|
|
|
|
|
{
|
|
|
|
|
case esriFieldType.esriFieldTypeSmallInteger:
|
|
|
|
|
col.DataType = typeof(short);
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeInteger:
|
|
|
|
|
col.DataType = typeof(int);
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeSingle:
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeDouble:
|
|
|
|
|
col.DataType = typeof(double);
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeString:
|
|
|
|
|
col.DataType = typeof(string);
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeDate:
|
|
|
|
|
col.DataType = typeof(DateTime);
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeOID:
|
|
|
|
|
col.DataType = typeof(Int32);
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeGeometry:
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeBlob:
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeRaster:
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeGUID:
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeGlobalID:
|
|
|
|
|
break;
|
|
|
|
|
case esriFieldType.esriFieldTypeXML:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
col.ReadOnly = !field.Editable;//编辑状态启用默认是否可以编辑
|
|
|
|
|
IntoData.Columns.Add(col);
|
|
|
|
|
Marshal.ReleaseComObject(field);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ClosePanel()
|
|
|
|
|
{
|
|
|
|
|
Platform.Instance.CloseView(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ClosePanelInvoke()
|
|
|
|
|
{
|
|
|
|
|
CloseViewHandler?.Invoke(null, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ShowPanel()
|
|
|
|
|
{
|
|
|
|
|
Platform.Instance.OpenView(this, false);
|
|
|
|
|
MapsManager.Instance.MapService.ProjectClosed += (s, e) =>
|
|
|
|
|
{
|
|
|
|
|
this.ClosePanel();
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class XZQGXAttribute2
|
|
|
|
|
{
|
|
|
|
|
public string TempBSMPrefix { get; set; }
|
|
|
|
|
public string BSM
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("BSM"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["BSM"].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("BSM"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["BSM"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("BSM", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public string BGTBOID { get; set; }
|
|
|
|
|
public bool IsUpdate { get; set; }
|
|
|
|
|
public int UpdateOID { get; set; }
|
|
|
|
|
private List<XZQGXGCAttribute2> _GCDataList;
|
|
|
|
|
public List<XZQGXGCAttribute2> GCDataList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_GCDataList == null)
|
|
|
|
|
_GCDataList = new List<XZQGXGCAttribute2>();
|
|
|
|
|
return _GCDataList;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_GCDataList = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private IGeometry _Shape;
|
|
|
|
|
public IGeometry Shape
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_GCDataList != null)
|
|
|
|
|
{
|
|
|
|
|
_Shape = UnionGXGC();
|
|
|
|
|
}
|
|
|
|
|
return _Shape;
|
|
|
|
|
}
|
|
|
|
|
set { _Shape = value; }
|
|
|
|
|
}
|
|
|
|
|
public IGeometry Shape2
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
public Dictionary<string, int> FieldsIndex { get; set; }
|
|
|
|
|
public Dictionary<string, object> FieldsValue { get; set; }
|
|
|
|
|
public XZQGXAttribute2(Dictionary<string, int> pFieldsIndex, XZQGXGCAttribute2 pGXGCData)
|
|
|
|
|
{
|
|
|
|
|
this.FieldsIndex = pFieldsIndex;
|
|
|
|
|
if (pGXGCData == null)
|
|
|
|
|
return;
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in FieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGH" + item;
|
|
|
|
|
if (!pGXGCData.FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGHTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!pGXGCData.FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, null);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pGXGCData.FieldsValue[bghAttr];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pGXGCData.FieldsValue[bghAttr]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
TempBSMPrefix = pGXGCData.TempBSMPrefix;
|
|
|
|
|
BGTBOID = pGXGCData.BGTBOID;
|
|
|
|
|
Shape = pGXGCData.Shape;
|
|
|
|
|
}
|
|
|
|
|
public XZQGXAttribute2(Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
FieldsIndex = pFieldsIndex;
|
|
|
|
|
}
|
|
|
|
|
public void SetAttribure(IFeature pFeature, Dictionary<string, int> pFieldsIndex = null)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
Shape = pFeature.ShapeCopy;
|
|
|
|
|
Dictionary<string, int> fields = FieldsIndex;
|
|
|
|
|
if (pFieldsIndex != null)
|
|
|
|
|
fields = pFieldsIndex;
|
|
|
|
|
foreach (var item in fields.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[FieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[FieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[FieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetAttribureNew(IFeature pFeature, Dictionary<string, int> pFieldsIndex = null)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
Shape = pFeature.ShapeCopy;
|
|
|
|
|
Dictionary<string, int> fields = FieldsIndex;
|
|
|
|
|
if (pFieldsIndex != null)
|
|
|
|
|
{
|
|
|
|
|
FieldsIndex = pFieldsIndex;
|
|
|
|
|
fields = pFieldsIndex;
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in fields.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item == "OBJECTID" || item == "FID")
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pFieldsIndex != null)
|
|
|
|
|
{
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[pFieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[pFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[pFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[FieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[FieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[FieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool IsEqual(XZQGXAttribute2 pData)
|
|
|
|
|
{
|
|
|
|
|
bool result = true;
|
|
|
|
|
if (FieldsValue == null || pData.FieldsValue == null)
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in FieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
if ("SHAPE,BGTBOID,GXSJ,BSM,YSDM".Contains(item) || item.Contains("MJ"))
|
|
|
|
|
continue;
|
|
|
|
|
if (!pData.FieldsValue.Keys.Contains(item)) continue;
|
|
|
|
|
if (!Equals(FieldsValue[item], pData.FieldsValue[item]))
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
private bool Equals(object obj1, object obj2)
|
|
|
|
|
{
|
|
|
|
|
if (obj1 == null || obj1 is DBNull)
|
|
|
|
|
{
|
|
|
|
|
obj1 = "";
|
|
|
|
|
}
|
|
|
|
|
if (obj2 == null || obj2 is DBNull)
|
|
|
|
|
{
|
|
|
|
|
obj2 = "";
|
|
|
|
|
}
|
|
|
|
|
if (obj2.ToString() == "0")
|
|
|
|
|
obj2 = "";
|
|
|
|
|
if (obj1.ToString() == "0")
|
|
|
|
|
obj1 = "";
|
|
|
|
|
if (obj1.ToTrim() == obj2.ToTrim())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
private IGeometry UnionGXGC()
|
|
|
|
|
{
|
|
|
|
|
IGeometry result = null;
|
|
|
|
|
List<int> updateOIDs = new List<int>();
|
|
|
|
|
foreach (var item in _GCDataList)
|
|
|
|
|
{
|
|
|
|
|
if (item.Shape == null || item.Shape.IsEmpty)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (item.IsUpdate)
|
|
|
|
|
{
|
|
|
|
|
if (updateOIDs.Contains(item.UpdateOID))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
updateOIDs.Add(item.UpdateOID);
|
|
|
|
|
}
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
result = item.Shape;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ITopologicalOperator topo = result as ITopologicalOperator;
|
|
|
|
|
topo.Simplify();
|
|
|
|
|
ITopologicalOperator topo2 = item.Shape as ITopologicalOperator;
|
|
|
|
|
topo2.Simplify();
|
|
|
|
|
IGeometry result2 = topo.Union(item.Shape);
|
|
|
|
|
result = result2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class XZQGXGCAttribute2
|
|
|
|
|
{
|
|
|
|
|
public string TempBSMPrefix { get; set; }
|
|
|
|
|
public string BGTBOID
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("BGTBOID"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["BGTBOID"].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("BGTBOID"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["BGTBOID"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("BGTBOID", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool IsUpdate { get; set; }
|
|
|
|
|
public int UpdateOID { get; set; }
|
|
|
|
|
public string BGHBSM
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("BGHBSM"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["BGHBSM"].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("BGHBSM"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["BGHBSM"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("BGHBSM", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 变更行为
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string BGXW { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 变更面积
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double BGMJ
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("TBBGMJ"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["TBBGMJ"].ToDouble();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("TBBGMJ"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["TBBGMJ"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("TBBGMJ", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Dictionary<string, int> FieldsIndex { get; set; }
|
|
|
|
|
public Dictionary<string, object> FieldsValue { get; set; }
|
|
|
|
|
public XZQGXGCAttribute2()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public XZQGXGCAttribute2(IFields pFields)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
FieldsIndex = new Dictionary<string, int>();
|
|
|
|
|
using (ComReleaser releaser = new ComReleaser())
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < pFields.FieldCount; i++)
|
|
|
|
|
{
|
|
|
|
|
IField field = pFields.Field[i];
|
|
|
|
|
releaser.ManageLifetime(field);
|
|
|
|
|
if (!field.Editable || field.Name.ToUpper().Contains("SHAPE")) continue;
|
|
|
|
|
FieldsIndex.Add(field.Name.ToUpper(), i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public XZQGXGCAttribute2(Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
this.FieldsIndex = pFieldsIndex;
|
|
|
|
|
}
|
|
|
|
|
public IGeometry Shape { get; set; }
|
|
|
|
|
public void SetBGQAttribure(IFeature pFeature, Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pFieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGQ" + item;
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGQTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pFeature.Value[pFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pFeature.Value[pFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGQAttribure(XZQGXGCAttribute2 pGXGCData)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGXGCData.FieldsValue.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item.Contains("BGH"))
|
|
|
|
|
continue;
|
|
|
|
|
string bghAttr = item;
|
|
|
|
|
if (!FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pGXGCData.FieldsValue[item];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pGXGCData.FieldsValue[item]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGHAttribure(XZQGXGCAttribute2 pGXGCData)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGXGCData.FieldsValue.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item.Contains("BGQ"))
|
|
|
|
|
continue;
|
|
|
|
|
string bghAttr = item;
|
|
|
|
|
if (!FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pGXGCData.FieldsValue[item];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pGXGCData.FieldsValue[item]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGHAttribure(XZQGXAttribute2 pGXData)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGXData.FieldsValue.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGH" + item;
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGHTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pGXData.FieldsValue[item];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pGXData.FieldsValue[item]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGHAttribure(IFeature pFeature, Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pFieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGH" + item;
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGHTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pFeature.Value[pFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pFeature.Value[pFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetAttribure(IFeature pFeature, Dictionary<string, int> pGxgcFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGxgcFieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsIndex.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[pGxgcFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[pGxgcFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[pGxgcFieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (item == "BGXW")
|
|
|
|
|
{
|
|
|
|
|
BGXW = pFeature.Value[pGxgcFieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class CJDCQGXAttribute
|
|
|
|
|
{
|
|
|
|
|
public string BSM
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("BSM"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["BSM"].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("BSM"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["BSM"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("BSM", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public string BGTBOID { get; set; }
|
|
|
|
|
public bool IsUpdate { get; set; }
|
|
|
|
|
public int UpdateOID { get; set; }
|
|
|
|
|
private List<CJDCQGXGCAttribute> _GCDataList;
|
|
|
|
|
public List<CJDCQGXGCAttribute> GCDataList
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_GCDataList == null)
|
|
|
|
|
_GCDataList = new List<CJDCQGXGCAttribute>();
|
|
|
|
|
return _GCDataList;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_GCDataList = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private IGeometry _Shape;
|
|
|
|
|
public IGeometry Shape
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_GCDataList != null)
|
|
|
|
|
{
|
|
|
|
|
_Shape = UnionGXGC();
|
|
|
|
|
}
|
|
|
|
|
return _Shape;
|
|
|
|
|
}
|
|
|
|
|
set { _Shape = value; }
|
|
|
|
|
}
|
|
|
|
|
public IGeometry Shape2
|
|
|
|
|
{
|
|
|
|
|
get;
|
|
|
|
|
set;
|
|
|
|
|
}
|
|
|
|
|
public Dictionary<string, int> FieldsIndex { get; set; }
|
|
|
|
|
public Dictionary<string, object> FieldsValue { get; set; }
|
|
|
|
|
public CJDCQGXAttribute(Dictionary<string, int> pFieldsIndex, CJDCQGXGCAttribute pGXGCData)
|
|
|
|
|
{
|
|
|
|
|
this.FieldsIndex = pFieldsIndex;
|
|
|
|
|
if (pGXGCData == null)
|
|
|
|
|
return;
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in FieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGH" + item;
|
|
|
|
|
if (!pGXGCData.FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGHTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!pGXGCData.FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, null);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pGXGCData.FieldsValue[bghAttr];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pGXGCData.FieldsValue[bghAttr]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
BGTBOID = pGXGCData.BGTBOID;
|
|
|
|
|
Shape = pGXGCData.Shape;
|
|
|
|
|
}
|
|
|
|
|
public CJDCQGXAttribute(Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
FieldsIndex = pFieldsIndex;
|
|
|
|
|
}
|
|
|
|
|
public void SetAttribure(IFeature pFeature, Dictionary<string, int> pFieldsIndex = null)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
Shape = pFeature.ShapeCopy;
|
|
|
|
|
Dictionary<string, int> fields = FieldsIndex;
|
|
|
|
|
if (pFieldsIndex != null)
|
|
|
|
|
fields = pFieldsIndex;
|
|
|
|
|
foreach (var item in fields.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[FieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[FieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[FieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetAttribureNew(IFeature pFeature, Dictionary<string, int> pFieldsIndex = null)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
Shape = pFeature.ShapeCopy;
|
|
|
|
|
Dictionary<string, int> fields = FieldsIndex;
|
|
|
|
|
if (pFieldsIndex != null)
|
|
|
|
|
{
|
|
|
|
|
FieldsIndex = pFieldsIndex;
|
|
|
|
|
fields = pFieldsIndex;
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in fields.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item == "OBJECTID" || item == "FID")
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pFieldsIndex != null)
|
|
|
|
|
{
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[pFieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[pFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[pFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[FieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[FieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[FieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool IsEqual(CJDCQGXAttribute pData)
|
|
|
|
|
{
|
|
|
|
|
bool result = true;
|
|
|
|
|
if (FieldsValue == null || pData.FieldsValue == null)
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in FieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
if ("SHAPE,BGTBOID,GXSJ,BSM,YSDM".Contains(item) || item.Contains("MJ"))
|
|
|
|
|
continue;
|
|
|
|
|
if (!pData.FieldsValue.Keys.Contains(item)) continue;
|
|
|
|
|
if (!Equals(FieldsValue[item], pData.FieldsValue[item]))
|
|
|
|
|
{
|
|
|
|
|
result = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
private bool Equals(object obj1, object obj2)
|
|
|
|
|
{
|
|
|
|
|
if (obj1 == null || obj1 is DBNull)
|
|
|
|
|
{
|
|
|
|
|
obj1 = "";
|
|
|
|
|
}
|
|
|
|
|
if (obj2 == null || obj2 is DBNull)
|
|
|
|
|
{
|
|
|
|
|
obj2 = "";
|
|
|
|
|
}
|
|
|
|
|
if (obj2.ToString() == "0")
|
|
|
|
|
obj2 = "";
|
|
|
|
|
if (obj1.ToString() == "0")
|
|
|
|
|
obj1 = "";
|
|
|
|
|
if (obj1.ToTrim() == obj2.ToTrim())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
private IGeometry UnionGXGC()
|
|
|
|
|
{
|
|
|
|
|
IGeometry result = null;
|
|
|
|
|
List<int> updateOIDs = new List<int>();
|
|
|
|
|
foreach (var item in _GCDataList)
|
|
|
|
|
{
|
|
|
|
|
if (item.Shape == null || item.Shape.IsEmpty)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (item.IsUpdate)
|
|
|
|
|
{
|
|
|
|
|
if (updateOIDs.Contains(item.UpdateOID))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
updateOIDs.Add(item.UpdateOID);
|
|
|
|
|
}
|
|
|
|
|
if (result == null)
|
|
|
|
|
{
|
|
|
|
|
result = item.Shape;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ITopologicalOperator topo = result as ITopologicalOperator;
|
|
|
|
|
topo.Simplify();
|
|
|
|
|
ITopologicalOperator topo2 = item.Shape as ITopologicalOperator;
|
|
|
|
|
topo2.Simplify();
|
|
|
|
|
IGeometry result2 = topo.Union(item.Shape);
|
|
|
|
|
result = result2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class CJDCQGXGCAttribute
|
|
|
|
|
{
|
|
|
|
|
public string BGTBOID
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("BGTBOID"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["BGTBOID"].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("BGTBOID"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["BGTBOID"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("BGTBOID", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool IsUpdate { get; set; }
|
|
|
|
|
public int UpdateOID { get; set; }
|
|
|
|
|
public string BGHBSM
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("BGHBSM"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["BGHBSM"].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("BGHBSM"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["BGHBSM"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("BGHBSM", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 变更行为
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string BGXW { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 变更面积
|
|
|
|
|
/// </summary>
|
|
|
|
|
public double BGMJ
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue != null && FieldsValue.Keys.Contains("TBBGMJ"))
|
|
|
|
|
{
|
|
|
|
|
return FieldsValue["TBBGMJ"].ToDouble();
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsValue.Keys.Contains("TBBGMJ"))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue["TBBGMJ"] = value;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add("TBBGMJ", value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Dictionary<string, int> FieldsIndex { get; set; }
|
|
|
|
|
public Dictionary<string, object> FieldsValue { get; set; }
|
|
|
|
|
public CJDCQGXGCAttribute(Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
this.FieldsIndex = pFieldsIndex;
|
|
|
|
|
}
|
|
|
|
|
public IGeometry Shape { get; set; }
|
|
|
|
|
public void SetBGQAttribure(IFeature pFeature, Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pFieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGQ" + item;
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGQTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pFeature.Value[pFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pFeature.Value[pFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGQAttribure(CJDCQGXGCAttribute pGXGCData)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGXGCData.FieldsValue.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item.Contains("BGH"))
|
|
|
|
|
continue;
|
|
|
|
|
string bghAttr = item;
|
|
|
|
|
if (!FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pGXGCData.FieldsValue[item];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pGXGCData.FieldsValue[item]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGHAttribure(CJDCQGXGCAttribute pGXGCData)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGXGCData.FieldsValue.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (item.Contains("BGQ"))
|
|
|
|
|
continue;
|
|
|
|
|
string bghAttr = item;
|
|
|
|
|
if (!FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pGXGCData.FieldsValue[item];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pGXGCData.FieldsValue[item]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGHAttribure(CJDCQGXAttribute pGXData)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGXData.FieldsValue.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGH" + item;
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGHTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pGXData.FieldsValue[item];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pGXData.FieldsValue[item]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetBGHAttribure(IFeature pFeature, Dictionary<string, int> pFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pFieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
string bghAttr = "BGH" + item;
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
bghAttr = "BGHTB" + item;
|
|
|
|
|
}
|
|
|
|
|
if (!FieldsIndex.Keys.Contains(bghAttr))
|
|
|
|
|
continue;
|
|
|
|
|
if (FieldsValue.Keys.Contains(bghAttr))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[bghAttr] = pFeature.Value[pFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(bghAttr, pFeature.Value[pFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void SetAttribure(IFeature pFeature, Dictionary<string, int> pGxgcFieldsIndex)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue == null)
|
|
|
|
|
FieldsValue = new Dictionary<string, object>();
|
|
|
|
|
if (FieldsIndex == null)
|
|
|
|
|
return;
|
|
|
|
|
foreach (var item in pGxgcFieldsIndex.Keys)
|
|
|
|
|
{
|
|
|
|
|
if (FieldsIndex.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
if (FieldsValue.Keys.Contains(item))
|
|
|
|
|
{
|
|
|
|
|
FieldsValue[item] = pFeature.Value[pGxgcFieldsIndex[item]];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FieldsValue.Add(item, pFeature.Value[pGxgcFieldsIndex[item]]);
|
|
|
|
|
}
|
|
|
|
|
if (item == "BGTBOID")
|
|
|
|
|
{
|
|
|
|
|
BGTBOID = pFeature.Value[pGxgcFieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
if (item == "BGXW")
|
|
|
|
|
{
|
|
|
|
|
BGXW = pFeature.Value[pGxgcFieldsIndex[item]].ToTrim();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void CalculationArea()
|
|
|
|
|
{
|
|
|
|
|
BGMJ = (Shape as IPolygon).GetEllipseArea();
|
|
|
|
|
}
|
|
|
|
|
private bool Equals(object obj1, object obj2)
|
|
|
|
|
{
|
|
|
|
|
if (obj1 == null || obj1 is DBNull)
|
|
|
|
|
{
|
|
|
|
|
obj1 = "";
|
|
|
|
|
}
|
|
|
|
|
if (obj2 == null || obj2 is DBNull)
|
|
|
|
|
{
|
|
|
|
|
obj2 = "";
|
|
|
|
|
}
|
|
|
|
|
if (obj2.ToString() == "0")
|
|
|
|
|
obj2 = "";
|
|
|
|
|
if (obj1.ToString() == "0")
|
|
|
|
|
obj1 = "";
|
|
|
|
|
if (obj1.ToTrim() == obj2.ToTrim())
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|