|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.loaders.stl.STLFileReader
public class STLFileReader
Class to read STL (Stereolithography) files.
Usage: First create a STLFileReader
object. To obtain the number
of objects, name of objects and number of facets for each object use the
appropriate methods. Then use the getNextFacet(double[], double[][])
method repetitively
to obtain the geometric data for each facet. Call close()
to free the
resources.
In case that the file uses the binary STL format, no check can be done to assure that the file is in STL format. A wrong format will only be recognized if an invalid amount of data is contained in the file.
Constructor Summary | |
---|---|
STLFileReader(java.io.File file)
Creates a STLFileReader object to read a STL file from a
file. |
|
STLFileReader(java.io.File file,
java.awt.Component parentComponent)
Creates a STLFileReader object to read a STL file from a
file. |
|
STLFileReader(java.io.File file,
java.awt.Component parentComponent,
boolean strict)
Creates a STLFileReader object to read a STL file from a
file. |
|
STLFileReader(java.lang.String fileName)
Creates a STLFileReader object to read a STL file from a
file. |
|
STLFileReader(java.lang.String fileName,
boolean strict)
Creates a STLFileReader object to read a STL file from a
file. |
|
STLFileReader(java.lang.String fileName,
java.awt.Component parentComponent)
Creates a STLFileReader object to read a STL file from a
file. |
|
STLFileReader(java.lang.String fileName,
java.awt.Component parentComponent,
boolean strict)
Creates a STLFileReader object to read a STL file from a
file. |
|
STLFileReader(java.net.URL url)
Creates a STLFileReader object to read a STL file from an
URL. |
|
STLFileReader(java.net.URL url,
boolean strict)
Creates a STLFileReader object to read a STL file from an
URL. |
|
STLFileReader(java.net.URL url,
java.awt.Component parentComponent)
Creates a STLFileReader object to read a STL file from an
URL. |
|
STLFileReader(java.net.URL url,
java.awt.Component parentComponent,
boolean strict)
Creates a STLFileReader object to read a STL file from an
URL. |
Method Summary | |
---|---|
void |
close()
Releases used resources. |
boolean |
getNextFacet(double[] normal,
double[][] vertices)
Returns the data for a facet. |
int[] |
getNumOfFacets()
Get number of facets per object. |
int |
getNumOfObjects()
Get number of objects in file. |
java.lang.String[] |
getObjectNames()
Get array with object names. |
java.util.List<java.lang.String> |
getParsingMessages()
Get detailed messages on what was wrong when parsing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public STLFileReader(java.io.File file) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from a
file. The data may be in ASCII or binary format.
file
- File
object of STL file to read.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.lang.String fileName) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from a
file. The data may be in ASCII or binary format.
fileName
- Name of STL file to read.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.lang.String fileName, boolean strict) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from a
file. The data may be in ASCII or binary format.
fileName
- Name of STL file to read.strict
- Attempt to deal with crappy data or short downloads.
Will try to return any useable geometry.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.net.URL url) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from an
URL. The data may be in ASCII or binary format.
url
- URL of STL file to read.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.net.URL url, boolean strict) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from an
URL. The data may be in ASCII or binary format.
url
- URL of STL file to read.strict
- Attempt to deal with crappy data or short downloads.
Will try to return any useable geometry.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.net.URL url, java.awt.Component parentComponent) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from an
URL. The data may be in ASCII or binary format. A progress monitor will
show the progress during reading.
url
- URL of STL file to read.parentComponent
- Parent Component
of progress monitor.
Use null
if there is no parent.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.net.URL url, java.awt.Component parentComponent, boolean strict) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from an
URL. The data may be in ASCII or binary format. A progress monitor will
show the progress during reading.
url
- URL of STL file to read.parentComponent
- Parent Component
of progress monitor.
Use null
if there is no parent.strict
- Attempt to deal with crappy data or short downloads.
Will try to return any useable geometry.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.io.File file, java.awt.Component parentComponent) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from a
file. The data may be in ASCII or binary format. A progress monitor will
show the progress during reading.
file
- File
object of STL file to read.parentComponent
- Parent Component
of progress monitor.
Use null
if there is no parent.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.io.File file, java.awt.Component parentComponent, boolean strict) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from a
file. The data may be in ASCII or binary format. A progress monitor will
show the progress during reading.
file
- File
object of STL file to read.parentComponent
- Parent Component
of progress monitor.
Use null
if there is no parent.strict
- Attempt to deal with crappy data or short downloads.
Will try to return any useable geometry.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.lang.String fileName, java.awt.Component parentComponent) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from a
file. The data may be in ASCII or binary format. A progress monitor will
show the progress during reading.
fileName
- Name of STL file to read.parentComponent
- Parent Component
of progress monitor.
Use null
if there is no parent.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public STLFileReader(java.lang.String fileName, java.awt.Component parentComponent, boolean strict) throws InvalidFormatException, java.io.IOException
STLFileReader
object to read a STL file from a
file. The data may be in ASCII or binary format. A progress monitor will
show the progress during reading.
fileName
- Name of STL file to read.parentComponent
- Parent Component
of progress monitor.
Use null
if there is no parent.strict
- Attempt to deal with crappy data or short downloads.
Will try to return any useable geometry.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
Method Detail |
---|
public boolean getNextFacet(double[] normal, double[][] vertices) throws InvalidFormatException, java.io.IOException
Call consecutively until all data is read.
normal
- array of size 3 to store the normal vector.vertices
- array of size 3x3 to store the vertex data.
True
if facet data is contained in
normal
and vertices
. False
if end of file is reached. Further calls of this method after
the end of file is reached will lead to an IOException.
InvalidFormatException
- The file was structurally incorrect
java.io.IOException
public java.lang.String[] getObjectNames()
null
.public int[] getNumOfFacets()
public java.util.List<java.lang.String> getParsingMessages()
public int getNumOfObjects()
public void close() throws java.io.IOException
java.io.IOException
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |