elrnv / vtkio

Visualization ToolKit (VTK) file parser and writer
Apache License 2.0
56 stars 13 forks source link

Add configuration options for exporting files #39

Open elrnv opened 1 year ago

elrnv commented 1 year ago

There are different ways one could export files, and currently the API tries its best to guess what is intended by looking at the file type and the model definition. For XML files, there are different ways to export the same Vtk model. In the current implementation when exporting in XML, a Vtk struct is converted to VTKFile which represents the XML format for these files, and while this contains all the information for the final export, the conversion itself assumes a number of defaults (e.g. whether to use base64 encoding).

The proposal here is to add a config struct that can be passed to the export function as well as Vtk::try_into_xml_format, to enable custom export options. This can be combined with the compression scheme, which is already passed in the Vtk::try_into_xml_format function. One use case is to help with debugging as suggested in #38 by enabling ASCII output.

This struct should look like:

struct XMLExportConfig {
    compressor: Compressor,
    compression_level: u32,
    data_format: DataArrayFormat,
    ... // Other configuration options.
}