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 "../Utils.hh" 56 #include <OpenVolumeMesh/Core/BaseProperty.hh> 58 #include "Widgets/LoadSaveWidget.hh" 59 #include "Widgets/PickWidget.hh" 63 #include "../Utils.hh" 65 #define PROP_VIS "PropertyVisualization" 67 #include "OVMPropertyModelSubclass.hh" 71 template<
typename MeshT>
78 virtual void updateWidget(
const QModelIndexList& selectedIndices);
100 static bool isUnsignedIntType(
const PropertyInfo& propInfo);
104 static bool isVec3dOVMType(
const PropertyInfo& propInfo);
110 static bool isVectorOVMType(
const PropertyInfo& propInfo);
112 static bool isMatrix3x3Type(
const PropertyInfo& propInfo);
115 #define DECLARE_PROPTYPES(primitive) \ 116 static const TypeInfoWrapper proptype_##primitive##_bool; \ 117 static const TypeInfoWrapper proptype_##primitive##_int; \ 118 static const TypeInfoWrapper proptype_##primitive##_uint; \ 119 static const TypeInfoWrapper proptype_##primitive##_double; \ 120 static const TypeInfoWrapper proptype_##primitive##_Vec3d; \ 121 static const TypeInfoWrapper proptype_##primitive##_Vec3dOVM; \ 122 static const TypeInfoWrapper proptype_##primitive##_Vec3f; \ 123 static const TypeInfoWrapper proptype_##primitive##_Matrix3x3d; 125 DECLARE_PROPTYPES(Cell)
126 DECLARE_PROPTYPES(Face)
127 DECLARE_PROPTYPES(HalfFace)
128 DECLARE_PROPTYPES(Edge)
129 DECLARE_PROPTYPES(HalfEdge)
130 DECLARE_PROPTYPES(Vertex)
131 #undef DECLARE_PROPTYPES 151 typename MeshT::Properties::const_iterator props_first,
152 typename MeshT::Properties::const_iterator props_last,
153 PropertyInfo::ENTITY_FILTER filter);
175 bool isEntityType(
const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type)
const;
181 void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
183 void initializeSupportedPropertyTypes();
189 QPushButton bCombine;
198 std::string lastPickMode;
201 typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
202 TypeInfoWrapperSet supportedPropertyTypes;
206 #define INITIALIZE_PROPTYPES(primitive) \ 207 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_bool \ 208 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool"); \ 209 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_int \ 210 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<int>), "int"); \ 211 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_uint \ 212 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<unsigned int>), "unsigned int"); \ 213 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_double \ 214 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<double>), "double"); \ 215 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3d \ 216 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d"); \ 217 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3dOVM \ 218 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<OpenVolumeMesh::Vec3d>), "Vec3dOVM"); \ 219 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3f \ 220 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f"); \ 221 template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Matrix3x3d \ 222 = TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Matrix3x3d>), "Matrix3x3d"); 224 INITIALIZE_PROPTYPES(Cell)
225 INITIALIZE_PROPTYPES(Face)
226 INITIALIZE_PROPTYPES(HalfFace)
227 INITIALIZE_PROPTYPES(Edge)
228 INITIALIZE_PROPTYPES(HalfEdge)
229 INITIALIZE_PROPTYPES(Vertex)
231 #undef INITIALIZE_PROPTYPES 234 #if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_MODEL_CC) 235 #include "OVMPropertyModelT_impl.hh"
virtual void pickProperty()
Toggle picking on and off.
Wraps the information of a type.
ActionMode
Enum listing action modes of the viewers.
virtual void mouseEvent(QMouseEvent *_event)
Handles mouse events for picking.
virtual void updateWidget(const QModelIndexList &selectedIndices)
Updates the widget.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter)
Adds a new property to the mesh.
TypeInfoWrapper getSupportedTypeInfoWrapper(OpenVolumeMesh::BaseProperty *const baseProp) const
Returns the TypeInfoWrapper for the property if it is supported.
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.
virtual void pickModeChanged(const std::string &_mode)
Handles changing of pick mode.
virtual void saveProperty()
Saves the currently slected properties.
bool isSupported(OpenVolumeMesh::BaseProperty *const baseProp) const
Checks if visualizing this property is supported.
void addPropertyVisualizer(OpenVolumeMesh::BaseProperty *const baseProp, MeshT *mesh, PropertyInfo::ENTITY_FILTER filter)
Adds a new PropertyVisualizer.
Cellection of information about a property.
virtual QString getLoadFilenameFilter()
Returns the filename filter for loading.
void resetPicking()
Disables picking.
This class vizualizes a property.
void gatherProperties()
Searches for all properties and creates the visualizers.
virtual void combine()
Combines two properties.
virtual bool parseHeader(QString header, PropertyVisualizer *&propVis, unsigned int &n)
Parses the property file header.
virtual QString getSaveFilenameFilter(unsigned int propId)
Returns the filename filter for saving.
bool combinable(PropertyVisualizer *propertyVisualizer1, PropertyVisualizer *propertyVisualizer2) const
Checks if two properties are combinable.
bool isNew(OpenVolumeMesh::BaseProperty *const baseProp, PropertyInfo::ENTITY_FILTER filter) const
Checks if we already created a PropertyVisualizer for this property.