backend
Class MouseHandler

java.lang.Object
  extended by java.util.Observable
      extended by backend.MouseHandler

public class MouseHandler
extends java.util.Observable

MouseHandler handles mouse clicks by determining the appropriate action to take depending on how it is set It is really only meant to interact with a SphereWorld


Constructor Summary
MouseHandler(SphereWorldModel theWorldModel, com.sun.j3d.utils.behaviors.vp.OrbitBehavior theRotator, InformationModel theInformation, javax.swing.JPanel theController)
          The MouseHandler constructor takes a initalized SphereWorld to play with
 
Method Summary
 void addCircle(SphereCircleModel addMe)
          addCircle will add a SphereCircleModel to the current state of the mouse handler.
 void addLine(SphereLineModel addMe)
          addLine will add a line to be processed by the mouse handler
 void addPoint(float x, float y, float z)
          addPoints behavior changes based on the current operation that is set for the mouse rotator
 void addPoint(SpherePointModel addMe)
          addPoint will add a point to be processed by the mouse handler depending on when mode it's set it
 void newMouseLoc(java.awt.event.MouseEvent newPt, javax.vecmath.Point3f worldLoc)
          newMouseLoc will update the current MouseHandlerState as to the position of the Mouse
 void reset()
          reset is used to reset the current state of the MouseHandler
 boolean sendMouseLoc()
          sendMouseLoc returns true if the current mouse location should be sent to the state
 void setOperationAngleMeasure()
          setOperationAngleMeasure will set the current operation to get return angle measures
 void setOperationDrawCircle()
          setOperationDrawCircle will switch the current state to draw circle
 void setOperationDrawPoint()
          setOperationDrawPoint will set the mouse handler to draw points when a point is passed to it
 void setOperationGreatCircle()
          setOperationGreatCircle will set the current state to draw great circles on the sphere
 void setOperationLineIntersection()
          setOperationLineIntersection will set the current state to find the intersection of two lines
 void setOperationLineMeasure()
          setOperationLineMeasure will set the current state to measure the distance of a line
 void setOperationLongLine()
          setOperationLongLine will set the current state to draw long lines on the sphere
 void setOperationMovePt()
          setOperationMovePt will set the current state to one where the moving of points is allowed
 void setOperationParaTrans()
          setOperationParaTrans will switch the current state to parallel transport
 void setOperationPointRename()
          setOperationPointRename will switch the current state to the state that lets points to be renamed
 void setOperationRemoveObject()
          setOperationRemoveObject will set the current state to one where objects can be removed
 void setOperationRotatePt()
          setOperationRotatePt will switch to point rotation mode
 void setOperationRotateSphere()
          setOperationRotateSphere will set the mouse handler to allow the sphere to be rotated when a user clicks and holds on the sphere
 void setOperationShortLine()
          setOperationShortLine will set the current state to draw short line on the sphere
 void setOperationTriangleAreaMeasure()
          setOperationTriangleAreaMeasure will set the current state to find the area of a triangle
 void setOperationZoom()
          setOperationZoomState will set the current state to one where the sphere will zoom.
 boolean shouldHighlight(SphereBasicObject myObj)
          shouldHighlight will let the current state decide whether this object should be highlighted or not
 java.lang.String stateName()
          stateName returns the name associated with the current state
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MouseHandler

public MouseHandler(SphereWorldModel theWorldModel,
                    com.sun.j3d.utils.behaviors.vp.OrbitBehavior theRotator,
                    InformationModel theInformation,
                    javax.swing.JPanel theController)
The MouseHandler constructor takes a initalized SphereWorld to play with

Parameters:
theWorldModel - the SphereWorldModel for MouseHandler to pass on to different states
theWorld - the SphereWorld for MouseHandler to pass on to different states
theRotator - is the OrbitBehavior to have the MouseHandler control
theInformation - is the InformationModel for the MouseHandler to pass on to different states
theController - should be the main JFrame so errors can be displayed correctly
Method Detail

