Commit 5a9f7311 authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'OVMVec3dSupport' into 'master'

added support for OVM::Vec3d

See merge request !23
parents cc155c62 8b675e2b
......@@ -101,10 +101,14 @@ public:
static bool isUnsignedIntType(const TypeInfoWrapper& typeInfo);
static bool isVec3dType(const PropertyInfo& propInfo);
static bool isVec3dType(const TypeInfoWrapper& typeInfo);
static bool isVec3dOVMType(const PropertyInfo& propInfo);
static bool isVec3dOVMType(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);
static bool isVectorOVMType(const PropertyInfo& propInfo);
static bool isVectorOVMType(const TypeInfoWrapper& typeInfo);
static bool isMatrix3x3Type(const PropertyInfo& propInfo);
static bool isMatrix3x3Type(const TypeInfoWrapper& typeInfo);
......@@ -114,6 +118,7 @@ public:
static const TypeInfoWrapper proptype_##primitive##_uint; \
static const TypeInfoWrapper proptype_##primitive##_double; \
static const TypeInfoWrapper proptype_##primitive##_Vec3d; \
static const TypeInfoWrapper proptype_##primitive##_Vec3dOVM; \
static const TypeInfoWrapper proptype_##primitive##_Vec3f; \
static const TypeInfoWrapper proptype_##primitive##_Matrix3x3d;
......@@ -209,6 +214,8 @@ template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##prim
= 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##_Vec3dOVM \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<OpenVolumeMesh::Vec3d>), "Vec3dOVM"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Vec3f \
= TypeInfoWrapper(typeid(OpenVolumeMesh::primitive##PropertyT<ACG::Vec3f>), "Vec3f"); \
template <typename T> const TypeInfoWrapper OVMPropertyModel<T>::proptype_##primitive##_Matrix3x3d \
......
......@@ -458,7 +458,7 @@ bool OVMPropertyModel<MeshT>::isSupported(OpenVolumeMesh::BaseProperty* const ba
* @return True if the property type can be visualized, False if not.
*
* Currently supported are the types "bool", "int", "unsigned int", "double", "Vec3d"
* and "Vec3f"
* "Vec3dOVM" and "Vec3f"
*/
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isSupported(QString friendlyName) const
......@@ -622,6 +622,23 @@ bool OVMPropertyModel<MeshT>::isVec3dType(const TypeInfoWrapper& typeInfo)
typeInfo == proptype_Vertex_Vec3d;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVec3dOVMType(const PropertyInfo& propInfo)
{
return isVec3dOVMType(propInfo.typeinfo());
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVec3dOVMType(const TypeInfoWrapper& typeInfo)
{
return typeInfo == proptype_Cell_Vec3dOVM ||
typeInfo == proptype_Face_Vec3dOVM ||
typeInfo == proptype_HalfFace_Vec3dOVM ||
typeInfo == proptype_Edge_Vec3dOVM ||
typeInfo == proptype_HalfEdge_Vec3dOVM ||
typeInfo == proptype_Vertex_Vec3dOVM;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVec3fType(const PropertyInfo& propInfo)
{
......@@ -642,7 +659,7 @@ bool OVMPropertyModel<MeshT>::isVec3fType(const TypeInfoWrapper& typeInfo)
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVectorType(const PropertyInfo& propInfo)
{
return isVec3fType(propInfo) || isVec3dType(propInfo);
return isVec3fType(propInfo) || isVec3dType(propInfo) ;
}
template<typename MeshT>
......@@ -651,6 +668,18 @@ bool OVMPropertyModel<MeshT>::isVectorType(const TypeInfoWrapper& typeInfo)
return isVec3fType(typeInfo) || isVec3dType(typeInfo);
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVectorOVMType(const PropertyInfo& propInfo)
{
return isVec3dOVMType(propInfo) ;
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isVectorOVMType(const TypeInfoWrapper& typeInfo)
{
return isVec3dOVMType(typeInfo);
}
template<typename MeshT>
bool OVMPropertyModel<MeshT>::isMatrix3x3Type(const PropertyInfo& propInfo)
{
......@@ -679,6 +708,7 @@ bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, Prop
|| (typeInfo == proptype_Cell_double)
|| (typeInfo == proptype_Cell_uint)
|| (typeInfo == proptype_Cell_Vec3d)
|| (typeInfo == proptype_Cell_Vec3dOVM)
|| (typeInfo == proptype_Cell_Vec3f);
}
if (entity_type & PropertyInfo::EF_FACE)
......@@ -688,6 +718,7 @@ bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, Prop
|| (typeInfo == proptype_Face_double)
|| (typeInfo == proptype_Face_uint)
|| (typeInfo == proptype_Face_Vec3d)
|| (typeInfo == proptype_Face_Vec3dOVM)
|| (typeInfo == proptype_Face_Vec3f);
}
if (entity_type & PropertyInfo::EF_HALFFACE)
......@@ -697,6 +728,7 @@ bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, Prop
|| (typeInfo == proptype_HalfFace_double)
|| (typeInfo == proptype_HalfFace_uint)
|| (typeInfo == proptype_HalfFace_Vec3d)
|| (typeInfo == proptype_HalfFace_Vec3dOVM)
|| (typeInfo == proptype_HalfFace_Vec3f);
}
if (entity_type & PropertyInfo::EF_EDGE)
......@@ -706,6 +738,7 @@ bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, Prop
|| (typeInfo == proptype_Edge_double)
|| (typeInfo == proptype_Edge_uint)
|| (typeInfo == proptype_Edge_Vec3d)
|| (typeInfo == proptype_Edge_Vec3dOVM)
|| (typeInfo == proptype_Edge_Vec3f);
}
if (entity_type & PropertyInfo::EF_HALFEDGE)
......@@ -715,6 +748,7 @@ bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, Prop
|| (typeInfo == proptype_HalfEdge_double)
|| (typeInfo == proptype_HalfEdge_uint)
|| (typeInfo == proptype_HalfEdge_Vec3d)
|| (typeInfo == proptype_HalfEdge_Vec3dOVM)
|| (typeInfo == proptype_HalfEdge_Vec3f);
}
if (entity_type & PropertyInfo::EF_VERTEX)
......@@ -724,6 +758,7 @@ bool OVMPropertyModel<MeshT>::isEntityType(const TypeInfoWrapper& typeInfo, Prop
|| (typeInfo == proptype_Vertex_double)
|| (typeInfo == proptype_Vertex_uint)
|| (typeInfo == proptype_Vertex_Vec3d)
|| (typeInfo == proptype_Vertex_Vec3dOVM)
|| (typeInfo == proptype_Vertex_Vec3f);
}
return result;
......@@ -753,7 +788,9 @@ void OVMPropertyModel<MeshT>::addPropertyVisualizer(OpenVolumeMesh::BaseProperty
else if (isDoubleType(propInfo))
propertyVisualizers.push_back(new OVMPropertyVisualizerDouble<MeshT>(mesh, objectID_, propInfo));
else if (isVectorType(propInfo))
propertyVisualizers.push_back(new OVMPropertyVisualizerVector<MeshT>(mesh, objectID_, propInfo));
propertyVisualizers.push_back(new OVMPropertyVisualizerVector<MeshT, ACG::Vec3d>(mesh, objectID_, propInfo));
else if (isVectorOVMType(propInfo))
propertyVisualizers.push_back(new OVMPropertyVisualizerVector<MeshT, OpenVolumeMesh::Vec3d>(mesh, objectID_, propInfo));
else if (isMatrix3x3Type(propInfo))
propertyVisualizers.push_back(new OVMPropertyVisualizerMatrix3x3<MeshT>(mesh, objectID_, propInfo));
connectLogs(propertyVisualizers.back());
......@@ -959,6 +996,7 @@ supportedPropertyTypes.insert(proptype_##primitive##_int); \
supportedPropertyTypes.insert(proptype_##primitive##_uint); \
supportedPropertyTypes.insert(proptype_##primitive##_double); \
supportedPropertyTypes.insert(proptype_##primitive##_Vec3d); \
supportedPropertyTypes.insert(proptype_##primitive##_Vec3dOVM); \
supportedPropertyTypes.insert(proptype_##primitive##_Vec3f); \
supportedPropertyTypes.insert(proptype_##primitive##_Matrix3x3d); \
......@@ -969,7 +1007,7 @@ supportedPropertyTypes.insert(proptype_##primitive##_Matrix3x3d); \
INSERT_PROPTYPES(HalfEdge)
INSERT_PROPTYPES(Vertex)
#undef INITIALIZE_PROPTYPES
#undef INSERT_PROPTYPES
......
......@@ -56,7 +56,7 @@
#include <iostream>
template <typename MeshT>
template <typename MeshT, typename VectorT>
class OVMPropertyVisualizerVector: public OVMPropertyVisualizer<MeshT>{
public:
......@@ -94,6 +94,8 @@ protected:
void setHalfedgePropertyFromText(unsigned int index, QString text) override;
void setVertexPropertyFromText(unsigned int index, QString text) override;
inline ACG::Vec3d convert_to_acg(const VectorT& _v) { return ACG::Vec3d(_v[0], _v[1], _v[2]);}
ACG::SceneGraph::LineNode* lineNode;
};
......
......@@ -48,8 +48,8 @@
#include "OVMPropertyVisualizerVector.hh"
template <typename MeshT>
OVMPropertyVisualizerVector<MeshT>::OVMPropertyVisualizerVector(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
template <typename MeshT, typename VectorT>
OVMPropertyVisualizerVector<MeshT,VectorT>::OVMPropertyVisualizerVector(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
: OVMPropertyVisualizer<MeshT>(_mesh, objectID, _propertyInfo)
{
if (PropertyVisualizer::widget) delete PropertyVisualizer::widget;
......@@ -65,28 +65,28 @@ OVMPropertyVisualizerVector<MeshT>::OVMPropertyVisualizerVector(MeshT* _mesh, in
[this](double value) {lineNode->set_line_width(value);});
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::clear()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::clear()
{
lineNode->clear();
OVMPropertyVisualizer<MeshT>::clear();
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::duplicateProperty()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::duplicateProperty()
{
OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<ACG::Vec3d>();
OVMPropertyVisualizer<MeshT>::template duplicateProperty_stage1<VectorT>();
}
template<typename MeshT>
template<typename MeshT, typename VectorT>
template<typename PropType, typename EntityIterator>
void OVMPropertyVisualizerVector<MeshT>::visualizeVectorAsColorForEntity(PropType prop, EntityIterator e_begin, EntityIterator e_end, bool normalized) {
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeVectorAsColorForEntity(PropType prop, EntityIterator e_begin, EntityIterator e_end, bool normalized) {
if (!prop)
throw VizException("Getting PropHandle from mesh for selected property failed.");
VolumeMeshObject<MeshT>* object;
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) {
ACG::Vec3d v = prop[*e_it];
ACG::Vec3d v = convert_to_acg(prop[*e_it]);
if (normalized)
v = v.normalized() * 0.5 + ACG::Vec3d(0.5);
else
......@@ -95,13 +95,13 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeVectorAsColorForEntity(PropTyp
}
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeCellProp(bool _setDrawMode)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeCellProp(bool _setDrawMode)
{
VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
if (w->vectors_colors_rb->isChecked())
{
OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::CellPropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
visualizeVectorAsColorForEntity(prop,
OVMPropertyVisualizer<MeshT>::mesh->cells_begin(),
OVMPropertyVisualizer<MeshT>::mesh->cells_end(),
......@@ -116,13 +116,13 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeCellProp(bool _setDrawMode)
else visualizeCellPropAsStrokes();
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeFaceProp(bool _setDrawMode)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeFaceProp(bool _setDrawMode)
{
VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
if (w->vectors_colors_rb->isChecked())
{
OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::FacePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
visualizeVectorAsColorForEntity(prop,
OVMPropertyVisualizer<MeshT>::mesh->faces_begin(),
OVMPropertyVisualizer<MeshT>::mesh->faces_end(),
......@@ -138,13 +138,13 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeFaceProp(bool _setDrawMode)
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeHalffaceProp(bool _setDrawMode)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeHalffaceProp(bool _setDrawMode)
{
VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
if (w->vectors_colors_rb->isChecked())
{
OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::HalfFacePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
visualizeVectorAsColorForEntity(prop,
OVMPropertyVisualizer<MeshT>::mesh->halffaces_begin(),
OVMPropertyVisualizer<MeshT>::mesh->halffaces_end(),
......@@ -159,13 +159,13 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalffaceProp(bool _setDrawMode
else visualizeHalffacePropAsStrokes();
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeEdgeProp(bool _setDrawMode)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeEdgeProp(bool _setDrawMode)
{
VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
if (w->vectors_colors_rb->isChecked())
{
OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::EdgePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
visualizeVectorAsColorForEntity(prop,
OVMPropertyVisualizer<MeshT>::mesh->edges_begin(),
OVMPropertyVisualizer<MeshT>::mesh->edges_end(),
......@@ -180,13 +180,13 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeEdgeProp(bool _setDrawMode)
else visualizeEdgePropAsStrokes();
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeHalfedgeProp(bool _setDrawMode)
{
VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
if (w->vectors_colors_rb->isChecked())
{
OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::HalfEdgePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
visualizeVectorAsColorForEntity(prop,
OVMPropertyVisualizer<MeshT>::mesh->halfedges_begin(),
OVMPropertyVisualizer<MeshT>::mesh->halfedges_end(),
......@@ -201,13 +201,13 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgeProp(bool _setDrawMode
else visualizeHalfedgePropAsStrokes();
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeVertexProp(bool _setDrawMode)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeVertexProp(bool _setDrawMode)
{
VectorWidget* w = (VectorWidget*)PropertyVisualizer::widget;
if (w->vectors_colors_rb->isChecked())
{
OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::VertexPropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
visualizeVectorAsColorForEntity(prop,
OVMPropertyVisualizer<MeshT>::mesh->vertices_begin(),
OVMPropertyVisualizer<MeshT>::mesh->vertices_end(),
......@@ -222,8 +222,8 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeVertexProp(bool _setDrawMode)
else visualizeVertexPropAsStrokes();
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeFacePropAsStrokes()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeFacePropAsStrokes()
{
VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
......@@ -231,7 +231,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeFacePropAsStrokes()
ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
OpenVolumeMesh::FacePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<VectorT>(PropertyVisualizer::propertyInfo.propName());
if ( !prop )
return;
......@@ -250,7 +250,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeFacePropAsStrokes()
center /= vCount;
ACG::Vec3d v = prop[*f_it];
ACG::Vec3d v = convert_to_acg(prop[*f_it]);
if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
v.normalize();
......@@ -263,8 +263,8 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeFacePropAsStrokes()
}
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeEdgePropAsStrokes()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeEdgePropAsStrokes()
{
VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
......@@ -272,7 +272,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeEdgePropAsStrokes()
ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::EdgePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return;
......@@ -284,7 +284,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeEdgePropAsStrokes()
ACG::Vec3d v2 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.to_vertex());
ACG::Vec3d start = 0.5*(v1+v2);
ACG::Vec3d v = prop[*e_it];
ACG::Vec3d v = convert_to_acg(prop[*e_it]);
if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
v.normalize();
......@@ -299,8 +299,8 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeEdgePropAsStrokes()
}
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgePropAsStrokes()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeHalfedgePropAsStrokes()
{
VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
......@@ -308,7 +308,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgePropAsStrokes()
ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
OpenVolumeMesh::HalfEdgePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::HalfEdgePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return;
......@@ -321,7 +321,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgePropAsStrokes()
ACG::Vec3d v2 = OVMPropertyVisualizer<MeshT>::mesh->vertex(edge.to_vertex());
ACG::Vec3d start = (2.0*v1+v2)/3.0;
ACG::Vec3d v = prop[*he_it];
ACG::Vec3d v = convert_to_acg(prop[*he_it]);
if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
v.normalize();
......@@ -334,8 +334,8 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalfedgePropAsStrokes()
}
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeVertexPropAsStrokes()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeVertexPropAsStrokes()
{
VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
......@@ -343,7 +343,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeVertexPropAsStrokes()
ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
OpenVolumeMesh::VertexPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::VertexPropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
return;
......@@ -352,7 +352,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeVertexPropAsStrokes()
ACG::Vec3d start = OVMPropertyVisualizer<MeshT>::mesh->vertex(*v_it);
ACG::Vec3d v = prop[*v_it];
ACG::Vec3d v = convert_to_acg(prop[*v_it]);
if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
v.normalize();
......@@ -365,8 +365,8 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeVertexPropAsStrokes()
}
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeCellPropAsStrokes()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeCellPropAsStrokes()
{
VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
......@@ -374,7 +374,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeCellPropAsStrokes()
ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
OpenVolumeMesh::CellPropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<VectorT>(PropertyVisualizer::propertyInfo.propName());
if ( !prop )
return;
......@@ -389,7 +389,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeCellPropAsStrokes()
center += OVMPropertyVisualizer<MeshT>::mesh->vertex(*cv_it) / (double)vCount;
}
ACG::Vec3d v = prop[*c_it];
ACG::Vec3d v = convert_to_acg(prop[*c_it]);
if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
v.normalize();
......@@ -402,8 +402,8 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeCellPropAsStrokes()
}
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::visualizeHalffacePropAsStrokes()
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::visualizeHalffacePropAsStrokes()
{
VectorWidget* vectorWidget = static_cast<VectorWidget*>(PropertyVisualizer::widget);
......@@ -411,7 +411,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalffacePropAsStrokes()
ACG::Vec4f color = ACG::to_Vec4f(vectorWidget->lineColor->color());
OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<ACG::Vec3d>(PropertyVisualizer::propertyInfo.propName());
OpenVolumeMesh::HalfFacePropertyT<VectorT> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<VectorT>(PropertyVisualizer::propertyInfo.propName());
if ( !prop )
return;
......@@ -429,7 +429,7 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalffacePropAsStrokes()
center /= vCount;
ACG::Vec3d v = prop[*hf_it];
ACG::Vec3d v = convert_to_acg(prop[*hf_it]);
if (vectorWidget->normalize->isChecked() && v.sqrnorm() > 1e-12)
v.normalize();
......@@ -442,19 +442,19 @@ void OVMPropertyVisualizerVector<MeshT>::visualizeHalffacePropAsStrokes()
}
}
template <typename MeshT>
QString OVMPropertyVisualizerVector<MeshT>::getPropertyText(unsigned int index)
template <typename MeshT, typename VectorT>
QString OVMPropertyVisualizerVector<MeshT,VectorT>::getPropertyText(unsigned int index)
{
return OVMPropertyVisualizer<MeshT>::template getPropertyText_<ACG::Vec3d>(index);
return OVMPropertyVisualizer<MeshT>::template getPropertyText_<VectorT>(index);
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::setCellPropertyFromText(unsigned int index, QString text)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::setCellPropertyFromText(unsigned int index, QString text)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::CellPropertyT<ACG::Vec3d> prop = mesh->template request_cell_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::CellPropertyT<VectorT> prop = mesh->template request_cell_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
......@@ -463,15 +463,15 @@ void OVMPropertyVisualizerVector<MeshT>::setCellPropertyFromText(unsigned int in
OpenVolumeMesh::CellHandle ch(index);
prop[ch] = this->strToVec3d(text);
prop[ch] = this->template strToVec3<VectorT>(text);
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::setFacePropertyFromText(unsigned int index, QString text)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::setFacePropertyFromText(unsigned int index, QString text)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::FacePropertyT<ACG::Vec3d> prop = mesh->template request_face_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::FacePropertyT<VectorT> prop = mesh->template request_face_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
......@@ -480,15 +480,15 @@ void OVMPropertyVisualizerVector<MeshT>::setFacePropertyFromText(unsigned int in
OpenVolumeMesh::FaceHandle fh(index);
prop[fh] = this->strToVec3d(text);
prop[fh] = this->template strToVec3<VectorT>(text);
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::setHalffacePropertyFromText(unsigned int index, QString text)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::setHalffacePropertyFromText(unsigned int index, QString text)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::HalfFacePropertyT<ACG::Vec3d> prop = mesh->template request_halfface_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::HalfFacePropertyT<VectorT> prop = mesh->template request_halfface_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
......@@ -497,15 +497,15 @@ void OVMPropertyVisualizerVector<MeshT>::setHalffacePropertyFromText(unsigned in
OpenVolumeMesh::HalfFaceHandle hfh(index);
prop[hfh] = this->strToVec3d(text);
prop[hfh] = this->template strToVec3<VectorT>(text);
}
template <typename MeshT>
void OVMPropertyVisualizerVector<MeshT>::setEdgePropertyFromText(unsigned int index, QString text)
template <typename MeshT, typename VectorT>
void OVMPropertyVisualizerVector<MeshT,VectorT>::setEdgePropertyFromText(unsigned int index, QString text)
{
MeshT* mesh = OVMPropertyVisualizer<MeshT>::mesh;
OpenVolumeMesh::EdgePropertyT<ACG::Vec3d> prop = mesh->template request_edge_property<ACG::Vec3d>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
OpenVolumeMesh::EdgePropertyT<VectorT> prop = mesh->template request_edge_property<VectorT>(OVMPropertyVisualizer<MeshT>::propertyInfo.propName());
if ( !prop )
{
emit this->log(LOGERR, QObject::tr("Error: No property with name ").append(PropertyVisualizer::propertyInfo.propName().c_str()));
......@@ -514,15 +514,15 @@ void OVMPropertyVisualize