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 {
176 OpenMesh::IO::restore( _in , tmp,
false );
180 void readValue(std::istream& _in,
int& _value)
const {
183 OpenMesh::IO::restore( _in , tmp,
false );
187 void readValue(std::istream& _in,
unsigned int& _value)
const {
190 OpenMesh::IO::restore( _in , tmp,
false );
194 void writeValue(std::ostream& _out,
int value)
const {
197 OpenMesh::IO::store(_out, tmp,
false);
200 void writeValue(std::ostream& _out,
unsigned int value)
const {
203 OpenMesh::IO::store(_out, tmp,
false);
206 void writeValue(std::ostream& _out,
float value)
const {
209 OpenMesh::IO::store(_out, tmp,
false);
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
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
void backupTextureCoordinates(MeshT &_mesh)
backup per vertex/face texture coordinates
int getColorType(std::string &_line, bool _texCoordsAvailable)
Get color type.
bool writeMesh(std::ostream &_out, MeshT &_mesh, BaseObject &_baseObj)
Writer function.
bool writeBinaryData(std::ostream &_out, MeshT &_mesh)
Write binary mesh data to file.
Logtype
Log types for Message Window.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Control OpenFlippers status bar.
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
QWidget * saveOptionsWidget(QString)
bool readFileOptions(QString _filename, OFFImporter &_importer)
Before Parsing the actual file, read all features supported.
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
Interface for all Plugins which provide scriptable Functions.
bool getCleanLine(std::istream &ifs, std::string &_string, bool _skipEmptyLines=true)
Function to retrieve next line.
Interface class from which all plugins have to be created.
void initializePlugin()
Initialize Plugin.
Interface for all Plugins which do logging to the logging window of the framework.
bool checkDegenerateFace(const std::vector< VertexHandle > &_v)
Check for degenerate faces before adding them.
bool parseBinary(std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
Parse binary OFF file.
bool writeASCIIData(std::ostream &_out, MeshT &_mesh)
Write ASCII mesh data to file.
bool parseASCII(std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
Parse ascii OFF file.
Interface class for file handling.
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)
applicationStatus
Enum for the statusBar Status Icon.
bool readOFFFile(QString _filename, OFFImporter &_importer)
Read OFF file and parse it.
Interface for all plugins which want to Load or Save files and create Objects.
QString description()
Return a description of what the plugin is doing.
QWidget * loadOptionsWidget(QString)
FileOFFPlugin()
Constructor.
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
QString name()
Return a name for the plugin.