Workspace 6.21.5
Classes | Public Member Functions | Static Public Member Functions | List of all members
SelectableMeshReaders Class Reference

Singleton class that provides an extensible list of mesh readers.

#include <Mesh/FileIO/Readers/selectablemeshreaders.h>

Classes

struct  Reader
 Details about a specific reader. More...
 

Public Member Functions

bool addReader (const DataExecution::Workspace &workspace, const QString &format, const QString &filter, QString fileNameInput="Mesh model interface", QString meshModelInterfaceInput="File name", QString meshModelOutput="Mesh model", QString transformsOutput="", QString modelInfoOutput="")
 
bool addReader (const DataExecution::Workspace &workspace, const QString &format, const QStringList &filters, QString meshModelInterfaceInput="Mesh model interface", QString fileNameInput="File name", QString meshModelOutput="Mesh model", QString transformsOutput="", QString modelInfoOutput="")
 
bool addReader (const QString &workspaceFileName, const QString &format, const QString &filter, QString meshModelInterfaceInput="Mesh model interface", QString fileNameInput="File name", QString meshModelOutput="Mesh model", QString transformsOutput="", QString modelInfoOutput="")
 
bool addReader (const QString &workspaceFileName, const QString &format, const QStringList &filters, QString meshModelInterfaceInput="Mesh model interface", QString fileNameInput="File name", QString meshModelOutput="Mesh model", QString transformsOutput="", QString modelInfoOutput="")
 
QStringList getFormats (bool sort=false) const
 
QStandardItemModel & getFormatsModel ()
 
QList< ReadergetReaders (const QString &format) const
 
bool haveFormat (const QString &format) const
 
bool removeReadersAndFiltersForFormat (const QString &format)
 

Static Public Member Functions

static SelectableMeshReadersgetInstance ()
 

Member Function Documentation

◆ addReader() [1/4]

bool addReader ( const DataExecution::Workspace workspace,
const QString &  format,
const QString &  filter,
QString  fileNameInput = "Mesh model interface",
QString  meshModelInterfaceInput = "File name",
QString  meshModelOutput = "Mesh model",
QString  transformsOutput = "",
QString  modelInfoOutput = "" 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ addReader() [2/4]

bool addReader ( const DataExecution::Workspace workspace,
const QString &  format,
const QStringList filters,
QString  meshModelInterfaceInput = "Mesh model interface",
QString  fileNameInput = "File name",
QString  meshModelOutput = "Mesh model",
QString  transformsOutput = "",
QString  modelInfoOutput = "" 
)
Parameters
workspaceA workspace to use as a prototype for a selectable mesh reader.
formatThe name of the format this reader handles. It would normally be unique among all formats supported, but if it matches an existing reader then the readers will be tried in turn until one succeeds when a request for a reader for that format is made. The name must not be "Auto-detect" as this is reserved for internal use.
filtersA list of file filters typically associated with this format. This will often be used to populate file dialog filters but may also be used by file format auto-detection logic. For more information on filters, see the Qt documentation for QFileDialog.
fileNameInputThe name of an input to the workspace which should accept the name of the file to read. The input must have a data type of QString. Developers are strongly encouraged to use the default input name for consistency.
meshModelInterfaceInputThe name of an input to the workspace which should accept the MeshModelInterface to read into. The input must have a data type of MeshModelInterface. Developers are strongly encouraged to use the default input name for consistency.
meshModelOutputThe name of an output from the workspace which should provide the mesh model after reading. The output must have a data type of MeshModel. Developers are strongly encouraged to use the default output name for consistency.
transformsOutputThe name of an output from the workspace which should provide the object transforms after reading. Not all readers support this input, so an empty string is allowed to be provided for these readers.
modelInfoOutputThe name of an output from the workspace which should provide the model info after reading. Not all readers support this input, so an empty string is allowed to be provided for these readers.
Returns
True if a reader was added based on the information supplied, or false otherwise.

◆ addReader() [3/4]

bool addReader ( const QString &  workspaceFileName,
const QString &  format,
const QString &  filter,
QString  meshModelInterfaceInput = "Mesh model interface",
QString  fileNameInput = "File name",
QString  meshModelOutput = "Mesh model",
QString  transformsOutput = "",
QString  modelInfoOutput = "" 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload differs in that instead of providing a Workspace, the caller provides the name of a file to read in and load as a workspace. This workspaceFileName can be a local file or it can also be a resource path.

◆ addReader() [4/4]

bool addReader ( const QString &  workspaceFileName,
const QString &  format,
const QStringList filters,
QString  meshModelInterfaceInput = "Mesh model interface",
QString  fileNameInput = "File name",
QString  meshModelOutput = "Mesh model",
QString  transformsOutput = "",
QString  modelInfoOutput = "" 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload differs in that instead of providing a Workspace, the caller provides the name of a file to read in and load as a workspace. This workspaceFileName can be a local file or it can also be a resource path.

◆ getFormats()

QStringList getFormats ( bool  sort = false) const
Returns
The list of supported reader formats. Note that there could be more than one reader supporting a given format, in which case they will be tried in order until one succeeds. The order should be considered arbitrary, since it depends on the order in which the readers were added to the SelectableMeshReaders object.
See also
getReaders()

◆ getFormatsModel()

QStandardItemModel & getFormatsModel ( )
Returns
The model providing the supported formats. This model is kept up to date as new readers are added. This is particularly useful for passing as the model to a QComboBox, for example, where that combo box needs to show the list of supported formats and it has to stay in sync as new readers are added.

◆ getInstance()

SelectableMeshReaders & getInstance ( )
static
Returns
The Singleton instance.

◆ getReaders()

QList< SelectableMeshReaders::Reader > getReaders ( const QString &  format) const
Parameters
formatThe format for which the available readers are required.
Returns
A list of readers that support the requested format. If no readers support format, the returned list will be empty.
See also
getFormats()

◆ haveFormat()

bool haveFormat ( const QString &  format) const
inline

◆ removeReadersAndFiltersForFormat()

bool removeReadersAndFiltersForFormat ( const QString &  format)