public override void Run(object sender, EventArgs e) { mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; //道路检测 PipeRoadCheck(); WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); }
public override void Run(object sender, EventArgs e) { mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; frmSelType frmType = new frmSelType(); if (frmType.ShowDialog() == DialogResult.OK) { //将数据字典读入内存 string strMdbPath = System.Windows.Forms.Application.StartupPath + @"\..\Support\管线数据字典.mdb"; string strTableName = "_CONFIGDICTIONARY"; bool bSuccess = false; m_dtDic = GetDataDictionary(strTableName, strMdbPath, ref bSuccess); m_arrPipeType = frmType.PipeType; //点表数据检查 DataPntCheck(); //线表数据检查 DataArcCheck(); WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); } }
public override void Run(object sender, EventArgs e) { mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; frmIntegrityCheck frmDataCheckSet = new frmIntegrityCheck(); if (frmDataCheckSet.ShowDialog() == DialogResult.OK) { m_arrPntField = frmDataCheckSet.PntFieldSel; m_arrArcField = frmDataCheckSet.ArcFieldSel; m_arrPipeType = frmDataCheckSet.PipeType; DataIntegrityCheck();//开始检查 WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); } }
public override void Run(object sender, EventArgs e) { int i = 0, k; string strDicValue; string strPntID; IFeatureClass Pntfc; IFeatureClass Arcfc; IFeatureCursor pFeaCursor; IQueryFilter pFilter = new QueryFilterClass(); IFeature pFea; string[] arrFc2DId; mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; frmSelType frmType = new frmSelType(); if (frmType.ShowDialog() == DialogResult.OK) { try { List <DF2DFeatureClass> pPntlist = new List <DF2DFeatureClass>(); List <DF2DFeatureClass> pArclist = new List <DF2DFeatureClass>(); m_arrPipeType = frmType.PipeType; for (i = 0; i < m_arrPipeType.Count; i++) { MajorClass mc = m_arrPipeType[i] as MajorClass; arrFc2DId = mc.Fc2D.Split(';'); if (arrFc2DId == null) { continue; } foreach (string fc2DId in arrFc2DId) { DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId); if (dffc == null) { continue; } IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } if (dffc.GetFacilityClassName() == "PipeNode") { pPntlist.Add(dffc); continue; } if (dffc.GetFacilityClassName() == "PipeLine") { pArclist.Add(dffc); continue; } } } if ((pPntlist == null) || (pArclist == null)) { return; } Dictionary <IFeatureClass, DataTable> dict = new Dictionary <IFeatureClass, DataTable>(); WaitForm.Start("开始数据一致性检查..", "请稍候"); int count = 0; foreach (DF2DFeatureClass Pntdfcc in pPntlist) { DataTable dt = GetDataTableByStruture(); DF2DFeatureClass Arcdfcc = pArclist[count]; Pntfc = Pntdfcc.GetFeatureClass(); Arcfc = Arcdfcc.GetFeatureClass(); if (Pntfc == null && Arcfc == null) { return; } WaitForm.SetCaption("正在检查图层:" + " " + Pntfc.AliasName); FacilityClass fac = Pntdfcc.GetFacilityClass(); if (fac == null) { continue; } FacilityClass facc = Arcdfcc.GetFacilityClass(); if (facc == null) { continue; } //List<DFDataConfig.Class.FieldInfo> listField = fac.FieldInfoCollection; DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("LinkType"); if (fi == null) { continue; } DFDataConfig.Class.FieldInfo fi1 = fac.GetFieldInfoBySystemName("Detectid"); if (fi1 == null) { continue; } DFDataConfig.Class.FieldInfo fi2 = facc.GetFieldInfoBySystemName("StartNo"); if (fi2 == null) { continue; } DFDataConfig.Class.FieldInfo fi3 = facc.GetFieldInfoBySystemName("EndNo"); if (fi3 == null) { continue; } DFDataConfig.Class.FieldInfo fi4 = fac.GetFieldInfoBySystemName("UState"); if (fi4 == null) { continue; } // DFDataConfig.Class.FieldInfo fi5 = facc.GetFieldInfoBySystemName("source"); // if (fi5 == null) continue; pFeaCursor = Pntfc.Search(null, true); while ((pFea = pFeaCursor.NextFeature()) != null) { bool b1 = false, b2 = false; strPntID = pFea.get_Value(Pntfc.FindField(fi1.Name)).ToString(); strDicValue = pFea.get_Value(Pntfc.FindField(fi.Name)).ToString(); if (strDicValue == "三通" || strDicValue == "三分支") { k = 3; } else if (strDicValue == "四通" || strDicValue == "四分支") { k = 4; } else if (strDicValue == "五通" || strDicValue == "五分支") { k = 5; } else if (strDicValue == "六通" || strDicValue == "六分支") { k = 6; } else if (strDicValue == "七通" || strDicValue == "七分支") { k = 7; } else if (strDicValue == "八通" || strDicValue == "八分支") { k = 8; } else { k = 2; } pFilter.WhereClause = fi2.Name + " = '" + strPntID + "' or " + fi3.Name + " = '" + strPntID + "'"; if (Arcfc.FeatureCount(pFilter) != k) { b1 = true; } if (Pntfc.FindField(fi4.Name) != -1 && Arcfc.FindField(fi4.Name) != -1) { pFilter.WhereClause = "(" + fi2.Name + " = '" + strPntID + "' or " + fi3.Name + " = '" + strPntID + "') and " + fi4.Name + " <> '" + strDicValue + "'"; if (Arcfc.FeatureCount(pFilter) > 0) { b2 = true; } } DataRow dr = dt.NewRow(); dr["ErrorFeatureID"] = pFea.OID; dr["FeatureofClass"] = Pntfc.AliasName; dr["FeatureofLayer"] = (Pntfc as IDataset).Name; dr["FeatureClass"] = Pntfc; if (b1 && b2) { dr["ErrorType"] = "多通多分支与管点连接管线数量不一致;管点与相连接管线的使用状态不一致"; } else if (b1 && !b2) { dr["ErrorType"] = "多通多分支与管点连接管线数量不一致"; } else if (!b1 && b2) { dr["ErrorType"] = "管点与相连接管线的使用状态不一致"; } dt.Rows.Add(dr); //Console.WriteLine(pFea.OID + " " + Pntfc.AliasName); } if (dt.Rows.Count > 0) { dict[Pntfc] = dt; } count++; } WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); } catch (System.Exception ex) { } } }
public override void Run(object sender, EventArgs e) { string[] arrFc2DId; mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; frmSelType frmType = new frmSelType(); if (frmType.ShowDialog() == DialogResult.OK) { List <DF2DFeatureClass> list = new List <DF2DFeatureClass>(); m_arrPipeType = frmType.PipeType; for (int i = 0; i < m_arrPipeType.Count; i++) { MajorClass mc = m_arrPipeType[i] as MajorClass; arrFc2DId = mc.Fc2D.Split(';'); if (arrFc2DId == null) { continue; } foreach (string fc2DId in arrFc2DId) { DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId); if (dffc == null || dffc.GetFacilityClassName() != "PipeLine") { continue; } IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } //if (fc.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline) //{ list.Add(dffc); //} } } Dictionary <IFeatureClass, DataTable> dict = new Dictionary <IFeatureClass, DataTable>(); WaitForm.Start("开始拓扑检查..", "请稍候"); foreach (DF2DFeatureClass dffc in list) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { continue; } FacilityClass fac = dffc.GetFacilityClass(); if (fac == null) { continue; } List <DFDataConfig.Class.FieldInfo> listField = fac.FieldInfoCollection; DFDataConfig.Class.FieldInfo fi = fac.GetFieldInfoBySystemName("StartHeight2D"); int index = fc.FindField(fi.Name); WaitForm.SetCaption("正在检查图层:" + " " + fc.AliasName); if (fi == null || index == -1) { continue; } DFDataConfig.Class.FieldInfo fi1 = fac.GetFieldInfoBySystemName("EndHeight"); int index1 = fc.FindField(fi1.Name); if (fi1 == null || index1 == -1) { continue; } DFDataConfig.Class.FieldInfo fi2 = fac.GetFieldInfoBySystemName("StartDep"); int index2 = fc.FindField(fi2.Name); if (fi2 == null || index2 == -1) { continue; } DFDataConfig.Class.FieldInfo fi3 = fac.GetFieldInfoBySystemName("EndDep"); int index3 = fc.FindField(fi3.Name); if (fi3 == null || index3 == -1) { continue; } DataTable dt = GetDataTableByStruture(); IFeatureCursor pFeaCursor = fc.Search(null, true); IFeature pFea = pFeaCursor.NextFeature(); while (pFea != null) { //Console.WriteLine(pFea.OID + " " + fc.AliasName); bool b1 = false, b2 = false; string obj = pFea.get_Value(index).ToString(); string obj1 = pFea.get_Value(index1).ToString(); if (obj != "" && obj1 != "") { double d; if (!double.TryParse(obj1, out d)) { d = 0.0; } if (Math.Abs(double.Parse(obj) - double.Parse(obj1)) > 1) { b1 = true; } } string obj2 = pFea.get_Value(index2).ToString(); string obj3 = pFea.get_Value(index3).ToString(); /* if (obj3 != null) continue;*/ if ((obj2 != "") && (obj3 != "")) { double d; if (!double.TryParse(obj2, out d)) { d = 0.0; } if (Math.Abs(double.Parse(obj2) - double.Parse(obj3)) > 0.5) { b2 = true; } } if (b1 && b2) { DataRow dr = dt.NewRow(); dr["ErrorFeatureID"] = pFea.OID; dr["FeatureofClass"] = fc.AliasName; dr["FeatureofLayer"] = (fc as IDataset).Name; dr["FeatureClass"] = fc; if (b1 && b2) { dr["ErrorType"] = "管线起止点高程差值超出规范值;管线起止点埋深差值超出规范值"; } else if (b1 && !b2) { dr["ErrorType"] = "管线起止点高程差值超出规范值"; } else if (b2 && !b1) { dr["ErrorType"] = "管线起止点埋深差值超出规范值"; } dt.Rows.Add(dr); } pFea = pFeaCursor.NextFeature(); } if (dt.Rows.Count > 0) { dict[fc] = dt; } } WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); } }
public override void Run(object sender, EventArgs e) { IFeatureCursor pFeaCursor; IQueryFilter pFilter = new QueryFilterClass(); IFeature pFea; mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } bool bBind = mapView.Bind(this); if (!bBind) { return; } app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } m_pMapControl = app.Current2DMapControl; List <DF2DFeatureClass> list = Dictionary2DTable.Instance.GetFeatureClassByFacilityClassName("PipeNode"); if (list == null) { return; } Dictionary <IFeatureClass, DataTable> dict = new Dictionary <IFeatureClass, DataTable>(); WaitForm.Start("开始数据唯一性检查..", "请稍候"); foreach (DF2DFeatureClass dfcc in list) { IFeatureClass fc = dfcc.GetFeatureClass(); if (fc == null) { return; } WaitForm.SetCaption("正在检查图层:" + " " + fc.AliasName); FacilityClass fac = dfcc.GetFacilityClass(); if (fac == null) { continue; } List <DFDataConfig.Class.FieldInfo> listField = fac.FieldInfoCollection; DFDataConfig.Class.FieldInfo fi1 = fac.GetFieldInfoBySystemName("detectid"); if (fi1 == null) { continue; } DataTable dt = GetDataTableByStruture(); string TableName = (fc as IDataset).Name; pFilter.WhereClause = fi1.Name + " in (select " + fi1.Name + " from " + (fc as IDataset).Name + " group by " + fi1.Name + " having count(" + fi1.Name + ") > 1) order by " + fi1.Name + " asc"; pFeaCursor = fc.Search(pFilter, true); while ((pFea = pFeaCursor.NextFeature()) != null) { DataRow dr = dt.NewRow(); dr["ErrorFeatureID"] = pFea.OID; dr["FeatureofClass"] = fc.AliasName; dr["FeatureofLayer"] = (fc as IDataset).Name; dr["FeatureClass"] = fc; dr["ErrorType"] = "【物探点名】字段值重复"; dt.Rows.Add(dr); //Console.WriteLine(pFea.OID); } if (dt.Rows.Count > 0) { dict[fc] = dt; } } //if (dict.Count == 0) //{ // XtraMessageBox.Show("提示表格数据为空!"); //} WaitForm.Stop(); FormCheckResult dlg = new FormCheckResult(dict, m_pMapControl); dlg.Text = this.CommandName; dlg.Show(); }