|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bbn.openmap.image.AbstractImageFormatter
public abstract class AbstractImageFormatter
The abstract implementation of the ImageFormatter. The ImageFormatter deals with most of the image meanderings of Java, while letting you create an image in a specific format. The ImageFormatter's responsibility has grown slightly, since it now contains the BufferedImage that it will be formatting. Thisis to make things go smoother for different uses of the formatter - some image formats, for instance, really need to utilize a special implementation of a Graphics in order to create the data file they want. The new definition allows for that. Generally, however, you'll want to either hand the MapBean to the formatter to get the image bytes, or, as in the case of the ImageServer, get a Graphics from the formatter, paint the map into it, then retrieve the image bytes after that.
Field Summary | |
---|---|
protected java.awt.image.BufferedImage |
bufferedImage
|
protected Layer[] |
layers
Used when the layers from the MapBean are needed, in order to use the renderDataForProjection method. |
protected java.lang.String |
propertiesPrefix
|
Fields inherited from interface com.bbn.openmap.PropertyConsumer |
---|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty |
Constructor Summary | |
---|---|
AbstractImageFormatter()
|
Method Summary | |
---|---|
abstract 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.awt.Graphics |
getGraphics(int width,
int height)
Return the applicable Graphics to use to paint the layers into. |
java.awt.Graphics |
getGraphics(int width,
int height,
boolean alpha)
|
java.awt.Graphics |
getGraphics(int width,
int height,
int imageType)
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. |
byte[] |
getImageFromMapBean(MapBean map,
int width,
int height)
Take a MapBean, and get the image bytes that represent the current state. |
byte[] |
getImageFromMapBean(MapBean map,
int width,
int height,
boolean scaleImage)
Take a MapBean, and get the image bytes that represent the current state. |
java.util.Properties |
getProperties(java.util.Properties props)
Part of the PropertyConsumer interface. |
java.util.Properties |
getPropertyInfo(java.util.Properties list)
Part of the PropertyConsumer interface. |
java.lang.String |
getPropertyPrefix()
Part of the PropertyConsumer interface. |
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. |
protected abstract boolean |
imageFormatSupportAlphaChannel()
Return true if the image format support alpha channel. |
protected abstract boolean |
imageFormatSupportTransparentPixel()
Return true if the image format support fully transparent pixels. |
abstract ImageFormatter |
makeClone()
Create a new instance of the same type of formatter. |
void |
propertyChange(java.beans.PropertyChangeEvent pce)
Used when the layers from the MapBean are needed, in order to use the renderDataForProjection method. |
void |
setBufferedImage(java.awt.image.BufferedImage bi)
Return the BufferedImage contained within the formatter. |
void |
setProperties(java.util.Properties props)
Set the layers and image type in the properties. |
void |
setProperties(java.lang.String prefix,
java.util.Properties props)
Set the properties of the image formatter. |
void |
setPropertyPrefix(java.lang.String prefix)
Part of the PropertyConsumer interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.bbn.openmap.image.ImageFormatter |
---|
getContentType, getFormatLabel |
Field Detail |
---|
protected java.awt.image.BufferedImage bufferedImage
protected java.lang.String propertiesPrefix
protected Layer[] layers
Constructor Detail |
---|
public AbstractImageFormatter()
Method Detail |
---|
public void setProperties(java.lang.String prefix, java.util.Properties props)
setProperties
in interface ImageFormatter
setProperties
in interface PropertyConsumer
prefix
- a String used by the PropertyConsumer to prepend
to each property value it wants to look up -
setList.getProperty(prefix.propertyKey). If the prefix
had already been set, then the prefix passed in should
replace that previous value.props
- a Properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.public abstract byte[] formatImage(java.awt.image.BufferedImage bi)
formatImage
in interface ImageFormatter
bi
- a BufferedImage..public abstract ImageFormatter makeClone()
makeClone
in interface ImageFormatter
protected abstract boolean imageFormatSupportTransparentPixel()
protected abstract boolean imageFormatSupportAlphaChannel()
public byte[] getImageFromMapBean(MapBean map)
getImageFromMapBean
in interface ImageFormatter
map
- the MapBean.
public byte[] getImageFromMapBean(MapBean map, int width, int height)
map
- the MapBean.width
- the pixel width of the desired image.height
- the pixel height of the desired image.
public byte[] getImageFromMapBean(MapBean map, int width, int height, boolean scaleImage)
map
- the MapBean.width
- the pixel width of the desired image.height
- the pixel height of the desired image.scaleImage
- true to resize image based on scale
public java.awt.Graphics getGraphics(int width, int height)
getGraphics
in interface ImageFormatter
width
- pixel width of Graphics.height
- pixel height of Graphics.
BufferedImage
public java.awt.Graphics getGraphics(int width, int height, boolean alpha)
getGraphics
in interface ImageFormatter
public java.awt.Graphics getGraphics(int width, int height, int imageType)
width
- pixel width of Graphics.height
- pixel height of Graphics.imageType
- image type - see BufferedImage
BufferedImage
public java.awt.image.BufferedImage getBufferedImage()
getBufferedImage
in interface ImageFormatter
public void setBufferedImage(java.awt.image.BufferedImage bi)
setBufferedImage
in interface ImageFormatter
bi
- the BufferedImage to use in this formatter.public java.awt.image.BufferedImage getScaledBufferedImage(int scaledWidth, int scaledHeight)
getScaledBufferedImage
in interface ImageFormatter
scaledWidth
- the desired pixel width of the image.scaledHeight
- the desired pixel height of the image.
public byte[] getImageBytes()
getImageBytes
in interface ImageFormatter
public byte[] getScaledImageBytes(int scaledWidth, int scaledHeight)
getScaledImageBytes
in interface ImageFormatter
scaledWidth
- the desired pixel width of the image.scaledHeight
- the desired pixel height of the image.
public void setProperties(java.util.Properties props)
setProperties
in interface PropertyConsumer
props
- a properties object that the PropertyConsumer
can use to retrieve expected properties it can use for
configuration.public java.util.Properties getProperties(java.util.Properties props)
getProperties
in interface PropertyConsumer
props
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public java.util.Properties getPropertyInfo(java.util.Properties list)
getPropertyInfo
in interface PropertyConsumer
list
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new
Properties object should be created.
public void setPropertyPrefix(java.lang.String prefix)
setPropertyPrefix
in interface PropertyConsumer
prefix
- the prefix String.public java.lang.String getPropertyPrefix()
getPropertyPrefix
in interface PropertyConsumer
public void propertyChange(java.beans.PropertyChangeEvent pce)
propertyChange
in interface java.beans.PropertyChangeListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |