|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bbn.openmap.omGraphics.geom.BasicGeometry
com.bbn.openmap.omGraphics.OMGraphic
com.bbn.openmap.omGraphics.OMRasterObject
com.bbn.openmap.omGraphics.OMRaster
com.bbn.openmap.omGraphics.OMScalingRaster
This is an extension to OMRaster that automatically scales itelf to match the current projection. It is only lat/lon based, and takes the coordinates of the upper left and lower right corners of the image. It does straight scaling - it does not force the image projection to match the map projection! So, your mileage may vary - you have to understand the projection of the image, and know how it fits the projection type of the map. Of course, at larger scales, it might not matter so much. This class was inspired by, and created from parts of the ImageLayer submission from Adrian Lumsden@sss, on 25-Jan-2002. Used the scaling and trimming code from that submission. That code was also developed with assistance from Steve McDonald at SiliconSpaceships.com.
OMRaster
,
OMRasterObject
,
Serialized FormNested Class Summary |
Nested classes inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
OMRasterObject.TrimScaleFilter |
Field Summary | |
protected java.awt.Rectangle |
clipRect
The rectangle in screen co-ordinates that the scaled image projects to after clipping. |
protected float |
lat2
The latitude of the lower right corner for the image, in decimal degrees. |
protected float |
lon2
The longitude of the lower right corner for the image, in decimal degrees. |
protected java.awt.image.BufferedImage |
sourceImage
This the original version of the image, which we keep around for rescaling later. |
Fields inherited from class com.bbn.openmap.omGraphics.OMRaster |
colors, transparent |
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, lon, needToReposition, pixels, point1, point2, rotationAngle, SMOOTH_SCALING, width, x, y |
Fields inherited from class com.bbn.openmap.omGraphics.OMGraphic |
declutterType, displayPaint, edgeMatchesFill, fillPaint, hasLabel, linePaint, matted, mattingPaint, renderType, selected, selectPaint, showEditablePalette, stroke, textureMask |
Fields inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
APP_OBJECT_KEY, appObject, ATT_MAP_KEY, lineType, needToRegenerate, shape, visible |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
OMScalingRaster()
Constuct a blank OMRaster, to be filled in with set calls. |
|
OMScalingRaster(float ullat,
float ullon,
float lrlat,
float lrlon,
java.awt.Image ii)
Create an OMRaster, Lat/Lon placement with an Image. |
|
OMScalingRaster(float ullat,
float ullon,
float lrlat,
float lrlon,
javax.swing.ImageIcon ii)
Create an OMRaster, Lat/Lon placement with an ImageIcon. |
|
OMScalingRaster(float ullat,
float ullon,
float lrlat,
float lrlon,
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 contruct the int[] pixels. |
|
OMScalingRaster(float ullat,
float ullon,
float lrlat,
float lrlon,
int w,
int h,
int[] pix)
Creates an OMRaster images, Lat/Lon placement with a direct colormodel image. |
Method Summary | |
boolean |
generate(Projection proj)
Prepare the graphics for rendering. |
java.awt.Rectangle |
getClippedRectangle()
Return the rectangle in screen co-ordinates that the scaled image has been clipped to. |
float |
getLRLat()
Get the southern latitude. |
float |
getLRLon()
Get the eastern longitude. |
float |
getULLat()
Get the upper latitude. |
float |
getULLon()
Get the western longitude. |
boolean |
isOnMap(Projection proj)
|
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. |
protected void |
rotate(java.awt.Graphics2D g)
Since the OMScalingRaster changes height and width depending on scale, we need to rotate the image over that point and factor in the scaled height and width of the image. |
protected void |
scaleTo(Projection thisProj)
Take the current projection and the sourceImage, and make the image that gets displayed fit the projection. |
void |
setImage(java.awt.Image image)
Creates a BufferedImage version of the image. |
void |
setLRLat(float value)
Change the southern latitude attribute. |
void |
setLRLon(float value)
Change the eastern longitude attribute. |
void |
setShape()
Set the rectangle, based on the location and size of the image after scaling. |
void |
setULLat(float value)
Change the upper latitude attribute. |
void |
setULLon(float value)
Change the western longitude attribute. |
protected boolean |
updateImageForProjection(Projection proj)
No op for this class, can be use to manage image use for subclasses. |
Methods inherited from class com.bbn.openmap.omGraphics.OMRaster |
computePixels, getByte, getColors, getPixel, getTransparent, setBits, setByte, setColors, setColors, setImageIcon, setPixel, setTransparent |
Methods inherited from class com.bbn.openmap.omGraphics.OMRasterObject |
filterImage, getBits, getColorModel, getFilteredHeight, getFilteredWidth, getHeight, getImage, getImageFilter, getLat, getLon, getMapLocation, getNeedToReposition, getPixels, getRotationAngle, getWidth, getX, getY, hasLineTypeChoice, imageUpdate, render, scaleTo, setColorModel, setHeight, setImageFilter, setLat, setLon, setNeedToReposition, setPixels, setRotationAngle, setWidth, setX, setY, shouldRenderFill |
Methods inherited from class com.bbn.openmap.omGraphics.geom.BasicGeometry |
_distance, appendShapeEdge, appendShapeEdge, appendShapeEdge, appendShapeEdge, checkAttributeMap, checkAttributeMap, clearAttributes, contains, createAttributeMap, createBoxShape, createShape, createShape, describeShapeDetail, describeShapeDetail, distanceToEdge, draw, fill, getAppObject, getAppObject, getAttribute, getAttributeMap, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, replaceAppObjectWithAttributeMap, setAppObject, setAppObject, setAttributes, setLineType, setNeedToRegenerate, 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.OMGeometry |
clearAttributes, contains, draw, fill, getAppObject, getAttribute, getAttributes, getLineType, getNeedToRegenerate, getShape, isRenderable, isVisible, putAttribute, removeAttribute, setAppObject, setAttributes, setLineType, setNeedToRegenerate, setVisible |
Field Detail |
protected float lat2
protected float lon2
protected java.awt.image.BufferedImage sourceImage
protected java.awt.Rectangle clipRect
Constructor Detail |
public OMScalingRaster()
public OMScalingRaster(float ullat, float ullon, float lrlat, float lrlon, int w, int h, int[] pix)
ullat
- latitude of the top of the image.ullon
- longitude of the left side of the image.lrlat
- latitude of the bottom of the image.lrlon
- longitude of the right side of the image.w
- width of the image, in pixels.h
- height of the image, in pixels.pix
- color values for the pixels.public OMScalingRaster(float ullat, float ullon, float lrlat, float lrlon, javax.swing.ImageIcon ii)
ullat
- latitude of the top of the image.ullon
- longitude of the left side of the image.lrlat
- latitude of the bottom of the image.lrlon
- longitude of the right side of the image.ii
- ImageIcon used for the image.public OMScalingRaster(float ullat, float ullon, float lrlat, float lrlon, java.awt.Image ii)
ullat
- latitude of the top of the image.ullon
- longitude of the left side of the image.lrlat
- latitude of the bottom of the image.lrlon
- longitude of the right side of the image.ii
- Image used for the image.public OMScalingRaster(float ullat, float ullon, float lrlat, float lrlon, int w, int h, byte[] bytes, java.awt.Color[] colorTable, int trans)
ullat
- latitude of the top of the image.ullon
- longitude of the left side of the image.lrlat
- latitude of the bottom of the image.lrlon
- longitude of the right 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.Method Detail |
public void setImage(java.awt.Image image)
setImage
in class OMRasterObject
image
- the input image.protected boolean position(Projection proj)
position
in class OMRasterObject
proj
- projection of window.
public boolean generate(Projection proj)
generate
in interface OMGeometry
generate
in class OMRaster
proj
- Projection used to position the image on the window.
protected boolean updateImageForProjection(Projection proj)
proj
- current projection.
protected void rotate(java.awt.Graphics2D g)
rotate
in class OMRasterObject
protected void scaleTo(Projection thisProj)
thisProj
- the projection that the image should be scaled to.public java.awt.Rectangle getClippedRectangle()
public void setULLat(float value)
value
- latitude in decimal degrees.public float getULLat()
public void setULLon(float value)
value
- the longitude in decimal degrees.public float getULLon()
public void setLRLat(float value)
value
- latitude in decimal degrees.public float getLRLat()
public void setLRLon(float value)
value
- the longitude in decimal degrees.public float getLRLon()
public void setShape()
setShape
in class OMRasterObject
public boolean isOnMap(Projection proj)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |