Class PgMathLoader
- java.lang.Object
-
- jv.loader.PgAbstractLoader
-
- jv.loader.PgMathLoader
-
- All Implemented Interfaces:
- PgLoaderIf
public final class PgMathLoader extends PgAbstractLoader
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.- Author:
- Ulrich Reitebuch
- Version:
- 14.12.12, 3.10 revised (ur) BugFix: After parsing GraphicsComplex, parsing numbers has to be activated
and other geometries have to be joined into the same geom array.
22.03.10, 3.00 revised (kp) Superclass changed to PgAbstractLoader.
03.01.07, 2.51 revised (ur) Enable Autofit and AutoCenter for 2D geometries.
21.08.06, 2.50 revised (ur) Enable lighting instead of computed face colors, read AspectRatio.
23.09.05, 2.40 revised (ur) Enable ColorFunction "Automatic" and "Hue", parse ColorFunctionScaling.
14.06.05, 2.39 revised (ur) Bug removed. Parsing of numbers must be enabled when reading colors.
13.07.04, 2.38 revised (ur) Offset will be parsed now, but still ignored.
09.03.04, 2.37 revised (ur) ColorFunction will be parsed now, but still ignored.
15.02.04, 2.36 revised (kp) Export of 2D geometries improved.
06.10.03, 2.35 revised (kp) Interface extended by isEnabledOptimization().
10.06.03, 2.30 revised (ur) Better handling of GraphicsArray.
19.04.03, 2.20 revised (kp) Interface extended by setGeometryOption().
20.03.03, 2.10 revised (ur) ColorOutput handling enabled.
16.03.03, 2.00 revised (kp) BoxRatio activated and bounding box calculation shortened.
06.02.03, 1.90 revised (ur) Handling of perspectivity and text alignment improved, circles and disks added.
20.01.03, 1.80 revised (ur) Parsing of Raster and RasterArray added. (ur) 16.01.03, 1.70 revised (ur) Diverse improvements in handling of options and colors.
29.11.02, 1.60 revised (ur) Security against EOF in while statements.
26.08.02, 1.50 revised (kp) Method setDisplayOptions() added such that this class now implements PgLoaderIf.
09.07.02, 1.40 revised (ur) Handle ambient light as a light source, since Lighting gets supported in JavaView.
17.05.01, 1.39 revised (kp) Bug with class verification exception in jvLite cured.
23.03.01, 1.38 revised (ur) Color handling adjusted for Lighting->True/False.
20.03.01, 1.37 revised (ur) Correct camera settings without display.fit().
14.03.01, 1.37 revised (ur) Lighting->False handled, bug in SurfaceGraphics faceColors removed.
08.03.01, 1.36 revised (ur) Set neighbour informations in readParametricSurface.
07.03.01, 1.35 revised (ur) Read DensityGraphics, new Graphics primitive Arrow, add two light sources, whenever Mathematica default light sources are given.
05.03.01, 1.34 revised (ur) Setting of backFace Colors activated.
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 methodreadGraphics(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)
-
-
Field Summary
-
Fields inherited from interface jv.loader.PgLoaderIf
GEOM_DATA_AUTHOR, GEOM_DATA_COLORS, GEOM_DATA_HEADER, GEOM_DATA_INFO, GEOM_DATA_NORMALS, GEOM_DATA_TEXTURE, GEOM_DATA_VECTORS
-
-
Constructor Summary
Constructors Constructor and Description PgMathLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PvDisplayOption[]getDisplayOptions()Get array of display options which some parsers and geometry file formats supply.booleanisEnabledOptimization()Determines if the loaded geometry requires some optimization.booleanisKeyAnimation()Return, if list of geometries is a keyframe animation.PgJvxSrc[]read(java.io.BufferedReader in)Read a Mathematica graphics from a bufferedReader.voidsetKeyAnimation(boolean flag)Set flag, if list of geometries is a keyframe animation.voidsetMathematicaVersion(double version)Set Mathematica Version number.booleanwrite(java.io.DataOutputStream outWriter, PgJvxSrc[] geom)Write an array of geometries into a binary output stream writer.booleanwrite(java.io.Writer writer, PgJvxSrc[] geomArr)Write an array of geometries into an output stream writer in Mathematica expression file format, called MGS.-
Methods inherited from class jv.loader.PgAbstractLoader
getAnimations, getDisplayOption, getGeometries, getSpecializedGeometries, isAnimation, load, read, setAnimation, setDisplayOption, setGeometryOption
-
-
-
-
Method Detail
-
isEnabledOptimization
public boolean isEnabledOptimization()
Determines if the loaded geometry requires some optimization. The method in this class allows optimization and always returns true.For example, some file formats do not store a connected mesh but provide individual vertices for each face every time the face is mentioned. In this case, a loader manager may identify equal vertices.
A similar method in the loader manager PgLoader may override the individual settings of each loader.
- Specified by:
isEnabledOptimizationin interfacePgLoaderIf- Overrides:
isEnabledOptimizationin classPgAbstractLoader- Returns:
trueif loader is enabled for optimization.- Since:
- JavaView 2.99.018
- See Also:
PgLoader.isEnabledOptimization(),PgLoader.setEnabledOptimization(boolean)- Version:
- 06.10.03, 1.00 created (kp)
-
setMathematicaVersion
public void setMathematicaVersion(double version)
Set Mathematica Version number. Some default settings are changed significantly from Mathematica Version 5.* to 6.0, so the version number should be known to handle default parameters correctly.- Parameters:
version-
-
isKeyAnimation
public boolean isKeyAnimation()
Return, if list of geometries is a keyframe animation.
-
setKeyAnimation
public void setKeyAnimation(boolean flag)
Set flag, if list of geometries is a keyframe animation. During animation the time steps of a keyframe animation are morphed into another using the blend method.
-
read
public PgJvxSrc[] read(java.io.BufferedReader in)
Read a Mathematica graphics from a bufferedReader. Depending on the result of calling the methodisAnimation()use either the methodsgetGeometries()orgetAnimations()to retrieve the loaded geometries from this loader.Alternatively, one may call load(BuffereredReader) followed by getGeometries() resp. getAnimations() to have a finer control about which information one wants to use from a source. For example, optional display information must be retrieve by a subsequent call getDisplayOption() if available.
- Specified by:
readin interfacePgLoaderIf- Overrides:
readin classPgAbstractLoader- Parameters:
in- BufferedReader to read textual data from.- Returns:
- Array of JVX geometries.
- Since:
- JavaView 2.32
- See Also:
PgAbstractLoader.isAnimation(),PgAbstractLoader.getAnimations(),PgAbstractLoader.getGeometries()- Version:
- 16.03.03, 1.10 revised (kp) Bounding box calculation shortened.
-
write
public boolean write(java.io.DataOutputStream outWriter, PgJvxSrc[] geom) throws java.io.IOExceptionWrite an array of geometries into a binary output stream writer.- Specified by:
writein interfacePgLoaderIf- Overrides:
writein classPgAbstractLoader- Parameters:
outWriter- Write all data to this streamgeom- Array with geometries to save- Returns:
trueon success.- Throws:
java.io.IOException- See Also:
read(BufferedReader),write(Writer, PgJvxSrc [])- Version:
- 30.04.06, 1.00 created (kp)
-
write
public boolean write(java.io.Writer writer, PgJvxSrc[] geomArr) throws java.io.IOExceptionWrite an array of geometries into an output stream writer in Mathematica expression file format, called MGS.Numbers with absolute value less than
jv.vecmath.PuMath#EPSare 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.- Specified by:
writein interfacePgLoaderIf- Overrides:
writein classPgAbstractLoader- Parameters:
writer- Write all data to this streamgeomArr- Array with geometries to save- Returns:
trueon success.- Throws:
java.io.IOException- See Also:
read(BufferedReader)- Version:
- 11.06.07, 1.30 revised (ur) Save element colors as SurfaceColor[...].
10.06.01, 1.20 revised (kp) Save array of geometries instead of single geometry.
21.08.00, 1.00 created (kp)
-
getDisplayOptions
public PvDisplayOption[] getDisplayOptions()
Get array of display options which some parsers and geometry file formats supply. This array is needed for individual option settings in GraphicsArrays or animations.- Author:
- Ulrich Reitebuch
- Version:
- 11.06.03, 1.00 (ur) created.
-
-
"