Package ucar.visad

Class Plotter

java.lang.Object
ucar.visad.Plotter

public class Plotter extends Object
Plot a Plottable object to file. This is roughly analoguous to java printing which provides a Graphics2D to a Printable object, which the Printable can then render itself to, before being printed
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Interface for classes which create charts capable of being plotted via a third party rendering library to a vector based graphics format
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Specifies a format of DIFAX
    static final String[]
    The different file formats supported
    static final int
    Specifies a format of JPG
    static final int
    Specifies a format of PDF
    static final int
    Specifies a format of PNG
    static final int
    Specifies a format of Postscript
    static final int
    Specifies a format of SVG
    static final int
    Specifies a format of PS2
  • Constructor Summary

    Constructors
    Constructor
    Description
    Plotter(int format, String filename)
    Create a plotter
    Plotter(int format, String filename, boolean monochrome)
    Create a plotter
    Plotter(String filename)
    ctor
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Find out which format the plotter is plotting to
    Get the preview of the given plot
    void
    handle the error.
    void
    Plot a plottable object to the file specified in the constructor
    void
    setColourDepth(int colourDepth)
    Set color depth
    void
    setFilename(String filename)
    Set the filename
    void
    setMonochrome(boolean monochrome)
    set monochrome

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Plotter

      public Plotter(int format, String filename)
      Create a plotter
      Parameters:
      format - The format of the distination file SVG, PNG or PS
      filename - The filename to plot to
    • Plotter

      public Plotter(String filename)
      ctor
      Parameters:
      filename - file to write to
    • Plotter

      public Plotter(int format, String filename, boolean monochrome)
      Create a plotter
      Parameters:
      format - The format of the distination file SVG, PNG or PS
      filename - The filename to plot to
      monochrome - Set to true if all colours are to be plotted as either pure black or pure white
  • Method Details

    • handleError

      public void handleError(Exception exc) throws Exception
      handle the error. THis just throws the error but can be overwritten
      Parameters:
      exc - The error.
      Throws:
      Exception - On badness
    • setFilename

      public void setFilename(String filename)
      Set the filename
      Parameters:
      filename - the filename
    • setMonochrome

      public void setMonochrome(boolean monochrome)
      set monochrome
      Parameters:
      monochrome - is monochrome
    • setColourDepth

      public void setColourDepth(int colourDepth)
      Set color depth
      Parameters:
      colourDepth - the depth
    • getFormat

      public int getFormat()
      Find out which format the plotter is plotting to
      Returns:
      format
    • plot

      public void plot(Plotter.Plottable plottable) throws FileNotFoundException, IOException, Exception
      Plot a plottable object to the file specified in the constructor
      Parameters:
      plottable - The object to be plotted
      Throws:
      Exception - On badness
      FileNotFoundException - On badness
      IOException - On badness
    • getPreview

      public JComponent getPreview(Plotter.Plottable plottable) throws FileNotFoundException, IOException
      Get the preview of the given plot
      Parameters:
      plottable - plot to preview
      Returns:
      preview component
      Throws:
      FileNotFoundException - On badness
      IOException - On badness