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

📄 defaultselect.java

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

import org.w3c.dom.*;
import net.aetherial.gis.surface.*;
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class DefaultSelect {

  private Node firstWaypoint = null;
  private Node lastWaypoint = null;
  private Node tracks = null;
  private int firstID = 0;
  private int lastID = 0;
  Vector v = new Vector();
  public DefaultSelect(Node track) {
    this.tracks = track;
    this.getMyWaypoints();
    if(v.size()>0){
      this.findBegin();
      this.findEnd();
      this.getPosition();
    }
  }
  private void getMyWaypoints(){
    String id = ItemValue.getTracksID(this.tracks);
    int[] pos = ItemValue.getPosition("waypoint");

    Node node = null;
    if(pos == null){
      return ;
    }else{
      for(int i =0;i<pos.length;i++){
        node = ItemValue.getWaypoint(pos[i]);
        if (ItemValue.getWaypointTracksID(node).equals(id)){
              v.add(node);
            }
      }
    }
  }
  private void findBegin(){
    for(int i =0;i<v.size();i++){
      if(ItemValue.getWaypointKP((Node)(v.get(i))).equals("起点")){
        this.firstWaypoint = (Node)(v.get(i));
        break;
      }
    }
    if(this.firstWaypoint == null){
      this.firstWaypoint = (Node)(v.get(0));
    }
  }
  private void findEnd(){
    for(int i =0;i<v.size();i++){
      if(ItemValue.getWaypointKP((Node)(v.get(i))).equals("终点")){
        this.lastWaypoint = (Node)(v.get(i));
        break;
      }
    }
    if(this.lastWaypoint == null){
      this.lastWaypoint = (Node)(v.get(v.size()-1));
    }
  }
  private int getPos(int[] pos,Node waypoint){
    for(int i = 0;i<pos.length;i++){
      if(ItemValue.getWaypoint(pos[i]).equals(waypoint)){
        return i;
      }
    }
    return 0;
  }
  private void getPosition(){
    int[] pos = ItemValue.getPosition("waypoint");
    if(pos == null){
      return;
    }else{
      if(this.firstWaypoint == null){
        return;
      }
      if(this.lastWaypoint == null){
        return;
      }
      this.firstID = this.getPos(pos,this.firstWaypoint);
      this.lastID = this.getPos(pos,this.lastWaypoint);
    }
  }
  public String getFirstName(){
    return ItemValue.getWaypointName(this.firstWaypoint);
  }
  public String getlastName(){
    return ItemValue.getWaypointName(this.lastWaypoint);
  }
  public int getFirstID(){
    return this.firstID;
  }
  public int getlastID(){
    return this.lastID;
  }
}

⌨️ 快捷键说明

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