com.bbn.openmap.dataAccess.image
Class ImageTile

java.lang.Object
  extended by com.bbn.openmap.omGraphics.geom.BasicGeometry
      extended by com.bbn.openmap.omGraphics.OMGraphicAdapter
          extended by com.bbn.openmap.omGraphics.OMRasterObject
              extended by com.bbn.openmap.omGraphics.OMRaster
                  extended by com.bbn.openmap.omGraphics.OMScalingRaster
                      extended by com.bbn.openmap.dataAccess.image.ImageTile
All Implemented Interfaces:
OMGeometry, OMGraphic, OMGraphicConstants, java.awt.image.ImageObserver, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ErrImageTile

public class ImageTile
extends OMScalingRaster
implements java.io.Serializable

This is an extension to OMRaster that automatically scales itself 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.

See Also:
OMRaster, OMRasterObject, Serialized Form

Nested Class Summary
static class ImageTile.Cache
           
 
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMRasterObject
OMRasterObject.TrimScaleFilter
 
Field Summary
protected  CacheHandler cache
           
static java.awt.Color DEFAULT_NON_CLEAR_FILL_PAINT
           
protected  ImageReader imageDecoder
           
protected  java.lang.Boolean realSelection
           
 
Fields inherited from class com.bbn.openmap.omGraphics.OMScalingRaster
clipRect, corners, lastProjection, lat2, lon2, scaleTransformType, scalingXFormOp
 
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, 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 com.bbn.openmap.omGraphics.OMGraphicConstants
ADD_GRAPHIC_MASK, APP_OBJECT, BASIC_STROKE, CHANGE_APPEARANCE, clear, DECIMAL_DEGREES, DECLUTTERTYPE_LINE, DECLUTTERTYPE_MOVE, DECLUTTERTYPE_NONE, DECLUTTERTYPE_SPACE, DEFAULT_ROTATIONANGLE, DELETE_GRAPHIC_MASK, DESELECT_GRAPHIC_MASK, DESELECTALL_GRAPHIC_MASK, GRAPHICTYPE_ARC, GRAPHICTYPE_BITMAP, GRAPHICTYPE_CIRCLE, GRAPHICTYPE_ELLIPSE, GRAPHICTYPE_GRAPHIC, GRAPHICTYPE_GRID, GRAPHICTYPE_LINE, GRAPHICTYPE_POINT, GRAPHICTYPE_POLY, GRAPHICTYPE_RASTER, GRAPHICTYPE_RECTANGLE, GRAPHICTYPE_TEXT, INDEX, INFOLINE, LABEL, LINETYPE_GREATCIRCLE, LINETYPE_RHUMB, LINETYPE_STRAIGHT, LINETYPE_UNKNOWN, LOWER_GRAPHIC_MASK, LOWER_TO_BOTTOM_GRAPHIC_MASK, NO_ROTATE, OMGRAPHIC_ELT, OMGRAPHIC_TYPE_ATTR, RADIANS, RAISE_GRAPHIC_MASK, RAISE_TO_TOP_GRAPHIC_MASK, REMOVABLE, RENDERTYPE_LATLON, RENDERTYPE_OFFSET, RENDERTYPE_UNKNOWN, RENDERTYPE_XY, SELECT_GRAPHIC_MASK, SORT_GRAPHICS_MASK, TOOLTIP, UPDATE_GRAPHIC_MASK, UPDATED
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageTile()
          Construct a blank OMRaster, to be filled in with set calls.
ImageTile(double ullat, double ullon, double lrlat, double lrlon, java.awt.image.BufferedImage image)
          Create an OMRaster, Lat/Lon placement with an ImageIcon.
ImageTile(double ullat, double ullon, double lrlat, double lrlon, ImageReader imageDecoder, CacheHandler cache)
          Create an OMRaster, Lat/Lon placement with an ImageIcon.
 
Method Summary
 ImageReader getImageDecoder()
           
 boolean regenerate(Projection p)
          Overrides OMGraphicAdapter version to handle OMRasterObject getNeedToReposition.
 void setImageDecoder(ImageReader imageDecoder)
           
 void setSelected(boolean setting)
          Calls select() or deselect() depending on the boolean (select is true).
protected  boolean shouldFetchForProjection(Projection proj)
          Checking to see of the image needs to be updated for the projection parameters, namely scale.
protected  boolean updateImageForProjection(Projection proj)
          Called from within generate.
 
