de.steeringbehaviors.simulation.renderer
Class RenderInfo

java.lang.Object
  extended by de.steeringbehaviors.simulation.renderer.RenderInfo
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
Circle, InfoBox, PolygonShape, Tile, VectorShape

public class RenderInfo
extends java.lang.Object
implements java.lang.Comparable

Base class for all shapes used by the renderer


Field Summary
static int CIRCLE
           
static int INFOBOX
           
protected  java.awt.Color m_color
          The color of the shape
protected  Geometrie m_parent
          This is the parent Geometrie object
protected  Point2d m_pos
          Position of the shape after transformation into view space
protected  double m_scaleX
          The scale of the shape along the x axis
protected  double m_scaleY
          The scale of the shape along the y axis
protected  int m_type
          The type of the shape.
protected  int m_z
          Z position of the shape.
static int POLYGONSHAPE
           
static int RENDERINFO
           
static int TILE
           
static int VECTORSHAPE
           
 
Constructor Summary
RenderInfo()
          Constructs a simple shape
RenderInfo(int z)
          Constructs a shape including the z position
RenderInfo(int z, Geometrie parent)
          Constructs a new shape
 
Method Summary
 int compareTo(java.lang.Object o)
          Function used in comparable sets to compare two RenderInfo objects
 java.awt.Color getColor()
          Returns the color of the shape
 double getFarthestDistance()
          Returns the distance of the point on the shape that is farthest away from the center of the geometrie.
 Geometrie getParent()
          Returns the parent Geometrie object
 Point2d getPos()
          Returns the position
 double getScaleX()
          Returns the scaling of the shape along the x axis
 double getScaleY()
          Returns the scaling of the shape along the y axis
 int getType()
          Return the type of the object
 int getZ()
          Returns the z position
 boolean isInside(double x, double y)
          Tests if the point is inside the shape
 void moveCenter(Vector2d relMove)
          Transforms the shape in local space.
 void setColor(java.awt.Color c)
          Sets the color of the shape
 void setParent(Geometrie parent)
          Sets the parent Geometrie object
 void setPos(Point2d pos)
          Sets the position
 void setScaleX(double scaleX)
          Scales the complete object along the x axis according to the factor.
 void setScaleY(double scaleY)
          Scales the complete object along the Y axis according to the factor.
 void setZ(int z)
          Sets the z position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RENDERINFO

public static final int RENDERINFO
See Also:
Constant Field Values

CIRCLE

public static final int CIRCLE
See Also:
Constant Field Values

VECTORSHAPE

public static final int VECTORSHAPE
See Also:
Constant Field Values

POLYGONSHAPE

public static final int POLYGONSHAPE
See Also:
Constant Field Values

TILE

public static final int TILE
See Also:
Constant Field Values

INFOBOX

public static final int INFOBOX
See Also:
Constant Field Values

m_color

protected java.awt.Color m_color
The color of the shape


m_parent

protected Geometrie m_parent
This is the parent Geometrie object


m_pos

protected Point2d m_pos
Position of the shape after transformation into view space


m_scaleX

protected double m_scaleX
The scale of the shape along the x axis


m_scaleY

protected double m_scaleY
The scale of the shape along the y axis


m_type

protected int m_type
The type of the shape. Also see the type constants defined in this class


m_z

protected int m_z
Z position of the shape. This value is used to determine the order of drawing (eg. back to front)

Constructor Detail

RenderInfo

public RenderInfo()
Constructs a simple shape


RenderInfo

public RenderInfo(int z)
Constructs a shape including the z position

Parameters:
z - The z position

RenderInfo

public RenderInfo(int z,
                  Geometrie parent)
Constructs a new shape

Parameters:
z - The z position
parent - The parent Geometrie
Method Detail

moveCenter

public void moveCenter(Vector2d relMove)
Transforms the shape in local space.

Parameters:
relMove - Vector used to move the points

setColor

public void setColor(java.awt.Color c)
Sets the color of the shape

Parameters:
c - The new color of the shape

setParent

public void setParent(Geometrie parent)
Sets the parent Geometrie object

Parameters:
parent - The parent Geometrie object

setPos

public void setPos(Point2d pos)
Sets the position

Parameters:
pos - The new position

setScaleX

public void setScaleX(double scaleX)
Scales the complete object along the x axis according to the factor. Works only if the factor is greater zero.

Parameters:
factor - Scale to apply to the object

setScaleY

public void setScaleY(double scaleY)
Scales the complete object along the Y axis according to the factor. Works only if the factor is greater zero.

Parameters:
factor - Scale to apply to the object

setZ

public void setZ(int z)
Sets the z position

Parameters:
z - The z position

getColor

public java.awt.Color getColor()
Returns the color of the shape

Returns:
The color of the shape

getFarthestDistance

public double getFarthestDistance()
Returns the distance of the point on the shape that is farthest away from the center of the geometrie.

Returns:
The farthest distance from the center of the geometrie

getParent

public Geometrie getParent()
Returns the parent Geometrie object

Returns:
The parent Geometrie object

getPos

public Point2d getPos()
Returns the position

Returns:
The position

getType

public int getType()
Return the type of the object

Returns:
A type of shape defined in this class

getZ

public int getZ()
Returns the z position

Returns:
The z position

getScaleX

public double getScaleX()
Returns the scaling of the shape along the x axis

Returns:
The scaling along the x axis

getScaleY

public double getScaleY()
Returns the scaling of the shape along the y axis

Returns:
The scaling along the y axis

compareTo

public int compareTo(java.lang.Object o)
Function used in comparable sets to compare two RenderInfo objects

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - The other object to compare to
Returns:
0 = Objects equal, -1 = other object > this object, 1 = other object < this object

isInside

public boolean isInside(double x,
                        double y)
Tests if the point is inside the shape

Parameters:
x - The x position in screen coordinates
y - The y position in screen coordinates
zoom - The zoom factor used in drawing the shape
Returns:
True if the point is inside, False if not