interactors
Class NewShapeInteractor

java.lang.Object
  extended by interactors.Interactor
      extended by interactors.NewShapeInteractor

public class NewShapeInteractor
extends Interactor

Interaction for creating a new object.


Field Summary
(package private)  java.util.ArrayList<java.awt.geom.Point2D> coordinates
          the coordinates of the new object
private  boolean drawCursorVertex
          specifies if a vertex should be drawn at the cursor location
private  GraphicalObject.Type type
          the graphical type of the new object
 
Fields inherited from class interactors.Interactor
handler
 
Constructor Summary
NewShapeInteractor(InteractionHandler handler)
          Constructs the new shape interactor.
 
Method Summary
 void constructObject()
          Displays a dialog allowsing the user to select the object type.
 void draw(GL gl, GLU glu, GLUT glut)
          Draws the outline of the new shape.
 java.awt.Cursor getCursor()
          Gets the new shape cursor.
 void mousePressed(java.awt.event.MouseEvent arg0)
          Left mouse clicks add new points to the shape.
 void startInteraction()
          Displays a dialog graphics types.
 
Methods inherited from class interactors.Interactor
endInteraction, keyPressed, keyReleased, mouseDragged, mouseMoved, mouseReleased
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

coordinates

java.util.ArrayList<java.awt.geom.Point2D> coordinates
the coordinates of the new object


type

private GraphicalObject.Type type
the graphical type of the new object


drawCursorVertex

private boolean drawCursorVertex
specifies if a vertex should be drawn at the cursor location

Constructor Detail

NewShapeInteractor

public NewShapeInteractor(InteractionHandler handler)
Constructs the new shape interactor.

Parameters:
handler - - the interaction handler
Method Detail

getCursor

public java.awt.Cursor getCursor()
Gets the new shape cursor.

Overrides:
getCursor in class Interactor

startInteraction

public void startInteraction()
Displays a dialog graphics types. If the user selects a graphics type, then the interaction beings drawing the new shape. If no type is selected, then the interaction is ended.

Overrides:
startInteraction in class Interactor

draw

public void draw(GL gl,
                 GLU glu,
                 GLUT glut)
Draws the outline of the new shape.

Overrides:
draw in class Interactor

mousePressed

public void mousePressed(java.awt.event.MouseEvent arg0)
Left mouse clicks add new points to the shape. The drawing interaction is completed by a double left click or a single right click. If there are less than two vertices, then a right click ends the interaction.

Overrides:
mousePressed in class Interactor

constructObject

public void constructObject()
Displays a dialog allowsing the user to select the object type. If an object type is selected, then a new object is created with the previously constructed graphics.