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

📄 analysekuaxian.java

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

import net.aetherial.gis.jiaotongbu.input.publicuse.Permanence;
import net.aetherial.gis.jiaotongbu.input.type.KuaxianLuxian;
import java.util.Vector;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2004</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class AnalyseKuaxian {
  String lxNumber;
  private String currentXian;
  private double scale = 1;
  private double startLicheng = 0;
  public AnalyseKuaxian(String lxNumber, String currentXian) {
    this.lxNumber = lxNumber;
    this.currentXian = currentXian;
    this.init();
//    Permanence


  }

  public void reset() {
    this.scale = 1;
    this.startLicheng = 0;
  }

  public double getCurrentWeizhi(double zhuanghao) {
    double temp = (zhuanghao * this.scale) - this.startLicheng;
    if (temp < 0) {
//      System.out.println("this.startLicheng:" + this.startLicheng);
//      System.out.println("this.scale:" + this.scale);
//      System.exit(0);
    }

//    if (lxNumber.indexOf("X002") != -1) {
//      System.out.println("scale " + scale );
//      System.out.println("startLicheng " + startLicheng );
//      System.out.println("temp " + temp );
//      System.exit(0);
//    }

    return (zhuanghao * this.scale) - this.startLicheng;
  }

  public double getZongtiZhuanghao(double weizhi) {
    return (weizhi + this.startLicheng) / this.scale;
  }

  private KuaxianLuxian[] getThisKuaxian() {
    Vector array = new Vector();
    KuaxianLuxian temp = null;
    for (int i = 0; i < Permanence.kuaxian_lx.size(); i++) {
      temp = (KuaxianLuxian) Permanence.kuaxian_lx.get(i);
      if (temp.getNumber().toUpperCase().indexOf(this.lxNumber) != -1) {
        array.add(temp);
      }
    }
    KuaxianLuxian[] all = new KuaxianLuxian[array.size()];
    array.copyInto(all);
    return all;
  }

  private void init() {
    double maxZhaunghao = 0, allGpsLicheng = 0, currentQidian = 0;
    KuaxianLuxian[] kxs = this.getThisKuaxian();
    for (int i = 0; i < kxs.length; i++) {
      maxZhaunghao = Math.max(maxZhaunghao, kxs[i].getZhidianZhuanghao());
      allGpsLicheng += kxs[i].getGpsLicheng();
      if (kxs[i].getBelongXian().indexOf(this.currentXian) != -1 ||
          this.currentXian.indexOf(kxs[i].getBelongXian()) != -1) {

        currentQidian = kxs[i].getQidianZhuanghao();
        System.out.println("kxs[i]" + kxs[i]);
        System.out.println(kxs[i].getBelongXian() + " " + kxs[i].getNumber() +
                           "发现当前路线,起点为:" + currentQidian);
//        break;
      }
    }
    try {
//      System.out.println("kxs.length:" + kxs.length);
//      System.out.println("allGpsLicheng:" + allGpsLicheng + ",maxZhaunghao" + maxZhaunghao);
      this.scale = allGpsLicheng / maxZhaunghao;
    }
    catch (Exception ex) {
      this.scale = 1;
    }
    if (Double.isInfinite(this.scale) || Double.isNaN(this.scale)) {
      this.scale = 1;
    }
//    if (this.scale > 1) {
//      this.scale = 1;
//    }

    for (int i = 0; i < kxs.length; i++) {
      if (kxs[i].getQidianZhuanghao() < currentQidian) {
        System.out.println(kxs[i].getBelongXian() + " " + kxs[i].getNumber() +
                           "发现前面的路线,当前起点为:" + currentQidian);
        startLicheng += kxs[i].getGpsLicheng();
      }
    }
  }

  public double getStartLicheng() {
    return startLicheng;
  }

  public double getScale() {
    return scale;
  }

}

⌨️ 快捷键说明

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