50 #ifndef FILEOFFPLUGIN_HH
51 #define FILEOFFPLUGIN_HH
68 #include <OpenMesh/Core/IO/SR_store.hh>
71 #include "OFFImporter.hh"
83 #if QT_VERSION >= 0x050000
84 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-FileOFF")
87 void openedFile(
int _id );
88 void addEmptyObject(
DataType _type,
int& _id);
89 void load(QString _filename,
DataType _type,
int& _id);
90 void save(
int _id , QString _filename );
91 void log(
Logtype _type, QString _message);
92 void log(QString _message);
94 void updatedObject(
int _identifier,
const UpdateType& _type);
96 void deleteObject(
int _id );
99 void showStatusMessage(QString _message,
int _timeout = 0);
104 void fileOpened(
int ){};
125 QString
name() {
return (QString(
"FileOFF")); };
126 QString
description( ) {
return (QString(tr(
"Load/Save OFF-Files"))); };
144 bool saveObject(
int _id, QString _filename);
146 QString version() {
return QString(
"1.1"); };
163 int getColorType(std::string& _line,
bool _texCoordsAvailable);
173 void readValue(std::istream& _in,
float& _value)
const {
180 void readValue(std::istream& _in,
int& _value)
const {
187 void readValue(std::istream& _in,
unsigned int& _value)
const {
194 void writeValue(std::ostream& _out,
int value)
const {
200 void writeValue(std::ostream& _out,
unsigned int value)
const {
206 void writeValue(std::ostream& _out,
float value)
const {
212 void trimString( std::string& _string);
221 bool getCleanLine( std::istream& ifs , std::string& _string,
bool _skipEmptyLines =
true);
227 template<
class MeshT >
231 template<
class MeshT >
235 template<
class MeshT >
239 template <
class MeshT>
243 QWidget* loadOptions_;
244 QWidget* saveOptions_;
246 QCheckBox* saveBinary_;
247 QCheckBox* saveVertexColor_;
248 QCheckBox* saveFaceColor_;
249 QCheckBox* saveAlpha_;
250 QCheckBox* saveNormals_;
251 QCheckBox* saveTexCoords_;
252 QLabel* savePrecisionLabel_;
253 QSpinBox* savePrecision_;
254 QPushButton* saveDefaultButton_;
257 QComboBox* triMeshHandling_;
258 QCheckBox* loadVertexColor_;
259 QCheckBox* loadFaceColor_;
260 QCheckBox* loadAlpha_;
261 QCheckBox* loadNormals_;
262 QCheckBox* loadTexCoords_;
263 QCheckBox* loadCheckManifold_;
264 QPushButton* loadDefaultButton_;
266 unsigned int userReadOptions_;
267 unsigned int userWriteOptions_;
269 bool forceTriangleMesh_;
272 OFFImporter::ObjectOptionsE trimeshOptions_;
275 #if defined(INCLUDE_TEMPLATES) && !defined(FILEOFFPLUGIN_C)
276 #define FILEOFFPLUGIN_TEMPLATES
277 #include "FileOFFT.cc"
280 #endif //FILEOFFPLUGIN_HH
Interface class from which all plugins have to be created.
QString description()
Return a description of what the plugin is doing.
bool checkDegenerateFace(const std::vector< VertexHandle > &_v)
Check for degenerate faces before adding them.
void backupTextureCoordinates(MeshT &_mesh)
backup per vertex/face texture coordinates
Logtype
Log types for Message Window.
applicationStatus
Enum for the statusBar Status Icon.
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.
QString name()
Return a name for the plugin.
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
QWidget * saveOptionsWidget(QString)
bool parseBinary(std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
Parse binary OFF file.
Interface for all Plugins which do logging to the logging window of the framework.
Interface class for file handling.
FileOFFPlugin()
Constructor.
bool writeMesh(std::ostream &_out, MeshT &_mesh, BaseObject &_baseObj)
Writer function.
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
bool getCleanLine(std::istream &ifs, std::string &_string, bool _skipEmptyLines=true)
Function to retrieve next line.
int getColorType(std::string &_line, bool _texCoordsAvailable)
Get color type.
Interface for all Plugins which provide scriptable Functions.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Interface for all plugins which want to Load or Save files and create Objects.
size_t store(std::ostream &_os, const T &_v, bool _swap=false)
void initializePlugin()
Initialize Plugin.
Control OpenFlippers status bar.
bool writeBinaryData(std::ostream &_out, MeshT &_mesh)
Write binary mesh data to file.
bool writeASCIIData(std::ostream &_out, MeshT &_mesh)
Write ASCII mesh data to file.
bool readFileOptions(QString _filename, OFFImporter &_importer)
Before Parsing the actual file, read all features supported.
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)
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
size_t restore(std::istream &_is, T &_v, bool _swap=false)
QWidget * loadOptionsWidget(QString)
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.