public abstract class AbstractImageFormatter extends java.lang.Object implements ImageFormatter, PropertyConsumer, java.beans.PropertyChangeListener
Modifier and Type | Field and Description |
---|---|
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 |
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
Constructor and Description |
---|
AbstractImageFormatter() |
Modifier and Type | Method and Description |
---|---|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContentType, getFormatLabel
protected java.awt.image.BufferedImage bufferedImage
protected java.lang.String propertiesPrefix
protected Layer[] layers
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 scalepublic 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 BufferedImageBufferedImage
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
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details