Commit 2f87f2ba authored by Jan Möbius's avatar Jan Möbius

More cleanup

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14053 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 004fea51
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include <OpenFlipper/common/bsp/TriangleBSPT.hh> #include <OpenFlipper/common/bsp/TriangleBSPT.hh>
#include <ACG/Geometry/Algorithms.hh> #include <ACG/Geometry/Algorithms.hh>
#include <ACG/Scenegraph/PointNode.hh>
#include <ACG/Utils/ColorCoder.hh> #include <ACG/Utils/ColorCoder.hh>
...@@ -95,8 +94,7 @@ void MeshComparePlugin::initializePlugin() ...@@ -95,8 +94,7 @@ void MeshComparePlugin::initializePlugin()
layout->addWidget(plot_); layout->addWidget(plot_);
#else #else
// Hide the extra frame as QWT is not available, we will not have an histogramm
// Hide the extra frame
tool_->frame->hide(); tool_->frame->hide();
#endif #endif
} }
...@@ -387,7 +385,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b ...@@ -387,7 +385,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
if (meanCurvature) { if (meanCurvature) {
TriMesh::Scalar curvature = 0.0; TriMesh::Scalar curvature = 0.0;
curvature = compMesh->property(meanComp, v0) * projectedPoint[0]; curvature = compMesh->property(meanComp, v0) * projectedPoint[0];
curvature += compMesh->property(meanComp, v1) * projectedPoint[1]; curvature += compMesh->property(meanComp, v1) * projectedPoint[1];
curvature += compMesh->property(meanComp, v2) * projectedPoint[2]; curvature += compMesh->property(meanComp, v2) * projectedPoint[2];
...@@ -402,7 +400,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b ...@@ -402,7 +400,7 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
if (gaussCurvature) { if (gaussCurvature) {
TriMesh::Scalar curvature = 0.0; TriMesh::Scalar curvature = 0.0;
curvature = compMesh->property(gaussComp, v0) * projectedPoint[0]; curvature = compMesh->property(gaussComp, v0) * projectedPoint[0];
curvature += compMesh->property(gaussComp, v1) * projectedPoint[1]; curvature += compMesh->property(gaussComp, v1) * projectedPoint[1];
curvature += compMesh->property(gaussComp, v2) * projectedPoint[2]; curvature += compMesh->property(gaussComp, v2) * projectedPoint[2];
...@@ -421,102 +419,50 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b ...@@ -421,102 +419,50 @@ void MeshComparePlugin::compare(int _sourceId,int _targetId,bool _computeDist, b
tool_->minValue->setText( QString::number(0.0) ); tool_->minValue->setText( QString::number(0.0) );
double min = 0.0;
double max = 1.0;
if ( tool_->distance->isChecked() ) { if ( tool_->distance->isChecked() ) {
tool_->maxValue->setText( QString::number(maximalDistance_) ); visualizeData(distances,maximalDistance_,pNode);
if ( tool_->doClamp->isChecked() ) {
min = tool_->minVal->value();
max = std::min(tool_->maxVal->value(),maximalDistance_);
} else
max = maximalDistance_;
ACG::ColorCoder cCoder(min,max);
for ( unsigned int i = 0 ; i < distances.size() ; ++i) {
pNode->add_color(cCoder.color_float4(distances[i]));
}
#ifdef WITH_QWT
plot_->setMinMax(min,max);
plot_->setFunction( distances );
plot_->replot();
#endif
} else if ( tool_->normalAngle->isChecked() ) { } else if ( tool_->normalAngle->isChecked() ) {
tool_->maxValue->setText( QString::number(maxNormalDeviation_) ); visualizeData(normalAngles,maxNormalDeviation_,pNode);
if ( tool_->doClamp->isChecked() ) {
min = tool_->minVal->value();
max = std::min(tool_->maxVal->value(),maxNormalDeviation_);
} else
max = maxNormalDeviation_;
ACG::ColorCoder cCoder(min,max);
for ( unsigned int i = 0 ; i < normalAngles.size() ; ++i) {
pNode->add_color(cCoder.color_float4(normalAngles[i]));
}
#ifdef WITH_QWT
plot_->setMinMax(min,max);
plot_->setFunction( normalAngles );
plot_->replot();
#endif
} else if ( tool_->meanCurvature->isChecked() ) { } else if ( tool_->meanCurvature->isChecked() ) {
tool_->maxValue->setText( QString::number(maxMeanCurvatureDev_) ); visualizeData(meanCurvatures,maxMeanCurvatureDev_,pNode);
if ( tool_->doClamp->isChecked() ) {
min = tool_->minVal->value();
max = std::min(tool_->maxVal->value(),maxMeanCurvatureDev_);
} else
max = maxMeanCurvatureDev_;
ACG::ColorCoder cCoder(min,max);
for ( unsigned int i = 0 ; i < meanCurvatures.size() ; ++i) {
pNode->add_color(cCoder.color_float4(meanCurvatures[i]));
}
#ifdef WITH_QWT
plot_->setMinMax(min,max);
plot_->setFunction( meanCurvatures );
plot_->replot();
#endif
} else if ( tool_->gaussCurvature->isChecked() ) { } else if ( tool_->gaussCurvature->isChecked() ) {
tool_->maxValue->setText( QString::number(maxGaussCurvatureDev_) ); visualizeData(gaussCurvatures,maxGaussCurvatureDev_,pNode);
}
if ( tool_->doClamp->isChecked() ) { emit updateView();
min = tool_->minVal->value(); }
max = std::min(tool_->maxVal->value(),maxGaussCurvatureDev_);
} else
max = maxGaussCurvatureDev_;
ACG::ColorCoder cCoder(min,max); }
for ( unsigned int i = 0 ; i < gaussCurvatures.size() ; ++i) { void MeshComparePlugin::visualizeData( const std::vector<double>& _data, double _maxValue, ACG::SceneGraph::PointNode* _pnode ) {
pNode->add_color(cCoder.color_float4(gaussCurvatures[i]));
}
#ifdef WITH_QWT // Set the current real maximal value in the label to show it to the user
plot_->setMinMax(min,max); tool_->maxValue->setText( QString::number(_maxValue) );
plot_->setFunction( gaussCurvatures );
plot_->replot();
#endif
} // If the clamping check box is set, we take the values from the spin boxes
double min = 0.0;
double max = 1.0;
if ( tool_->doClamp->isChecked() ) {
min = tool_->minVal->value();
max = std::min(tool_->maxVal->value(),_maxValue);
} else
max = _maxValue;
emit updateView(); ACG::ColorCoder cCoder(min,max);
for ( unsigned int i = 0 ; i < _data.size() ; ++i) {
_pnode->add_color(cCoder.color_float4(_data[i]));
} }
#ifdef WITH_QWT
plot_->setMinMax(min,max);
plot_->setFunction( _data );
plot_->replot();
#endif
} }
Q_EXPORT_PLUGIN2( meshcompareplugin , MeshComparePlugin ); Q_EXPORT_PLUGIN2( meshcompareplugin , MeshComparePlugin );
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
#include <OpenFlipper/BasePlugin/RPCInterface.hh> #include <OpenFlipper/BasePlugin/RPCInterface.hh>
#include <OpenFlipper/common/Types.hh> #include <OpenFlipper/common/Types.hh>
#include <ACG/Scenegraph/PointNode.hh>
#include "MeshCompareToolbarWidget.hh" #include "MeshCompareToolbarWidget.hh"
#ifdef WITH_QWT #ifdef WITH_QWT
...@@ -156,6 +158,17 @@ class MeshComparePlugin : public QObject, BaseInterface, ToolboxInterface, Loggi ...@@ -156,6 +158,17 @@ class MeshComparePlugin : public QObject, BaseInterface, ToolboxInterface, Loggi
/// If the checkbox is changed to be checked, the values in the labels will be written into the spin boxes. /// If the checkbox is changed to be checked, the values in the labels will be written into the spin boxes.
void slotClampBox(bool _checked); void slotClampBox(bool _checked);
private:
/** \brief Visualize data
*
* This function visualizes the data via rendering points and pushes it to the histogram.
*
* @param _data Vector of data points
* @param _maxValue Maximal value found in the data
*/
void visualizeData( const std::vector<double>& _data, double _maxValue, ACG::SceneGraph::PointNode* _pnode);
private: private:
/// The toolbar widget of this plugin /// The toolbar widget of this plugin
MeshCompareToolbarWidget* tool_; MeshCompareToolbarWidget* tool_;
......
...@@ -106,7 +106,7 @@ QwtFunctionPlot::QwtFunctionPlot(QWidget* _parent) : ...@@ -106,7 +106,7 @@ QwtFunctionPlot::QwtFunctionPlot(QWidget* _parent) :
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void QwtFunctionPlot::setFunction( std::vector<double>& _values) void QwtFunctionPlot::setFunction(const std::vector<double>& _values)
{ {
values_ = _values; values_ = _values;
} }
......
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
~QwtFunctionPlot() {} ~QwtFunctionPlot() {}
/// set the function to plot /// set the function to plot
void setFunction( std::vector<double>& _values ); void setFunction(const std::vector<double>& _values );
void setMinMax(double _min, double _max); void setMinMax(double _min, double _max);
......
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