Commit 0a494df6 authored by Martin Heistermann's avatar Martin Heistermann

ovm int/double/bool vis: use range-like iterable instead of begin/end iter

parent 873577dd
...@@ -162,7 +162,7 @@ template <Template> \ ...@@ -162,7 +162,7 @@ template <Template> \
void Classname::visualizeCellProp(bool _setDrawMode) \ void Classname::visualizeCellProp(bool _setDrawMode) \
{\ {\
OpenVolumeMesh::CellPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_cell_property<PropType>(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());\ visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->cells());\
if (_setDrawMode)\ if (_setDrawMode)\
{\ {\
VolumeMeshObject<MeshT>* object;\ VolumeMeshObject<MeshT>* object;\
...@@ -174,7 +174,7 @@ template <Template>\ ...@@ -174,7 +174,7 @@ template <Template>\
void Classname::visualizeFaceProp(bool _setDrawMode)\ void Classname::visualizeFaceProp(bool _setDrawMode)\
{\ {\
OpenVolumeMesh::FacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_face_property<PropType>(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());\ visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->faces());\
if (_setDrawMode)\ if (_setDrawMode)\
{\ {\
VolumeMeshObject<MeshT>* object;\ VolumeMeshObject<MeshT>* object;\
...@@ -186,7 +186,7 @@ template <Template>\ ...@@ -186,7 +186,7 @@ template <Template>\
void Classname::visualizeHalffaceProp(bool _setDrawMode)\ void Classname::visualizeHalffaceProp(bool _setDrawMode)\
{\ {\
OpenVolumeMesh::HalfFacePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfface_property<PropType>(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());\ visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halffaces());\
if (_setDrawMode)\ if (_setDrawMode)\
{\ {\
VolumeMeshObject<MeshT>* object;\ VolumeMeshObject<MeshT>* object;\
...@@ -198,7 +198,7 @@ template <Template>\ ...@@ -198,7 +198,7 @@ template <Template>\
void Classname::visualizeEdgeProp(bool _setDrawMode)\ void Classname::visualizeEdgeProp(bool _setDrawMode)\
{\ {\
OpenVolumeMesh::EdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_edge_property<PropType>(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());\ visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->edges());\
if (_setDrawMode)\ if (_setDrawMode)\
{\ {\
VolumeMeshObject<MeshT>* object;\ VolumeMeshObject<MeshT>* object;\
...@@ -210,7 +210,7 @@ template <Template>\ ...@@ -210,7 +210,7 @@ template <Template>\
void Classname::visualizeHalfedgeProp(bool _setDrawMode)\ void Classname::visualizeHalfedgeProp(bool _setDrawMode)\
{\ {\
OpenVolumeMesh::HalfEdgePropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_halfedge_property<PropType>(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());\ visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->halfedges());\
if (_setDrawMode)\ if (_setDrawMode)\
{\ {\
VolumeMeshObject<MeshT>* object;\ VolumeMeshObject<MeshT>* object;\
...@@ -222,7 +222,7 @@ template <Template>\ ...@@ -222,7 +222,7 @@ template <Template>\
void Classname::visualizeVertexProp(bool _setDrawMode)\ void Classname::visualizeVertexProp(bool _setDrawMode)\
{\ {\
OpenVolumeMesh::VertexPropertyT<PropType> prop = OVMPropertyVisualizer<MeshT>::mesh->template request_vertex_property<PropType>(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());\ visualizeProp(prop, OVMPropertyVisualizer<MeshT>::mesh->vertices());\
if (_setDrawMode)\ if (_setDrawMode)\
{\ {\
VolumeMeshObject<MeshT>* object;\ VolumeMeshObject<MeshT>* object;\
......
...@@ -59,8 +59,8 @@ public: ...@@ -59,8 +59,8 @@ public:
protected: protected:
template <typename PropType, typename EntityIterator> template <typename PropType, typename HandleIterable>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end); void visualizeProp(PropType prop, HandleIterable handles);
void duplicateProperty() override; void duplicateProperty() override;
void visualizeFaceProp(bool _setDrawMode = true) override; void visualizeFaceProp(bool _setDrawMode = true) override;
......
...@@ -59,8 +59,8 @@ OVMPropertyVisualizerBoolean<MeshT>::OVMPropertyVisualizerBoolean(MeshT* _mesh, ...@@ -59,8 +59,8 @@ OVMPropertyVisualizerBoolean<MeshT>::OVMPropertyVisualizerBoolean(MeshT* _mesh,
} }
template <typename MeshT> template <typename MeshT>
template <typename PropType, typename EntityIterator> template <typename PropType, typename HandleIterable>
void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end) void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, HandleIterable handles)
{ {
if (!prop) if (!prop)
return; return;
...@@ -74,11 +74,11 @@ void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, EntityIte ...@@ -74,11 +74,11 @@ void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, EntityIte
VolumeMeshObject<MeshT>* object; VolumeMeshObject<MeshT>* object;
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object); PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
for (EntityIterator e_it = e_begin ; e_it != e_end; ++e_it) for (const auto &h: handles)
if ( prop[*e_it] ) if ( prop[h] )
object->colors()[*e_it] = colorTrue; object->colors()[h] = colorTrue;
else else
object->colors()[*e_it] = colorFalse; object->colors()[h] = colorFalse;
} }
CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerBoolean<MeshT>, typename MeshT, bool) CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerBoolean<MeshT>, typename MeshT, bool)
......
...@@ -63,8 +63,8 @@ public: ...@@ -63,8 +63,8 @@ public:
virtual ~OVMPropertyVisualizerDouble(){} virtual ~OVMPropertyVisualizerDouble(){}
protected: protected:
template <typename PropType, typename EntityIterator> template <typename PropType, typename HandleIterable>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end); void visualizeProp(PropType prop, HandleIterable handles);
void duplicateProperty() override; void duplicateProperty() override;
void visualizeFaceProp(bool _setDrawMode = true) override; void visualizeFaceProp(bool _setDrawMode = true) override;
......
...@@ -66,9 +66,10 @@ OVMPropertyVisualizerDouble<MeshT>::OVMPropertyVisualizerDouble(MeshT* _mesh, in ...@@ -66,9 +66,10 @@ OVMPropertyVisualizerDouble<MeshT>::OVMPropertyVisualizerDouble(MeshT* _mesh, in
} }
template <typename MeshT> template <typename MeshT>
template <typename PropType, typename EntityIterator> template <typename PropType, typename HandleIterable>
void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end) void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, HandleIterable handles)
{ {
using Handle = decltype(*begin(handles));
if (!prop) return; if (!prop) return;
DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget); DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget);
...@@ -85,8 +86,8 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter ...@@ -85,8 +86,8 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
max = FLT_MIN; max = FLT_MIN;
} }
for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it){ for (const Handle& h: handles) {
double value = prop[*e_it]; double value = prop[h];
if ( doubleWidget->doubleAbsolute->isChecked() ){ if ( doubleWidget->doubleAbsolute->isChecked() ){
min = std::min( min, fabs(value)); min = std::min( min, fabs(value));
max = std::max( max, fabs(value)); max = std::max( max, fabs(value));
...@@ -112,20 +113,20 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter ...@@ -112,20 +113,20 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
VolumeMeshObject<MeshT>* object; VolumeMeshObject<MeshT>* object;
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object); PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it){ for (const Handle& h: handles) {
if (range == 0.0) if (range == 0.0)
object->colors()[*e_it] = colorMin; object->colors()[h] = colorMin;
else { else {
double value = prop[*e_it]; double value = prop[h];
// absolut value? // absolut value?
if ( doubleWidget->doubleAbsolute->isChecked()) if ( doubleWidget->doubleAbsolute->isChecked())
value = fabs(value); value = fabs(value);
double t = (value-min)/range; double t = (value-min)/range;
object->colors()[*e_it] = cc->color_float4(t); object->colors()[h] = cc->color_float4(t);
} }
} }
} }
......
...@@ -61,8 +61,8 @@ public: ...@@ -61,8 +61,8 @@ public:
virtual ~OVMPropertyVisualizerInteger(){} virtual ~OVMPropertyVisualizerInteger(){}
protected: protected:
template <typename PropType, typename EntityIterator> template <typename PropType, typename HandleIterable>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end); void visualizeProp(PropType prop, HandleIterable handles);
void duplicateProperty() override; void duplicateProperty() override;
void visualizeFaceProp(bool _setDrawMode = true) override; void visualizeFaceProp(bool _setDrawMode = true) override;
......
...@@ -69,8 +69,8 @@ OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh ...@@ -69,8 +69,8 @@ OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh
} }
template <typename MeshT, typename T> template <typename MeshT, typename T>
template <typename PropType, typename EntityIterator> template <typename PropType, typename HandleIterable>
void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end) void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, HandleIterable handles)
{ {
if (!prop) return; if (!prop) return;
...@@ -86,9 +86,9 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity ...@@ -86,9 +86,9 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
T min = mNumericLimitMax; T min = mNumericLimitMax;
T max = mNumericLimitMin; T max = mNumericLimitMin;
for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) for (const auto &h: handles)
{ {
T value = prop[*e_it]; T value = prop[h];
min = std::min( min, value); min = std::min( min, value);
max = std::max( max, value); max = std::max( max, value);
} }
...@@ -110,12 +110,12 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity ...@@ -110,12 +110,12 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
VolumeMeshObject<MeshT>* object; VolumeMeshObject<MeshT>* object;
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object); PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it) for (const auto &h: handles)
{ {
if (range == 0) if (range == 0)
object->colors()[*e_it] = colorMin; object->colors()[h] = colorMin;
else { else {
T value = prop[*e_it]; T value = prop[h];
double pos = (value - min) / (double) range; double pos = (value - min) / (double) range;
ACG::Vec4f color; ACG::Vec4f color;
if ( integerWidget->intRandom->isChecked() ) if ( integerWidget->intRandom->isChecked() )
...@@ -134,7 +134,7 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity ...@@ -134,7 +134,7 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
color = cc->color_float4(pos); color = cc->color_float4(pos);
} }
object->colors()[*e_it] = color; object->colors()[h] = color;
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment