maspack.render
Class DrawToolBase

java.lang.Object
  extended by maspack.render.DragToolBase
      extended by maspack.render.DrawToolBase
All Implemented Interfaces:
Dragger3d, GLRenderable, GLSelectable
Direct Known Subclasses:
FreehandTool, SplineTool

public abstract class DrawToolBase
extends DragToolBase
implements Dragger3d


Nested Class Summary
static class DrawToolBase.FrameBinding
           
 
Field Summary
 
Fields inherited from interface maspack.render.GLRenderable
TRANSLUCENT, TWO_DIMENSIONAL
 
Method Summary
 void addListener(DrawToolListener l)
           
abstract  void clear()
          Clears the drawn contents of this tool.
 void fireDrawToolAddedListeners()
           
 void fireDrawToolBeginListeners(int modifiersEx)
           
 void fireDrawToolEndListeners(int modifiersEx)
           
 void fireDrawToolRemovedListeners()
           
 RigidTransform3d getFrame()
           
 DrawToolBase.FrameBinding getFrameBinding()
           
 double getFrameOffset()
           
 int getRenderHints()
          Returns a bit code giving rendering hints about this renderable.
 void getSelection(java.util.LinkedList<java.lang.Object> list, int qid)
          Append to list the component (or components) associated with the qid-th selection query issued by this component's render method.
 void getToolToWorld(RigidTransform3d X)
           
 GLViewer getViewer()
          Returns a reference to the viewer which is handling this drawTool.
 boolean isSelectable()
          Returns true if this object is in fact selectable.
 boolean isVisible()
           
 boolean mouseClicked(MouseRayEvent e)
           
 boolean mouseDragged(MouseRayEvent e)
           
 boolean mouseMoved(MouseRayEvent e)
           
 boolean mousePressed(MouseRayEvent e)
           
 boolean mouseReleased(MouseRayEvent e)
           
 int numSelectionQueriesNeeded()
          If this selectable manages its own selection (by issuing selection queries within its render method), then this method should return the maximum number of selection queries that will be required.
 void prerender(RenderList list)
          Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.
 boolean removeListener(DrawToolListener l)
           
 void setFrame(RigidTransform3d X)
           
 void setFrameBinding(DrawToolBase.FrameBinding binding)
           
 void setFrameOffset(double offset)
           
 void setViewer(GLViewer viewer)
          Used by the viewer to set a reference to itself when the drawTool is added.
 void setVisible(boolean visible)
           
 void updateBounds(Point3d pmin, Point3d pmax)
          Update the minimum and maximum points for this object.
 
Methods inherited from class maspack.render.DragToolBase
updateKeyMasks
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface maspack.render.GLRenderable
render
 

Method Detail

setFrameBinding

public void setFrameBinding(DrawToolBase.FrameBinding binding)

getFrameBinding

public DrawToolBase.FrameBinding getFrameBinding()

setFrameOffset

public void setFrameOffset(double offset)

getFrameOffset

public double getFrameOffset()

clear

public abstract void clear()
Clears the drawn contents of this tool.


setFrame

public void setFrame(RigidTransform3d X)

getFrame

public RigidTransform3d getFrame()

getToolToWorld

public void getToolToWorld(RigidTransform3d X)

addListener

public void addListener(DrawToolListener l)

removeListener

public boolean removeListener(DrawToolListener l)

fireDrawToolAddedListeners

public void fireDrawToolAddedListeners()

fireDrawToolBeginListeners

public void fireDrawToolBeginListeners(int modifiersEx)

fireDrawToolEndListeners

public void fireDrawToolEndListeners(int modifiersEx)

fireDrawToolRemovedListeners

public void fireDrawToolRemovedListeners()

isVisible

public boolean isVisible()
Specified by:
isVisible in interface Dragger3d

setVisible

public void setVisible(boolean visible)

mouseClicked

public boolean mouseClicked(MouseRayEvent e)
Specified by:
mouseClicked in interface Dragger3d

mousePressed

public boolean mousePressed(MouseRayEvent e)
Specified by:
mousePressed in interface Dragger3d

mouseReleased

public boolean mouseReleased(MouseRayEvent e)
Specified by:
mouseReleased in interface Dragger3d

mouseDragged

public boolean mouseDragged(MouseRayEvent e)
Specified by:
mouseDragged in interface Dragger3d

mouseMoved

public boolean mouseMoved(MouseRayEvent e)
Specified by:
mouseMoved in interface Dragger3d

setViewer

public void setViewer(GLViewer viewer)
Used by the viewer to set a reference to itself when the drawTool is added.


getViewer

public GLViewer getViewer()
Returns a reference to the viewer which is handling this drawTool. Used mainly to determine the size and alignment of constrained motions. Should not be modified in any way.


updateBounds

public void updateBounds(Point3d pmin,
                         Point3d pmax)
Description copied from interface: GLRenderable
Update the minimum and maximum points for this object. In an x-y-z coordinate system with x directed to the right and y directed upwards, the minimum and maximum points can be thought of as defining the left-lower-far and right-upper-near corners of a bounding cube. This method should only reduce the elements of the minimum point and increase the elements of the maximum point, since it may be used as part of an iteration to determine the bounding cube for several different objects.

Specified by:
updateBounds in interface GLRenderable
Parameters:
pmin - minimum point
pmax - maximum point

isSelectable

public boolean isSelectable()
Returns true if this object is in fact selectable.

Specified by:
isSelectable in interface GLSelectable
Returns:
true if this object is selectable

numSelectionQueriesNeeded

public int numSelectionQueriesNeeded()
If this selectable manages its own selection (by issuing selection queries within its render method), then this method should return the maximum number of selection queries that will be required. Otherwise, this method should return -1.

Specified by:
numSelectionQueriesNeeded in interface GLSelectable
Returns:
maximum number of selection queries needed by this component, or -1 if this component does not manage its own selection.

getSelection

public void getSelection(java.util.LinkedList<java.lang.Object> list,
                         int qid)
Append to list the component (or components) associated with the qid-th selection query issued by this component's render method. This will only be called if this component manages its own selection (i.e., the number nums returned by GLSelectable.numSelectionQueriesNeeded() is positive), and qid will in turn be a number between 0 and nums-1.

Specified by:
getSelection in interface GLSelectable
Parameters:
list - selected objects are appended to the end of this list
qid - index of the selection query

prerender

public void prerender(RenderList list)
Prepare for rendering, and potentially add itself to a list to be drawn by a GLRenderer.

Specified by:
prerender in interface GLRenderable

getRenderHints

public int getRenderHints()
Returns a bit code giving rendering hints about this renderable. Current bit codes include TRANSLUCENT.

Specified by:
getRenderHints in interface GLRenderable
Returns:
bit code of rendering hints.