public void run() { try { Ut.print("___________________________________________"); Ut.print(" o Writing file : " + filename + " in progress..."); Ut.print("..."); pb.setValue(0); BufferedWriter out = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(new File(filename)), "UTF-8")); out.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"); HoloTrack tk = gp.tracks.get(tkNum); HoloTraj ht = tk.getHoloTraj(tjNum).dupliquer(); ht.shiftDates(-ht.getFirstDate()); out.write(ht.toICSTFile()); pb.inc(gp.tracks.get(tkNum).getHoloTraj(tjNum).size()); out.close(); pb.dispose(); Ut.print(" v File was successfully written"); Ut.print("___________________________________________"); } catch (IOException ioe) { ioe.printStackTrace(); } }
public ICSTFileWriter(GestionPistes _gp, String fi, int _tk, int _seq) { gp = _gp; filename = fi; tkNum = _tk; tjNum = _seq; max = gp.tracks.get(tkNum).getHoloTraj(tjNum).size(); pb = new ProgressBar("Exporting..."); pb.setMaximum(max); pb.open(); runner = new Thread(this); runner.setName("ICST-writer"); runner.start(); try { while (runner.isAlive()) { // System.out.println("tj-writer-waiting"); pb.repaint(); Thread.sleep(100); } } catch (InterruptedException e) { } }