NASA World Wind

gov.nasa.worldwind
Interface Exportable

All Known Subinterfaces:
BalloonAttributes, ShapeAttributes
All Known Implementing Classes:
AbstractGeneralShape, AbstractShape, AntennaAxes, AntennaModel, BasicBalloonAttributes, BasicShapeAttributes, Box, ColladaMeshShape, Cone, Cylinder, DirectedPath, Ellipsoid, ExportableAnalyticSurface, ExtrudedPolygon, KMLExtrudedPolygonImpl, KMLGroundOverlayPolygonImpl, KMLLineStringPlacemarkImpl, KMLPointPlacemarkImpl, KMLPolygonImpl, KMLScreenImageImpl, KMLSurfaceImageImpl, KMLSurfacePolygonImpl, MultiResolutionPath, Path, PointPlacemark, PointPlacemarkAttributes, Polygon, Pyramid, RigidShape, ScreenCreditImage, ScreenImage, SectorSelector.RegionShape, SurfaceImage, SurfacePolygon, SurfacePolyline, SurfaceQuad, SurfaceSector, SurfaceSquare, Wedge

public interface Exportable

Exportable marks an object that can be exported in different data formats. Implementing classes may support one or more export formats. Formats are identified by MIME type. Call isExportFormatSupported(String) to determine if an object supports export in a certain format.

Example of use:

 // Export a PointPlacemark in KML format
 PointPlacemark placemark;
 

StringWriter kml = new StringWriter(); placemark.export(KMLConstants.KML_MIME_TYPE, kml);


Field Summary
static String FORMAT_NOT_SUPPORTED
          Returned by isExportFormatSupported(String) if the object does not support export to the given format.
static String FORMAT_PARTIALLY_SUPPORTED
          Returned by isExportFormatSupported(String) if the object contains some objects that support does not support export to the given format, but others that do not.
static String FORMAT_SUPPORTED
          Returned by isExportFormatSupported(String) if the object does support export to the given format.
 
Method Summary
 void export(String mimeType, Object output)
          Exports the object to a format.
 String isExportFormatSupported(String mimeType)
          Does this object support a certain export format?
 

Field Detail

FORMAT_NOT_SUPPORTED

static final String FORMAT_NOT_SUPPORTED
Returned by isExportFormatSupported(String) if the object does not support export to the given format.

See Also:
Constant Field Values

FORMAT_PARTIALLY_SUPPORTED

static final String FORMAT_PARTIALLY_SUPPORTED
Returned by isExportFormatSupported(String) if the object contains some objects that support does not support export to the given format, but others that do not. For example, a Layer might contain some objects that support the export format, and some that do not.

See Also:
Constant Field Values

FORMAT_SUPPORTED

static final String FORMAT_SUPPORTED
Returned by isExportFormatSupported(String) if the object does support export to the given format.

See Also:
Constant Field Values
Method Detail

export

void export(String mimeType,
            Object output)
            throws IOException,
                   UnsupportedOperationException
Exports the object to a format.

Parameters:
mimeType - Desired export format. Call isExportFormatSupported(String) to make sure that the object supports the format before trying to export, or be prepared to handle UnsupportedOperationException.
output - Object that will receive the exported data. The type of this object depends on the export format. All formats should support java.io.OutputStream. Text based format (for example, XML formats) should also support java.io.Writer. Certain formats may also support other object types.
Throws:
IOException - if an exception occurs while exporting the data.
UnsupportedOperationException - if the format is not supported by this object, or if the output argument is not of a supported type.
See Also:
isExportFormatSupported(String)

isExportFormatSupported

String isExportFormatSupported(String mimeType)
Does this object support a certain export format?

Parameters:
mimeType - Desired export format.
Returns:
One of FORMAT_SUPPORTED, FORMAT_NOT_SUPPORTED, or FORMAT_PARTIALLY_SUPPORTED.
See Also:
export(String, Object)

NASA World Wind