COPASI API  4.16.103
qwt3dPlot.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include <QtGui/QContextMenuEvent>
16 #include <QtGui/QGridLayout>
17 #include <QtGui/QSlider>
18 #include <QtGui/QMenu>
19 #include <QtGui/QFrame>
20 
21 #ifdef DEBUG_UI
22 #include <QtCore/QtDebug>
23 #endif
24 
25 #include "qwt3dPlot.h"
26 #include "qwt3dScale.h"
27 #include "qwt3dColor.h"
28 
29 #include "copasi/UI/CQMessageBox.h"
31 #include "copasi/UI/qtUtilities.h"
32 
33 #include "copasi.h"
34 
35 CQBarChart::CQBarChart(QWidget* parent, const char* name) :
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 }
59 
61 {}
62 
63 /*
64  * Function to set zoom of view
65  */
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 }
80 
81 /*
82  * Function to plot data
83  */
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 }
104 
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 }
257 
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 }
277 
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 }
289 
290 void CQBarChart::setScale(const std::vector<std::string> *columnsDescript, const std::vector<std::string> *rowsDescript)
291 {
292 #ifdef DEBUG_UI
293  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setPlotTitle --";
294 #endif
295  mpColumnScale = columnsDescript;
296  mpRowScale = rowsDescript;
297 }
298 
299 void CQBarChart::setColors(std::vector<QColor> mColors, double min, double max)
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 }
324 
325 void CQBarChart::setData(double** data, int columns, int rows, double 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 }
368 
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 }
395 
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 }
434 
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 }
448 
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 }
462 
463 void CQBarChart::sliderMoved(int column, int row)
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 }
501 
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 }
518 
519 void CQBarChart::contextMenuEvent(QContextMenuEvent *)
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 }
538 
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 }
590 
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 }
604 
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 }
615 
616 void CQBarChart::setDescriptions(const std::vector<std::string>* columnsDes, const std::vector<std::string>* rowsDes)
617 {
618  setScale(columnsDes, rowsDes);
619 }
620 
621 void CQBarChart::showColorLegend(bool CLegend)
622 {
623  mColorLegend = CLegend;
624 }
625 
626 void CQBarChart::setPlotTitle(QString title)
627 {
628  mTitle = title;
629 }
virtual void sliderMoved(int column, int row)
Definition: qwt3dPlot.cpp:463
void setLegend()
Definition: qwt3dPlot.cpp:258
void contextMenuEvent(QContextMenuEvent *)
Definition: qwt3dPlot.cpp:519
void setZoom()
Definition: qwt3dPlot.cpp:66
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void emptyPlot()
Definition: qwt3dPlot.cpp:502
double rowAxeLength
Definition: qwt3dPlot.h:38
Data mData
Definition: qwt3dPlot.h:45
void setSlider()
Definition: qwt3dPlot.cpp:369
double maxValue
Definition: qwt3dPlot.h:41
void resizeCoordSys()
Definition: qwt3dPlot.cpp:396
The standard (1:1) mapping class for axis numbering.
Definition: qwt3dScale.h:33
void saveDataToFile()
Definition: qwt3dPlot.cpp:539
void setColorVector(Qwt3D::ColorVector const &cv)
Definition: qwt3dColor.cpp:47
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
Bar * mpBar
Definition: qwt3dPlot.h:49
double minValue
Definition: qwt3dPlot.h:42
#define C_INT32
Definition: copasi.h:90
Definition: qwt3dBars.h:23
bool mSliderActive
Definition: CQBaseWidget.h:33
void hotKeysMessage()
Definition: qwt3dPlot.cpp:605
void setDescriptions(const std::vector< std::string > *columnsDes, const std::vector< std::string > *rowsDes)
Definition: qwt3dPlot.cpp:616
CQBarChart(QWidget *parent=0, const char *name=0)
Definition: qwt3dPlot.cpp:35
int getRowSliderPos()
Definition: qwt3dPlot.cpp:449
void showColorLegend(bool CLegend)
Definition: qwt3dPlot.cpp:621
void plotData()
Definition: qwt3dPlot.cpp:84
C_INT32 checkSelection(const QString &file)
int getColSliderPos()
Definition: qwt3dPlot.cpp:435
const std::vector< std::string > * mpRowScale
Definition: qwt3dPlot.h:53
double valueZone
Definition: qwt3dPlot.h:40
double ** data
Definition: qwt3dPlot.h:51
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
const std::vector< std::string > * mpColumnScale
Definition: qwt3dPlot.h:52
void setAxes()
Definition: qwt3dPlot.cpp:105
void setPlotTitle()
Definition: qwt3dPlot.cpp:278
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
double columnAxeLength
Definition: qwt3dPlot.h:37
QString mTitle
Definition: qwt3dPlot.h:50
void setData()
#define min(a, b)
Definition: f2c.h:175
void setScale(const std::vector< std::string > *columnsDescript, const std::vector< std::string > *rowsDescript)
Definition: qwt3dPlot.cpp:290
void setColors(std::vector< QColor > mColors, double min, double max)
Definition: qwt3dPlot.cpp:299
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)
bool mColorLegend
Definition: qwt3dPlot.h:54
virtual ~CQBarChart()
Definition: qwt3dPlot.cpp:60
void showLegend()
Definition: qwt3dPlot.cpp:591
#define max(a, b)
Definition: f2c.h:176