COPASI API  4.16.103
Classes | Public Slots | Public Member Functions | Public Attributes | Private Member Functions | List of all members
CQBarChart Class Reference

#include <qwt3dPlot.h>

Inheritance diagram for CQBarChart:
Inheritance graph
[legend]
Collaboration diagram for CQBarChart:
Collaboration graph
[legend]

Classes

struct  Data
 

Public Slots

void hotKeysMessage ()
 
void saveDataToFile ()
 
void showLegend ()
 

Public Member Functions

 CQBarChart (QWidget *parent=0, const char *name=0)
 
void emptyPlot ()
 
int getColSliderPos ()
 
int getRowSliderPos ()
 
void plotData ()
 
void resizeCoordSys ()
 
void setAxes ()
 
void setColors (std::vector< QColor > mColors, double min, double max)
 
void setData (double **data, int columns, int rows, double valueZone)
 
void setData ()
 
void setDescriptions (const std::vector< std::string > *columnsDes, const std::vector< std::string > *rowsDes)
 
void setLegend ()
 
void setPlotTitle ()
 
void setPlotTitle (QString title)
 
void setScale (const std::vector< std::string > *columnsDescript, const std::vector< std::string > *rowsDescript)
 
void setSlider ()
 
void setZoom ()
 
void showColorLegend (bool CLegend)
 
virtual void sliderMoved (int column, int row)
 
virtual ~CQBarChart ()
 
