Class Metafile

java.lang.Object
  |
  +--Metafile
Direct Known Subclasses:
ErioMetafile

public abstract class Metafile
extends Object

Abstract class which represents 3-D drawings defined by polygon meshes. Derived classes must minimally override the read() method to read the metafile data from a stream.

Version:
2.0
Author:
Sasmito Adibowo
See Also:
read(java.io.Reader)

Field Summary
protected  WindowBoundaries boundaries
          The window view coordinates.
private  Map coorsys
          A set of named CoorSys objects in (String,CoorSys) pairs.
private  Map lights
          A set of named Light objects in (String,Light) pairs.
private  Map meshes
          A set of named Mesh objects in (String,Mesh) pairs.
protected  int renderMode
          the rendering mode, one of RENDERMODE_xxx
static int RENDERMODE_FLAT
          Render constant-shade
static int RENDERMODE_GOURAUD
          Render Guraud
static int RENDERMODE_PHONG
          Render Phong
static int RENDERMODE_WIREFRAME
          Render wireframe
private  Map transformations
          A set of named transformation objects in (String,Transformation) pairs
protected  ViewPlane view
          The active viewplane.
protected  int viewMode
          the view projection mode, one of VIEWMODE_xxx
static int VIEWMODE_PARALLEL
          Parallel viewing mode.
static int VIEWMODE_PERSPECT
          Perspective viewing mode.
protected  ViewPlane viewPlane
          The view plane.
 
Constructor Summary
Metafile()
          Constructs the metafile object.
 
Method Summary
protected  void clear()
          Clears the metafile data already in the object.
 Set getCoorSys()
          Returns all of the names of the coordinate systems.
 CoorSys getCoorSys(String name)
          Returns a coordinate system.
 Set getLight()
          Returns all the names of the lights.
 Light getLight(String name)
          Returns a Light.
 Set getMesh()
          Returns all the names of the meshes.
 Mesh getMesh(String name)
          Returns a mesh.
 int getRenderMode()
          Returns the rendering mode, one of RENDERMODE_xxxx
 Transformation getTransformation(String name)
          Returns a named transformation.
 int getViewMode()
          Returns the viewing mode, one of VIEWMODE_xxxx
 ViewPlane getViewPlane()
          Returns the view plane of the metafile
 WindowBoundaries getWindowBoundaries()
          Returns the window boundaries as specified in the metafile.
abstract  void read(Reader in)
          Reads metafile data into the object.
 void setCoorSys(String name, CoorSys cs)
          Sets a coordinate system into the metafile.
 void setLight(String name, Light l)
          Sets a light into the metafile.
 void setMesh(String name, Mesh m)
          Sets a mesh into the metafile.
 void setTransformation(String name, Transformation t)
          Sets a transformation into the metafile.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

viewPlane

protected ViewPlane viewPlane
The view plane.

transformations

private Map transformations
A set of named transformation objects in (String,Transformation) pairs

lights

private Map lights
A set of named Light objects in (String,Light) pairs.

meshes

private Map meshes
A set of named Mesh objects in (String,Mesh) pairs.

coorsys

private Map coorsys
A set of named CoorSys objects in (String,CoorSys) pairs.

boundaries

protected WindowBoundaries boundaries
The window view coordinates.

view

protected ViewPlane view
The active viewplane.

viewMode

protected int viewMode
the view projection mode, one of VIEWMODE_xxx

renderMode

protected int renderMode
the rendering mode, one of RENDERMODE_xxx

VIEWMODE_PERSPECT

public static final int VIEWMODE_PERSPECT
Perspective viewing mode.

VIEWMODE_PARALLEL

public static final int VIEWMODE_PARALLEL
Parallel viewing mode.

RENDERMODE_WIREFRAME

public static final int RENDERMODE_WIREFRAME
Render wireframe

RENDERMODE_FLAT

public static final int RENDERMODE_FLAT
Render constant-shade

RENDERMODE_GOURAUD

public static final int RENDERMODE_GOURAUD
Render Guraud

RENDERMODE_PHONG

public static final int RENDERMODE_PHONG
Render Phong
Constructor Detail

Metafile

public Metafile()
Constructs the metafile object.
Method Detail

clear

protected void clear()
Clears the metafile data already in the object. This method should be called by subclass' read() method prior to reading the metafile data.

read

public abstract void read(Reader in)
                   throws IOException
Reads metafile data into the object.
Parameters:
in - the metafile data file.

getCoorSys

public CoorSys getCoorSys(String name)
Returns a coordinate system.
Parameters:
name - the name of the coordinate system.

getCoorSys

public Set getCoorSys()
Returns all of the names of the coordinate systems.

getMesh

public Mesh getMesh(String name)
Returns a mesh.
Parameters:
name - the name of the mesh.

getMesh

public Set getMesh()
Returns all the names of the meshes.

getLight

public Set getLight()
Returns all the names of the lights.

getLight

public Light getLight(String name)
Returns a Light.
Parameters:
name - the name of the light.

getTransformation

public Transformation getTransformation(String name)
Returns a named transformation.
Parameters:
name - the name of the transformation.

setMesh

public void setMesh(String name,
                    Mesh m)
Sets a mesh into the metafile.
Parameters:
name - the name of the mesh.
m - the mesh object.

setTransformation

public void setTransformation(String name,
                              Transformation t)
Sets a transformation into the metafile.
Parameters:
name - the name of the transformation
t - the transformation object.

setCoorSys

public void setCoorSys(String name,
                       CoorSys cs)
Sets a coordinate system into the metafile.
Parameters:
name - the name of the coordinate system.
cs - the coordinate system.

setLight

public void setLight(String name,
                     Light l)
Sets a light into the metafile.
Parameters:
name - the name of the mesh.
l - the light object.

getWindowBoundaries

public WindowBoundaries getWindowBoundaries()
Returns the window boundaries as specified in the metafile.

getViewPlane

public ViewPlane getViewPlane()
Returns the view plane of the metafile

getViewMode

public int getViewMode()
Returns the viewing mode, one of VIEWMODE_xxxx

getRenderMode

public int getRenderMode()
Returns the rendering mode, one of RENDERMODE_xxxx