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 PolygonObjParser
OBJ polygon parser.private final Reader
Underlying reader. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractObjPolygonReader
(Reader reader) Construct a new instance that reads OBJ content from the given reader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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 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 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:
-
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 interfaceAutoCloseable
- Specified by:
close
in 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
-