fr.inria.insitu.glite
Class Lite

java.lang.Object
  extended by fr.inria.insitu.glite.Lite
Direct Known Subclasses:
LiteBounded, LiteGroup

public abstract class Lite
extends Object

Lite ojects are very simple objects used to build a 2D scene graph.

Version:
$Revision: 1.12 $
Author:
Jean-Daniel Fekete

Constructor Summary
Lite()
           
 
Method Summary
 void descendantModified()
          Notifies this node that one of its descendant has been modified.
abstract  LiteBounds getBounds()
          Returns the bounds of this lite.
 Lite getChild(int i)
          Returns the Lite contained at the specified index in that Lite or null.
 int getChildrenCount()
          Returns the number of children contained in the Lite.
 LiteComponent getComponent()
           
 double getHeight()
           
 Lite getParent()
          Returns the parent of this Lite.
abstract  Point2D getPosition()
          Returns a reference position for this Lite.
 double getWidth()
           
 double getX()
           
 double getY()
           
 int indexOf(Lite l)
          Returns the index of the specified Lite or -1.
 void modified()
          Notifies this node that it has been modified.
 void moveBy(double dx, double dy)
          Move the Lite by a specified vector.
abstract  void paint(LitePaintContext ctx)
          Abstract method to called when the Lite should be painted.
abstract  Lite pick(LiteBounds box)
          Abstract method used to find the top Lite object under a specified bounding box.
 Lite pick(Point2D p)
          Picks the topmost object under the specified point.
abstract  ArrayList<Lite> pickAll(LiteBounds box, ArrayList<Lite> pickStack)
          Abstract method to pick all the Lite objects under a specified bounding box.
 void setParent(Lite p)
          Sets the parent of this Lite.
abstract  void setPosition(double x, double y)
          Change the reference position for this Lite.
 void setPosition(Point2D pos)
          Change the reference position for this Lite.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Lite

public Lite()
Method Detail

getBounds

public abstract LiteBounds getBounds()
Returns the bounds of this lite. Depending on the class, the returned object can be used by the Lite object or new. In general, don't change it and make a copy if you want to hold it. It can also be recomputed each time it is called so this method can be expensive.

Returns:
the bounds of this lite.

getPosition

public abstract Point2D getPosition()
Returns a reference position for this Lite.

Returns:
a reference position for this Lite.

setPosition

public final void setPosition(Point2D pos)
Change the reference position for this Lite.

Parameters:
pos - the new reference position.

setPosition

public abstract void setPosition(double x,
                                 double y)
Change the reference position for this Lite.

Parameters:
x - the new x coordinate
y - the new y coordinate

getParent

public Lite getParent()
Returns the parent of this Lite.

Returns:
the parent of this Lite.

setParent

public void setParent(Lite p)
Sets the parent of this Lite.

Parameters:
p - the new parent of this Lite.

modified

public void modified()
Notifies this node that it has been modified.


descendantModified

public void descendantModified()
Notifies this node that one of its descendant has been modified.


paint

public abstract void paint(LitePaintContext ctx)
Abstract method to called when the Lite should be painted.

Parameters:
ctx - the LitePaintContext

pick

public abstract Lite pick(LiteBounds box)
Abstract method used to find the top Lite object under a specified bounding box.

Parameters:
box - the box
Returns:
the top Lite under the box or null.

pickAll

public abstract ArrayList<Lite> pickAll(LiteBounds box,
                                        ArrayList<Lite> pickStack)
Abstract method to pick all the Lite objects under a specified bounding box. The topmost object is added first, then all the other objects are added.

Parameters:
box - the bounding box
pickStack - an ArrayList that will hold the Lite objects or null if you want the Lite to allocate it by itself.
Returns:
a list of all the picked Lite objects.

pick

public Lite pick(Point2D p)
Picks the topmost object under the specified point.

Parameters:
p - the point
Returns:
the topmost object under the specified point.

getChildrenCount

public int getChildrenCount()
Returns the number of children contained in the Lite.

Returns:
the number of children contained in the Lite

getChild

public Lite getChild(int i)
Returns the Lite contained at the specified index in that Lite or null.

Parameters:
i - the index
Returns:
the Lite contained at the specified index in that Lite or null.

indexOf

public int indexOf(Lite l)
Returns the index of the specified Lite or -1.

Parameters:
l - the Lite
Returns:
the index of the specified Lite or -1

getWidth

public double getWidth()
Returns:
the width of the bounding box.

getHeight

public double getHeight()
Returns:
the height of the bounding box.

getX

public double getX()
Returns:
the X position of the bounding box.

getY

public double getY()
Returns:
the Y position of the bounding box.

getComponent

public LiteComponent getComponent()
Returns:
the LiteComponent or null

moveBy

public void moveBy(double dx,
                   double dy)
Move the Lite by a specified vector.

Parameters:
dx - the x displacement
dy - the y displacement


Copyright © 2006 by Jean-Daniel Fekete and INRIA, France All rights reserved.