44 #ifndef FILEOFFPLUGIN_HH 45 #define FILEOFFPLUGIN_HH 51 #include <QPushButton> 68 #include <OpenMesh/Core/IO/SR_store.hh> 71 #include "OFFImporter.hh" 83 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-FileOFF")
85 void openedFile(
int _id );
86 void addEmptyObject(
DataType _type,
int& _id);
87 void load(QString _filename,
DataType _type,
int& _id);
88 void save(
int _id , QString _filename );
89 void log(
Logtype _type, QString _message);
90 void log(QString _message);
92 void updatedObject(
int _identifier,
const UpdateType& _type);
94 void deleteObject(
int _id );
97 void showStatusMessage(QString _message,
int _timeout = 0);
102 void fileOpened(
int ){};
123 QString
name() {
return (QString(
"FileOFF")); };
124 QString
description( ) {
return (QString(tr(
"Load/Save OFF-Files"))); };
142 bool saveObject(
int _id, QString _filename);
144 QString version() {
return QString(
"1.1"); };
161 int getColorType(std::string& _line,
bool _texCoordsAvailable);
171 void readValue(std::istream& _in,
float& _value)
const {
174 OpenMesh::IO::restore( _in , tmp,
false );
178 void readValue(std::istream& _in,
int& _value)
const {
181 OpenMesh::IO::restore( _in , tmp,
false );
185 void readValue(std::istream& _in,
unsigned int& _value)
const {
188 OpenMesh::IO::restore( _in , tmp,
false );
192 void writeValue(std::ostream& _out,
int value)
const {
195 OpenMesh::IO::store(_out, tmp,
false);
198 void writeValue(std::ostream& _out,
unsigned int value)
const {
201 OpenMesh::IO::store(_out, tmp,
false);
204 void writeValue(std::ostream& _out,
float value)
const {
207 OpenMesh::IO::store(_out, tmp,
false);
210 void trimString( std::string& _string);
219 bool getCleanLine( std::istream& ifs , std::string& _string,
bool _skipEmptyLines =
true);
225 template<
class MeshT >
229 template<
class MeshT >
233 template<
class MeshT >
237 template <
class MeshT>
241 QWidget* loadOptions_;
242 QWidget* saveOptions_;
244 QCheckBox* saveBinary_;
245 QCheckBox* saveVertexColor_;
246 QCheckBox* saveFaceColor_;
247 QCheckBox* saveAlpha_;
248 QCheckBox* saveNormals_;
249 QCheckBox* saveTexCoords_;
250 QLabel* savePrecisionLabel_;
251 QSpinBox* savePrecision_;
252 QPushButton* saveDefaultButton_;
255 QComboBox* triMeshHandling_;
256 QCheckBox* loadVertexColor_;
257 QCheckBox* loadFaceColor_;
258 QCheckBox* loadAlpha_;
259 QCheckBox* loadNormals_;
260 QCheckBox* loadTexCoords_;
261 QCheckBox* loadCheckManifold_;
262 QPushButton* loadDefaultButton_;
264 unsigned int userReadOptions_;
265 unsigned int userWriteOptions_;
267 bool forceTriangleMesh_;
270 OFFImporter::ObjectOptionsE trimeshOptions_;
273 #if defined(INCLUDE_TEMPLATES) && !defined(FILEOFFPLUGIN_C) 274 #define FILEOFFPLUGIN_TEMPLATES 275 #include "FileOFFT_impl.hh" 278 #endif //FILEOFFPLUGIN_HH
bool getCleanLine(std::istream &ifs, std::string &_string, bool _skipEmptyLines=true)
Function to retrieve next line.
Logtype
Log types for Message Window.
Interface for all plugins which want to Load or Save files and create Objects.
Control OpenFlippers status bar.
Interface for all Plugins which provide scriptable Functions.
bool writeBinaryData(std::ostream &_out, MeshT &_mesh)
Write binary mesh data to file.
QString name()
Return a name for the plugin.
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 for all Plugins which do logging to the logging window of the framework.
bool readOFFFile(QString _filename, OFFImporter &_importer)
Read OFF file and parse it.
bool readFileOptions(QString _filename, OFFImporter &_importer)
Before Parsing the actual file, read all features supported.
QWidget * saveOptionsWidget(QString)
applicationStatus
Enum for the statusBar Status Icon.
QWidget * loadOptionsWidget(QString)
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
bool checkDegenerateFace(const std::vector< VertexHandle > &_v)
Check for degenerate faces before adding them.
void handleTrimeshDialog()
Displays a dialog to ask how to load the mesh (triangle, polymesh , autodetect)
FileOFFPlugin()
Constructor.
void backupTextureCoordinates(MeshT &_mesh)
backup per vertex/face texture coordinates
Interface class from which all plugins have to be created.
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)
bool writeMesh(std::ostream &_out, MeshT &_mesh, BaseObject &_baseObj)
Writer function.
void initializePlugin()
Initialize Plugin.
bool parseBinary(std::istream &_in, OFFImporter &_importer, DataType _type, QString &_objectName)
Parse binary OFF file.
Interface class for file handling.
QString description()
Return a description of what the plugin is doing.
void slotLoadDefault()
Slot called when user wants to save the given Load options as default.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
int getColorType(std::string &_line, bool _texCoordsAvailable)
Get color type.