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

java.lang.Object
  extended bynl.tudelft.simulation.dsol.animation.D2.Renderable2D
      extended bynl.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 2003 Delft University of Technology , the Netherlands.
See for project information www.simulation.tudelft.nl
License of use: General Public License (GPL) , no warranty

Since:
1.4
Version:
1.2 Apr 30, 2004
Author:
Peter Jacobs

Nested Class Summary
 
Nested classes inherited from class 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  javax.swing.ImageIcon[] images
          the images to be used
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(nl.tudelft.simulation.language.d3.DirectedPoint staticLocation, java.awt.Dimension size, SimulatorInterface simulator, java.net.URL[] images)
          constructs a new ImageRenderable
ImageRenderable(LocatableInterface source, SimulatorInterface simulator, java.net.URL[] images)
          constructs a new ImageRenderable
ImageRenderable(java.awt.geom.Point2D staticLocation, java.awt.Dimension size, SimulatorInterface simulator, java.net.URL[] images)
          constructs a new ImageRenderable
 
Method Summary
 javax.swing.ImageIcon[] getImages()
           
 void paint(java.awt.Graphics2D graphics, java.awt.image.ImageObserver observer)
          draws an animation on a worldcoordinates around [x,y=0,0]
protected  java.awt.geom.Point2D resolveOrigin(short orientation, java.awt.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
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 javax.swing.ImageIcon[] images
the images to be used


orientation

protected short orientation
the origin of the image

Constructor Detail

ImageRenderable

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

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

ImageRenderable

public ImageRenderable(nl.tudelft.simulation.language.d3.DirectedPoint staticLocation,
                       java.awt.Dimension size,
                       SimulatorInterface simulator,
                       java.net.URL[] images)
constructs a new ImageRenderable

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

ImageRenderable

public ImageRenderable(java.awt.geom.Point2D staticLocation,
                       java.awt.Dimension size,
                       SimulatorInterface simulator,
                       java.net.URL[] images)
constructs a new ImageRenderable

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

paint

public void paint(java.awt.Graphics2D graphics,
                  java.awt.image.ImageObserver observer)
           throws java.rmi.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:
java.rmi.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 images[] 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 javax.swing.ImageIcon[] getImages()
Returns:
Returns the images.

resolveOrigin

protected java.awt.geom.Point2D resolveOrigin(short orientation,
                                              java.awt.Dimension size)
resolves the origin of the image

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


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