50 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
52 #ifndef OVM_PROPERTY_MODEL_H
53 #define OVM_PROPERTY_MODEL_H
55 #include "SingleObjectPropertyModel.hh"
56 #include "OVMPropertyVisualizer.hh"
57 #include "OVMPropertyVisualizerBoolean.hh"
58 #include "OVMPropertyVisualizerDouble.hh"
59 #include "OVMPropertyVisualizerInteger.hh"
60 #include "OVMPropertyVisualizerVector.hh"
61 #include "OVMPropertyVisualizerVectorFieldDifference.hh"
63 #include "../Utils.hh"
64 #include <OpenVolumeMesh/Core/BaseProperty.hh>
66 #include "Widgets/LoadSaveWidget.hh"
67 #include "Widgets/PickWidget.hh"
71 #include "../Utils.hh"
73 #define PROP_VIS "PropertyVisualization"
86 OVMPropertyModelSubclass(QObject *parent = 0)
92 virtual void slotCombine(){ combine(); }
95 virtual void slotPickProperty(){ pickProperty(); }
98 virtual void combine(){}
100 virtual void pickProperty(){}
104 template<
typename MeshT>
105 class OVMPropertyModel:
public OVMPropertyModelSubclass {
108 OVMPropertyModel(MeshT* mesh,
int objectID, QObject *parent = 0);
109 virtual ~OVMPropertyModel(){}
111 virtual void updateWidget(
const QModelIndexList& selectedIndices);
117 virtual void pickProperty();
120 virtual void pickModeChanged(
const std::string& _mode);
123 virtual void mouseEvent(QMouseEvent* _event);
125 virtual bool parseHeader(QString header,
PropertyVisualizer*& propVis,
unsigned int& n);
133 static bool isUnsignedIntType(
const PropertyInfo& propInfo);
142 #define DECLARE_PROPTYPES(primitive) \
143 static const TypeInfoWrapper proptype_##primitive##_bool; \
144 static const TypeInfoWrapper proptype_##primitive##_int; \
145 static const TypeInfoWrapper proptype_##primitive##_uint; \
146 static const TypeInfoWrapper proptype_##primitive##_double; \
147 static const TypeInfoWrapper proptype_##primitive##_Vec3d; \
148 static const TypeInfoWrapper proptype_##primitive##_Vec3f;
150 DECLARE_PROPTYPES(Cell)
151 DECLARE_PROPTYPES(Face)
152 DECLARE_PROPTYPES(HalfFace)
153 DECLARE_PROPTYPES(Edge)
154 DECLARE_PROPTYPES(HalfEdge)
155 DECLARE_PROPTYPES(Vertex)
156 #undef DECLARE_PROPTYPES
160 virtual QString getLoadFilenameFilter();
161 virtual QString getSaveFilenameFilter(
unsigned int propId);
166 virtual void combine();
172 virtual void saveProperty();
175 void gatherProperties( MeshT* mesh,
176 typename MeshT::Properties::const_iterator props_first,
177 typename MeshT::Properties::const_iterator props_last,
178 PropertyInfo::ENTITY_FILTER filter);
180 void gatherProperties();
186 bool isSupported(QString friendlyName)
const;
192 bool isPropertyFree(QString propName, PropertyInfo::ENTITY_FILTER filter,
TypeInfoWrapper typeInfo);
198 TypeInfoWrapper getSupportedTypeInfoWrapper(QString friendlyName, PropertyInfo::ENTITY_FILTER filter)
const;
200 bool isEntityType(
const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type)
const;
206 void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
208 void initializeSupportedPropertyTypes();
214 QPushButton bCombine;
223 std::string lastPickMode;
224 Viewer::ActionMode lastActionMode;
226 typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
227 TypeInfoWrapperSet supportedPropertyTypes;
231 #define INITIALIZE_PROPTYPES(primitive) \
232 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_bool \
233 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool"); \
234 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_int \
235 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<int>), "int"); \
236 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_uint \
237 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<unsigned int>), "unsigned int"); \
238 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_double \
239 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<double>), "double"); \
240 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3d \
241 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d"); \
242 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3f \
243 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f");
245 INITIALIZE_PROPTYPES(Cell)
246 INITIALIZE_PROPTYPES(Face)
247 INITIALIZE_PROPTYPES(HalfFace)
248 INITIALIZE_PROPTYPES(Edge)
249 INITIALIZE_PROPTYPES(HalfEdge)
250 INITIALIZE_PROPTYPES(Vertex)
252 #undef INITIALIZE_PROPTYPES
255 #if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_MODEL_CC)
256 #include "OVMPropertyModelT.cc"
This class manages the visualizers for a single object.
This class vizualizes a property.
void loadProperty()
Loads property.
Wraps the information of a type.
void saveProperty(unsigned int propId)
Saves property.
Cellection of information about a property.