📄 finderrorroad.java
字号:
package net.aetherial.gis.our.auto;
import net.aetherial.gis.our.FrameOur;
import net.aetherial.gis.surface.ItemValue;
import java.io.File;
import net.aetherial.gis.dataType.GPSFile;
import org.w3c.dom.Node;
import net.aetherial.gis.surface.CreateFile;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class FindErrorRoad {
FrameOur fo = null;
String n ="";
String other = "";
private double longest =0.0;
private final double stand =1000.0;//定义一个比较标准
public FindErrorRoad() {
}
public FindErrorRoad(FrameOur fo) {
this.fo = fo;
}
public void getLongestBetweenPoint(String inputDirectory,String outputDirectory){//判断距离最长的两个点
/*
得到在航迹点中距离最远的两个航迹点所在的航迹
在inputDirectory文件夹下的所有文件都会被计算(不包括目录下面的目录)
计算结果输出到outputDirectory
*/
}
public void scanDir(String dir,String output){
File f = new File(dir);
File[] all = f.listFiles();
String fileName = "";
for(int i =0; i<all.length;i++){
fileName = GPSFile.getRidOfGPSSuffix(all[i].getName());
fo.openFile(all[i]);
this.n =this.getLongest(fileName) + this.other;
CreateFile cf = new CreateFile(new File(output + fileName+"最长计算.txt"));
cf.setEncode("UTF-8");
cf.memoryToFile(this.n);
fo.reset();
}
}
public void scanDir1(String input,String output){
File f = new File(input);
File[] all = f.listFiles();
String fileName = "";
for(int i =0; i<all.length;i++){
fileName = GPSFile.getRidOfGPSSuffix(all[i].getName());
fo.openFile(all[i]);
this.n = this.n + fileName + ":\r\n"+this.getAllLong(fileName)+"\r\n";
fo.reset();
}
this.n = this.n + this.other;
CreateFile cf = new CreateFile(new File(output + "最长计算.txt"));
cf.setEncode("UTF-8");
cf.memoryToFile(this.n);
}
private String getLongest(String fileName){
String temp ="";
int[] pos = ItemValue.getPosition("track");
double dis =0.0;
Node node = null;
if(pos==null){
return "pos == null";
}else{
for(int i =0;i<pos.length;i++){
node = ItemValue.getTracks(pos[i]);
dis = ItemValue.getLongestDistance(node);
longest = this.getlonger(dis,longest,fileName, ItemValue.getTracksName(node));
temp = temp + dis + ":"+ ItemValue.getTracksName(node) + "\r\n";
}
}
return temp;
}
private String getAllLong(String fileName){
String temp ="";
int[] pos = ItemValue.getPosition("track");
double dis =0.0;
Node node = null;
if(pos==null){
return "pos == null";
}else{
for(int i =0;i<pos.length;i++){
node = ItemValue.getTracks(pos[i]);
dis = ItemValue.getLongestDistance(node);
longest = this.getlonger(dis,longest,fileName, ItemValue.getTracksName(node));
if(dis>this.stand){
temp = temp + "(" + ItemValue.getTracksName(node) + ") 存在两点距离:"+ dis + "米\r\n";
}
}
return temp;
}
}
private double getlonger(double a,double b,String file,String node){
if(a>b){
this.other = "整个文件夹内最长为:"+file +" -> " + node +":" + a + "米";
return a;
}else{
//this.other = "整个文件夹内"+file +":" + node +":" + b + "最长";
return b;
}
}
public static void main(String[] args) {
FindErrorRoad finderrorroad = new FindErrorRoad();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -