コード例 #1
0
  private void saveLayer(java.io.File file, FilePlacement placement, ProgressMonitor monitor) {
    monitor.beginTask(tr("Saving to file."), 1000);

    OsmBuilder builder = new OsmBuilder(placement);
    DataSet data =
        builder.build(
            this.data.getLayers(), OsmBuilder.Mode.Final, monitor.createSubTaskMonitor(500, false));
    OsmDataLayer layer = new OsmDataLayer(data, file.getName(), file);

    monitor.setCustomText(tr(" Writing to file"));
    monitor.setTicks(500);

    OsmExporter exporter = new OsmExporter();

    try {
      exporter.exportData(file, layer);
    } catch (IOException e) {
      // TODO:
    }

    monitor.finishTask();
  }