textureProperties.cc 3.09 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//=============================================================================
//
//                               OpenFlipper
//        Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
//                           www.openflipper.org
//
//-----------------------------------------------------------------------------
//
//                                License
//
//  OpenFlipper is free software: you can redistribute it and/or modify
//  it under the terms of the GNU Lesser General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
Jan Möbius's avatar
Jan Möbius committed
15
//
Jan Möbius's avatar
 
Jan Möbius committed
16 17 18 19
//  OpenFlipper is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
Jan Möbius's avatar
Jan Möbius committed
20
//
Jan Möbius's avatar
 
Jan Möbius committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
//  You should have received a copy of the GNU Lesser General Public License
//  along with OpenFlipper.  If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




#include "textureProperties.hh"
36 37 38 39 40 41

#include <qwt_plot_grid.h>
#include <qwt_text.h>
#include <qwt_plot.h>
#include <float.h>

Jan Möbius's avatar
 
Jan Möbius committed
42 43 44 45 46 47
#include <QtGui>

texturePropertiesWidget::texturePropertiesWidget(QWidget *parent)
    : QDialog(parent)
{
    setupUi(this);
Jan Möbius's avatar
Jan Möbius committed
48

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    QGridLayout* layout = new QGridLayout( originalData);
    originalDataHistogram_ = new QwtPlot(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_);







Jan Möbius's avatar
Jan Möbius committed
81

Jan Möbius's avatar
 
Jan Möbius committed
82 83
//     connect(distanceCheckBox,SIGNAL(stateChanged ( int ) ) , this , SLOT (slotDistanceCheckbox(int)) );
//     connect(normalCheckBox,SIGNAL(stateChanged ( int ) ) , this , SLOT (slotNormalCheckbox(int)) );
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101


}

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();
Jan Möbius's avatar
 
Jan Möbius committed
102
}