com.tensegrity.graphics.interaction
Class LinearLineInteractionItem

java.lang.Object
  extended bycom.tensegrity.graphics.interaction.AbstractInteractionItem
      extended bycom.tensegrity.graphics.interaction.LinearLineInteractionItem
All Implemented Interfaces:
InteractionItem

public class LinearLineInteractionItem
extends com.tensegrity.graphics.interaction.AbstractInteractionItem

An implementation of the InteractionItem interface to enable linear line selection and manipulation.

Version:
$Id: LinearLineInteractionItem.java,v 1.13 2006/04/03 12:18:52 MichaelKegel Exp $
Author:
MichaelKegel

Field Summary
protected  int[] coordsX
          instance variable for the x components of the coordinates the InteractionItem uses
protected  int[] coordsX2
          instance variable for a second coordinates x components the InteractionItem uses
protected  int[] coordsY
          instance variable for the y components of the coordinates the InteractionItem uses
protected  int[] coordsY2
          instance variable for a second coordinates y components the InteractionItem uses
protected  int cursorID
          instance variable that identifies the cursor that should be displayed when the mouse position hits the InteractionItem or when interaction is performed.
protected  boolean draw
          instance variable that indicates whether the InteractionItem should be drawn or not.
protected  int handlesize
          instance variable for the size of the handle
protected  double[] offsetsX
          instance variable that keeps the distances between the x component of the interaction start coordinate and the x component of the coordinate to the points the interaction item refers to
protected  double[] offsetsY
          instance variable that keeps the distances between the y component of the interaction start coordinate and the y component of the coordinate to the points the interaction item refers to
protected  Transform2D xform_object
          instance variable for the transformation of the object the InteractionItem belongs to.
 
Fields inherited from interface com.tensegrity.graphics.interaction.InteractionItem
AREA, HANDLE, LINE, POLYLINE, RECT
 
Constructor Summary
LinearLineInteractionItem(int[] coordsX, int[] coordsY, int[] coordsX2, int[] coordsY2, int indexX1, int indexY1, int indexX2, int indexY2, Transform2D xform_object, boolean draw)
          Constructor for LinearLineInteractionItem.
LinearLineInteractionItem(int[] coordsX, int[] coordsY, int indexX1, int indexY1, int indexX2, int indexY2, Transform2D xform_object)
          Constructor for LinearLineInteractionItem.
LinearLineInteractionItem(int[] coordsX, int[] coordsY, int indexX1, int indexY1, int indexX2, int indexY2, Transform2D xform_object, boolean draw)
          Constructor for LinearLineInteractionItem.
LinearLineInteractionItem(int[] coordsX, int[] coordsY, int index1, int index2, Transform2D xform_object)
          Constructor for LinearLineInteractionItem.
LinearLineInteractionItem(int[] coordsX, int[] coordsY, int index1, int index2, Transform2D xform_object, boolean draw)
          Constructor for LinearLineInteractionItem.
LinearLineInteractionItem(int[] coordsX, int[] coordsY, int index1, int index2, Transform2D xform_object, boolean draw, int restrictionMove)
          Constructor for LinearLineInteractionItem.
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xform_object

protected Transform2D xform_object
instance variable for the transformation of the object the InteractionItem belongs to.


coordsX

protected int[] coordsX
instance variable for the x components of the coordinates the InteractionItem uses


coordsX2

protected int[] coordsX2
instance variable for a second coordinates x components the InteractionItem uses


coordsY

protected int[] coordsY
instance variable for the y components of the coordinates the InteractionItem uses


coordsY2

protected int[] coordsY2
instance variable for a second coordinates y components the InteractionItem uses


offsetsX

protected double[] offsetsX
instance variable that keeps the distances between the x component of the interaction start coordinate and the x component of the coordinate to the points the interaction item refers to


offsetsY

protected double[] offsetsY
instance variable that keeps the distances between the y component of the interaction start coordinate and the y component of the coordinate to the points the interaction item refers to


cursorID

protected int cursorID
instance variable that identifies the cursor that should be displayed when the mouse position hits the InteractionItem or when interaction is performed.


draw

protected boolean draw
instance variable that indicates whether the InteractionItem should be drawn or not.


handlesize

protected int handlesize
instance variable for the size of the handle

Constructor Detail

LinearLineInteractionItem

public LinearLineInteractionItem(int[] coordsX,
                                 int[] coordsY,
                                 int index1,
                                 int index2,
                                 Transform2D xform_object)
Constructor for LinearLineInteractionItem.


LinearLineInteractionItem

public LinearLineInteractionItem(int[] coordsX,
                                 int[] coordsY,
                                 int indexX1,
                                 int indexY1,
                                 int indexX2,
                                 int indexY2,
                                 Transform2D xform_object)
Constructor for LinearLineInteractionItem.


LinearLineInteractionItem

public LinearLineInteractionItem(int[] coordsX,
                                 int[] coordsY,
                                 int index1,
                                 int index2,
                                 Transform2D xform_object,
                                 boolean draw)
Constructor for LinearLineInteractionItem.


LinearLineInteractionItem

public LinearLineInteractionItem(int[] coordsX,
                                 int[] coordsY,
                                 int indexX1,
                                 int indexY1,
                                 int indexX2,
                                 int indexY2,
                                 Transform2D xform_object,
                                 boolean draw)
Constructor for LinearLineInteractionItem.


LinearLineInteractionItem

public LinearLineInteractionItem(int[] coordsX,
                                 int[] coordsY,
                                 int[] coordsX2,
                                 int[] coordsY2,
                                 int indexX1,
                                 int indexY1,
                                 int indexX2,
                                 int indexY2,
                                 Transform2D xform_object,
                                 boolean draw)
Constructor for LinearLineInteractionItem.


LinearLineInteractionItem

public LinearLineInteractionItem(int[] coordsX,
                                 int[] coordsY,
                                 int index1,
                                 int index2,
                                 Transform2D xform_object,
                                 boolean draw,
                                 int restrictionMove)
Constructor for LinearLineInteractionItem.

Method Detail

getSpecifier

public int getSpecifier()
Description copied from interface: InteractionItem
Returns the specifier for an object that implements this interface.

Returns:
int the specifier

update

public void update(java.lang.Object[] args)
Description copied from interface: InteractionItem
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)
Description copied from interface: InteractionItem
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)
Description copied from interface: InteractionItem
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)
Description copied from interface: InteractionItem
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)
Description copied from interface: InteractionItem
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)
Description copied from interface: InteractionItem
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)
Description copied from interface: InteractionItem
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)

getHandleSize

public int getHandleSize()
Description copied from interface: InteractionItem
Returns the current handle size. This size specifies the size of the handles that are drawn for the interaction item.

Specified by:
getHandleSize in interface InteractionItem
Returns:
int the current handle size

setHandleSize

public void setHandleSize(int handlesize)
Description copied from interface: InteractionItem
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.

Specified by:
setHandleSize in interface InteractionItem
Parameters:
handlesize - the new size for the drawn handles

getDraw

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

Specified by:
getDraw in interface InteractionItem
Returns:
boolean the actual drawing state for the InteractionItem

setDraw

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

Specified by:
setDraw in interface InteractionItem
Parameters:
draw - the new value for the drawing state

getCursorID

public int getCursorID()
Description copied from interface: InteractionItem
Returns an identifier that specifies a cursor. The identifiers are defined by the constants in GraphicConstants.

Specified by:
getCursorID in interface InteractionItem
Returns:
int the cursor identifier

setCursorID

public void setCursorID(int cursorID)
Specified by:
setCursorID in interface InteractionItem

setTransform

public void setTransform(Transform2D xform_object)
Description copied from interface: InteractionItem
sets the transform a selectable object is possibly transformed by.

Specified by:
setTransform in interface InteractionItem
Parameters:
xform_object - the transformation of the object


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