📄 lwhuafen.java
字号:
package net.aetherial.gis.jiaotongbu.outputJTB.prepare.huafen.luwang;
import org.w3c.dom.Node;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
import net.aetherial.gis.surface.ItemValue;
import org.w3c.dom.NodeList;
import net.aetherial.gis.our.FrameOur;
import net.aetherial.gis.garmin.GarminGMLDoc;
import org.w3c.dom.Element;
import java.io.File;
import net.aetherial.gis.output.toLd.OpenDirectory;
import net.aetherial.gis.jiaotongbu.input.publicuse.ReFangxiang;
import net.aetherial.gis.jiaotongbu.input.jxl.ReadFangxiang;
import net.aetherial.gis.publicuse.track.ConcatenatedTrack;
import net.aetherial.gis.publicuse.track.TrackDecussate;
import net.aetherial.gis.our.auto.check.repeattrk.TrackRectangle;
import net.aetherial.gis.publicuse.track.CutByAppointWPT;
import net.aetherial.gis.jiaotongbu.outputJTB.prepare.huafen.AWPTsDepth;
/**
* <p>标题: 农村公路数据采集与核对工具</p>
*
* <p>描述: 路网划分</p>
*
* <p>版权: Copyright (c) 2006</p>
*
* <p>公司: 安徽省通途信息技术公司</p>
*
* @author 王爱国
* @version 1.0
*/
public class LWHuafen {
private FrameOur fo = null;
private KeepAndDel keep = new KeepAndDel();
private OpenDirectory od = new OpenDirectory();
private File currentFile = null;
public LWHuafen(File gpsFile) {
this.currentFile = gpsFile;
}
public void huafen() {
File[] more = od.get_GradeMore_NumberLess_File(this.currentFile);
this.fo.openFile(this.currentFile);
keep.keepPrimal();
for (int i = 0; more != null && i < more.length; i++) {
this.compareToFile(more[i]);
}
this.cutByAppointNodes();
}
/**
* 与其他文件比较
*/
public void compareToFile(File beCompareFile) {
this.fo.openFile(beCompareFile);
Node[] otherTracks = keep.getOtherTracks();
Node[] primalTracks = keep.getPrimalTracks();
Node tempWaypoint = null;
for (int i = 0; i < primalTracks.length; i++) {
for (int j = 0; j < otherTracks.length; j++) {
if (this.isTracksJiaocha(primalTracks[i], otherTracks[j])) {
tempWaypoint = this.getJiachaTP(primalTracks[i], otherTracks[j]);
if (tempWaypoint != null) {
tempWaypoint = ItemValue.turnTracksPointToWaypoint(tempWaypoint);
ItemValue.setWaypointName(tempWaypoint,
ItemValue.getTracksNumber(otherTracks[j]));
this.keep.addJiaochaWaypoint(tempWaypoint, primalTracks[i]);
}
}
}
}
keep.deleteOthers();
}
/**
* 与keep中得到的航点作划分
*/
private void cutByAppointNodes() {
CutByAppointWPT cut = null;
Hashtable ht = this.keep.getJiaochas();
Enumeration keys = ht.keys();
Node key = null;
Vector jiaochNodes = null;
while (keys.hasMoreElements()) {
key = (Node) keys.nextElement();
jiaochNodes = (Vector) ht.get(key);
if (jiaochNodes.size() > 0) {
cut = new CutByAppointWPT();
cut.setBeenCutTrack(key);
cut.addWpts(AWPTsDepth.getNewShunxuWpts(jiaochNodes, key));
cut.cut();
// ItemValue.removeTrack(key);
}
}
}
/**
* 判断航迹是否交叉
*/
public boolean isTracksJiaocha(Node track1, Node track2) {
TrackRectangle tr1 = new TrackRectangle(track1);
TrackRectangle tr2 = new TrackRectangle(track2);
if (tr1.isContain(tr2) || tr1.isIntersect(tr2)) {
TrackDecussate td = new TrackDecussate();
td.setTracks(track1, track2);
if (td.isDecussate()) {
return true;
}
}
return false;
}
/**
* 得到交叉的航迹点
*/
private Node getJiachaTP(Node trk1, Node trk2) {
TrackDecussate td = new TrackDecussate();
td.setTracks(trk1, trk2);
return td.getDecussateTrackPoint();
// return null;
}
public void setFo(FrameOur fo) {
this.fo = fo;
}
public void save(File saveFile) {
this.fo.saveFile(saveFile);
this.fo.reset();
}
public static void main(String args[]) {
LWHuafen lw = new LWHuafen(new File(
"E:\\核对工作\\数据\\临时数据\\安庆市\\望江县\\整理完毕\\乡\\Y014.gps"));
lw.setFo(new FrameOur());
ItemValue.setShowDialogMessage(false);
lw.huafen();
lw.save(new File("E:\\核对工作\\数据\\临时数据\\安庆市\\望江县\\整理完毕\\test\\Y014_2.gps"));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -