📄 newbjtrack.java
字号:
package net.aetherial.gis.jiaotongbu.outputJTB.txtOutput.module.gpsdata.lxld.ld.
ldhf.bianjie;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import net.aetherial.gis.surface.ItemValue;
import java.util.*;
import net.aetherial.gis.jiaotongbu.outputJTB.txtOutput.module.gpsdata.lxld.ld.ldhf.TrackToLD;
import net.aetherial.gis.jiaotongbu.outputJTB.txtOutput.module.colligate.xzjj.XZJJData;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class NewBJTrack {
public NewBJTrack() {
}
/**
* 用给定的XZJJData[]产生新的航迹
*/
public void createNewTrack(XZJJData[] jj){
if (jj == null) {
return;
}
String nearTrk = null;
Node nearTp = null;
for (int i = 0; i < jj.length; i++) {
nearTrk = jj[i].getNearstTracks();
nearTp = this.getNearstTP(nearTrk,Double.parseDouble(jj[i].getColumnLongitude()),Double.parseDouble(jj[i].getColumnLatitude()));
// TrackToLD.cutByTrackPoint(nearTrk,nearTp);
}
}
/**
* 得到最近的航迹点
*/
private Node getNearstTP(String trk,double longitude,double latitude){
if (trk == null) {
return null;
}
Node tp = null;
Vector nodes = (Vector) ItemValue.namedTracks.get(trk);
double dis = 9999999d;
for(int n=0 ; nodes != null && n < nodes.size(); n++){
Node node = (Node) nodes.get(n);
NodeList nl = ItemValue.getTracksPoint(node);
double minDis = 1000.0;
for (int i = 0; i < nl.getLength(); i++) {
minDis = this.getDisOfTP(nl.item(i), longitude, latitude);
if(minDis < dis){
dis = minDis;
tp = nl.item(i);
}
}
}
return tp;
}
/**
* 得到给定的坐标与航迹点的距离
*/
private double getDisOfTP(Node tp,double lon,double lat){
double tpx = Double.parseDouble(ItemValue.getTracksPointX(tp));
double tpy = Double.parseDouble(ItemValue.getTracksPointY(tp));
return Math.pow((tpx - lon) * (tpx - lon) + (tpy - lat) * (tpy - lat),0.5);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -