Class TextAnimation

    • Constructor Detail

      • TextAnimation

        public TextAnimation​(Locatable source,
                             String text,
                             float dx,
                             float dy,
                             TextAlignment textAlignment,
                             Color color,
                             float fontSize,
                             float minFontSize,
                             float maxFontSize,
                             SimulatorInterface.TimeDoubleUnit simulator,
                             TextAnimation.ContrastToBackground background,
                             TextAnimation.ScaleDependentRendering scaleDependentRendering)
                      throws RemoteException,
                             NamingException
        Construct a new TextAnimation.
        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
        fontSize - float; the size of the font; default = 2.0 (meters)
        minFontSize - float; minimum font size resulting from scaling
        maxFontSize - float; maximum font size resulting from scaling
        simulator - SimulatorInterface.TimeDoubleUnit; the simulator
        background - ContrastToBackground; allows querying the background color and adaptation of the actual color of the text to ensure contrast
        scaleDependentRendering - ScaleDependentRendering; suppress rendering when font scale is too small
        Throws:
        NamingException - when animation context cannot be created or retrieved
        RemoteException - when remote context cannot be found
      • TextAnimation

        public TextAnimation​(Locatable source,
                             String text,
                             float dx,
                             float dy,
                             TextAlignment textAlignment,
                             Color color,
                             float fontSize,
                             float minFontSize,
                             float maxFontSize,
                             SimulatorInterface.TimeDoubleUnit simulator,
                             TextAnimation.ScaleDependentRendering scaleDependentRendering)
                      throws RemoteException,
                             NamingException
        Construct a new TextAnimation without contrast to background protection and no minimum font scale.
        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
        fontSize - float; the size of the font; default = 2.0 (meters)
        minFontSize - float; minimum font size resulting from scaling
        maxFontSize - float; maximum font size resulting from scaling
        simulator - SimulatorInterface.TimeDoubleUnit; the simulator
        scaleDependentRendering - ScaleDependentRendering; render text only when bigger than minimum scale
        Throws:
        NamingException - when animation context cannot be created or retrieved
        RemoteException - when remote context cannot be found
      • TextAnimation

        public TextAnimation​(Locatable source,
                             String text,
                             float dx,
                             float dy,
                             TextAlignment textAlignment,
                             Color color,
                             SimulatorInterface.TimeDoubleUnit simulator,
                             TextAnimation.ScaleDependentRendering scaleDependentRendering)
                      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 - SimulatorInterface.TimeDoubleUnit; the simulator
        scaleDependentRendering - ScaleDependentRendering; render text only when bigger than minimum scale
        Throws:
        NamingException - when animation context cannot be created or retrieved
        RemoteException - when remote context cannot be found
    • Method Detail

      • paint

        public void paint​(Graphics2D graphics,
                          ImageObserver observer)
                   throws RemoteException
        paint() method so it can be overridden or extended.
        Parameters:
        graphics - Graphics2D; the graphics object
        observer - ImageObserver; the observer
        Throws:
        RemoteException - on network exception
      • destroy

        public final void destroy()
        Destroy the text animation.
      • clone

        public abstract TextAnimation clone​(Locatable newSource,
                                            SimulatorInterface.TimeDoubleUnit newSimulator)
                                     throws RemoteException,
                                            NamingException
        Clone the TextAnimation and return a copy for the new source on the new simulator.
        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:
        RemoteException - when remote animation cannot be reached
        NamingException - when animation name cannot be found or bound in the Context
      • getSource

        protected final Locatable getSource()
        Retrieve the source.
        Returns:
        Locatable; the source
      • getDx

        protected final float getDx()
        Retrieve dx.
        Returns:
        float; the value of dx
      • getDy

        protected final float getDy()
        Retrieve dy.
        Returns:
        float; the value of dy
      • setXY

        protected final void setXY​(float x,
                                   float y)
        Sets a new offset.
        Parameters:
        x - float; dx
        y - float; dy
      • getTextAlignment

        protected final TextAlignment getTextAlignment()
        Retrieve the text alignment.
        Returns:
        TextAlignment; the text alignment
      • getFontSize

        protected final float getFontSize()
        Retrieve the font size.
        Returns:
        float; the font size
      • getFont

        protected final Font getFont()
        Retrieve the font.
        Returns:
        Font; the font
      • getText

        protected final String getText()
        Retrieve the current text.
        Returns:
        String; the current text
      • setText

        protected final void setText​(String text)
        Update the text.
        Parameters:
        text - String; the new text
      • getColor

        protected final Color getColor()
        Retrieve the current color.
        Returns:
        Color; the current color
      • setColor

        protected final void setColor​(Color color)
        Update the color.
        Parameters:
        color - Color; the new color
      • isFlip

        public final boolean isFlip()
        Retrieve the current flip status.
        Returns:
        boolean; the current flip status
      • setFlip

        public final void setFlip​(boolean flip)
        Update the flip status.
        Parameters:
        flip - boolean; the new flip status
      • isRotate

        public final boolean isRotate()
        Retrieve the current rotation status.
        Returns:
        boolean; the current rotation status
      • setRotate

        public final void setRotate​(boolean rotate)
        Update the rotation status.
        Parameters:
        rotate - boolean; the new rotation status
      • isScale

        public final boolean isScale()
        Retrieve the current scale status.
        Returns:
        boolean; the current scale status
      • setScale

        public final void setScale​(boolean scale)
        Update the scale status.
        Parameters:
        scale - boolean; the new scale status
      • isTranslate

        public final boolean isTranslate()
        Retrieve the current translate status.
        Returns:
        boolean; the current translate status
      • setTranslate

        public final void setTranslate​(boolean translate)
        Update the translate status.
        Parameters:
        translate - boolean; the new translate status
      • getScaleDependentRendering

        protected TextAnimation.ScaleDependentRendering getScaleDependentRendering()
        Retrieve the scale dependent rendering qualifier (used in cloning).
        Returns:
        ScaleDependentRendering; the rendering qualifier of this TextAnimation