public abstract class TextAnimation extends Object implements Locatable, Serializable
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
Constructor and Description |
---|
TextAnimation(Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
float fontSize,
float minFontSize,
float maxFontSize,
SimulatorInterface.TimeDoubleUnit simulator) |
TextAnimation(Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
SimulatorInterface.TimeDoubleUnit simulator) |
Modifier and Type | Method and Description |
---|---|
abstract TextAnimation |
clone(Locatable newSource,
SimulatorInterface.TimeDoubleUnit newSimulator)
Clone the TextAnimation and return a copy for the new source on the new simulator.
|
void |
destroy()
Destroy the text animation.
|
javax.media.j3d.Bounds |
getBounds() |
protected Color |
getColor()
Retrieve the current color.
|
protected float |
getDx()
Retrieve dx.
|
protected float |
getDy()
Retrieve dy.
|
protected Font |
getFont()
Retrieve the font.
|
protected float |
getFontSize()
Retrieve the font size.
|
DirectedPoint |
getLocation() |
protected Locatable |
getSource()
Retrieve the source.
|
protected String |
getText()
Retrieve the current text.
|
protected TextAlignment |
getTextAlignment()
Retrieve the text alignment.
|
boolean |
isFlip()
Retrieve the current flip status.
|
boolean |
isRotate()
Retrieve the current rotation status.
|
boolean |
isScale()
Retrieve the current scale status.
|
boolean |
isTranslate()
Retrieve the current translate status.
|
void |
paint(Graphics2D graphics,
ImageObserver observer)
paint() method so it can be overridden or extended.
|
protected void |
setColor(Color color)
Update the color.
|
void |
setFlip(boolean flip)
Update the flip status.
|
void |
setRotate(boolean rotate)
Update the rotation status.
|
void |
setScale(boolean scale)
Update the scale status.
|
protected void |
setText(String text)
Update the text.
|
void |
setTranslate(boolean translate)
Update the translate status.
|
protected void |
setXY(float x,
float y)
Sets a new offset.
|
public TextAnimation(Locatable source, String text, float dx, float dy, TextAlignment textAlignment, Color color, float fontSize, float minFontSize, float maxFontSize, SimulatorInterface.TimeDoubleUnit simulator) throws RemoteException, NamingException
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 textfontSize
- float; the size of the font; default = 2.0 (meters)minFontSize
- float; minimum font size resulting from scalingmaxFontSize
- float; maximum font size resulting from scalingsimulator
- SimulatorInterface.TimeDoubleUnit; the simulatorNamingException
- when animation context cannot be created or retrievedRemoteException
- when remote context cannot be foundpublic TextAnimation(Locatable source, String text, float dx, float dy, TextAlignment textAlignment, Color color, SimulatorInterface.TimeDoubleUnit simulator) throws RemoteException, NamingException
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 simulatorNamingException
- when animation context cannot be created or retrievedRemoteException
- when remote context cannot be foundpublic DirectedPoint getLocation() throws RemoteException
getLocation
in interface Locatable
RemoteException
public final javax.media.j3d.Bounds getBounds() throws RemoteException
getBounds
in interface Locatable
RemoteException
public void paint(Graphics2D graphics, ImageObserver observer) throws RemoteException
graphics
- Graphics2D; the graphics objectobserver
- ImageObserver; the observerRemoteException
- on network exceptionpublic final void destroy()
public abstract TextAnimation clone(Locatable newSource, SimulatorInterface.TimeDoubleUnit newSimulator) throws RemoteException, NamingException
newSource
- Locatable; the new source to link to the text animationnewSimulator
- SimulatorInterface.TimeDoubleUnit; the new simulator to register the animation onRemoteException
- when remote animation cannot be reachedNamingException
- when animation name cannot be found or bound in the Contextprotected final Locatable getSource()
protected final float getDx()
protected final float getDy()
protected final void setXY(float x, float y)
x
- float; dxy
- float; dyprotected final TextAlignment getTextAlignment()
protected final float getFontSize()
protected final Font getFont()
protected final String getText()
protected final void setText(String text)
text
- String; the new textprotected final Color getColor()
protected final void setColor(Color color)
color
- Color; the new colorpublic final boolean isFlip()
public final void setFlip(boolean flip)
flip
- boolean; the new flip statuspublic final boolean isRotate()
public final void setRotate(boolean rotate)
rotate
- boolean; the new rotation statuspublic final boolean isScale()
public final void setScale(boolean scale)
scale
- boolean; the new scale statuspublic final boolean isTranslate()
public final void setTranslate(boolean translate)
translate
- boolean; the new translate statusCopyright © 2014–2019 Delft University of Technology. All rights reserved.