⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newlwtrack.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
字号:
package net.aetherial.gis.jiaotongbu.outputJTB.txtOutput.module.gpsdata.lxld.ld.
    ldhf.luwang;

import org.w3c.dom.Node;
import java.util.Vector;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.dataType.TrackType;
import net.aetherial.gis.our.auto.check.repeattrk.TrackRectangle;
import net.aetherial.gis.publicuse.track.TrackDecussate;
import net.aetherial.gis.jiaotongbu.outputJTB.txtOutput.module.gpsdata.lxld.ld.ldhf.TrackToLD;

/**
 * <p>Title: </p>
 *
 * <p>Description: 按照路网划分</p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class NewLWTrack {
  public NewLWTrack() {
  }

  /**
   * 得到比等级高的航迹
   */
  private Node[] getSuitableTrk(Node[] all, Node trk) {
//    for (int i = 0; all != null && i < all.length; i++) {
//      if (all[i] != trk) {
//        /**
//         * 1.比较方框,得到方框交叉和包含的航迹数组
//         * 2.在数组范围内判断是否为等级高的数组
//         * 3.在数组范围内判断交叉的航迹
//         * 4.如果切割后的航迹分别大于1公里,就切割
//         */
//
//      }
//    }
     return getAcrossTrack(getContainOrIntersectTrks(getThanGradeTrks(all,trk),trk),trk);
  }

  /**
   * 在给定的数组中寻找路线等级比trk 高的航迹
   */
  private Node[] getThanGradeTrks(Node[] all, Node trk) {
    if (all == null) {
      return null;
    }
    Vector ve = new Vector();
    for (int i = 0; i < all.length; i++) {
      if (this.isGradeThan(trk, all[i])) {
        ve.addElement(all[i]);
      }
    }
    Node[] temp = new Node[ve.size()];
    for (int i = 0; i < temp.length; i++) {
      temp[i] = (Node) ve.elementAt(i);
    }
    return temp;
  }

  /**
   * 判断航迹是否相交或者互相包含
   */
  private Node[] getContainOrIntersectTrks(Node[] all, Node trk) {
    Vector ve = new Vector();
    TrackRectangle trs = null, tr = null;
    if (all == null) {
      return null;
    }
    for (int i = 0; i < all.length; i++) {
      trs = new TrackRectangle(all[i]);
      tr = new TrackRectangle(trk);
      if ( (trs.isContain(tr)) || (trs.isIntersect(tr))) {
        ve.addElement(all[i]);
      }
    }

    Node[] temp = new Node[ve.size()];
    for (int i = 0; i < temp.length; i++) {
      temp[i] = (Node) ve.elementAt(i);
    }
    return temp;
  }

  /**
   * 得到交叉的航迹
   */
  private Node[] getAcrossTrack(Node[] all, Node trk) {
    TrackDecussate td = null;
    if (all == null) {
      return null;
    }
    Vector ve = new Vector();
    for (int i = 0; i < all.length; i++) {
      td = new TrackDecussate();
      td.setTracks(all[i], trk);
      if (td.isDecussate()) {
        ve.addElement(all[i]);
      }
    }
    Node[] temp = new Node[ve.size()];
    for (int i = 0; i < temp.length; i++) {
      temp[i] = (Node) ve.elementAt(i);
    }
    return temp;

  }
  /**
   * 得到交叉的航迹点
   */
  private Node getJiachaTP(Node trk1, Node trk2) {
    TrackDecussate td = new TrackDecussate();
    td.setTracks(trk1, trk2);
    return td.getDecussateTrackPoint();
//    return null;
  }

  /**
   * 根据交叉的航迹点,切割航迹trk
   */
  private void cutTrack(Node[] tp,Node trk){
    if(trk == null || tp == null) return;
    Vector trks = new Vector();
    trks.add(trk);
    Vector tps = new Vector();
    for (int i = 0; i < tp.length; i++) {
      tps.add(tp[i]);
    }
    TrackToLD.cutByTrackPoints(trks, tps);
  }
  /**
   * 判断目标航迹是否比源航迹等级高
   */
  private boolean isGradeThan(Node source, Node target) {
    String gradeSource = ItemValue.getTracksGrade(source);
    String gradeTarget = ItemValue.getTracksGrade(target);
    return this.isThan(gradeSource, gradeTarget);
  }

  /**
   * 判断给定的两种等级,判断是否为上级公路
   */
  private boolean isThan(String g1, String g2) {
    if (g1.equals(TrackType.Grade_CUN)) {
      if (g2.equals(TrackType.Grade_GUO)) {
        return true;
      }
      else if (g2.equals(TrackType.Grade_SHEN)) {
        return true;
      }
      else if (g2.equals(TrackType.Grade_XIAN)) {
        return true;
      }
      else if (g2.equals(TrackType.Grade_XIANG)) {
        return true;
      }
      else {
        return false;
      }
    }
    else if (g1.equals(TrackType.Grade_XIANG)) {
      if (g2.equals(TrackType.Grade_GUO)) {
        return true;
      }
      else if (g2.equals(TrackType.Grade_SHEN)) {
        return true;
      }
      else if (g2.equals(TrackType.Grade_XIAN)) {
        return true;
      }
      else {
        return false;
      }
    }
    else if (g1.equals(TrackType.Grade_XIAN)) {
      if (g2.equals(TrackType.Grade_GUO)) {
        return true;
      }
      else if (g2.equals(TrackType.Grade_SHEN)) {
        return true;
      }
      else {
        return false;
      }
    }
    else if (g1.equals(TrackType.Grade_SHEN)) {
      if (g2.equals(TrackType.Grade_GUO)) {
        return true;
      }
      else {
        return false;
      }
    }
    else {
      return false;
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -