📄 allcheckfunction.java
字号:
package net.aetherial.gis.our.auto.check;
import net.aetherial.gis.our.auto.Frame.CheckItem;
import net.aetherial.gis.our.FrameOur;
import net.aetherial.gis.our.auto.Frame.FrameAllCheck;
import net.aetherial.gis.surface.DialogProgress;
import net.aetherial.gis.our.auto.check.repeatwpt.RepeatEntirely;
import java.io.File;
import net.aetherial.gis.surface.CreateFile;
import java.util.Vector;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.our.auto.check.repeatwpt.SameName;
import net.aetherial.gis.our.auto.check.Integritywpt.NoData;
import net.aetherial.gis.our.auto.check.Integritywpt.NotCompleletly;
import net.aetherial.gis.our.auto.check.Integritywpt.NodeRelativeTrk;
import net.aetherial.gis.our.auto.check.Integritywpt.WptXZCNoComp;
import net.aetherial.gis.our.auto.check.Integritytrk.Less2PointTrack;
import net.aetherial.gis.our.auto.check.Integritytrk.TrkNoComp;
import net.aetherial.gis.our.auto.check.Integritytrk.TrkNotInFile;
import net.aetherial.gis.our.auto.check.Integritytrk.TrkNoWpt;
import net.aetherial.gis.our.auto.check.Integritytrk.TrkPlanComp;
import net.aetherial.gis.our.auto.check.Integritytrk.TrkPrimal;
import net.aetherial.gis.our.auto.check.repeattrk.CheckRepeat;
import javax.swing.JOptionPane;
import net.aetherial.gis.our.auto.check.Integritywpt.WptSoFar;
/**
* <p>Title: </p>
*
* <p>Description:所有的检查功能集中在一起 </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class AllCheckFunction {
CheckItem item = null;
FrameOur fo = null;
FrameAllCheck fac = null;
DialogProgress dp = new DialogProgress();
String n = "";
String check_N1 = "", check_N2 = "", check_N3 = "", check_N4 = "", check_N5 = "",
check_N6 = "", check_N7 = "", check_N8 = "", check_N9 = "", check_N10 = "",
check_N11 = "", check_N12 = "", check_N13 = "", check_N14 = "";
private String InputPath = "", OutputPath = "";
private boolean yunxing_fenkai = true, yunxing_hebing = false;
public File[] input = null;
private RepeatEntirely check1_re = new RepeatEntirely();
private SameName check2_sn = new SameName();
private NoData check3_nd = new NoData();
private NotCompleletly check4_nc = new NotCompleletly();
private NodeRelativeTrk check5_nr = new NodeRelativeTrk();
private WptXZCNoComp check6_wc = new WptXZCNoComp();
private Less2PointTrack check7_lt = new Less2PointTrack();
private TrkNoComp check8_tc = new TrkNoComp();
private TrkNotInFile check9_tf = new TrkNotInFile();
private TrkNoWpt check10_tnw = new TrkNoWpt();
private TrkPlanComp check11_tpc = new TrkPlanComp();
private CheckRepeat check12_cp = new CheckRepeat();
private TrkPrimal check13_tp = new TrkPrimal();
private WptSoFar check14_wsf = new WptSoFar();
public AllCheckFunction(CheckItem item,FrameOur fo,FrameAllCheck fac) {
this.item = item;
this.fo = fo;
this.fac = fac;
}
/**
* 设置输入输出路径
*/
public void setPath(String InputPath,String OutputPath){
this.InputPath = InputPath;
this.OutputPath = OutputPath;
this.input =this.getInputDirectoryFiles(this.InputPath);
}
/**
* 设置分文件运行和合并所有文件运行
*/
public void setYunxing_Type(boolean yunxing_fenkai,boolean yunxing_hebing){
this.yunxing_fenkai = yunxing_fenkai;
this.yunxing_hebing = yunxing_hebing;
}
/**
* 设置状态条的显示文字
*/
private void setDpShow(String content){
this.dp.setTitle("检查数据");
this.dp.jLabel1.setText("检查数据");
this.dp.jTextField1.setText(content);
}
/**
* 得到目录下的文件
*/
private File[] getInputDirectoryFiles(String inputDirectory){
File f = new File(inputDirectory);
File[] Temp = f.listFiles();
File[] temp2 = null;
Vector ve = new Vector();
for(int i = 0;i<Temp.length;i++){
if(Temp[i].isFile()){
ve.add(Temp[i]);
}
}
temp2 = new File[ve.size()];
for(int i = 0;i<temp2.length;i++){
temp2[i] = (File)ve.elementAt(i);
}
return temp2;
}
/**
* 运行程序
*/
public void check_Start(){
this.n = "\"监测项目\",\"标准\",\"等级\",\"操作建议\",\"输出格式\"\r\n"+n;
this.dp.show();
if (this.yunxing_fenkai) {
this.run_FenKai();
}
if (this.yunxing_hebing) {
this.run_HeBing();
}
/**
*生成文件
*/
this.addTitle();
String logName = this.OutputPath +"check_" +ItemValue.getDayTimeNumber() + ".csv";
this.createLog(logName,this.n);
this.resetAll();
this.dp.hide();
this.msg("数据检查完毕,生成的文件为\r\n" + logName);
}
/**
* 分开运行
*/
private void run_FenKai(){
if (this.input != null) {
for (int i = 0; i < this.input.length; i++) {
ItemValue.encrypt = true;
ItemValue.fileName = this.input[i].getName();
this.fo.openFile(this.input[i]);
this.checkByOrder();
this.fo.reset();
}
}
}
/**
* 合并运行
*/
private void run_HeBing() {
if (this.input != null) {
for (int i = 0; i < this.input.length; i++) {
ItemValue.encrypt = true;
ItemValue.fileName = "合并之后的文件";
this.fo.openFile(this.input[i]);
}
this.checkByOrder();
this.fo.reset();
}
}
/**
* 按顺序检查项目
*/
private void checkByOrder(){
if (this.item.isCheckItem1_selected()) {
this.setDpShow("检查重复航点(名称、属性、坐标相同)");
check1_re.checkAll();
this.check_N1 = check_N1 + check1_re.getN();
check1_re.reset();
}
if (this.item.isCheckItem2_selected()) {
this.setDpShow("检查重复航点(名称相同、属性为行政村、自然村、学校)");
check2_sn.checkAll();
this.check_N2 = check_N2 + check2_sn.getN();
check2_sn.reset();
}
if (this.item.isCheckItem3_selected()) {
this.setDpShow("航点信息完整性(名称、经、纬度、高程未填写或无数据)");
check3_nd.checkAll();
this.check_N3 = check_N3 + check3_nd.getN();
check3_nd.reset();
}
if (this.item.isCheckItem4_selected()) {
this.setDpShow("航点信息完整性(名称为原始编号、关键点和道路变化属性均未填写)");
this.check4_nc.checkAll();
this.check_N4 = check_N4 + check4_nc.getN();
check4_nc.reset();
}
if (this.item.isCheckItem5_selected()) {
this.setDpShow("航点信息完整性(未关联航迹)");
this.check5_nr.checkAll();
this.check_N5 = check_N5 + check5_nr.getN();
check5_nr.reset();
}
if (this.item.isCheckItem6_selected()) {
this.setDpShow("关键点信息完整性(行政村未选择,桥梁、隧道、渡口属性未填写)");
this.check6_wc.checkAll();
this.check_N6 = check_N6 + check6_wc.getN();
check6_wc.reset();
}
if (this.item.isCheckItem7_selected()) {
this.setDpShow("航迹信息完整性(航迹点数量小于2)");
this.check7_lt.checkAll();
this.check_N7 = check_N7 + check7_lt.getN();
check7_lt.reset();
}
if (this.item.isCheckItem8_selected()) {
this.setDpShow(
"航迹信息完整性(所在市县(乡村道要检查所在乡镇),名称,编号,行政等级,路面类型,路基、路面宽度,技术标准,路面结构,路面现状,始建完工日期,建设类型)");
this.check8_tc.checkAll();
this.check_N8 = check_N8 + check8_tc.getN();
check8_tc.reset();
}
if (this.item.isCheckItem9_selected()) {
this.setDpShow("航迹信息一致性(乡镇数据文件内道路所在地不一致)");
this.check9_tf.checkAll();
this.check_N9 = check_N9 + check9_tf.getN();
check9_tf.reset();
}
if (this.item.isCheckItem10_selected()) {
this.setDpShow("航迹信息一致性(航迹未关联行点或关联航点小于2)");
this.check10_tnw.checkAll();
this.check_N10 = check_N10 + check10_tnw.getN();
check10_tnw.reset();
}
if (this.item.isCheckItem11_selected()) {
this.setDpShow(
"航迹拟建计划信息完整性(建设里程,投资额,开工、完工年,路面、路基宽度,路面类型,相邻干线编号和距离未填写或填写不完整)");
this.check11_tpc.checkAll();
this.check_N11 = check_N11 + check11_tpc.getN();
check11_tpc.reset();
}
if (this.item.isCheckItem12_selected()) {
this.setDpShow("重复航迹(全部或部分路段距离小于3米)");
this.check12_cp.runOverAllTrk();
this.check12_cp.compareTrack();
this.check_N12 = check_N12 + this.check12_cp.getLog();
this.check12_cp.resetN();
}
if (this.item.isCheckItem13_selected()) {
this.setDpShow("多余信息监测(有名称未原始编号状态的航迹和active-log)");
this.check13_tp.checkAll();
this.check_N13 = check_N13 + check13_tp.getN();
check13_tp.reset();
}
if (this.item.isCheckItem14_selected()) {
this.setDpShow("航点与关联的航迹距离太远");
this.check14_wsf.checkAll();;
this.check_N14 = check_N14 + check14_wsf.getN();
check14_wsf.reset();
}
}
private void addTitle(){
String temp = "";
temp = this.check_N1.trim();
if (!(temp.equals(""))) {
this.check_N1 = "\"重复航点\",\"名称、属性、坐标相同\",\"高\",\"删除\",\"<文件名称〉-> 有<数量>个完全相同的<航点名称>\"\r\n" + check_N1;
temp ="";
}
temp = this.check_N2.trim();
if (!(temp.equals(""))) {
this.check_N2 = "\"重复航点\",\"名称相同、属性为行政村、自然村、学校\",\"高\",\"检查\",\"<文件名称〉-> 有<数量>个同名的<航点名称>\"\r\n" + check_N2;
temp = "";
}
temp = this.check_N3.trim();
if (!(temp.equals(""))) {
this.check_N3 = "\"航点信息完整性\",\"名称、经、纬度、高程未填写或无数据\",\"高\",\"删除\",\"<文件名称〉-> 包含不完整的航点信息\"\r\n" + check_N3;
temp = "";
}
temp = this.check_N4.trim();
if (!(temp.equals(""))) {
this.check_N4 = "\"航点信息完整性\",\"名称为原始编号、关键点和道路变化属性均未填写\",\"高\",\"检查\",\"<文件名称〉-> 航点<名称>信息不完整\"\r\n" + check_N4;
temp = "";
}
temp = this.check_N5.trim();
if (!(temp.equals(""))) {
this.check_N5 = "\"航点信息完整性\",\"未关联航迹\",\"高\",\"检查\",\"<文件名称〉-> 航点<名称>未关联到航迹\"\r\n" + check_N5;
temp = "";
}
temp = this.check_N6.trim();
if (!(temp.equals(""))) {
this.check_N6 = "\"关键点信息完整性\",\"行政村未选择,桥梁、隧道、渡口属性填写不完整\",\"中\",\"检查\",\"<文件名> <市><县><乡镇> 未填写相关信息\"\r\n" + check_N6;
temp = "";
}
temp = this.check_N7.trim();
if (!(temp.equals(""))) {
this.check_N7 = "\"航迹信息完整性\",\"航迹点数量小于2\",\"高\",\"删除\",\"<文件名称〉中包含一条只有一个航迹点的航迹\"\r\n" + check_N7;
temp = "";
}
temp = this.check_N8.trim();
if (!(temp.equals(""))) {
this.check_N8 = "\"航迹信息完整性\",\"所在市县(乡村道要检查所在乡镇),名称,编号,行政等级,路面类型,路基、路面宽度,技术标准,路面结构,路面现状,始建完工日期,建设类型\",\"高\",\"检查\",\"<文件名> <市><县><乡镇> <路名〉未填写 <信息项1〉… <信息项n〉\"\r\n" + check_N8;
temp = "";
}
temp = this.check_N9.trim();
if (!(temp.equals(""))) {
this.check_N9 = "\"航迹信息一致性\",\"乡镇数据文件内道路所在地不一致\",\"高\",\"删除\",\"<文件名> <市><县><乡镇> <路名〉所在地与文件内其它道路不一致\"\r\n" + check_N9;
temp = "";
}
temp = this.check_N10.trim();
if (!(temp.equals(""))) {
this.check_N10= "\"航迹信息一致性\",\"航迹未关联行点或关联航点小于2\",\"中\",\"检查\",\"<文件名> <市><县><乡镇> <路名〉关联航点过少\"\r\n" + check_N10;
temp = "";
}
temp = this.check_N11.trim();
if (!(temp.equals(""))) {
this.check_N11 = "\"航迹拟建计划信息完整性\",\"建设里程,投资额,开工、完工年,路面、路基宽度,路面类型,相邻干线编号和距离未填写或填写不完整\",\"中\",\"检查\",\"<文件名> <市><县><乡镇> <路名〉未填写拟建计划\"\r\n" + check_N11;
temp = "";
}
temp = this.check_N12.trim();
if (!(temp.equals(""))) {
this.check_N12 = "\"重复航迹\",\"全部或部分路段距离小于3米\",\"高\",\"检查\",\"<市><县><乡镇> <路名1〉<起始航迹点编号〉至 <结束航迹点编号〉与 <路名2> 重合\"\r\n" + check_N12;
temp = "";
}
temp = this.check_N13.trim();
if (!(temp.equals(""))) {
this.check_N13 = "\"多余信息监测\",\"有名称未原始编号状态的航迹和active-log\",\"中\",\"检查\",\"<文件名称〉包含原始数据信息<航点名称〉<航迹名称>\"\r\n" + check_N13;
temp = "";
}
temp = this.check_N14.trim();
if (!(temp.equals(""))) {
this.check_N14 = "\"航点属性检测\",\"航点与关联的航迹距离太远\",\"中\",\"检查\",\"<文件名称〉包含原始数据信息<航点名称〉<航迹名称>\"\r\n" + check_N14;
temp = "";
}
this.n = n + this.check_N1 + this.check_N2 + this.check_N3 + this.check_N4 +
this.check_N5 + this.check_N6 + this.check_N14 + this.check_N7 + this.check_N8 +
this.check_N9 + this.check_N10 + this.check_N11 + this.check_N12 +
this.check_N13;
}
/**
* 清空记录的文本
*/
private void resetAll(){
this.n = "";
this.check_N1 = "";
this.check_N2 = "";
this.check_N3 = "";
this.check_N4 = "";
this.check_N5 = "";
this.check_N6 = "";
this.check_N7 = "";
this.check_N8 = "";
this.check_N9 = "";
this.check_N10 = "";
this.check_N11 = "";
this.check_N12 = "";
this.check_N13 = "";
this.check_N14 = "";
}
/**
* 生成文件
*/
private void createLog(String logFile, String str) {
CreateFile cf = new CreateFile(new File(logFile));
cf.setEncode("GB2312");
cf.memoryToFile(str);
}
/**
* 提示完毕
*/
public void msg(String message){
JOptionPane.showMessageDialog(this.fac, message,
"GPS Information",
JOptionPane.INFORMATION_MESSAGE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -