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 aBalloonby dragging the mouse. This class should usually not be instantiated directly. Instead,BalloonControllerwill instantiate it when a balloon needs to be resized.- See Also:
BalloonController
-
-
Field Summary
Fields Modifier and Type Field Description protected Balloonballoonprotected java.awt.Rectangleboundsprotected static java.awt.DimensionDEFAULT_MIN_SIZEprotected WorldWindowwwd-
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 voiddetach()Remove this controller as an event listener.java.awt.RectanglegetBounds()Gets the bounds of the Balloon being sized.protected java.awt.RectanglegetBounds(PickedObject pickedObject)Get the balloon bounds from a SelectEvent.protected java.awt.DimensiongetMinimumSize()Get the minimum size of the frame.protected java.awt.PointgetScreenPoint()Get the screen point of the upper left corner of the frame.protected java.awt.DimensiongetSize()Get the size of the frame.booleanisResizing()Is the controller currently resizing a balloon?voidmouseMoved(java.awt.event.MouseEvent e)Update the resize cursor when the mouse moves.voidsetBounds(java.awt.Rectangle bounds)Specifies the bounds of the Balloon to be sized.protected voidsetScreenPoint(java.awt.Point newPoint)Set the screen point of the upper left corner of the frame.protected voidsetSize(java.awt.Dimension newSize)Set the size of the frame.protected voidupdateCursor()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:AbstractResizeHotSpotUpdate the resize cursor when the mouse moves.- Specified by:
mouseMovedin interfaceHotSpot- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Overrides:
mouseMovedin 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:
getSizein 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
nullif 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:
setSizein 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
nullif 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:
getScreenPointin 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:
setScreenPointin 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:
getMinimumSizein classAbstractResizeHotSpot- Returns:
- Minimum frame size.
- See Also:
AbstractResizeHotSpot.isValidSize(int, int)
-
-