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

📄 cutbyappointwpt.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
字号:
package net.aetherial.gis.publicuse.track;

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;

/**
 * <p>标题: 农村公路数据采集与核对工具</p>
 *
 * <p>描述: </p>
 *
 * <p>版权: Copyright (c) 2006</p>
 *
 * <p>公司: 安徽省通途信息技术公司</p>
 *
 * @author 王爱国
 * @version 1.0
 */
public class CutByAppointWPT {
  /**
   * 不能被划分的里程数,代表划分不能过细的原则
   * 定义的最小不能划分的里程
   * 可以随时调节
   * 如果不想使用,将该值定为:0
   */
  public final static double NotBeHuafenLicheng = 500;

  private Vector appointWPTs = new Vector();

  private Node beenCutTrack = null;
  public CutByAppointWPT() {
  }

  public void addWpt(Node waypoint) {
    this.appointWPTs.add(waypoint);
  }

  public void addWpts(Vector appointWPTs) {
    this.appointWPTs.addAll(appointWPTs);
  }


  public void setBeenCutTrack(Node track) {
    this.beenCutTrack = track;
  }

  private void initStartEndPoint() {
    if (this.beenCutTrack != null) {
      NodeList nl = ItemValue.getTracksPoint(this.beenCutTrack);
      if (nl != null) {
        Node start = ItemValue.turnTracksPointToWaypoint(nl.item(0));
        Node end = ItemValue.turnTracksPointToWaypoint(nl.item(nl.getLength() -
            1));
        this.appointWPTs.add(end);
        this.appointWPTs.add(0, start);
      }
    }
  }

  public void cut() {
    if (this.beenCutTrack == null
        || this.appointWPTs.size() == 0
        || !ItemValue.isCanBeCut_ld(this.beenCutTrack)
        ) {
      if (this.beenCutTrack == null) {
        System.out.println("beenCutTrack == null");
      }
      else if (this.appointWPTs.size() == 0) {
      System.out.println("appointWPTs.size() == 0");
      }
      else if (!ItemValue.isCanBeCut_ld(this.beenCutTrack)) {
      System.out.println("!ItemValue.isCanBeCut_ld(this.beenCutTrack)");
      }

      else {
      System.out.println("Other error");
      }
      System.out.println("航迹不能被切割");
      return;
    }
    this.initStartEndPoint();
    Node temp = null;
    CutToSection cut = null;
    String trackName = ItemValue.getTracksName(this.beenCutTrack);
    Node[] allNodes = new Node[this.appointWPTs.size()];
    this.appointWPTs.copyInto(allNodes);
    int j = 1;
    for (int i = 0; i < allNodes.length; i++) {
      if (j < allNodes.length) {
        cut = new CutToSection();
        cut.setStartEnd(allNodes[i],allNodes[j]);
        cut.setTrack(this.beenCutTrack);
        temp = cut.createNewDocNode();

        /**
         * 划分不能过细
         */
        if (ItemValue.getTracksDistance(temp) < CutByAppointWPT.NotBeHuafenLicheng) {
          j++;
          ItemValue.removeTrack(temp);
          continue;
        }
        j++;
        /**
         * 划分不能过细 end
         */
        ItemValue.setTracksName(temp,trackName);
      }
    }
    /**
     * 删除首尾临时的节点
     */
    ItemValue.removeWaypoint((Node)this.appointWPTs.firstElement());
    ItemValue.removeWaypoint((Node)this.appointWPTs.lastElement());


    ItemValue.removeTrack(this.beenCutTrack);
  }
}


⌨️ 快捷键说明

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