- Public Member Functions inherited from CQBaseWidget
 CQBaseWidget (QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
 
bool isSliderActive () const
 
int scaleFactor ()
 
void setSliderActive (const bool &active)
 
virtual ~CQBaseWidget ()
 

Public Attributes

double ** data
 
bool mColorLegend
 
Data mData
 
BarmpBar
 
const std::vector< std::string > * mpColumnScale
 
const std::vector< std::string > * mpRowScale
 
QString mTitle
 

Private Member Functions

void contextMenuEvent (QContextMenuEvent *)
 

Additional Inherited Members

- Protected Slots inherited from CQBaseWidget
void setSlider ()
 
- Protected Attributes inherited from CQBaseWidget
int mScaleFactor
 
bool mSliderActive
 

Detailed Description

Definition at line 26 of file qwt3dPlot.h.

Constructor & Destructor Documentation

CQBarChart::CQBarChart ( QWidget *  parent = 0,
const char *  name = 0 
)

Definition at line 35 of file qwt3dPlot.cpp.

References CQBarChart::Data::maxValue, mColorLegend, mData, CQBarChart::Data::minValue, and mTitle.

35  :
36  CQBaseWidget(parent, name),
37  mpBar(NULL),
38  mTitle(),
39  data(NULL),
40  mpColumnScale(NULL),
41  mpRowScale(NULL),
42  mColorLegend(true)
43 {
44  mpPlot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
45  mpPlot->setRotation(30, 0, 15);
46  //setScale(1,1,1);
47  mpPlot->setShift(0, 0, 0);
48 
49  mTitle = QString("");
50  mColorLegend = true;
51 
52  mData.maxValue = 0;
53  mData.minValue = 0;
54 
55  mpPlot->coordinates()->setAutoScale(false);
56  mpPlot->updateData();
57  mpPlot->updateGL();
58 }
Data mData
Definition: qwt3dPlot.h:45
double maxValue
Definition: qwt3dPlot.h:41
Bar * mpBar
Definition: qwt3dPlot.h:49
CQBaseWidget(QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
double minValue
Definition: qwt3dPlot.h:42
const std::vector< std::string > * mpRowScale
Definition: qwt3dPlot.h:53
double ** data
Definition: qwt3dPlot.h:51
const std::vector< std::string > * mpColumnScale
Definition: qwt3dPlot.h:52
QString mTitle
Definition: qwt3dPlot.h:50
bool mColorLegend
Definition: qwt3dPlot.h:54
CQBarChart::~CQBarChart ( )
virtual

Definition at line 60 of file qwt3dPlot.cpp.

61 {}

Member Function Documentation

void CQBarChart::contextMenuEvent ( QContextMenuEvent *  )
private

Definition at line 519 of file qwt3dPlot.cpp.

References hotKeysMessage(), mColorLegend, saveDataToFile(), and showLegend().

520 {
521 #ifdef DEBUG_UI
522  qDebug() << "-- in qwt3dPlot.cpp Plot3d::contextMenuEvent --";
523 #endif
524  QMenu* mpContextMenu = new QMenu(this);
525  Q_CHECK_PTR(mpContextMenu);
526  mpContextMenu->addAction("handling information", this, SLOT(hotKeysMessage()));
527 
528  if (mColorLegend)
529  mpContextMenu->addAction("hide legend", this, SLOT(showLegend()));
530  else
531  mpContextMenu->addAction("show legend", this, SLOT(showLegend()));
532 
533  mpContextMenu->addAction("Print to &file", this, SLOT(saveDataToFile()));
534 
535  mpContextMenu->exec(QCursor::pos());
536  delete mpContextMenu;
537 }
void saveDataToFile()
Definition: qwt3dPlot.cpp:539
void hotKeysMessage()
Definition: qwt3dPlot.cpp:605
bool mColorLegend
Definition: qwt3dPlot.h:54
void showLegend()
Definition: qwt3dPlot.cpp:591
void CQBarChart::emptyPlot ( )

Definition at line 502 of file qwt3dPlot.cpp.

References data, mTitle, plotData(), setData(), and setScale().

503 {
504 #ifdef DEBUG_UI
505  qDebug() << "-- in qwt3dPlot.cpp Plot3d::emptyPlot --";
506 #endif
507 
508  data = new double * [1];
509  data[0] = new double[1];
510  data[0][0] = 0;
511 
512  setScale(NULL, NULL);
513  setData(data, 1, 1, 0);
514  mTitle = (QString(""));
515  mpPlot->showColorLegend(false);
516  plotData();
517 }
void plotData()
Definition: qwt3dPlot.cpp:84
double ** data
Definition: qwt3dPlot.h:51
QString mTitle
Definition: qwt3dPlot.h:50
void setData()
void setScale(const std::vector< std::string > *columnsDescript, const std::vector< std::string > *rowsDescript)
Definition: qwt3dPlot.cpp:290
int CQBarChart::getColSliderPos ( )

Definition at line 435 of file qwt3dPlot.cpp.

References CQBarChart::Data::columns, mData, and CQBaseWidget::mSliderActive.

Referenced by setAxes().

436 {
437 #ifdef DEBUG_UI
438  qDebug() << "-- in qwt3dPlot.cpp Plot3d::getColSliderPos --";
439 #endif
440 
441  if (!mSliderActive) return - 1;
442 
443  if (mpSliderColumn->value() > mData.columns)
444  return - 1;
445  else
446  return mpSliderColumn->value();
447 }
Data mData
Definition: qwt3dPlot.h:45
bool mSliderActive
Definition: CQBaseWidget.h:33
int CQBarChart::getRowSliderPos ( )

Definition at line 449 of file qwt3dPlot.cpp.

References mData, CQBaseWidget::mSliderActive, and CQBarChart::Data::rows.

Referenced by setAxes().

450 {
451 #ifdef DEBUG_UI
452  qDebug() << "-- in qwt3dPlot.cpp Plot3d::getRowSliderPos --";
453 #endif
454 
455  if (!mSliderActive) return - 1;
456 
457  if (mpSliderRow->value() > mData.rows)
458  return - 1;
459  else
460  return mpSliderRow->value();
461 }
Data mData
Definition: qwt3dPlot.h:45
bool mSliderActive
Definition: CQBaseWidget.h:33
void CQBarChart::hotKeysMessage ( )
slot

Definition at line 605 of file qwt3dPlot.cpp.

References CQMessageBox::information().

Referenced by contextMenuEvent().

606 {
607  CQMessageBox::information(this, "Mouse and Keyboard Handling",
608  "You can perform shifts, turns, scales and zooms. \n \n"
609  "Try Ctrl, Shift, Alt in combination with your wheel and left mouse \n"
610  "button to get a clue (or use instead your cursor keys).\n"
611  );
612 
613  return;
614 }
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CQBarChart::plotData ( )

Definition at line 84 of file qwt3dPlot.cpp.

References CQBarChart::Data::faktor, mColorLegend, mData, mpBar, resizeCoordSys(), setAxes(), setLegend(), setPlotTitle(), and setZoom().

Referenced by emptyPlot(), and setData().

85 {
86 #ifdef DEBUG_UI
87  qDebug() << "-- in qwt3dPlot.cpp Plot3d::plotData --";
88 #endif
89 
91 
92  mpBar = (Bar*)mpPlot->setPlotStyle(Bar(mData.faktor * 0.4, -1, -1));
93 
94  setPlotTitle();
95 
96  if (mColorLegend == true) setLegend();
97 
98  setZoom();
99  setAxes();
100  mpPlot->setCoordinateStyle(Qwt3D::FRAME);
101  mpPlot->updateData();
102  mpPlot->updateGL();
103 }
void setLegend()
Definition: qwt3dPlot.cpp:258
void setZoom()
Definition: qwt3dPlot.cpp:66
Data mData
Definition: qwt3dPlot.h:45
void resizeCoordSys()
Definition: qwt3dPlot.cpp:396
Bar * mpBar
Definition: qwt3dPlot.h:49
Definition: qwt3dBars.h:23
void setAxes()
Definition: qwt3dPlot.cpp:105
void setPlotTitle()
Definition: qwt3dPlot.cpp:278
bool mColorLegend
Definition: qwt3dPlot.h:54
void CQBarChart::resizeCoordSys ( )

Definition at line 396 of file qwt3dPlot.cpp.

Referenced by plotData().

397 {
398 #ifdef DEBUG_UI
399  qDebug() << "-- in qwt3dPlot.cpp Plot3d::resizeCoordSys --";
400 #endif
401  double minZ = mpPlot->hull().minVertex.z;
402  double maxZ = mpPlot->hull().maxVertex.z;
403 
404  if ((mpPlot->hull().minVertex.z < 0) && (mpPlot->hull().maxVertex.z > 0))
405  {
406  if (mpPlot->hull().maxVertex.z > fabs(mpPlot->hull().minVertex.z))
407  {
408  minZ = -mpPlot->hull().maxVertex.z;
409  maxZ = mpPlot->hull().maxVertex.z;
410  }
411 
412  if (mpPlot->hull().maxVertex.z < fabs(mpPlot->hull().minVertex.z))
413  {
414  minZ = mpPlot->hull().minVertex.z;
415  maxZ = -mpPlot->hull().minVertex.z;
416  }
417  }
418 
419  if ((mpPlot->hull().minVertex.z < 0) && (mpPlot->hull().maxVertex.z < 0))
420  {
421  minZ = mpPlot->hull().minVertex.z;
422  maxZ = 0;
423  }
424 
425  if ((mpPlot->hull().minVertex.z > 0) && (mpPlot->hull().maxVertex.z > 0))
426  {
427  minZ = 0;
428  maxZ = mpPlot->hull().maxVertex.z;
429  }
430 
431  mpPlot->coordinates()->init(Qwt3D::Triple(mpPlot->hull().minVertex.x, mpPlot->hull().minVertex.y, minZ),
432  Qwt3D::Triple(mpPlot->hull().maxVertex.x, mpPlot->hull().maxVertex.y, maxZ));
433 }
void CQBarChart::saveDataToFile ( )
slot

Definition at line 539 of file qwt3dPlot.cpp.

References C_INT32, checkSelection(), CQMessageBox::critical(), FROM_UTF8, CopasiFileDialog::getSaveFileName(), and TO_UTF8.

Referenced by contextMenuEvent().

540 {
541 #ifdef DEBUG_UI
542  qDebug() << "-- in qwt3dPlot.cpp Plot3d::saveDataToFile --";
543 #endif
544  C_INT32 Answer = QMessageBox::No;
545  QString fileName, filetype_; //, newFilter;
546 
547  while (Answer == QMessageBox::No)
548  {
549 
550  QString *userFilter = new QString;
551 
552  fileName =
553  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
554  "ILDMResults-barsPrint", "BMP Files (*.bmp);;PS Files (*.ps);;PDF Files (*.pdf)", "Save to",
555  userFilter);
556 
557  if (fileName.isNull()) return;
558 
559  if (*userFilter == "BMP Files (*.bmp)")
560  filetype_ = "BMP";
561  else if (*userFilter == "PS Files (*.ps)")
562  filetype_ = "PS";
563  else if (*userFilter == "PDF Files (*.pdf)")
564  filetype_ = "PDF";
565 
566 #ifdef DEBUG_UI
567  qDebug() << "user's filter pointer = " << *userFilter;
568  qDebug() << "filetype_ = " << filetype_;
569 #endif
570 
571  // Checks whether the file exists
572  Answer = checkSelection(fileName);
573 
574  if (Answer == QMessageBox::Cancel) return;
575  }
576 
577  int failed = 0;
578  QCursor oldCursor = cursor();
579  setCursor(Qt::WaitCursor);
580  failed = !Qwt3D::IO::save(mpPlot, fileName, filetype_);
581  setCursor(oldCursor);
582 
583  if (failed)
584  {
585  std::string s = "Could not save data to ";
586  s += TO_UTF8(fileName);
587  CQMessageBox::critical(this, "Save Error", FROM_UTF8(s), QMessageBox::Ok, QMessageBox::Ok);
588  }
589 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
#define C_INT32
Definition: copasi.h:90
C_INT32 checkSelection(const QString &file)
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CQBarChart::setAxes ( )

Definition at line 105 of file qwt3dPlot.cpp.

References CQBarChart::Data::columns, getColSliderPos(), getRowSliderPos(), CQBarChart::Data::maxItems, CQBarChart::Data::maxValue, mData, CQBarChart::Data::minValue, mpColumnScale, mpRowScale, CQBarChart::Data::rows, and CQBarChart::Data::valueZone.

Referenced by plotData().

106 {
107 #ifdef DEBUG_UI
108  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setAxes --";
109 #endif
110 
111  double majorTicLength, minorTicLength;
112 
113  if (mData.maxItems <= 2)
114  {
115  majorTicLength = mData.valueZone * 3;
116  minorTicLength = mData.valueZone * 2.5;
117  }
118  else if (mData.maxItems < 5)
119  {
120  majorTicLength = mData.valueZone;
121  minorTicLength = mData.valueZone / 1.2;
122  }
123  else
124  {
125  majorTicLength = mData.valueZone / 3;
126  minorTicLength = mData.valueZone / 4;
127  }
128 
129  mpPlot->coordinates()->setLineSmooth(true);
130  mpPlot->coordinates()->setGridLinesColor(Qwt3D::RGBA(0, 0, 0.5));
131  mpPlot->coordinates()->setNumberFont("Courier", 8);
132  mpPlot->coordinates()->setLabelFont("Courier", 8);
133  mpPlot->coordinates()->adjustLabels(35);
134  // mpPlot->coordinates()->adjustNumbers(majorTicLength);
135  mpPlot->coordinates()->setLabelColor(Qwt3D::RGBA(1, 0, 0));
136 
137  //mpPlot->coordinates()->setAutoDecoration(false);
138 
139  mpPlot->coordinates()->axes[Qwt3D::Z1].setScale(new ValueScale);
140 
141  if ((mData.maxValue > 0) && (mData.minValue < 0))
142  mpPlot->coordinates()->axes[Qwt3D::Z1].setMajors(2);
143  else
144  mpPlot->coordinates()->axes[Qwt3D::Z1].setMajors(1);
145 
146  mpPlot->coordinates()->axes[Qwt3D::Z1].setMinors(0);
147  mpPlot->coordinates()->axes[Qwt3D::Z1].setLineWidth(2, 0.7, 0.2);
148  mpPlot->coordinates()->axes[Qwt3D::Z1].setTicOrientation(-1, 1, 0);
149  mpPlot->coordinates()->axes[Qwt3D::Z1].setTicLength(majorTicLength, minorTicLength);
150 
151  mpPlot->coordinates()->axes[Qwt3D::Z2].setScale(new ValueScale);
152 
153  if ((mData.maxValue > 0) && (mData.minValue < 0))
154  mpPlot->coordinates()->axes[Qwt3D::Z2].setMajors(2);
155  else
156  mpPlot->coordinates()->axes[Qwt3D::Z2].setMajors(1);
157 
158  mpPlot->coordinates()->axes[Qwt3D::Z2].setMinors(0);
159  mpPlot->coordinates()->axes[Qwt3D::Z2].setLineWidth(2, 0.7, 0.2);
160  mpPlot->coordinates()->axes[Qwt3D::Z2].setTicOrientation(-1, -1, 0);
161  mpPlot->coordinates()->axes[Qwt3D::Z2].setTicLength(majorTicLength, minorTicLength);
162 
163  mpPlot->coordinates()->axes[Qwt3D::Z3].setScale(new ValueScale);
164 
165  if ((mData.maxValue > 0) && (mData.minValue < 0))
166  mpPlot->coordinates()->axes[Qwt3D::Z3].setMajors(2);
167  else
168  mpPlot->coordinates()->axes[Qwt3D::Z3].setMajors(1);
169 
170  mpPlot->coordinates()->axes[Qwt3D::Z3].setMinors(0);
171  mpPlot->coordinates()->axes[Qwt3D::Z3].setLineWidth(2, 0.7, 0.2);
172  mpPlot->coordinates()->axes[Qwt3D::Z3].setTicOrientation(1, -1, 0);
173  mpPlot->coordinates()->axes[Qwt3D::Z3].setTicLength(majorTicLength, minorTicLength);
174 
175  mpPlot->coordinates()->axes[Qwt3D::Z4].setScale(new ValueScale);
176 
177  if ((mData.maxValue > 0) && (mData.minValue < 0))
178  mpPlot->coordinates()->axes[Qwt3D::Z4].setMajors(2);
179  else
180  mpPlot->coordinates()->axes[Qwt3D::Z4].setMajors(1); mpPlot->coordinates()->axes[Qwt3D::Z4].setMinors(0);
181 
182  mpPlot->coordinates()->axes[Qwt3D::Z4].setLineWidth(2, 0.7, 0.2);
183  mpPlot->coordinates()->axes[Qwt3D::Z4].setTicOrientation(1, 1, 0);
184  mpPlot->coordinates()->axes[Qwt3D::Z4].setTicLength(majorTicLength, minorTicLength);
185 
186  mpPlot->coordinates()->axes[Qwt3D::X1].setScale(new ColumnScale(mpColumnScale, getColSliderPos()));
187  mpPlot->coordinates()->axes[Qwt3D::X1].setLabelString("columns");
188  mpPlot->coordinates()->axes[Qwt3D::X1].setMajors(mData.columns - 1);
189  mpPlot->coordinates()->axes[Qwt3D::X1].setMinors(0);
190 
191  //mpPlot->coordinates()->axes[Qwt3D::X1].setLineWidth(2, 0.7, 0);
192  if (mpColumnScale)
193  mpPlot->coordinates()->axes[Qwt3D::X1].setTicLength(majorTicLength, 0);
194  else
195  mpPlot->coordinates()->axes[Qwt3D::X1].setTicLength(0, 0);
196 
197  mpPlot->coordinates()->axes[Qwt3D::X2].setScale(new ColumnScale(mpColumnScale, getColSliderPos()));
198  mpPlot->coordinates()->axes[Qwt3D::X2].setLabelString("columns");
199  mpPlot->coordinates()->axes[Qwt3D::X2].setMajors(mData.columns - 1);
200  mpPlot->coordinates()->axes[Qwt3D::X2].setMinors(0);
201 
202  //mpPlot->coordinates()->axes[Qwt3D::X2].setLineWidth(2, 0.7, 0);
203  if (mpColumnScale)
204  mpPlot->coordinates()->axes[Qwt3D::X2].setTicLength(majorTicLength, 0);
205  else
206  mpPlot->coordinates()->axes[Qwt3D::X2].setTicLength(0, 0);
207 
208  mpPlot->coordinates()->axes[Qwt3D::X3].setScale(new ColumnScale(mpColumnScale, getColSliderPos()));
209  mpPlot->coordinates()->axes[Qwt3D::X3].setLabelString("columns");
210  mpPlot->coordinates()->axes[Qwt3D::X3].setMajors(mData.columns - 1);
211  mpPlot->coordinates()->axes[Qwt3D::X3].setMinors(0);
212 
213  //mpPlot->coordinates()->axes[Qwt3D::X3].setLineWidth(2, 0.7, 0);
214  if (mpColumnScale)
215  mpPlot->coordinates()->axes[Qwt3D::X3].setTicLength(majorTicLength, 0);
216  else
217  mpPlot->coordinates()->axes[Qwt3D::X3].setTicLength(0, 0);
218 
219  mpPlot->coordinates()->axes[Qwt3D::X4].setScale(new ColumnScale(mpColumnScale, getColSliderPos()));
220  mpPlot->coordinates()->axes[Qwt3D::X4].setLabelString("columns");
221  mpPlot->coordinates()->axes[Qwt3D::X4].setMajors(mData.columns - 1);
222 
223  //mpPlot->coordinates()->axes[Qwt3D::X4].setLineWidth(2, 0.7, 0);
224  if (mpColumnScale)
225  mpPlot->coordinates()->axes[Qwt3D::X4].setTicLength(majorTicLength, 0);
226  else
227  mpPlot->coordinates()->axes[Qwt3D::X4].setTicLength(0, 0);
228 
229  mpPlot->coordinates()->axes[Qwt3D::Y1].setLabelString("rows");
230  mpPlot->coordinates()->axes[Qwt3D::Y1].setScale(new RowScale(mpRowScale, getRowSliderPos()));
231  mpPlot->coordinates()->axes[Qwt3D::Y1].setMajors(mData.rows - 1);
232  mpPlot->coordinates()->axes[Qwt3D::Y1].setMinors(0);
233  //mpPlot->coordinates()->axes[Qwt3D::Y1].setLineWidth(2, 0.7, 0);
234  mpPlot->coordinates()->axes[Qwt3D::Y1].setTicLength(majorTicLength, 0);
235 
236  mpPlot->coordinates()->axes[Qwt3D::Y2].setLabelString("rows");
237  mpPlot->coordinates()->axes[Qwt3D::Y2].setScale(new RowScale(mpRowScale, getRowSliderPos()));
238  mpPlot->coordinates()->axes[Qwt3D::Y2].setMajors(mData.rows - 1);
239  mpPlot->coordinates()->axes[Qwt3D::Y2].setMinors(0);
240  //mpPlot->coordinates()->axes[Qwt3D::Y2].setLineWidth(2, 0.7, 0);
241  mpPlot->coordinates()->axes[Qwt3D::Y2].setTicLength(majorTicLength, 0);
242 
243  mpPlot->coordinates()->axes[Qwt3D::Y3].setLabelString("rows");
244  mpPlot->coordinates()->axes[Qwt3D::Y3].setScale(new RowScale(mpRowScale, getRowSliderPos()));
245  mpPlot->coordinates()->axes[Qwt3D::Y3].setMajors(mData.rows - 1);
246  mpPlot->coordinates()->axes[Qwt3D::Y3].setMinors(0);
247  //mpPlot->coordinates()->axes[Qwt3D::Y3].setLineWidth(2, 0.7, 0);
248  mpPlot->coordinates()->axes[Qwt3D::Y3].setTicLength(majorTicLength, 0);
249 
250  mpPlot->coordinates()->axes[Qwt3D::Y4].setLabelString("rows");
251  mpPlot->coordinates()->axes[Qwt3D::Y4].setScale(new RowScale(mpRowScale, getRowSliderPos()));
252  mpPlot->coordinates()->axes[Qwt3D::Y4].setMajors(mData.rows - 1);
253  mpPlot->coordinates()->axes[Qwt3D::Y4].setMinors(0);
254  //mpPlot->coordinates()->axes[Qwt3D::Y4].setLineWidth(2, 0.7, 0);
255  mpPlot->coordinates()->axes[Qwt3D::Y4].setTicLength(majorTicLength, 0);
256 }
Data mData
Definition: qwt3dPlot.h:45
double maxValue
Definition: qwt3dPlot.h:41
The standard (1:1) mapping class for axis numbering.
Definition: qwt3dScale.h:33
double minValue
Definition: qwt3dPlot.h:42
int getRowSliderPos()
Definition: qwt3dPlot.cpp:449
int getColSliderPos()
Definition: qwt3dPlot.cpp:435
const std::vector< std::string > * mpRowScale
Definition: qwt3dPlot.h:53
double valueZone
Definition: qwt3dPlot.h:40
const std::vector< std::string > * mpColumnScale
Definition: qwt3dPlot.h:52
void CQBarChart::setColors ( std::vector< QColor >  mColors,
double  min,
double  max 
)

Definition at line 299 of file qwt3dPlot.cpp.

References max, CQBarChart::Data::maxValue, mData, min, CQBarChart::Data::minValue, and BarColor::setColorVector().

300 {
301 #ifdef DEBUG_UI
302  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setColors --";
303 #endif
304  unsigned int i;
305  mData.maxValue = max;
306  mData.minValue = min;
307  Qwt3D::ColorVector cv;
308 
309  Qwt3D::RGBA rgb;
310 
311  for (i = 0; i < mColors.size(); i++)
312  {
313  double r, g, b;
314  r = (mColors[i].red()); g = (mColors[i].green()); b = (mColors[i].blue());
315  rgb.r = r / 254; rgb.g = g / 254; rgb.b = b / 254;
316  //rgb.a = 1;
317  cv.push_back(rgb);
318  }
319 
320  BarColor* mpCol = new BarColor(mpPlot, 100, min, max);
321  mpCol->setColorVector(cv);
322  mpPlot->setDataColor(mpCol);
323 }
Data mData
Definition: qwt3dPlot.h:45
double maxValue
Definition: qwt3dPlot.h:41
void setColorVector(Qwt3D::ColorVector const &cv)
Definition: qwt3dColor.cpp:47
double minValue
Definition: qwt3dPlot.h:42
#define min(a, b)
Definition: f2c.h:175
#define max(a, b)
Definition: f2c.h:176
void CQBarChart::setData ( double **  data,
int  columns,
int  rows,
double  valueZone 
)

Definition at line 325 of file qwt3dPlot.cpp.

References CQBarChart::Data::columnAxeLength, CQBarChart::Data::columns, CQBarChart::Data::faktor, CQBarChart::Data::maxItems, mData, plotData(), CQBarChart::Data::rowAxeLength, CQBarChart::Data::rows, setSlider(), and CQBarChart::Data::valueZone.

326 {
327 #ifdef DEBUG_UI
328  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setData --";
329 #endif
330  int j;
331  mData.valueZone = valueZone;
332  mData.columns = columns;
333  mData.rows = rows;
334 
335  if (columns < rows)
336  mData.maxItems = rows;
337  else
338  mData.maxItems = columns;
339 
340  if (mData.columns == 1)
341  {
342  double** dataExpand = new double * [2];
343  dataExpand[0] = new double[mData.rows];
344  dataExpand[1] = new double[mData.rows];
345 
346  for (j = 0; j < rows; j++)
347  {
348  dataExpand[0][j] = data[0][j];
349  dataExpand[1][j] = data[0][j];
350  }
351 
352  mData.faktor = 4 * (mData.valueZone) / (mData.rows - 1);
353  mData.columnAxeLength = ((mData.columns - 1) * mData.faktor) + 0.000001;
354  mData.rowAxeLength = ((mData.rows - 1) * mData.faktor);
355  mpPlot->loadFromData(dataExpand, mData.columns + 1, mData.rows, 0, mData.columnAxeLength, 0, mData.rowAxeLength);
356  }
357  else
358  {
359  mData.faktor = 4 * (mData.valueZone) / (mData.maxItems - 1);
361  mData.rowAxeLength = ((mData.rows - 1) * mData.faktor);
362  mpPlot->loadFromData(data, mData.columns, mData.rows, 0, mData.columnAxeLength, 0, mData.rowAxeLength);
363  }
364 
365  plotData();
366  setSlider();
367 }
double rowAxeLength
Definition: qwt3dPlot.h:38
Data mData
Definition: qwt3dPlot.h:45
void setSlider()
Definition: qwt3dPlot.cpp:369
void plotData()
Definition: qwt3dPlot.cpp:84
double valueZone
Definition: qwt3dPlot.h:40
double ** data
Definition: qwt3dPlot.h:51
double columnAxeLength
Definition: qwt3dPlot.h:37
void CQBarChart::setData ( )

Referenced by emptyPlot().

void CQBarChart::setDescriptions ( const std::vector< std::string > *  columnsDes,
const std::vector< std::string > *  rowsDes 
)

This method sets the user specified descriptions for the rows and columns. All axes in bar graph will be marked with this description labels automatically.

Definition at line 616 of file qwt3dPlot.cpp.

References setScale().

617 {
618  setScale(columnsDes, rowsDes);
619 }
void setScale(const std::vector< std::string > *columnsDescript, const std::vector< std::string > *rowsDescript)
Definition: qwt3dPlot.cpp:290
void CQBarChart::setLegend ( )

Definition at line 258 of file qwt3dPlot.cpp.

Referenced by plotData().

259 {
260 #ifdef DEBUG_UI
261  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setLegend --";
262 #endif
263 
264  mpPlot->legend()->setLimits(mpPlot->hull().minVertex.z, mpPlot->hull().maxVertex.z);
265 
266  if ((mpPlot->hull().minVertex.z < 0) && (mpPlot->hull().maxVertex.z < 0))
267  mpPlot->legend()->setLimits(mpPlot->hull().minVertex.z, 0);
268 
269  if ((mpPlot->hull().minVertex.z > 0) && (mpPlot->hull().maxVertex.z > 0))
270  mpPlot->legend()->setLimits(0, mpPlot->hull().maxVertex.z);
271 
272  mpPlot->legend()->setMajors(4);
273  mpPlot->legend()->setMinors(0);
274 
275  mpPlot->showColorLegend(true);
276 }
void CQBarChart::setPlotTitle ( )

< Set caption position

< Set caption font

< Set caption color

< Set caption text (one row only)

Definition at line 278 of file qwt3dPlot.cpp.

References mTitle.

Referenced by plotData().

279 {
280 #ifdef DEBUG_UI
281  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setPlotTitle --";
282 #endif
283 
284  mpPlot->setTitlePosition(0.97, 0.5, Qwt3D::TopCenter); //!< Set caption position
285  mpPlot->setTitleFont("Courier", 8); //!< Set caption font
286  mpPlot->setTitleColor(Qwt3D::RGBA(0, 0, 0)); //!< Set caption color
287  mpPlot->setTitle(mTitle); //!< Set caption text (one row only)
288 }
QString mTitle
Definition: qwt3dPlot.h:50
void CQBarChart::setPlotTitle ( QString  title)

If necessary set the title in the middle over the bar graph.

Definition at line 626 of file qwt3dPlot.cpp.

References mTitle.

627 {
628  mTitle = title;
629 }
QString mTitle
Definition: qwt3dPlot.h:50
void CQBarChart::setScale ( const std::vector< std::string > *  columnsDescript,
const std::vector< std::string > *  rowsDescript 
)

Definition at line 290 of file qwt3dPlot.cpp.

References mpColumnScale, and mpRowScale.

Referenced by emptyPlot(), and setDescriptions().

291 {
292 #ifdef DEBUG_UI
293  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setPlotTitle --";
294 #endif
295  mpColumnScale = columnsDescript;
296  mpRowScale = rowsDescript;
297 }
const std::vector< std::string > * mpRowScale
Definition: qwt3dPlot.h:53
const std::vector< std::string > * mpColumnScale
Definition: qwt3dPlot.h:52
void CQBarChart::setSlider ( )

Definition at line 369 of file qwt3dPlot.cpp.

References CQBarChart::Data::columns, mData, CQBaseWidget::mSliderActive, CQBarChart::Data::rows, sliderMoved(), and CQBarChart::Data::valueZone.

Referenced by setData().

370 {
371 #ifdef DEBUG_UI
372  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setSlider --";
373 #endif
374 
375  if (mSliderActive)
376  if (mData.valueZone != 0)
377  {
378  mpSliderColumn->setMinimum(0);
379 
380  if (mData.columns == 1)
381  mpSliderColumn->setMaximum((mData.columns - 1) * 1000);
382  else
383  mpSliderColumn->setMaximum(mData.columns * 1000);
384 
385  mpSliderRow->setMinimum(0);
386 
387  if (mData.rows == 1)
388  mpSliderRow->setMaximum((mData.rows - 1) * 1000);
389  else
390  mpSliderRow->setMaximum(mData.rows * 1000);
391 
392  sliderMoved(mpSliderColumn->value() / 1000, mpSliderRow->value() / 1000);
393  }
394 }
virtual void sliderMoved(int column, int row)
Definition: qwt3dPlot.cpp:463
Data mData
Definition: qwt3dPlot.h:45
bool mSliderActive
Definition: CQBaseWidget.h:33
double valueZone
Definition: qwt3dPlot.h:40
void CQBarChart::setZoom ( )

Definition at line 66 of file qwt3dPlot.cpp.

References CQBarChart::Data::maxItems, and mData.

Referenced by plotData().

67 {
68 #ifdef DEBUG_UI
69  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setZoom --";
70 #endif
71  double zoom;
72 
73  if (mData.maxItems < 7)
74  zoom = (double)(mData.maxItems) / 10;
75  else
76  zoom = 0.7;
77 
78  mpPlot->setZoom(zoom);
79 }
Data mData
Definition: qwt3dPlot.h:45
void CQBarChart::showColorLegend ( bool  CLegend)

Option to show or to hide the color legend.

Definition at line 621 of file qwt3dPlot.cpp.

References mColorLegend.

622 {
623  mColorLegend = CLegend;
624 }
bool mColorLegend
Definition: qwt3dPlot.h:54
void CQBarChart::showLegend ( )
slot

Definition at line 591 of file qwt3dPlot.cpp.

References mColorLegend.

Referenced by contextMenuEvent().

592 {
593  if (mColorLegend)
594  {
595  mColorLegend = false;
596  mpPlot->showColorLegend(false);
597  }
598  else
599  {
600  mColorLegend = true;
601  mpPlot->showColorLegend(true);
602  }
603 }
bool mColorLegend
Definition: qwt3dPlot.h:54
void CQBarChart::sliderMoved ( int  column,
int  row 
)
virtual

Implements CQBaseWidget.

Definition at line 463 of file qwt3dPlot.cpp.

References CQBarChart::Data::columnAxeLength, CQBarChart::Data::columns, CQBarChart::Data::faktor, mData, mpBar, mpColumnScale, mpRowScale, CQBaseWidget::mSliderActive, CQBarChart::Data::rowAxeLength, and CQBarChart::Data::rows.

Referenced by setSlider().

464 {
465  if (!mSliderActive) return;
466 
467 #ifdef DEBUG_UI
468  qDebug() << "-- in qwt3dPlot.cpp Plot3d::sliderMoved --";
469  qDebug() << "Plot3d::sliderMoved -> col = " << column << " - row = " << row;
470 #endif
471  int showColumn;
472  int showRow;
473 
474  if (column == mData.columns)
475  showColumn = -1;
476  else
477  showColumn = column;
478 
479  if (row == mData.rows)
480  showRow = -1;
481  else
482  showRow = row;
483 
484  mpPlot->coordinates()->axes[Qwt3D::X1].setScale(new ColumnScale(mpColumnScale, showColumn));
485  mpPlot->coordinates()->axes[Qwt3D::X2].setScale(new ColumnScale(mpColumnScale, showColumn));
486  mpPlot->coordinates()->axes[Qwt3D::X3].setScale(new ColumnScale(mpColumnScale, showColumn));
487  mpPlot->coordinates()->axes[Qwt3D::X4].setScale(new ColumnScale(mpColumnScale, showColumn));
488 
489  mpPlot->coordinates()->axes[Qwt3D::Y1].setScale(new RowScale(mpRowScale, showRow));
490  mpPlot->coordinates()->axes[Qwt3D::Y2].setScale(new RowScale(mpRowScale, showRow));
491  mpPlot->coordinates()->axes[Qwt3D::Y3].setScale(new RowScale(mpRowScale, showRow));
492  mpPlot->coordinates()->axes[Qwt3D::Y4].setScale(new RowScale(mpRowScale, showRow));
493 
494  mpBar = (Bar*)mpPlot->setPlotStyle(Bar(mData.faktor * 0.4, (mData.columnAxeLength / (mData.columns - 1)) * showColumn, (mData.rowAxeLength / (mData.rows - 1)) * showRow));
495 
496  mpPlot->updateData();
497  mpPlot->updateGL();
498 
499  // sliderPosition(column, row);
500 }
double rowAxeLength
Definition: qwt3dPlot.h:38
Data mData
Definition: qwt3dPlot.h:45
Bar * mpBar
Definition: qwt3dPlot.h:49
Definition: qwt3dBars.h:23
bool mSliderActive
Definition: CQBaseWidget.h:33
const std::vector< std::string > * mpRowScale
Definition: qwt3dPlot.h:53
const std::vector< std::string > * mpColumnScale
Definition: qwt3dPlot.h:52
double columnAxeLength
Definition: qwt3dPlot.h:37

Member Data Documentation

double** CQBarChart::data

Definition at line 51 of file qwt3dPlot.h.

Referenced by emptyPlot().

bool CQBarChart::mColorLegend

Definition at line 54 of file qwt3dPlot.h.

Referenced by contextMenuEvent(), CQBarChart(), plotData(), showColorLegend(), and showLegend().

Data CQBarChart::mData
Bar* CQBarChart::mpBar

Definition at line 49 of file qwt3dPlot.h.

Referenced by plotData(), and sliderMoved().

const std::vector<std::string>* CQBarChart::mpColumnScale

Definition at line 52 of file qwt3dPlot.h.

Referenced by setAxes(), setScale(), and sliderMoved().

const std::vector<std::string>* CQBarChart::mpRowScale

Definition at line 53 of file qwt3dPlot.h.

Referenced by setAxes(), setScale(), and sliderMoved().

QString CQBarChart::mTitle

Definition at line 50 of file qwt3dPlot.h.

Referenced by CQBarChart(), emptyPlot(), and setPlotTitle().


The documentation for this class was generated from the following files: