Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FileOFFPlugin Class Reference
Inheritance diagram for FileOFFPlugin:
BaseInterface FileInterface LoadSaveInterface LoggingInterface ScriptInterface StatusbarInterface

Public Slots

int loadObject (QString _filename)
 Loads Object and converts it to a triangle mesh if possible.
 
int loadObject (QString _filename, DataType _type)
 Loads Object with given datatype.
 
bool saveObject (int _id, QString _filename)
 
QString version ()
 

Signals

void openedFile (int _id)
 
void addEmptyObject (DataType _type, int &_id)
 
void load (QString _filename, DataType _type, int &_id)
 
void save (int _id, QString _filename)
 
void log (Logtype _type, QString _message)
 
void log (QString _message)
 
void updateView ()
 
void updatedObject (int _identifier, const UpdateType &_type)
 
void deleteObject (int _id)
 
void showStatusMessage (QString _message, int _timeout=0)
 
void setStatus (ApplicationStatus::applicationStatus _status)
 
- Signals inherited from BaseInterface
virtual void updateView ()
 Update current view in Main Application. More...
 
virtual void setSlotDescription (QString _slotName, QString _slotDescription, QStringList _parameters, QStringList _descriptions)
 Set a description for a public slot. More...
 
virtual void setRenderer (unsigned int _viewer, QString _rendererName)
 Set a renderer for the given viewer. More...
 
- Signals inherited from FileInterface
virtual void openedFile (int _id)
 This signal has to be emitted if an object has been loaded from a file. More...
 
- Signals inherited from LoadSaveInterface
virtual void save (int _id, QString _filename)
 Save object to a file. More...
 
virtual void load (QString _filename, DataType _type, int &_id)
 Load object from file with a specific DataType. More...
 
- Signals inherited from LoggingInterface
virtual void log (Logtype _type, QString _message)=0
 
virtual void log (QString _message)=0
 
- Signals inherited from ScriptInterface
virtual void scriptInfo (QString _functionWithParameters)
 Emit this signal if a scriptable function is executed. More...
 
virtual void getScriptingEngine (QScriptEngine *&_engine)
 
virtual void executeScript (QString _script)
 
virtual void getAvailableFunctions (QStringList &_functions)
 
- Signals inherited from StatusbarInterface
virtual void showStatusMessage (QString _message, int _timeout=0)
 Show a message in the status bar. More...
 

Public Member Functions

 FileOFFPlugin ()
 Constructor.
 
QString name ()
 Return a name for the plugin. More...
 
QString description ()
 Return a description of what the plugin is doing. More...
 
DataType supportedType ()
 Return your supported object type( e.g. DATA_TRIANGLE_MESH ) More...
 
QString getSaveFilters ()
 
QString getLoadFilters ()
 
QWidget * saveOptionsWidget (QString)
 
QWidget * loadOptionsWidget (QString)
 

Private Slots

void fileOpened (int)
 

Private Member Functions

void noguiSupported ()
 
void initializePlugin ()
 Initialize Plugin. More...
 
void handleTrimeshDialog ()
 Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
 
void slotLoadDefault ()
 Slot called when user wants to save the given Load options as default.
 
void slotSaveDefault ()
 Slot called when user wants to save the given Save options as default.
 
bool readFileOptions (QString _filename, OFFImporter &_importer)
 Before Parsing the actual file, read all features supported. More...
 
bool readOFFFile (QString _filename, OFFImporter &_importer)
 Read OFF file and parse it.
 
bool parseASCII (std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
 Parse ascii OFF file.
 
bool parseBinary (std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
 Parse binary OFF file.
 
int getColorType (std::string &_line, bool _texCoordsAvailable)
 Get color type.
 
void updateUserOptions ()
 
bool extendedFaceColorTest (std::istream &_in, uint _nV, uint _nF, int _nB) const
 Test if there are face color components (_nV is the initial face valence)
 
void readValue (std::istream &_in, float &_value) const
 
void readValue (std::istream &_in, int &_value) const
 
void readValue (std::istream &_in, unsigned int &_value) const
 
void writeValue (std::ostream &_out, int value) const
 
void writeValue (std::ostream &_out, unsigned int value) const
 
void writeValue (std::ostream &_out, float value) const
 
void trimString (std::string &_string)
 
bool getCleanLine (std::istream &ifs, std::string &_string, bool _skipEmptyLines=true)
 Function to retrieve next line. More...
 
bool checkDegenerateFace (const std::vector< VertexHandle > &_v)
 Check for degenerate faces before adding them.
 
template<class MeshT >
bool writeMesh (std::ostream &_out, MeshT &_mesh, BaseObject &_baseObj)
 Writer function.
 
template<class MeshT >
bool writeBinaryData (std::ostream &_out, MeshT &_mesh)
 Write binary mesh data to file.
 
template<class MeshT >
bool writeASCIIData (std::ostream &_out, MeshT &_mesh)
 Write ASCII mesh data to file.
 
template<class MeshT >
void backupTextureCoordinates (MeshT &_mesh)
 backup per vertex/face texture coordinates
 
- Private Member Functions inherited from BaseInterface
virtual ~BaseInterface ()
 Destructor.
 
virtual void blockScenegraphUpdates (bool _block)
 Tell the core to prevent scenegraph updates. More...
 
virtual void updatedObject (int _objectId)
 An object has been changed or added by this plugin. More...
 
virtual void updatedObject (int _identifier, const UpdateType &_type)
 An object has been changed or added by this plugin. More...
 
virtual void nodeVisibilityChanged (int _identifier)
 A scenegraph node has been shown or hidden. More...
 
virtual void getCurrentRenderer (unsigned int _viewer, QString &_rendererName)
 Get the current renderer for the given viewer. More...
 
- Private Member Functions inherited from FileInterface
virtual ~FileInterface ()
 Destructor.
 
virtual bool saveObject (int _id, QString _filename)=0
 Save an object from the given file. More...
 
virtual bool saveObjects (IdList _ids, QString _filename)
 Save multiple objects to one file. More...
 
- Private Member Functions inherited from LoadSaveInterface
virtual ~LoadSaveInterface ()
 Destructor.
 
virtual void addEmptyObject (DataType _type, int &_id)
 
virtual void copyObject (int _oldId, int &_newId)
 
virtual void emptyObjectAdded (int _id)
 DEPRECATED HERE (Moved to Type Interface)! Emit this signal if an empty object has been created. More...
 
virtual void deleteObject (int _id)
 Delete an object
This signal can be called from any thread.
. More...
 
virtual void deleteAllObjects ()
 Delete all Objects. More...
 
virtual void getAllFileFilters (QStringList &_filters)
 Get all file filters that are registered. More...
 
- Private Member Functions inherited from LoggingInterface
virtual ~LoggingInterface ()
 Destructor.
 
- Private Member Functions inherited from ScriptInterface
virtual ~ScriptInterface ()
 Destructor.
 
virtual void executeFileScript (QString _filename)
 
virtual void getDescription (QString _function, QString &_description, QStringList &_parameters, QStringList &_descriptions)
 
- Private Member Functions inherited from StatusbarInterface
virtual ~StatusbarInterface ()
 Destructor.
 
void setStatus (ApplicationStatus::applicationStatus _status)
 Sets the status icon of the StatusBar. More...
 
void clearStatusMessage ()
 Removes the current message from the statusBar. More...
 
void addWidgetToStatusbar (QWidget *_widget)
 Add a widget on the right side of the statusBar. More...
 

Private Attributes

QWidget * loadOptions_
 
QWidget * saveOptions_
 
QCheckBox * saveBinary_
 
QCheckBox * saveVertexColor_
 
QCheckBox * saveFaceColor_
 
QCheckBox * saveAlpha_
 
QCheckBox * saveNormals_
 
QCheckBox * saveTexCoords_
 
QLabel * savePrecisionLabel_
 
QSpinBox * savePrecision_
 
QPushButton * saveDefaultButton_
 
QComboBox * triMeshHandling_
 
QCheckBox * loadVertexColor_
 
QCheckBox * loadFaceColor_
 
QCheckBox * loadAlpha_
 
QCheckBox * loadNormals_
 
QCheckBox * loadTexCoords_
 
QCheckBox * loadCheckManifold_
 
QPushButton * loadDefaultButton_
 
unsigned int userReadOptions_
 
unsigned int userWriteOptions_
 
bool forceTriangleMesh_
 
bool forcePolyMesh_
 
bool readColorComp_
 
OFFImporter::ObjectOptionsE trimeshOptions_
 

Detailed Description

Definition at line 73 of file FileOFF.hh.

Member Function Documentation

QString FileOFFPlugin::description ( )
inlinevirtual

Return a description of what the plugin is doing.

This function has to return a basic description of the plugin

Implements BaseInterface.

Definition at line 126 of file FileOFF.hh.

bool FileOFFPlugin::getCleanLine ( std::istream &  ifs,
std::string &  _string,
bool  _skipEmptyLines = true 
)
private

Function to retrieve next line.

Parameters
ifsThe input stream we operate on
_stringThis will be the output string
_skipEmptyLinesSkip empty/comment lines? If not, empty strings will be returned if comment or (remaining) line is empty
Returns

Definition at line 167 of file FileOFF.cc.

QString FileOFFPlugin::getLoadFilters ( )
virtual

Return the Qt Filters for File dialogs when loading files (e.g. "Off files ( *.off )" )

Implements FileInterface.

Definition at line 134 of file FileOFF.cc.

QString FileOFFPlugin::getSaveFilters ( )
virtual

Get the Qt Filters for Filedialogs when saving files (e.g. "Off files ( *.off )" )

Implements FileInterface.

Definition at line 140 of file FileOFF.cc.

void FileOFFPlugin::initializePlugin ( )
privatevirtual

Initialize Plugin.

This slot is called if the plugin is loaded and has to be initialized. All initialization stuff in this slot has to stay inside the plugin, no external signals are allowed here (and will be ignored). Don't create any objects via PluginFunctions here. Use the pluginsInitialized() slot for external initialization. After execution of this slot your plugin should be fully functional. Only gui elements may be uninitialized and should be created in pluginsInitialized().

Reimplemented from BaseInterface.

Definition at line 103 of file FileOFF.cc.

QWidget * FileOFFPlugin::loadOptionsWidget ( QString  _currentFilter)
virtual

You can provide a special widget showing options for loading your file types depending on the current filter

_currentFilter: one filter from loadFilters

Return 0 when you don't need one

Implements FileInterface.

Definition at line 1425 of file FileOFF.cc.

QString FileOFFPlugin::name ( )
inlinevirtual

Return a name for the plugin.

This Function has to return the name of the plugin.

Implements BaseInterface.

Definition at line 125 of file FileOFF.hh.

void FileOFFPlugin::noguiSupported ( )
inlineprivatevirtual

Using this function you can inform the core that your plugin can run without creating a widget. If your plugin does not implement this function, it will not be loaded in scripting mode without gui. You don't have to do anything in this function.

Reimplemented from BaseInterface.

Definition at line 106 of file FileOFF.hh.

bool FileOFFPlugin::readFileOptions ( QString  _filename,
OFFImporter _importer 
)
private

Before Parsing the actual file, read all features supported.

Todo:
Implement extended coordinates
Todo:
Implement any space dimension

Definition at line 263 of file FileOFF.cc.

QWidget * FileOFFPlugin::saveOptionsWidget ( QString  _currentFilter)
virtual

You can provide a special widget showing options for saving your file types depending on the current filter

_currentFilter: one filter from saveFilters

Return 0 when you don't need one

Implements FileInterface.

Definition at line 1368 of file FileOFF.cc.

DataType FileOFFPlugin::supportedType ( )
virtual

Return your supported object type( e.g. DATA_TRIANGLE_MESH )

If you support multiple DataTypes you can combine them bitwise here. The function is used from the load and save code to check if your plugin can handle an object of a given dataType.

Implements FileInterface.

Definition at line 146 of file FileOFF.cc.

void FileOFFPlugin::updateUserOptions ( )
private

Update user options depending on which options have been selected on the load dialog

Definition at line 204 of file FileOFF.cc.


The documentation for this class was generated from the following files: