Class ImageFormat

  • Direct Known Subclasses:
    KmzFormat, SimpleFormat

    public abstract class ImageFormat
    extends Object
    Abstract superclass for all image formats. Only one instance of each subclass will be created so subclasses must be thread safe. Subclasses should provide protected default constructors so that they cannot be instantiated directly.
    Author:
    Jon Blower, Guy Griffiths
    • Constructor Detail

      • ImageFormat

        public ImageFormat()
    • Method Detail

      • getSupportedMimeTypes

        public static Set<String> getSupportedMimeTypes()
        Gets the image MIME types that are supported
        Returns:
        the MIME types as a Set of Strings
      • get

        public static ImageFormat get​(String mimeType)
                               throws InvalidFormatException
        Gets an ImageFormat object corresponding with the given MIME type. Note that this does not create a new object with each invocation: only one ImageFormat object is created for each MIME type.
        Parameters:
        mimeType - The MIME type of the requested format
        Returns:
        An ImageFormat object capable of rendering images in the given MIME type
        Throws:
        InvalidFormatException - if the given MIME type is not supported
      • getMimeType

        public abstract String getMimeType()
        Returns the MIME type that is supported by this ImageFormat object.
      • supportsMultipleFrames

        public abstract boolean supportsMultipleFrames()
        Returns true if this image format supports multi-frame animations.
      • supportsFullyTransparentPixels

        public abstract boolean supportsFullyTransparentPixels()
        Returns true if this image format supports fully-transparent pixels.
      • supportsPartiallyTransparentPixels

        public abstract boolean supportsPartiallyTransparentPixels()
        Returns true if this image format supports partially-transparent pixels. If this is true then supportsFullyTransparentPixels() should also be true.
      • requiresLegend

        public abstract boolean requiresLegend()
        Returns true if this image format needs an accompanying legend. This default implementation returns false, but subclasses can override.
        See Also:
        KmzFormat
      • writeImage

        public abstract void writeImage​(List<BufferedImage> frames,
                                        OutputStream out,
                                        String name,
                                        String description,
                                        org.opengis.metadata.extent.GeographicBoundingBox bbox,
                                        List<org.joda.time.DateTime> tValues,
                                        String zValue,
                                        BufferedImage legend,
                                        Integer frameRate)
                                 throws IOException
        Writes the given list of frames to the supplied output stream. If there are multiple frames, the image format must support animations, otherwise an exception is thrown.
        Parameters:
        frames - A List of BufferedImages to plot
        out - The OutputStream to write the resulting image to
        name - The name of the feature being plotted (for KML)
        description - A description of what's being plotted (for KML)
        bbox - The bounding box of the data being plotted
        tValues - The time values corresponding to the frames of data
        zValue - A string representing the elevation of the plotted data
        legend - An image representing the legend
        frameRate - The frame rate to render an animation at
        Throws:
        IOException - If there is a problem writing the data to the OutputStream