Class AbstractObjPolygonReader
java.lang.Object
org.apache.commons.geometry.io.euclidean.threed.obj.AbstractObjPolygonReader
- All Implemented Interfaces:
Closeable, AutoCloseable
- Direct Known Subclasses:
ObjFacetDefinitionReader, ObjTriangleMeshReader
Abstract base class for types that read OBJ polygon content using
PolygonObjParser.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PolygonObjParserOBJ polygon parser.private final ReaderUnderlying reader. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractObjPolygonReader(Reader reader) Construct a new instance that reads OBJ content from the given reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.booleanGet 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 Details
-
reader
Underlying reader. -
parser
OBJ polygon parser.
-
-
Constructor Details
-
AbstractObjPolygonReader
Construct a new instance that reads OBJ content from the given reader.- Parameters:
reader- reader to read characters from
-
-
Method Details
-
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:
-
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 interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
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:
IllegalStateException- if a parsing error occursUncheckedIOException- if an I/O error occurs
-
handleVertex
Method called when a vertex is found in the OBJ content.- Parameters:
vertex- vertex value
-
handleNormal
Method called when a normal is found in the OBJ content.- Parameters:
normal- normal value
-