com.bbn.openmap.image
Interface ImageFormatter

All Known Implementing Classes:
AbstractImageFormatter

public interface ImageFormatter

The ImageFormatter deals with most of the image meanderings of Java, while letting you create an image in a specific format.


Method Summary
 byte[] formatImage(java.awt.image.BufferedImage bi)
          Convert a BufferedImage to a image file format...
 java.awt.image.BufferedImage getBufferedImage()
          Return the BufferedImage contained within the formatter.
 java.lang.String getFormatLabel()
          Get the Image Type created by the ImageFormatter.
 java.awt.Graphics getGraphics(int width, int height)
          Return the applicable Graphics to use to paint the layers into.
 byte[] getImageBytes()
          Return the image bytes of the formatted image.
 byte[] getImageFromMapBean(MapBean map)
          Take a MapBean, and get the image bytes that represent the current state.
 java.awt.image.BufferedImage getScaledBufferedImage(int scaledWidth, int scaledHeight)
          Scale the internal BufferedImage to the pixel dimensions, and then return it.
 byte[] getScaledImageBytes(int scaledWidth, int scaledHeight)
          Scale the internal BufferedImage, then return the image bytes of the formatted image.
 ImageFormatter makeClone()
          Create a new instance of the same type of formatter.
 void setBufferedImage(java.awt.image.BufferedImage bi)
          Return the BufferedImage contained within the formatter.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Set the properties of the image formatter.
 

Method Detail

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Set the properties of the image formatter.


makeClone

public ImageFormatter makeClone()
Create a new instance of the same type of formatter. If you are running in a multi-threaded environment, you'll need to provide a new instance of the formatter to each thread, since the image and graphics that are being drawn into for each thread are contained within.

Returns:
a new instance of this type of formatter, with the same properties set.

formatImage

public byte[] formatImage(java.awt.image.BufferedImage bi)
Convert a BufferedImage to a image file format...

Parameters:
bi - a BufferedImage..

getImageFromMapBean

public byte[] getImageFromMapBean(MapBean map)
Take a MapBean, and get the image bytes that represent the current state.

Parameters:
map - the MapBean.
Returns:
byte[] representing an image of the map in it's current state.

getGraphics

public java.awt.Graphics getGraphics(int width,
                                     int height)
Return the applicable Graphics to use to paint the layers into. If the internal BufferedImage hasn't been created yet, or has been set to null, then a new buffered Image is created, set to the size specified by the height and width given. The ImageGenerator extends MapBean. Remember to dispose of the graphics object when you are done with it.

Parameters:
width - pixel width of Graphics.
height - pixel height of Graphics.
Returns:
java.awt.Graphics object to use.

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
Return the BufferedImage contained within the formatter.

Returns:
the BufferedImage.

setBufferedImage

public void setBufferedImage(java.awt.image.BufferedImage bi)
Return the BufferedImage contained within the formatter.

Parameters:
bi - the BufferedImage to use in this formatter.

getScaledBufferedImage

public java.awt.image.BufferedImage getScaledBufferedImage(int scaledWidth,
                                                           int scaledHeight)
Scale the internal BufferedImage to the pixel dimensions, and then return it.

Parameters:
scaledWidth - the desired pixel width of the image.
scaledHeight - the desired pixel height of the image.
Returns:
the scaled BufferedImage.

getImageBytes

public byte[] getImageBytes()
Return the image bytes of the formatted image.

Returns:
byte[] representing the image.

getScaledImageBytes

public byte[] getScaledImageBytes(int scaledWidth,
                                  int scaledHeight)
Scale the internal BufferedImage, then return the image bytes of the formatted image.

Parameters:
scaledWidth - the desired pixel width of the image.
scaledHeight - the desired pixel height of the image.
Returns:
byte[] representing the image.

getFormatLabel

public java.lang.String getFormatLabel()
Get the Image Type created by the ImageFormatter. These responses should adhere to the OGC WMT standard format labels. Some are listed in the WMTConstants interface file.



Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details