Commit d51a34d8 authored by Isaak Lim's avatar Isaak Lim

added support for mutltiple objects (OpenMesh) Thanks to Alexander Dielen

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@21166 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 8aa8d9ef
This diff is collapsed.
#ifndef MULTI_OBJECT_PROPERTY_MODEL_H
#define MULTI_OBJECT_PROPERTY_MODEL_H
#include "PropertyModel.hh"
class PropertyVisualizer;
class MultiObjectPropertyModel: public PropertyModel
{
Q_OBJECT
public:
MultiObjectPropertyModel(const QStringList& res, QObject *parent = 0);
virtual ~MultiObjectPropertyModel();
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
/// Revisualizes visualized properties.
virtual void objectUpdated();
/// Visualizes the selected properties.
virtual void visualize(QModelIndexList selectedIndices, QWidgetList widgets = QWidgetList());
/// Removes the selected properties.
virtual void removeProperty(QModelIndexList selectedIndices);
/// Duplicates the selected properties.
virtual void duplicateProperty(QModelIndexList selectedIndices);
/// Searches for properties and creates PropertyVisualizers.
virtual void gatherProperties();
/// Clears the selected property visualization.
virtual void clear(QModelIndexList selectedIndices);
/// Hides the widget.
virtual void hideWidget();
/// Returns the widget.
virtual QWidget* getWidget();
/// Updates the widget
virtual void updateWidget(const QModelIndexList& selectedIndices);
/// Connects the PropertyVisualizer log signals with the log slot.
virtual void connectLogs(PropertyVisualizer* propViz);
/// Returns the property info for the property with the given index.
virtual PropertyInfo getPropertyInfo(const QModelIndex index) const;
private:
QWidget* createWidgetForType(const TypeInfoWrapper& info) const;
void setRange(const PropertyInfo& info, QWidget* widget) const;
private:
const QStringList restriction;
std::vector<QString> propNames;
std::vector<PropertyInfo> propInfos;
std::vector<QWidget*> propWidgets;
QWidget* widget;
};
#endif /* MULTI_OBJECT_PROPERTY_MODEL_H */
......@@ -89,6 +89,10 @@ void ObjectListItemModel::removeObject(int _id)
void ObjectListItemModel::refresh(const DataType &datatype) {
std::vector<ObjectInfo> objects;
objects.push_back(ObjectInfo("ALL_OBJECTS", -13));
objects.push_back(ObjectInfo("TARGET_OBJECTS", -14));
objects.push_back(ObjectInfo("SOURCE_OBJECTS", -15));
for (PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, datatype);
o_it != PluginFunctions::objectsEnd(); ++o_it) {
objects.push_back(ObjectInfo(o_it->name(), o_it->id()));
......
......@@ -50,7 +50,7 @@
#ifndef OM_PROPERTY_MODEL_H
#define OM_PROPERTY_MODEL_H
#include "../PropertyModel.hh"
#include "SingleObjectPropertyModel.hh"
#include "OMPropertyVisualizer.hh"
#include "Widgets/LoadSaveWidget.hh"
......@@ -69,12 +69,12 @@ class PropertyVisPlugin;
* slots or Q_OBJECT"
* http://doc.trolltech.com/qq/qq15-academic.html
*/
class OMPropertyModelSubclass: public PropertyModel
class OMPropertyModelSubclass: public SingleObjectPropertyModel
{
Q_OBJECT
public:
OMPropertyModelSubclass(QObject *parent = 0)
: PropertyModel(parent)
: SingleObjectPropertyModel(parent)
{
}
......@@ -161,9 +161,22 @@ private:
/// Adds a new property to the mesh.
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
void initializeSupportedPropertyTypes();
public:
static const TypeInfoWrapper proptype_bool;
static const TypeInfoWrapper proptype_int;
static const TypeInfoWrapper proptype_uint;
static const TypeInfoWrapper proptype_double;
static const TypeInfoWrapper proptype_Vec3d;
static const TypeInfoWrapper proptype_Vec3f;
static const TypeInfoWrapper proptype_Vec2d;
static const TypeInfoWrapper proptype_Vec2f;
#ifdef ENABLE_SKELETON_SUPPORT
static const TypeInfoWrapper proptype_SkinWeights;
#endif
private:
MeshT* mesh_;
......@@ -180,24 +193,35 @@ private:
std::string lastPickMode;
Viewer::ActionMode lastActionMode;
TypeInfoWrapper proptype_bool;
TypeInfoWrapper proptype_int;
TypeInfoWrapper proptype_uint;
TypeInfoWrapper proptype_double;
TypeInfoWrapper proptype_Vec3d;
TypeInfoWrapper proptype_Vec3f;
TypeInfoWrapper proptype_Vec2d;
TypeInfoWrapper proptype_Vec2f;
#ifdef ENABLE_SKELETON_SUPPORT
TypeInfoWrapper proptype_SkinWeights;
#endif
typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
TypeInfoWrapperSet supportedPropertyTypes;
};
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_bool
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<bool>), "bool");
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_int
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<int>), "int");
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_uint
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<unsigned int>), "unsigned int");
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_double
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<double>), "double");
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_Vec3d
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3d>), "Vec3d");
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_Vec3f
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3f>), "Vec3f");
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_Vec2d
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2d>), "Vec2d");
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_Vec2f
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2f>), "Vec2f");
#ifdef ENABLE_SKELETON_SUPPORT
template <typename T> const TypeInfoWrapper OMPropertyModel<T>::proptype_SkinWeights
= TypeInfoWrapper(typeid(OpenMesh::PropertyT<BaseSkin::SkinWeights>), "SkinWeights");
#endif
#if defined(INCLUDE_TEMPLATES) && !defined(OM_PROPERTY_MODEL_CC)
#include "OMPropertyModelT.cc"
#endif
......
......@@ -75,18 +75,7 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
objectID_(objectID),
mCombineProperty1(0),
mCombineProperty2(0),
pickModeActive(false),
proptype_bool(TypeInfoWrapper(typeid(OpenMesh::PropertyT<bool>), "bool")),
proptype_int(TypeInfoWrapper(typeid(OpenMesh::PropertyT<int>), "int")),
proptype_uint(TypeInfoWrapper(typeid(OpenMesh::PropertyT<unsigned int>), "unsigned int")),
proptype_double(TypeInfoWrapper(typeid(OpenMesh::PropertyT<double>), "double")),
proptype_Vec3d(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3d>), "Vec3d")),
proptype_Vec3f(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec3f>), "Vec3f")),
proptype_Vec2d(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2d>), "Vec2d")),
proptype_Vec2f(TypeInfoWrapper(typeid(OpenMesh::PropertyT<ACG::Vec2f>), "Vec2f"))
#ifdef ENABLE_SKELETON_SUPPORT
,proptype_SkinWeights(TypeInfoWrapper(typeid(OpenMesh::PropertyT<BaseSkin::SkinWeights>), "SkinWeights"))
#endif
pickModeActive(false)
{
gatherProperties();
bCombine.setText(tr("Combine"));
......@@ -112,7 +101,7 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
lastPickMode = PluginFunctions::pickMode();
lastActionMode = PluginFunctions::actionMode();
initializeSupportedPropertyTypes();
}
......@@ -120,7 +109,7 @@ OMPropertyModel<MeshT>::OMPropertyModel(MeshT* mesh, int objectID, QObject *pare
template<typename MeshT>
void OMPropertyModel<MeshT>::updateWidget(const QModelIndexList& selectedIndices)
{
PropertyModel::updateWidget(selectedIndices);
SingleObjectPropertyModel::updateWidget(selectedIndices);
if (selectedIndices.size() == 2)
{
......@@ -227,7 +216,7 @@ void OMPropertyModel<MeshT>::saveProperty()
{
for (QModelIndexList::const_iterator it = currentlySelectedIndices.begin(), it_end = currentlySelectedIndices.end();
it != it_end; ++it) {
PropertyModel::saveProperty(it->row());
SingleObjectPropertyModel::saveProperty(it->row());
}
}
......@@ -333,7 +322,7 @@ void OMPropertyModel<MeshT>::setPropertyFromFile(QTextStream*& file_stream_, uns
else
#endif
{
PropertyModel::setPropertyFromFile(file_stream_, n, propVis);
SingleObjectPropertyModel::setPropertyFromFile(file_stream_, n, propVis);
}
}
......@@ -750,8 +739,8 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
template<typename MeshT>
void OMPropertyModel<MeshT>::initializeSupportedPropertyTypes()
{
supportedPropertyTypes.insert(proptype_bool);
supportedPropertyTypes.insert(proptype_int);
supportedPropertyTypes.insert(proptype_uint);
......@@ -760,11 +749,11 @@ void OMPropertyModel<MeshT>::initializeSupportedPropertyTypes()
supportedPropertyTypes.insert(proptype_Vec3f);
supportedPropertyTypes.insert(proptype_Vec2d);
supportedPropertyTypes.insert(proptype_Vec2f);
#ifdef ENABLE_SKELETON_SUPPORT
supportedPropertyTypes.insert(proptype_SkinWeights);
#endif
//#ifdef ENABLE_SKELETON_SUPPORT
// //template <typename MeshT>
// //const typename OMPropertyModel<MeshT>::TypeInfoWrapperSet OMPropertyModel<MeshT>::supportedPropertyTypes =
......@@ -775,7 +764,5 @@ void OMPropertyModel<MeshT>::initializeSupportedPropertyTypes()
// // (OpenFlipper::Options::nogui() ? typename OMPropertyModel<MeshT>::TypeInfoWrapperSet() : typename OMPropertyModel<MeshT>::TypeInfoWrapperSet(propertyTypes, propertyTypes + 6));
// supportedPropertyTypes = typename OMPropertyModel<MeshT>::TypeInfoWrapperSet();
//#endif
}
}
......@@ -70,7 +70,7 @@ public:
/// Visualizes the property.
virtual void visualize(bool _setDrawMode = true);
virtual void visualize(bool _setDrawMode, QWidget* _widget);
/**
* @brief Removes the property.
......
......@@ -306,8 +306,15 @@ unsigned int OMPropertyVisualizer<MeshT>::getClosestVertexId(unsigned int _face,
* type of the property.
*/
template <typename MeshT>
void OMPropertyVisualizer<MeshT>::visualize(bool _setDrawMode)
void OMPropertyVisualizer<MeshT>::visualize(bool _setDrawMode, QWidget* _widget)
{
QWidget* tmp;
if (_widget)
{
tmp = widget;
widget = _widget;
}
if (propertyInfo.isFaceProp())
visualizeFaceProp(_setDrawMode);
else if (propertyInfo.isEdgeProp())
......@@ -316,6 +323,11 @@ void OMPropertyVisualizer<MeshT>::visualize(bool _setDrawMode)
visualizeHalfedgeProp(_setDrawMode);
else if (propertyInfo.isVertexProp())
visualizeVertexProp(_setDrawMode);
if (_widget)
{
widget = tmp;
}
}
/**
......
......@@ -52,7 +52,7 @@
#ifndef OVM_PROPERTY_MODEL_H
#define OVM_PROPERTY_MODEL_H
#include "../PropertyModel.hh"
#include "SingleObjectPropertyModel.hh"
#include "OVMPropertyVisualizer.hh"
#include "OVMPropertyVisualizerBoolean.hh"
#include "OVMPropertyVisualizerDouble.hh"
......@@ -79,12 +79,12 @@ class PropertyVisPlugin;
* slots or Q_OBJECT"
* http://doc.trolltech.com/qq/qq15-academic.html
*/
class OVMPropertyModelSubclass: public PropertyModel
class OVMPropertyModelSubclass: public SingleObjectPropertyModel
{
Q_OBJECT
public:
OVMPropertyModelSubclass(QObject *parent = 0)
: PropertyModel(parent)
: SingleObjectPropertyModel(parent)
{
}
......@@ -123,6 +123,37 @@ public:
virtual void mouseEvent(QMouseEvent* _event);
virtual bool parseHeader(QString header, PropertyVisualizer*& propVis, unsigned int& n);
static bool isBoolType(const PropertyInfo& propInfo);
static bool isBoolType(const TypeInfoWrapper& typeInfo);
static bool isIntType(const PropertyInfo& propInfo);
static bool isIntType(const TypeInfoWrapper& typeInfo);
static bool isDoubleType(const PropertyInfo& propInfo);
static bool isDoubleType(const TypeInfoWrapper& typeInfo);
static bool isUnsignedIntType(const PropertyInfo& propInfo);
static bool isUnsignedIntType(const TypeInfoWrapper& typeInfo);
static bool isVec3dType(const PropertyInfo& propInfo);
static bool isVec3dType(const TypeInfoWrapper& typeInfo);
static bool isVec3fType(const PropertyInfo& propInfo);
static bool isVec3fType(const TypeInfoWrapper& typeInfo);
static bool isVectorType(const PropertyInfo& propInfo);
static bool isVectorType(const TypeInfoWrapper& typeInfo);
#define DECLARE_PROPTYPES(primitive) \
static const TypeInfoWrapper proptype_##primitive##_bool; \
static const TypeInfoWrapper proptype_##primitive##_int; \
static const TypeInfoWrapper proptype_##primitive##_uint; \
static const TypeInfoWrapper proptype_##primitive##_double; \
static const TypeInfoWrapper proptype_##primitive##_Vec3d; \
static const TypeInfoWrapper proptype_##primitive##_Vec3f;
DECLARE_PROPTYPES(Cell)
DECLARE_PROPTYPES(Face)
DECLARE_PROPTYPES(HalfFace)
DECLARE_PROPTYPES(Edge)
DECLARE_PROPTYPES(HalfEdge)
DECLARE_PROPTYPES(Vertex)
#undef DECLARE_PROPTYPES
protected:
......@@ -166,15 +197,6 @@ private:
/// Returns the TypeInfoWrapper for the type of property if it is supported.
TypeInfoWrapper getSupportedTypeInfoWrapper(QString friendlyName, PropertyInfo::ENTITY_FILTER filter) const;
bool isBoolType(const PropertyInfo& propInfo) const;
bool isIntType(const PropertyInfo& propInfo) const;
bool isDoubleType(const PropertyInfo& propInfo) const;
bool isUnsignedIntType(const PropertyInfo& propInfo) const;
bool isVec3dType(const PropertyInfo& propInfo) const;
bool isVec3fType(const PropertyInfo& propInfo) const;
bool isVectorType(const PropertyInfo& propInfo) const;
bool isVectorType(const TypeInfoWrapper& typeInfo) const;
bool isEntityType(const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type) const;
/// Adds a new PropertyVisualizer.
......@@ -184,7 +206,7 @@ private:
void addProperty(QString propName, QString friendlyTypeName, PropertyInfo::ENTITY_FILTER filter);
void initializeSupportedPropertyTypes();
MeshT* mesh_;
int objectID_;
......@@ -201,29 +223,34 @@ private:
std::string lastPickMode;
Viewer::ActionMode lastActionMode;
#define DECLARE_PROPTYPES(primitive) \
TypeInfoWrapper proptype_##primitive##_bool; \
TypeInfoWrapper proptype_##primitive##_int; \
TypeInfoWrapper proptype_##primitive##_uint; \
TypeInfoWrapper proptype_##primitive##_double; \
TypeInfoWrapper proptype_##primitive##_Vec3d; \
TypeInfoWrapper proptype_##primitive##_Vec3f;
DECLARE_PROPTYPES(Cell)
DECLARE_PROPTYPES(Face)
DECLARE_PROPTYPES(HalfFace)
DECLARE_PROPTYPES(Edge)
DECLARE_PROPTYPES(HalfEdge)
DECLARE_PROPTYPES(Vertex)
#undef DECLARE_PROPTYPES
typedef std::set<TypeInfoWrapper> TypeInfoWrapperSet;
TypeInfoWrapperSet supportedPropertyTypes;
};
#define INITIALIZE_PROPTYPES(primitive) \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_bool \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_int \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<int>), "int"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_uint \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<unsigned int>), "unsigned int"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_double \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<double>), "double"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3d \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3f \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f");
INITIALIZE_PROPTYPES(Cell)
INITIALIZE_PROPTYPES(Face)
INITIALIZE_PROPTYPES(HalfFace)
INITIALIZE_PROPTYPES(Edge)
INITIALIZE_PROPTYPES(HalfEdge)
INITIALIZE_PROPTYPES(Vertex)
#undef INITIALIZE_PROPTYPES
#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_MODEL_CC)
#include "OVMPropertyModelT.cc"
......
......@@ -53,14 +53,6 @@
#include "OVMPropertyModel.hh"
#define INITIALIZE_PROPTYPES(primitive) \
proptype_##primitive##_bool(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<bool>), "bool")), \
proptype_##primitive##_int(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<int>), "int")), \
proptype_##primitive##_uint(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<unsigned int>), "unsigned int")), \
proptype_##primitive##_double(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<double>), "double")), \
proptype_##primitive##_Vec3d(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3d>), "Vec3d")), \
proptype_##primitive##_Vec3f(TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f"))
template <typename MeshT>
OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *parent)
......@@ -68,13 +60,7 @@ OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *pa
mesh_(mesh),
objectID_(objectID),
mCombineProperty1(0),
mCombineProperty2(0),
INITIALIZE_PROPTYPES(Cell),
INITIALIZE_PROPTYPES(Face),
INITIALIZE_PROPTYPES(HalfFace),
INITIALIZE_PROPTYPES(Edge),
INITIALIZE_PROPTYPES(HalfEdge),
INITIALIZE_PROPTYPES(Vertex)
mCombineProperty2(0)
{
gatherProperties();
bCombine.setText(tr("Combine"));
......@@ -109,7 +95,7 @@ OVMPropertyModel<MeshT>::OVMPropertyModel(MeshT* mesh, int objectID, QObject *pa
template <typename MeshT>
void OVMPropertyModel<MeshT>::updateWidget(const QModelIndexList& selectedIndices)
{
PropertyModel::updateWidget(selectedIndices);
SingleObjectPropertyModel::updateWidget(selectedIndices);
if (selectedIndices.size() == 2)
{
......@@ -397,21 +383,10 @@ void OVMPropertyModel<MeshT>::saveProperty()
{
for (QModelIndexList::const_iterator it = currentlySelectedIndices.begin(), it_end = currentlySelectedIndices.end();
it != it_end; ++it) {
PropertyModel::saveProperty(it->row());
SingleObjectPropertyModel::saveProperty(it->row());
}
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVectorType(const TypeInfoWrapper& typeInfo) const
{
return (typeInfo == proptype_Cell_Vec3f) || (typeInfo == proptype_Cell_Vec3d)
|| (typeInfo == proptype_Face_Vec3f) || (typeInfo == proptype_Face_Vec3d)
|| (typeInfo == proptype_HalfFace_Vec3f) || (typeInfo == proptype_HalfFace_Vec3d)
|| (typeInfo == proptype_Edge_Vec3f) || (typeInfo == proptype_Edge_Vec3d)
|| (typeInfo == proptype_HalfEdge_Vec3f) || (typeInfo == proptype_HalfEdge_Vec3d)
|| (typeInfo == proptype_Vertex_Vec3f) || (typeInfo == proptype_Vertex_Vec3d);
}
/**
* @brief Checks if two properties are combinable.
*
......@@ -569,77 +544,119 @@ TypeInfoWrapper OVMPropertyModel<MeshT>::getSupportedTypeInfoWrapper(QString fri
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isBoolType(const PropertyInfo& propInfo) const
bool OVMPropertyModel<MeshT>::isBoolType(const PropertyInfo& propInfo)
{
return isBoolType(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isBoolType(const TypeInfoWrapper& typeInfo)
{
return typeInfo == proptype_Cell_bool ||
typeInfo == proptype_Face_bool ||
typeInfo == proptype_HalfFace_bool ||
typeInfo == proptype_Edge_bool ||
typeInfo == proptype_HalfEdge_bool ||
typeInfo == proptype_Vertex_bool;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isIntType(const PropertyInfo& propInfo)
{
return isIntType(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isIntType(const TypeInfoWrapper& typeInfo)
{
return propInfo.typeinfo() == proptype_Cell_bool ||
propInfo.typeinfo() == proptype_Face_bool ||
propInfo.typeinfo() == proptype_HalfFace_bool ||
propInfo.typeinfo() == proptype_Edge_bool ||
propInfo.typeinfo() == proptype_HalfEdge_bool ||
propInfo.typeinfo() == proptype_Vertex_bool;
return typeInfo == proptype_Cell_int ||
typeInfo == proptype_Face_int ||
typeInfo == proptype_HalfFace_int ||
typeInfo == proptype_Edge_int ||
typeInfo == proptype_HalfEdge_int ||
typeInfo == proptype_Vertex_int;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isIntType(const PropertyInfo& propInfo) const
bool OVMPropertyModel<MeshT>::isDoubleType(const PropertyInfo& propInfo)
{
return propInfo.typeinfo() == proptype_Cell_int ||
propInfo.typeinfo() == proptype_Face_int ||
propInfo.typeinfo() == proptype_HalfFace_int ||
propInfo.typeinfo() == proptype_Edge_int ||
propInfo.typeinfo() == proptype_HalfEdge_int ||
propInfo.typeinfo() == proptype_Vertex_int;
return isDoubleType(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isDoubleType(const PropertyInfo& propInfo) const
bool OVMPropertyModel<MeshT>::isDoubleType(const TypeInfoWrapper& typeInfo)
{
return propInfo.typeinfo() == proptype_Cell_double ||
propInfo.typeinfo() == proptype_Face_double ||
propInfo.typeinfo() == proptype_HalfFace_double ||
propInfo.typeinfo() == proptype_Edge_double ||
propInfo.typeinfo() == proptype_HalfEdge_double ||
propInfo.typeinfo() == proptype_Vertex_double;
return typeInfo == proptype_Cell_double ||
typeInfo == proptype_Face_double ||
typeInfo == proptype_HalfFace_double ||
typeInfo == proptype_Edge_double ||
typeInfo == proptype_HalfEdge_double ||
typeInfo == proptype_Vertex_double;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isUnsignedIntType(const PropertyInfo& propInfo) const
bool OVMPropertyModel<MeshT>::isUnsignedIntType(const PropertyInfo& propInfo)
{
return propInfo.typeinfo() == proptype_Cell_uint ||
propInfo.typeinfo() == proptype_Face_uint ||
propInfo.typeinfo() == proptype_HalfFace_uint ||
propInfo.typeinfo() == proptype_Edge_uint ||
propInfo.typeinfo() == proptype_HalfEdge_uint ||
propInfo.typeinfo() == proptype_Vertex_uint;
return isUnsignedIntType(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVec3dType(const PropertyInfo& propInfo) const
bool OVMPropertyModel<MeshT>::isUnsignedIntType(const TypeInfoWrapper& typeInfo)
{
return propInfo.typeinfo() == proptype_Cell_Vec3d ||
propInfo.typeinfo() == proptype_Face_Vec3d ||
propInfo.typeinfo() == proptype_HalfFace_Vec3d ||
propInfo.typeinfo() == proptype_Edge_Vec3d ||
propInfo.typeinfo() == proptype_HalfEdge_Vec3d ||
propInfo.typeinfo() == proptype_Vertex_Vec3d;
return typeInfo == proptype_Cell_uint ||
typeInfo == proptype_Face_uint ||
typeInfo == proptype_HalfFace_uint ||
typeInfo == proptype_Edge_uint ||
typeInfo == proptype_HalfEdge_uint ||
typeInfo == proptype_Vertex_uint;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVec3fType(const PropertyInfo& propInfo) const
bool OVMPropertyModel<MeshT>::isVec3dType(const PropertyInfo& propInfo)
{
return propInfo.typeinfo() == proptype_Cell_Vec3f ||
propInfo.typeinfo() == proptype_Face_Vec3f ||
propInfo.typeinfo() == proptype_HalfFace_Vec3f ||
propInfo.typeinfo() == proptype_Edge_Vec3f ||
propInfo.typeinfo() == proptype_HalfEdge_Vec3f ||
propInfo.typeinfo() == proptype_Vertex_Vec3f;
return isVec3dType(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVectorType(const PropertyInfo& propInfo) const
bool OVMPropertyModel<MeshT>::isVec3dType(const TypeInfoWrapper& typeInfo)
{
return typeInfo == proptype_Cell_Vec3d ||
typeInfo == proptype_Face_Vec3d ||
typeInfo == proptype_HalfFace_Vec3d ||
typeInfo == proptype_Edge_Vec3d ||
typeInfo == proptype_HalfEdge_Vec3d ||
typeInfo == proptype_Vertex_Vec3d;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVec3fType(const PropertyInfo& propInfo)
{
return isVec3fType(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVec3fType(const TypeInfoWrapper& typeInfo)
{
return typeInfo == proptype_Cell_Vec3f ||
typeInfo == proptype_Face_Vec3f ||
typeInfo == proptype_HalfFace_Vec3f ||
typeInfo == proptype_Edge_Vec3f ||
typeInfo == proptype_HalfEdge_Vec3f ||
typeInfo == proptype_Vertex_Vec3f;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVectorType(const PropertyInfo& propInfo)
{
return isVec3fType(propInfo) || isVec3dType(propInfo);
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVectorType(const TypeInfoWrapper& typeInfo)
{
return isVec3fType(typeInfo) || isVec3dType(typeInfo);
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type) const
{
......
......@@ -76,7 +76,7 @@ public:
virtual ~OVMPropertyVisualizer(){ clear(); }
/// Visualizes a property.
virtual void visualize(bool _setDrawMode = true);
virtual void visualize(bool _setDrawMode, QWidget* _widget);
/**
* @brief Should remove the property.
......
......@@ -203,8 +203,15 @@ unsigned int OVMPropertyVisualizer<MeshT>::getClosestHalfedgeId(unsigned int _fa
template <typename MeshT>
void OVMPropertyVisualizer<MeshT>::visualize(bool _setDrawMode)
void OVMPropertyVisualizer<MeshT>::visualize(bool _setDrawMode, QWidget* _widget)
{
QWidget* tmp;
if (_widget)
{
tmp = widget;
widget = _widget;
}
if (propertyInfo.isCellProp())
visualizeCellProp(_setDrawMode);
else if (propertyInfo.isFaceProp())
......@@ -217,6 +224,11 @@ void OVMPropertyVisualizer<MeshT>::visualize(bool _setDrawMode)
visualizeHalfedgeProp(_setDrawMode);
else if (propertyInfo.isVertexProp())
visualizeVertexProp(_setDrawMode);
if (_widget)
{
widget = tmp;
}
}
template <typename MeshT>
......
This diff is collapsed.
......@@ -51,6 +51,7 @@
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include "MultiObjectPropertyModel.hh"
#include "OpenMesh/OMPropertyModel.hh"
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
......@@ -85,6 +86,36 @@
*/
PropertyModel* __PropertyModelFactory::getModel(int objectID)
{