Class ExportableAnalyticSurface
- java.lang.Object
-
- gov.nasa.worldwindx.examples.analytics.AnalyticSurface
-
- gov.nasa.worldwindx.examples.analytics.ExportableAnalyticSurface
-
- All Implemented Interfaces:
Exportable
,PreRenderable
,Renderable
public class ExportableAnalyticSurface extends AnalyticSurface implements Exportable
An extension of AnalyticSurface that enables export of the surface to a KML ground overlay. To successfully export the surface, the export image path and export image name fields of instances of this class must be specified.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nasa.worldwindx.examples.analytics.AnalyticSurface
AnalyticSurface.AnalyticSurfaceObject, AnalyticSurface.ClampToGroundSurface, AnalyticSurface.GridPointAttributes, AnalyticSurface.OrderedSurface, AnalyticSurface.RenderInfo, AnalyticSurface.ShadowSurface
-
-
Field Summary
Fields Modifier and Type Field Description protected int
exportImageHeight
protected java.lang.String
exportImageName
protected java.lang.String
exportImagePath
protected int
exportImageWidth
-
Fields inherited from class gov.nasa.worldwindx.examples.analytics.AnalyticSurface
altitude, altitudeMode, clampToGroundSurface, clientLayer, DEFAULT_ALTITUDE, DEFAULT_ALTITUDE_MODE, DEFAULT_COLOR, DEFAULT_DIMENSION, DEFAULT_GRID_POINT_ATTRIBUTES, DEFAULT_VALUE, expired, extremeValues, globeStateKey, height, pickObject, pickSupport, referencePoint, referencePos, regenTime, RELATIVE_TO_GROUND_REGEN_PERIOD, sector, shadowSurface, surfaceAttributes, surfaceRenderInfo, updateFailed, values, verticalScale, visible, width
-
Fields inherited from interface gov.nasa.worldwind.Exportable
FORMAT_NOT_SUPPORTED, FORMAT_PARTIALLY_SUPPORTED, FORMAT_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description ExportableAnalyticSurface()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImage
createImage(int imageWidth, int imageHeight)
Create an exportable image from this surface's colors and attributes.void
export(java.lang.String mimeType, java.lang.Object output)
Export's this surface's color values as a KML GroundOverlay.protected void
exportAsKML(java.lang.Object output)
Export the surface image to KML as a<GroundOverlay>
element.protected void
exportKMLLatLonBox(javax.xml.stream.XMLStreamWriter xmlWriter)
int
getExportImageHeight()
Indicates the image height of the ground overlay image when this surface is exported to KML.java.lang.String
getExportImageName()
Indicates the name to give this surface's ground overlay image when the surface is exported to KML.java.lang.String
getExportImagePath()
Indicates the directory in which this surface's export image is stored when exporting to KML.int
getExportImageWidth()
Indicates the image width of the ground overlay image when this surface is exported to KML.java.lang.String
isExportFormatSupported(java.lang.String format)
Does this object support a certain export format?void
setExportImageHeight(int exportImageHeight)
Specifies the image width of the ground overlay image when this surface is exported to KML.void
setExportImageName(java.lang.String exportImageName)
Specifies the name of the ground overlay image file to create when this surface is exported to KML.void
setExportImagePath(java.lang.String path)
Specifies the path at which to write this surface's exported image.void
setExportImageWidth(int exportImageWidth)
Specifies the image width of the ground overlay image when this surface is exported to KML.-
Methods inherited from class gov.nasa.worldwindx.examples.analytics.AnalyticSurface
beginDrawing, bind, computeExtremeValues, computeExtremeValues, computeSurfacePoint, createClampToGroundSurface, createColorGradientAttributes, createColorGradientValues, createDefaultValues, createGridPointAttributes, createShadowSurface, doDrawOrderedRenderable, doUpdate, drawInterior, drawOrderedRenderable, drawOutline, drawSurfaceObjects, endDrawing, getAltitude, getAltitudeMode, getClientLayer, getDimensions, getExtent, getPickObject, getSector, getSurfaceAttributes, getValues, getVerticalScale, intersectsFrustum, isExpired, isVisible, makeOrderedRenderable, preRender, preRenderSurfaceObjects, render, setAltitude, setAltitudeMode, setClientLayer, setDimensions, setExpired, setPickObject, setSector, setSurfaceAttributes, setValues, setVerticalScale, setVisible, update, updateNextSurfacePoint, updateSurfaceNormals, updateSurfacePoints
-
-
-
-
Method Detail
-
setExportImagePath
public void setExportImagePath(java.lang.String path)
Specifies the path at which to write this surface's exported image. Used only when exporting this surface as a KML ground overlay. This path should generally identify the directory holding the KML file that is being created. The exportImageName field must also be set. SeesetExportImageName(String)
.- Parameters:
path
- The directory in which to store the exported ground overlay image. This field must be non-null when this surface is exported.- See Also:
setExportImageName(String)
-
getExportImagePath
public java.lang.String getExportImagePath()
Indicates the directory in which this surface's export image is stored when exporting to KML.- Returns:
- This surface's export image path.
-
getExportImageName
public java.lang.String getExportImageName()
Indicates the name to give this surface's ground overlay image when the surface is exported to KML.- Returns:
- This surface's export image name.
-
setExportImageName
public void setExportImageName(java.lang.String exportImageName)
Specifies the name of the ground overlay image file to create when this surface is exported to KML. The exported image is written to a file with this name in the directory identified by this surface's exportImagePath field.- Parameters:
exportImageName
- The name of the file in which to write the exported image. This field must be non-null when this surface is exported.- See Also:
setExportImagePath(String)
-
getExportImageWidth
public int getExportImageWidth()
Indicates the image width of the ground overlay image when this surface is exported to KML. The default is 1024.- Returns:
- The export image width.
-
setExportImageWidth
public void setExportImageWidth(int exportImageWidth)
Specifies the image width of the ground overlay image when this surface is exported to KML. The default is 1024.- Parameters:
exportImageWidth
- The export image width.
-
getExportImageHeight
public int getExportImageHeight()
Indicates the image height of the ground overlay image when this surface is exported to KML. The default is 1024.- Returns:
- The export image height.
-
setExportImageHeight
public void setExportImageHeight(int exportImageHeight)
Specifies the image width of the ground overlay image when this surface is exported to KML. The default is 1024.- Parameters:
exportImageHeight
- The export image height.
-
export
public void export(java.lang.String mimeType, java.lang.Object output) throws java.io.IOException
Export's this surface's color values as a KML GroundOverlay. Only this surface's color values, outline color and outline width are used to create the ground overly image. The image is exported as clamp-to-ground. The following fields of this surface must be set prior to calling this method: exportImagePath and exportImageName. Optionally the exportImageWidth and exportImageHeight fields may be set to indicate the size of the exported ground overlay image. These values are both 1024 by default. The surface's opacity attributes are ignored, but any opacity values specified in the surface's color values are captured in the ground overlay image.If color values have not been specified for the surface then the interior if the output image is blank. The image outline is exported only if the surface's drawOutline file is true.
- Specified by:
export
in interfaceExportable
- Parameters:
mimeType
- Desired export format. Only "application/vnd.google-earth.kml+xml" is supported.output
- Object that will receive the exported data. The type of this object depends on the export format. All formats should supportjava.io.OutputStream
. Text based format (for example, XML formats) should also supportjava.io.Writer
. Certain formats may also support other object types.- Throws:
java.io.IOException
- if an error occurs while writing the output file or its image.- See Also:
setExportImageName(String)
,setExportImagePath(String)
,setExportImageWidth(int)
,setExportImageHeight(int)
-
isExportFormatSupported
public java.lang.String isExportFormatSupported(java.lang.String format)
Description copied from interface:Exportable
Does this object support a certain export format?- Specified by:
isExportFormatSupported
in interfaceExportable
- Parameters:
format
- Desired export format.- Returns:
- One of
Exportable.FORMAT_SUPPORTED
,Exportable.FORMAT_NOT_SUPPORTED
, orExportable.FORMAT_PARTIALLY_SUPPORTED
. - See Also:
Exportable.export(String, Object)
-
exportAsKML
protected void exportAsKML(java.lang.Object output) throws java.io.IOException, javax.xml.stream.XMLStreamException
Export the surface image to KML as a<GroundOverlay>
element. Theoutput
object will receive the data. This object must be one of: java.io.Writer java.io.OutputStream javax.xml.stream.XMLStreamWriter- Parameters:
output
- Object to receive the generated KML.- Throws:
javax.xml.stream.XMLStreamException
- If an exception occurs while writing the KMLjava.io.IOException
- if an exception occurs while exporting the data.
-
exportKMLLatLonBox
protected void exportKMLLatLonBox(javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
createImage
public java.awt.image.BufferedImage createImage(int imageWidth, int imageHeight)
Create an exportable image from this surface's colors and attributes. Note that only the surface's color values used to draw the interior, the surface's interior material attribute is ignored. Also ignored are the surface's opacity and shadow attributes.- Parameters:
imageWidth
- The width of the image to create.imageHeight
- The height of the image to create.- Returns:
- An ARGB image reflecting this surface's color values and outline attributes.
-
-