44#ifndef OVM_PROPERTY_MODEL_H
45#define OVM_PROPERTY_MODEL_H
47#include "OVMPropertyVisualizer.hh"
48#include "OVMPropertyVisualizerBoolean.hh"
49#include "OVMPropertyVisualizerDouble.hh"
50#include "OVMPropertyVisualizerInteger.hh"
51#include "OVMPropertyVisualizerMatrix3x3.hh"
52#include "OVMPropertyVisualizerVector.hh"
53#include "OVMPropertyVisualizerVectorFieldDifference.hh"
55#include <OpenVolumeMesh/Core/Properties/PropertyStorageBase.hh>
59#include "Widgets/LoadSaveWidget.hh"
60#include "Widgets/PickWidget.hh"
66#define PROP_VIS "PropertyVisualization"
68#include "OVMPropertyModelSubclass.hh"
72template<
typename MeshT>
79 virtual void updateWidget(
const QModelIndexList& selectedIndices);
101 static bool isUnsignedIntType(
const PropertyInfo& propInfo);
105 static bool isVec3dOVMType(
const PropertyInfo& propInfo);
111 static bool isVectorOVMType(
const PropertyInfo& propInfo);
113 static bool isMatrix3x3Type(
const PropertyInfo& propInfo);
116#define DECLARE_PROPTYPES(primitive) \
117 static const TypeInfoWrapper proptype_##primitive##_bool; \
118 static const TypeInfoWrapper proptype_##primitive##_int; \
119 static const TypeInfoWrapper proptype_##primitive##_uint; \
120 static const TypeInfoWrapper proptype_##primitive##_double; \
121 static const TypeInfoWrapper proptype_##primitive##_Vec3d; \
122 static const TypeInfoWrapper proptype_##primitive##_Vec3dOVM; \
123 static const TypeInfoWrapper proptype_##primitive##_Vec3f; \
124 static const TypeInfoWrapper proptype_##primitive##_Matrix3x3d;
126 DECLARE_PROPTYPES(Cell)
127 DECLARE_PROPTYPES(Face)
128 DECLARE_PROPTYPES(HalfFace)
129 DECLARE_PROPTYPES(Edge)
130 DECLARE_PROPTYPES(HalfEdge)
131 DECLARE_PROPTYPES(Vertex)
132#undef DECLARE_PROPTYPES
151 template<
typename PropIter>
153 PropIter props_first, PropIter props_last,
154 PropertyInfo::ENTITY_FILTER filter);
176 bool isEntityType(
const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type)
const;
182 void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
184 void initializeSupportedPropertyTypes();
190 QPushButton bCombine;
199 std::string lastPickMode;
202 typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
203 TypeInfoWrapperSet supportedPropertyTypes;
207#define INITIALIZE_PROPTYPES(primitive) \
208template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_bool \
209 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool"); \
210template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_int \
211 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<int>), "int"); \
212template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_uint \
213 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<unsigned int>), "unsigned int"); \
214template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_double \
215 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<double>), "double"); \
216template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3d \
217 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d"); \
218template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3dOVM \
219 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<OpenVolumeMesh::Vec3d>), "Vec3dOVM"); \
220template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3f \
221 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f"); \
222template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Matrix3x3d \
223 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Matrix3x3d>), "Matrix3x3d");
225INITIALIZE_PROPTYPES(Cell)
226INITIALIZE_PROPTYPES(Face)
227INITIALIZE_PROPTYPES(HalfFace)
228INITIALIZE_PROPTYPES(Edge)
229INITIALIZE_PROPTYPES(HalfEdge)
230INITIALIZE_PROPTYPES(Vertex)
232#undef INITIALIZE_PROPTYPES
235#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_MODEL_CC)
236#include "OVMPropertyModelT_impl.hh"
ActionMode
Enum listing action modes of the viewers.
virtual void saveProperty()
Saves the currently slected properties.
void gatherProperties()
Searches for all properties and creates the visualizers.
virtual QString getSaveFilenameFilter(unsigned int propId)
Returns the filename filter for saving.
void resetPicking()
Disables picking.
TypeInfoWrapper getSupportedTypeInfoWrapper(OpenVolumeMesh::BasePropertyPtr *const baseProp) const
Returns the TypeInfoWrapper for the property if it is supported.
void addPropertyVisualizer(OpenVolumeMesh::BasePropertyPtr *const baseProp, MeshT *mesh, PropertyInfo::ENTITY_FILTER filter)
Adds a new PropertyVisualizer.
virtual void pickProperty()
Toggle picking on and off.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter)
Adds a new property to the mesh.
bool isPropertyFree(QString propName, PropertyInfo::ENTITY_FILTER filter, TypeInfoWrapper typeInfo)
Checks if a property name is still available for an entity type and a property type.
bool combinable(PropertyVisualizer *propertyVisualizer1, PropertyVisualizer *propertyVisualizer2) const
Checks if two properties are combinable.
virtual void pickModeChanged(const std::string &_mode)
Handles changing of pick mode.
bool isSupported(OpenVolumeMesh::BasePropertyPtr *const baseProp) const
Checks if visualizing this property is supported.
virtual bool parseHeader(QString header, PropertyVisualizer *&propVis, unsigned int &n)
Parses the property file header.
virtual void mouseEvent(QMouseEvent *_event)
Handles mouse events for picking.
virtual void updateWidget(const QModelIndexList &selectedIndices)
Updates the widget.
virtual void combine()
Combines two properties.
virtual QString getLoadFilenameFilter()
Returns the filename filter for loading.
bool isNew(OpenVolumeMesh::BasePropertyPtr *const baseProp, PropertyInfo::ENTITY_FILTER filter) const
Checks if we already created a PropertyVisualizer for this property.
Cellection of information about a property.
This class vizualizes a property.
Wraps the information of a type.