JavaView® v2.00.008

jv.loader
Class PgMathLoader

java.lang.Object
  |
  +--jv.loader.PgMathLoader

public class PgMathLoader
extends java.lang.Object

Loader for Mathematica geometries. Reads Graphics, Graphics3d, SurfaceGraphics or lists of these from the Mathematica format "InputForm". If a list of Graphics, Graphics3d or SurfaceGraphics should get animated in JavaView, it must be applied with the keyword "ShowAnimation"; the former keywords "Animation" and "KeyAnimation" will work still.

Version:
28.02.01, 1.33 revised (ur) Call of computeMathematicaColors moved to method read, using of ShowAnimation as keyword enabled.
12.02.01, 1.32 revised (ur) Computing of element colors from LightSources, handling of some options improved.
06.02.01, 1.31 revised (ur) Internal changes in Color handling.
31.01.01, 1.30 revised (ur) Compute camera position and interest in world coordinates and give these to displayOption.
11.12.00, 1.29 revised (ur) "PgMathData" replaced by PgJvxSrc[]; setting of display options improved.
06.10.00, 1.28 revised (ur) Doubled code for reading viewer options moved to new method.
26.09.00, 1.27 revised (ur) Improved reading colors of geometries.
18.09.00, 1.26 revised (ep) Bugfix "ordinaryChar('-')" in method readGraphics(StreamTokenizer).
24.08.00, 1.25 revised (ur) Parsing of Mathematica's viewer options added.
23.08.00, 1.24 revised (ur) Enabled to read mgs files with header comment indicated by (* ... *).
13.07.00, 1.23 revised (kp) Static instance variables replaced with direct reference to PvGeometry variables.
13.07.00, 1.22 revised (ur) Adapted geomType integers to PvGeometryIf; bug in read(String fileName) removed.
01.05.00, 1.21 revised (ep) Removed bug in polygon allocation.
27.03.00, 1.20 revised (ur) All PgGeometry dependency removed; modified to be extension of PgLoaderSrc.
09.11.99, 1.10 revised (ur) Enabled reading lists of lists of graphics primitives in readGraphics 07.09.99, 1.00 created (ur)
Author:
Ulrich Reitebuch

Field Summary
protected  java.util.Vector graphicsVector
           
protected  PdVector m_boundingBoxMax
          Bounding box for all parsed geometries, maximum values.
protected  PdVector m_boundingBoxMin
          Bounding box for all parsed geometries, minimum values.
protected  PdVector[] m_circle
          List of circles in one graphics-object
protected  int m_dim
          Dimension of geometries
protected  PdVector[] m_disk
          List of discs in one graphics-object
protected  PvDisplayOption m_displayOption
          Options to be set in Display
protected  PgJvxSrc[] m_geom
          List of geometries in one graphics object.
protected  PgJvxSrc[][] m_graphics
          List of Graphics objects.
protected  boolean m_isAnimation
          Flag, if list of geometries is an animation.
protected  boolean m_isKeyAnimation
          Flag, if list of geometries is a keyframe animation.
protected  int m_numGraphics
          Number of PgJvxSrc[] in graphicsVector
protected  PdVector m_viewVertical
          Vector to be showed vertical in display.
 
Constructor Summary
PgMathLoader()
          Constructor
 
Method Summary
protected  void adjustViewer()
          Compute the correct 3D position of camera and lightSources.
protected  void computeMathematicaColors(PgJvxSrc geom)
          Compute element colors from lightSources as in Mathematica.
 PvDisplayOption getDisplayOption()
          Return display options.
 boolean isAnimation()
          Return, if list of geometries is an animation.
 boolean isKeyAnimation()
          Return, if list of geometries is a keyframe animation.
protected  boolean parseMath(java.io.BufferedReader bufReader)
          Parse the Mathematica graphics given in the input bufferedReader.
protected  boolean parseVector(java.io.StreamTokenizer st, PdVector vec, int dimension)
          Parse a vector of doubles.
 PgJvxSrc[][] read(java.io.BufferedReader in)
          Parse a Mathematica graphics from a bufferedReader.
protected  void readAxesLabel(java.io.StreamTokenizer st, int dim)
          Read "AxesLabel" option.
 java.awt.Color readCMYKColor(java.io.StreamTokenizer st)
          Parse a Color in cyan-magenta-yellow-black notation.
 boolean readGraphics(java.io.StreamTokenizer st)
          Parse a Mathematica graphics object.
 java.awt.Color readGrayLevel(java.io.StreamTokenizer st)
          Parse a Color given by gray-level.
 java.awt.Color readHueColor(java.io.StreamTokenizer st)
          Parse a Color by hue-saturation-brightness notation.
 double readNumber(java.io.StreamTokenizer st)
          Parse a number in Mathematica exponential notation "*^".
