net.sf.jcgm.core
Class CGM

java.lang.Object
  extended by net.sf.jcgm.core.CGM
All Implemented Interfaces:
java.lang.Cloneable

public class CGM
extends java.lang.Object
implements java.lang.Cloneable

The main class for Computer Graphics Metafile support.

Version:
$Id: CGM.java 46 2011-12-14 08:26:44Z phica $
Author:
xphc (Philippe Cadé), BBNT Solutions

Constructor Summary
CGM()
           
CGM(java.io.File cgmFile)
           
 
Method Summary
 void addCommandListener(ICommandListener listener)
          Adds the given listener to the list of command listeners
 java.awt.geom.Point2D.Double[] extent()
           
 java.util.List<Command> getCommands()
           
 java.util.List<Message> getMessages()
           
 java.awt.Dimension getSize()
          Returns the size of the CGM graphic.
 java.awt.Dimension getSize(double dpi)
          Returns the size of the CGM graphic taking into account a specific DPI setting
 void paint(CGMDisplay d)
           
 void read(java.io.DataInput in)
           
 void showCGMCommands()
           
 void showCGMCommands(java.io.PrintStream stream)
           
static void split(java.io.File cgmFile, java.io.File outputDir, IBeginMetafileNameExtractor extractor)
          Splits a CGM file containing several CGM files into pieces.
static void split(java.io.File cgmFile, ICgmExtractor extractor)
          Splits a CGM file containing several CGM files into pieces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CGM

public CGM()

CGM

public CGM(java.io.File cgmFile)
    throws java.io.IOException
Throws:
java.io.IOException
Method Detail

read

public void read(java.io.DataInput in)
          throws java.io.IOException
Throws:
java.io.IOException

split

public static void split(java.io.File cgmFile,
                         java.io.File outputDir,
                         IBeginMetafileNameExtractor extractor)
                  throws java.io.IOException
Splits a CGM file containing several CGM files into pieces. Each single CGM file will be extracted to an own file. The name of that file is provided by the given extractor.

Parameters:
cgmFile - The CGM file to split
outputDir - The output directory to use. Must exist and be writable.
extractor - The extractor in charge of naming the split CGM files
Throws:
java.io.IOException - If the given CGM file could not be read or there was an error splitting the file

split

public static void split(java.io.File cgmFile,
                         ICgmExtractor extractor)
                  throws java.io.IOException,
                         CgmException
Splits a CGM file containing several CGM files into pieces. The given extractor is in charge of dealing with the extracted CGM file.

Parameters:
cgmFile - The CGM file to split
extractor - An extractor that knows what to do with the extracted CGM file
Throws:
java.io.IOException - If an error happened reading the CGM file
CgmException - If an error happened during the handling of the extracted CGM file

addCommandListener

public void addCommandListener(ICommandListener listener)
Adds the given listener to the list of command listeners

Parameters:
listener - The listener to add

getMessages

public java.util.List<Message> getMessages()

paint

public void paint(CGMDisplay d)

getSize

public java.awt.Dimension getSize()
Returns the size of the CGM graphic.

Returns:
The dimension or null if no VDCExtent command was found.

getSize

public java.awt.Dimension getSize(double dpi)
Returns the size of the CGM graphic taking into account a specific DPI setting

Parameters:
dpi - The DPI value to use
Returns:
The dimension or null if no VDCExtent command was found.

extent

public java.awt.geom.Point2D.Double[] extent()

showCGMCommands

public void showCGMCommands()

showCGMCommands

public void showCGMCommands(java.io.PrintStream stream)

getCommands

public java.util.List<Command> getCommands()


Part of the jcgm library http://jcgm.sourceforge.net/