コード例 #1
0
  private static void export(
      GeoSetExporter exporter, GeoSet geoSet, String filePath, ProgressIndicator progressIndicator)
      throws IOException {

    // export the GeoSet to the file
    if (progressIndicator != null) {
      exporter.setProgressIndicator(progressIndicator);
      progressIndicator.start();
    }
    exporter.export(geoSet, filePath);

    // FIXME this is an ugly hack !!! ???
    if (exporter instanceof TableLinkExporter) {

      TableLinkExporter tableLinkExporter = (TableLinkExporter) exporter;
      TableLink tableLink = null;

      if (geoSet instanceof GeoMap && ((GeoMap) geoSet).tableLinkGetNumber() > 0) {
        tableLink = ((GeoMap) geoSet).tableLinkGet(0); // !!! ???
      } else {
        ika.table.Table table = new ika.table.Table("US-ASCII");
        table.setName("table");
        table.addColumn("ID");
        final int rowCount = tableLinkExporter.getFeatureCount();
        for (int i = 0; i < rowCount; i++) {
          table.addRow(new Object[] {new Double(i)});
        }
        tableLink = new TableLink(table, geoSet);
      }
      tableLinkExporter.exportTableForGeometry(filePath, tableLink);
    }
  }
コード例 #2
0
  public static void main(String args[]) throws IOException {
    LoaderOptions options = LoaderOptions.parseArgs(args);
    try {
      SSTableLoader loader =
          new SSTableLoader(options.directory, new ExternalClient(options), options);
      SSTableLoader.LoaderFuture future = loader.stream(options.ignores);

      if (options.noProgress) {
        future.get();
      } else {
        ProgressIndicator indicator = new ProgressIndicator(future.getPendingFiles());
        indicator.start();
        System.out.println("");
        while (!future.isDone()) {
          if (indicator.printProgress()) {
            // We're done with streaming
            System.out.println("\nWaiting for targets to rebuild indexes ...");
            future.get();
            assert future.isDone();
          } else {
            try {
              Thread.sleep(1000L);
            } catch (Exception e) {
            }
          }
        }
      }

      System.exit(0); // We need that to stop non daemonized threads
    } catch (Exception e) {
      System.err.println(e.getMessage());
      if (options.debug) e.printStackTrace(System.err);
      System.exit(1);
    }
  }
コード例 #3
0
    protected GeoSet doInBackground() throws Exception {
      try {

        progressIndicator.start();
        this.setProgress(0);
        GeoExportGUI.export(exporter, geoSet, filePath, progressIndicator);

        return null;

      } catch (Exception e) {

        e.printStackTrace();

        // this will be executed in the event dispatching thread.
        ika.utils.ErrorDialog.showErrorDialog("The file could not be exported.", e);
        throw e;
      } finally {
        progressIndicator.complete();
      }
    }