| 1 | // License: GPL. For details, see LICENSE file.
|
|---|
| 2 | package org.openstreetmap.josm.io.session;
|
|---|
| 3 |
|
|---|
| 4 | import java.awt.Component;
|
|---|
| 5 | import java.io.IOException;
|
|---|
| 6 | import java.util.Collection;
|
|---|
| 7 |
|
|---|
| 8 | import org.openstreetmap.josm.gui.layer.Layer;
|
|---|
| 9 | import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
|
|---|
| 10 | import org.w3c.dom.Element;
|
|---|
| 11 |
|
|---|
| 12 | /**
|
|---|
| 13 | * Session layer exporter.
|
|---|
| 14 | * @since 4685
|
|---|
| 15 | */
|
|---|
| 16 | public interface SessionLayerExporter {
|
|---|
| 17 |
|
|---|
| 18 | /**
|
|---|
| 19 | * Return the Layers, this Layer depends on.
|
|---|
| 20 | * @return the layer dependencies
|
|---|
| 21 | */
|
|---|
| 22 | Collection<Layer> getDependencies();
|
|---|
| 23 |
|
|---|
| 24 | /**
|
|---|
| 25 | * The GUI for exporting this layer.
|
|---|
| 26 | * @return the export panel
|
|---|
| 27 | */
|
|---|
| 28 | Component getExportPanel();
|
|---|
| 29 |
|
|---|
| 30 | /**
|
|---|
| 31 | * Return true, if the layer should be included in the list of exported layers.
|
|---|
| 32 | *
|
|---|
| 33 | * The user can veto this in the export panel.
|
|---|
| 34 | * @return {@code true} if the layer should be included in the list of exported layers, {@code false} otherwise.
|
|---|
| 35 | */
|
|---|
| 36 | boolean shallExport();
|
|---|
| 37 |
|
|---|
| 38 | /**
|
|---|
| 39 | * Return true, if some data needs to be included in the zip archive. This decision depends on the user
|
|---|
| 40 | * selection in the export panel.
|
|---|
| 41 | *
|
|---|
| 42 | * If any layer requires zip, the user can only save as .joz. Otherwise both .jos and .joz are possible.
|
|---|
| 43 | * @return {@code true} if some data needs to be included in the zip archive, {@code false} otherwise.
|
|---|
| 44 | */
|
|---|
| 45 | boolean requiresZip();
|
|---|
| 46 |
|
|---|
| 47 | /**
|
|---|
| 48 | * Save meta data to the .jos file. Return a layer XML element.
|
|---|
| 49 | * Use <code>support</code> to save files in the zip archive as needed.
|
|---|
| 50 | * @param support support class providing export utilities
|
|---|
| 51 | * @return the resulting XML element
|
|---|
| 52 | * @throws IOException if any I/O error occurs
|
|---|
| 53 | */
|
|---|
| 54 | Element export(ExportSupport support) throws IOException;
|
|---|
| 55 | }
|
|---|