|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.omGraphics.geom.BasicGeometry com.bbn.openmap.omGraphics.OMGraphicAdapter com.bbn.openmap.omGraphics.OMRasterObject com.bbn.openmap.omGraphics.OMRaster
public class OMRaster
The OMRaster object lets you create multi-colored images. An image is a two dimensional array of pixel values that correspond to some color values. The pixels are used from the top left, across each row to the right, down to the bottom row.
There are two colormodels that are implemented in OMRaster - the direct colormodel and the indexed colormodel. The direct colormodel is implemented when the pixel values contain the actual java.awt.Color values for the image. The indexed colormodel is implemented when the pixel values are actually indexes into an array of java.awt.Colors. NOTE: The direct colormodel OMRaster is faster to display, because it doesn't need to take the time to resolve the colortable values into pixels.
For direct colormodel images: If you pass in a null pix or a pix with a zero length, the object will create the pixels for you but will not general a renderable version of the object. You will need to call render before generate after the pixels have been set. This feature is for cached rasters, where the content may be changed later. Use this (null pix) if you are building images in a cache, for tiled mapping data or something else where the data is not yet known. The memory for the pixels will be allocated, and then they can be set with image data later when a database is accessed.
For ImageIcon OMRasters: Using an ImageIcon to create an OMRaster gives you the ability to put an image on the screen based on an ImageIcon made from file or URL. The OMRaster uses this ImageIcon as is - there is no opportunity to change any parameters of this image. So set the colors, transparency, etc. before you create the OMRaster.
For indexed colormodel images: If you pass in an empty byte array, a byte array will be created based on the width and height. You will have to resolve empty colortables and set the pixels later. Use this method (null bytes) if you are building images in a cache, for tiled mapping data or something else where the data is not yet known. The memory for the pixels will be allocated, and then they can be set with image data later when a database is accessed. There is the ability to add a filter to the image, to change it's appearance for rendering. The most common filter, which is included as a kind of default, is the scale filter. Filtering the OMRasterObject replaces the bitmap variable, which is the internal java.awt.Image used for rendering. For OMRasters created with pixels, or with the colortable and the colortable index, the original data is left intact, and can be recreated later, or rescaled on the fly, because the internal bitmap will be recreated prior to re-scaling. For OMRasters created by ImageIcons or Images, though, you'll need to hold on to the original Image. The internal version is replaced by the filtered version.
OMRasterObject
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
---|
OMRasterObject.TrimScaleFilter |
Field Summary | |
---|---|
protected int[] |
colors
The integer colors that are needed in a java colortable. |
protected int |
transparent
The transparency of the image. |
Fields inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
---|
bitmap, bits, colorModel, COLORMODEL_DIRECT, COLORMODEL_IMAGEICON, COLORMODEL_INDEXED, DEBUG, FAST_SCALING, filteredHeight, filteredWidth, height, imageFilter, lat, logger, lon, needToReposition, pixels, point1, point2, renderRotationAngle, rotationAngle, SMOOTH_SCALING, width, x, y |
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter |
---|
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask |
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
---|
attributes, lineType, needToRegenerate, shape, visible |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
OMRaster()
Construct a blank OMRaster, to be filled in with setX calls. |
|
OMRaster(double lt,
double ln,
java.awt.Image ii)
Create an OMRaster, Lat/Lon placement with an Image. |
|
OMRaster(double lt,
double ln,
javax.swing.ImageIcon ii)
Create an OMRaster, Lat/Lon placement with an ImageIcon. |
|
OMRaster(double lt,
double ln,
int w,
int h,
byte[] bytes,
java.awt.Color[] colorTable,
int trans)
Lat/Lon placement with a indexed colormodel, which is using a colortable and a byte array to construct the int[] pixels. |
|
OMRaster(double lt,
double ln,
int offset_x1,
int offset_y1,
java.awt.Image ii)
Create an OMRaster, Lat/Lon with X/Y placement with an Image. |
|
OMRaster(double lt,
double ln,
int offset_x1,
int offset_y1,
javax.swing.ImageIcon ii)
Create an OMRaster, Lat/Lon with X/Y placement with an ImageIcon. |
|
OMRaster(double lt,
double ln,
int w,
int h,
int[] pix)
Creates an OMRaster images, Lat/Lon placement with a direct colormodel. |
|
OMRaster(double lt,
double ln,
int offset_x1,
int offset_y1,
int w,
int h,
byte[] bytes,
java.awt.Color[] colorTable,
int trans)
Lat/lon placement with XY offset with a indexed colormodel, which is using a colortable and a byte array to construct the int[] pixels. |
|
OMRaster(double lt,
double ln,
int offset_x1,
int offset_y1,
int w,
int h,
int[] pix)
Create an OMRaster, Lat/lon placement with XY offset with a direct colormodel. |
|
OMRaster(int x1,
int y1,
java.awt.Image ii)
Create an OMRaster image, X/Y placement with an Image. |
|
OMRaster(int x1,
int y1,
javax.swing.ImageIcon ii)
Create an OMRaster image, X/Y placement with an ImageIcon. |
|
OMRaster(int x1,
int y1,
int w,
int h,
byte[] bytes,
java.awt.Color[] colorTable,
int trans)
XY placement with a indexed colormodel, which is using a colortable and a byte array to construct the int[] pixels. |
|
OMRaster(int x1,
int y1,
int w,
int h,
int[] pix)
Create an OMRaster image, XY placement with a direct colormodel. |
Method Summary | |
---|---|
protected int[] |
computePixels(byte[] bits)
Compute pixels is the function that resolves the color table into pixel integer values used in the Image. |
protected void |
evaluateRotationAngle(Projection proj)
Set the renderRotationAngle based on the projection angle and OMRaster settings. |
boolean |
generate(Projection proj)
Prepare the graphics for rendering. |
protected java.awt.Image |
getBitmapFromInternalData()
|
byte |
getByte(int x,
int y)
Get image byte data, which the index to a colortable for indexed images. |
int[] |
getColors()
Get the array of colors used in the indexed color model. |
int |
getPixel(int x,
int y)
Get the image pixel value at a location. |
int |
getTransparent()
Get the transparent setting of the image. |
void |
restore(OMGeometry source)
Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one. |
void |
setBits(byte[] values)
Set the bytes used to create the pixels used to create the image. |
boolean |
setByte(int x,
int y,
byte ctIndex)
Set image byte data, for index frame using colortable. |
void |
setColors(java.awt.Color[] values)
Set the color table according to the java.awt.Color array passed in. |
void |
setColors(int[] values)
Set the color table to the int RGB values passed in. |
void |
setImageIcon(javax.swing.ImageIcon img)
Set the ImageIcon. |
boolean |
setPixel(int x,
int y,
int colorValue)
Set the image pixel value at a location. |
void |
setTransparent(int value)
Set the transparency of the index type images. |
Methods inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
---|
adjustShapeForRotation, filterImage, getBits, getColorModel, getFilteredHeight, getFilteredWidth, getHeight, getImage, getImageFilter, getLat, getLon, getMapLocation, getNeedToReposition, getPixels, getRotationAngle, getWidth, getX, getY, hasLineTypeChoice, imageUpdate, position, regenerate, render, renderImage, rotate, scaleTo, setColorModel, setHeight, setImage, setImageFilter, setLat, setLon, setNeedToReposition, setPixels, setRotationAngle, setShape, setWidth, setX, setY, shouldRenderFill |
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
---|
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.bbn.openmap.omGraphics.OMGraphic |
---|
clone, deselect, getDeclutterType, getDisplayColor, getDisplayPaint, getFillColor, getFillPaint, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, isMatted, isSelected, normalizeDistanceForLineWidth, renderLabel, select, setDeclutterType, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setLabelLocation, setLabelLocation, setLabelLocation, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelected, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge |
Methods inherited from interface com.bbn.openmap.omGraphics.OMGeometry |
---|
clearAttributes, contains, distance, distanceToEdge, draw, draw, fill, fill, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible |
Field Detail |
---|
protected int[] colors
protected int transparent
0 <= transparent <= 255
Constructor Detail |
---|
public OMRaster()
public OMRaster(double lt, double ln, int w, int h, int[] pix)
lt
- latitude of the top of the image.ln
- longitude of the left side of the image.w
- width of the image, in pixels.h
- height of the image, in pixels.pix
- color values for the pixels.setPixel(int, int, int)
public OMRaster(int x1, int y1, int w, int h, int[] pix)
x1
- window location of the left side of the image.y1
- window location of the top of the image.w
- width of the image, in pixels.h
- height of the image, in pixels.pix
- color values for the pixels.setPixel(int, int, int)
public OMRaster(double lt, double ln, int offset_x1, int offset_y1, int w, int h, int[] pix)
lt
- latitude of the top of the image, before the offset.ln
- longitude of the left side of the image, before the offset.offset_x1
- number of pixels to move image to the right.offset_y1
- number of pixels to move image down.w
- width of the image, in pixels.h
- height of the image, in pixels.pix
- color values for the pixels.setPixel(int, int, int)
public OMRaster(double lt, double ln, javax.swing.ImageIcon ii)
lt
- latitude of the top of the image.ln
- longitude of the left side of the image.ii
- ImageIcon used for the image.public OMRaster(double lt, double ln, java.awt.Image ii)
lt
- latitude of the top of the image.ln
- longitude of the left side of the image.ii
- Image used for the image.public OMRaster(int x1, int y1, javax.swing.ImageIcon ii)
x1
- window location of the left side of the image.y1
- window location of the top of the image.ii
- ImageIcon used for the image.public OMRaster(int x1, int y1, java.awt.Image ii)
x1
- window location of the left side of the image.y1
- window location of the top of the image.ii
- Image used for the image.public OMRaster(double lt, double ln, int offset_x1, int offset_y1, javax.swing.ImageIcon ii)
lt
- latitude of the top of the image, before the offset.ln
- longitude of the left side of the image, before the offset.offset_x1
- number of pixels to move image to the right.offset_y1
- number of pixels to move image down.ii
- ImageIcon used for the image.public OMRaster(double lt, double ln, int offset_x1, int offset_y1, java.awt.Image ii)
lt
- latitude of the top of the image, before the offset.ln
- longitude of the left side of the image, before the offset.offset_x1
- number of pixels to move image to the right.offset_y1
- number of pixels to move image down.ii
- Image used for the image.public OMRaster(double lt, double ln, int w, int h, byte[] bytes, java.awt.Color[] colorTable, int trans)
lt
- latitude of the top of the image.ln
- longitude of the left side of the image.w
- width of the image, in pixels.h
- height of the image, in pixels.bytes
- colortable index values for the pixels.colorTable
- color array corresponding to bytestrans
- transparency of image.setPixel(int, int, int)
public OMRaster(int x1, int y1, int w, int h, byte[] bytes, java.awt.Color[] colorTable, int trans)
x1
- window location of the left side of the image.y1
- window location of the top of the image.w
- width of the image, in pixels.h
- height of the image, in pixels.bytes
- colortable index values for the pixels.colorTable
- color array corresponding to bytestrans
- transparency of image.setPixel(int, int, int)
public OMRaster(double lt, double ln, int offset_x1, int offset_y1, int w, int h, byte[] bytes, java.awt.Color[] colorTable, int trans)
lt
- latitude of the top of the image, before the offset.ln
- longitude of the left side of the image, before the offset.offset_x1
- number of pixels to move image to the right.offset_y1
- number of pixels to move image down.w
- width of the image, in pixels.h
- height of the image, in pixels.bytes
- colortable index values for the pixels.colorTable
- color array corresponding to bytestrans
- transparency of image.setPixel(int, int, int)
Method Detail |
---|
public void setImageIcon(javax.swing.ImageIcon img)
img
- ImageIconpublic boolean setPixel(int x, int y, int colorValue)
x
- Horizontal location of pixel from left.y
- Vertical location of pixel from top.colorValue
- the color value of the pixel.
public int getPixel(int x, int y)
x
- Horizontal location of pixel from left.y
- Vertical location of pixel from top.
public boolean setByte(int x, int y, byte ctIndex)
x
- Horizontal location of pixel from left.y
- Vertical location of pixel from top.ctIndex
- The array index of the applicable color in the color
table.
public byte getByte(int x, int y)
x
- Horizontal location of pixel from left.y
- Vertical location of pixel from top.
public void setBits(byte[] values)
setBits
in class OMRasterObject
values
- byte values containing bit pixel values.public void setTransparent(int value)
value
- New value of the alpha value for the image.public int getTransparent()
public void setColors(int[] values)
values
- array of color RGB values.public void setColors(java.awt.Color[] values)
values
- array of java.awt.Color colors.public int[] getColors()
protected int[] computePixels(byte[] bits)
computePixels
in class OMRasterObject
public boolean generate(Projection proj)
generate
in interface OMGeometry
generate
in class OMGraphicAdapter
proj
- Projection used to position the image on the window.
OMGraphicAdapter.regenerate(com.bbn.openmap.proj.Projection)
protected void evaluateRotationAngle(Projection proj)
proj
- the current projection.protected java.awt.Image getBitmapFromInternalData()
public void restore(OMGeometry source)
OMGraphicAdapter
restore
in interface OMGeometry
restore
in class OMRasterObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |