Class ContourPlot.Legend

java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.Legend
All Implemented Interfaces:
ContourPlot.PDFRenderer, ContourPlot.Renderable, ContourPlot.Renderer
Enclosing class:
ContourPlot

public static class ContourPlot.Legend extends Object implements ContourPlot.Renderable, ContourPlot.Renderer
The Legend class is ContourPlot.Renderable and its own ContourPlot.Renderer at once. It is intended to be used to display labels and corresponding visual representatives such as a colored ContourPlot.Glyph or line segment, in order to explain the meaning of the contents of a visualization.

To add items to the legend, the methods

invalid reference
#addGlyphLabel(Glyph, int, String)
and addLineLabel(double, int, String) can be used. The layout of the items is very similar to FlowLayout in which the items are positioned next to each other until no more space is available to the right and a line break happens, then positioning continues in the next row. A slight difference is that glyph labels are always first in order and followed by line labels. Layouting happens on
invalid reference
#updateGL(boolean)
.
Author:
hageldave
  • Field Details

  • Constructor Details

    • Legend

      public Legend()
  • Method Details

    • setColorScheme

      public void setColorScheme(ContourPlot.ColorScheme colorScheme)
    • setDirty

      public ContourPlot.Legend setDirty()
      Sets the isDirty() state of this legend to true. This indicates that a call to
      invalid reference
      #updateGL(boolean)
      is necessary to sync GL resources with this legends state.
      Returns:
      this for chaining
    • isDirty

      public boolean isDirty()
      Description copied from interface: ContourPlot.Renderable
      if true, indicates that a call to
      invalid reference
      #updateGL(boolean)
      is necessary to sync this objects GL resources to its current state.
      Specified by:
      isDirty in interface ContourPlot.Renderable
      Returns:
      true if dirty
    • renderFallback

      public void renderFallback(Graphics2D g, Graphics2D p, int w, int h)
      Description copied from interface: ContourPlot.Renderer
      Renders this ContourPlot.Renderer's 'scene'. This is the fallback path in case OpenGL based rendering through
      invalid reference
      #render(int, int, int, int)
      is not available.
      Specified by:
      renderFallback in interface ContourPlot.Renderer
      Parameters:
      g - main graphics object for drawing onto the framebuffer
      p - graphics object for drawing onto the picking framebuffer (invisible but used for picking)
      w - width of the current viewport in pixels
      h - height of the current viewport in pixels
    • renderPDF

      public void renderPDF(org.apache.pdfbox.pdmodel.PDDocument doc, org.apache.pdfbox.pdmodel.PDPage page, int x, int y, int w, int h)
      Description copied from interface: ContourPlot.PDFRenderer
      Renders this PDFRenderers contents, that is creating pdf elements and appending them to the specified page within the corresponding document.
      Specified by:
      renderPDF in interface ContourPlot.PDFRenderer
      Parameters:
      doc - the PDF document holding the page
      page - page in pdf doc to which elements are to be appended
      x - x coordinate of the current viewport
      y - y coordinate of the current viewport
      w - width of the current viewport
      h - height of the current viewport
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: ContourPlot.Renderer
      Whether this renderer is enabled or not. By default a renderer is enabled and will render upon
      invalid reference
      #render(int, int, int, int)
      or
      invalid reference
      #renderSVG(org.w3c.dom.Document, org.w3c.dom.Element, int, int)
      . When disabled those methods return right away and will not render anything.
      Specified by:
      isEnabled in interface ContourPlot.Renderer
      Returns:
      true when active
    • intersects

      public boolean intersects(Rectangle2D rect)
      Always return false.
      Specified by:
      intersects in interface ContourPlot.Renderable
      Parameters:
      rect - rectangle to test
      Returns:
      true when intersecting
    • addLineLabel

      public ContourPlot.Legend addLineLabel(double thickness, int color, int strokePattern, String labeltxt, int pickColor)
      Adds a label for a line to this legend.
      Parameters:
      thickness - of the line to appear in front of the label text
      color - integer packed ARGB color value of the glyph
      strokePattern - lines stroke pattern (see
      invalid reference
      Lines#setStrokePattern(int)
      )
      labeltxt - text of the label
      pickColor - picking color (see
      invalid reference
      FBOCanvas
      )
      Returns:
      this for chaining
    • addLineLabel

      public ContourPlot.Legend addLineLabel(double thickness, int color, String labeltxt, int pickColor)
      Adds a label for a line to this legend.
      Parameters:
      thickness - of the line to appear in front of the label text
      color - integer packed ARGB color value of the glyph
      labeltxt - text of the label
      pickColor - picking color (see
      invalid reference
      FBOCanvas
      )
      Returns:
      this for chaining
    • addLineLabel

      public ContourPlot.Legend addLineLabel(double thickness, int color, String labeltxt)
      Adds a label for a line to this legend.
      Parameters:
      thickness - of the line to appear in front of the label text
      color - integer packed ARGB color value of the glyph
      labeltxt - text of the label
      Returns:
      this for chaining