Class BalloonResizeController
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.util.AbstractHotSpot
-
- gov.nasa.worldwind.util.AbstractResizeHotSpot
-
- gov.nasa.worldwindx.examples.util.BalloonResizeController
-
- All Implemented Interfaces:
AVList
,SelectListener
,HotSpot
,java.awt.event.KeyListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.event.MouseWheelListener
,java.util.EventListener
public class BalloonResizeController extends AbstractResizeHotSpot
Create a controller to resize aBalloon
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
Fields Modifier and Type Field Description protected Balloon
balloon
protected java.awt.Rectangle
bounds
protected static java.awt.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
Constructors Constructor Description BalloonResizeController(WorldWindow wwd, Balloon balloon)
Create a resize controller.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detach()
Remove this controller as an event listener.java.awt.Rectangle
getBounds()
Gets the bounds of the Balloon being sized.protected java.awt.Rectangle
getBounds(PickedObject pickedObject)
Get the balloon bounds from a SelectEvent.protected java.awt.Dimension
getMinimumSize()
Get the minimum size of the frame.protected java.awt.Point
getScreenPoint()
Get the screen point of the upper left corner of the frame.protected java.awt.Dimension
getSize()
Get the size of the frame.boolean
isResizing()
Is the controller currently resizing a balloon?void
mouseMoved(java.awt.event.MouseEvent e)
Update the resize cursor when the mouse moves.void
setBounds(java.awt.Rectangle bounds)
Specifies the bounds of the Balloon to be sized.protected void
setScreenPoint(java.awt.Point newPoint)
Set the screen point of the upper left corner of the frame.protected void
setSize(java.awt.Dimension newSize)
Set the size of the frame.protected void
updateCursor()
Update the WorldWindow'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
-
-
-
-
Field Detail
-
wwd
protected WorldWindow wwd
-
bounds
protected java.awt.Rectangle bounds
-
balloon
protected Balloon balloon
-
DEFAULT_MIN_SIZE
protected static final java.awt.Dimension DEFAULT_MIN_SIZE
-
-
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.
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
Description copied from class:AbstractResizeHotSpot
Update the resize cursor when the mouse moves.- Specified by:
mouseMoved
in interfaceHotSpot
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
- Overrides:
mouseMoved
in classAbstractResizeHotSpot
- Parameters:
e
- Mouse event.
-
isResizing
public boolean isResizing()
Is the controller currently resizing a balloon?- Returns:
- True if the controller is currently resizing the balloon.
-
getSize
protected java.awt.Dimension getSize()
Get the size of the frame.- Specified by:
getSize
in classAbstractResizeHotSpot
- Returns:
- Frame size in pixels.
-
getBounds
public java.awt.Rectangle getBounds()
Gets the bounds of the Balloon being sized.- Returns:
- Balloon bounds in AWT coordinates, or
null
if no bounds have been set.
-
setBounds
public void setBounds(java.awt.Rectangle bounds)
Specifies the bounds of the Balloon to be sized.- Parameters:
bounds
- Balloon bounds, in AWT coordinates.
-
updateCursor
protected void updateCursor()
Update the WorldWindow's cursor to the current resize cursor.
-
setSize
protected void setSize(java.awt.Dimension newSize)
Set the size of the frame.- Specified by:
setSize
in classAbstractResizeHotSpot
- Parameters:
newSize
- New frame size in pixels.
-
getBounds
protected java.awt.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.
-
getScreenPoint
protected java.awt.Point getScreenPoint()
Get the screen point of the upper left corner of the frame.- Specified by:
getScreenPoint
in classAbstractResizeHotSpot
- Returns:
- Screen point measured from upper left corner of the screen (AWT coordinates).
-
setScreenPoint
protected void setScreenPoint(java.awt.Point newPoint)
Set the screen point of the upper left corner of the frame.- Specified by:
setScreenPoint
in classAbstractResizeHotSpot
- Parameters:
newPoint
- New screen point measured from upper left corner of the screen (AWT coordinates).
-
getMinimumSize
protected java.awt.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 classAbstractResizeHotSpot
- Returns:
- Minimum frame size.
- See Also:
AbstractResizeHotSpot.isValidSize(int, int)
-
-