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

java.lang.Object
  extended by nl.tudelft.simulation.dsol.animation.D2.GisRenderable2D
All Implemented Interfaces:
Renderable2DInterface, LocatableInterface

public class GisRenderable2D
extends Object
implements Renderable2DInterface, LocatableInterface

This renderable draws CAD/GIS objects.

(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
protected  Bounds bounds
          the bounds of the image
protected  Rectangle2D extent
          the cached extent
protected  BufferedImage image
          the image cached image
protected  DirectedPoint location
          the location of the image
protected  nl.javel.gisbeans.map.MapInterface map
          the map to display
protected  Dimension screenSize
          the cached screenSize
 
Constructor Summary
GisRenderable2D(SimulatorInterface simulator, URL mapFile)
          constructs a new GisRenderable2D
 
Method Summary
protected  void bind2Context(SimulatorInterface simulator)
          binds a renderable2D to the context.
 boolean contains(Point2D pointWorldCoordinates, Rectangle2D extent, Dimension screen)
          does the shape contain the point
 void destroy()
          destroys an RenderableObject by unsubscribing it from the context.
 Bounds getBounds()
          returns the bounds of the locatable object.
 DirectedPoint getLocation()
          returns the location of an object
 LocatableInterface getSource()
          gets the source of this renderable
 void paint(Graphics2D graphics, Rectangle2D extent, Dimension screen, ImageObserver observer)
          paints the object on a 2D graphics object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected nl.javel.gisbeans.map.MapInterface map
the map to display


image

protected BufferedImage image
the image cached image


extent

protected Rectangle2D extent
the cached extent


screenSize

protected Dimension screenSize
the cached screenSize


location

protected DirectedPoint location
the location of the image


bounds

protected Bounds bounds
the bounds of the image

Constructor Detail

GisRenderable2D

public GisRenderable2D(SimulatorInterface simulator,
                       URL mapFile)
constructs a new GisRenderable2D

Parameters:
simulator - the simulator.
mapFile - the mapfile to use.
Method Detail

bind2Context

protected void bind2Context(SimulatorInterface simulator)
binds a renderable2D to the context. The reason for specifying this in an independent method instead of adding the code in the constructor is related to the RFE submitted by van Houten that in specific distributed context, such binding must be overwritten.

Parameters:
simulator - the simulator used for binding the object.

paint

public void paint(Graphics2D graphics,
                  Rectangle2D extent,
                  Dimension screen,
                  ImageObserver observer)
Description copied from interface: Renderable2DInterface
paints the object on a 2D graphics object

Specified by:
paint in interface Renderable2DInterface
Parameters:
graphics - the graphics object
extent - the extent of the panel
screen - the screen of the panel
observer - the observer of the renderableInterface
See Also:
#paint(java.awt.Graphics2D, java.awt.geom.Rectangle2D, java.awt.Dimension, java.awt.image.ImageObserver)

getSource

public LocatableInterface getSource()
Description copied from interface: Renderable2DInterface
gets the source of this renderable

Specified by:
getSource in interface Renderable2DInterface
Returns:
Locatable the source
See Also:
Renderable2DInterface.getSource()

getBounds

public Bounds getBounds()
Description copied from interface: LocatableInterface
returns the bounds of the locatable object. The bounds is the not rotated bounds around [0;0;0]

Specified by:
getBounds in interface LocatableInterface
Returns:
BoundingBox include this.getLocation() as center of the box..
See Also:
LocatableInterface.getBounds()

getLocation

public DirectedPoint getLocation()
Description copied from interface: LocatableInterface
returns the location of an object

Specified by:
getLocation in interface LocatableInterface
Returns:
DirectedPoint the location
See Also:
LocatableInterface.getLocation()

destroy

public void destroy()
destroys an RenderableObject by unsubscribing it from the context.

Specified by:
destroy in interface Renderable2DInterface

contains

public boolean contains(Point2D pointWorldCoordinates,
                        Rectangle2D extent,
                        Dimension screen)
Description copied from interface: Renderable2DInterface
does the shape contain the point

Specified by:
contains in interface Renderable2DInterface
Parameters:
pointWorldCoordinates - the point in world coordinates. Default implementation is to intersect the 3D bounds on location.z and to return the bounds2D of this intersect.
extent - the extent of the panel.
screen - the screen of the panel.
Returns:
whether the point is in the shape
See Also:
Renderable2DInterface.contains(java.awt.geom.Point2D, java.awt.geom.Rectangle2D, java.awt.Dimension)


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