Class CanvasPanel

    • Field Detail

      • m_BestFit

        protected boolean m_BestFit
        whether to use best fit.
      • m_Zoom

        protected double m_Zoom
        the zoom (1.0 = 100%).
      • m_ActualZoom

        protected double m_ActualZoom
        the actual zoom to use.
      • m_Brightness

        protected float m_Brightness
        the brightness.
      • m_LastBrightness

        protected Float m_LastBrightness
        the last brightness.
      • m_BrightImage

        protected BufferedImage m_BrightImage
        the brightened image.
      • m_ResizeRequired

        protected boolean m_ResizeRequired
        whether a resize is required.
      • m_FirstDisplay

        protected boolean m_FirstDisplay
        first display.
      • m_InteractionLoggingFilter

        protected InteractionLoggingFilter m_InteractionLoggingFilter
        the interaction logger in use.
      • m_PopupMenuCustomizer

        protected PopupMenuCustomizer m_PopupMenuCustomizer
        the popup menu customizer to use.
      • m_FileChooser

        protected ImageFileChooser m_FileChooser
        the file dialog for saving the image.
    • Constructor Detail

      • CanvasPanel

        public CanvasPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class BasePanel
      • setOwner

        public void setOwner​(ObjectAnnotationPanel value)
        Sets the owner.
        Parameters:
        value - the owner
      • setBestFit

        public void setBestFit​(boolean value)
        Sets whether to use best fit or specified zoom.
        Parameters:
        value - true if to use best fit
      • getBestFit

        public boolean getBestFit()
        Sets whether to use best fit.
        Returns:
        true if to use best fit
      • setZoom

        public void setZoom​(double value)
        Sets the zoom.
        Parameters:
        value - the zoom to use (1 = 100%)
      • getZoom

        public double getZoom()
        Returns the current zoom.
        Returns:
        the zoom (1 = 100%)
      • getActualZoom

        public double getActualZoom()
        Returns the actual zoom in use (taking best fit into account if set).
        Returns:
        the zoom in use (1 = 100%)
      • setBrightness

        public void setBrightness​(float value)
        Sets the brightness to use.
        Parameters:
        value - the brightness (100 = default)
      • getBrightness

        public float getBrightness()
        Returns the brightness to use.
        Returns:
        the brightness (100 = default)
      • setImage

        public void setImage​(BufferedImage value)
        Sets the image to display.
        Parameters:
        value - the image, null for none
      • getImage

        public BufferedImage getImage()
        Returns the image on display.
        Returns:
        the image, null if none set
      • setInteractionLoggingFilter

        public void setInteractionLoggingFilter​(InteractionLoggingFilter value)
        Sets the interaction log filter to use.
        Parameters:
        value - the filter
      • getInteractionLoggingFilter

        public InteractionLoggingFilter getInteractionLoggingFilter()
        Returns the interaction log filter in use.
        Returns:
        the filter
      • setPopupMenuCustomizer

        public void setPopupMenuCustomizer​(PopupMenuCustomizer value)
        Sets the popup menu customizer to use.
        Parameters:
        value - the customizer, null to unset
      • getPopupMenuCustomizer

        public PopupMenuCustomizer getPopupMenuCustomizer()
        Returns the popup menu customizer in use.
        Returns:
        the customizer, null if none used
      • createPopupMenu

        protected JPopupMenu createPopupMenu()
        Creates the popup.
        Returns:
        the popup menu
      • copyToClipboard

        public void copyToClipboard()
        Copies the image to the clipboard.
      • saveAs

        public void saveAs()
        Saves the image to disk.
      • update

        public void update()
        Updates the image.
      • update

        public void update​(boolean doLayout)
        Updates the image.
        Parameters:
        doLayout - whether to update the layout
      • mouseToPixelLocation

        public Point mouseToPixelLocation​(Point mousePos)
        Turns the mouse position into pixel location. Limits the pixel position to the size of the image, i.e., no negative pixel locations or ones that exceed the image size are generated.
        Parameters:
        mousePos - the mouse position
        Returns:
        the pixel location
      • pixelToMouseLocation

        public Point pixelToMouseLocation​(Point pixelPos)
        Converts the pixel position (at 100% zoom) to a mouse location.
        Parameters:
        pixelPos - the pixel position
        Returns:
        the mouse position
      • logMouseButtonPressed

        public void logMouseButtonPressed​(MouseEvent e)
        Logs a mouse button pressed.
        Parameters:
        e - the mouse event to record
      • logMouseButtonClick

        public void logMouseButtonClick​(MouseEvent e)
        Logs a mouse click.
        Parameters:
        e - the mouse event to record
      • logMouseButtonReleased

        public void logMouseButtonReleased​(MouseEvent e)
        Logs a mouse button released.
        Parameters:
        e - the mouse event to record
      • logMouseWheel

        public void logMouseWheel​(MouseWheelEvent e,
                                  double oldZoom,
                                  double newZoom)
        Logs a mouse wheel event (zoom).
        Parameters:
        e - the mouse wheel event to record
        oldZoom - the old zoom
        newZoom - the new zoom
      • logScale

        public void logScale​(double newScale)
        Logs a scale change from the menu.
        Parameters:
        newScale - the new scale
      • paint

        public void paint​(Graphics g)
        Paints the image or just a white background.
        Overrides:
        paint in class JComponent
        Parameters:
        g - the graphics context