44#ifndef FILEOFFPLUGIN_HH
45#define FILEOFFPLUGIN_HH
69#include <OpenMesh/Core/IO/SR_store.hh>
72#include "OFFImporter.hh"
86 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-FileOFF")
89 void openedFile(
int _id );
90 void addEmptyObject(
DataType _type,
int& _id);
91 void load(QString _filename,
DataType _type,
int& _id);
92 void save(
int _id , QString _filename );
93 void log(
Logtype _type, QString _message);
94 void log(QString _message);
96 void updatedObject(
int _identifier,
const UpdateType& _type);
98 void deleteObject(
int _id );
101 void showStatusMessage(QString _message,
int _timeout = 0);
106 void fileOpened(
int ){};
127 QString
name() {
return (QString(
"FileOFF")); };
128 QString
description( ) {
return (QString(tr(
"Load/Save OFF-Files"))); };
146 bool saveObject(
int _id, QString _filename);
148 QString version() {
return QString(
"1.1"); };
165 int getColorType(std::string& _line,
bool _texCoordsAvailable);
175 void readValue(std::istream& _in,
float& _value)
const {
178 OpenMesh::IO::restore( _in , tmp,
false );
182 void readValue(std::istream& _in,
int& _value)
const {
185 OpenMesh::IO::restore( _in , tmp,
false );
189 void readValue(std::istream& _in,
unsigned int& _value)
const {
192 OpenMesh::IO::restore( _in , tmp,
false );
196 void writeValue(std::ostream& _out,
int value)
const {
199 OpenMesh::IO::store(_out, tmp,
false);
202 void writeValue(std::ostream& _out,
unsigned int value)
const {
205 OpenMesh::IO::store(_out, tmp,
false);
208 void writeValue(std::ostream& _out,
float value)
const {
211 OpenMesh::IO::store(_out, tmp,
false);
214 void trimString( std::string& _string);
223 bool getCleanLine( std::istream& ifs , std::string& _string,
bool _skipEmptyLines =
true);
229 template<
class MeshT >
233 template<
class MeshT >
237 template<
class MeshT >
241 template <
class MeshT>
245 QWidget* loadOptions_;
246 QWidget* saveOptions_;
248 QCheckBox* saveBinary_;
249 QCheckBox* saveVertexColor_;
250 QCheckBox* saveFaceColor_;
251 QCheckBox* saveAlpha_;
252 QCheckBox* saveNormals_;
253 QCheckBox* saveTexCoords_;
254 QLabel* savePrecisionLabel_;
255 QSpinBox* savePrecision_;
256 QPushButton* saveDefaultButton_;
259 QComboBox* triMeshHandling_;
260 QCheckBox* loadVertexColor_;
261 QCheckBox* loadFaceColor_;
262 QCheckBox* loadAlpha_;
263 QCheckBox* loadNormals_;
264 QCheckBox* loadTexCoords_;
265 QCheckBox* loadCheckManifold_;
266 QPushButton* loadDefaultButton_;
268 unsigned int userReadOptions_;
269 unsigned int userWriteOptions_;
271 bool forceTriangleMesh_;
274 OFFImporter::ObjectOptionsE trimeshOptions_;
277#if defined(INCLUDE_TEMPLATES) && !defined(FILEOFFPLUGIN_C)
278#define FILEOFFPLUGIN_TEMPLATES
279#include "FileOFFT_impl.hh"
Logtype
Log types for Message Window.
Interface class from which all plugins have to be created.
Interface class for file handling.
bool parseBinary(std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
Parse binary OFF file.
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
bool readFileOptions(QString _filename, OFFImporter &_importer)
Before Parsing the actual file, read all features supported.
bool writeASCIIData(std::ostream &_out, MeshT &_mesh)
Write ASCII mesh data to file.
void initializePlugin()
Initialize Plugin.
bool writeBinaryData(std::ostream &_out, MeshT &_mesh)
Write binary mesh data to file.
bool writeMesh(std::ostream &_out, MeshT &_mesh, BaseObject &_baseObj)
Writer function.
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
QWidget * loadOptionsWidget(QString)
QString name()
Return a name for the plugin.
int getColorType(std::string &_line, bool _texCoordsAvailable)
Get color type.
QString description()
Return a description of what the plugin is doing.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
QWidget * saveOptionsWidget(QString)
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
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 backupTextureCoordinates(MeshT &_mesh)
backup per vertex/face texture coordinates
FileOFFPlugin()
Constructor.
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
bool parseASCII(std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
Parse ascii OFF file.
bool checkDegenerateFace(const std::vector< VertexHandle > &_v)
Check for degenerate faces before adding them.
bool readOFFFile(QString _filename, OFFImporter &_importer)
Read OFF file and parse it.
bool getCleanLine(std::istream &ifs, std::string &_string, bool _skipEmptyLines=true)
Function to retrieve next line.
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which do logging to the logging window of the framework.
Interface class for exporting functions to python.
Interface for all Plugins which provide scriptable Functions.
Control OpenFlippers status bar.
applicationStatus
Enum for the statusBar Status Icon.