45#ifndef OVM_PROPERTY_VISUALIZER_HH
46#define OVM_PROPERTY_VISUALIZER_HH
48#include "PropertyVisualizer/PropertyVisualizer.hh"
50#include <ObjectTypes/VolumeMeshObject/VolumeMeshObject.hh>
52#include <OpenFlipper/BasePlugin/PluginFunctionsViewControls.hh>
54#include <ObjectTypes/VolumeMeshObject/VolumeMeshDrawModesContainer.hh>
56#include <ACG/QtWidgets/QtHistogramWidget.hh>
60template <
typename MeshT>
74 virtual void visualize(
bool _setDrawMode, QWidget* _widget);
82 virtual void removeProperty(){ emit log(
"Removing properties not yet implemented for OpenVolumeMeshs."); }
96 template <
typename Type>
102 virtual void visualizeFaceProp(
bool _setDrawMode =
true);
103 virtual void visualizeEdgeProp(
bool _setDrawMode =
true);
104 virtual void visualizeHalfedgeProp(
bool _setDrawMode =
true);
105 virtual void visualizeVertexProp(
bool _setDrawMode =
true);
106 virtual void visualizeCellProp(
bool _setDrawMode =
true);
107 virtual void visualizeHalffaceProp(
bool _setDrawMode =
true);
109 template<
typename PropType>
110 void duplicateProperty_stage1();
112 template <
typename InnerType>
113 QString getPropertyText_(
unsigned int index);
115 virtual void setCellPropertyFromText(
unsigned int index, QString text);
116 virtual void setFacePropertyFromText(
unsigned int index, QString text);
117 virtual void setHalffacePropertyFromText(
unsigned int index, QString text);
118 virtual void setEdgePropertyFromText(
unsigned int index, QString text);
119 virtual void setHalfedgePropertyFromText(
unsigned int index, QString text);
120 virtual void setVertexPropertyFromText(
unsigned int index, QString text);
128 unsigned int getClosestCellId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
129 unsigned int getClosestFaceId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
130 unsigned int getClosestHalffaceId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
131 unsigned int getClosestEdgeId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
132 unsigned int getClosestHalfedgeId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
133 unsigned int getClosestVertexId(
unsigned int _face,
ACG::Vec3d& _hitPoint);
141 template<
typename Property>
146 p1(p1), p2(p2), mesh(mesh) {}
148 template<
typename PrimitiveHandleT>
149 inline void operator() (
const PrimitiveHandleT &pr) {
160#define CALLS_TO_VISUALIZE_PROP(Classname, Template, PropType) \
162void Classname::visualizeCellProp(bool _setDrawMode) \
164 OpenVolumeMesh::CellPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
165 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->cells());\
168 VolumeMeshObject<MeshT>* object;\
169 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
170 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.cellsColoredPerCell);\
174void Classname::visualizeFaceProp(bool _setDrawMode)\
176 OpenVolumeMesh::FacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
177 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->faces());\
180 VolumeMeshObject<MeshT>* object;\
181 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
182 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.facesColoredPerFace);\
186void Classname::visualizeHalffaceProp(bool _setDrawMode)\
188 OpenVolumeMesh::HalfFacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
189 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halffaces());\
192 VolumeMeshObject<MeshT>* object;\
193 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
194 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halffacesColoredPerHalfface);\
198void Classname::visualizeEdgeProp(bool _setDrawMode)\
200 OpenVolumeMesh::EdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
201 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->edges());\
204 VolumeMeshObject<MeshT>* object;\
205 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
206 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.edgesColoredPerEdge);\
210void Classname::visualizeHalfedgeProp(bool _setDrawMode)\
212 OpenVolumeMesh::HalfEdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
213 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halfedges());\
216 VolumeMeshObject<MeshT>* object;\
217 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
218 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halfedgesColoredPerHalfedge);\
222void Classname::visualizeVertexProp(bool _setDrawMode)\
224 OpenVolumeMesh::VertexPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
225 visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->vertices());\
228 VolumeMeshObject<MeshT>* object;\
229 PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
230 object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.verticesColored);\
235#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_VISUALIZER_CC)
236#include "OVMPropertyVisualizerT_impl.hh"
virtual QString getPropertyText(unsigned int index)=0
Returns the value of a property in text form.
virtual void removeProperty()
Should remove the property.
virtual void clear()
Clears a property.
virtual int getEntityCount()
Returns the number of entities.
virtual void setPropertyFromText(unsigned int index, QString text)
Returns the value of a property in text form.
virtual void duplicateProperty()
Duplicates a property.
virtual void visualize(bool _setDrawMode, QWidget *_widget)
Visualizes a property.
virtual QString getHeader()
Returns the header for saving.
unsigned int getClosestPrimitiveId(unsigned int _face, ACG::Vec3d &_hitPoint)
Returns the ID of the closest primitive.
Cellection of information about a property.
This class vizualizes a property.
PropertyVisualizer(const PropertyInfo &_propertyInfo)
Constructor.
This class provides easy access to DrawModes supported by OpenVolumeMesh.