system
Class CurveReader

java.lang.Object
  extended bysystem.CurveReader

public class CurveReader
extends Object

This class reads a Curve Scheme from a file. Actually, the Curve Scheme is an ESDL file, and this class asks a class from KirkPack, called ESDLReader, to read the ESDL file. This class then converts the SDL representation to a grouped shape representation (a Curve Scheme).

This class does not have to be instantiated, a simple call:

CurveReader.readCurveScheme(filename)

will return a Group object, which is the main group.

Since:
1.00
Version:
1.10
Author:
Berend "Kirk" Wouda

Constructor Summary
protected CurveReader()
          Constructs a CurveReader.
 
Method Summary
protected  Group convert(kirk.io.sdl.SDLDocument sdldocument)
          Converts the main group and all its subgroups and shapes.
protected  ControlPoint convertToControlPoint(kirk.io.sdl.SDLElement sdlelement)
          Converts the given SDLElement into a ControlPoint, providing it represents one (it has to have "controlpoint" as name, and be an SDL normal element).
protected  Curve convertToCurve(kirk.io.sdl.SDLElement sdlelement)
          Converts the given SDLElement into a Curve, providing it represents one (it has to have "curve" as name, and be an SDL normal element).
protected  Group convertToGroup(kirk.io.sdl.SDLElement sdlelement)
          Converts the given SDLElement into a Group, providing it represents one (it has to have "group" as name, and be an SDL normal element).
protected  Shape convertToShape(kirk.io.sdl.SDLElement sdlelement)
          Converts the given SDLElement into a Shape, providing it represents one (it has to have "shape" as name, and be an SDL normal element).
static Group readCurveScheme(String filename)
          This method reads a Curve Scheme from the given filename.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurveReader

protected CurveReader()
Constructs a CurveReader.

Method Detail

convert

protected Group convert(kirk.io.sdl.SDLDocument sdldocument)
                 throws CurveReadException
Converts the main group and all its subgroups and shapes.

Parameters:
sdldocument - The SDLDocument to convert.
Returns:
The main group with it's subtree.
Throws:
CurveReadException - When the SDL is not a correct Curve Scheme.

convertToGroup

protected Group convertToGroup(kirk.io.sdl.SDLElement sdlelement)
                        throws CurveReadException
Converts the given SDLElement into a Group, providing it represents one (it has to have "group" as name, and be an SDL normal element).

Parameters:
sdlelement - The SDLElement to convert into a Group.
Returns:
The Group made from the SDLElement.
Throws:
CurveReadException - When the SDL is not a correct Curve Scheme.

convertToShape

protected Shape convertToShape(kirk.io.sdl.SDLElement sdlelement)
                        throws CurveReadException
Converts the given SDLElement into a Shape, providing it represents one (it has to have "shape" as name, and be an SDL normal element).

Parameters:
sdlelement - The SDLElement to convert into a Shape.
Returns:
The Shape made from the SDLElement.
Throws:
CurveReadException - When the SDL is not a correct Curve Scheme.

convertToCurve

protected Curve convertToCurve(kirk.io.sdl.SDLElement sdlelement)
                        throws CurveReadException
Converts the given SDLElement into a Curve, providing it represents one (it has to have "curve" as name, and be an SDL normal element).

Parameters:
sdlelement - The SDLElement to convert into a Curve.
Returns:
The Curve made from the SDLElement.
Throws:
CurveReadException - When the SDL is not a correct Curve Scheme.

convertToControlPoint

protected ControlPoint convertToControlPoint(kirk.io.sdl.SDLElement sdlelement)
                                      throws CurveReadException
Converts the given SDLElement into a ControlPoint, providing it represents one (it has to have "controlpoint" as name, and be an SDL normal element).

Parameters:
sdlelement - The SDLElement to convert into a ControlPoint.
Returns:
The ControlPoint made from the SDLElement.
Throws:
CurveReadException - When the SDL is not a correct Curve Scheme.

readCurveScheme

public static Group readCurveScheme(String filename)
                             throws IOException,
                                    CurveReadException,
                                    kirk.io.sdl.ESDLReadException
This method reads a Curve Scheme from the given filename. It returns the main group of a grouped shape representation of the Curve Scheme hierarchy.

Parameters:
filename - The file to read the Curve Scheme from.
Returns:
The main group of the Curve Scheme hierarchy.
Throws:
IOException - When file errors happen.
CurveReadException - When the Scheme is incorrect.
kirk.io.sdl.ESDLReadException - When the ESDL structure is incorrect.