Class ObjBoundaryWriteHandler3D
java.lang.Object
org.apache.commons.geometry.io.euclidean.threed.AbstractBoundaryWriteHandler3D
org.apache.commons.geometry.io.euclidean.threed.obj.ObjBoundaryWriteHandler3D
- All Implemented Interfaces:
BoundaryWriteHandler<PlaneConvexSubset,
,BoundarySource3D> BoundaryWriteHandler3D
BoundaryWriteHandler3D
implementation for writing OBJ content. Output is written using the UTF-8 charset by default.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
The default line separator value.private static final int
Default mesh buffer batch size.private Charset
Charset used for text output.private DoubleFunction
<String> Double format function.private String
Line separator string.private int
Batch size used for mesh buffer creation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ObjWriter
Construct a new, configuredObjWriter
instance for writing content to the given output stream.Get the text output default charset, used if the output does not specify a charset.Get the function used to convert double values to strings.Get thedata format
supported by this handler.Get the line separator.int
Get the batch size when generating OBJ mesh content from facet sequences.void
setDefaultCharset
(Charset charset) Set the text output default charset, used if the output does not specify a charset.void
setDoubleFormat
(DoubleFunction<String> doubleFormat) Set the function used to convert double values to strings.void
setLineSeparator
(String lineSeparator) Set the line separator.void
setMeshBufferBatchSize
(int batchSize) Set the batch size when generating OBJ mesh content from facet sequences.void
write
(Stream<? extends PlaneConvexSubset> boundaries, GeometryOutput out) Write all boundaries in the stream to the given output using the data format supported by this instance.void
write
(BoundarySource3D src, GeometryOutput out) Write all boundaries fromsrc
to the given output, using the data format for the instance.void
writeFacets
(Stream<? extends FacetDefinition> facets, GeometryOutput out) Write allfacets
in the stream to the output using the data format supported by this instance.Methods inherited from class org.apache.commons.geometry.io.euclidean.threed.AbstractBoundaryWriteHandler3D
writeFacets
-
Field Details
-
DEFAULT_LINE_SEPARATOR
The default line separator value.- See Also:
-
DEFAULT_MESH_BUFFER_BATCH_SIZE
private static final int DEFAULT_MESH_BUFFER_BATCH_SIZEDefault mesh buffer batch size.- See Also:
-
defaultCharset
Charset used for text output. -
lineSeparator
Line separator string. -
doubleFormat
Double format function. -
meshBufferBatchSize
private int meshBufferBatchSizeBatch size used for mesh buffer creation.
-
-
Constructor Details
-
ObjBoundaryWriteHandler3D
public ObjBoundaryWriteHandler3D()
-
-
Method Details
-
getFormat
Get thedata format
supported by this handler.- Returns:
- data format supported by this handler
-
getDefaultCharset
Get the text output default charset, used if the output does not specify a charset.- Returns:
- text output default charset
-
setDefaultCharset
Set the text output default charset, used if the output does not specify a charset.- Parameters:
charset
- text output default charset
-
getLineSeparator
Get the line separator. This value defaults to "\n".- Returns:
- the current line separator
-
setLineSeparator
Set the line separator.- Parameters:
lineSeparator
- the line separator to use
-
getDoubleFormat
Get the function used to convert double values to strings.- Returns:
- double format function
-
setDoubleFormat
Set the function used to convert double values to strings. The given function must be thread-safe if this handler is to be used in a multi-threaded context.- Parameters:
doubleFormat
- double format function
-
getMeshBufferBatchSize
public int getMeshBufferBatchSize()Get the batch size when generating OBJ mesh content from facet sequences. Larger batch sizes allow for reuse of vertex definitions but at the cost of more memory usage. The buffer size is unlimited if set to-1
. Default value is -1.- Returns:
- mesh buffer batch size
- See Also:
-
setMeshBufferBatchSize
public void setMeshBufferBatchSize(int batchSize) Set the batch size when generating OBJ mesh content from facet sequences. Larger batch sizes allow for reuse of vertex definitions but at the cost of more memory usage. Set to-1
to allow unlimited buffer size. Default value is -1.- Parameters:
batchSize
- mesh buffer batch size; set to-1
to allow unlimited buffer sizes- See Also:
-
write
Write all boundaries fromsrc
to the given output, using the data format for the instance.- Specified by:
write
in interfaceBoundaryWriteHandler<PlaneConvexSubset,
BoundarySource3D> - Overrides:
write
in classAbstractBoundaryWriteHandler3D
- Parameters:
src
- boundary sourceout
- output to write to
-
write
Write all boundaries in the stream to the given output using the data format supported by this instance. The stream passed as an argument is not closed, meaning that callers are responsible for closing the stream if necessary (for example, if the stream fetches data from the file system).- Parameters:
boundaries
- stream containing boundaries to writeout
- output to write to
-
writeFacets
Write allfacets
in the stream to the output using the data format supported by this instance. The stream passed as an argument is not closed, meaning that callers are responsible for closing the stream if necessary (for example, if the stream fetches data from the file system).- Parameters:
facets
- stream containing facets to writeout
- output to write to
-
createWriter
Construct a new, configuredObjWriter
instance for writing content to the given output stream.- Parameters:
out
- output stream to write to- Returns:
- new
OBJWriter
for writing content to the given output stream - Throws:
UncheckedIOException
- if an I/O error occurs
-