Class HTMLAnimationPanel

    • Constructor Detail

      • HTMLAnimationPanel

        public HTMLAnimationPanel​(Rectangle2D extent,
                                  Dimension size,
                                  SimulatorInterface<?,​?,​?> simulator)
                           throws RemoteException
        constructs a new AnimationPanel.
        Parameters:
        extent - Rectangle2D; the extent of the panel
        size - Dimension; the size of the panel.
        simulator - SimulatorInterface<?,?,?>; the simulator of which we want to know the events for animation
        Throws:
        RemoteException - on network error for one of the listeners
    • Method Detail

      • paintComponent

        public void paintComponent​(HTMLGraphics2D g2)
        Draw the grid.
        Overrides:
        paintComponent in class HTMLGridPanel
        Parameters:
        g2 - HTMLGraphics2D; the virtual Graphics2D canvas to enable writing to the browser
      • isShowElement

        public boolean isShowElement​(Renderable2DInterface<? extends Locatable> element)
        Test whether the element needs to be shown on the screen or not.
        Parameters:
        element - Renderable2DInterface<? extends Locatable>; the renderable element to test
        Returns:
        whether the element needs to be shown or not
      • isShowClass

        public boolean isShowClass​(Class<? extends Locatable> locatableClass)
        Test whether a certain class needs to be shown on the screen or not. The class needs to implement Locatable, otherwise it cannot be shown at all.
        Parameters:
        locatableClass - Class<? extends Locatable>; the class to test
        Returns:
        whether the class needs to be shown or not
      • objectAdded

        public void objectAdded​(Renderable2DInterface<? extends Locatable> element)
        Add a locatable object to the animation.
        Parameters:
        element - Renderable2DInterface<? extends Locatable>; the element to add to the animation
      • objectRemoved

        public void objectRemoved​(Renderable2DInterface<? extends Locatable> element)
        Remove a locatable object from the animation.
        Parameters:
        element - Renderable2DInterface<? extends Locatable>; the element to add to the animation
      • fullExtent

        public Rectangle2D fullExtent()
        Calculate the full extent based on the current positions of the objects.
        Returns:
        the full extent of the animation.
      • zoomAll

        public void zoomAll()
        resets the panel to its an extent that covers all displayed objects.
      • showClass

        public void showClass​(Class<? extends Locatable> locatableClass)
        Set a class to be shown in the animation to true.
        Parameters:
        locatableClass - Class<? extends Locatable>; the class for which the animation has to be shown.
      • hideClass

        public void hideClass​(Class<? extends Locatable> locatableClass)
        Set a class to be hidden in the animation to true.
        Parameters:
        locatableClass - Class<? extends Locatable>; the class for which the animation has to be hidden.
      • toggleClass

        public void toggleClass​(Class<? extends Locatable> locatableClass)
        Toggle a class to be displayed in the animation to its reverse value.
        Parameters:
        locatableClass - Class<? extends Locatable>; the class for which a visible animation has to be turned off or vice versa.
      • getDragLine

        public final javax.vecmath.Point4i getDragLine()
        Returns:
        returns the dragLine.
      • isDragLineEnabled

        public final boolean isDragLineEnabled()
        Returns:
        returns the dragLineEnabled.
      • setDragLineEnabled

        public final void setDragLineEnabled​(boolean dragLineEnabled)
        Parameters:
        dragLineEnabled - boolean; the dragLineEnabled to set.
      • addToggleAnimationButtonText

        public final void addToggleAnimationButtonText​(String name,
                                                       Class<? extends Locatable> locatableClass,
                                                       String toolTipText,
                                                       boolean initiallyVisible)
        Add a button for toggling an animatable class on or off.
        Parameters:
        name - String; the name of the button
        locatableClass - Class<? extends Locatable>; the class for which the button holds (e.g., GTU.class)
        toolTipText - String; the tool tip text to show when hovering over the button
        initiallyVisible - boolean; whether the class is initially shown or not
      • showClass

        public final void showClass​(String name)
        Show a Locatable class based on the name.
        Parameters:
        name - the name of the class to show
      • hideClass

        public final void hideClass​(String name)
        Hide a Locatable class based on the name.
        Parameters:
        name - the name of the class to hide
      • addToggleText

        public final void addToggleText​(String text)
        Add a text to explain animatable classes.
        Parameters:
        text - String; the text to show
      • addAllToggleGISButtonText

        public final void addAllToggleGISButtonText​(String header,
                                                    GisRenderable2D gisMap,
                                                    String toolTipText)
        Add buttons for toggling all GIS layers on or off.
        Parameters:
        header - String; the name of the group of layers
        gisMap - GisRenderable2D; the GIS map for which the toggles have to be added
        toolTipText - String; the tool tip text to show when hovering over the button
      • addToggleGISButtonText

        public final void addToggleGISButtonText​(String layerName,
                                                 String displayName,
                                                 GisRenderable2D gisMap,
                                                 String toolTipText)
        Add a button to toggle a GIS Layer on or off.
        Parameters:
        layerName - String; the name of the layer
        displayName - String; the name to display next to the tick box
        gisMap - GisRenderable2D; the map
        toolTipText - String; the tool tip text
      • showGISLayer

        public final void showGISLayer​(String layerName)
        Set a GIS layer to be shown in the animation to true.
        Parameters:
        layerName - String; the name of the GIS-layer that has to be shown.
      • hideGISLayer

        public final void hideGISLayer​(String layerName)
        Set a GIS layer to be hidden in the animation to true.
        Parameters:
        layerName - String; the name of the GIS-layer that has to be hidden.
      • toggleGISLayer

        public final void toggleGISLayer​(String layerName)
        Toggle a GIS layer to be displayed in the animation to its reverse value.
        Parameters:
        layerName - String; the name of the GIS-layer that has to be turned off or vice versa.