Skip to content
Snippets Groups Projects
Commit 0a494df6 authored by Martin Heistermann's avatar Martin Heistermann
Browse files

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

parent 873577dd
Branches
No related tags found
1 merge request!19Feature int histograms (includes refactoring)
......@@ -162,7 +162,7 @@ template <Template> \
void Classname::visualizeCellProp(bool _setDrawMode) \
{\
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)\
{\
VolumeMeshObject<MeshT>* object;\
......@@ -174,7 +174,7 @@ template <Template>\
void Classname::visualizeFaceProp(bool _setDrawMode)\
{\
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)\
{\
VolumeMeshObject<MeshT>* object;\
......@@ -186,7 +186,7 @@ template <Template>\
void Classname::visualizeHalffaceProp(bool _setDrawMode)\
{\
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)\
{\
VolumeMeshObject<MeshT>* object;\
......@@ -198,7 +198,7 @@ template <Template>\
void Classname::visualizeEdgeProp(bool _setDrawMode)\
{\
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)\
{\
VolumeMeshObject<MeshT>* object;\
......@@ -210,7 +210,7 @@ template <Template>\
void Classname::visualizeHalfedgeProp(bool _setDrawMode)\
{\
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)\
{\
VolumeMeshObject<MeshT>* object;\
......@@ -222,7 +222,7 @@ template <Template>\
void Classname::visualizeVertexProp(bool _setDrawMode)\
{\
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)\
{\
VolumeMeshObject<MeshT>* object;\
......
......@@ -59,8 +59,8 @@ public:
protected:
template <typename PropType, typename EntityIterator>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end);
template <typename PropType, typename HandleIterable>
void visualizeProp(PropType prop, HandleIterable handles);
void duplicateProperty() override;
void visualizeFaceProp(bool _setDrawMode = true) override;
......
......@@ -59,8 +59,8 @@ OVMPropertyVisualizerBoolean<MeshT>::OVMPropertyVisualizerBoolean(MeshT* _mesh,
}
template <typename MeshT>
template <typename PropType, typename EntityIterator>
void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end)
template <typename PropType, typename HandleIterable>
void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, HandleIterable handles)
{
if (!prop)
return;
......@@ -74,11 +74,11 @@ void OVMPropertyVisualizerBoolean<MeshT>::visualizeProp(PropType prop, EntityIte
VolumeMeshObject<MeshT>* object;
PluginFunctions::getObject(OVMPropertyVisualizer<MeshT>::mObjectID, object);
for (EntityIterator e_it = e_begin ; e_it != e_end; ++e_it)
if ( prop[*e_it] )
object->colors()[*e_it] = colorTrue;
for (const auto &h: handles)
if ( prop[h] )
object->colors()[h] = colorTrue;
else
object->colors()[*e_it] = colorFalse;
object->colors()[h] = colorFalse;
}
CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerBoolean<MeshT>, typename MeshT, bool)
......
......@@ -63,8 +63,8 @@ public:
virtual ~OVMPropertyVisualizerDouble(){}
protected:
template <typename PropType, typename EntityIterator>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end);
template <typename PropType, typename HandleIterable>
void visualizeProp(PropType prop, HandleIterable handles);
void duplicateProperty() override;
void visualizeFaceProp(bool _setDrawMode = true) override;
......
......@@ -66,9 +66,10 @@ OVMPropertyVisualizerDouble<MeshT>::OVMPropertyVisualizerDouble(MeshT* _mesh, in
}
template <typename MeshT>
template <typename PropType, typename EntityIterator>
void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end)
template <typename PropType, typename HandleIterable>
void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, HandleIterable handles)
{
using Handle = decltype(*begin(handles));
if (!prop) return;
DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget);
......@@ -85,8 +86,8 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
max = FLT_MIN;
}
for (EntityIterator e_it = e_begin; e_it != e_end; ++e_it){
double value = prop[*e_it];
for (const Handle& h: handles) {
double value = prop[h];
if ( doubleWidget->doubleAbsolute->isChecked() ){
min = std::min( min, fabs(value));
max = std::max( max, fabs(value));
......@@ -112,20 +113,20 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
VolumeMeshObject<MeshT>* 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)
object->colors()[*e_it] = colorMin;
object->colors()[h] = colorMin;
else {
double value = prop[*e_it];
double value = prop[h];
// absolut value?
if ( doubleWidget->doubleAbsolute->isChecked())
value = fabs(value);
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:
virtual ~OVMPropertyVisualizerInteger(){}
protected:
template <typename PropType, typename EntityIterator>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end);
template <typename PropType, typename HandleIterable>
void visualizeProp(PropType prop, HandleIterable handles);
void duplicateProperty() override;
void visualizeFaceProp(bool _setDrawMode = true) override;
......
......@@ -69,8 +69,8 @@ OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh
}
template <typename MeshT, typename T>
template <typename PropType, typename EntityIterator>
void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end)
template <typename PropType, typename HandleIterable>
void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, HandleIterable handles)
{
if (!prop) return;
......@@ -86,9 +86,9 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
T min = mNumericLimitMax;
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);
max = std::max( max, value);
}
......@@ -110,12 +110,12 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
VolumeMeshObject<MeshT>* 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)
object->colors()[*e_it] = colorMin;
object->colors()[h] = colorMin;
else {
T value = prop[*e_it];
T value = prop[h];
double pos = (value - min) / (double) range;
ACG::Vec4f color;
if ( integerWidget->intRandom->isChecked() )
......@@ -134,7 +134,7 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
color = cc->color_float4(pos);
}
object->colors()[*e_it] = color;
object->colors()[h] = color;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment