Class CgviewIO

java.lang.Object
ca.ualberta.stothard.cgview.CgviewIO
All Implemented Interfaces:
CgviewConstants

public class CgviewIO extends Object implements CgviewConstants
This class contains static methods for converting Cgview objects to image files. Images can be generated in PNG, JPG, SVG, and SVGZ (gzipped SVG) formats.
Author:
Paul Stothard
  • Constructor Details

    • CgviewIO

      public CgviewIO()
  • Method Details

    • writeToSVGFile

      public static void writeToSVGFile(Cgview cgview, String filename, boolean useCompression) throws FileNotFoundException, IOException, UnsupportedEncodingException, org.apache.batik.svggen.SVGGraphics2DIOException
      Writes a Cgview object to a SVG or a SVGZ file. Any mouseover or hyperlink information associated with the Cgview object is embedded directly in the SVG.
      Parameters:
      cgview - the Cgview object.
      filename - the file to create.
      useCompression - whether or not to generate compressed SVG (SVGZ).
      Throws:
      FileNotFoundException
      IOException
      UnsupportedEncodingException
      org.apache.batik.svggen.SVGGraphics2DIOException
    • writeToSVGFile

      public static void writeToSVGFile(Cgview cgview, String filename, boolean useCompression, boolean keepLastLabels) throws FileNotFoundException, IOException, UnsupportedEncodingException, org.apache.batik.svggen.SVGGraphics2DIOException
      Writes a Cgview object to a SVG or a SVGZ file. Any mouseover or hyperlink information associated with the Cgview object is embedded directly in the SVG.
      Parameters:
      cgview - the Cgview object.
      filename - the file to create.
      useCompression - whether or not to generate compressed SVG (SVGZ).
      keepLastLabels - whether or not to use labels generated by a previous call to one of the Cgview objects draw() or drawZoomed() methods.
      Throws:
      FileNotFoundException
      IOException
      UnsupportedEncodingException
      org.apache.batik.svggen.SVGGraphics2DIOException
    • writeToPNGFile

      public static void writeToPNGFile(Cgview cgview, String filename, boolean keepLastLabels) throws IOException
      Writes a Cgview object to a PNG file.
      Parameters:
      cgview - the Cgview object.
      filename - the file to create.
      keepLastLabels - whether or not to use labels generated by a previous call to one of the Cgview objects draw() or drawZoomed() methods.
      Throws:
      IOException
    • writeToPNGFile

      public static void writeToPNGFile(Cgview cgview, String filename) throws IOException
      Writes a Cgview object to a PNG file.
      Parameters:
      cgview - the Cgview object.
      filename - the file to create.
      Throws:
      IOException
    • writeToJPGFile

      public static void writeToJPGFile(Cgview cgview, String filename, boolean keepLastLabels) throws IOException
      Writes a Cgview object to a JPG file.
      Parameters:
      cgview - the Cgview object.
      filename - the file to create.
      keepLastLabels - whether or not to use labels generated by a previous call to one of the Cgview objects draw() or drawZoomed() methods.
      Throws:
      IOException
    • writeToJPGFile

      public static void writeToJPGFile(Cgview cgview, String filename) throws IOException
      Writes a Cgview object to a JPG file.
      Parameters:
      cgview - the Cgview object.
      filename - the file to create.
      Throws:
      IOException
    • writeHTMLFile

      public static void writeHTMLFile(Cgview cgview, String imageFilename, String imageFormat, String htmlFilename) throws FileNotFoundException, IOException
      Creates an HTML file that links to a Cgview map. Any hyperlink or mouseover information associated with the Cgview object is included in an image map in the HTML file (in the case of PNG and JPG maps). In the case of SVG and SVGZ maps, the mouseover and hyperlink information is embedded directly in the SVG.
      Parameters:
      cgview - the Cgview object embedded in the HTML.
      imageFilename - the name of the image file containing the Cgview image.
      imageFormat - the format of the image file.
      htmlFilename - the HTML file to generate.
      Throws:
      FileNotFoundException
      IOException
    • writeHTMLFile

      public static void writeHTMLFile(Cgview cgview, String imageFilename, String imageFormat, String htmlFilename, boolean useOverlib) throws FileNotFoundException, IOException
      Creates an HTML file that links to a Cgview map. Any hyperlink or mouseover information associated with the Cgview object is included in an image map in the HTML file (in the case of PNG and JPG maps). In the case of SVG and SVGZ maps, the mouseover and hyperlink information is embedded directly in the SVG.
      Parameters:
      cgview - the Cgview object embedded in the HTML.
      imageFilename - the name of the image file containing the Cgview image.
      imageFormat - the format of the image file.
      htmlFilename - the HTML file to generate.
      useOverlib - whether to use the overlib javascript library for mouseovers (recommended)
      Throws:
      FileNotFoundException
      IOException
    • main

      public static void main(String[] args)