Methods inherited from class com.bbn.openmap.omGraphics.OMScalingRaster
generate, getClippedRectangle, getImageWarp, getLRLat, getLRLon, getScaleTransformType, getULLat, getULLon, isOnMap, position, render, renderImage, restore, rotate, scaleTo, setLRLat, setLRLon, setScaleTransformType, setShape, setULLat, setULLon
 
Methods inherited from class com.bbn.openmap.omGraphics.OMRaster
computePixels, evaluateRotationAngle, getBitmapFromInternalData, getByte, getColors, getPixel, getTransparent, setBits, setByte, setColors, setColors, setImageIcon, setPixel, setTransparent
 
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, scaleTo, setColorModel, setHeight, setImage, setImageFilter, setLat, setLon, setNeedToReposition, setPixels, setRotationAngle, setWidth, setX, setY, shouldRenderFill
 
Methods inherited from class com.bbn.openmap.omGraphics.OMGraphicAdapter
clone, deselect, distance, getDeclutterType, getDisplayColor, getDisplayPaint, getEdgeMatchesFill, getFillColor, getFillPaint, getHasLabel, getLineColor, getLinePaint, getMattingPaint, getRenderType, getSelectColor, getSelectPaint, getShowEditablePalette, getStroke, getTextureMask, initLabelingDuringGenerate, isClear, isMatted, isSelected, normalizeDistanceForLineWidth, readStroke, readTextureMask, renderLabel, renderShape, select, setDeclutterType, setEdgeMatchesFill, setFillColor, setFillPaint, setGraphicsColor, setGraphicsForEdge, setGraphicsForFill, setHasLabel, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLabelLocation, setLineColor, setLinePaint, setMatted, setMattingPaint, setRenderType, setSelectColor, setSelectPaint, setShowEditablePalette, setStroke, setTextureMask, shouldRenderEdge, writeStroke, writeTextureMask
 
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, 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

imageDecoder

protected ImageReader imageDecoder

cache

protected CacheHandler cache

realSelection

protected java.lang.Boolean realSelection

DEFAULT_NON_CLEAR_FILL_PAINT

public static java.awt.Color DEFAULT_NON_CLEAR_FILL_PAINT
Constructor Detail

ImageTile

public ImageTile()
Construct a blank OMRaster, to be filled in with set calls. Make sure you set either a source image or ImageDecoder that knows how to get the image.


ImageTile

public ImageTile(double ullat,
                 double ullon,
                 double lrlat,
                 double lrlon,
                 ImageReader imageDecoder,
                 CacheHandler cache)
Create an OMRaster, Lat/Lon placement with an ImageIcon.

Parameters:
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.
imageDecoder - ImageReader for Image.
cache - CacheHandler holding cached images.

ImageTile

public ImageTile(double ullat,
                 double ullon,
                 double lrlat,
                 double lrlon,
                 java.awt.image.BufferedImage image)
Create an OMRaster, Lat/Lon placement with an ImageIcon.

Parameters:
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.
image - BufferedImage used for the image.
Method Detail

setSelected

public void setSelected(boolean setting)
Description copied from class: OMGraphicAdapter
Calls select() or deselect() depending on the boolean (select is true).

Specified by:
setSelected in interface OMGraphic
Overrides:
setSelected in class OMGraphicAdapter

shouldFetchForProjection

protected boolean shouldFetchForProjection(Projection proj)
Checking to see of the image needs to be updated for the projection parameters, namely scale.

Parameters:
proj - current projection
Returns:
true if the image scale, as projected, isn't being shrunk down too much, and the image should be displayed.

updateImageForProjection

protected boolean updateImageForProjection(Projection proj)
Called from within generate.

Overrides:
updateImageForProjection in class OMScalingRaster
Parameters:
proj - current projection.
Returns:
false if the rest of generate() should be skipped, if the image doesn't need to be formed for the current projection.

regenerate

public boolean regenerate(Projection p)
Description copied from class: OMRasterObject
Overrides OMGraphicAdapter version to handle OMRasterObject getNeedToReposition.

Specified by:
regenerate in interface OMGeometry
Specified by:
regenerate in interface OMGraphic
Overrides:
regenerate in class OMRasterObject
Parameters:
p - the Projection
Returns:
true if generated, false if didn't do it (maybe a problem).
See Also:
OMGraphicAdapter.generate(com.bbn.openmap.proj.Projection)

getImageDecoder

public ImageReader getImageDecoder()

setImageDecoder

public void setImageDecoder(ImageReader imageDecoder)


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details