50 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
52 #ifndef OVM_PROPERTY_VISUALIZER_HH
53 #define OVM_PROPERTY_VISUALIZER_HH
55 #include "../PropertyVisualizer.hh"
57 #include <ObjectTypes/VolumeMeshObject/VolumeMeshObject.hh>
59 #include <OpenFlipper/BasePlugin/PluginFunctionsViewControls.hh>
61 #include <ObjectTypes/VolumeMeshObject/VolumeMeshDrawModesContainer.hh>
65 template <
typename MeshT>
69 OVMPropertyVisualizer(MeshT* _mesh,
int objectID,
PropertyInfo _propertyInfo)
76 virtual ~OVMPropertyVisualizer(){
clear(); }
79 virtual void visualize(
bool _setDrawMode, QWidget* _widget);
87 virtual void removeProperty(){ emit log(
"Removing properties not yet implemented for OpenVolumeMeshs."); }
98 unsigned int getClosestPrimitiveId(
unsigned int _face,
ACG::Vec3d &_hitPoint);
103 virtual void visualizeFaceProp(
bool _setDrawMode =
true);
104 virtual void visualizeEdgeProp(
bool _setDrawMode =
true);
105 virtual void visualizeHalfedgeProp(
bool _setDrawMode =
true);
106 virtual void visualizeVertexProp(
bool _setDrawMode =
true);
107 virtual void visualizeCellProp(
bool _setDrawMode =
true);
108 virtual void visualizeHalffaceProp(
bool _setDrawMode =
true);
110 template<
typename PropType>
111 void duplicateProperty_stage1();
115 template <
typename InnerType>
116 QString getPropertyText_(
unsigned int index);
118 virtual void setCellPropertyFromText(
unsigned int index, QString text);
119 virtual void setFacePropertyFromText(
unsigned int index, QString text);
120 virtual void setHalffacePropertyFromText(
unsigned int index, QString text);
121 virtual void setEdgePropertyFromText(
unsigned int index, QString text);
122 virtual void setHalfedgePropertyFromText(
unsigned int index, QString text);
123 virtual void setVertexPropertyFromText(
unsigned int index, QString text);
131 unsigned int getClosestCellId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
132 unsigned int getClosestFaceId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
133 unsigned int getClosestHalffaceId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
134 unsigned int getClosestEdgeId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
135 unsigned int getClosestHalfedgeId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
136 unsigned int getClosestVertexId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
144 template<
typename Property>
148 CopyProperty(Property& p1,
const Property& p2, MeshT*& mesh) :
149 p1(p1), p2(p2), mesh(mesh) {}
151 template<
typename PrimitiveHandleT>
152 inline void operator() (
const PrimitiveHandleT &pr) {
163 #define CALLS_TO_VISUALIZE_PROP(Classname, Template, PropType) \
164 template <Template> \
165 void Classname::visualizeCellProp(bool _setDrawMode) \
167 OpenVolumeMesh::CellPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
168 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->cells_begin(), OVMPropertyVisualizer<MeshT>::mesh->cells_end());\
171 VolumeMeshObject<MeshT>* object;\
172 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
173 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.cellsColoredPerCell);\
177 void Classname::visualizeFaceProp(bool _setDrawMode)\
179 OpenVolumeMesh::FacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
180 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->faces_begin(), OVMPropertyVisualizer<MeshT>::mesh->faces_end());\
183 VolumeMeshObject<MeshT>* object;\
184 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
185 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.facesColoredPerFace);\
189 void Classname::visualizeHalffaceProp(bool _setDrawMode)\
191 OpenVolumeMesh::HalfFacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
192 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halffaces_begin(), OVMPropertyVisualizer<MeshT>::mesh->halffaces_end());\
195 VolumeMeshObject<MeshT>* object;\
196 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
197 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halffacesColoredPerHalfface);\
201 void Classname::visualizeEdgeProp(bool _setDrawMode)\
203 OpenVolumeMesh::EdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
204 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->edges_begin(), OVMPropertyVisualizer<MeshT>::mesh->edges_end());\
207 VolumeMeshObject<MeshT>* object;\
208 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
209 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.edgesColoredPerEdge);\
213 void Classname::visualizeHalfedgeProp(bool _setDrawMode)\
215 OpenVolumeMesh::HalfEdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
216 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halfedges_begin(), OVMPropertyVisualizer<MeshT>::mesh->halfedges_end());\
219 VolumeMeshObject<MeshT>* object;\
220 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
221 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halfedgesColoredPerHalfedge);\
225 void Classname::visualizeVertexProp(bool _setDrawMode)\
227 OpenVolumeMesh::VertexPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
228 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->vertices_begin(), OVMPropertyVisualizer<MeshT>::mesh->vertices_end());\
231 VolumeMeshObject<MeshT>* object;\
232 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
233 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.verticesColored);\
238 #if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_VISUALIZER_CC)
239 #include "OVMPropertyVisualizerT.cc"
This class vizualizes a property.
virtual QString getPropertyText(unsigned int i)=0
Returns the value of a property in text form.
virtual void clear()
Clears the property visualization.
virtual int getEntityCount()=0
Returns the number of entities.
virtual void removeProperty()
Removes the property.
virtual void visualize(bool _setDrawMode, QWidget *_widget)
Visualizes the property.
virtual void setPropertyFromText(unsigned int index, QString text)=0
Returns the value of a property in text form.
virtual void duplicateProperty()
Duplicates the property.
virtual QString getHeader()=0
Returns the header for saving.
Cellection of information about a property.
This class provides easy access to DrawModes supported by OpenVolumeMesh.