Class AbstractObjPolygonReader

java.lang.Object
org.apache.commons.geometry.io.euclidean.threed.obj.AbstractObjPolygonReader
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
ObjFacetDefinitionReader, ObjTriangleMeshReader

public abstract class AbstractObjPolygonReader extends Object implements Closeable
Abstract base class for types that read OBJ polygon content using PolygonObjParser.
  • Field Details

    • reader

      private final Reader reader
      Underlying reader.
    • parser

      private final PolygonObjParser parser
      OBJ polygon parser.
  • Constructor Details

    • AbstractObjPolygonReader

      protected AbstractObjPolygonReader(Reader reader)
      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 an IllegalStateException 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 an IllegalStateException 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 an IllegalStateException will be thrown if non-polygon content is encountered
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface 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:
      IllegalStateException - if a parsing error occurs
      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