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.CloseableAbstract base class for types that read OBJ polygon content usingPolygonObjParser.
-
-
Field Summary
Fields Modifier and Type Field Description private PolygonObjParserparserOBJ polygon parser.private java.io.ReaderreaderUnderlying reader.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractObjPolygonReader(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 voidclose()protected abstract voidhandleNormal(Vector3D normal)Method called when a normal is found in the OBJ content.protected abstract voidhandleVertex(Vector3D vertex)Method called when a vertex is found in the OBJ content.booleanisFailOnNonPolygonKeywords()Get the flag indicating whether or not anIllegalStateExceptionwill be thrown if the OBJ content contains any keywords defining non-polygon geometric content (ex:curv).protected PolygonObjParser.FacereadFace()Return the next face from the OBJ content or null if no face is found.voidsetFailOnNonPolygonKeywords(boolean fail)Set the flag indicating whether or not anIllegalStateExceptionwill 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 anIllegalStateExceptionwill 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
IllegalStateExceptionwill 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 anIllegalStateExceptionwill 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 anIllegalStateExceptionwill be thrown if non-polygon content is encountered
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein 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
-
-