Commit 35d07dcf authored by Max Lyon's avatar Max Lyon

Some fixes for property visualization:

  - plugin is now informed about object deletion
  - fixed some bugs in open volume mesh property visualizers that were unnoticed as long as open volume mesh rendering did not support colors

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16760 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 007918e7
......@@ -69,6 +69,17 @@ QVariant ObjectListItemModel::data(const QModelIndex & index, int role) const {
}
}
void ObjectListItemModel::removeObject(int _id)
{
beginResetModel();
for (int i = (int)objects_.size()-1; i>=0; i--)
{
if (objects_[i].getId() == _id)
objects_.erase(objects_.begin()+i);
}
endResetModel();
}
void ObjectListItemModel::refresh(const DataType &datatype) {
std::vector<ObjectInfo> objects;
for (PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, datatype);
......
......@@ -54,6 +54,8 @@ class ObjectListItemModel: public QAbstractListModel {
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
void removeObject(int _id);
void refresh(const DataType &datatype);
protected:
......
......@@ -178,7 +178,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setFacePropertyFromText(unsigned int in
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::FaceHandle fh = mesh->face_handle(index);
......@@ -193,7 +193,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setEdgePropertyFromText(unsigned int in
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
......@@ -208,7 +208,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setHalfedgePropertyFromText(unsigned in
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
......@@ -223,7 +223,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setVertexPropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
......@@ -63,7 +63,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
OpenMesh::FPropHandleT< double > prop;
......@@ -150,7 +150,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
......@@ -242,7 +242,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
......@@ -331,7 +331,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
//TODO check if this also works if the property is Vec3d
......@@ -418,7 +418,7 @@ void OMPropertyVisualizerDouble<MeshT>::setFacePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::FaceHandle fh = mesh->face_handle(index);
......@@ -433,7 +433,7 @@ void OMPropertyVisualizerDouble<MeshT>::setEdgePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
......@@ -448,7 +448,7 @@ void OMPropertyVisualizerDouble<MeshT>::setHalfedgePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
......@@ -463,7 +463,7 @@ void OMPropertyVisualizerDouble<MeshT>::setVertexPropertyFromText(unsigned int i
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
......@@ -75,7 +75,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor;
......@@ -164,7 +164,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor;
......@@ -254,7 +254,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor;
......@@ -343,7 +343,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor;
......@@ -433,7 +433,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setFacePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::FaceHandle fh = mesh->face_handle(index);
......@@ -449,8 +449,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setEdgePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
......@@ -465,7 +464,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setHalfedgePropertyFromText(unsigned
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
......@@ -481,7 +480,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setVertexPropertyFromText(unsigned i
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
......@@ -152,7 +152,7 @@ void OMPropertyVisualizerSkinWeights<MeshT>::setVertexPropertyFromText(unsigned
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
......@@ -356,7 +356,7 @@ void OMPropertyVisualizerVector<MeshT>::setFacePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::FaceHandle fh = mesh->face_handle(index);
......@@ -371,7 +371,7 @@ void OMPropertyVisualizerVector<MeshT>::setEdgePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
......@@ -386,7 +386,7 @@ void OMPropertyVisualizerVector<MeshT>::setHalfedgePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
......@@ -401,7 +401,7 @@ void OMPropertyVisualizerVector<MeshT>::setVertexPropertyFromText(unsigned int i
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) )
std::cerr << "Error: No property with name " << PropertyVisualizer::propertyInfo.propName().c_str() << std::endl;
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
......@@ -157,7 +157,7 @@ private:
TypeInfoWrapper getSupportedTypeInfoWrapper(OpenVolumeMesh::BaseProperty* const baseProp) const;
/// Returns the TypeInfoWrapper for the type of property if it is supported.
TypeInfoWrapper getSupportedTypeInfoWrapper(QString friendlyName) const;
TypeInfoWrapper getSupportedTypeInfoWrapper(QString friendlyName, PropertyInfo::ENTITY_FILTER filter) const;
bool isBoolType(const PropertyInfo& propInfo) const;
bool isIntType(const PropertyInfo& propInfo) const;
......@@ -168,6 +168,8 @@ private:
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.
void addPropertyVisualizer(OpenVolumeMesh::BaseProperty* const baseProp, MeshT* mesh, PropertyInfo::ENTITY_FILTER filter);
......
......@@ -273,7 +273,7 @@ bool OVMPropertyModel<MeshT>::parseHeader(QString header, PropertyVisualizer*& p
}
TypeInfoWrapper typeInfo = getSupportedTypeInfoWrapper(friendlyName);
TypeInfoWrapper typeInfo = getSupportedTypeInfoWrapper(friendlyName, filter);
QString propName = QInputDialog::getText(0, "Property Name", "Please enter name.",QLineEdit::Normal,headerParts[4]);
if (propName == "") return false;
......@@ -535,21 +535,22 @@ TypeInfoWrapper OVMPropertyModel<MeshT>::getSupportedTypeInfoWrapper(OpenVolumeM
}
/**
* @brief Returns the TypeInfoWrapper for the type of property if it is supported.
* @brief Returns the TypeInfoWrapper for the type of property and entity if it is supported.
*
* @param friendlyName The type we want to visualize in text form.
* @param filter The type of the entity
*
* @return A TypeInfoWrapper containing all the type information for the property type.
*/
template<typename MeshT>
TypeInfoWrapper OVMPropertyModel<MeshT>::getSupportedTypeInfoWrapper(QString friendlyName) const
TypeInfoWrapper OVMPropertyModel<MeshT>::getSupportedTypeInfoWrapper(QString friendlyName, PropertyInfo::ENTITY_FILTER filter) const
{
for (TypeInfoWrapperSet::const_iterator it = supportedPropertyTypes.begin();
it != supportedPropertyTypes.end();
++it )
{
if (friendlyName.toStdString().compare(it->getName()) == 0)
if ((friendlyName.toStdString().compare(it->getName()) == 0) && isEntityType(*it, filter))
return *it;
}
throw std::exception();
......@@ -627,6 +628,68 @@ bool OVMPropertyModel<MeshT>::isVectorType(const PropertyInfo& propInfo) const
return isVec3fType(propInfo) || isVec3dType(propInfo);
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type) const
{
bool result = false;
if (entity_type & PropertyInfo::EF_CELL)
{
result |= (typeInfo == proptype_Cell_bool)
|| (typeInfo == proptype_Cell_int)
|| (typeInfo == proptype_Cell_double)
|| (typeInfo == proptype_Cell_uint)
|| (typeInfo == proptype_Cell_Vec3d)
|| (typeInfo == proptype_Cell_Vec3d);
}
if (entity_type & PropertyInfo::EF_FACE)
{
result |= (typeInfo == proptype_Face_bool)
|| (typeInfo == proptype_Face_int)
|| (typeInfo == proptype_Face_double)
|| (typeInfo == proptype_Face_uint)
|| (typeInfo == proptype_Face_Vec3d)
|| (typeInfo == proptype_Face_Vec3d);
}
if (entity_type & PropertyInfo::EF_HALFFACE)
{
result |= (typeInfo == proptype_HalfFace_bool)
|| (typeInfo == proptype_HalfFace_int)
|| (typeInfo == proptype_HalfFace_double)
|| (typeInfo == proptype_HalfFace_uint)
|| (typeInfo == proptype_HalfFace_Vec3d)
|| (typeInfo == proptype_HalfFace_Vec3d);
}
if (entity_type & PropertyInfo::EF_EDGE)
{
result |= (typeInfo == proptype_Edge_bool)
|| (typeInfo == proptype_Edge_int)
|| (typeInfo == proptype_Edge_double)
|| (typeInfo == proptype_Edge_uint)
|| (typeInfo == proptype_Edge_Vec3d)
|| (typeInfo == proptype_Edge_Vec3d);
}
if (entity_type & PropertyInfo::EF_HALFEDGE)
{
result |= (typeInfo == proptype_HalfEdge_bool)
|| (typeInfo == proptype_HalfEdge_int)
|| (typeInfo == proptype_HalfEdge_double)
|| (typeInfo == proptype_HalfEdge_uint)
|| (typeInfo == proptype_HalfEdge_Vec3d)
|| (typeInfo == proptype_HalfEdge_Vec3d);
}
if (entity_type & PropertyInfo::EF_VERTEX)
{
result |= (typeInfo == proptype_Vertex_bool)
|| (typeInfo == proptype_Vertex_int)
|| (typeInfo == proptype_Vertex_double)
|| (typeInfo == proptype_Vertex_uint)
|| (typeInfo == proptype_Vertex_Vec3d)
|| (typeInfo == proptype_Vertex_Vec3d);
}
return result;
}
/**
* @brief Adds a new PropertyVisualizer.
*
......
......@@ -51,6 +51,8 @@
#include <OpenFlipper/BasePlugin/PluginFunctionsViewControls.hh>
#include <ObjectTypes/VolumeMeshObject/VolumeMeshDrawModesContainer.hh>
#include <iostream>
template <typename MeshT>
......@@ -60,10 +62,11 @@ public:
OVMPropertyVisualizer(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
: PropertyVisualizer(_propertyInfo),
mesh(_mesh),
mObjectID(objectID)
mObjectID(objectID),
drawModes()
{}
virtual ~OVMPropertyVisualizer(){}
virtual ~OVMPropertyVisualizer(){ clear(); }
/// Visualizes a property.
virtual void visualize();
......@@ -82,7 +85,7 @@ public:
/// Clears a property.
virtual void clear();
virtual QString getPropertyText(unsigned int index);
virtual QString getPropertyText(unsigned int index)=0;
/// Returns the ID of the closest primitive.
unsigned int getClosestPrimitiveId(unsigned int _face, ACG::Vec3d &_hitPoint);
......@@ -105,13 +108,6 @@ protected:
template <typename InnerType>
QString getPropertyText_(unsigned int index);
virtual QString getCellPropertyText(unsigned int index);
virtual QString getFacePropertyText(unsigned int index);
virtual QString getHalffacePropertyText(unsigned int index);
virtual QString getEdgePropertyText(unsigned int index);
virtual QString getHalfedgePropertyText(unsigned int index);
virtual QString getVertexPropertyText(unsigned int index);
virtual void setCellPropertyFromText(unsigned int index, QString text);
virtual void setFacePropertyFromText(unsigned int index, QString text);
virtual void setHalffacePropertyFromText(unsigned int index, QString text);
......@@ -132,11 +128,10 @@ protected:
unsigned int getClosestHalfedgeId(unsigned int _face, ACG::Vec3d& _hitPoint);
unsigned int getClosestVertexId(unsigned int _face, ACG::Vec3d& _hitPoint);
template <typename EntityIterator>
void clearEntityProperty(VolumeMeshObject<MeshT>* object, EntityIterator e_begin, EntityIterator e_end);
int mObjectID;
VolumeMeshDrawModesContainer drawModes;
private:
template<typename Property>
......@@ -158,48 +153,60 @@ private:
};
};
#define CALLS_TO_VISUALIZE_PROP(Classname, Template) \
#define CALLS_TO_VISUALIZE_PROP(Classname, Template, PropType) \
template <Template> \
void Classname::visualizeCellProp() \
{\
OpenVolumeMesh::CellPropertyT<bool> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
OpenVolumeMesh::CellPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->cells_begin(), OVMPropertyVisualizer<MeshT>::mesh->cells_end());\
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::CELLS_COLORED);\
VolumeMeshObject<MeshT>* object;\
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.cellsColoredPerCell);\
}\
template <Template>\
void Classname::visualizeFaceProp()\
{\
OpenVolumeMesh::FacePropertyT<bool> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
OpenVolumeMesh::FacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->faces_begin(), OVMPropertyVisualizer<MeshT>::mesh->faces_end());\
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);\
VolumeMeshObject<MeshT>* object;\
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.facesColoredPerFace);\
}\
template <Template>\
void Classname::visualizeHalffaceProp()\
{\
OpenVolumeMesh::HalfFacePropertyT<bool> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
OpenVolumeMesh::HalfFacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halffaces_begin(), OVMPropertyVisualizer<MeshT>::mesh->halffaces_end());\
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);\
VolumeMeshObject<MeshT>* object;\
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halffacesColoredPerHalfface);\
}\
template <Template>\
void Classname::visualizeEdgeProp()\
{\
OpenVolumeMesh::EdgePropertyT<bool> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
OpenVolumeMesh::EdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->edges_begin(), OVMPropertyVisualizer<MeshT>::mesh->edges_end());\
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED);\
VolumeMeshObject<MeshT>* object;\
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.edgesColoredPerEdge);\
}\
template <Template>\
void Classname::visualizeHalfedgeProp()\
{\
OpenVolumeMesh::HalfEdgePropertyT<bool> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
OpenVolumeMesh::HalfEdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halfedges_begin(), OVMPropertyVisualizer<MeshT>::mesh->halfedges_end());\
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::HALFEDGES_COLORED);\
VolumeMeshObject<MeshT>* object;\
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.halfedgesColoredPerHalfedge);\
}\
template <Template>\
void Classname::visualizeVertexProp()\
{\
OpenVolumeMesh::VertexPropertyT<bool> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
OpenVolumeMesh::VertexPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<PropType>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());\
visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->vertices_begin(), OVMPropertyVisualizer<MeshT>::mesh->vertices_end());\
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_POINTS_COLORED);\
VolumeMeshObject<MeshT>* object;\
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);\
object->setObjectDrawMode(OVMPropertyVisualizer<MeshT>::drawModes.verticesColored);\
}\
......
......@@ -71,13 +71,6 @@ protected:
virtual void visualizeCellProp();
virtual void visualizeHalffaceProp();
virtual QString getCellPropertyText(unsigned int index);
virtual QString getFacePropertyText(unsigned int index);
virtual QString getHalffacePropertyText(unsigned int index);
virtual QString getEdgePropertyText(unsigned int index);
virtual QString getHalfedgePropertyText(unsigned int index);
virtual QString getVertexPropertyText(unsigned int index);
virtual void setCellPropertyFromText(unsigned int index, QString text);
virtual void setFacePropertyFromText(unsigned int index, QString text);
virtual void setHalffacePropertyFromText(unsigned int index, QString text);
......
......@@ -54,6 +54,7 @@ OVMPropertyVisualizerBoolean<MeshT>::OVMPropertyVisualizerBoolean(MeshT* _mesh,
BooleanWidget* w = new BooleanWidget();
w->paramBool->setTitle(QString("Boolean Parameters of ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
PropertyVisualizer::widget = w;
}
template <typename MeshT>
......@@ -78,7 +79,7 @@ void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, EntityIte
else
object->colors()[*e_it] = colorFalse;
}
CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerBoolean<MeshT>, typename MeshT)
CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerBoolean<MeshT>, typename MeshT, bool)
template <typename MeshT>
void OVMPropertyVisualizerBoolean<MeshT>::duplicateProperty()
......@@ -86,90 +87,6 @@ void OVMPropertyVisualizerBoolean<MeshT>::duplicateProperty()
OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<bool>();
}
template <typename MeshT>
QString OVMPropertyVisualizerBoolean<MeshT>::getCellPropertyText(unsigned int index)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::CellPropertyT<bool> prop = mesh->template request_cell_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str());;
OpenVolumeMesh::CellHandle ch(index);
return this->toStr(prop[ch]);
}
template <typename MeshT>
QString OVMPropertyVisualizerBoolean<MeshT>::getFacePropertyText(unsigned int index)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::FacePropertyT<bool> prop = mesh->template request_face_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str());;
OpenVolumeMesh::FaceHandle fh(index);
return this->toStr(prop[fh]);
}
template <typename MeshT>
QString OVMPropertyVisualizerBoolean<MeshT>::getHalffacePropertyText(unsigned int index)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::HalfFacePropertyT<bool> prop = mesh->template request_halfface_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str());;
OpenVolumeMesh::HalfFaceHandle hfh(index);
return this->toStr(prop[hfh]);
}
template <typename MeshT>
QString OVMPropertyVisualizerBoolean<MeshT>::getEdgePropertyText(unsigned int index)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::EdgePropertyT<bool> prop = mesh->template request_edge_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str());;
OpenVolumeMesh::EdgeHandle eh(index);
return this->toStr(prop[eh]);
}
template <typename MeshT>
QString OVMPropertyVisualizerBoolean<MeshT>::getHalfedgePropertyText(unsigned int index)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::HalfEdgePropertyT<bool> prop = mesh->template request_halfedge_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str());;
OpenVolumeMesh::HalfEdgeHandle heh(index);
return this->toStr(prop[heh]);
}
template <typename MeshT>
QString OVMPropertyVisualizerBoolean<MeshT>::getVertexPropertyText(unsigned int index)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::VertexPropertyT<bool> prop = mesh->template request_vertex_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str());;
OpenVolumeMesh::VertexHandle vh(index);
return this->toStr(prop[vh]);
}
template <typename MeshT>
void OVMPropertyVisualizerBoolean<MeshT>::setCellPropertyFromText(unsigned int index, QString text)
{
......@@ -178,7 +95,7 @@ void OVMPropertyVisualizerBoolean<MeshT>::setCellPropertyFromText(unsigned int i
OpenVolumeMesh::CellPropertyT<bool> prop = mesh->template request_cell_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
//emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
return;
}
......@@ -195,7 +112,7 @@ void OVMPropertyVisualizerBoolean<MeshT>::setFacePropertyFromText(unsigned int i
OpenVolumeMesh::FacePropertyT<bool> prop = mesh->template request_face_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
// emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
return;
}
......@@ -212,7 +129,7 @@ void OVMPropertyVisualizerBoolean<MeshT>::setHalffacePropertyFromText(unsigned i
OpenVolumeMesh::HalfFacePropertyT<bool> prop = mesh->template request_halfface_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
// emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
return;
}
......@@ -229,7 +146,7 @@ void OVMPropertyVisualizerBoolean<MeshT>::setEdgePropertyFromText(unsigned int i
OpenVolumeMesh::EdgePropertyT<bool> prop = mesh->template request_edge_property<bool>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
// emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
return;