Class ViewportJ2D

  • All Implemented Interfaces:
    IViewport, java.awt.event.ComponentListener, java.util.EventListener

    public class ViewportJ2D
    extends AbstractViewport
    implements java.awt.event.ComponentListener
    This class manages the GUI and all user interaction.
    • Constructor Detail

      • ViewportJ2D

        public ViewportJ2D​(IPerspective persp,
                           java.lang.ClassLoader classloader)
        Creates a new Viewport.
        Parameters:
        layerObject - object holding properties for pre/postlayers
        libService - the library service
    • Method Detail

      • getImage

        public java.awt.image.BufferedImage getImage​(java.lang.String path)
        Returns an image for texturing
        Parameters:
        path - resource path of the image
      • refresh

        public void refresh()
        Description copied from interface: IViewport
        Refreshes the viewport.
        Specified by:
        refresh in interface IViewport
      • getContext

        public java.awt.Graphics2D getContext()
      • getDefaultTransform

        public java.awt.geom.AffineTransform getDefaultTransform()
        Returns the default transform.
        Returns:
        the default transform
      • getImageTransform

        public java.awt.geom.AffineTransform getImageTransform​(int sizeX,
                                                               int sizeY)
        Sets up the image transform.
        Parameters:
        sizeX - image x-size
        sizeY - image y-size
        Returns:
        the transform
      • drawPrimitive

        public void drawPrimitive​(DrawableCombiner dc,
                                  Primitive primitive,
                                  java.lang.Object obj)
        Draws a primitive
        Specified by:
        drawPrimitive in interface IViewport
        Parameters:
        dc - The combiner.
        primitive - The primitive.
        obj - The object being drawn.
      • dispose

        public void dispose()
        Disposes the Viewport.
        Specified by:
        dispose in interface IViewport
      • componentHidden

        public void componentHidden​(java.awt.event.ComponentEvent e)
        Specified by:
        componentHidden in interface java.awt.event.ComponentListener
      • componentMoved

        public void componentMoved​(java.awt.event.ComponentEvent e)
        Specified by:
        componentMoved in interface java.awt.event.ComponentListener
      • componentResized

        public void componentResized​(java.awt.event.ComponentEvent e)
        Specified by:
        componentResized in interface java.awt.event.ComponentListener
      • componentShown

        public void componentShown​(java.awt.event.ComponentEvent e)
        Specified by:
        componentShown in interface java.awt.event.ComponentListener