public abstract class TextAnimation extends Object implements nl.tudelft.simulation.dsol.animation.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.
| Modifier and Type | Class and Description |
|---|---|
static interface |
TextAnimation.ContrastToBackground
Interface to obtain the color of the background.
|
static interface |
TextAnimation.ScaleDependentRendering
Determine if a Feature object should be rendered.
|
| Modifier and Type | Field and Description |
|---|---|
static TextAnimation.ScaleDependentRendering |
RENDERALWAYS
Always render the Text.
|
static TextAnimation.ScaleDependentRendering |
RENDERWHEN1
Don't render texts when smaller than 1.
|
static TextAnimation.ScaleDependentRendering |
RENDERWHEN10
Don't render texts when smaller than 2.
|
static TextAnimation.ScaleDependentRendering |
RENDERWHEN100
Don't render texts when smaller than 2.
|
| Constructor and Description |
|---|
TextAnimation(nl.tudelft.simulation.dsol.animation.Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
float fontSize,
float minFontSize,
float maxFontSize,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit simulator,
TextAnimation.ContrastToBackground background,
TextAnimation.ScaleDependentRendering scaleDependentRendering)
Construct a new TextAnimation.
|
TextAnimation(nl.tudelft.simulation.dsol.animation.Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
float fontSize,
float minFontSize,
float maxFontSize,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit simulator,
TextAnimation.ScaleDependentRendering scaleDependentRendering)
Construct a new TextAnimation without contrast to background protection and no minimum font scale.
|
TextAnimation(nl.tudelft.simulation.dsol.animation.Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit simulator,
TextAnimation.ScaleDependentRendering scaleDependentRendering) |
| Modifier and Type | Method and Description |
|---|---|
abstract TextAnimation |
clone(nl.tudelft.simulation.dsol.animation.Locatable newSource,
nl.tudelft.simulation.dsol.simulators.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.
|
nl.tudelft.simulation.language.d3.DirectedPoint |
getLocation() |
protected TextAnimation.ScaleDependentRendering |
getScaleDependentRendering()
Retrieve the scale dependent rendering qualifier (used in cloning).
|
protected nl.tudelft.simulation.dsol.animation.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 static final TextAnimation.ScaleDependentRendering RENDERALWAYS
public static final TextAnimation.ScaleDependentRendering RENDERWHEN1
public static final TextAnimation.ScaleDependentRendering RENDERWHEN10
public static final TextAnimation.ScaleDependentRendering RENDERWHEN100
public TextAnimation(nl.tudelft.simulation.dsol.animation.Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
float fontSize,
float minFontSize,
float maxFontSize,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit simulator,
TextAnimation.ContrastToBackground background,
TextAnimation.ScaleDependentRendering scaleDependentRendering)
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 simulatorbackground - ContrastToBackground; allows querying the background color and adaptation of the actual color of the
text to ensure contrastscaleDependentRendering - ScaleDependentRendering; suppress rendering when font scale is too smallNamingException - when animation context cannot be created or retrievedRemoteException - when remote context cannot be foundpublic TextAnimation(nl.tudelft.simulation.dsol.animation.Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
float fontSize,
float minFontSize,
float maxFontSize,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit simulator,
TextAnimation.ScaleDependentRendering scaleDependentRendering)
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 simulatorscaleDependentRendering - ScaleDependentRendering; render text only when bigger than minimum scaleNamingException - when animation context cannot be created or retrievedRemoteException - when remote context cannot be foundpublic TextAnimation(nl.tudelft.simulation.dsol.animation.Locatable source,
String text,
float dx,
float dy,
TextAlignment textAlignment,
Color color,
nl.tudelft.simulation.dsol.simulators.SimulatorInterface.TimeDoubleUnit simulator,
TextAnimation.ScaleDependentRendering scaleDependentRendering)
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 simulatorscaleDependentRendering - ScaleDependentRendering; render text only when bigger than minimum scaleNamingException - when animation context cannot be created or retrievedRemoteException - when remote context cannot be foundpublic nl.tudelft.simulation.language.d3.DirectedPoint getLocation()
throws RemoteException
getLocation in interface nl.tudelft.simulation.dsol.animation.LocatableRemoteExceptionpublic final javax.media.j3d.Bounds getBounds()
throws RemoteException
getBounds in interface nl.tudelft.simulation.dsol.animation.LocatableRemoteExceptionpublic 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(nl.tudelft.simulation.dsol.animation.Locatable newSource, nl.tudelft.simulation.dsol.simulators.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 nl.tudelft.simulation.dsol.animation.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 statusprotected TextAnimation.ScaleDependentRendering getScaleDependentRendering()
Copyright © 2014–2019 Delft University of Technology. All rights reserved.