jv.loader
Class PgStlLoader
- java.lang.Object
-
- jv.loader.PgAbstractLoader
-
- jv.loader.PgStlLoader
-
- All Implemented Interfaces:
- PgLoaderIf
public final class PgStlLoader extends PgAbstractLoader
Loader for geometry files given in STL file format.- Author:
- Konrad Polthier
- Version:
- 13.05.13, 3.00 revised (kp) Move to jv.loader from jvx.loader.
22.03.10, 2.00 revised (kp) Superclass changed to PgAbstractLoader.
15.02.04, 1.90 revised (kp) Export of 2D geometries improved.
06.10.03, 1.85 revised (kp) Interface extended by isEnabledOptimization().
19.04.03, 1.80 revised (kp) Interface extended by setGeometryOption().
21.08.02, 1.70 revised (kp) New methods getGeometries/getAnimations of PgLoaderIf implemented.
23.09.01, 1.60 revised (kp) Implement PgLoaderIf extended with methods for display options.
11.06.01, 1.50 revised (kp) Implement PgLoaderIf.
26.02.01, 1.00 created (kp)
-
-
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 PgStlLoader()Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static booleanisAscii(java.io.BufferedReader in)Determine if input file is ASCII by checking first word to be "solid".PgJvxSrc[]read(java.io.BufferedReader in)Read an STL geometry file and return an array of new geometries.PgJvxSrc[]read(java.io.DataInputStream inReader)Read an array of geometries from a binary input stream.booleanwrite(java.io.Writer writer, PgJvxSrc[] geomArr)Write a single element set into an output stream writer.-
Methods inherited from class jv.loader.PgAbstractLoader
getAnimations, getDisplayOption, getGeometries, getSpecializedGeometries, isAnimation, isEnabledOptimization, load, setAnimation, setDisplayOption, setGeometryOption, write
-
-
-
-
Method Detail
-
read
public PgJvxSrc[] read(java.io.BufferedReader in)
Read an STL geometry file and return an array of new geometries.The returned array of geometry may contain keyframes of an animation. This is checked with the method
isAnimation().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.
- See Also:
write(Writer, PgJvxSrc [])- Author:
- Konrad Polthier
- Version:
- 10.06.01, 1.10 revised (kp) Return an array instead a single geometry.
26.02.01, 1.00 created (kp)
-
isAscii
public static boolean isAscii(java.io.BufferedReader in) throws java.io.IOExceptionDetermine if input file is ASCII by checking first word to be "solid". In case of STL file, decide by the first five characters whether to read as ASCII file or as binary file. The ASCII file would always begin with the word "solid", the binary file will never.Note, reader will return at same read position, typically at the beginning of file.
- Parameters:
in- Buffered reader from current STL file- Returns:
- true if file contains STL in ASCII format
- Throws:
java.io.IOException
-
read
public PgJvxSrc[] read(java.io.DataInputStream inReader)
Read an array of geometries from a binary input stream.- Overrides:
readin classPgAbstractLoader- Parameters:
inReader- Provides all data to this stream- Returns:
- set of loaded geometries on success.
- See Also:
PgAbstractLoader.load(BufferedReader),write(Writer, PgJvxSrc [])- Version:
- 26.10.10, 1.00 created (mad)
-
write
public boolean write(java.io.Writer writer, PgJvxSrc[] geomArr) throws java.io.IOExceptionWrite a single element set into an output stream writer. Only the first element set of an array is exported.- 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:
- 09.02.02, 1.10 revised (kp) Export floats in non-exponential form.
10.06.01, 1.00 created (kp)
-
-
"