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
76 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT
108 std::vector<quint32> indices;
122 #if QT_VERSION >= 0x050000
123 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-VTK")
127 void openedFile(
int _id );
128 void addEmptyObject(
DataType _type,
int& _id);
129 void load(QString _filename,
DataType _type,
int& _id);
130 void save(
int _id , QString _filename );
131 void log(
Logtype _type, QString _message);
132 void log(QString _message);
134 void updatedObject(
int _identifier,
const UpdateType& _type);
136 void emptyObjectAdded(
int _id );
137 void deleteObject(
int _id );
140 void showStatusMessage(QString _message,
int _timeout = 0);
144 void pluginExists( QString _pluginName ,
bool& _exists );
145 void functionExists( QString _pluginName , QString _functionName ,
bool& _exists );
148 void setTextureMode(QString _textureName, QString _mode,
int _id );
149 void switchTexture( QString _textureName,
int _id );
150 void addMultiTexture( QString _textureGroup, QString _name, QString _filename,
int _id,
int& _textureId);
151 void textureFilename(
int , QString , QString& );
152 void textureIndex(QString _name,
int _id,
int& _index);
153 void getCurrentTexture(
int , QString& );
154 void textureName (
int,
int, QString &);
155 void getSubTextures (
int, QString, QStringList &);
156 void textureIndexPropertyName(
int, QString&);
160 void fileOpened(
int ){};
171 enum ObjectOptionsVtk
175 FACENORMALS = 1 << 1,
176 VERTEXNORMALS = 1 << 2,
177 VERTEXTEXCOORDS = 1 << 3,
184 QString
name() {
return (QString(
"FileVTK")); };
185 QString
description( ) {
return (QString(tr(
"Load/Save ASCII VTK-Files"))); };
203 bool saveObject(
int _id, QString _filename);
205 QString version() {
return QString(
"1.0"); };
209 bool forceTriangleMesh_;
212 QWidget* saveOptions_;
214 QCheckBox* saveBinary_;
215 QCheckBox* saveFaceNormals_;
216 QCheckBox* saveVertexNormals_;
217 QCheckBox* saveVertexTexCoords_;
218 QLabel* savePrecisionLabel_;
219 QSpinBox* savePrecision_;
220 QPushButton* saveDefaultButton_;
224 unsigned int userWriteOptions_;
240 template <
typename MeshT>
251 template <
typename MeshT>
262 template <
typename MeshT>
273 template <
typename MeshT>
284 template <
typename MeshT>
295 template <
typename MeshT>
308 template <
typename MeshT>
309 int addFaceToOpenMesh(MeshT*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
316 template <
typename MeshT>
324 template <
typename MeshT>
332 template <
typename MeshT>
342 template <
typename MeshT>
352 template <
typename MeshT>
360 template <
typename MeshT>
369 template<
class MeshT >
380 int addTetraCell(TriMesh*& _mesh, std::vector<quint32> _indices);
390 int addTetraCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
400 int addHexaCell(TriMesh*& _mesh, std::vector<quint32> _indices);
410 int addHexaCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
420 int addWedgeCell(TriMesh*& _mesh, std::vector<quint32> _indices);
430 int addWedgeCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
440 int addPyramidCell(TriMesh*& _mesh, std::vector<quint32> _indices);
450 int addPyramidCell(PolyMesh*& _mesh, std::vector<quint32> _indices);
460 int addFace(TriMesh*& _mesh, std::vector<quint32> _indices);
470 int addFace(PolyMesh*& _mesh, std::vector<quint32> _indices);
482 int addFace(TriMesh*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
494 int addFace(PolyMesh*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
604 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
613 template <
typename MeshT>
614 int addTetraCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
624 template <
typename MeshT>
625 int addHexaCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
635 template <
typename MeshT>
636 int addWedgeCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
646 template <
typename MeshT>
647 int addPyramidCellToOpenVolumeMesh(MeshT _mesh, std::vector<quint32> _indices);
657 template <
typename MeshT>
658 int addFaceToOpenVolumeMesh(MeshT*& _mesh, std::vector<quint32> indices);
670 template <
typename MeshT>
671 int addFaceToOpenVolumeMesh(MeshT*& _mesh, quint32 _index1, quint32 _index2, quint32 _index3);
680 template <
typename MeshT>
681 void addVertexNormalToOpenVolumeMesh(MeshT _mesh, quint32 _index,
OpenMesh::Vec3d _normal);
690 template <
typename MeshT>
691 void addFaceNormalToOpenVolumeMesh(MeshT _mesh, quint32 _index,
OpenMesh::Vec3d _normal);
699 template<
class MeshT >
700 bool writeASCIIDataOfOpenVolumeMesh(std::ostream& _out, MeshT& _mesh );
701 #endif //ENABLE_OPENVOLUMEMESH_SUPPORT
703 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
824 #endif //ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
826 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
947 #endif //ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
949 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT
1070 #endif //ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1076 BMT_PolyMesh = 1 << 1,
1077 BMT_HexahedralMesh = 1 << 2,
1078 BMT_PolyhedralMesh = 1 << 3,
1079 BMT_TetrahedralMesh = 1 << 4
1085 template <
typename MeshT>
1086 bool loadMesh(QTextStream& _stream,MeshT*& _mesh, Dataset _type);
1094 template <
typename MeshT>
1095 bool loadMeshPoints(QString _spec,QTextStream& _in,MeshT*& _mesh);
1104 template <
typename MeshT>
1105 bool loadMeshLines(QString _spec,QTextStream& _in,MeshT*& _mesh);
1115 template <
typename MeshT>
1116 bool loadMeshPolygons(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells);
1126 template <
typename MeshT>
1137 template <
typename MeshT>
1138 bool loadMeshTriangleStrips(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells);
1148 template <
typename MeshT>
1149 bool loadMeshCells(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells);
1161 template <
typename MeshT>
1162 bool loadMeshNormals(QString _spec,QTextStream& _in,MeshT*& _mesh, std::vector<CellType>& _cells,
bool _pointNormal, quint32 _count);
1170 template<
class MeshT >
1171 bool writeMesh(std::ostream& _out, MeshT& _mesh );
1176 #endif //FILEVTKPLUGIN_HH
Interface to call functions across plugins.
void setNormalsOfDuplicatedVerticesOfOpenMesh(MeshT *&_mesh)
Sets normals of duplicated vertices that were created for non-manifold meshes.
Control OpenFlippers status bar.
int addPyramidCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a pyramid cell to the mesh. (Does nothing, yet)
applicationStatus
Enum for the statusBar Status Icon.
bool writeMesh(std::ostream &_out, MeshT &_mesh)
Writes the header of the VTK file, then calls writeASCIIData (binary VTK is currently unsupported) ...
int addWedgeCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a wedge cell to the mesh. (Does nothing, yet)
int addWedgeCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a wedge cell to the mesh. (Does nothing, yet)
void updateFaceNormalsOfOpenMesh(MeshT *&_mesh)
Updates face 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.
void updateFaceNormals(TriMesh *&_mesh)
Updates face normals.
QWidget * loadOptionsWidget(QString)
int addFaceToOpenMesh(MeshT *&_mesh, std::vector< quint32 > _indices)
Adds a face to the mesh.
bool loadMeshPoints(QString _spec, QTextStream &_in, MeshT *&_mesh)
Reads points from the stream and adds them to the mesh.
bool loadMeshTriangleStrips(QString _spec, QTextStream &_in, MeshT *&_mesh, std::vector< CellType > &_cells)
Reads triangle strips from the stream and adds them to the mesh.
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which provide scriptable Functions.
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.
FileVTKPlugin()
Constructor.
int loadObject(QString _filename)
Loads Object and converts it to a triangle mesh if possible.
int addTetraCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a tetra cell to the mesh. (Does nothing, yet)
void removeTemporaryProperties(TriMesh *&_mesh)
Removed temporary properties that might have been added during file reading.
QWidget * saveOptionsWidget(QString)
void addVertexNormal(TriMesh *&_mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a vertex normal.
void updateVertexNormals(TriMesh *&_mesh)
Updates vertex normals.
Interface for all Plugins which do logging to the logging window of the framework.
void addVertexNormalToOpenMesh(MeshT _mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a vertex 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.
void updateVertexNormalsOfOpenMesh(MeshT *&_mesh)
Updates vertex normals.
int addPyramidCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a pyramid cell to the mesh. (Does nothing, yet)
int addFace(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a face to the mesh.
void addFaceNormal(TriMesh *&_mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a face normal.
bool binary_
Reading binary file?
void addFaceNormalToOpenMesh(MeshT _mesh, quint32 _index, OpenMesh::Vec3d _normal)
Adds a face normal.
void initializePlugin()
Initialize Plugin.
bool writeASCIIDataOfOpenMesh(std::ostream &_out, MeshT &_mesh)
Writes the data of the VTK file in ASCII format.
Interface class from which all plugins have to be created.
int addTetraCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a tetra cell to the mesh. (Does nothing, yet)
Logtype
Log types for Message Window.
BestMeshType findBestObjectType(QString _filename)
Reads the file to check for present primitives and returns the object type that fits best...
bool writeASCIIData(std::ostream &_out, TriMesh &_mesh)
Writes the data of the VTK file in ASCII format.
QString description()
Return a description of what the plugin is doing.
Provide texture support for a plugin.
Interface class for file handling.
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.
void setNormalsOfDuplicatedVertices(TriMesh *&_mesh)
Sets normals of duplicated vertices that were created for non-manifold meshes.
void addCellNormal(MeshT *&_mesh, const CellType &_cell, OpenMesh::Vec3d _normal)
Adds a normal to the cell.
void removeTemporaryPropertiesOfOpenMesh(MeshT *&_mesh)
Removed temporary properties that might have been added during file reading.
bool loadMeshPolygons(QString _spec, QTextStream &_in, MeshT *&_mesh, std::vector< CellType > &_cells)
Reads polygons from the stream and adds them to the mesh.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
int addHexaCellToOpenMesh(MeshT _mesh, std::vector< quint32 > _indices)
Adds a hexa cell to the mesh. (Does nothing, yet)
Interface class for Plugins which have to store information in ini files.
int addHexaCell(TriMesh *&_mesh, std::vector< quint32 > _indices)
Adds a hexa cell to the mesh. (Does nothing, yet)
QString name()
Return a name for the plugin.