protected  boolean readOptions(java.io.StreamTokenizer st)
          Read viewer options: Boxed, Axes, Lighting, LightSources, ViewPoint, ViewCenter, AxesEdge, AmbientLight, BoxRatios, Background, PolygonIntersections, ViewVertical.
 boolean readParametricSurface(java.io.StreamTokenizer st)
          Parse a Mathematica parametric surface graphics object.
 java.awt.Color readRGBColor(java.io.StreamTokenizer st)
          Parse a Color in red-green-blue notation.
 java.lang.String readString(java.io.StreamTokenizer st)
          Parse a String included by quotes
 int readSurfaceColor(java.io.StreamTokenizer st, java.awt.Color[] c)
          Parse a SurfaceColor object.
protected  void setDisplayDefault()
          Set all values in PvDisplayOption to the Mathematica default values.
 void setKeyAnimation(boolean flag)
          Return, if list of geometries is a keyframe animation.
static java.lang.String write(PgJvxSrc geom)
          Write a geometry into a string in Mathematica expression file format, called MGS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_dim

protected int m_dim
Dimension of geometries

m_circle

protected PdVector[] m_circle
List of circles in one graphics-object

m_disk

protected PdVector[] m_disk
List of discs in one graphics-object

m_isKeyAnimation

protected boolean m_isKeyAnimation
Flag, if list of geometries is a keyframe animation.

m_isAnimation

protected boolean m_isAnimation
Flag, if list of geometries is an animation.

m_geom

protected PgJvxSrc[] m_geom
List of geometries in one graphics object. PgElementSet,PgPointset and PgPolygons in one graphics-object

m_graphics

protected PgJvxSrc[][] m_graphics
List of Graphics objects.

graphicsVector

protected java.util.Vector graphicsVector

m_numGraphics

protected int m_numGraphics
Number of PgJvxSrc[] in graphicsVector

m_displayOption

protected PvDisplayOption m_displayOption
Options to be set in Display

m_boundingBoxMin

protected PdVector m_boundingBoxMin
Bounding box for all parsed geometries, minimum values.

m_boundingBoxMax

protected PdVector m_boundingBoxMax
Bounding box for all parsed geometries, maximum values.

m_viewVertical

protected PdVector m_viewVertical
Vector to be showed vertical in display.
Constructor Detail

PgMathLoader

public PgMathLoader()
Constructor
Method Detail

setKeyAnimation

public void setKeyAnimation(boolean flag)
Return, if list of geometries is a keyframe animation.

isKeyAnimation

public boolean isKeyAnimation()
Return, if list of geometries is a keyframe animation.

isAnimation

public boolean isAnimation()
Return, if list of geometries is an animation.

read

public PgJvxSrc[][] read(java.io.BufferedReader in)
Parse a Mathematica graphics from a bufferedReader.

parseMath

protected boolean parseMath(java.io.BufferedReader bufReader)
                     throws java.io.IOException
Parse the Mathematica graphics given in the input bufferedReader.

readGraphics

public boolean readGraphics(java.io.StreamTokenizer st)
Parse a Mathematica graphics object.

readParametricSurface

public boolean readParametricSurface(java.io.StreamTokenizer st)
Parse a Mathematica parametric surface graphics object.

readNumber

public double readNumber(java.io.StreamTokenizer st)
Parse a number in Mathematica exponential notation "*^".

write

public static java.lang.String write(PgJvxSrc geom)
Write a geometry into a string in Mathematica expression file format, called MGS.

Numbers with absolute value less than EPS are shown as zero. This avoids the anoying fact that double precision numbers fill the whole text area hiding the exponent, which hides their small value.


readString

public java.lang.String readString(java.io.StreamTokenizer st)
Parse a String included by quotes

readRGBColor

public java.awt.Color readRGBColor(java.io.StreamTokenizer st)
Parse a Color in red-green-blue notation.

readGrayLevel

public java.awt.Color readGrayLevel(java.io.StreamTokenizer st)
Parse a Color given by gray-level.

readHueColor

public java.awt.Color readHueColor(java.io.StreamTokenizer st)
Parse a Color by hue-saturation-brightness notation.

readCMYKColor

public java.awt.Color readCMYKColor(java.io.StreamTokenizer st)
Parse a Color in cyan-magenta-yellow-black notation.

readSurfaceColor

public int readSurfaceColor(java.io.StreamTokenizer st,
                            java.awt.Color[] c)
Parse a SurfaceColor object.

setDisplayDefault

protected void setDisplayDefault()
Set all values in PvDisplayOption to the Mathematica default values.

getDisplayOption

public PvDisplayOption getDisplayOption()
Return display options.

readOptions

protected boolean readOptions(java.io.StreamTokenizer st)
Read viewer options: Boxed, Axes, Lighting, LightSources, ViewPoint, ViewCenter, AxesEdge, AmbientLight, BoxRatios, Background, PolygonIntersections, ViewVertical.

readAxesLabel

protected void readAxesLabel(java.io.StreamTokenizer st,
                             int dim)
Read "AxesLabel" option.

parseVector

protected boolean parseVector(java.io.StreamTokenizer st,
                              PdVector vec,
                              int dimension)
Parse a vector of doubles.

computeMathematicaColors

protected void computeMathematicaColors(PgJvxSrc geom)
Compute element colors from lightSources as in Mathematica.

adjustViewer

protected void adjustViewer()
Compute the correct 3D position of camera and lightSources.

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.