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

📄 readall.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package net.aetherial.gis.output.toTable.readglj;

import net.aetherial.gis.our.duibi.readXLS.ReadFile;
import net.aetherial.gis.surface.CreateFile;

import java.io.File;
import java.util.*;

import org.w3c.dom.Node;

import net.aetherial.gis.output.FileOperate;
import net.aetherial.gis.our.*;
import net.aetherial.gis.output.toLd.*;
import net.aetherial.gis.output.toTable.*;
import net.aetherial.gis.jiaotongbu.output.publicuse.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class ReadAll
    extends ReadFile {
  public static Vector allRow = new Vector();
  public ReadAll() {
    this.setSheet("file\\glj\\luduanxinxi.xls", "t");
    this.row = this.baseRow = 0;
  }

  public void read() {
    System.out.print("  正在读取公路局路段信息表:");
    while (true) {
      if (this.row >= 11274) {
        break;
      }
      if (this.row % 1000 == 1) {
        System.out.print(this.row + ", ");
      }
      this.moveNext();
      if (!this.isEmptyrow()) {
        allRow.add( (new ReadRow(this.rowData)).getLdRow());
      }
      else {
        break;
      }
    }
    System.out.println("");
  }

  public static Vector selectLdRow(String xianName) {
    Vector temp = new Vector();
    for (int i = 0; i < allRow.size(); i++) {
      if ( ( (LdRow) allRow.get(i)).getDanWeiName().indexOf(xianName) != -1) {
        temp.add( (LdRow) allRow.get(i));
      }
    }
    return temp;
  }

  //----------获取所有跨县路段数据
  public static Vector selectAllRow() {

    Vector temp = new Vector();
    Vector AllRow2 = new Vector();
    String lxNumber = ""; //路线编号
    for (int i = 0; i < allRow.size(); i++) {
      lxNumber = ( (LdRow) allRow.get(i)).getLxNumber();
      if ( ( (LdRow) allRow.get(i)).getStartValue().equals("0")) {
        continue;
      }
      int n = selectRowNum(lxNumber).size(); //相同路线编号的总记录数
      int isZero = 0; //判断起点数据是否为0
      AllRow2 = selectRowNum(lxNumber);
      for (int j = 0; j < AllRow2.size(); j++) {
        if ( ( (LdRow) AllRow2.get(j)).getStartValue().equals("0")) {
          isZero = 1;
          break;
        }
        else {
          continue;
        }
      }
      if (isZero == 0) { //当起点不为0时,则为跨县路段
        temp.add( (LdRow) allRow.get(i));
      }

    }

    return temp;

  }

  //----------根据县名获取跨县路段数据
  public static Vector selectRowByXian(String xianName) {
    Vector temp = new Vector();
    Vector AllRow2 = new Vector();

    String lxNumber = ""; //路线编号
    for (int i = 0; i < allRow.size(); i++) {
      lxNumber = ( (LdRow) allRow.get(i)).getLxNumber();
      if ( ( (LdRow) allRow.get(i)).getStartValue().equals("0")) {
        continue;
      }
      int n = selectRowNum(lxNumber).size(); //相同路线编号的总记录数
      int isZero = 0; //判断起点数据是否为0
      int isHave = 0;
      AllRow2 = selectRowNum(lxNumber);
      for (int j = 0; j < AllRow2.size(); j++) {
        /*  if (((LdRow)AllRow2.get(j)).getStartValue().equals("0")) {
            isZero=1;
            break;
          }else */
        if (temp != null) {
          for (int k = 0; k < temp.size(); k++) {
            String number = ( (LdRow) temp.get(k)).getLxNumber();
            if (number.equals(lxNumber)) {
              isHave = 1;
            }
          }
        }
        else {
          continue;
        }
      }
      if (isHave == 0) { //&& ((LdRow)allRow.get(i)).getDanWeiName().indexOf(xianName) != -1)   //当起点不为0时,则为跨县路段
        temp.add( (LdRow) allRow.get(i));
      }

    }

    return temp;
  }

  //----------根据县名获取所有数据
  public static Vector getRowByXian(String shiName, String xianName) {
    Vector temp = new Vector();
    Vector AllRow2 = new Vector();

    String lxNumber = ""; //路线编号

    String xianName1 = xianName;
    String xian = xianName.substring(2, 3);
    if (xian.equals("区")) {
      xian = shiName;
      xianName1 = xian;
    }
    for (int i = 0; i < allRow.size(); i++) {
      lxNumber = ( (LdRow) allRow.get(i)).getLxNumber();
      int n = selectRowNum(lxNumber).size(); //相同路线编号的总记录数
      int isZero = 0; //判断起点数据是否为0
      int isHave = 0;
      AllRow2 = selectRowNum(lxNumber);
      for (int j = 0; j < AllRow2.size(); j++) {
        /*  if (((LdRow)AllRow2.get(j)).getStartValue().equals("0")) {
            isZero=1;
            break;
          }else */
        if (temp != null) {
          for (int k = 0; k < temp.size(); k++) {
            String number = ( (LdRow) temp.get(k)).getLxNumber();
            if (number.equals(lxNumber)) {
              isHave = 1;
            }
          }
        }
        else {
          continue;
        }
      }
      if (isHave == 0 &&
          ( (LdRow) allRow.get(i)).getDanWeiName().indexOf(xianName1) != -1) { //当起点不为0时,则为跨县路段
        temp.add( (LdRow) allRow.get(i));
        String number = ( (LdRow) allRow.get(i)).getLxNumber();
        System.err.println("================Number=====" + number);
      }

    }

    return temp;
  }

  //-------------查找跨入县区的列表
  public static Vector kuaXianRow(String xianName, String lxNumber) {
    Vector temp = new Vector();
    String lxNum = "";
    for (int i = 0; i < allRow.size(); i++) {
      lxNum = ( (LdRow) allRow.get(i)).getLxNumber();
      if (lxNum.equals(lxNumber)) {
        temp.add( (LdRow) allRow.get(i));
      }
    }
    return temp;
  }

  //----------统计同一路线编号的记录(add by zhurun)
  public static Vector selectRowNum(String LxNumber) {
    Vector temp = new Vector();
    for (int i = 0; i < allRow.size(); i++) {
      if ( ( (LdRow) allRow.get(i)).getLxNumber().indexOf(LxNumber) != -1) {
        temp.add( (LdRow) allRow.get(i));
      }
    }
    return temp;
  }

  //----------获取起点、止点桩号
  public static String[] zhuangHao(String LxNumber, String shiName,
                                   String xianName) {
    String xianName1 = xianName;
    String xian = xianName.substring(2, 3);
    if (xian.equals("区")) {
      xian = shiName;
      xianName1 = xian;
    }
    String[] zh = new String[2];
    zh[0] = "0";
    zh[1] = "0";
    Vector temp = new Vector();
    for (int i = 0; i < allRow.size(); i++) {
      if ( ( (LdRow) allRow.get(i)).getLxNumber().indexOf(LxNumber) != -1 &&
          ( (LdRow) allRow.get(i)).getDanWeiName().indexOf(xianName1) != -1) {
        temp.add( (LdRow) allRow.get(i));
      }
    }
    for (int j = 0; j < temp.size(); j++) {
      if (j == 0) {
        if ( ( (LdRow) temp.get(j)).getStartValue() != null) {
          zh[0] = ( (LdRow) temp.get(j)).getStartValue();
        }

      }
      if (j == temp.size() - 1) {
        if ( ( (LdRow) temp.get(j)).getZhiDianValue() != null) {
          zh[1] = ( (LdRow) temp.get(j)).getZhiDianValue();
        }

      }
    }

    return zh;

  }

⌨️ 快捷键说明

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