📄 keepanddel.java
字号:
package net.aetherial.gis.jiaotongbu.outputJTB.prepare.huafen.luwang;
import java.util.*;
import java.io.File;
import org.w3c.dom.Node;
import net.aetherial.gis.surface.ItemValue;
/**
* <p>标题: 农村公路数据采集与核对工具</p>
*
* <p>描述: </p>
*
* <p>版权: Copyright (c) 2006</p>
*
* <p>公司: 安徽省通途信息技术公司</p>
*
* @author 王爱国
* @version 1.0
*/
public class KeepAndDel {
private Vector primalTracks = new Vector();
private Vector primalWaypoints = new Vector();
private Hashtable jiaochas = new Hashtable();
public KeepAndDel() {
}
/**
* 设置应被保留的航迹和航点
* 将交叉点的hashtable初始化。
*/
public void keepPrimal() {
Node[] trks = ItemValue.getTracks();
Vector jiaochs = null;
for (int i = 0; trks != null && i < trks.length; i++) {
this.primalTracks.add(trks[i]);
jiaochs = new Vector();
this.jiaochas.put(trks[i], jiaochs);
}
Node[] wpts = ItemValue.getWaypoint();
for (int i = 0; wpts != null && i < wpts.length; i++) {
this.primalWaypoints.add(wpts[i]);
}
}
/**
* 删除其余航迹和航点
*/
public void deleteOthers() {
Node[] trks = ItemValue.getTracks();
for (int i = 0; trks != null && i < trks.length; i++) {
if (!this.isInPrimal(trks[i])) {
ItemValue.removeTrack(trks[i]);
}
}
Node[] wpts = ItemValue.getWaypoint();
for (int i = 0; wpts != null && i < wpts.length; i++) {
if (!this.isInPrimal(wpts[i])) {
ItemValue.removeTrack(wpts[i]);
}
}
this.printPrimal();
}
/**
* 得到原航迹
*/
public Node[] getPrimalTracks() {
Node[] tempTrks = new Node[primalTracks.size()];
primalTracks.copyInto(tempTrks);
return tempTrks;
}
void printPrimal(){
for (int i = 0; i < this.primalTracks.size(); i++) {
System.out.println(" primaltrack[" +i +"]:" + ItemValue.getTracksName((Node)this.primalTracks.get(i)));
}
Node[] all = ItemValue.getTracks();
for (int i = 0; all != null && i < all.length; i++) {
System.out.println(" ALltrack[" +i +"]:" + ItemValue.getTracksName(all[i]));
}
}
/**
* 得到其他的航迹
*/
public Node[] getOtherTracks() {
Node[] trks = ItemValue.getTracks();
Vector temp = new Vector();
for (int i = 0; trks != null && i < trks.length; i++) {
if (!this.isInPrimal(trks[i])) {
temp.add(trks[i]);
}
}
Node[] tempTrks = new Node[temp.size()];
temp.copyInto(tempTrks);
return tempTrks;
}
/**
* 添加交叉点
*/
public void addJiaochaWaypoint(Node waypoint, Node prmalTrack) {
Vector jiaochs = null;
Enumeration keys = this.jiaochas.keys();
Node key = null;
while (keys.hasMoreElements()) {
key = (Node) keys.nextElement();
if (key == prmalTrack) {
jiaochs = (Vector)this.jiaochas.get(key);
jiaochs.add(waypoint);
break;
}
}
this.primalWaypoints.add(waypoint);
}
/**
* 是否在该保留的节点范围内
*/
private boolean isInPrimal(Node node) {
Node temp = null;
for (int i = 0; i < this.primalTracks.size(); i++) {
temp = (Node)this.primalTracks.get(i);
if (temp == node) {
return true;
}
}
for (int i = 0; i < this.primalWaypoints.size(); i++) {
temp = (Node)this.primalWaypoints.get(i);
if (temp == node) {
return true;
}
}
return false;
}
public Hashtable getJiaochas() {
return jiaochas;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -