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

📄 wuwei.java

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

import java.util.Vector;
import java.io.*;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.publicuse.StringOper;
import net.aetherial.gis.jiaotongbu.output.publicuse.Item;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class WuWei
    extends Xian {

  public WuWei() {
    /*
         if(this.wuchen_xiangzhen != null){
      this.length = wuchen_xiangzhen.length;
         }else{
      this.length =0;
         }
     */
    this.read();
    if (!this.isAllEqual()) {
      System.out.println("数据读取的长度不相等!!!!!!!!!");
    }
    this.printAllLength();
  }

  private void read() {
    String arrayPath = ItemValue.getArrayPath();
//    System.err.println("arrayPath:" + arrayPath);
    if (arrayPath.equals("")) {
      this.wuchen_xiangzhen = this.readFile("file\\array\\xiangzhen.txt");
      this.wuwei_cun = this.readFile("file\\array\\cun.txt");
      this.wuwei_jinji = this.readFile("file\\array\\jinji.txt");
      this.wuwei_renkou = this.readFile("file\\array\\renkou.txt");
      this.wuwei_shouru = this.readFile("file\\array\\shouru.txt");
      this.wmianji = this.readFile("file\\array\\mianji.txt");
      this.wzirancun = this.readFile("file\\array\\zirancun.txt");
      this.wdixing = this.readFile("file\\array\\dixing.txt");
      this.wtiaojian = this.readFile("file\\array\\tiaojian.txt");
      this.wdukou = this.readFile("file\\array\\dukou.txt");
      this.wbeizhu = this.readFile("file\\array\\beizhu.txt");

    }
    else {
      this.wuchen_xiangzhen = this.readFile(arrayPath + "xiangzhen.txt");
      this.wuwei_cun = this.readFile(arrayPath + "cun.txt");
      this.wuwei_jinji = this.readFile(arrayPath + "jinji.txt");
      this.wuwei_renkou = this.readFile(arrayPath + "renkou.txt");
      this.wuwei_shouru = this.readFile(arrayPath + "shouru.txt");
      this.wmianji = this.readFile(arrayPath + "mianji.txt");
      this.wzirancun = this.readFile(arrayPath + "zirancun.txt");
      this.wdixing = this.readFile(arrayPath + "dixing.txt");
      this.wtiaojian = this.readFile(arrayPath + "tiaojian.txt");
      this.wdukou = this.readFile(arrayPath + "dukou.txt");
      this.wbeizhu = this.readFile(arrayPath + "beizhu.txt");
    }
//    System.out.println("this.wuchen_xiangzhen.length" + this.wuchen_xiangzhen.length);
    this.length = wuchen_xiangzhen.length;
    this.setWuwei();
  }

  /**
   * 如果是区的话,去掉其它的区内容
   * 并且得到该区乡镇正确名称
   */
  private void getRidOfOtherIfQu(){
    if (!Item.isQu) {
      return;
    }
    String quName = Item.getXianName();
    if (this.wuchen_xiangzhen != null) {
      for (int i = 0; i < this.wuchen_xiangzhen.length; i++) {
        if ((this.wuchen_xiangzhen[i].indexOf(quName)) == -1) {
//  删除数组中该条

        }
      }
    }

  }
  /**
   * 删除掉某一条
   */
  private String[] deleteRow(String[] array,int row){
    Vector ve = new Vector();
    for (int i = 0; i < array.length; i++) {
      ve.addElement(array[i]);

    }
    if ((row >0)&&(row < ve.size())) {
      ve.removeElementAt(row);
    }

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

  /**
   * 判断乡镇文件与数组乡镇是否匹配
   * 通过匹配率判断
   * @param allFile 乡村文件夹内的文件
   */
  public boolean isXiangZhenSimulate(File[] allFile) {
    int sameCount = 0;
    if ( (allFile == null) || (this.wuchen_xiangzhen == null)) {
      return false;
    }
    else {
      for (int i = 0; i < allFile.length; i++) {
        for (int j = 0; j < this.wuchen_xiangzhen.length; j++) {
          if (allFile[i].getName().indexOf(this.wuchen_xiangzhen[j]) != -1) {
            sameCount++;
          }
        }
      }
    }
    if ( (sameCount / this.wuchen_xiangzhen.length) > 0.5) {
      return true;
    }
    return false;
  }

  /**
   * 寻找在本数组里面有没有与之匹配的
   * 找不到,返回-1;
   */
  public int find(String xingzhengcun, String xiangzhen) {
    if (this.wuwei == null) {
      return -1;
    }
    for (int i = 0; i < this.wuwei.length; i++) {
      if (StringOper.isInclude(xiangzhen,this.wuwei[i][0])) {
        int maxPos = 0;
        if ( (i + 1) == this.wuwei.length) {
          maxPos = this.wuwei_cun.length;
        }
        else {
          maxPos = Integer.parseInt(this.wuwei[i + 1][1]);
        }
        for (int j = Integer.parseInt(this.wuwei[i][1]); j < maxPos; j++) {
          if (xingzhengcun.indexOf(this.wuwei_cun[j]) != -1) {
            return j;
          }
        }
        break;
      }
    }
    for (int i = 0; i < this.wuwei_cun.length; i++) {
      if (StringOper.isInclude(xingzhengcun,this.wuwei_cun[i])) {
        return i;
      }
    }
    return -1;
  }

  private void setWuwei() {

    Vector ve = new Vector();
    String tempXiangzhen = "";
    for (int i = 0; i < this.length; i++) {
      if (! (tempXiangzhen.equals(this.wuchen_xiangzhen[i]))) {
        tempXiangzhen = this.wuchen_xiangzhen[i];
        ve.add(tempXiangzhen);
        ve.add("" + i);
      }
    }
    this.wuwei = new String[ (int) (ve.size() / 2)][2];
    for (int i = 0; i < ve.size(); i++) {
      this.wuwei[i / 2][0] = ve.elementAt(i) + "";
      this.wuwei[i / 2][1] = ve.elementAt(i + 1) + "";
      i++;
    }
  }

  private boolean isAllEqual() {
    if ( (this.wuchen_xiangzhen.length == this.wuwei_cun.length) &&
        (this.wuwei_renkou.length == this.wuwei_jinji.length)) {
      if (this.wuwei_cun.length == this.wuwei_jinji.length) {
        return true;
      }
    }
    return false;
  }

  private void printAllLength() {
//    System.out.println("array_xiangzhen.length:" +
//                       this.wuchen_xiangzhen.length);
//    System.out.println("array_cun.length:" + this.wuwei_cun.length);
//    System.out.println("array_jinji.length:" + this.wuwei_jinji.length);
//    System.out.println("array_renkou.length:" + this.wuwei_renkou.length);
//    System.out.println("array.length:" + this.wuwei.length);
  }

  private String[] readFile(String fileName) {
    Vector ve = new Vector();
    try {
      BufferedReader in = new BufferedReader(new InputStreamReader(new
          FileInputStream(fileName)));
      String line = new String("");
      int i = 0;
      for (line = in.readLine(); line != null; line = in.readLine(), i++) {
        //System.out.println("读取第"+ i + "行: " + line);
        ve.add(line.trim());
      }
    }
    catch (Exception ex) {
      System.out.print(ex);
    }
    String[] temp = new String[ve.size()];
    for (int i = 0; i < ve.size(); i++) {
      temp[i] = ve.elementAt(i) + "";
    }
    return temp;
  }

  private String[] readFile1(String fileName) {
    String all = "";
    try {
      File f = new File(fileName);
      FileInputStream in = new FileInputStream(f);
      int l = Integer.parseInt(f.length() + "");
      byte[] b = new byte[l];
      int inttemp;
      if (l > 0) {
        while (true) {
          if ( (inttemp = in.read(b)) == -1) {
            break;
          }
          all = all + (new String(b, "ANSI"));
        }
      }
    }
    catch (Exception ex) {
      System.err.print(ex);
    }

    Vector ve = new Vector();

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

  }

  public String[] wmianji = null;
  public String[] wzirancun = null;
  public String[] wdixing = null;
  public String[] wtiaojian = null;
  public String[] wdukou = null;
  public String[] wbeizhu = null;
  public String[] wuchen_xiangzhen = {
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "无城",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "赫店",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "仓头",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "太平",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "红庙",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "开城",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "石涧",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "三汊河",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "陡沟",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "福渡",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "凤凰桥",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "二坝",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "汤沟",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "白茆",
      "黑沙洲",
      "黑沙洲",
      "黑沙洲",
      "黑沙洲",
      "黑沙洲",
      "黑沙洲",
      "黑沙洲",
      "黑沙洲",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "蜀山",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "泉塘",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "十里墩",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "鹤毛",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "昆山",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "百胜",
      "严桥",

⌨️ 快捷键说明

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