shady.common.ui
Class HotSpot

java.lang.Object
  extended by shady.common.ui.HotSpot
Direct Known Subclasses:
ChainIKHotSpot

public class HotSpot
extends java.lang.Object

A HotSpot.

TBD more doc

Copyright (C) 2006 Marsette A. Vona, III

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Author:
Marsette (Marty) A. Vona, III

Field Summary
static boolean DEBUG
          Whether to debug.
protected  GraphicsDisplay graphicsDisplay
          Our GraphicsDisplay.
 Point point
          The point.
 int uid
          Unique ID for this HotSpot.
protected static int uidCounter
          The next UID.
 
Constructor Summary
HotSpot(Point point)
          Create a new HotSpot.
 
Method Summary
 double distanceSq(double x, double y)
          Compute the distance squared from point to (x, y) in world frame.
 double distanceSq(Point point)
          Defers to distanceSq(double, double).
 double distanceSq(java.awt.geom.Point2D point)
          Defers to distanceSq(double, double).
 boolean handleDrag(double dx, double dy, java.awt.geom.Point2D startDragPoint, java.awt.geom.Point2D point, int modifiers, boolean accel)
          Subclasses wishing to respond to drags override this.
 void handleDragEnded(java.awt.geom.Point2D startDragPoint, java.awt.geom.Point2D point, int modifiers, boolean accel)
          Subclasses wishing to respond to drags may override this to be told when the drag ends.
 boolean handleWheel(int wheelRotation, java.awt.geom.Point2D point, int modifiers, boolean accel)
          Subclasses wishing to respond to wheel rotations override this.
 void setGraphicsDisplay(GraphicsDisplay graphicsDisplay)
          Used by GraphicsDisplay to notify this HotSpot when it has been added and removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG

Whether to debug.

See Also:
Constant Field Values

point

public final Point point

The point.


graphicsDisplay

protected GraphicsDisplay graphicsDisplay

Our GraphicsDisplay.


uid

public final int uid

Unique ID for this HotSpot.


uidCounter

protected static int uidCounter

The next UID.

Constructor Detail

HotSpot

public HotSpot(Point point)

Create a new HotSpot.

Parameters:
point - the point
Method Detail

handleWheel

public boolean handleWheel(int wheelRotation,
                           java.awt.geom.Point2D point,
                           int modifiers,
                           boolean accel)

Subclasses wishing to respond to wheel rotations override this.

This method will be called at each wheel event over the hotspot.

Default impl just returns false.

Parameters:
wheelRotation - number of clicks rotated, negative values if the mouse wheel was rotated up/away from the user, and positive values if the mouse wheel was rotated down/ towards the user
point - the current mouse point in world frame, not null
modifiers - modifiersEx of the mouse event
accel - whether the user is indicating this is an accelerated gesture
Returns:
true iff the event should be "swallowed"

handleDrag

public boolean handleDrag(double dx,
                          double dy,
                          java.awt.geom.Point2D startDragPoint,
                          java.awt.geom.Point2D point,
                          int modifiers,
                          boolean accel)

Subclasses wishing to respond to drags override this.

This method will be called at each mouse event during a drag which started over the hotspot.

Default impl just returns false.

Parameters:
dx - horizontal pixels moved since last call, view frame
dy - vertical pixels moved since last call, view frame
startDragPoint - the drag start point in world frame, not null
point - the current drag point in world frame, not null
modifiers - modifiersEx of the mouse event
accel - whether the user is indicating this is an accelerated gesture
Returns:
true iff the event should be "swallowed"

handleDragEnded

public void handleDragEnded(java.awt.geom.Point2D startDragPoint,
                            java.awt.geom.Point2D point,
                            int modifiers,
                            boolean accel)

Subclasses wishing to respond to drags may override this to be told when the drag ends.

This method will be called when a drag which started over the hotspot ends.

Default impl just returns false.

Parameters:
startDragPoint - the drag start point in world frame, not null
point - the end drag point in world frame, not null
modifiers - modifiersEx of the mouse event
accel - whether the user is indicating this is an accelerated gesture

distanceSq

public double distanceSq(double x,
                         double y)

Compute the distance squared from point to (x, y) in world frame.

Parameters:
x - the x-coord of the point in world frame, not null
y - the y-coord of the point in world frame, not null
Returns:
the distance squared from point (x, y) in world frame

distanceSq

public double distanceSq(java.awt.geom.Point2D point)

Defers to distanceSq(double, double).

Parameters:
point - the point

distanceSq

public double distanceSq(Point point)

Defers to distanceSq(double, double).

Parameters:
point - the point

setGraphicsDisplay

public void setGraphicsDisplay(GraphicsDisplay graphicsDisplay)

Used by GraphicsDisplay to notify this HotSpot when it has been added and removed.

Parameters:
graphicsDisplay - the GraphicsDisplay or null for none