Interface BoundaryReadHandler<H extends HyperplaneConvexSubset<?>,B extends BoundarySource<H>>

Type Parameters:
H - Geometric boundary type
B - Boundary source type
All Known Subinterfaces:
BoundaryReadHandler3D
All Known Implementing Classes:
AbstractBoundaryReadHandler3D, CsvBoundaryReadHandler3D, ObjBoundaryReadHandler3D, StlBoundaryReadHandler3D, TextBoundaryReadHandler3D

public interface BoundaryReadHandler<H extends HyperplaneConvexSubset<?>,B extends BoundarySource<H>>
Basic interface for reading geometric boundary representations (B-reps) from a specific data storage format. This interface is intended primarily for use with BoundaryIOManager.

Implementation note: implementations of this interface must be thread-safe.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boundaries(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
    Return a Stream that can be used to access all boundary information from the given input, which is expected to contain data in the format supported by this handler.
    Get the data format supported by this handler.
    read(GeometryInput input, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
    Return an object containing all boundaries read from input using the handler's supported data format.
  • Method Details

    • getFormat

      GeometryFormat getFormat()
      Get the data format supported by this handler.
      Returns:
      data format supported by this handler
    • read

      B read(GeometryInput input, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return an object containing all boundaries read from input using the handler's supported data format.
      Parameters:
      input - input to read from
      precision - precision context used for floating point comparisons
      Returns:
      object containing all boundaries read from input
      Throws:
      IllegalArgumentException - if mathematically invalid data is encountered
      IllegalStateException - if a data format error occurs
      UncheckedIOException - if an I/O error occurs
    • boundaries

      Stream<H> boundaries(GeometryInput in, org.apache.commons.numbers.core.Precision.DoubleEquivalence precision)
      Return a Stream that can be used to access all boundary information from the given input, which is expected to contain data in the format supported by this handler. Unlike the read method, this method does not require that all input be read immediately and stored in memory (although implementations of this interface are still free to do so). Callers may therefore prefer to use this method in cases where memory usage is a concern or transformations and/or filters must be applied to the boundaries before use.

      Implementing class will usually keep the source input stream open during stream iteration. Callers should therefore use the returned stream in a try-with-resources statement to ensure that all resources are properly released. Ex:

        try (Stream<H> stream = handler.boundaries(in, precision)) {
            // access stream content
        }
       

      The following exceptions may be thrown during stream iteration:

      Parameters:
      in - input to read from
      precision - precision context used for floating point comparisons
      Returns:
      stream providing access to the boundary information from the given input
      Throws:
      IllegalStateException - if a data format error occurs during stream creation
      UncheckedIOException - if an I/O error occurs during stream creation