Esempio n. 1
0
  /** 从plt中读取数据,并写入到mysql数据库中 */
  private static void loadData() {
    // TODO Auto-generated method stub

    MyDataBase dataBase = new MyDataBase();
    String path = MyConstant.filePath + "Data";
    gps.getFiles(path);
    gps.fileCount();
    ArrayList<FileAtrribute> filelist = gps.getFilelist();

    TimeThread myThread = new TimeThread();
    myThread.start();

    myThread.setTotalNum(filelist.size());
    for (int i = 0; i < filelist.size(); i++) {
      FileAtrribute file = filelist.get(i);
      List<GPSpoint> gPSpoints = gps.readTextFile(file.getFilePath(), file.getFileNum());
      if (gPSpoints.size() == 0) {
        continue;
      } else {
        dataBase.insertGPSdata(gPSpoints);
      }
      myThread.setI(i);
    }
    // 关掉线程
    myThread.setFlag(true);
  }
Esempio n. 2
0
  public void startTime() {
    if (thread != null && thread.running) stopTime();

    thread = new TimeThread();
    thread.start();
  }