nl.tudelft.simulation.dsol.animation.D2
Class ImageRenderable

java.lang.Object
  extended by nl.tudelft.simulation.dsol.animation.D2.Renderable2D
      extended by nl.tudelft.simulation.dsol.animation.D2.ImageRenderable
All Implemented Interfaces:
Renderable2DInterface
Direct Known Subclasses:
SingleImageRenderable

public abstract class ImageRenderable
extends Renderable2D

An abstract class for state-dependent image renderables.

(c) copyright 2002-2005 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: Lesser General Public License (LGPL) , no warranty.

Since:
1.4
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:21:28 $
Author:
Peter Jacobs

Nested Class Summary
 
Nested classes/interfaces inherited from interface nl.tudelft.simulation.dsol.animation.D2.Renderable2DInterface
Renderable2DInterface.Util
 
Field Summary
static short CB
          CENTER-BOTTOM location
static short CC
          CENTER-CENTER location
static short CT
          CENTER-TOP location
protected  ImageIcon[] imageIcons
          the imageIcons to be used
protected  URL[] images
          the imageIcons to use
static short LB
          LEFT-BOTTOM location
static short LC
          LEFT-CENTER location
static short LT
          LEFT-TOP location
protected  short orientation
          the origin of the image
static short RB
          RIGHT-BOTTOM location
static short RC
          RIGHT-CENTER location
static short RT
          RIGHT-TOP location
 
Fields inherited from class nl.tudelft.simulation.dsol.animation.D2.Renderable2D
flip, rotate, scale, simulator, source, translate
 
Constructor Summary
ImageRenderable(DirectedPoint staticLocation, Dimension size, SimulatorInterface simulator, URL[] images)
          constructs a new ImageRenderable
ImageRenderable(LocatableInterface source, SimulatorInterface simulator, URL[] images)
          constructs a new ImageRenderable
ImageRenderable(Point2D staticLocation, Dimension size, SimulatorInterface simulator, URL[] images)
          constructs a new ImageRenderable
 
Method Summary
 ImageIcon[] getImages()
           
 short getOrientation()
          Returns the orientation of this image to the point [0,0].
 void paint(Graphics2D graphics, ImageObserver observer)
          draws an animation on a worldcoordinates around [x,y=0,0]
protected  Point2D resolveOrigin(short orientation, Dimension size)
          resolves the origin of the image
abstract  int selectImage()
          selects the image.
 void setOrientation(short orientation)
           
 
Methods inherited from class nl.tudelft.simulation.dsol.animation.D2.Renderable2D
bind2Context, contains, destroy, getSource, isFlip, isRotate, isScale, isTranslate, paint, setFlip, setRotate, setScale, setTranslate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LB

public static final short LB
LEFT-BOTTOM location

See Also:
Constant Field Values

CB

public static final short CB
CENTER-BOTTOM location

See Also:
Constant Field Values

RB

public static final short RB
RIGHT-BOTTOM location

See Also:
Constant Field Values

LC

public static final short LC
LEFT-CENTER location

See Also:
Constant Field Values

CC

public static final short CC
CENTER-CENTER location

See Also:
Constant Field Values

RC

public static final short RC
RIGHT-CENTER location

See Also:
Constant Field Values

LT

public static final short LT
LEFT-TOP location

See Also:
Constant Field Values

CT

public static final short CT
CENTER-TOP location

See Also:
Constant Field Values

RT

public static final short RT
RIGHT-TOP location

See Also:
Constant Field Values

images

protected URL[] images
the imageIcons to use


imageIcons

protected transient ImageIcon[] imageIcons
the imageIcons to be used


orientation

protected short orientation
the origin of the image

Constructor Detail

ImageRenderable

public ImageRenderable(LocatableInterface source,
                       SimulatorInterface simulator,
                       URL[] images)
constructs a new ImageRenderable

Parameters:
source - the source to be animated.
simulator - the simulator to be used.
imageIcons - the image urls.

ImageRenderable

public ImageRenderable(DirectedPoint staticLocation,
                       Dimension size,
                       SimulatorInterface simulator,
                       URL[] images)
constructs a new ImageRenderable

Parameters:
staticLocation - the static location of the set of imageIcons
size - the size of the imageIcons in world coordinates.
simulator - the simulator to be used
imageIcons - the imageIcons to display.

ImageRenderable

public ImageRenderable(Point2D staticLocation,
                       Dimension size,
                       SimulatorInterface simulator,
                       URL[] images)
constructs a new ImageRenderable

Parameters:
staticLocation - the static location of the set of imageIcons
size - the size of the imageIcons in world coordinates.
simulator - the simulator to be used
imageIcons - the imageIcons to display.
Method Detail

paint

public void paint(Graphics2D graphics,
                  ImageObserver observer)
           throws RemoteException
Description copied from class: Renderable2D
draws an animation on a worldcoordinates around [x,y=0,0]

Specified by:
paint in class Renderable2D
Parameters:
graphics - the graphics object
observer - the observer
Throws:
RemoteException - on network exception
See Also:
Renderable2D.paint(java.awt.Graphics2D, java.awt.image.ImageObserver)

selectImage

public abstract int selectImage()
selects the image. This methods makes the ImageRenderable state dependent. One is required to return the index number of the imageIcons[] which has to be drawn.

Returns:
int the current (state-dependent) image.

setOrientation

public void setOrientation(short orientation)
Parameters:
orientation - The orientation to set.

getImages

public ImageIcon[] getImages()
Returns:
Returns the imageIcons.

resolveOrigin

protected Point2D resolveOrigin(short orientation,
                                Dimension size)
resolves the origin of the image

Parameters:
orientation - the orientation (CC,..)
size - the size of the image.
Returns:
Point2D the location

getOrientation

public short getOrientation()
Returns the orientation of this image to the point [0,0]. Orientations are either LEFT, CENTER, RIGHT and TOP, CENTER, or BOTTOM. An example is thus ImageRenderable.RT.

Returns:
the orientation of this image


Copyright © 2002-2010 Delft University of Technology, the Netherlands. All Rights Reserved.