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:
Serializable
,Locatable
- Enclosing class:
- DefaultCarAnimation
Text animation for the Car. Separate class to be able to turn it on and off...
Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
- See Also:
-
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
ConstructorsConstructorDescriptionText
(Locatable source, String text, float dx, float dy, TextAlignment textAlignment, Color color, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator) Text
(Locatable source, String text, float dx, float dy, TextAlignment textAlignment, Color color, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, TextAnimation.ContrastToBackground background) -
Method Summary
Modifier and TypeMethodDescriptionorg.opentrafficsim.core.geometry.DirectedPoint
final void
paint
(Graphics2D graphics, ImageObserver observer) paint() method so it can be overridden or extended.final 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 Details
-
Text
public Text(Locatable source, String text, float dx, float dy, TextAlignment textAlignment, Color color, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator) throws RemoteException, 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
- OtsSimulatorInterface; the simulator- Throws:
NamingException
- when animation context cannot be created or retrievedRemoteException
- - when remote context cannot be found
-
Text
public Text(Locatable source, String text, float dx, float dy, TextAlignment textAlignment, Color color, org.opentrafficsim.core.dsol.OtsSimulatorInterface simulator, TextAnimation.ContrastToBackground background) throws RemoteException, 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
- OtsSimulatorInterface; the simulatorbackground
- TextAnimation.ContrastToBackground; connection to retrieve the current background color- Throws:
NamingException
- when animation context cannot be created or retrievedRemoteException
- - when remote context cannot be found
-
-
Method Details
-
paint
paint() method so it can be overridden or extended.- Overrides:
paint
in classTextAnimation
- Parameters:
graphics
- Graphics2D; the graphics objectobserver
- ImageObserver; the observer
-
getLocation
public org.opentrafficsim.core.geometry.DirectedPoint getLocation()- Specified by:
getLocation
in interfaceLocatable
- Overrides:
getLocation
in classTextAnimation
-
toString
-