setOperationDrawPoint

public void setOperationDrawPoint()
setOperationDrawPoint will set the mouse handler to draw points when a point is passed to it


setOperationRotateSphere

public void setOperationRotateSphere()
setOperationRotateSphere will set the mouse handler to allow the sphere to be rotated when a user clicks and holds on the sphere


setOperationAngleMeasure

public void setOperationAngleMeasure()
setOperationAngleMeasure will set the current operation to get return angle measures


setOperationShortLine

public void setOperationShortLine()
setOperationShortLine will set the current state to draw short line on the sphere


setOperationGreatCircle

public void setOperationGreatCircle()
setOperationGreatCircle will set the current state to draw great circles on the sphere


setOperationLongLine

public void setOperationLongLine()
setOperationLongLine will set the current state to draw long lines on the sphere


setOperationLineMeasure

public void setOperationLineMeasure()
setOperationLineMeasure will set the current state to measure the distance of a line


setOperationLineIntersection

public void setOperationLineIntersection()
setOperationLineIntersection will set the current state to find the intersection of two lines


setOperationTriangleAreaMeasure

public void setOperationTriangleAreaMeasure()
setOperationTriangleAreaMeasure will set the current state to find the area of a triangle


setOperationRemoveObject

public void setOperationRemoveObject()
setOperationRemoveObject will set the current state to one where objects can be removed


setOperationZoom

public void setOperationZoom()
setOperationZoomState will set the current state to one where the sphere will zoom.


setOperationMovePt

public void setOperationMovePt()
setOperationMovePt will set the current state to one where the moving of points is allowed


setOperationRotatePt

public void setOperationRotatePt()
setOperationRotatePt will switch to point rotation mode


setOperationParaTrans

public void setOperationParaTrans()
setOperationParaTrans will switch the current state to parallel transport


setOperationDrawCircle

public void setOperationDrawCircle()
setOperationDrawCircle will switch the current state to draw circle


setOperationPointRename

public void setOperationPointRename()
setOperationPointRename will switch the current state to the state that lets points to be renamed


addPoint

public void addPoint(float x,
                     float y,
                     float z)
addPoints behavior changes based on the current operation that is set for the mouse rotator

Parameters:
x - is the x point to add to the world
y - is the y point to add to the world
z - is the z point to add to the world

addPoint

public void addPoint(SpherePointModel addMe)
addPoint will add a point to be processed by the mouse handler depending on when mode it's set it

Parameters:
addMe - the point to add in SpheriosityPoint form

addLine

public void addLine(SphereLineModel addMe)
addLine will add a line to be processed by the mouse handler

Parameters:
addMe - is sent to the current state for manipulation

addCircle

public void addCircle(SphereCircleModel addMe)
addCircle will add a SphereCircleModel to the current state of the mouse handler.

Parameters:
addMe - the SphereCircleModel to pass along to the current state

newMouseLoc

public void newMouseLoc(java.awt.event.MouseEvent newPt,
                        javax.vecmath.Point3f worldLoc)
newMouseLoc will update the current MouseHandlerState as to the position of the Mouse

Parameters:
newPt - The new location of the mouse
worldLoc - Should be the mouse point converted to world coordinates

shouldHighlight

public boolean shouldHighlight(SphereBasicObject myObj)
shouldHighlight will let the current state decide whether this object should be highlighted or not

Parameters:
myObj - the object to highlight
Returns:
true if it should get highlight or false if it should not.

reset

public void reset()
reset is used to reset the current state of the MouseHandler


stateName

public java.lang.String stateName()
stateName returns the name associated with the current state

Returns:
The name of this state.

sendMouseLoc

public boolean sendMouseLoc()
sendMouseLoc returns true if the current mouse location should be sent to the state

Returns:
true if the mouse location should be sent and false if it should not be sent