Class AbstractObjPolygonReader
- java.lang.Object
-
- org.apache.commons.geometry.io.euclidean.threed.obj.AbstractObjPolygonReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
ObjFacetDefinitionReader
,ObjTriangleMeshReader
public abstract class AbstractObjPolygonReader extends java.lang.Object implements java.io.Closeable
Abstract base class for types that read OBJ polygon content usingPolygonObjParser
.
-
-
Field Summary
Fields Modifier and Type Field Description private PolygonObjParser
parser
OBJ polygon parser.private java.io.Reader
reader
Underlying reader.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractObjPolygonReader(java.io.Reader reader)
Construct a new instance that reads OBJ content from the given reader.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
protected abstract void
handleNormal(Vector3D normal)
Method called when a normal is found in the OBJ content.protected abstract void
handleVertex(Vector3D vertex)
Method called when a vertex is found in the OBJ content.boolean
isFailOnNonPolygonKeywords()
Get the flag indicating whether or not anIllegalStateException
will be thrown if the OBJ content contains any keywords defining non-polygon geometric content (ex:curv
).protected PolygonObjParser.Face
readFace()
Return the next face from the OBJ content or null if no face is found.void
setFailOnNonPolygonKeywords(boolean fail)
Set the flag indicating whether or not anIllegalStateException
will be thrown if the OBJ content contains any keywords defining non-polygon geometric content (ex:curv
).
-
-
-
Field Detail
-
reader
private final java.io.Reader reader
Underlying reader.
-
parser
private final PolygonObjParser parser
OBJ polygon parser.
-
-
Method Detail
-
isFailOnNonPolygonKeywords
public boolean isFailOnNonPolygonKeywords()
Get the flag indicating whether or not anIllegalStateException
will be thrown if the OBJ content contains any keywords defining non-polygon geometric content (ex:curv
). If false, non-polygon data is ignored.- Returns:
- flag indicating whether or not an
IllegalStateException
will be thrown if non-polygon content is encountered - See Also:
PolygonObjParser.isFailOnNonPolygonKeywords()
-
setFailOnNonPolygonKeywords
public void setFailOnNonPolygonKeywords(boolean fail)
Set the flag indicating whether or not anIllegalStateException
will be thrown if the OBJ content contains any keywords defining non-polygon geometric content (ex:curv
). If set to false, non-polygon data is ignored.- Parameters:
fail
- flag indicating whether or not anIllegalStateException
will be thrown if non-polygon content is encountered
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
readFace
protected PolygonObjParser.Face readFace()
Return the next face from the OBJ content or null if no face is found.- Returns:
- the next face from the OBJ content or null if no face is found
- Throws:
java.lang.IllegalStateException
- if a parsing error occursjava.io.UncheckedIOException
- if an I/O error occurs
-
handleVertex
protected abstract void handleVertex(Vector3D vertex)
Method called when a vertex is found in the OBJ content.- Parameters:
vertex
- vertex value
-
handleNormal
protected abstract void handleNormal(Vector3D normal)
Method called when a normal is found in the OBJ content.- Parameters:
normal
- normal value
-
-