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

📄 search.java

📁 基于Java的地图数据管理软件。使用MySQL数据库管理系统。
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    baseWidth = "";

    namePara = "";
    numberPara = "";
    surfaceWidthPara = "";
    baseWidthPara = "";

    notLinkLx = "";
//   msg = "";
  }

  /**
   * 弹出报警信息
   */
  public void msg(String string) {
    JOptionPane.showMessageDialog(this, string,
                                  string,
                                  JOptionPane.WARNING_MESSAGE);

  }

  public void jButton1_actionPerformed(ActionEvent e) {
    ProgressBar pbar = null;
    if (!this.isCommand && !this.isYixinglu) {
      pbar = new ProgressBar();
    }

    boolean show = ItemValue.getShowDialogMessage();
    ItemValue.setShowDialogMessage(false);
    String msg = "";
    inputPath = pathSelect.getInputPath();
    outputPath = pathSelect.getOutputPath();
    name = jTextField1.getText();
    number = jTextField2.getText();

    gradeStr =
        (jCheckBox1.isSelected() ? "国道|" : "") +
        (jCheckBox2.isSelected() ? "省道|" : "") +
        (jCheckBox3.isSelected() ? "县道|" : "") +
        (jCheckBox4.isSelected() ? "乡道|" : "") +
        (jCheckBox5.isSelected() ? "村道|" : "") +
        (jCheckBox6.isSelected() ? "专用道路|" : "");
    levelStr =
        (jCheckBox7.isSelected() ? "高速|" : "") +
        (jCheckBox8.isSelected() ? "一级|" : "") +
        (jCheckBox9.isSelected() ? "二级|" : "") +
        (jCheckBox10.isSelected() ? "三级|" : "") +
        (jCheckBox11.isSelected() ? "四级|" : "") +
        (jCheckBox12.isSelected() ? "等外|" : "");
    surfaceStr =
        (jCheckBox13.isSelected() ? "水泥|" : "") +
        (jCheckBox14.isSelected() ? "油路|" : "") +
        (jCheckBox15.isSelected() ? "砂石路|" : "") +
        (jCheckBox16.isSelected() ? "土路|" : "") +
        (jCheckBox17.isSelected() ? "无路面|" : "");

    wayPointKPStr =
        (jCheckBox18.isSelected() ? "行政村|" : "") +
        (jCheckBox19.isSelected() ? "学校|" : "") +
        (jCheckBox20.isSelected() ? "桥梁|" : "") +
        (jCheckBox21.isSelected() ? "隧道|" : "") +
        (jCheckBox21.isSelected() ? "渡口|" : "") +
        (jCheckBox23.isSelected() ? "唯一|" : "");
    notLinkLx =
        (jCheckBox24.isSelected() ? "T型路线|" : "") +
        (jCheckBox25.isSelected() ? "断头路|" : "") +
        (jCheckBox26.isSelected() ? "两端吻合|" : "") +
        (jCheckBox27.isSelected() ? "两端接近|" : "");

    surfaceWidth = jTextField4.getText();
    baseWidth = jTextField3.getText();
    length = jTextField5.getText();

    namePara = (String) jComboBox1.getSelectedItem();
    numberPara = (String) jComboBox2.getSelectedItem();
    lengthPara = (String) jComboBox3.getSelectedItem();

    surfaceWidthPara = (String) jComboBox8.getSelectedItem();
    baseWidthPara = (String) jComboBox9.getSelectedItem();

//    if (inputPath == null || inputPath.length() < 4) {
    msg += (CheckPath.checkInput(inputPath)).trim() + "\n";
//    }
//    String checkinput = (CheckPath.checkInput(this.fwPath[0])).trim();
    msg += (CheckPath.checkOutput(outputPath)).trim() + "\n";
//    }
    if (surfaceWidth.length() > 0) {
      try {
        Float.parseFloat(surfaceWidth);
      }
      catch (NumberFormatException ex) {
        msg += "请正确填写路面宽度,要求为数字\n";
      }
    }
    if (baseWidth.length() > 0) {
      try {
        Float.parseFloat(baseWidth);
      }
      catch (NumberFormatException ex) {
        msg += "请正确填写路基宽度,要求为数字\n";
      }
    }
    if (!"".equals(msg.replaceAll("\\n", "").trim())) {
      if (!this.isCommand && !this.isYixinglu) {
        pbar.dispose();
      }

      msg(msg);
      return;
    }

    gpsFiles = findOutGPSFiles(inputPath);
    String trackName, roadName, trackNumber, trackGrade, trackLevel,
        trackSurface,
        trackSurfaceWidth, trackBaseWidth, trackShi, trackXian, trackXiang,
        trackCun;
    double dis = 0;
    String fileName = outputPath + "搜索结果_" + System.currentTimeMillis() +
        ".csv";
    if (this.isYixinglu) {
      fileName = outputPath + "年报核对表\\程序输出信息\\5_异型路.txt";
      try {
        (new File(fileName)).getParentFile().mkdirs();
      }
      catch (Exception ex2) {
      }
    }
    try {
      PrintStream out = new PrintStream(new BufferedOutputStream(new
          FileOutputStream(fileName)));

      String shiname = "";

      if (this.isCommand) {
        Node[] preTracks = null, newTracks;
        for (int i = 0; gpsFiles != null && i < gpsFiles.size(); i++) {

          fo.openFile( (File) gpsFiles.get(i));
          newTracks = this.getNewTracks(preTracks);
          preTracks = ItemValue.getTracks();
          this.refreshShuxing( (File) gpsFiles.get(i), newTracks);
        }
        Node[] tracks = ItemValue.getTracks();
        Across cross = new Across();
        ConcatenatedTrack.setIsInosculate(false);
        cross.initAcrossTrks();


        for (int j = 0; tracks != null && j < tracks.length; j++) {
          TrackTableName rodeName = new TrackTableName(tracks[j]);
          trackShi = ItemValue.getTracksT1(tracks[j]);
          trackXian = ItemValue.getTracksT2(tracks[j]);
          trackXiang = ItemValue.getTracksT3(tracks[j]);
          trackCun = ItemValue.getTracksT4(tracks[j]);

          trackName = ItemValue.getTracksName(tracks[j]);
          roadName = rodeName.getStartEndName();
          trackNumber = ItemValue.getTracksNumber(tracks[j]);
          trackGrade = ItemValue.getTracksGrade(tracks[j]);
          trackLevel = ItemValue.getTracksT5(tracks[j]);
          trackSurface = ItemValue.getTracksType(tracks[j]);

          trackSurfaceWidth = ItemValue.getTracksWidth(tracks[j]);
          trackBaseWidth = ItemValue.getTracks_jitongbu_luji_With(tracks[j]);

          dis = ItemValue.getTracksDistance(tracks[j]) / 1000;

          if (
              //村道
//              (
//                  ItemValue.getTracksGrade(tracks[j]).trim().equals(TrackType.
//              Grade_CUN)
//              )
//              &&
              // name
              (name.length() == 0 ||
               (
                   ("等于".equals(namePara) && name.equalsIgnoreCase(trackName)) ||
                   ("包含".equals(namePara) && trackName.indexOf(name) > -1)
               )
              ) &&
              // number
              (number.length() == 0 ||
               (
                   ("等于".equals(numberPara) &&
                    name.equalsIgnoreCase(trackNumber)) ||
                   ("包含".equals(numberPara) &&
                    trackNumber.indexOf(number) > -1)
               )
              )
//              && // 行政等级
//              (
//                  gradeStr.length() == 0 ||
//                  gradeStr.indexOf(trackGrade) > -1
//              )
              && // 技术等级
              (
                  levelStr.length() == 0 ||
                  levelStr.indexOf(trackLevel) > -1
              ) && // 路面类型
              (
                  surfaceStr.length() == 0 ||
                  surfaceStr.indexOf(trackSurface) > -1
              ) && // 路面宽度
              (
                  surfaceWidth.length() == 0 ||
                  check(trackSurfaceWidth, surfaceWidthPara, surfaceWidth)
              ) && // 路基宽度
              (
                  baseWidth.length() == 0 ||
                  check(trackBaseWidth, baseWidthPara, baseWidth)
              ) && // 路线里程
              (
                  length.length() == 0 ||
                  check("" + dis, lengthPara, length)
              ) && // 包含航点
              (
                  wayPointKPStr.length() == 0 ||
                  checkWP(tracks[j], wayPointKPStr)
              )
              && // 异型路
              (   (!this.isYixinglu) ||(this.isYixinglu &&
                (this.checkIsYixingLx(tracks[j],cross) || this.checkIsDuantouLx(tracks[j],cross))
                )
              )

              ) {
            shiname = ItemValue.getTracksT1(tracks[j]);
            SearchItem.addLuduan(ItemValue.getTracksT2(tracks[j]),
                                 dis);
            if (!this.isYixinglu) {
              out.println("\"" + trackShi + "\",\"" +
                          trackXian + "\",\"" +
                          trackXiang + "\",\"" +
                          trackCun + "\",\"" +
                          trackNumber + "\",\"" +
                          trackName + "\",\"" +
                          roadName + "\",\"" +

                          trackGrade + "\",\"" +
                          trackLevel + "\",\"" +
                          trackSurface + "\",\"" +
                          trackSurfaceWidth + "\",\"" +
                          trackBaseWidth + "\",\"" +
                          dis + "\""
                  );
            }

          }
        }
        fo.reset();
        if (!this.isYixinglu) {
          SearchItem.createFile(outputPath + shiname + "_" +
                                System.currentTimeMillis() + ".txt");
        }
      }
      else {

        for (int i = 0; gpsFiles != null && i < gpsFiles.size(); i++) {
          fo.openFile( (File) gpsFiles.get(i));
          Node[] tracks = ItemValue.getTracks();
          boolean isThisFileYixing = false;

          Across cross = new Across();
          if (this.jCheckBox24.isSelected() || this.jCheckBox25.isSelected()) {
            if (this.jCheckBox26.isSelected()) {
              ConcatenatedTrack.setIsInosculate(true);
            }
            cross.initAcrossTrks();
          }
          if (this.isYixinglu) {
            ConcatenatedTrack.setIsInosculate(false);
            cross.initAcrossTrks();
          }

          for (int j = 0; tracks != null && j < tracks.length; j++) {
            TrackTableName rodeName = new TrackTableName(tracks[j]);
            trackShi = ItemValue.getTracksT1(tracks[j]);
            trackXian = ItemValue.getTracksT2(tracks[j]);
            trackXiang = ItemValue.getTracksT3(tracks[j]);
            trackCun = ItemValue.getTracksT4(tracks[j]);

            trackName = ItemValue.getTracksName(tracks[j]);
            roadName = rodeName.getStartEndName();
            trackNumber = ItemValue.getTracksNumber(tracks[j]);
            trackGrade = ItemValue.getTracksGrade(tracks[j]);
            trackLevel = ItemValue.getTracksT5(tracks[j]);
            trackSurface = ItemValue.getTracksType(tracks[j]);

            trackSurfaceWidth = ItemValue.getTracksWidth(tracks[j]);
            trackBaseWidth = ItemValue.getTracks_jitongbu_luji_With(tracks[j]);

            dis = ItemValue.getTracksDistance(tracks[j]) / 1000;

            if (

                (
                    this.isCundaoTrk( (File) gpsFiles.get(i)) ||
                    (!this.isCommand)
                )
                &&
                // name
                (name.length() == 0 ||
                 (
                     ("等于".equals(namePara) && name.equalsIgnoreCase(trackName)) ||
                     ("包含".equals(namePara) && trackName.indexOf(name) > -1)
                 )
                ) &&
                // number
                (number.length() == 0 ||
                 (
                     ("等于".equals(numberPara) &&
                      name.equalsIgnoreCase(trackNumber)) ||
                     ("包含".equals(numberPara) &&
                      trackNumber.indexOf(number) > -1)
                 )
                )
//              && // 行政等级
//              (
//                  gradeStr.length() == 0 ||
//                  gradeStr.indexOf(trackGrade) > -1
//              )
                && // 技术等级
                (
                    levelStr.length() == 0 ||
                    levelStr.indexOf(trackLevel) > -1
                ) && // 路面类型
                (
                    surfaceStr.length() == 0 ||
                    surfaceStr.indexOf(trackSurface) > -1
                ) && // 路面宽度
                (
                    surfaceWidth.length() == 0 ||
                    check(trackSurfaceWidth, surfaceWidthPara, surfaceWidth)
                ) && // 路基宽度
                (
                    baseWidth.length() == 0 ||
                    check(trackBaseWidth, baseWidthPara, baseWidth)
                ) && // 路线里程
                (
                    length.length() == 0 ||
                    check("" + dis, lengthPara, length)
                ) && // 包含航点
                (
                    wayPointKPStr.length() == 0 ||
                    checkWP(tracks[j], wayPointKPStr)
                ) && // 非连续路线
                (
                    notLinkLx.length() == 0 ||
                    checkNotLinkLx(tracks[j], notLinkLx, cross)
                )
                  && // 异型路
              (   (!this.isYixinglu) ||(this.isYixinglu &&
                 (this.checkIsYixingLx(tracks[j],cross) || this.checkIsDuantouLx(tracks[j],cross)))
              )

                ) {
              if (!this.isYixinglu) {
                out.println("\"" + trackShi + "\",\"" +
                            trackXian + "\",\"" +
                            trackXiang + "\",\"" +
                            trackCun + "\",\"" +
                            trackNumber + "\",\"" +
                            trackName + "\",\"" +
                            roadName + "\",\"" +
                            trackGrade + "\",\"" +
                            trackLevel + "\",\"" +
                            trackSurface + "\",\"" +
                            trackSurfaceWidth + "\",\"" +
                            trackBaseWidth + "\",\"" +
                            dis + "\""
                    );
              }
              else {
              isThisFileYixing = true;
              String yixing = "";
              if (this.checkIsYixingLx(tracks[j],cross)) {
                yixing = "异型路";
              }else if(this.checkIsDuantouLx(tracks[j],cross)){
                yixing = "断头路";
              }
              out.println(trackShi + "\t" +
                          trackXian + "\t" +
                          trackXiang + "\t" +
                          trackCun + "\t" +

                          trackName + "\t" +
                          roadName + "\t" +

                          trackNumber + "\t" +

                          trackGrade + "\t" +
                          trackLevel + "\t" +
                          trackSurface + "\t" +
                          trackSurfaceWidth + "\t" +
                          trackBaseWidth + "\t" +
                          dis + "\t" + yixing
                  );
            }

            }
          }

          if (isThisFileYixing && this.isYixinglu) {
            String myoutput = outputPath + "年报核对表\\异型路路线示意图\\";
            new ToJPG().generateJPG(tracks,new File(myoutput+((File) gpsFiles.get(i)).getName().toUpperCase().replaceAll(".GPS","")+".jpg"));
          }
          fo.reset();
        }
      }
      out.flush();
      out.close();

      if (!this.isCommand && !this.isYixinglu) {
        pbar.dispose();
        msg("运行结束,结果文件是: \n" + fileName);
      }
      //end search
      ItemValue.setShowDialogMessage(show);
    }
    catch (FileNotFoundException ex1) {
      msg("运行出错了,无法写入文件: \n" + fileName);
//      System.out.println("File not found!");

⌨️ 快捷键说明

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