|
||||||||||
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
public abstract class OMRasterObject
The OMRasterObject is the parent class for OMRaster and OMBitmap objects. It manages some of the same functions that both classes require in order to create image pixel data from bytes or integers.
An ImageFilter may be applied to OMRasterObjects. These can be scale filters, color filters, or maybe (?hopefully?) projection filters. These filters won't change the original image data, and the original can be reconstructed by resetting the filter to null, and generating the object.
For all classes in the OMRasterObject family, a java.awt.Shape object is created for the border of the image. This Shape object is used for distance calculations. If the OMRasterObject is selected(), however, this Shape will be rendered with the OMGraphic parameters that are set in the OMGraphic.
Nested Class Summary | |
---|---|
protected class |
OMRasterObject.TrimScaleFilter
This is an effort to create an scaling ImageFilter that will trim off the unused pixels, lessoning the load on the display server. |
Field Summary | |
---|---|
protected java.awt.Image |
bitmap
The bitmap is drawn to the graphics. |
protected byte[] |
bits
The byte info for the image. |
protected int |
colorModel
colorModel helps figure out what kind of updates are necessary, by knowing what kind of image we're dealing with. |
static int |
COLORMODEL_DIRECT
The direct colormodel, for OMRasters, means the integer values passed in as pixels, already reflect the RGB color values each pixel should display. |
static int |
COLORMODEL_IMAGEICON
The ImageIcon colormodel means that the image is externally set, and we just want to to display the image at the given location. |
static int |
COLORMODEL_INDEXED
The indexed colormodel, for OMRasters, means that the byte array passed in for the pixels has to be resolved with a colortable in order to create a integer array of RGB pixels. |
protected boolean |
DEBUG
|
static int |
FAST_SCALING
If scaling the image, use the faster, replicating/clipping algorithm. |
protected int |
filteredHeight
The height of the image after scaling, if you want the image to be a different size than the source. |
protected int |
filteredWidth
The width of the image after scaling, if you want the image to be a different size than the source. |
protected int |
height
The height of the image, in pixels. |
protected java.awt.image.ImageFilter |
imageFilter
The image filter to use on the constructed image. |
protected double |
lat
The latitude of the upper left corner for the image, in decimal degrees. |
static java.util.logging.Logger |
logger
|
protected double |
lon
The longitude of the upper left corner for the image, in decimal degrees. |
protected boolean |
needToReposition
Set if the projection has had attributes change that require a repositioning of the image, not a regeneration. |
protected int[] |
pixels
The pixels are used for the image that is drawn on the window. |
protected java.awt.Point |
point1
Projected window pixel location of the upper left corner of the image. |
protected java.awt.Point |
point2
Projected window pixel location of the lower right corner of the image. |
protected java.lang.Double |
renderRotationAngle
The angle, perhaps taking into account NO_ROTATE, that the image is rotated at render-time. |
protected double |
rotationAngle
the angle by which the image is to be rotated, in radians |
static int |
SMOOTH_SCALING
If scaling the image, use the slower, smoothing algorithm. |
protected int |
width
The width of the image, in pixels. |
protected int |
x
Horizontal location of the upper left corner of the image, or the x offset from the lon for that corner, in pixels. |
protected int |
y
Vertical location of the upper left corner of the image, or the y offset from the lat for that corner, in pixels. |
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 | |
---|---|
OMRasterObject()
A Constructor that sets the graphic type to raster, render type to unknown, line type to unknown, and the declutter type to none. |
|
OMRasterObject(int rType,
int lType,
int dcType)
A Constructor that sets the graphic type, render type, line type and the declutter type to the values you pass in. |
Method Summary | |
---|---|
protected java.awt.geom.GeneralPath |
adjustShapeForRotation(java.awt.geom.GeneralPath projectedShape,
double anchorX,
double anchorY)
Internally evaluates renderRotationAngle and if necessary, applies the rotation to the shape. |
protected abstract int[] |
computePixels(byte[] bits)
Compute the raster objects pixels, based on the color model and the byte values. |
protected java.awt.Image |
filterImage(java.awt.Image image)
A method used to manipulate the image according to the parameters set by the imageFilter in the OMRasterObject. |
byte[] |
getBits()
Get the byte values for indexed color model images and OMBitmaps. |
int |
getColorModel()
Get the color model type of the image. |
int |
getFilteredHeight()
Get the height of image after a filter was applied. |
int |
getFilteredWidth()
Get width of image, after a filter is applied. |
int |
getHeight()
Get the height of image. |
java.awt.Image |
getImage()
Get the image that will be put on the window. |
java.awt.image.ImageFilter |
getImageFilter()
Return the image filter used on the image. |
double |
getLat()
Get the latitude. |
double |
getLon()
Get the longitude. |
java.awt.Point |
getMapLocation()
Return the map location of the image, after generation. |
boolean |
getNeedToReposition()
Return the reposition status. |
int[] |
getPixels()
Return the pixels used for the image. |
double |
getRotationAngle()
Get the current rotation of the image. |
int |
getWidth()
Get width of image. |
int |
getX()
Returns the x attribute. |
int |
getY()
Return the y attribute. |
boolean |
hasLineTypeChoice()
Used by the GraphicAttributes object to provide a choice on whether the line type choice can be changed. |
boolean |
imageUpdate(java.awt.Image img,
int infoflags,
int x,
int y,
int width,
int height)
From the Image Observer Interface. |
protected boolean |
position(Projection proj)
Since the image doesn't necessarily need to be regenerated when it is merely moved, raster objects have this function, called from generate() and when a placement attribute is changed. |
boolean |
regenerate(Projection proj)
Overrides OMGraphicAdapter version to handle OMRasterObject getNeedToReposition. |
void |
render(java.awt.Graphics graphics)
Render the raster on the java.awt.Graphics |
protected void |
renderImage(java.awt.Graphics g,
java.awt.Image image,
java.awt.Point loc)
Render the image at the given pixel location. |
void |
restore(OMGeometry source)
Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one. |
protected void |
rotate(java.awt.Graphics2D g)
Called from within render(). |
void |
scaleTo(int w,
int h,
int algorithmType)
Convenience function to scale the Image to the xy size. |
void |
setBits(byte[] values)
Set the bytes used to create the pixels used to create the image. |
protected void |
setColorModel(int cm)
The color model is set based on the constructor. |
void |
setHeight(int value)
Set the height of the image, in pixels. |
void |
setImage(java.awt.Image ii)
Set the image to be drawn, if the color model is COLORMODEL_IMAGEICON. |
void |
setImageFilter(java.awt.image.ImageFilter filter)
Set a filter to be used on the constructed image. |
void |
setLat(double value)
Change the latitude attribute, which matters only if the render type is RENDERTYPE_LATLON or RENDERTYPE_OFFSET. |
void |
setLon(double value)
Change the longitude attribute, which matters only if the render type is RENDERTYPE_LATLON or RENDERTYPE_OFFSET. |
void |
setNeedToReposition(boolean value)
Set the flag for the object that lets the render method (which draws the object) know that the object needs to be repositioned first. |
void |
setPixels(int[] values)
Set the pixels for the image for direct color model images. |
void |
setRotationAngle(double angle)
Set the angle by which the image is to rotated. |
void |
setShape()
Set the rectangle, based on the location and size of the image. |
void |
setWidth(int value)
Set width of image. |
void |
setX(int value)
Change the x attribute, which matters only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET. |
void |
setY(int value)
Change the y attribute, which matters only if the render type is RENDERTYPE_XY or RENDERTYPE_OFFSET. |
boolean |
shouldRenderFill()
Always true for images, affects distance measurements. |
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, generate, getAppObject, getAttribute, getAttributes, getDescription, getLineType, getNeedToRegenerate, getShape, isRenderable, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setShape, setVisible |
Field Detail |
---|
public static final int COLORMODEL_DIRECT
public static final int COLORMODEL_INDEXED
public static final int COLORMODEL_IMAGEICON
public static final int SMOOTH_SCALING
public static final int FAST_SCALING
protected int colorModel
protected int[] pixels
protected int x
protected int y
protected double lat
protected double lon
protected int width
protected int height
protected byte[] bits
protected transient java.awt.Image bitmap
protected transient java.awt.Point point1
protected transient java.awt.Point point2
protected int filteredWidth
protected int filteredHeight
protected java.awt.image.ImageFilter imageFilter
protected boolean needToReposition
protected double rotationAngle
protected java.lang.Double renderRotationAngle
public static java.util.logging.Logger logger
protected transient boolean DEBUG
Constructor Detail |
---|
public OMRasterObject()
public OMRasterObject(int rType, int lType, int dcType)
rType
- render typelType
- line typedcType
- declutter typeMethod Detail |
---|
protected void setColorModel(int cm)
cm
- the colormode that describes how the colors are being set -
COLORMODEL_DIRECT, COLORMODEL_INDEXED, or COLORMODEL_IMAGEICON.public int getColorModel()
public void setNeedToReposition(boolean value)
public boolean getNeedToReposition()
public void setRotationAngle(double angle)
angle
- the number of radians the image is to be rotated. Measured
clockwise from horizontal.public double getRotationAngle()
protected abstract int[] computePixels(byte[] bits)
protected void rotate(java.awt.Graphics2D g)
public void render(java.awt.Graphics graphics)
render
in interface OMGeometry
render
in class OMGraphicAdapter
graphics
- java.awt.Graphics to draw the image on.protected void renderImage(java.awt.Graphics g, java.awt.Image image, java.awt.Point loc)
g
- the Graphics object to render the image into. Assumes this is a
derivative of the Graphics passed into the OMGraphic, and can be
modified without worrying about passing settings on to other
OMGraphics.loc
- the pixel location of the image.public void setShape()
protected java.awt.geom.GeneralPath adjustShapeForRotation(java.awt.geom.GeneralPath projectedShape, double anchorX, double anchorY)
projectedShape
- The GeneralPath to rotate, if necessary.anchorX
- the x coordinate of the rotation point.anchorY
- the y coordinate of the rotation point.
protected boolean position(Projection proj)
proj
- projection of window.
public void setImage(java.awt.Image ii)
ii
- the image icon to use.public boolean regenerate(Projection proj)
regenerate
in interface OMGeometry
regenerate
in interface OMGraphic
regenerate
in class OMGraphicAdapter
proj
- the Projection
OMGraphicAdapter.generate(com.bbn.openmap.proj.Projection)
public java.awt.Image getImage()
public boolean shouldRenderFill()
shouldRenderFill
in interface OMGraphic
shouldRenderFill
in class OMGraphicAdapter
public void setPixels(int[] values)
values
- the pixel values.public int[] getPixels()
public void setX(int value)
value
- the x location in pixels.public int getX()
public void setY(int value)
value
- the y location in pixelspublic int getY()
public java.awt.Point getMapLocation()
public void setLat(double value)
value
- latitude in decimal degrees.public double getLat()
public void setLon(double value)
value
- the longitude in decimal degrees.public double getLon()
public void setHeight(int value)
value
- height in pixels.public int getHeight()
public int getFilteredHeight()
public void setWidth(int value)
value
- width in pixels.public int getWidth()
public int getFilteredWidth()
public void setBits(byte[] values)
values
- byte valuespublic byte[] getBits()
public void setImageFilter(java.awt.image.ImageFilter filter)
filter
- Image filter to apply to constructed raster.public java.awt.image.ImageFilter getImageFilter()
public void scaleTo(int w, int h, int algorithmType)
w
- width to scale to, in pixelsh
- height to scale to, in pixelsalgorithmType
- OMRasterObject parameter describing which scaling
algorithm to use.protected java.awt.Image filterImage(java.awt.Image image)
image
- the Image to filter
public boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface java.awt.image.ImageObserver
public boolean hasLineTypeChoice()
OMGraphicAdapter
hasLineTypeChoice
in interface OMGraphic
hasLineTypeChoice
in class OMGraphicAdapter
public void restore(OMGeometry source)
OMGraphicAdapter
restore
in interface OMGeometry
restore
in class OMGraphicAdapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |