public void OnDataCheck() { Exception eError = null; if (Hook == null) { return; } IArcgisDataCheckParaSet dataCheckParaSet = Hook.DataCheckParaSet as IArcgisDataCheckParaSet; if (dataCheckParaSet == null) { return; } if (dataCheckParaSet.Workspace == null) { return; } //实现代码 SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.DbConn = dataCheckParaSet.DbConnPara; pSysTable.DBConType = SysCommon.enumDBConType.OLEDB; pSysTable.DBType = SysCommon.enumDBType.ACCESS; //获取所有数据集 SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace); List <string> featureDatasetNames = sysGisDataSet.GetAllFeatureDatasetNames(); if (featureDatasetNames.Count == 0) { return; } //设置进度条 ProgressChangeEvent eInfo = new ProgressChangeEvent(); eInfo.Max = featureDatasetNames.Count; int pValue = 0; //遍历数据集,并进行检查 foreach (string name in featureDatasetNames) { IFeatureDataset featureDataset = sysGisDataSet.GetFeatureDataset(name, out eError); if (eError != null) { continue; } //线线重合检查,参数为45 DataTable mTable = TopologyCheckClass.GetParaValueTable(featureDataset, pSysTable, 45, out eError); if (eError != null) { //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); return; } if (mTable.Rows.Count == 0) { continue; } AreaTopoCheck2(Hook, featureDataset, mTable, esriTopologyRuleType.esriTRTLineCoveredByLineClass, out eError); if (eError != null) { eError = new Exception("线线重合检查失败!" + eError.Message); return; } //进度条加1 pValue++; eInfo.Value = pValue; GeoDataChecker.GeoDataChecker_ProgressShow((object)GeoDataChecker._ProgressBarInner, eInfo); } }
public override void OnClick() { //FrmMathematicsCheck mFrmMathematicsCheck = new FrmMathematicsCheck(_AppHk, enumErrorType.线长度逻辑性); //mFrmMathematicsCheck.ShowDialog(); Exception eError = null; FrmLineLengthCheck pFrmLineLengthCheck = new FrmLineLengthCheck(); if (pFrmLineLengthCheck.ShowDialog() == DialogResult.OK) { #region 错误日志保存 //错误日志连接信息 string logPath = TopologyCheckClass.GeoLogPath + "Log" + System.DateTime.Today.Year.ToString() + System.DateTime.Today.Month.ToString() + System.DateTime.Today.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString() + ".xls";; if (File.Exists(logPath)) { if (SysCommon.Error.ErrorHandle.ShowFrmInformation("是", "否", "日志文件\n'" + logPath + "'\n已经存在,是否替换?")) { File.Delete(logPath); } else { return; } } //生成日志信息EXCEL格式 SysCommon.DataBase.SysDataBase pSysLog = new SysCommon.DataBase.SysDataBase(); pSysLog.SetDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + logPath + "; Extended Properties=Excel 8.0;", SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "日志信息表连接失败!"); return; } string strCreateTableSQL = @" CREATE TABLE "; strCreateTableSQL += @" 错误日志 "; strCreateTableSQL += @" ( "; strCreateTableSQL += @" 检查功能名 VARCHAR, "; strCreateTableSQL += @" 错误类型 VARCHAR, "; strCreateTableSQL += @" 错误描述 VARCHAR, "; strCreateTableSQL += @" 数据图层1 VARCHAR, "; strCreateTableSQL += @" 数据OID1 VARCHAR, "; strCreateTableSQL += @" 数据图层2 VARCHAR, "; strCreateTableSQL += @" 数据OID2 VARCHAR, "; strCreateTableSQL += @" 定位点X VARCHAR , "; strCreateTableSQL += @" 定位点Y VARCHAR , "; strCreateTableSQL += @" 检查时间 VARCHAR ,"; strCreateTableSQL += @" 数据文件路径 VARCHAR "; strCreateTableSQL += @" ) "; pSysLog.UpdateTable(strCreateTableSQL, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "插入表头出错!"); pSysLog.CloseDbConnection(); return; } DataCheckClass dataCheckCls = new DataCheckClass(_AppHk); //将日志表连接信息和表名保存起来 dataCheckCls.ErrDbCon = pSysLog.DbConn; dataCheckCls.ErrTableName = "错误日志"; #endregion #region 获得要检查的IFeatureClass的集合 //将Mapcontrol上所有的图层名保存起来 List <IFeatureClass> LstFeaClass = new List <IFeatureClass>(); for (int i = 0; i < _AppHk.MapControl.LayerCount; i++) { ILayer player = _AppHk.MapControl.get_Layer(i); if (player is IGroupLayer) { ICompositeLayer pComLayer = player as ICompositeLayer; for (int j = 0; j < pComLayer.Count; j++) { ILayer mLayer = pComLayer.get_Layer(j); IFeatureLayer mfeatureLayer = mLayer as IFeatureLayer; if (mfeatureLayer == null) { continue; } IFeatureClass pfeaCls = mfeatureLayer.FeatureClass; if (!LstFeaClass.Contains(pfeaCls)) { LstFeaClass.Add(pfeaCls); } } } else { IFeatureLayer pfeatureLayer = player as IFeatureLayer; if (pfeatureLayer == null) { continue; } IFeatureClass mFeaCls = pfeatureLayer.FeatureClass; if (!LstFeaClass.Contains(mFeaCls)) { LstFeaClass.Add(mFeaCls); } } } #endregion try { SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable(); string conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + TopologyCheckClass.GeoDataCheckParaPath; pSysTable.SetDbConnection(conStr, SysCommon.enumDBConType.OLEDB, SysCommon.enumDBType.ACCESS, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "GIS数据检查配置表连接失败!"); pSysLog.CloseDbConnection(); return; } //分类代码字段名 string codeName = TopologyCheckClass.GetCodeName(pSysTable, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); pSysLog.CloseDbConnection(); pSysTable.CloseDbConnection(); return; } DataTable mTable = TopologyCheckClass.GetParaValueTable(pSysTable, 3, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); pSysLog.CloseDbConnection(); pSysTable.CloseDbConnection(); return; } if (mTable.Rows.Count == 0) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未进行线长度检查配置!"); pSysLog.CloseDbConnection(); pSysTable.CloseDbConnection(); return; } //执行线长度逻辑性检查 double pmax = pFrmLineLengthCheck.MaxValue; double pmin = pFrmLineLengthCheck.MinValue; LineLogicCheck(dataCheckCls, LstFeaClass, mTable, codeName, pmin.ToString(), pmax.ToString(), out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "线长度逻辑性检查失败。" + eError.Message); pSysLog.CloseDbConnection(); pSysTable.CloseDbConnection(); return; } SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "数据检查完成!"); pSysLog.CloseDbConnection(); pSysTable.CloseDbConnection(); //隐藏进度条 dataCheckCls.ShowProgressBar(false); } catch (Exception ex) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message); pSysLog.CloseDbConnection(); return; } } }
public void OnDataCheck() { Exception eError = null; if (Hook == null) { return; } IArcgisDataCheckParaSet dataCheckParaSet = Hook.DataCheckParaSet as IArcgisDataCheckParaSet; if (dataCheckParaSet == null) { return; } if (dataCheckParaSet.Workspace == null) { return; } //实现代码 SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.DbConn = dataCheckParaSet.DbConnPara; pSysTable.DBConType = SysCommon.enumDBConType.OLEDB; pSysTable.DBType = SysCommon.enumDBType.ACCESS; //获取所有数据集 SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace); List <string> featureDatasetNames = sysGisDataSet.GetAllFeatureDatasetNames(); if (featureDatasetNames.Count == 0) { return; } foreach (string name in featureDatasetNames) { IFeatureDataset featureDataset = sysGisDataSet.GetFeatureDataset(name, out eError); if (eError != null) { continue; } //线穿面检查,参数ID为17 DataTable mTable = TopologyCheckClass.GetParaValueTable(featureDataset, pSysTable, 17, out eError); if (eError != null) { //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); return; } if (mTable.Rows.Count == 0) { continue; } LineCrossAreaCheck(Hook, featureDataset, mTable, out eError); if (eError != null) { eError = new Exception("线穿面检查失败!" + eError.Message); return; } } }
public void OnDataCheck() { Exception eError = null; if (Hook == null) { return; } IArcgisDataCheckParaSet dataCheckParaSet = Hook.DataCheckParaSet as IArcgisDataCheckParaSet; if (dataCheckParaSet == null) { return; } if (dataCheckParaSet.Workspace == null) { return; } //实现代码 SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.DbConn = dataCheckParaSet.DbConnPara; pSysTable.DBConType = SysCommon.enumDBConType.OLEDB; pSysTable.DBType = SysCommon.enumDBType.ACCESS; //分类代码字段名 string codeName = TopologyCheckClass.GetCodeName(pSysTable, out eError); if (eError != null) { //eError=new Exception(eError.Message); return; } //等高线注记检查,参数ID为31 DataTable mTable = TopologyCheckClass.GetParaValueTable(pSysTable, 31, out eError); if (eError != null) { //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); return; } if (mTable.Rows.Count == 0) { //eError = new Exception("未进行等高线注记一致性检查参数配置!"); return; } //等高线注记检查搜索半径,参数ID为34 string paraValue3 = TopologyCheckClass.GetParaValue(pSysTable, 34, out eError); if (eError != null) { eError = new Exception("读取数据减配置表失败。" + eError.Message); return; } double serchRadiu3 = Convert.ToDouble(paraValue3); //等高线注记检查精度控制,参数ID为37 paraValue3 = TopologyCheckClass.GetParaValue(pSysTable, 37, out eError); if (eError != null) { eError = new Exception("读取数据减配置表失败。" + eError.Message); return; } long precision3 = Convert.ToInt64(paraValue3); SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace); List <IDataset> LstFeaClass = sysGisDataSet.GetAllFeatureClass(); if (LstFeaClass.Count == 0) { return; } //执行等高线注记检查 PointAnnoCheck(Hook, LstFeaClass, mTable, codeName, serchRadiu3, precision3, out eError); if (eError != null) { eError = new Exception("等高线注记检查失败。" + eError.Message); return; } #region 分类代码字段名 //string codeName = TopologyCheckClass.GetCodeName(pSysTable, out eError); //if (eError != null) //{ // //eError=new Exception(eError.Message); // return; //} ////获取所有数据集 //SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace); //List<string> featureDatasetNames = sysGisDataSet.GetAllFeatureDatasetNames(); //if (featureDatasetNames.Count == 0) return; //foreach (string name in featureDatasetNames) //{ // IFeatureDataset featureDataset = sysGisDataSet.GetFeatureDataset(name, out eError); // if (eError != null) continue; // //等高线注记检查,参数ID为31 // DataTable mTable = TopologyCheckClass.GetParaValueTable(featureDataset, pSysTable, 31, out eError); // if (eError != null) // { // //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); // return; // } // if (mTable.Rows.Count == 0) // { // continue; // } // //等高线注记检查搜索半径,参数ID为34 // string paraValue3 = TopologyCheckClass.GetParaValue(pSysTable, 34, out eError); // if (eError != null) // { // eError = new Exception("读取数据减配置表失败。" + eError.Message); // return; // } // double serchRadiu3 = Convert.ToDouble(paraValue3); // //等高线注记检查精度控制,参数ID为37 // paraValue3 = TopologyCheckClass.GetParaValue(pSysTable, 37, out eError); // if (eError != null) // { // eError = new Exception("读取数据减配置表失败。" + eError.Message); // return; // } // long precision3 = Convert.ToInt64(paraValue3); // //执行等高线注记检查 // PointAnnoCheck(Hook, featureDataset, mTable, codeName, serchRadiu3, precision3, out eError); // if (eError != null) // { // eError = new Exception("等高线注记检查失败。" + eError.Message); // return; // } //} #endregion }
public void OnDataCheck() { Exception eError = null; if (Hook == null) { return; } IArcgisDataCheckParaSet dataCheckParaSet = Hook.DataCheckParaSet as IArcgisDataCheckParaSet; if (dataCheckParaSet == null) { return; } if (dataCheckParaSet.Workspace == null) { return; } string path = dataCheckParaSet.Workspace.PathName; //实现代码 SysCommon.DataBase.SysTable pSysTable = new SysCommon.DataBase.SysTable(); pSysTable.DbConn = dataCheckParaSet.DbConnPara; pSysTable.DBConType = SysCommon.enumDBConType.OLEDB; pSysTable.DBType = SysCommon.enumDBType.ACCESS; DataTable mTable = TopologyCheckClass.GetParaValueTable(pSysTable, 2, out eError); if (eError != null) { //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); return; } if (mTable.Rows.Count == 0) { //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未进行空值检查配置!"); return; } SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace); List <IDataset> LstFeaClass = sysGisDataSet.GetAllFeatureClass(); if (LstFeaClass.Count == 0) { return; } //执行空值检查 IsNullCheck(Hook, LstFeaClass, mTable, path, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "空值检查失败。" + eError.Message); return; } #region ////获取所有数据集 //SysCommon.Gis.SysGisDataSet sysGisDataSet = new SysCommon.Gis.SysGisDataSet(dataCheckParaSet.Workspace); //List<string> featureDatasetNames = sysGisDataSet.GetAllFeatureDatasetNames(); //if (featureDatasetNames.Count == 0) return; //foreach (string name in featureDatasetNames) //{ // IFeatureDataset featureDataset = sysGisDataSet.GetFeatureDataset(name, out eError); // if (eError != null) continue; // //空值检查参数ID为2 // DataTable mTable = TopologyCheckClass.GetParaValueTable(featureDataset, pSysTable, 2, out eError); // if (eError != null) // { // //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); // return; // } // if (mTable.Rows.Count == 0) // { // continue; // } // //执行空值检查 // IsNullCheck(Hook, featureDataset, mTable, out eError); // if (eError != null) // { // eError=new Exception("空值检查失败。" + eError.Message); // return; // } //} #endregion }