Class 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.
    BSD-style license. See OpenTrafficSim License.

    $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Dec 11, 2016
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel
    See Also:
    Serialized Form
    • 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 displayed
        text - String; the text to display
        dx - float; the horizontal movement of the text, in meters
        dy - float; the vertical movement of the text, in meters
        textAlignment - TextAlignment; where to place the text
        color - Color; the color of the text
        simulator - SimulatorInterface.TimeDoubleUnit; the simulator
        Throws:
        javax.naming.NamingException - when animation context cannot be created or retrieved
        java.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 displayed
        text - String; the text to display
        dx - float; the horizontal movement of the text, in meters
        dy - float; the vertical movement of the text, in meters
        textAlignment - TextAlignment; where to place the text
        color - Color; the color of the text
        simulator - SimulatorInterface.TimeDoubleUnit; the simulator
        background - TextAnimation.ContrastToBackground; connection to retrieve the current background color
        Throws:
        javax.naming.NamingException - when animation context cannot be created or retrieved
        java.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 class TextAnimation
        Parameters:
        graphics - Graphics2D; the graphics object
        observer - ImageObserver; the observer
        Throws:
        java.rmi.RemoteException - on network exception
      • 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 class TextAnimation
        Parameters:
        newSource - Locatable; the new source to link to the text animation
        newSimulator - 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 reached
        javax.naming.NamingException - when animation name cannot be found or bound in the Context
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object