com.tensegrity.graphics.interaction
Interface InteractionItem

All Known Implementing Classes:
com.tensegrity.graphics.interaction.AbstractInteractionItem

public interface InteractionItem

A InteractionItem specifies a single element like handles, lines, rectangles or areas for the interaction for an object that implements the BaseInteractable interface. Through the combination of several InteractionItems an object can be freely configured how to select and what interactions are possible. InteractionItems are stored within a InteractionDescriptor.

Version:
$Id: InteractionItem.java,v 1.12 2006/04/03 12:18:52 MichaelKegel Exp $
Author:
MichaelKegel
See Also:
InteractionDescriptor

Field Summary
static int AREA
          constant that defines an individual interaction item
static int HANDLE
          constant that defines an individual interaction item
static int LINE
          constant that defines an individual interaction item
static int POLYLINE
          constant that defines an individual interaction item
static int RECT
          constant that defines an individual interaction item
 
Method Summary
 java.lang.Object calculateMove(Transform2D xform_context, int x, int y)
           
 void draw(Device device, Transform2D xform_context)
          draws an object that implements this interface if it has a visual representation and is enabled for drawing.
 int getCursorID()
          Returns an identifier that specifies a cursor.
 boolean getDraw()
          Returns a boolean that indicates whether the InteractionItem is draw when the BaseInteractable is selected or is not draw.
 int getHandleSize()
          Returns the current handle size.
 int getSpecifier()
          Returns the specifier for an object that implements this interface.
 boolean hits(Transform2D xform_context, int x, int y)
          checks whether the given point hits the object that implements this interface.
 void move(Transform2D xform_context, int x, int y)
          This method is called from the InteractionContext when a move occurs.
 void moveStart(int x, int y)
          This method is called from the InteractionContext when a move is about to start.
 void moveStart(Transform2D xform_context, int x, int y)
          This method is called from the InteractionContext when a move is about to start.
 void moveStop(Transform2D xform_context, int x, int y)
          This method is called from the InteractionContext when a move has been done.
 void setCursorID(int cursorID)
           
 void setDraw(boolean draw)
          Sets the flag that indices whether the InteractionItem is drawn when the BaseInteractable is selected to the value given by draw.
 void setHandleSize(int handlesize)
          Sets the handle size to the value given by handlesize.
 void setTransform(Transform2D xform_object)
          sets the transform a selectable object is possibly transformed by.
 void update(java.lang.Object[] args)
          Updates the arguments the InteractionItem uses.
 

Field Detail

HANDLE

public static final int HANDLE
constant that defines an individual interaction item

See Also:
Constant Field Values

LINE

public static final int LINE
constant that defines an individual interaction item

See Also:
Constant Field Values

POLYLINE

public static final int POLYLINE
constant that defines an individual interaction item

See Also:
Constant Field Values

RECT

public static final int RECT
constant that defines an individual interaction item

See Also:
Constant Field Values

AREA

public static final int AREA
constant that defines an individual interaction item

See Also:
Constant Field Values
Method Detail

getSpecifier

public int getSpecifier()
Returns the specifier for an object that implements this interface.

Returns:
int the specifier

getHandleSize

public int getHandleSize()
Returns the current handle size. This size specifies the size of the handles that are drawn for the interaction item.

Returns:
int the current handle size

setHandleSize

public void setHandleSize(int handlesize)
Sets the handle size to the value given by handlesize. The handle size specifies the size of the handles that are drawn for the interaction item.

Parameters:
handlesize - the new size for the drawn handles

getDraw

public boolean getDraw()
Returns a boolean that indicates whether the InteractionItem is draw when the BaseInteractable is selected or is not draw.

Returns:
boolean the actual drawing state for the InteractionItem

setDraw

public void setDraw(boolean draw)
Sets the flag that indices whether the InteractionItem is drawn when the BaseInteractable is selected to the value given by draw.

Parameters:
draw - the new value for the drawing state

getCursorID

public int getCursorID()
Returns an identifier that specifies a cursor. The identifiers are defined by the constants in GraphicConstants.

Returns:
int the cursor identifier

setCursorID

public void setCursorID(int cursorID)

setTransform

public void setTransform(Transform2D xform_object)
sets the transform a selectable object is possibly transformed by.

Parameters:
xform_object - the transformation of the object

update

public void update(java.lang.Object[] args)
Updates the arguments the InteractionItem uses. Because the used arguments differ for each implementation of the InteractionItem please take a look at the documentation of the specific implementation of the InteractionItem to see what arguments and what order of the arguments are/is expected.

Parameters:
args - the array with the arguments

draw

public void draw(Device device,
                 Transform2D xform_context)
draws an object that implements this interface if it has a visual representation and is enabled for drawing.

Parameters:
device - the device to draw onto
xform_context - the transformation of the context

hits

public boolean hits(Transform2D xform_context,
                    int x,
                    int y)
checks whether the given point hits the object that implements this interface.

Parameters:
xform_context - the transformation of the context
x - the x coordinate of the point to check for
y - the y coordinate of the point to check for
Returns:
boolean flag that indicates whether the given point hits or not

moveStart

public void moveStart(int x,
                      int y)
This method is called from the InteractionContext when a move is about to start. It enables an object that implements this interface to do some initialisations needed for the move action and such.
This method is called without the context transformation so that the given coordinate must be given in logical units.

Parameters:
x - the x coordinate the move starts at
y - the y coordinate the move starts at

moveStart

public void moveStart(Transform2D xform_context,
                      int x,
                      int y)
This method is called from the InteractionContext when a move is about to start. It enables an object that implements this interface to do some initialisations needed for the move action and such.

Parameters:
xform_context - the transformation of the context
x - the x coordinate the move starts at
y - the y coordinate the move starts at

moveStop

public void moveStop(Transform2D xform_context,
                     int x,
                     int y)
This method is called from the InteractionContext when a move has been done. It enables an object that implements this interface to do some clean ups when a move action is finished.

Parameters:
xform_context - the transformation of the context
x - the x coordinate the move starts at
y - the y coordinate the move starts at

move

public void move(Transform2D xform_context,
                 int x,
                 int y)
This method is called from the InteractionContext when a move occurs. It enables an object that implements this interface to modify the Interactable object it is associated to.

Parameters:
xform_context - the transformation of the context
x - the x coordinate the move is currently at
y - the y coordinate the move is currently at

calculateMove

public java.lang.Object calculateMove(Transform2D xform_context,
                                      int x,
                                      int y)


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.