COPASI API  4.16.103
CQLayoutMainWindow.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 "CQLayoutMainWindow.h"
16 
17 #include <QtGui/QAction>
18 #include <QtGui/QComboBox>
19 #include <QtGui/QFrame>
20 #include <QtGui/QLabel>
21 #include <QtGui/QLayout>
22 #include <QtGui/QMenuBar>
23 #include <QtGui/QMessageBox>
24 #include <QtGui/QMenu>
25 #include <QtGui/QPushButton>
26 #include <QtGui/QSplitter>
27 #include <QtGui/QVBoxLayout>
28 #include <QtGui/QToolBar>
29 #include <QtGui/QSlider>
30 #include <QtGui/QGridLayout>
31 #include <QtGui/QPixmap>
32 #include <QtGui/QCloseEvent>
33 
34 #include <iostream>
35 #include <cmath>
36 #include <stdlib.h>
37 
38 #include "copasi/UI/CQMessageBox.h"
40 #include "copasi/layout/CLBase.h"
44 #include "CQCurrentValueTable.h"
45 #include "CQGLNetworkPainter.h"
46 #include "CQGLViewport.h"
47 #include "FontChooser.h"
48 #include "NodeSizePanel.h"
49 #include "ParaPanel.h"
50 #include "CQPlayerControlWidget.h"
52 
54 
55 #ifdef DEBUG_UI
56 #include <QtCore/QtDebug>
57 #endif
58 
59 using namespace std;
60 
61 const char* const CQLayoutMainWindow::ZOOM_FACTOR_STRINGS[] = {"1%", "2%", "3%", "4%", "5%", "10%", "20%", "25%", "30%", "40%", "50%", "75%", "100%", "150%", "200%", "300%", "400%", "500%", "1000%"};
62 const double CQLayoutMainWindow::ZOOM_FACTORS[] = {0.01, 0.02, 0.03, 0.04, 0.05, 0.1, 0.2, 0.25, 0.3, 0.4, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 10.0};
63 
65  QFrame(pParent)
66  , mpVisParameters(new CVisParameters)
67  , mpParaPanel(new CQParaPanel)
68  , mpValTable(new CQCurrentValueTable)
69  , mpMainBox(new QFrame(this))
70  , mpSplitter(new QSplitter(Qt::Horizontal, this->mpMainBox))
71  , mpGLViewport(NULL)
72  , mpTimeSlider(new QSlider(Qt::Horizontal))
73  , mpFrame(new QFrame)
74  , mpInfoBox(new QFrame)
75  , mpControlWidget(new CQPlayerControlWidget)
76  , mDataPresent(false)
77  , mCurrentPlace(QString::null)
78  , mpZoomActionGroup(new QActionGroup(this))
79  , mpLayout(NULL)
80 {
81 
82 #ifndef Darwin
84 #endif // not Darwin
85 
86  QVBoxLayout* mainLayout = new QVBoxLayout(mpMainBox);
87  QVBoxLayout* infoLayout = new QVBoxLayout(mpInfoBox);
88  mpSplitter->addWidget(this->mpInfoBox);
89 
90  // create split window with parameter panel and graph panel
91  mainLayout->addWidget(this->mpSplitter);
92 
93  infoLayout->addWidget(this->mpParaPanel);
94  infoLayout->addWidget(this->mpValTable);
95  this->mpInfoBox->setLayout(infoLayout);
96 
97  // Create OpenGL widget
98  // we initialize it here because the parent has to be present
99  this->mpGLViewport = new CQGLViewport(this->mpSplitter);
100  this->mpGLViewport->setWindowTitle("Network layout");
101  this->mpSplitter->addWidget(this->mpGLViewport);
102 
103  if (this->mpLayout != NULL)
104  {
105  this->mpGLViewport->createGraph(this->mpLayout); // create local data structures
106  }
107 
108  this->mpSplitter->setStretchFactor(this->mpSplitter->indexOf(this->mpInfoBox), 0);
109  this->mpSplitter->setStretchFactor(this->mpSplitter->indexOf(this->mpGLViewport), 1);
110 
111  connect(this->mpControlWidget, SIGNAL(play()), this, SLOT(startAnimation()));
112  connect(this->mpControlWidget, SIGNAL(pause()), this, SLOT(pauseAnimation()));
113  connect(this->mpControlWidget, SIGNAL(stop()), this, SLOT(stopAnimation()));
114  connect(this->mpControlWidget, SIGNAL(forward()), this, SLOT(forwardAnimation()));
115  connect(this->mpControlWidget, SIGNAL(backward()), this, SLOT(backwardAnimation()));
116  connect(this->mpControlWidget, SIGNAL(step_backward()), this, SLOT(stepBackwardAnimation()));
117  connect(this->mpControlWidget, SIGNAL(step_forward()), this, SLOT(stepForwardAnimation()));
118 
119  this->mpTimeSlider->setRange(0, 100);
120  this->mpTimeSlider->setValue(0);
121  this->mpTimeSlider->setEnabled(false);
122 
123  this->mpTimeSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
124  connect(this->mpTimeSlider, SIGNAL(valueChanged(int)), this, SLOT(showStep(int)));
125 
126  QHBoxLayout* pGridLayout = new QHBoxLayout(mpFrame);
127  pGridLayout->addWidget(this->mpControlWidget);
128  pGridLayout->addWidget(this->mpTimeSlider);
129  this->mpFrame->setLayout(pGridLayout);
130 
131  mainLayout->addWidget(this->mpFrame);
132 
133  this->mpMainBox->setLayout(mainLayout);
134 
135  this->QFrame::setLayout(new QVBoxLayout);
136  this->layout()->addWidget(this->mpMainBox);
137 
138  connect(this->mpValTable , SIGNAL(valueChanged(int)), this, SLOT(parameterTableValueChanged(int)));
139  this->mLooping = false;
140 
141  this->setTabOrder(this->mpGLViewport, this->mpToolbar);
142  this->setTabOrder(this->mpParaPanel, this->mpValTable);
143  this->setTabOrder(this->mpValTable, this->mpControlWidget);
144 }
145 
147 {
148  std::string key = this->mpValTable->getKeyForRow(row);
149  bool value = this->mpValTable->getValueForRow(row);
150 
151  if (value == true)
152  {
153  this->addItemInAnimation(key);
154  }
155  else
156  {
157  this->removeItemInAnimation(key);
158  }
159 
160  // redraw the layout if we are in animation mode
161  if (this->mpGLViewport->isCircleMode())
162  {
163  this->mpGLViewport->updateWidget();
164  }
165 }
166 
168 {
169  if (mpVisParameters != NULL)
170  {
172  }
173  else
174  return false;
175 }
176 
177 void CQLayoutMainWindow::setAnimationRunning(bool animationRunningP)
178 {
179  if (mpVisParameters != NULL)
180  {
181  mpVisParameters->mAnimationRunning = animationRunningP;
182  }
183 }
184 
186 {
187  C_FLOAT64 minNodeSize = 10.0;
188 
189  if (mpVisParameters != NULL)
190  {
191 
192  minNodeSize = mpVisParameters->mMinNodeSize;
193  }
194 
195  return minNodeSize;
196 }
197 
199 {
200  C_FLOAT64 maxNodeSize = 100.0;
201 
202  if (mpVisParameters != NULL)
203  {
204  maxNodeSize = mpVisParameters->mMaxNodeSize;
205  }
206 
207  return maxNodeSize;
208 }
209 
211 {
212  if (mpVisParameters != NULL)
213  mpVisParameters->mMinNodeSize = minNdSize;
214 }
215 
217 {
218  if (mpVisParameters != NULL)
219  mpVisParameters->mMaxNodeSize = maxNdSize;
220 }
221 
223 {
224  return mpGLViewport->getPainter()->getFontSize();
225 }
226 
228 {
229  if (mpVisParameters != NULL)
230  {
232  }
233  else
234  return 2;
235 }
236 
238 {
239  if (mpVisParameters != NULL)
240  {
242  }
243 }
244 
246 {
247  return (size_t) this->mpTimeSlider->value();
248 }
249 
251 {
252  if (mpVisParameters != NULL)
253  {
255  }
256  else
258 }
259 
261 {
262  if (mpVisParameters != NULL)
263  {
265  }
266  else
267  return CVisParameters::SIZE_DIAMETER_MODE; // default mode
268 }
269 
271 {
272  CListOfLayouts *pLayoutList;
273  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
274 
275  if ((*CCopasiRootContainer::getDatamodelList())[0] != NULL)
276  {
277  pLayoutList = (*CCopasiRootContainer::getDatamodelList())[0]->getListOfLayouts();
278  }
279  else
280  pLayoutList = NULL;
281 
283 
284  if (pLayoutList != NULL)
285  {
286  CLayout * pLayout;
287 
288  if (pLayoutList->size() > 0)
289  {
290  pLayout = (*pLayoutList)[0];
291  mpGLViewport->createGraph(pLayout); // create local data structures
292  }
293  }
294 }
295 
297 {
298  if (mpGLViewport->getPainter() != NULL)
299  {
301 
303  showStep(this->mpTimeSlider->value());
304  }
305 }
306 
308 {
309  if (mpGLViewport->getPainter() != NULL)
310  {
312  mpGLViewport->getPainter()->updateGL();
313  }
314 }
315 
317 {
318  NodeSizePanel *panel = new NodeSizePanel(this);
319  panel->exec();
320 }
321 
323 {
324  // choose new font size (setting of size will be invoked from FontChooser panel
325  FontChooser *fCh = new FontChooser(this);
326  fCh->exec();
327 }
328 
330 {
331  bool successfulP = mpGLViewport->getPainter()->createDataSets();
332 
333  if (successfulP)
334  {
335  // set the number of steps in the control widget and place the current
336  // step at 0
338  this->mpTimeSlider->setEnabled(true);
339  this->mDataPresent = true;
340  mpParaPanel->enableStepNumberChoice();
341  size_t maxVal = mpGLViewport->getPainter()->getNumberOfSteps();
342  this->mpTimeSlider->setRange(0, maxVal - 1);
343  this->mpControlWidget->setNumSteps(maxVal);
344  mpGLViewport->getPainter()->updateGL();
345  CQGLNetworkPainter* pPainter = this->mpGLViewport->getPainter();
346 
347  if (pPainter->getNumberOfSteps() > 1)
348  {
349  this->mpParaPanel->enableParameterChoice();
350  this->mpParaPanel->enableStepNumberChoice();
351  this->mpParaPanel->enableModeChoice();
352 
353  if (pPainter->isCircleMode())
354  {
355  showStep(this->mpTimeSlider->value());
356  }
357  }
358  else
359  {
360  this->mpParaPanel->disableParameterChoice();
361  this->mpParaPanel->disableStepNumberChoice();
362  this->mpParaPanel->disableModeChoice();
363  }
364  }
365 }
366 
368 {
369  int i = 0;
370  std::string key, name;
371  C_FLOAT64 val;
372  mpValTable->setNumRows((int) dataSet.getNumberOfElements());
374  disconnect(this->mpValTable , SIGNAL(valueChanged(int)), this, SLOT(parameterTableValueChanged(int)));
375 
376  while ((key = mpGLViewport->getPainter()->getNodeNameEntry(i)) != "")
377  {
378  name = this->mpGLViewport->getPainter()->getNameForNodeKey(key);
379  val = dataSet.getOrigValueForSpecies(key); // would be (- std::numeric_limits< C_FLOAT64 >::max()) if key not present
380  mpValTable->setRowInTable(i, key, name, val);
381  i++;
382  }
383 
384  connect(this->mpValTable , SIGNAL(valueChanged(int)), this, SLOT(parameterTableValueChanged(int)));
385 }
386 
388 {
389  int i = 0;
390  std::string key, name;
391  C_FLOAT64 val;
392  disconnect(this->mpValTable , SIGNAL(valueChanged(int)), this, SLOT(parameterTableValueChanged(int)));
393 
394  while ((key = mpGLViewport->getPainter()->getNodeNameEntry(i)) != "")
395  {
396  name = mpGLViewport->getPainter()->getNameForNodeKey(key);
397  val = dataSet.getOrigValueForSpecies(key); // would be (- std::numeric_limits< C_FLOAT64 >::max()) if key not present
398 
399  if (mpValTable->numRows() > i)
400  {
401  mpValTable->updateRowInTable(i, val);
402  }
403 
404  i++;
405  }
406 
407  connect(this->mpValTable , SIGNAL(valueChanged(int)), this, SLOT(parameterTableValueChanged(int)));
408 }
409 
410 // adds the item given by s to the list of items to animate (no change, if it is already present)
412 {
413  mpGLViewport->getPainter()->setItemAnimated(key, true);
414 }
415 
416 // removes the item given by s from the list of items to animate (no change, if it is not present in the list)
418 {
419  mpGLViewport->getPainter()->setItemAnimated(key, false);
420 }
421 
423 {
424  startAnimation();
425 }
426 
428 {
429  if (!this->mDataPresent)
430  this->loadData(); // look for data
431 
432  if (this->mDataPresent)
433  {
434  // only if time series data present
435  this->mpVisParameters->mAnimationRunning = true;
436  this->mpTimeSlider->setEnabled(false);
439  this->mpParaPanel->disableParameterChoice();
440  this->mpParaPanel->disableStepNumberChoice();
441  }
442  else
443  {
444  CQMessageBox::warning(this, "Missing Data",
445  "No data found: \nYou first have to create a time course.",
446  QMessageBox::Ok, QMessageBox::Ok);
447  }
448 }
449 
451 {
452 #ifdef DEBUG_UI
453 // qDebug() << "mCurrentPlace = " << mCurrentPlace;
454 #endif
455 
456  // get the parameters
457  CQGLNetworkPainter* pPainter = this->mpGLViewport->getPainter();
458  assert(pPainter != NULL);
459 
460  if (pPainter != NULL)
461  {
462  size_t step = pPainter->getCurrentStep();
463  size_t lastFrame = pPainter->getNumberOfSteps();
464  double x = pPainter->getCurrentPositionX();
465  double y = pPainter->getCurrentPositionY();
466  double layoutX = pPainter->getGraphMin().getX();
467  double layoutY = pPainter->getGraphMin().getY();
468  double layoutWidth = pPainter->getGraphMax().getX() - layoutX;
469  double layoutHeight = pPainter->getGraphMax().getY() - layoutY;
470  unsigned int imageWidth = pPainter->width();
471  unsigned int imageHeight = pPainter->height();
472  double zoomFactor = pPainter->getZoomFactor();
473  double width = (double)imageWidth / zoomFactor;
474  double height = (double)imageHeight / zoomFactor;
475  // use more sophisticated dialog
476  CQScreenshotOptionsDialog* pDialog = new CQScreenshotOptionsDialog(layoutX, layoutY, layoutWidth, layoutHeight,
477  x, y, width, height, pPainter->width() , pPainter->height(), lastFrame, this);
478 
479  if (pDialog->exec() == QDialog::Accepted)
480  {
481  // ask for the filename
482  // TODO use a nicer default filename
483  QString fileName = CopasiFileDialog::getSaveFileName(this, "Save Image Dialog", QString("untitled.png"), QString("PNG (*.png);;All files (*)"), QString("Choose a filename to save the image(s) under"));
484 
485  if (!fileName.isEmpty() && !fileName.isNull())
486  {
487  // get the frames
488  std::vector<size_t> v;
489 
490  switch (pDialog->getFrameOption())
491  {
493 
494  // add all frames from 1 to lastFrame
495  if (lastFrame != 0)
496  {
497  for (size_t i = 1; i <= lastFrame; ++i)
498  {
499  v.push_back(i);
500  }
501  }
502  else
503  {
504  v.push_back(step);
505  }
506 
507  break;
508 
510  v.insert(v.begin(), pDialog->getFrameSet().begin(), pDialog->getFrameSet().end());
511 
512  if (v.empty())
513  {
514  CQMessageBox::warning(this, "No frames selected",
515  "The frame selection was invalid.\nExporting current frame.",
516  QMessageBox::Ok, QMessageBox::Ok);
517  v.push_back(step);
518  }
519 
520  break;
521 
522  default:
523  v.push_back(step);
524  break;
525  }
526 
527  bool result = pPainter->export_bitmap(pDialog->getX(), pDialog->getY(), pDialog->getWidth(), pDialog->getHeight(), pDialog->getImageWidth(), pDialog->getImageHeight(), fileName, v);
528 
529  if (result == false)
530  {
531  CQMessageBox::warning(this, "Error creating image",
532  "The image could not be created.",
533  QMessageBox::Ok, QMessageBox::Ok);
534  return;
535  }
536  }
537  }
538 
539  delete pDialog;
540  }
541 }
542 
544 {
545  // tell the painter that the anmation is paused
547  this->mpVisParameters->mAnimationRunning = false;
548  this->mpTimeSlider->setEnabled(true);
549  mpParaPanel->enableParameterChoice();
550  mpParaPanel->enableStepNumberChoice();
551 }
552 
554 {
555  if (this->mLooping)
556  {
557  this->mpControlWidget->getBackwardAction()->activate(QAction::Trigger);
558  }
559  else
560  {
561  this->mpControlWidget->getPauseAction()->activate(QAction::Trigger);
562  }
563 }
564 
566 {
567  this->mpControlWidget->setCurrentStep(static_cast<int>(i));
568  mpGLViewport->getPainter()->showStep(static_cast<int>(i));
569  mpGLViewport->getPainter()->updateGL();
570  mpParaPanel->setStepNumber(static_cast<int>(i));
571  CDataEntity* srcData = mpGLViewport->getPainter()->getDataSetAt(static_cast<int>(i));
572 
573  if (srcData)
574  {
575  updateValueTable(*srcData);
576  }
577 }
578 
580 {
581  mpTimeSlider->setValue(i);
582 }
583 
585 {
589  showStep(this->mpTimeSlider->value());
590 }
591 
593 {
597  showStep(this->mpTimeSlider->value());
598 }
599 
601 {
603  mpGLViewport->getPainter()->rescaleDataSetsWithNewMinMax(0.0, 1.0, getMinNodeSize(), getMaxNodeSize(), mpVisParameters->mScalingMode); // only [0.240] of possible HSV values (not fill circle in order to get good color range)
604  showStep(this->mpTimeSlider->value());
605 }
606 
608 {
610  mpGLViewport->getPainter()->rescaleDataSetsWithNewMinMax(getMinNodeSize(), getMaxNodeSize(), 0.0, 1.0, mpVisParameters->mScalingMode); // rescaling, because min and max node size changed (interpretation as color value takes place elsewhere),only [0.240] of possible HSV values (not fill circle in order to get good color range)
611  showStep(this->mpTimeSlider->value());
612 }
613 
615 {
616  mpTimeSlider->setValue(val);
617 }
618 
619 // set minimum possible node size for animation
621 {
623  setMinNodeSize(minNdSize);
624  showStep(this->mpTimeSlider->value());
625 }
626 
627 // set maximum possible node size for animation
629 {
631  setMaxNodeSize(maxNdSize);
632  showStep(this->mpTimeSlider->value());
633 }
634 
636 {
638  setMinNodeSize(minNdSize);
639  setMaxNodeSize(maxNdSize);
640  showStep(this->mpTimeSlider->value());
641 }
642 
644 {
645  mpGLViewport->getPainter()->setFontSizeForLabels((unsigned int) size);
646 }
647 
649 {
650  C_INT32 w = 19;
651  C_INT32 h = 19;
652  QImage img = QImage(w, h, QImage::Format_Indexed8);
653  img.setNumColors(2);
654  img.setColor(0, qRgb(0, 0, 200));
655  C_INT16 x, y;
656 
657  for (x = 0; x < w; x++)
658  {
659  for (y = 0; y < h; y++)
660  {
661  img.setPixel(x, y, 0);
662  }
663  }
664 
665  C_INT32 delta = 0;
666  img.setColor(1, qRgb(255, 0, 0));
667 
668  for (x = 3; x < w - 3; x++)
669  {
670  for (y = 3 + delta; y < h - 3 - delta; y++)
671  {
672  img.setPixel(x, y, 1);
673  }
674 
675  if (fmod((double) x, 2.0) == 0)
676  delta++;
677  }
678 
679  QPixmap *pixmap = new QPixmap();
680  pixmap->fromImage(img);
681  QIcon iconset = QIcon(*pixmap);
682  delete pixmap;
683  return iconset;
684 }
685 
687 {
688  C_INT32 w = 20;
689  C_INT32 h = 20;
690  QImage img = QImage(w, h, QImage::Format_Indexed8);
691  img.setNumColors(2);
692  img.setColor(0, qRgb(0, 0, 200));
693  C_INT16 x, y;
694 
695  for (x = 0; x < w; x++)
696  {
697  for (y = 0; y < h; y++)
698  {
699  img.setPixel(x, y, 0);
700  }
701  }
702 
703  C_INT32 delta = 4;
704  img.setColor(1, qRgb(255, 0, 0));
705 
706  for (x = (delta - 1); x <= (w - delta); x++)
707  {
708  for (y = (delta - 1); y <= (h - delta); y++)
709  {
710  img.setPixel(x, y, 1);
711  }
712  }
713 
714  QPixmap *pixmap = new QPixmap();
715  pixmap->fromImage(img);
716  QIcon iconset = QIcon(*pixmap);
717  delete pixmap;
718  return iconset;
719 }
720 
721 // returns true because window is opened from COPASI and can be easily reopened
723 {
724  // int ret = CQMessageBox::warning(this, "SimWiz",
725  // "Do you really want to quit?",
726  // // tr("Do you really want to quit?\n"
727  // // "XXXXXXXX"),
728  // QMessageBox::Yes | QMessageBox::Default,
729  // QMessageBox::No,
730  // QMessageBox::Cancel | QMessageBox::Escape);
731  // if (ret == QMessageBox::Yes)
732  // return true;
733  // else if (ret == QMessageBox::Cancel)
734  // return false;
735 
736  return true;
737 }
738 
739 /**
740  * Make the layout fit the screen.
741  * Return the new zoom factor.
742  */
744 {
745  double zoom = this->mpGLViewport->fitToScreen();
746  return zoom;
747 }
748 
750 {
751  this->mpGLViewport->resetView();
752 }
753 
755 {
756  this->mpGLViewport->setZoomFactor(zoom);
757 }
758 
760 {
761  s.remove(s.size() - 1, 1);
762  // create a number from the text
763  double n = s.toDouble();
764  n /= 100.0;
765  this->setZoomFactor(n);
766 }
767 
769 {
770  if (this->mpLayout == pLayout) return;
771 
772  this->mpLayout = pLayout;
773 
774  if (this->mpLayout != NULL)
775  {
776  this->mpGLViewport->createGraph(this->mpLayout); // create local data structures
777  this->loadData();
778  }
779 
780  this->update();
781 }
782 
784 {
785  return this->mpControlWidget;
786 }
787 
789 {
790  // go to step 0 and stop
791  this->backwardAnimation();
792  this->mapLabelsToRectangles();
793 }
794 
796 {
797  // go to last step and redisplay
798  if (!this->mLooping)
799  {
800  this->pauseAnimation();
801  double stepNumber = (double)(this->mpGLViewport->getPainter()->getNumberOfSteps() - 1);
802  this->showStep(stepNumber);
803  // update the slider
804  disconnect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
805  this->mpTimeSlider->setValue(stepNumber);
806  connect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
807  }
808  else
809  {
810  this->backwardAnimation();
811  }
812 }
813 
815 {
816  // go to step 0 and redisplay
817  this->pauseAnimation();
818  this->mpGLViewport->getPainter()->showStep(0);
819  // update the slider
820  disconnect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
821  this->mpTimeSlider->setValue(0.0);
822  this->mpParaPanel->setStepNumber(0);
823  connect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
824 
825  if (this->mpControlWidget->isPlaying())
826  {
827  this->startAnimation();
828  }
829 }
830 
832 {
833  // raise step by one if possible and continue animation
834  // go to last step and redisplay
835  size_t currentStep = this->getCurrentStep();
836  ++currentStep;
837 
838  if (currentStep < this->mpGLViewport->getPainter()->getNumberOfSteps())
839  {
840  this->pauseAnimation();
841  this->showStep((double)currentStep);
842  // update the slider
843  disconnect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
844  this->mpTimeSlider->setValue((double)currentStep);
845  connect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
846  }
847 }
848 
850 {
851  // lower step by one if possible and redisplay
852  size_t currentStep = this->getCurrentStep();
853 
854  if (currentStep > 0)
855  {
856  --currentStep;
857  this->pauseAnimation();
858  this->showStep((double)currentStep);
859  // update the slider
860  disconnect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
861  this->mpTimeSlider->setValue((double)currentStep);
862  connect(mpTimeSlider, SIGNAL(valueChanged(double)), this, SLOT(showStep(double)));
863  }
864 }
865 
867 {
868  (checked == true) ? this->mpParaPanel->show() : this->mpParaPanel->hide();
869 
870  // if all object in the info box are hidden, we hide the info box
871  if (!checked && !this->mpValueTableAction->isChecked())
872  {
873  this->mpInfoBox->hide();
874  }
875  else
876  {
877  this->mpInfoBox->show();
878  }
879 }
880 
882 {
883  (checked == true) ? this->mpValTable->show() : this->mpValTable->hide();
884 
885  // if all object in the info box are hidden, we hide the info box
886  if (!checked && !this->mpParameterTableAction->isChecked())
887  {
888  this->mpInfoBox->hide();
889  }
890  else
891  {
892  this->mpInfoBox->show();
893  }
894 }
895 
897 {
898  (checked == true) ? this->mpToolbar->show() : this->mpToolbar->hide();
899 }
900 
902 {
903  (checked == true) ? this->mpFrame->show() : this->mpFrame->hide();
904 }
905 
907 {
908  this->mLooping = checked;
909 }
std::string getKeyForRow(int row) const
void setFontSizeForLabels(C_INT32 size)
CQPlayerControlWidget * getControlWidget()
MAPPING_MODE mMappingMode
void updateWidget()
double fitToScreen()
CQParaPanel * mpParaPanel
void setMaxNodeSize(C_FLOAT64 minNdSize)
virtual size_t size() const
SCALING_MODE mScalingMode
bool getValueForRow(int row) const
QAction * mpParameterTableAction
void slotParameterTableToggled(bool checked)
void setZoomFactor(double zoom)
void setValueOnSlider(C_INT32)
void setZoomFactor(QString s)
void setNumSteps(size_t numSteps)
C_FLOAT64 getOrigValueForSpecies(std::string nodeKey)
Definition: CDataEntity.cpp:70
void slotLoopActivated(bool checked)
CVisParameters * mpVisParameters
const CQGLNetworkPainter * getPainter() const
CDataEntity * getDataSetAt(size_t stepNumber)
#define C_INT32
Definition: copasi.h:90
void removeItemInAnimation(std::string s)
size_t getCurrentStep() const
static const double ZOOM_FACTORS[]
void insertValueTable(CDataEntity dataSet)
void setMinValue(C_INT32 minNdSize)
static const char *const ZOOM_FACTOR_STRINGS[]
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void setCurrentStep(size_t currentStep)
void rescaleDataSets(CVisParameters::SCALING_MODE scaleMode)
void createGraph(CLayout *lP)
const C_FLOAT64 & getX() const
Definition: CLBase.h:83
void setAnimationRunning(bool animationRunningP)
size_t getNumberOfSteps() const
static const QIcon & icon(const IconID &id)
CQGLViewport * mpGLViewport
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
#define C_INT16
Definition: copasi.h:91
void setRowInTable(int row, std::string key, std::string s, C_FLOAT64 val)
CVisParameters::SCALING_MODE getScalingMode()
void setMinNodeSize(C_FLOAT64 minNdSize)
void setScaleMode(CVisParameters::SCALING_MODE scaleMode)
std::string getNameForNodeKey(std::string key)
C_FLOAT64 getCurrentPositionY() const
void setLayout(CLayout *pLayout)
const C_FLOAT64 & getY() const
Definition: CLBase.h:84
void setMaxValue(C_INT32 maxNdSize)
void setFontSizeForLabels(unsigned int fs)
CQPlayerControlWidget * mpControlWidget
#define C_FLOAT64
Definition: copasi.h:92
void slotPlayerControlToggled(bool checked)
void slotToolbarToggled(bool checked)
bool export_bitmap(double x, double y, double width, double height, unsigned int imageWidth, unsigned int imageHeight, const QString &filename, const std::vector< size_t > frames)
void rescaleDataSetsWithNewMinMax(C_FLOAT64 oldMin, C_FLOAT64 oldMax, C_FLOAT64 newMin, C_FLOAT64 newMax, CVisParameters::SCALING_MODE scaleMode)
void parameterTableValueChanged(int row)
const CLPoint & getGraphMax()
void updateValueTable(CDataEntity dataSet)
std::string getNodeNameEntry(int i)
C_FLOAT64 getCurrentPositionX() const
C_FLOAT64 getZoomFactor() const
void setStepsPerSecond(C_INT16 val)
size_t getNumberOfElements()
Definition: CDataEntity.h:48
CQLayoutMainWindow(QWidget *pParent)
void addItemInAnimation(std::string s)
void setItemAnimated(std::string key, bool animatedP)
bool isCircleMode() const
CQCurrentValueTable * mpValTable
void setNumCols(int columns)
CVisParameters::MAPPING_MODE getMappingMode()
void updateRowInTable(int row, C_FLOAT64 val)
const CLPoint & getGraphMin()
void slotValueTableToggled(bool checked)
void setMinAndMaxValue(C_INT32 minNdSize, C_INT32 maxNdSize)
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)
const std::set< size_t > & getFrameSet() const