COPASI API  4.16.103
CQMatrixDialog.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/UI/CQMatrixDialog.cpp,v $
3 // $Revision: 1.9 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/09/30 16:39:37 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 #include "CQMatrixDialog.h"
15 
16 #include <QtCore/QVariant>
18 #include "qtUtilities.h"
19 
20 /*
21  * Constructs a CQMatrixDialog as a child of 'parent', with the
22  * name 'name' and widget flags set to 'f'.
23  *
24  * The dialog will by default be modeless, unless you set 'modal' to
25  * true to construct a modal dialog.
26  */
27 CQMatrixDialog::CQMatrixDialog(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
28  : QDialog(parent, fl)
29 {
30  setObjectName(QString::fromUtf8(name));
31  setModal(modal);
32  setupUi(this);
33 
34 }
35 
36 /*
37  * Destroys the object and frees any allocated resources
38  */
40 {
41  // no need to delete child widgets, Qt does it all for us
42 }
43 
44 void CQMatrixDialog::setArray(const CArrayAnnotation *tmp, bool single)
45 {
46  size_t i;
47 
48  mpLabelRow->setText("Rows : " + FROM_UTF8(tmp->getDimensionDescription(0)));
49  size_t nRows = tmp->size()[0];
50 
51  if (!single)
52  mpCBRow->insertItem(mpCBRow->count(), "ALL");
53 
54  if (FROM_UTF8(tmp->getObjectName()).contains("Eigenvalues"))
55  {
56  for (i = 0; i < nRows; i++)
57  mpCBRow->insertItem(mpCBRow->count(), QString::number(i + 1));
58  }
59  else
60  {
61  for (i = 0; i < nRows; i++)
62  mpCBRow->insertItem(mpCBRow->count(), FROM_UTF8(tmp->getAnnotationsString(0, true)[i]));
63  }
64 
65  mpLabelColumn->hide();
66  mpCBColumn->hide();
67 
68  mpLabelDim3->hide();
69  mpCBDim3->hide();
70 
71  if (tmp->dimensionality() > 1)
72  {
73  mpLabelColumn->show();
74  mpCBColumn->show();
75 
76  mpLabelColumn->setText("Columns : " + FROM_UTF8(tmp->getDimensionDescription(1)));
77  size_t nCols = tmp->size()[1];
78 
79  if (!single)
80  mpCBColumn->insertItem(mpCBColumn->count(), "ALL");
81 
82  if (FROM_UTF8(tmp->getObjectName()).contains("Eigenvalues"))
83  {
84  mpCBColumn->insertItem(mpCBColumn->count(), "Real part");
85  mpCBColumn->insertItem(mpCBColumn->count(), "Imaginary part");
86  }
87  else
88  {
89  for (i = 0; i < nCols; i++)
90  mpCBColumn->insertItem(mpCBColumn->count(), FROM_UTF8(tmp->getAnnotationsString(1, true)[i]));
91  }
92 
93  if (tmp->dimensionality() == 3)
94  {
95  mpLabelDim3->show();
96  mpCBDim3->show();
97 
98  mpLabelDim3->setText("Dimension : " + FROM_UTF8(tmp->getDimensionDescription(2)));
99  size_t nDims = tmp->size()[2];
100 
101  if (!single)
102  mpCBDim3->insertItem(mpCBDim3->count(), "ALL");
103 
104  for (i = 0; i < nDims; i++)
105  mpCBDim3->insertItem(mpCBDim3->count(), FROM_UTF8(tmp->getAnnotationsString(2, true)[i]));
106  }
107  }
108 }
const std::string & getDimensionDescription(size_t d) const
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const std::string & getObjectName() const
const std::vector< std::string > & getAnnotationsString(size_t d, bool display=true) const
CQMatrixDialog(QWidget *parent=0, const char *name=0, bool modal=false, Qt::WindowFlags fl=0)
Header file of class CArrayAnnotation.
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
virtual void setArray(const CArrayAnnotation *tmp, bool single)
CCopasiAbstractArray::index_type size() const
size_t dimensionality() const