Package org.opentrafficsim.draw.gtu
Class DefaultCarAnimation.Text
- java.lang.Object
-
- org.opentrafficsim.draw.core.TextAnimation
-
- org.opentrafficsim.draw.gtu.DefaultCarAnimation.Text
-
- All Implemented Interfaces:
java.io.Serializable
,Locatable
- Enclosing class:
- DefaultCarAnimation
public class DefaultCarAnimation.Text extends TextAnimation
Text animation for the Car. Separate class to be able to turn it on and off...Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Dec 11, 2016
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opentrafficsim.draw.core.TextAnimation
TextAnimation.ContrastToBackground, TextAnimation.ScaleDependentRendering
-
-
Field Summary
-
Fields inherited from class org.opentrafficsim.draw.core.TextAnimation
RENDERALWAYS, RENDERWHEN1, RENDERWHEN10, RENDERWHEN100
-
-
Constructor Summary
Constructors Constructor Description Text(Locatable source, java.lang.String text, float dx, float dy, TextAlignment textAlignment, java.awt.Color color, SimulatorInterface.TimeDoubleUnit simulator)
Text(Locatable source, java.lang.String text, float dx, float dy, TextAlignment textAlignment, java.awt.Color color, SimulatorInterface.TimeDoubleUnit simulator, TextAnimation.ContrastToBackground background)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextAnimation
clone(Locatable newSource, SimulatorInterface.TimeDoubleUnit newSimulator)
Clone the TextAnimation and return a copy for the new source on the new simulator.DirectedPoint
getLocation()
void
paint(java.awt.Graphics2D graphics, java.awt.image.ImageObserver observer)
paint() method so it can be overridden or extended.java.lang.String
toString()
-
Methods inherited from class org.opentrafficsim.draw.core.TextAnimation
destroy, getBounds, getColor, getDx, getDy, getFont, getFontSize, getScaleDependentRendering, getSource, getText, getTextAlignment, isFlip, isRotate, isScale, isTranslate, setColor, setFlip, setRotate, setScale, setText, setTranslate, setXY
-
-
-
-
Constructor Detail
-
Text
public Text(Locatable source, java.lang.String text, float dx, float dy, TextAlignment textAlignment, java.awt.Color color, SimulatorInterface.TimeDoubleUnit simulator) throws java.rmi.RemoteException, javax.naming.NamingException
- Parameters:
source
- Locatable; the object for which the text is displayedtext
- String; the text to displaydx
- float; the horizontal movement of the text, in metersdy
- float; the vertical movement of the text, in meterstextAlignment
- TextAlignment; where to place the textcolor
- Color; the color of the textsimulator
- SimulatorInterface.TimeDoubleUnit; the simulator- Throws:
javax.naming.NamingException
- when animation context cannot be created or retrievedjava.rmi.RemoteException
- - when remote context cannot be found
-
Text
public Text(Locatable source, java.lang.String text, float dx, float dy, TextAlignment textAlignment, java.awt.Color color, SimulatorInterface.TimeDoubleUnit simulator, TextAnimation.ContrastToBackground background) throws java.rmi.RemoteException, javax.naming.NamingException
- Parameters:
source
- Locatable; the object for which the text is displayedtext
- String; the text to displaydx
- float; the horizontal movement of the text, in metersdy
- float; the vertical movement of the text, in meterstextAlignment
- TextAlignment; where to place the textcolor
- Color; the color of the textsimulator
- SimulatorInterface.TimeDoubleUnit; the simulatorbackground
- TextAnimation.ContrastToBackground; connection to retrieve the current background color- Throws:
javax.naming.NamingException
- when animation context cannot be created or retrievedjava.rmi.RemoteException
- - when remote context cannot be found
-
-
Method Detail
-
paint
public final void paint(java.awt.Graphics2D graphics, java.awt.image.ImageObserver observer) throws java.rmi.RemoteException
paint() method so it can be overridden or extended.- Overrides:
paint
in classTextAnimation
- Parameters:
graphics
- Graphics2D; the graphics objectobserver
- ImageObserver; the observer- Throws:
java.rmi.RemoteException
- on network exception
-
getLocation
public DirectedPoint getLocation() throws java.rmi.RemoteException
- Specified by:
getLocation
in interfaceLocatable
- Overrides:
getLocation
in classTextAnimation
- Throws:
java.rmi.RemoteException
-
clone
public TextAnimation clone(Locatable newSource, SimulatorInterface.TimeDoubleUnit newSimulator) throws java.rmi.RemoteException, javax.naming.NamingException
Clone the TextAnimation and return a copy for the new source on the new simulator.- Specified by:
clone
in classTextAnimation
- Parameters:
newSource
- Locatable; the new source to link to the text animationnewSimulator
- SimulatorInterface.TimeDoubleUnit; the new simulator to register the animation on- Returns:
- TextAnimation; a copy of this TextAnimation
- Throws:
java.rmi.RemoteException
- when remote animation cannot be reachedjavax.naming.NamingException
- when animation name cannot be found or bound in the Context
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-