50 #ifndef FILEVTKPLUGIN_HH
51 #define FILEVTKPLUGIN_HH
61 #include <OpenFlipper/BasePlugin/INIInterface.hh>
65 #include <OpenFlipper/BasePlugin/TextureInterface.hh>
70 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
73 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
105 std::vector<quint32> indices;
119 #if QT_VERSION >= 0x050000
120 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-VTK")
124 void openedFile(
int _id );
125 void addEmptyObject(
DataType _type,
int& _id);
126 void load(QString _filename,
DataType _type,
int& _id);
127 void save(
int _id , QString _filename );
128 void log(
Logtype _type, QString _message);
129 void log(QString _message);
131 void updatedObject(
int _identifier,
const UpdateType& _type);
133 void emptyObjectAdded(
int _id );
134 void deleteObject(
int _id );
137 void showStatusMessage(QString _message,
int _timeout = 0);
141 void pluginExists( QString _pluginName ,
bool& _exists );
142 void functionExists( QString _pluginName , QString _functionName ,
bool& _exists );
145 void setTextureMode(QString _textureName, QString _mode,
int _id );
146 void switchTexture( QString _textureName,
int _id );
147 void addMultiTexture( QString _textureGroup, QString _name, QString _filename,
int _id,
int& _textureId);
148 void textureFilename(
int , QString , QString& );
149 void textureIndex(QString _name,
int _id,
int& _index);
150 void getCurrentTexture(
int , QString& );
151 void textureName (
int,
int, QString &);
152 void getSubTextures (
int, QString, QStringList &);
153 void textureIndexPropertyName(
int, QString&);
157 void fileOpened(
int ){};
168 enum ObjectOptionsVtk
172 FACENORMALS = 1 << 1,
173 VERTEXNORMALS = 1 << 2,
174 VERTEXTEXCOORDS = 1 << 3,
181 QString
name() {
return (QString(
"FileVTK")); };
182 QString
description( ) {
return (QString(tr(
"Load/Save ASCII VTK-Files"))); };
200 bool saveObject(
int _id, QString _filename);
202 QString version() {
return QString(
"1.0"); };
206 bool forceTriangleMesh_;
209 QWidget* saveOptions_;
211 QCheckBox* saveBinary_;
212 QCheckBox* saveFaceNormals_;
213 QCheckBox* saveVertexNormals_;
214 QCheckBox* saveVertexTexCoords_;
215 QLabel* savePrecisionLabel_;
216 QSpinBox* savePrecision_;
217 QPushButton* saveDefaultButton_;
221 unsigned int userWriteOptions_;
237 template <
typename MeshT>
248 template <
typename MeshT>
259 template <
typename MeshT>
270 template <
typename MeshT>
281 template <
typename MeshT>
292 template <
typename MeshT>
305 template <
typename MeshT>
306 int addFaceToOpenMesh(MeshT*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
313 template <
typename MeshT>
321 template <
typename MeshT>
329 template <
typename MeshT>
339 template <
typename MeshT>
349 template <
typename MeshT>
357 template <
typename MeshT>
366 template<
class MeshT >
377 int addTetraCell(TriMesh*& _mesh, std::vector<quint32> _indices);
387 int addTetraCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
397 int addHexaCell(TriMesh*& _mesh, std::vector<quint32> _indices);
407 int addHexaCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
417 int addWedgeCell(TriMesh*& _mesh, std::vector<quint32> _indices);
427 int addWedgeCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
437 int addPyramidCell(TriMesh*& _mesh, std::vector<quint32> _indices);
447 int addPyramidCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
457 int addFace(TriMesh*& _mesh, std::vector<quint32> _indices);
467 int addFace(PolyMesh*& _mesh, std::vector<quint32> _indices);
479 int addFace(TriMesh*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
491 int addFace(PolyMesh*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
601 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
610 template <
typename MeshT>
611 int addTetraCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
621 template <
typename MeshT>
622 int addHexaCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
632 template <
typename MeshT>
633 int addWedgeCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
643 template <
typename MeshT>
644 int addPyramidCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
654 template <
typename MeshT>
655 int addFaceToOpenVolumeMesh(MeshT*& _mesh, std::vector<quint32> indices);
667 template <
typename MeshT>
668 int addFaceToOpenVolumeMesh(MeshT*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
677 template <
typename MeshT>
678 void addVertexNormalToOpenVolumeMesh(MeshT _mesh, quint32 _index,
OpenMesh::Vec3d _normal);
687 template <
typename MeshT>
688 void addFaceNormalToOpenVolumeMesh(MeshT _mesh, quint32 _index,
OpenMesh::Vec3d _normal);
696 template<
class MeshT >
697 bool writeASCIIDataOfOpenVolumeMesh(std::ostream& _out, MeshT& _mesh );
698 #endif //ENABLE_OPENVOLUMEMESH_SUPPORT
700 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
821 #endif //ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
823 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
944 #endif //ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
950 BMT_PolyMesh = 1 << 1,
951 BMT_HexahedralMesh = 1 << 2,
952 BMT_PolyhedralMesh = 1 << 3
958 template <
typename MeshT>
959 bool loadMesh(QTextStream& _stream,MeshT*& _mesh, Dataset _type);
967 template <
typename MeshT>
968 bool loadMeshPoints(QString _spec,QTextStream& _in,MeshT*& _mesh);
977 template <
typename MeshT>
978 bool loadMeshLines(QString _spec,QTextStream& _in,MeshT*& _mesh);
988 template <
typename MeshT>
989 bool loadMeshPolygons(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells);
999 template <
typename MeshT>
1010 template <
typename MeshT>
1011 bool loadMeshTriangleStrips(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells);
1021 template <
typename MeshT>
1022 bool loadMeshCells(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells);
1034 template <
typename MeshT>
1035 bool loadMeshNormals(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells,
bool _pointNormal, quint32 _count);
1043 template<
class MeshT >
1044 bool writeMesh(std::ostream& _out, MeshT& _mesh );
1049 #endif //FILEVTKPLUGIN_HH
BestMeshType findBestObjectType(QString _filename)
Reads the file to check for present primitives and returns the object type that fits best...
void setNormalsOfDuplicatedVertices(TriMesh *&_mesh)
Sets normals of duplicated vertices that were created for non-manifold meshes.
Interface class from which all plugins have to be created.
bool writeMesh(std::ostream &_out, MeshT &_mesh)
Writes the header of the VTK file, then calls writeASCIIData (binary VTK is currently unsupported) ...
bool writeASCIIData(std::ostream &_out, TriMesh &_mesh)
Writes the data of the VTK file in ASCII format.
void updateFaceNormals(TriMesh *&_mesh)
Updates face normals.
Interface class for Plugins which have to store information in ini files.
bool loadMeshCells(QString _spec, QTextStream &_in, MeshT *&_mesh, std::vector< CellType > &_cells)
Reads unstructured grid data from the stream and adds it to the mesh.
Logtype
Log types for Message Window.
void addVertexNormal(TriMesh *&_mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a vertex normal.
applicationStatus
Enum for the statusBar Status Icon.
int addPyramidCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a pyramid cell to the mesh. (Does nothing, yet)
void addFaceNormal(TriMesh *&_mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a face normal.
int add_non_manifold_face(MeshT *&_mesh, std::vector< OpenMesh::VertexHandle > &_vhandles)
Helper function for loadMeshPolygons() that takes care of adding non-manifold faces.
int addFaceToOpenMesh(MeshT *&_mesh, std::vector< quint32 > _indices)
Adds a face to the mesh.
int addHexaCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a hexa cell to the mesh. (Does nothing, yet)
int addFace(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a face to the mesh.
Interface for all Plugins which do logging to the logging window of the framework.
int addPyramidCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a pyramid cell to the mesh. (Does nothing, yet)
QWidget * saveOptionsWidget(QString)
void initializePlugin()
Initialize Plugin.
Interface class for file handling.
QString description()
Return a description of what the plugin is doing.
Interface to call functions across plugins.
bool loadMeshPolygons(QString _spec, QTextStream &_in, MeshT *&_mesh, std::vector< CellType > &_cells)
Reads polygons from the stream and adds them to the mesh.
bool loadMeshPoints(QString _spec, QTextStream &_in, MeshT *&_mesh)
Reads points from the stream and adds them to the mesh.
void updateFaceNormalsOfOpenMesh(MeshT *&_mesh)
Updates face normals.
bool writeASCIIDataOfOpenMesh(std::ostream &_out, MeshT &_mesh)
Writes the data of the VTK file in ASCII format.
int addWedgeCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a wedge cell to the mesh. (Does nothing, yet)
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
void removeTemporaryProperties(TriMesh *&_mesh)
Removed temporary properties that might have been added during file reading.
Interface for all Plugins which provide scriptable Functions.
void removeTemporaryPropertiesOfOpenMesh(MeshT *&_mesh)
Removed temporary properties that might have been added during file reading.
void updateVertexNormals(TriMesh *&_mesh)
Updates vertex normals.
void slotSaveDefault()
Slot called when user wants to save the given Save options as default.
bool loadMeshLines(QString _spec, QTextStream &_in, MeshT *&_mesh)
Reads lines from the stream and adds them to the mesh.
bool loadMeshNormals(QString _spec, QTextStream &_in, MeshT *&_mesh, std::vector< CellType > &_cells, bool _pointNormal, quint32 _count)
Reads Normals from the stream and adds them to the mesh.
int addTetraCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a tetra cell to the mesh. (Does nothing, yet)
Interface for all plugins which want to Load or Save files and create Objects.
QWidget * loadOptionsWidget(QString)
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
int addTetraCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a tetra cell to the mesh. (Does nothing, yet)
bool binary_
Reading binary file?
void updateVertexNormalsOfOpenMesh(MeshT *&_mesh)
Updates vertex normals.
void setNormalsOfDuplicatedVerticesOfOpenMesh(MeshT *&_mesh)
Sets normals of duplicated vertices that were created for non-manifold meshes.
void addVertexNormalToOpenMesh(MeshT _mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a vertex normal.
bool loadMeshTriangleStrips(QString _spec, QTextStream &_in, MeshT *&_mesh, std::vector< CellType > &_cells)
Reads triangle strips from the stream and adds them to the mesh.
FileVTKPlugin()
Constructor.
Control OpenFlippers status bar.
QString name()
Return a name for the plugin.
Provide texture support for a plugin.
void addFaceNormalToOpenMesh(MeshT _mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a face normal.
int addHexaCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a hexa cell to the mesh. (Does nothing, yet)
void addCellNormal(MeshT *&_mesh, const CellType &_cell, OpenMesh::Vec3d _normal)
Adds a normal to the cell.
int addWedgeCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a wedge cell to the mesh. (Does nothing, yet)