com.bbn.openmap.omGraphics
Class OMScalingIcon

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.omGraphics.OMScalingIcon
All Implemented Interfaces:
OMGeometry, OMGraphic, OMGraphicConstants, java.awt.image.ImageObserver, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
EsriIconPoint, TemporalOMScalingIcon

public class OMScalingIcon
extends OMScalingRaster
implements java.io.Serializable

This is an extension to OMScalingRaster that scales an icon. The icon is automatically centered over the lat/lon location. The offsets push the icon away from the lat/lon.

See Also:
OMScalingRaster, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.omGraphics.OMRasterObject
OMRasterObject.TrimScaleFilter
 
Field Summary
protected  float baseScale
           
protected  float maxScale
           
protected  float minScale
           
protected  boolean noScalingRequired
          Shortcut flag for position/scaleTo/rendering for images that don't need scaling.
 
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
OMScalingIcon()
          Construct a blank OMRaster, to be filled in with set calls.
OMScalingIcon(double centerLat, double centerLon, java.awt.Image image)
          Create an OMRaster, Lat/Lon placement with an ImageIcon.
OMScalingIcon(double centerLat, double centerLon, javax.swing.ImageIcon ii)
          Create an OMRaster, Lat/Lon placement with an ImageIcon.
OMScalingIcon(double centerLat, double centerLon, int offsetX, int offsetY, java.awt.Image ii, float baseScale)
          Create an OMRaster, Lat/Lon placement with an Image.
OMScalingIcon(double centerLat, double centerLon, int offsetX, int offsetY, javax.swing.ImageIcon ii, float baseScale)
          Create an OMRaster, Lat/Lon placement with an ImageIcon.
OMScalingIcon(double centerLat, double centerLon, int offsetX, int offsetY, int w, int h, int[] pix, float baseScale)
          Creates an OMRaster images, Lat/Lon placement with a direct colormodel image.
OMScalingIcon(float centerLat, float centerLon, int offsetX, int offsetY, int w, int h, byte[] bytes, java.awt.Color[] colorTable, int trans, float baseScale)
          Lat/Lon placement with a indexed colormodel, which is using a colortable and a byte array to construct the int[] pixels.
 
Method Summary
 float getBaseScale()
           
 float getMaxScale()
           
 float getMinScale()
           
 boolean isOnMap(Projection proj)
          Test to see if projected image is on map.
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 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 scaleTo(Projection thisProj)
          Over-riding this so we don't clip rotated icons near the edge of the map.
 void setBaseScale(float bs)
           
 void setMaxScale(float ms)
          Set the scale that limits how small an icon will shrink.
 void setMinScale(float ms)
          Set the scale that limits how big an icon should grow.
 
Methods inherited from class com.bbn.openmap.omGraphics.OMScalingRaster
generate, getClippedRectangle, getImageWarp, getLRLat, getLRLon, getScaleTransformType, getULLat, getULLon, render, rotate, setLRLat, setLRLon, setScaleTransformType, setShape, setULLat, setULLon, updateImageForProjection
 
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, regenerate, 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, setSelected, 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, 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

baseScale

protected float baseScale

maxScale

protected float maxScale

minScale

protected float minScale

noScalingRequired

protected boolean noScalingRequired
Shortcut flag for position/scaleTo/rendering for images that don't need scaling. Preserves rendering quality.

Constructor Detail

OMScalingIcon

public OMScalingIcon()
Construct a blank OMRaster, to be filled in with set calls.


OMScalingIcon

public OMScalingIcon(double centerLat,
                     double centerLon,
                     int offsetX,
                     int offsetY,
                     int w,
                     int h,
                     int[] pix,
                     float baseScale)
Creates an OMRaster images, Lat/Lon placement with a direct colormodel image.

Parameters:
centerLat - latitude of the top of the image.
centerLon - longitude of the left side of the image.
offsetX - horizontal pixel offset of icon (positive pushes east).
offsetY - vertical pixel offset of icon (positive pushes south).
w - width of the image, in pixels.
h - height of the image, in pixels.
pix - color values for the pixels.
baseScale - the scale where the icon will be show regular size.
See Also:
OMRaster.setPixel(int, int, int)

OMScalingIcon

public OMScalingIcon(double centerLat,
                     double centerLon,
                     int offsetX,
                     int offsetY,
                     javax.swing.ImageIcon ii,
                     float baseScale)
Create an OMRaster, Lat/Lon placement with an ImageIcon.

Parameters:
centerLat - latitude of the top of the image.
centerLon - longitude of the left side of the image.
offsetX - horizontal pixel offset of icon (positive pushes east).
offsetY - vertical pixel offset of icon (positive pushes south).
ii - ImageIcon used for the image.
baseScale - the scale where the icon will be show regular size.

OMScalingIcon

public OMScalingIcon(double centerLat,
                     double centerLon,
                     javax.swing.ImageIcon ii)
Create an OMRaster, Lat/Lon placement with an ImageIcon. Doesn't scale, because baseScale, minScale and maxScale are all set to the same number (4000000).

Parameters:
centerLat - latitude of the top of the image.
centerLon - longitude of the left side of the image.
ii - ImageIcon used for the image.

OMScalingIcon

public OMScalingIcon(double centerLat,
                     double centerLon,
                     int offsetX,
                     int offsetY,
                     java.awt.Image ii,
                     float baseScale)
Create an OMRaster, Lat/Lon placement with an Image.

Parameters:
centerLat - latitude of the top of the image.
centerLon - longitude of the left side of the image.
offsetX - horizontal pixel offset of icon (positive pushes east).
offsetY - vertical pixel offset of icon (positive pushes south).
ii - Image used for the image.
baseScale - the scale where the icon will be show regular size.

OMScalingIcon

public OMScalingIcon(double centerLat,
                     double centerLon,
                     java.awt.Image image)
Create an OMRaster, Lat/Lon placement with an ImageIcon. Doesn't scale, because baseScale, minScale and maxScale are all set to the same number (4000000).

Parameters:
centerLat - latitude of the top of the image.
centerLon - longitude of the left side of the image.
image - ImageIcon used for the image.

OMScalingIcon

public OMScalingIcon(float centerLat,
                     float centerLon,
                     int offsetX,
                     int offsetY,
                     int w,
                     int h,
                     byte[] bytes,
                     java.awt.Color[] colorTable,
                     int trans,
                     float baseScale)
Lat/Lon placement with a indexed colormodel, which is using a colortable and a byte array to construct the int[] pixels.

Parameters:
centerLat - latitude of the top of the image.
centerLon - longitude of the left side of the image.
offsetX - horizontal pixel offset of icon (positive pushes east).
offsetY - vertical pixel offset of icon (positive pushes south).
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 bytes
trans - transparency of image.
baseScale - the scale where the icon will be show regular size.
See Also:
OMRaster.setPixel(int, int, int)
Method Detail

position

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.

Overrides:
position in class OMScalingRaster
Parameters:
proj - projection of window.
Returns:
true if enough information is in the object for proper placement.

isOnMap

public boolean isOnMap(Projection proj)
Description copied from class: OMScalingRaster
Test to see if projected image is on map.

Overrides:
isOnMap in class OMScalingRaster
Parameters:
proj - current projection
Returns:
true of projected image location intersects map area.

scaleTo

protected void scaleTo(Projection thisProj)
Over-riding this so we don't clip rotated icons near the edge of the map. Just display icons as whole.

Overrides:
scaleTo in class OMScalingRaster
Parameters:
thisProj - the projection that the image should be scaled to.

renderImage

protected void renderImage(java.awt.Graphics g,
                           java.awt.Image image,
                           java.awt.Point loc)
Render the image at the given pixel location. This method should be overridden for special Image handling.

Overrides:
renderImage in class OMScalingRaster
Parameters:
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.
image - the image to render.
loc - the pixel location of the image.

setBaseScale

public void setBaseScale(float bs)

getBaseScale

public float getBaseScale()

setMaxScale

public void setMaxScale(float ms)
Set the scale that limits how small an icon will shrink. Should be a number larger than the base scale. If the map scale gets larger than this number, the icon will stop shrinking.


getMaxScale

public float getMaxScale()

setMinScale

public void setMinScale(float ms)
Set the scale that limits how big an icon should grow. Should be a number smaller than the base scale. If the map scale gets smaller than this number, the icon will stop growing.


getMinScale

public float getMinScale()

restore

public void restore(OMGeometry source)
Description copied from class: OMGraphicAdapter
Takes the generic OMGraphic settings from another OMGraphic and pushes them to this one.

Specified by:
restore in interface OMGeometry
Overrides:
restore in class OMScalingRaster


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