Commit 90b47c75 authored by Jan Möbius's avatar Jan Möbius

Added basic code for TextureControl histogram plotting

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3750 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7628069b
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
include( $$TOPDIR/qmake/all.include ) include( $$TOPDIR/qmake/all.include )
qwt()
Plugin() Plugin()
DIRECTORIES = . DIRECTORIES = .
......
...@@ -401,27 +401,25 @@ void TextureControlPlugin::updateDialog() { ...@@ -401,27 +401,25 @@ void TextureControlPlugin::updateDialog() {
tmp.setNum(textures_[textureid].clamp_max); tmp.setNum(textures_[textureid].clamp_max);
settingsDialog_->clamp_max->setText(tmp); settingsDialog_->clamp_max->setText(tmp);
// // update plot only when dimension is 1 // update plot only when dimension is 1
// if ( textures_[textureid].dimension == 1) { if ( textures_[textureid].dimension == 1) {
// std::vector< double > x,y; std::vector< double > x,y;
//
// // getOriginalHistogram();
//
// }
}
// template< typename MeshT > x.push_back(100.0);
// void TextureControlPlugin::getOriginalHistogram(std::vector< double>& _x, std::vector< double>& _y, y.push_back(100.0);
// int _textureid, MeshT& _mesh,
// OpenMesh::VPropHandleT< double > _texProp) { x.push_back(200.0);
// _x.clear(); y.push_back(150.0);
// _y.clear();
// x.push_back(300.0);
// for ( typename MeshT::VertexIter v_it = _mesh.vertices_begin(); v_it != _mesh.vertices_end(); ++v_it) { y.push_back(10.0);
// double value = _mesh.property(_texProp, v_it);
// } settingsDialog_->setOriginalData(x,y);
//
// } // getOriginalHistogram();
}
}
void TextureControlPlugin::slotSetTextureProperties() { void TextureControlPlugin::slotSetTextureProperties() {
updateDialog(); updateDialog();
......
...@@ -147,6 +147,10 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me ...@@ -147,6 +147,10 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me
template< typename MeshT > template< typename MeshT >
void doUpdateTexture ( int _textureid, MeshT& _mesh); void doUpdateTexture ( int _textureid, MeshT& _mesh);
template< typename MeshT >
void getOriginalHistogram(std::vector< double>& _x, std::vector< double>& _y,
int _textureid, MeshT& _mesh,
OpenMesh::VPropHandleT< double > _texProp);
//=========================================================================== //===========================================================================
/** @name 1D Texture copy functions( copy 1D input textures to target texture coordinates and transform values ) /** @name 1D Texture copy functions( copy 1D input textures to target texture coordinates and transform values )
...@@ -204,5 +208,10 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me ...@@ -204,5 +208,10 @@ class TextureControlPlugin : public QObject, BaseInterface, TextureInterface, Me
#include "TextureControl2DTextureHandlingT.cc" #include "TextureControl2DTextureHandlingT.cc"
#endif #endif
#if defined(INCLUDE_TEMPLATES) && !defined(TEXTURECONTROL_HISTOGRAMS_C)
#define TEXTURECONTROL_HISTOGRAMS_TEMPLATES
#include "TextureControlHistogramsT.cc"
#endif
#endif //TEXTURECONTROLPLUGIN_HH #endif //TEXTURECONTROLPLUGIN_HH
...@@ -33,6 +33,12 @@ ...@@ -33,6 +33,12 @@
#include "textureProperties.hh" #include "textureProperties.hh"
#include <qwt_plot_grid.h>
#include <qwt_text.h>
#include <qwt_plot.h>
#include <float.h>
#include <QtGui> #include <QtGui>
texturePropertiesWidget::texturePropertiesWidget(QWidget *parent) texturePropertiesWidget::texturePropertiesWidget(QWidget *parent)
...@@ -40,11 +46,57 @@ texturePropertiesWidget::texturePropertiesWidget(QWidget *parent) ...@@ -40,11 +46,57 @@ texturePropertiesWidget::texturePropertiesWidget(QWidget *parent)
{ {
setupUi(this); setupUi(this);
// QGridLayout* layout = new QGridLayout( originalData); QGridLayout* layout = new QGridLayout( originalData);
// originalDataHistogram_ = new QwtPlot(0); originalDataHistogram_ = new QwtPlot(0);
//
// layout->addWidget( originalDataHistogram_ , 0,0 ); layout->addWidget( originalDataHistogram_ , 0,0 );
QwtText axis_title_x("value");
// axis_title_x.setFont(arial);
QwtText axis_title_y("count");
// axis_title_y.setFont(arial);
originalDataHistogram_->setAxisTitle(QwtPlot::xBottom, axis_title_x);
originalDataHistogram_->setAxisTitle(QwtPlot::yLeft, axis_title_y);
originalDataHistogram_->setCanvasBackground(Qt::white);
QwtPlotGrid *grid2 = new QwtPlotGrid;
grid2->enableYMin(true);
grid2->enableXMin(true);
grid2->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
grid2->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid2->attach(originalDataHistogram_);
QwtText curve_title("Delay Spread Histogram");
// curve_title.setFont(arial);
histogramCurve_.setTitle(curve_title);
histogramCurve_.attach(originalDataHistogram_);
// connect(distanceCheckBox,SIGNAL(stateChanged ( int ) ) , this , SLOT (slotDistanceCheckbox(int)) ); // connect(distanceCheckBox,SIGNAL(stateChanged ( int ) ) , this , SLOT (slotDistanceCheckbox(int)) );
// connect(normalCheckBox,SIGNAL(stateChanged ( int ) ) , this , SLOT (slotNormalCheckbox(int)) ); // connect(normalCheckBox,SIGNAL(stateChanged ( int ) ) , this , SLOT (slotNormalCheckbox(int)) );
}
void texturePropertiesWidget::setOriginalData(std::vector< double > _x, std::vector< double > _y ) {
double minx = FLT_MIN;
double maxx = FLT_MIN;
double miny = FLT_MAX;
double maxy = FLT_MIN;
for ( uint i = 0 ; i < _x.size(); ++ i ) {
minx = std::min(minx,_x[0]);
maxx = std::max(maxx,_x[0]);
miny = std::min(miny,_y[0]);
maxy = std::max(maxy,_y[0]);
}
histogramCurve_.setData(&_x[0], &_y[0], _x.size());
originalDataHistogram_->replot();
} }
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "ui_textureProperties.hh" #include "ui_textureProperties.hh"
#include <QtGui> #include <QtGui>
// #include <qwt_plot.h> #include <qwt_plot_curve.h>
class texturePropertiesWidget : public QDialog, public Ui::Dialog class texturePropertiesWidget : public QDialog, public Ui::Dialog
{ {
...@@ -43,6 +43,11 @@ class texturePropertiesWidget : public QDialog, public Ui::Dialog ...@@ -43,6 +43,11 @@ class texturePropertiesWidget : public QDialog, public Ui::Dialog
public: public:
texturePropertiesWidget(QWidget *parent = 0); texturePropertiesWidget(QWidget *parent = 0);
// QwtPlot* originalDataHistogram_; void setOriginalData(std::vector< double > _x, std::vector< double > _y );
private:
QwtPlot* originalDataHistogram_;
QwtPlotCurve histogramCurve_;
}; };
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