Hello, Would anyone like more time to look over this? If not, and assuming there are no objections, I plan on merging it in the next few days.
Regards, Matt J ________________________________ From: Matt Juntunen <matt.juntu...@hotmail.com> Sent: Sunday, March 28, 2021 1:39 PM To: Commons Developers List <dev@commons.apache.org> Subject: [geometry] IO Modules - Part 2 Hello, I've created a new PR with IO modules for commons-geometry [1]. This is a refactoring of an earlier PR I had and incorporates changes suggested by reviewers. Here are some of the main differences with the previous version: 1. Inputs and outputs are abstracted behind GeometryInput and GeometryOutput interfaces. The interface provides access to the input/output stream, the file name (if available), and a charset (if applicable and available). 2. Formats are represented with the GeometryFormat interface. This interface defines the format name and standard file extensions associated with the format. 3. There is now a GeometryFormat3D enum that implements GeometryFormat and provides easy access to the formats supported by the library. 4. The IO3D class provides static convenience methods for simple operations. If a path or url is passed with no specified format, the file extension is examined to determine the format. 5. I've added support for STL files (GEOMETRY-101). Below is an example using the BoundaryManager3D class, which is the class users would use if they wanted to customize the default IO functionality. DoublePrecisionContext precision = new EpsilonDoublePrecisionContext(1e-10); // create some geometry to write BoundarySource3D cube = Parallelepiped.unitCube(precision); // create the manager and add handlers BoundaryIOManager3D manager = new BoundaryIOManager3D(); manager.registerReadHandler(new StlBoundaryReadHandler3D()); manager.registerWriteHandler(new StlBoundaryWriteHandler3D()); Path file = Paths.get("target/cube.stl"); // write manager.write(cube, new FileGeometryOutput(file), GeometryFormat3D.STL); // read back BoundarySource3D result = manager.read(new FileGeometryInput(file), GeometryFormat3D.STL, precision); Here is the same example using the convenience methods in IO3D. The file format is inferred from the file name. DoublePrecisionContext precision = new EpsilonDoublePrecisionContext(1e-10); // create some geometry to write BoundarySource3D cube = Parallelepiped.unitCube(precision); Path file = Paths.get("target/cube.stl"); // write IO3D.write(cube, file); // read back BoundarySource3D result = IO3D.read(file, precision); If anyone has time to review the PR that would be most welcome. Regards, Matt J [1] https://github.com/apache/commons-geometry/pull/141