Class DefaultCarAnimation.Text

    • Constructor Detail

      • 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 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 - OTSSimulatorInterface; the simulator
        Throws:
        NamingException - when animation context cannot be created or retrieved
        RemoteException - - 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 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 - OTSSimulatorInterface; the simulator
        background - TextAnimation.ContrastToBackground; connection to retrieve the current background color
        Throws:
        NamingException - when animation context cannot be created or retrieved
        RemoteException - - when remote context cannot be found
    • Method Detail

      • paint

        public final void paint​(Graphics2D graphics,
                                ImageObserver observer)
        paint() method so it can be overridden or extended.
        Overrides:
        paint in class TextAnimation
        Parameters:
        graphics - Graphics2D; the graphics object
        observer - ImageObserver; the observer
      • clone

        public TextAnimation clone​(Locatable newSource,
                                   org.opentrafficsim.core.dsol.OTSSimulatorInterface newSimulator)
                            throws RemoteException,
                                   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 - OTSSimulatorInterface; the new simulator to register the animation on
        Returns:
        TextAnimation; a copy of this TextAnimation
        Throws:
        RemoteException - when remote animation cannot be reached
        NamingException - when animation name cannot be found or bound in the Context