📄 awptsdepth.java
字号:
package net.aetherial.gis.jiaotongbu.outputJTB.prepare.huafen;
import net.aetherial.gis.cutAndLink.cut.CutToSection;
import java.util.Vector;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.output.toLd.cut.RelateWPTAfterCut;
import net.aetherial.gis.jiaotongbu.input.type.Luduan;
import net.aetherial.gis.cutAndLink.zhuanghao.Zhuanghao;
import net.aetherial.gis.jiaotongbu.input.publicuse.Permanence;
/**
* <p>标题: 农村公路数据采集与核对工具</p>
*
* <p>描述: 得到航点在航迹中的深度</p>
*
* <p>版权: Copyright (c) 2006</p>
*
* <p>公司: 安徽省通途信息技术公司</p>
*
* @author 王爱国
* @version 1.0
*/
public class AWPTsDepth {
public AWPTsDepth() {
}
public static Vector getNewShunxuWpts(Vector wpts, Node track) {
Vector temp = new Vector();
Node tempNode = null;
for (int i = 0; i < wpts.size(); i++) {
tempNode = getMinDepthNode(wpts, track);
if (tempNode != null) {
temp.add(tempNode);
wpts.removeElement(tempNode);
i--;
}
}
return temp;
}
/**
* 得到最小深度的航点
*/
private static Node getMinDepthNode(Vector wpts, Node track) {
double minDis = Double.MAX_VALUE, dis;
Node temp = null, minNode = null;
for (int i = 0; i < wpts.size(); i++) {
temp = (Node) wpts.get(i);
dis = getDepth(temp, track);
if (dis < minDis) {
minDis = dis;
minNode = temp;
}
}
return minNode;
}
/**
* 得到深度
* 深度的整数是由最近的航迹点位置
* 小数是航点至最近航迹点的距离组成
*/
public static double getDepth(Node wpt, Node track) {
double minDis = Double.MAX_VALUE, dis;
NodeList nl = ItemValue.getTracksPoint(track);
int tpPos = 0;
for (int i = 0; nl != null && i < nl.getLength(); i++) {
dis = getDis(wpt, nl.item(i));
if (dis < minDis) {
minDis = dis;
tpPos = i;
}
}
return tpPos + minDis;
}
/**
* 得到深度
* 深度的整数是由最近的航迹点位置
* 小数是航点至最近航迹点的距离组成
*/
public static double getMiDepth(Node wpt, Node track) {
double minDis = Double.MAX_VALUE, dis;
NodeList nl = ItemValue.getTracksPoint(track);
int tpPos = 0;
for (int i = 0; nl != null && i < nl.getLength(); i++) {
dis = getDis(wpt, nl.item(i));
if (dis < minDis) {
minDis = dis;
tpPos = i;
}
}
return tpPos + minDis;
}
/**
* 得到航点到航迹点的距离
*/
private static double getDis(Node waypoint, Node trackpoint) {
double x_w = Double.parseDouble(ItemValue.getWaypointX(waypoint));
double y_w = Double.parseDouble(ItemValue.getWaypointY(waypoint));
double x_tp = Double.parseDouble(ItemValue.getTracksPointX(trackpoint));
double y_tp = Double.parseDouble(ItemValue.getTracksPointY(trackpoint));
return Math.sqrt( (x_w - x_tp) * (x_w - x_tp) + (y_w - y_tp) * (y_w - y_tp));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -