Commit 05ae8343 authored by Max Lyon's avatar Max Lyon
Browse files

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 8e4e4f39
...@@ -69,6 +69,17 @@ QVariant ObjectListItemModel::data(const QModelIndex & index, int role) const { ...@@ -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) { void ObjectListItemModel::refresh(const DataType &datatype) {
std::vector<ObjectInfo> objects; std::vector<ObjectInfo> objects;
for (PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, datatype); for (PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS, datatype);
......
...@@ -54,6 +54,8 @@ class ObjectListItemModel: public QAbstractListModel { ...@@ -54,6 +54,8 @@ class ObjectListItemModel: public QAbstractListModel {
virtual int rowCount(const QModelIndex & parent = QModelIndex()) const; virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; virtual QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
void removeObject(int _id);
void refresh(const DataType &datatype); void refresh(const DataType &datatype);
protected: protected:
......
...@@ -178,7 +178,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setFacePropertyFromText(unsigned int in ...@@ -178,7 +178,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setFacePropertyFromText(unsigned int in
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::FaceHandle fh = mesh->face_handle(index);
...@@ -193,7 +193,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setEdgePropertyFromText(unsigned int in ...@@ -193,7 +193,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setEdgePropertyFromText(unsigned int in
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
...@@ -208,7 +208,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setHalfedgePropertyFromText(unsigned in ...@@ -208,7 +208,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setHalfedgePropertyFromText(unsigned in
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
...@@ -223,7 +223,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setVertexPropertyFromText(unsigned int ...@@ -223,7 +223,7 @@ void OMPropertyVisualizerBoolean<MeshT>::setVertexPropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
...@@ -63,7 +63,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp() ...@@ -63,7 +63,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
OpenMesh::FPropHandleT< double > prop; OpenMesh::FPropHandleT< double > prop;
...@@ -150,7 +150,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp() ...@@ -150,7 +150,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
...@@ -242,7 +242,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp() ...@@ -242,7 +242,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
...@@ -331,7 +331,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp() ...@@ -331,7 +331,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
//TODO check if this also works if the property is Vec3d //TODO check if this also works if the property is Vec3d
...@@ -418,7 +418,7 @@ void OMPropertyVisualizerDouble<MeshT>::setFacePropertyFromText(unsigned int ind ...@@ -418,7 +418,7 @@ void OMPropertyVisualizerDouble<MeshT>::setFacePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::FaceHandle fh = mesh->face_handle(index);
...@@ -433,7 +433,7 @@ void OMPropertyVisualizerDouble<MeshT>::setEdgePropertyFromText(unsigned int ind ...@@ -433,7 +433,7 @@ void OMPropertyVisualizerDouble<MeshT>::setEdgePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
...@@ -448,7 +448,7 @@ void OMPropertyVisualizerDouble<MeshT>::setHalfedgePropertyFromText(unsigned int ...@@ -448,7 +448,7 @@ void OMPropertyVisualizerDouble<MeshT>::setHalfedgePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
...@@ -463,7 +463,7 @@ void OMPropertyVisualizerDouble<MeshT>::setVertexPropertyFromText(unsigned int i ...@@ -463,7 +463,7 @@ void OMPropertyVisualizerDouble<MeshT>::setVertexPropertyFromText(unsigned int i
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
...@@ -75,7 +75,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp() ...@@ -75,7 +75,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -164,7 +164,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp() ...@@ -164,7 +164,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -254,7 +254,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp() ...@@ -254,7 +254,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -343,7 +343,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp() ...@@ -343,7 +343,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp()
colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color()); colorMin = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color()); colorMax = OMPropertyVisualizer<MeshT>::convertColor(integerWidget->intMax->color());
// color codern in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -433,7 +433,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setFacePropertyFromText(unsigned int ...@@ -433,7 +433,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setFacePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::FaceHandle fh = mesh->face_handle(index);
...@@ -449,8 +449,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setEdgePropertyFromText(unsigned int ...@@ -449,8 +449,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setEdgePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
...@@ -465,7 +464,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setHalfedgePropertyFromText(unsigned ...@@ -465,7 +464,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setHalfedgePropertyFromText(unsigned
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
...@@ -481,7 +480,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setVertexPropertyFromText(unsigned i ...@@ -481,7 +480,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::setVertexPropertyFromText(unsigned i
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
...@@ -152,7 +152,7 @@ void OMPropertyVisualizerSkinWeights<MeshT>::setVertexPropertyFromText(unsigned ...@@ -152,7 +152,7 @@ void OMPropertyVisualizerSkinWeights<MeshT>::setVertexPropertyFromText(unsigned
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
...@@ -356,7 +356,7 @@ void OMPropertyVisualizerVector<MeshT>::setFacePropertyFromText(unsigned int ind ...@@ -356,7 +356,7 @@ void OMPropertyVisualizerVector<MeshT>::setFacePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::FaceHandle fh = mesh->face_handle(index);
...@@ -371,7 +371,7 @@ void OMPropertyVisualizerVector<MeshT>::setEdgePropertyFromText(unsigned int ind ...@@ -371,7 +371,7 @@ void OMPropertyVisualizerVector<MeshT>::setEdgePropertyFromText(unsigned int ind
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::EdgeHandle eh = mesh->edge_handle(index);
...@@ -386,7 +386,7 @@ void OMPropertyVisualizerVector<MeshT>::setHalfedgePropertyFromText(unsigned int ...@@ -386,7 +386,7 @@ void OMPropertyVisualizerVector<MeshT>::setHalfedgePropertyFromText(unsigned int
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::HalfedgeHandle heh = mesh->halfedge_handle(index);
...@@ -401,7 +401,7 @@ void OMPropertyVisualizerVector<MeshT>::setVertexPropertyFromText(unsigned int i ...@@ -401,7 +401,7 @@ void OMPropertyVisualizerVector<MeshT>::setVertexPropertyFromText(unsigned int i
MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh; MeshT* mesh = OMPropertyVisualizer<MeshT>::mesh;
if ( !mesh->get_property_handle(prop, PropertyVisualizer::propertyInfo.propName() ) ) 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); typename MeshT::VertexHandle vh = mesh->vertex_handle(index);
......
...@@ -157,7 +157,7 @@ private: ...@@ -157,7 +157,7 @@ private:
TypeInfoWrapper getSupportedTypeInfoWrapper(OpenVolumeMesh::BaseProperty* const baseProp) const; TypeInfoWrapper getSupportedTypeInfoWrapper(OpenVolumeMesh::BaseProperty* const baseProp) const;
/// Returns the TypeInfoWrapper for the type of property if it is supported. /// 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 isBoolType(const PropertyInfo& propInfo) const;
bool isIntType(const PropertyInfo& propInfo) const; bool isIntType(const PropertyInfo& propInfo) const;
...@@ -168,6 +168,8 @@ private: ...@@ -168,6 +168,8 @@ private:
bool isVectorType(const PropertyInfo& propInfo) const; bool isVectorType(const PropertyInfo& propInfo) const;
bool isVectorType(const TypeInfoWrapper& typeInfo) const; bool isVectorType(const TypeInfoWrapper& typeInfo) const;
bool isEntityType(const TypeInfoWrapper& typeInfo, PropertyInfo::ENTITY_FILTER entity_type) const;
/// Adds a new PropertyVisualizer. /// Adds a new PropertyVisualizer.
void addPropertyVisualizer(OpenVolumeMesh::BaseProperty* const baseProp, MeshT* mesh, PropertyInfo::ENTITY_FILTER filter); void addPropertyVisualizer(OpenVolumeMesh::BaseProperty* const baseProp, MeshT* mesh, PropertyInfo::ENTITY_FILTER filter);
......
...@@ -273,7 +273,7 @@ bool OVMPropertyModel<MeshT>::parseHeader(QString header, PropertyVisualizer*& p ...@@ -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]); QString propName = QInputDialog::getText(0, "Property Name", "Please enter name.",QLineEdit::Normal,headerParts[4]);
if (propName == "") return false; if (propName == "") return false;
...@@ -535,21 +535,22 @@ TypeInfoWrapper OVMPropertyModel<MeshT>::getSupportedTypeInfoWrapper(OpenVolumeM ...@@ -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 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. * @return A TypeInfoWrapper containing all the type information for the property type.
*/ */
template<typename MeshT> 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(); for (TypeInfoWrapperSet::const_iterator it = supportedPropertyTypes.begin();
it != supportedPropertyTypes.end(); it != supportedPropertyTypes.end();
++it ) ++it )
{ {
if (friendlyName.toStdString().compare(it->getName()) == 0) if ((friendlyName.toStdString().compare(it->getName()) == 0) && isEntityType(*it, filter))
return *it; return *it;
} }
throw std::exception(); throw std::exception();
...@@ -627,6 +628,68 @@ bool OVMPropertyModel<MeshT>::isVectorType(const PropertyInfo& propInfo) const ...@@ -627,6 +628,68 @@ bool OVMPropertyModel<MeshT>::isVectorType(const PropertyInfo& propInfo) const
return isVec3fType(propInfo) || isVec3dType(propInfo); 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. * @brief Adds a new PropertyVisualizer.
* *
......
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#include <OpenFlipper/BasePlugin/PluginFunctionsViewControls.hh> #include <OpenFlipper/BasePlugin/PluginFunctionsViewControls.hh>
#include <ObjectTypes/VolumeMeshObject/VolumeMeshDrawModesContainer.hh>
#include <iostream> #include <iostream>
template <typename MeshT> template <typename MeshT>
...@@ -60,10 +62,11 @@ public: ...@@ -60,10 +62,11 @@ public:
OVMPropertyVisualizer(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo) OVMPropertyVisualizer(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
: PropertyVisualizer(_propertyInfo), : PropertyVisualizer(_propertyInfo),
mesh(_mesh), mesh(_mesh),
mObjectID(objectID) mObjectID(objectID),
drawModes()
{} {}
virtual ~OVMPropertyVisualizer(){} virtual ~OVMPropertyVisualizer(){ clear(); }
/// Visualizes a property.