Commit 9dbcb099 authored by Martin Heistermann's avatar Martin Heistermann

Extract Interface from ColorCoder, implement RGB-Linear CC, use it in propvis for double+int.

parent a9a0e559
...@@ -125,7 +125,6 @@ protected: ...@@ -125,7 +125,6 @@ protected:
virtual void setHalfedgePropertyFromText(unsigned int index, QString text); virtual void setHalfedgePropertyFromText(unsigned int index, QString text);
virtual void setVertexPropertyFromText(unsigned int index, QString text); virtual void setVertexPropertyFromText(unsigned int index, QString text);
OpenMesh::Vec4f convertColor(QColor color);
virtual void setPropertyFromText(unsigned int index, QString text); virtual void setPropertyFromText(unsigned int index, QString text);
virtual int getEntityCount(); virtual int getEntityCount();
......
...@@ -70,7 +70,6 @@ public: ...@@ -70,7 +70,6 @@ public:
virtual ~OMPropertyVisualizerDouble(){} virtual ~OMPropertyVisualizerDouble(){}
protected: protected:
virtual void visualizeFaceProp(bool _setDrawMode = true); virtual void visualizeFaceProp(bool _setDrawMode = true);
virtual void visualizeEdgeProp(bool _setDrawMode = true); virtual void visualizeEdgeProp(bool _setDrawMode = true);
virtual void visualizeHalfedgeProp(bool _setDrawMode = true); virtual void visualizeHalfedgeProp(bool _setDrawMode = true);
......
...@@ -66,13 +66,11 @@ template <typename MeshT> ...@@ -66,13 +66,11 @@ template <typename MeshT>
void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp(bool _setDrawMode) void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp(bool _setDrawMode)
{ {
DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget); DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax;
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); typename MeshT::Color colorMin = ACG::to_Vec4f(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color coder in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::IColorCoder *cc = doubleWidget->buildColorCoder();
OpenMesh::FPropHandleT< double > prop; OpenMesh::FPropHandleT< double > prop;
...@@ -133,18 +131,13 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp(bool _setDrawMode) ...@@ -133,18 +131,13 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp(bool _setDrawMode)
v = std::min(max,v); v = std::min(max,v);
double t = (v-min)/range; double t = (v-min)/range;
typename MeshT::Color color = cc->color_float4(t);
typename MeshT::Color color;
if( doubleWidget->doubleColorCoder->isChecked())
color = cc.color_float4(t);
else
color = (colorMin)*(1.0-t) + (colorMax)*t;
// set color // set color
OMPropertyVisualizer<MeshT>::mesh->set_color(*f_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*f_it, color);
} }
} }
delete cc;
if (_setDrawMode) if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);
...@@ -154,15 +147,12 @@ template <typename MeshT> ...@@ -154,15 +147,12 @@ template <typename MeshT>
void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp(bool _setDrawMode) void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp(bool _setDrawMode)
{ {
DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget); DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax; typename MeshT::Color colorMin;
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); colorMin = ACG::to_Vec4f(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color coder in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::IColorCoder *cc = doubleWidget->buildColorCoder();
//TODO check if this also works if the property is Vec3d //TODO check if this also works if the property is Vec3d
OpenMesh::EPropHandleT< double > prop; OpenMesh::EPropHandleT< double > prop;
...@@ -225,19 +215,13 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp(bool _setDrawMode) ...@@ -225,19 +215,13 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp(bool _setDrawMode)
v = std::min(max,v); v = std::min(max,v);
double t = (v-min)/range; double t = (v-min)/range;
typename MeshT::Color color = cc->color_float4(t);
typename MeshT::Color color;
if( doubleWidget->doubleColorCoder->isChecked())
color = cc.color_float4(t);
else
color = (colorMin)*(1.0-t) + (colorMax)*t;
// set color // set color
OMPropertyVisualizer<MeshT>::mesh->set_color(*e_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*e_it, color);
} }
} }
delete cc;
if (_setDrawMode) if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED); PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::EDGES_COLORED);
...@@ -248,14 +232,11 @@ template <typename MeshT> ...@@ -248,14 +232,11 @@ template <typename MeshT>
void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp(bool _setDrawMode) void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
{ {
DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget); DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax;
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); typename MeshT::Color colorMin = ACG::to_Vec4f(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color coder in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::IColorCoder *cc = doubleWidget->buildColorCoder();
//TODO check if this also works if the property is Vec3d //TODO check if this also works if the property is Vec3d
OpenMesh::HPropHandleT< double > prop; OpenMesh::HPropHandleT< double > prop;
...@@ -317,14 +298,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp(bool _setDrawMode) ...@@ -317,14 +298,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
v = std::min(max,v); v = std::min(max,v);
double t = (v-min)/range; double t = (v-min)/range;
typename MeshT::Color color = cc->color_float4(t);
typename MeshT::Color color;
if( doubleWidget->doubleColorCoder->isChecked())
color = cc.color_float4(t);
else {
color = (colorMin)*(1.0-t) + (colorMax)*t;
}
// set color // set color
OMPropertyVisualizer<MeshT>::mesh->set_color(*he_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*he_it, color);
...@@ -338,13 +312,11 @@ template <typename MeshT> ...@@ -338,13 +312,11 @@ template <typename MeshT>
void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp(bool _setDrawMode) void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp(bool _setDrawMode)
{ {
DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget); DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax;
colorMin = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMin->color()); typename MeshT::Color colorMin = ACG::to_Vec4f(doubleWidget->doubleMin->color());
colorMax = OMPropertyVisualizer<MeshT>::convertColor(doubleWidget->doubleMax->color());
// color coder in [0,1] // color coder in [0,1]
ACG::ColorCoder cc; ACG::IColorCoder *cc = doubleWidget->buildColorCoder();
//TODO check if this also works if the property is Vec3d //TODO check if this also works if the property is Vec3d
OpenMesh::VPropHandleT< double > prop; OpenMesh::VPropHandleT< double > prop;
...@@ -406,14 +378,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp(bool _setDrawMode) ...@@ -406,14 +378,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp(bool _setDrawMode)
v = std::min(max,v); v = std::min(max,v);
double t = (v-min)/range; double t = (v-min)/range;
typename MeshT::Color color = cc->color_float4(t);
typename MeshT::Color color;
if( doubleWidget->doubleColorCoder->isChecked())
color = cc.color_float4(t);
else {
color = (colorMin)*(1.0-t) + (colorMax)*t;
}
// set color // set color
OMPropertyVisualizer<MeshT>::mesh->set_color(*v_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*v_it, color);
......
...@@ -66,7 +66,6 @@ public: ...@@ -66,7 +66,6 @@ public:
virtual ~OMPropertyVisualizerInteger(){} virtual ~OMPropertyVisualizerInteger(){}
protected: protected:
virtual void visualizeFaceProp(bool _setDrawMode = true); virtual void visualizeFaceProp(bool _setDrawMode = true);
virtual void visualizeEdgeProp(bool _setDrawMode = true); virtual void visualizeEdgeProp(bool _setDrawMode = true);
virtual void visualizeHalfedgeProp(bool _setDrawMode = true); virtual void visualizeHalfedgeProp(bool _setDrawMode = true);
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#define OM_PROPERTY_VISUALIZER_INTEGER_CC #define OM_PROPERTY_VISUALIZER_INTEGER_CC
#include <ACG/Utils/IColorCoder.hh>
#include <ACG/Utils/ColorConversion.hh> #include <ACG/Utils/ColorConversion.hh>
#include "OMPropertyVisualizerInteger.hh" #include "OMPropertyVisualizerInteger.hh"
...@@ -78,13 +79,9 @@ template <typename MeshT, typename T> ...@@ -78,13 +79,9 @@ template <typename MeshT, typename T>
void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode) void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode)
{ {
IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget); IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax;
colorMin = ACG::to_Vec4f(integerWidget->intMin->color()); typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
colorMax = ACG::to_Vec4f(integerWidget->intMax->color()); ACG::IColorCoder *cc = integerWidget->buildColorCoder(); // color coder in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -132,19 +129,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode) ...@@ -132,19 +129,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode)
typename MeshT::Color color; typename MeshT::Color color;
if (integerWidget->intColorCoder->isChecked()) if (integerWidget->intRandom->isChecked() ){
{
color = cc.color_float4(pos);
}
else if ( !integerWidget->intRandom->isChecked() ){
color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
color[3] = 1.0;
} else {
if ( randomColor.find( getValue(prop, f_it) ) == randomColor.end() ){ if ( randomColor.find( getValue(prop, f_it) ) == randomColor.end() ){
color = mColorGenerator.generateNextColor(); color = mColorGenerator.generateNextColor();
...@@ -154,11 +139,14 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode) ...@@ -154,11 +139,14 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode)
} }
color = randomColor[ getValue(prop, f_it) ]; color = randomColor[ getValue(prop, f_it) ];
} else {
color = cc->color_float4(pos);
} }
OMPropertyVisualizer<MeshT>::mesh->set_color(*f_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*f_it, color);
} }
} }
delete cc;
if (_setDrawMode) if (_setDrawMode)
PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED); PluginFunctions::setDrawMode(ACG::SceneGraph::DrawModes::SOLID_FACES_COLORED);
...@@ -168,13 +156,9 @@ template <typename MeshT, typename T> ...@@ -168,13 +156,9 @@ template <typename MeshT, typename T>
void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp(bool _setDrawMode) void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp(bool _setDrawMode)
{ {
IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget); IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax;
colorMin = ACG::to_Vec4f(integerWidget->intMin->color()); typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
colorMax = ACG::to_Vec4f(integerWidget->intMax->color()); ACG::IColorCoder *cc = integerWidget->buildColorCoder(); // color coder in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -222,19 +206,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp(bool _setDrawMode) ...@@ -222,19 +206,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp(bool _setDrawMode)
typename MeshT::Color color; typename MeshT::Color color;
if (integerWidget->intColorCoder->isChecked()) if (integerWidget->intRandom->isChecked() ){
{
color = cc.color_float4(pos);
}
else if ( !integerWidget->intRandom->isChecked() ){
color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
color[3] = 1.0;
} else {
if ( randomColor.find( getValue(prop, e_it) ) == randomColor.end() ){ if ( randomColor.find( getValue(prop, e_it) ) == randomColor.end() ){
color = mColorGenerator.generateNextColor(); color = mColorGenerator.generateNextColor();
...@@ -244,6 +216,8 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp(bool _setDrawMode) ...@@ -244,6 +216,8 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp(bool _setDrawMode)
} }
color = randomColor[ getValue(prop, e_it) ]; color = randomColor[ getValue(prop, e_it) ];
} else {
color = cc->color_float4(pos);
} }
OMPropertyVisualizer<MeshT>::mesh->set_color(*e_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*e_it, color);
...@@ -259,13 +233,9 @@ template <typename MeshT, typename T> ...@@ -259,13 +233,9 @@ template <typename MeshT, typename T>
void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp(bool _setDrawMode) void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp(bool _setDrawMode)
{ {
IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget); IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax;
colorMin = ACG::to_Vec4f(integerWidget->intMin->color()); typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
colorMax = ACG::to_Vec4f(integerWidget->intMax->color()); ACG::IColorCoder *cc = integerWidget->buildColorCoder(); // color coder in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -313,19 +283,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp(bool _setDrawM ...@@ -313,19 +283,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp(bool _setDrawM
typename MeshT::Color color; typename MeshT::Color color;
if (integerWidget->intColorCoder->isChecked()) if (integerWidget->intRandom->isChecked() ){
{
color = cc.color_float4(pos);
}
else if ( !integerWidget->intRandom->isChecked() ){
color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
color[3] = 1.0;
} else {
if ( randomColor.find( getValue(prop, he_it) ) == randomColor.end() ){ if ( randomColor.find( getValue(prop, he_it) ) == randomColor.end() ){
color = mColorGenerator.generateNextColor(); color = mColorGenerator.generateNextColor();
...@@ -335,6 +293,8 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp(bool _setDrawM ...@@ -335,6 +293,8 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp(bool _setDrawM
} }
color = randomColor[ getValue(prop, he_it) ]; color = randomColor[ getValue(prop, he_it) ];
} else {
color = cc->color_float4(pos);
} }
OMPropertyVisualizer<MeshT>::mesh->set_color(*he_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*he_it, color);
...@@ -349,13 +309,9 @@ template <typename MeshT, typename T> ...@@ -349,13 +309,9 @@ template <typename MeshT, typename T>
void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMode) void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMode)
{ {
IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget); IntegerWidget* integerWidget = static_cast<IntegerWidget*>(PropertyVisualizer::widget);
typename MeshT::Color colorMin, colorMax;
colorMin = ACG::to_Vec4f(integerWidget->intMin->color()); typename MeshT::Color colorMin = ACG::to_Vec4f(integerWidget->intMin->color());
colorMax = ACG::to_Vec4f(integerWidget->intMax->color()); ACG::IColorCoder *cc = integerWidget->buildColorCoder(); // color coder in [0,1]
// color coder in [0,1]
ACG::ColorCoder cc;
std::map< int, typename MeshT::Color> randomColor; std::map< int, typename MeshT::Color> randomColor;
...@@ -403,21 +359,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMod ...@@ -403,21 +359,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMod
typename MeshT::Color color; typename MeshT::Color color;
if (integerWidget->intColorCoder->isChecked()) if (integerWidget->intRandom->isChecked() ){
{
color = cc.color_float4(pos);
}
else if ( !integerWidget->intRandom->isChecked() ){
color[0] = colorMin[0] * (1-pos) + pos * colorMax[0];
color[1] = colorMin[1] * (1-pos) + pos * colorMax[1];
color[2] = colorMin[2] * (1-pos) + pos * colorMax[2];
color[3] = 1.0;
}
else
{
if ( randomColor.find( getValue(prop, v_it) ) == randomColor.end() ){ if ( randomColor.find( getValue(prop, v_it) ) == randomColor.end() ){
color = mColorGenerator.generateNextColor(); color = mColorGenerator.generateNextColor();
...@@ -427,6 +369,8 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMod ...@@ -427,6 +369,8 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMod
} }
color = randomColor[ getValue(prop, v_it) ]; color = randomColor[ getValue(prop, v_it) ];
} else {
color = cc->color_float4(pos);
} }
OMPropertyVisualizer<MeshT>::mesh->set_color(*v_it, color); OMPropertyVisualizer<MeshT>::mesh->set_color(*v_it, color);
......
...@@ -348,20 +348,6 @@ void OMPropertyVisualizer<MeshT>::clear() ...@@ -348,20 +348,6 @@ void OMPropertyVisualizer<MeshT>::clear()
clearVertexProp(); clearVertexProp();
} }
template <typename MeshT>
OpenMesh::Vec4f OMPropertyVisualizer<MeshT>::convertColor(const QColor _color){
OpenMesh::Vec4f color;
color[0] = _color.redF();
color[1] = _color.greenF();
color[2] = _color.blueF();
color[3] = _color.alphaF();
return color;
}
template <typename MeshT> template <typename MeshT>
void OMPropertyVisualizer<MeshT>::visualizeFaceProp(bool /*_setDrawMode*/) void OMPropertyVisualizer<MeshT>::visualizeFaceProp(bool /*_setDrawMode*/)
{ {
......
...@@ -110,8 +110,6 @@ protected: ...@@ -110,8 +110,6 @@ protected:
template<typename PropType> template<typename PropType>
void duplicateProperty_stage1(); void duplicateProperty_stage1();
OpenMesh::Vec4f convertColor(QColor color);
template <typename InnerType> template <typename InnerType>
QString getPropertyText_(unsigned int index); QString getPropertyText_(unsigned int index);
......
...@@ -58,9 +58,7 @@ ...@@ -58,9 +58,7 @@
#include <OpenFlipper/BasePlugin/PluginFunctions.hh> #include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <ACG/Utils/ColorCoder.hh> #include <ACG/Utils/IColorCoder.hh>
#include <iostream> #include <iostream>
...@@ -72,7 +70,6 @@ public: ...@@ -72,7 +70,6 @@ public:
virtual ~OVMPropertyVisualizerDouble(){} virtual ~OVMPropertyVisualizerDouble(){}
protected: protected:
template <typename PropType, typename EntityIterator> template <typename PropType, typename EntityIterator>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end); void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end);
virtual void duplicateProperty(); virtual void duplicateProperty();
......
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
#include <ACG/Utils/LinearTwoColorCoder.hh> #include <ACG/Utils/LinearTwoColorCoder.hh>
#include <ACG/Utils/ColorConversion.hh> #include <ACG/Utils/ColorConversion.hh>
#include <QObject>
template <typename MeshT> template <typename MeshT>
OVMPropertyVisualizerDouble<MeshT>::OVMPropertyVisualizerDouble(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo) OVMPropertyVisualizerDouble<MeshT>::OVMPropertyVisualizerDouble(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo)
: OVMPropertyVisualizer<MeshT>(_mesh, objectID, _propertyInfo) : OVMPropertyVisualizer<MeshT>(_mesh, objectID, _propertyInfo)
...@@ -77,11 +75,8 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter ...@@ -77,11 +75,8 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget); DoubleWidget* doubleWidget = static_cast<DoubleWidget*>(PropertyVisualizer::widget);
ACG::Vec4f colorMin = ACG::to_Vec4f(doubleWidget->doubleMin->color()); ACG::Vec4f colorMin = ACG::to_Vec4f(doubleWidget->doubleMin->color());
ACG::Vec4f colorMax = ACG::to_Vec4f(doubleWidget->doubleMax->color());
// color coder in [0,1]
ACG::ColorCoder cc;
ACG::IColorCoder *cc = doubleWidget->buildColorCoder();
double min, max; double min, max;
if ( doubleWidget->doubleAbsolute->isChecked() ){ if ( doubleWidget->doubleAbsolute->isChecked() ){
...@@ -137,13 +132,7 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter ...@@ -137,13 +132,7 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
double t = (value-min)/range; double t = (value-min)/range;
ACG::Vec4f color; ACG::Vec4f color = cc->color_float4(t);
if( doubleWidget->doubleColorCoder->isChecked())
color = cc.color_float4(t);
else {
color = (colorMin)*(1.0-t) + (colorMax)*t;
}
if (doubleWidget->doubleMapOutsideRange->isChecked()) { if (doubleWidget->doubleMapOutsideRange->isChecked()) {
if (prop[*e_it] < min || prop[*e_it] > max) if (prop[*e_it] < min || prop[*e_it] > max)
...@@ -154,6 +143,7 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter ...@@ -154,6 +143,7 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
object->colors()[*e_it] = color; object->colors()[*e_it] = color;
} }
} }
delete cc;
} }
CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerDouble<MeshT>, typename MeshT, double) CALLS_TO_VISUALIZE_PROP(OVMPropertyVisualizerDouble<MeshT>, typename MeshT, double)
......
...@@ -68,7 +68,6 @@ public: ...@@ -68,7 +68,6 @@ public:
virtual ~OVMPropertyVisualizerInteger(){} virtual ~OVMPropertyVisualizerInteger(){}
protected: protected:
template <typename PropType, typename EntityIterator> template <typename PropType, typename EntityIterator>
void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end); void visualizeProp(PropType prop, EntityIterator e_begin, EntityIterator e_end);
virtual void duplicateProperty(); virtual void duplicateProperty();
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "OVMPropertyVisualizerInteger.hh" #include "OVMPropertyVisualizerInteger.hh"
#include <ACG/Utils/ColorConversion.hh> #include <ACG/Utils/ColorConversion.hh>
#include <ACG/Utils/LinearTwoColorCoder.hh>
template <typename MeshT, typename T> template <typename MeshT, typename T>
OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh, int objectID, PropertyInfo _propertyInfo, bool isUnsigned)