NASA World Wind

gov.nasa.worldwindx.examples.util
Class BalloonResizeController

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.util.AbstractHotSpot
          extended by gov.nasa.worldwind.util.AbstractResizeHotSpot
              extended by gov.nasa.worldwindx.examples.util.BalloonResizeController
All Implemented Interfaces:
AVList, SelectListener, HotSpot, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class BalloonResizeController
extends AbstractResizeHotSpot

Create a controller to resize a Balloon by dragging the mouse. This class should usually not be instantiated directly. Instead, BalloonController will instantiate it when a balloon needs to be resized.

See Also:
BalloonController

Field Summary
protected  Balloon balloon
           
protected  Rectangle bounds
           
protected static Dimension DEFAULT_MIN_SIZE
           
protected  WorldWindow wwd
           
 
Fields inherited from class gov.nasa.worldwind.util.AbstractResizeHotSpot
adjustLocationX, adjustLocationY, allowHorizontalResize, allowVerticalResize, cursor, dragging, dragRefPoint, EAST, NORTH, NORTHEAST, NORTHWEST, refLocation, refSize, SOUTH, SOUTHEAST, SOUTHWEST, WEST, xSign, ySign
 
Fields inherited from class gov.nasa.worldwind.util.AbstractHotSpot
active
 
Constructor Summary
BalloonResizeController(WorldWindow wwd, Balloon balloon)
          Create a resize controller.
 
Method Summary
 void detach()
          Remove this controller as an event listener.
 Rectangle getBounds()
          Gets the bounds of the Balloon being sized.
protected  Rectangle getBounds(PickedObject pickedObject)
          Get the balloon bounds from a SelectEvent.
protected  Dimension getMinimumSize()
          Get the minimum size of the frame.
protected  Point getScreenPoint()
          Get the screen point of the upper left corner of the frame.
protected  Dimension getSize()
          Get the size of the frame.
 boolean isResizing()
          Is the controller currently resizing a balloon?
 void mouseMoved(MouseEvent e)
          Update the resize cursor when the mouse moves.
 void setBounds(Rectangle bounds)
          Specifies the bounds of the Balloon to be sized.
protected  void setScreenPoint(Point newPoint)
          Set the screen point of the upper left corner of the frame.
protected  void setSize(Dimension newSize)
          Set the size of the frame.
protected  void updateCursor()
          Update the World Window's cursor to the current resize cursor.
 
Methods inherited from class gov.nasa.worldwind.util.AbstractResizeHotSpot
beginDrag, drag, endDrag, getCursor, isDragging, isValidSize, selected, setActive, setDirection, setDirection, setDirectionFromPoint
 
Methods inherited from class gov.nasa.worldwind.util.AbstractHotSpot
isActive, isConsumed, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased, mouseWheelMoved
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

balloon

protected Balloon balloon

bounds

protected Rectangle bounds

DEFAULT_MIN_SIZE

protected static final Dimension DEFAULT_MIN_SIZE

wwd

protected WorldWindow wwd
Constructor Detail

BalloonResizeController

public BalloonResizeController(WorldWindow wwd,
                               Balloon balloon)
Create a resize controller.

Parameters:
wwd - WorldWindow to interact with.
balloon - Balloon to resize.
Method Detail

detach

public void detach()
Remove this controller as an event listener. The controller will not receive input events after this method is called.


getBounds

public Rectangle getBounds()
Gets the bounds of the Balloon being sized.

Returns:
Balloon bounds in AWT coordinates, or null if no bounds have been set.

getBounds

protected Rectangle getBounds(PickedObject pickedObject)
Get the balloon bounds from a SelectEvent.

Parameters:
pickedObject - Top picked object. The bounds are expected to be attached to the to PickedObject under AVKey.BOUNDS.
Returns:
Bounds or null if no bounds are found in the top PickedObject.

getMinimumSize

protected Dimension getMinimumSize()
Get the minimum size of the frame. The user is not allowed to resize the frame to be smaller than this size. This implementation returns 0, 0.

Overrides:
getMinimumSize in class AbstractResizeHotSpot
Returns:
Minimum frame size.
See Also:
AbstractResizeHotSpot.isValidSize(int, int)

getScreenPoint

protected Point getScreenPoint()
Get the screen point of the upper left corner of the frame.

Specified by:
getScreenPoint in class AbstractResizeHotSpot
Returns:
Screen point measured from upper left corner of the screen (AWT coordinates).

getSize

protected Dimension getSize()
Get the size of the frame.

Specified by:
getSize in class AbstractResizeHotSpot
Returns:
Frame size in pixels.

isResizing

public boolean isResizing()
Is the controller currently resizing a balloon?

Returns:
True if the controller is currently resizing the balloon.

mouseMoved

public void mouseMoved(MouseEvent e)
Description copied from class: AbstractResizeHotSpot
Update the resize cursor when the mouse moves.

Specified by:
mouseMoved in interface HotSpot
Specified by:
mouseMoved in interface MouseMotionListener
Overrides:
mouseMoved in class AbstractResizeHotSpot
Parameters:
e - Mouse event.

setBounds

public void setBounds(Rectangle bounds)
Specifies the bounds of the Balloon to be sized.

Parameters:
bounds - Balloon bounds, in AWT coordinates.

setScreenPoint

protected void setScreenPoint(Point newPoint)
Set the screen point of the upper left corner of the frame.

Specified by:
setScreenPoint in class AbstractResizeHotSpot
Parameters:
newPoint - New screen point measured from upper left corner of the screen (AWT coordinates).

setSize

protected void setSize(Dimension newSize)
Set the size of the frame.

Specified by:
setSize in class AbstractResizeHotSpot
Parameters:
newSize - New frame size in pixels.

updateCursor

protected void updateCursor()
Update the World Window's cursor to the current resize cursor.


NASA World Wind