📄 linkjudge.java
字号:
package net.aetherial.gis.output.toLd.repeate;
import org.w3c.dom.Node;
import net.aetherial.gis.publicuse.track.TrackDecussate;
import net.aetherial.gis.publicuse.NodeArrayOper;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.our.FrameOur;
import java.io.File;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class LinkJudge {
private PartTrack[] pt = null;
private FrameOur fo = null;
public LinkJudge() {
}
/**
* 判断 两条航迹是否相连
*/
private boolean isTwoTrk_Link(Node trk1, Node trk2) {
TrackDecussate td = new TrackDecussate();
td.setTracks(trk1, trk2);
return td.isTLinkOrXDecussate();
}
public void createPartTrack(File multiTrkFile) {
if (this.fo == null) {
this.fo = new FrameOur();
}
ItemValue.setShowDialogMessage(false);
this.fo.openFile(multiTrkFile);
Node[] tracks = ItemValue.getTracks();
this.initPt(tracks);
// this.fo.reset();
// if (this.pt != null) {
// for (int i = 0; i < this.pt.length; i++) {
// try {
// System.out.println(this.pt[i].toString());
// }
// catch (Exception ex) {
// System.out.println("this.pt[" + i + "]==null");
// }
// }
// }
}
private void initPt(Node[] trks) {
PartTrack pt = toParts(null, trks,1);
if (pt == null) {
return;
}
if (this.pt == null) {
this.pt = new PartTrack[1];
this.pt[0] = pt;
}
else {
PartTrack[] temp = this.pt;
this.pt = new PartTrack[temp.length + 1];
for (int i = 0; i < temp.length; i++) {
this.pt[i] = temp[i];
}
this.pt[temp.length] = pt;
}
for (int i = 0; i < this.pt.length; i++) {
try {
trks = NodeArrayOper.getleftNode(this.pt[i].getParts(), trks);
}
catch (Exception ex) {
return;
}
}
this.initPt(trks);
}
private PartTrack toParts(Node currentTrk, Node[] trks,int cunci) {
if (trks == null) {
// System.out.println(this.getClass().getName() + ":Line 84 trks=null");
return null;
}
if (currentTrk == null) {
currentTrk = trks[0];
}
Node[] temp1 = null;
PartTrack newPt = new PartTrack();
newPt.addATrk(currentTrk);
// System.out.println(this.getClass().getName() + ":Line 86");
for (int i = 0; i < trks.length; i++) {
// for (int j = 0; j < cunci; j++) {
// System.out.print("--");
// }
//
//
// for (int j = 0; j < trks.length; j++) {
// System.out.println(ItemValue.getTracksName(trks[j]));
// }
// System.exit(0);
// System.out.println("trks["+i+"]:" +ItemValue.getTracksName(trks[i]) + " VS currentTrk:" + ItemValue.getTracksName(currentTrk));
// System.out.println("trks.length103:" + trks.length);
if (currentTrk != trks[i]) {
if (this.isTwoTrk_Link(currentTrk, trks[i])) {
newPt.addATrk(trks[i]);
// System.out.println("Is error?1...");
temp1 = NodeArrayOper.removeNode(trks[i], trks);
// System.out.println("temp1 = NodeArrayOper.removeNode(trks[i], trks):" + temp1.length);
newPt.addAPart(toParts(trks[i],
temp1,cunci+1)); //??????
// System.out.println("Is error?2....");
}
}
}
// System.out.println("newPt:" + newPt.toString());
return newPt;
}
public static void main(String[] args) {
LinkJudge linkjudge = new LinkJudge();
// linkjudge.test("E:\\temp\\枞阳县\\整理完毕\\乡\\Y010.gps");
}
public void setFo(FrameOur fo) {
this.fo = fo;
}
public PartTrack[] getPt() {
return pt;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -