com.bbn.openmap
Class MapBean.RotationHelper

java.lang.Object
  extended by com.bbn.openmap.MapBean.RotationHelper
Enclosing class:
MapBean

protected class MapBean.RotationHelper
extends java.lang.Object


Method Summary
 void dispose()
           
 java.awt.Graphics getGraphics()
           
 java.awt.geom.AffineTransform getInverseRotationTransform()
           
 Projection getProjection()
           
<T extends java.awt.geom.Point2D>
T
inverse(double x, double y, T ret)
          Performs a projection.inverse operation that also takes into account rotation.
 java.awt.geom.Point2D inverseTransform(java.awt.geom.Point2D src, java.awt.geom.Point2D dst)
          Returns dst, the unrotated pixel location of the map.
 java.awt.Shape inverseTransform(java.awt.Shape shape)
          Returns a transformed version of the Shape, unrotated into the projected pixel space of the layer OMGraphics.
 boolean isStillNeeded(double az)
           
 void paintChildren(java.awt.Graphics g, java.awt.Rectangle clip)
           
 void paintPainters(java.awt.Graphics g)
           
 void updateAngle(double angle)
           
protected  boolean updateForBufferDimensions(Projection proj)
          We're going to try to do buffering with a image that will cover all of the corners when the map is rotated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

updateForBufferDimensions

protected boolean updateForBufferDimensions(Projection proj)
We're going to try to do buffering with a image that will cover all of the corners when the map is rotated. We'll measure the ground distance from the center of the projection/map to each corner, and take the longest to create a bounding circle. The NSEW of that bounding circle (as a bounding box) Makes up the buffered image pixel bounds, and the inverse projected coordinates of that box should be returned as upper left and lower right coordinates when those methods are called. The projection of that box should be the same as the current projection, except for the new width and height. Because the height and width are different for the buffered image, we're going to have to translate it before it is rotated. We can probably just tack on an additional translate to the rot. That difference will be 1/2 the difference of the height and width between the rot image and the original projection (mapbean dimensions).

Parameters:
proj - the projection to use to create the current image buffer
Returns:
boolean true if the rotBufferHeight and/or rotBufferWidth have changed, indicating that the image buffer was recreated for new dimensions.

updateAngle

public void updateAngle(double angle)

isStillNeeded

public boolean isStillNeeded(double az)
Parameters:
az - angle to test against
Returns:
true if current angle or new angle is not zero. Two zero angles in a row is an indication that the RotationHelper is no longer needed.

getProjection

public Projection getProjection()
Returns:
the projection of the image buffer that is big enough for rotated areas.

paintChildren

public void paintChildren(java.awt.Graphics g,
                          java.awt.Rectangle clip)

paintPainters

public void paintPainters(java.awt.Graphics g)

getGraphics

public java.awt.Graphics getGraphics()
Returns:
a Graphics object from the MapBean with the rotation transform applied.

inverse

public <T extends java.awt.geom.Point2D> T inverse(double x,
                                                   double y,
                                                   T ret)
Performs a projection.inverse operation that also takes into account rotation.

Parameters:
x - pixel x
y - pixel y
ret - T in the coordinate space of projection.
Returns:
T, either ret or a new object.

inverseTransform

public java.awt.geom.Point2D inverseTransform(java.awt.geom.Point2D src,
                                              java.awt.geom.Point2D dst)
Returns dst, the unrotated pixel location of the map.

Parameters:
src - the pixel point
dst -
Returns:
see above.

inverseTransform

public java.awt.Shape inverseTransform(java.awt.Shape shape)
Returns a transformed version of the Shape, unrotated into the projected pixel space of the layer OMGraphics.

Parameters:
shape - to transform
Returns:
the transformed shape.

getInverseRotationTransform

public java.awt.geom.AffineTransform getInverseRotationTransform()

dispose

public void dispose()


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