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

📄 runall2.java

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

import net.aetherial.gis.dataType.TrackType;
import java.io.File;
import java.util.Vector;
import net.aetherial.gis.surface.CreateFile;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class RunAll2 {
  private boolean less3mi5 = true; //小于3.5米
  private boolean wulumian = true; //无路面
  private Vector bianmaSet = new Vector();
  public RunAll2() {
  }

  public void read() {
    ReadTongda readTongda = new ReadTongda(
        "C:\\Documents and Settings\\Administrator\\桌面\\编码\\22.xls");
    readTongda.read();
    System.out.println("22.xls read ok!");
    ReadLuxian readluxian = new ReadLuxian(
        "C:\\Documents and Settings\\Administrator\\桌面\\编码\\55.xls");
    readluxian.read();
    System.out.println("44.xls read ok!");
  }

  public void compare() {
    String n = "";
    this.scanToRepare();
    System.out.println("比较结束.");
    TongdaRow tongda = null;
    LuxianRow[] luxians = null;
    for (int j = 0; j < Permanence.tongda.size(); j++) {
      tongda = (TongdaRow) Permanence.tongda.get(j);
      luxians = Permanence.getluxian(tongda);
      System.out.println("正在查找:["+j+"]" + tongda.getName());
      for (int k = 0; k < luxians.length; k++) {

        if (( (Double.parseDouble(luxians[k].getLumian().trim()) < 3.5 &&
              this.less3mi5)
            ||
            (luxians[k].getType().trim().equals(TrackType.RS_JTB_8_WuLumian) && this.wulumian))
            &&
            (luxians[k].getBianma().toUpperCase().startsWith("C"))
            &&
            (!this.isInBianmaSet(luxians[k].getBianma()))
            ) {
          n += tongda.getBianma() + "\t";
          n += tongda.getName() + "\t";
          n += luxians[k].getBianma() + "\t";
//          n += luxians[k]. + "\t";
          n += luxians[k].getId() + "\t";
          n += luxians[k].getLuji() + "\t";
          n += luxians[k].getLumian() + "\t";
          n += luxians[k].getType() + "\t";
          n += luxians[k].getLicheng() + "\t";
          n += "\r\n";
          bianmaSet.add(luxians[k].getBianma());
        }

      }
    }
    this.createLogFile(n);
  }

  private boolean isInBianmaSet(String bianma){
    for (int i = 0; i < this.bianmaSet.size(); i++) {
      if (this.bianmaSet.get(i).equals(bianma)) {
        return true;
      }
    }
    return false;
  }

  public static String createLogFile(String content) {

      File f = new File("C:\\Documents and Settings\\Administrator\\桌面\\编码\\无路面小于3.5" + System.currentTimeMillis() + ".txt");
      CreateFile cf = new CreateFile(f);
      cf.memoryToFile(content);
      return f.getAbsolutePath();
  }
  private void scanToRepare() {
    TongdaRow tongda = null, tongda2 = null;
    for (int i = 0; i < Permanence.tongda.size(); i++) {

      tongda = (TongdaRow) Permanence.tongda.get(i);
      System.out.println("正在比较[" + i+"]:" + tongda.getName());
      for (int j = 0; j < Permanence.tongda.size(); j++) {
        tongda2 = (TongdaRow) Permanence.tongda.get(j);
        if (tongda != tongda2) {
          if (tongda.getBianma().trim().equals(tongda2.getBianma().trim())) {
            if (tongda.getJuli() <= tongda2.getJuli()) {
              Permanence.tongda.remove(tongda2);
              i--;
              j--;
            }
            else {
              Permanence.tongda.remove(tongda);
              i--;
              break;
            }
          }
        }
      }
    }

    /**
     * 去除掉大于80米范围的建制村
     */
    for (int i = 0; i < Permanence.tongda.size(); i++) {
      tongda = (TongdaRow) Permanence.tongda.get(i);
      if (tongda.getJuli() > 0.080) {
        Permanence.tongda.remove(tongda);
        i--;
      }
    }
  }

  public static void main(String args[]) {
    RunAll2 ra = new RunAll2();
    ra.read();
    ra.compare();
  }

  public void setLess3mi5(boolean less3mi5) {
    this.less3mi5 = less3mi5;
  }

  public void setWulumian(boolean wulumian) {
    this.wulumian = wulumian;
  }

}

⌨️ 快捷键说明

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