de.steeringbehaviors.simulation.renderer
Class InfoBox

java.lang.Object
  extended by de.steeringbehaviors.simulation.renderer.RenderInfo
      extended by de.steeringbehaviors.simulation.renderer.InfoBox
All Implemented Interfaces:
java.lang.Comparable

public class InfoBox
extends RenderInfo


Field Summary
protected  java.awt.FontMetrics m_fontMetrics
           
protected  int m_fontSize
           
protected  Point2d m_relPos
           
protected  java.lang.String m_text
           
 
Fields inherited from class de.steeringbehaviors.simulation.renderer.RenderInfo
CIRCLE, INFOBOX, m_color, m_parent, m_pos, m_scaleX, m_scaleY, m_type, m_z, POLYGONSHAPE, RENDERINFO, TILE, VECTORSHAPE
 
Constructor Summary
InfoBox(Point2d relPos)
           
InfoBox(Point2d relPos, java.lang.String text)
           
InfoBox(Point2d relPos, java.lang.String text, int fontSize)
           
 
Method Summary
 double getFarthestDistance()
          Returns the distance of the point on the shape that is farthest away from the center of the geometrie.
 int getFontSize()
           
 Point2d getRelPos()
           
 java.lang.String getText()
           
 boolean isInside(double x, double y)
          Tests if the point is inside the shape
 void scale(double factor)
          Scales the complete object according to the factor.
 void setFontMetrics(java.awt.FontMetrics theFont)
           
 void setFontSize(int fontSize)
           
 void setRelPos(Point2d relPos)
           
 void setText(java.lang.String text)
           
 
Methods inherited from class de.steeringbehaviors.simulation.renderer.RenderInfo
compareTo, getColor, getParent, getPos, getScaleX, getScaleY, getType, getZ, moveCenter, setColor, setParent, setPos, setScaleX, setScaleY, setZ
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_fontMetrics

protected java.awt.FontMetrics m_fontMetrics

m_relPos

protected Point2d m_relPos

m_fontSize

protected int m_fontSize

m_text

protected java.lang.String m_text
Constructor Detail

InfoBox

public InfoBox(Point2d relPos)

InfoBox

public InfoBox(Point2d relPos,
               java.lang.String text)

InfoBox

public InfoBox(Point2d relPos,
               java.lang.String text,
               int fontSize)
Method Detail

scale

public void scale(double factor)
Scales the complete object according to the factor. Works only if the factor is greater zero.

Parameters:
factor - Scale to apply to the object

setFontMetrics

public void setFontMetrics(java.awt.FontMetrics theFont)

setFontSize

public void setFontSize(int fontSize)

setRelPos

public void setRelPos(Point2d relPos)

setText

public void setText(java.lang.String text)

getFarthestDistance

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

Overrides:
getFarthestDistance in class RenderInfo
Returns:
The farthest distance from the center of the geometrie

getFontSize

public int getFontSize()

getRelPos

public Point2d getRelPos()

getText

public java.lang.String getText()

isInside

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

Overrides:
isInside in class RenderInfo
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