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

📄 createlianxuzhuang.java

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

import net.aetherial.gis.cutAndLink.zhuanghao.Zhuanghao;
import net.aetherial.gis.jiaotongbu.input.publicuse.Permanence;
import net.aetherial.gis.jiaotongbu.input.type.Qiaoliang;
import org.w3c.dom.Node;
import net.aetherial.gis.cutAndLink.zhuanghao.CreateZhuanghao;
import net.aetherial.gis.surface.ItemValue;
import net.aetherial.gis.dataType.WptType;
import net.aetherial.gis.jiaotongbu.input.publicuse.QiaoliangToGPS;
import java.io.File;
import net.aetherial.gis.our.FrameOur;
import net.aetherial.gis.publicuse.StringOper;

/**
 * <p>标题: 农村公路数据采集与核对工具</p>
 *
 * <p>描述: </p>
 *
 * <p>版权: Copyright (c) 2006</p>
 *
 * <p>公司: 安徽省通途信息技术公司</p>
 *
 * @author 王爱国
 * @version 1.0
 */
public class CreateLianxuZhuang {
  private double dizengzhi = 2;
  private String[] bianhao = {
      "G205", "S103-2","S215", "S103-1","S218-1","S218-2","S218-3"};
  private double[] start = {1529.748,209.464,194.745,295.745,0,58.425,67.623};
  private String inputPath;
  private String outputPath;
  private FrameOur fo;

  public CreateLianxuZhuang() {


  }

  public void create(){
    File[] gpsFiles = (new File(this.inputPath)).listFiles();
    for (int i = 0; i < gpsFiles.length; i++) {
      this.InsertAFile(gpsFiles[i]);
    }
  }
  private void InsertAFile(File gpsFile){
    this.fo.openFile(gpsFile);
    String number = gpsFile.getName().toUpperCase().replaceAll(".GPS","");

    Node[] trks = ItemValue.getTracks();
    this.createLianxu(trks[0],number);
    this.fo.saveFile(new File(StringOper.getSplashPath(this.outputPath) + gpsFile.getName()));
    this.fo.reset();
  }


  public static void main(String args[]){
    CreateLianxuZhuang create = new CreateLianxuZhuang();
    create.setInputPath("E:\\test\\14\\1");

    create.setFo(new FrameOur());
    ItemValue.setShowDialogMessage(false);
    for (int i = 11; i < 21; i++) {
      create.setDizengzhi(i);
      create.setOutputPath("E:\\test\\14\\2\\" + i+"K");
      create.create();
    }

  }

  private double getStart(String number) {
    for (int i = 0; i < bianhao.length; i++) {
      if (bianhao[i].trim().equals(number)) {
        return start[i];
      }
    }
    return 0;
  }

  private String getZhuanghaoString(double weizhi) {
    String str = "";
    int zhengshu = (int) weizhi;
    weizhi = weizhi - zhengshu;
    weizhi = weizhi * 1000;
    int xiaoshu = (int) weizhi;
    if (xiaoshu < 10) {
      return "K" + zhengshu + "+00" + xiaoshu;
    }
    else if (xiaoshu < 100) {
      return "K" + zhengshu + "+0" + xiaoshu;
    }
    else {
      return "K" + zhengshu + "+" + xiaoshu;
    }
  }

  private void createLianxu(Node track, String number) {
    double myStart = 0,newStart, pStart = this.getStart(number);
    int i = 0;

    Node temp = null;
    while (true) {
      if (i == 0) {
        temp = this.createZhunghao(0.001, track);
        ItemValue.setWaypointName(temp, this.getZhuanghaoString(pStart));
      }
      else {
        myStart = this.dizengzhi * i;
        if (myStart > pStart) {
          newStart = myStart - pStart;
          temp = this.createZhunghao(newStart, track);
          if (temp == null) {
            break;

          }else{
            ItemValue.setWaypointName(temp, this.getZhuanghaoString(myStart));
          }
        }
      }
      i++;

    }
  }

  private Node createZhunghao(double weizhi, Node track) {
    Zhuanghao zh = new Zhuanghao();
    CreateZhuanghao create = null;

    try {
      zh.setData(weizhi);
      zh.setZhuanghaoName("");
    }
    catch (NumberFormatException ex) {
      return null;
    }
    try {
      create = new CreateZhuanghao(zh, track);
    }
    catch (Exception ex1) {
      return null;
    }
    Node ql_wpt = create.getZhuanghaoWaypoint();
    if (ql_wpt != null) {
      ItemValue.setWaypointKP(ql_wpt, WptType.W14_QiTa);
      return ql_wpt;
    }
    return null;
  }

  public void setInputPath(String inputPath) {
    this.inputPath = inputPath;
  }

  public void setFo(FrameOur fo) {
    this.fo = fo;
  }

  public void setOutputPath(String outputPath) {
    this.outputPath = outputPath;
  }

  public void setDizengzhi(double dizengzhi) {
    this.dizengzhi = dizengzhi;
  }

}

⌨️ 快捷键说明

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