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

#include <CQSensResultWidget.h>

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

Public Member Functions

 CQSensResultWidget (QWidget *parent=0, const char *name=0, Qt::WFlags fl=0)
 
virtual bool leave ()
 
void newResult ()
 
virtual bool update (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key)
 
 ~CQSensResultWidget ()
 
- Public Member Functions inherited from CopasiWidget
 CopasiWidget (QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
 
bool enter (const std::string &key)
 
CCopasiDataModelgetDataModel ()
 
bool getIgnoreUpdates ()
 
virtual void setFramework (int framework)
 
void setIgnoreUpdates (bool v)
 

Protected Slots

void saveToFile ()
 
- Protected Slots inherited from CopasiWidget
virtual bool protectedNotify (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 

Protected Member Functions

void clearArrays ()
 
virtual bool enterProtected ()
 

Protected Attributes

const CArrayAnnotationmpCollapsedResult
 
const CArrayAnnotationmpResult
 
const CArrayAnnotationmpScaledResult
 
- Protected Attributes inherited from CopasiWidget
int mFramework
 
bool mIgnoreUpdates
 
std::string mKey
 
CCopasiDataModelmpDataModel
 
ListViewsmpListView
 
CCopasiObjectmpObject
 

Private Member Functions

void init ()
 

Detailed Description

Definition at line 32 of file CQSensResultWidget.h.

Constructor & Destructor Documentation

CQSensResultWidget::CQSensResultWidget ( QWidget *  parent = 0,
const char *  name = 0,
Qt::WFlags  fl = 0 
)

Definition at line 37 of file CQSensResultWidget.cpp.

References init().

38  : CopasiWidget(parent, name, fl),
39  mpResult(NULL)
40 {
41  setupUi(this);
42 
43  init();
44 }
const CArrayAnnotation * mpResult
CopasiWidget(QWidget *parent=0, const char *name=0, Qt::WFlags f=0)
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
CQSensResultWidget::~CQSensResultWidget ( )

Definition at line 49 of file CQSensResultWidget.cpp.

50 {}

Member Function Documentation

void CQSensResultWidget::clearArrays ( )
protected

Definition at line 111 of file CQSensResultWidget.cpp.

Referenced by enterProtected(), and newResult().

112 {
113  mArrayWidget->setArrayAnnotation(NULL);
114  mArrayWidgetScaled->setArrayAnnotation(NULL);
115  mArrayWidgetCollapsed->setArrayAnnotation(NULL);
116 }
bool CQSensResultWidget::enterProtected ( )
protectedvirtual

Reimplemented from CopasiWidget.

Definition at line 135 of file CQSensResultWidget.cpp.

References clearArrays(), CCopasiRootContainer::getDatamodelList(), CCopasiTask::getProblem(), CSensProblem::getResultAnnotated(), mpResult, and pTask.

136 {
137  //clear the widget if the pointer to the result has changed
138  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
139  CSensTask * pTask =
140  dynamic_cast<CSensTask*>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Sensitivities"]);
141 
142  if (!pTask)
143  {
144  clearArrays();
145  return false;
146  }
147 
148  CSensProblem * pProblem = dynamic_cast< CSensProblem * >(pTask->getProblem());
149 
150  if (!pProblem)
151  {
152  clearArrays();
153  return false;
154  }
155 
156  if (mpResult != pProblem->getResultAnnotated())
157  {
158  clearArrays();
159  return false;
160  }
161 
162  return true;
163 }
const CArrayAnnotation * mpResult
CCopasiProblem * getProblem()
CTSSATask * pTask
CArrayAnnotation * getResultAnnotated()
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void CQSensResultWidget::init ( )
private

Definition at line 52 of file CQSensResultWidget.cpp.

References CColorScaleAverage::setFactor().

Referenced by CQSensResultWidget().

53 {
54  // unscaled array
55  CColorScaleBiLog * tcs = new CColorScaleBiLog();
56  mArrayWidget->setColorCoding(tcs);
57  mArrayWidget->setColorScalingAutomatic(true);
58 
59  //scaled array
61  mArrayWidgetScaled->setColorCoding(tcs2);
62  tcs2->setFactor(3.0);
63  mArrayWidgetScaled->setColorScalingAutomatic(true);
64 
65  //scaled array
67  mArrayWidgetCollapsed->setColorCoding(tcs3);
68  tcs3->setFactor(3.0);
69  mArrayWidgetCollapsed->setColorScalingAutomatic(true);
70 }
void setFactor(C_FLOAT64 f)
Definition: CColorScale.h:171
bool CQSensResultWidget::leave ( )
virtual

Reimplemented from CopasiWidget.

Definition at line 130 of file CQSensResultWidget.cpp.

131 {
132  return true;
133 }
void CQSensResultWidget::newResult ( )

Definition at line 72 of file CQSensResultWidget.cpp.

References clearArrays(), CSensProblem::collapsRequested(), CSensProblem::getCollapsedResultAnnotated(), CCopasiRootContainer::getDatamodelList(), CCopasiTask::getProblem(), CSensProblem::getResultAnnotated(), CSensProblem::getScaledResultAnnotated(), mpCollapsedResult, mpResult, mpScaledResult, and pTask.

Referenced by SensitivitiesWidget::taskFinishedEvent().

73 {
74  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
75 
76  // clear the old one
77  clearArrays();
78 
79  CSensTask * pTask =
80  dynamic_cast<CSensTask*>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Sensitivities"]);
81 
82  if (!pTask)
83  return;
84 
85  CSensProblem * pProblem = dynamic_cast< CSensProblem * >(pTask->getProblem());
86 
87  if (!pProblem)
88  return;
89 
90  mpResult = pProblem->getResultAnnotated();
92 
93  mArrayWidget->setArrayAnnotation(mpResult);
94  mArrayWidgetScaled->setArrayAnnotation(mpScaledResult);
95 
96  //tab for collapsed result
97  if (pProblem->collapsRequested())
98  {
100  mpTab->setTabEnabled(mpTab->indexOf(mArrayWidgetCollapsed), true);
101  }
102  else
103  {
104  mpCollapsedResult = NULL;
105  mpTab->setTabEnabled(mpTab->indexOf(mArrayWidgetCollapsed), false);
106  }
107 
108  mArrayWidgetCollapsed->setArrayAnnotation(mpCollapsedResult);
109 }
const CArrayAnnotation * mpResult
bool collapsRequested() const
CCopasiProblem * getProblem()
CArrayAnnotation * getCollapsedResultAnnotated()
const CArrayAnnotation * mpCollapsedResult
CArrayAnnotation * getScaledResultAnnotated()
CTSSATask * pTask
CArrayAnnotation * getResultAnnotated()
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
const CArrayAnnotation * mpScaledResult
void CQSensResultWidget::saveToFile ( )
protectedslot

Definition at line 165 of file CQSensResultWidget.cpp.

References C_INT32, checkSelection(), CLocaleString::fromUtf8(), CCopasiRootContainer::getDatamodelList(), CCopasiTask::getResult(), CopasiFileDialog::getSaveFileName(), pTask, and TO_UTF8.

166 {
167  C_INT32 Answer = QMessageBox::No;
168  QString fileName;
169 
170  while (Answer == QMessageBox::No)
171  {
172  fileName =
173  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
174  "untitled.txt", "TEXT Files (*.txt)", "Save to");
175 
176  if (fileName.isEmpty()) return;
177 
178  // Checks whether the file exists
179  Answer = checkSelection(fileName);
180 
181  if (Answer == QMessageBox::Cancel) return;
182  }
183 
184  std::ofstream file(CLocaleString::fromUtf8(TO_UTF8(fileName)).c_str());
185 
186  if (file.fail())
187  return;
188 
189  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
190  CSensTask * pTask =
191  dynamic_cast<CSensTask*>((*(*CCopasiRootContainer::getDatamodelList())[0]->getTaskList())["Sensitivities"]);
192 
193  if (pTask != NULL)
194  file << pTask->getResult();
195 
196 // pTask->print(&file);
197 
198  return;
199 }
#define C_INT32
Definition: copasi.h:90
CTSSATask * pTask
C_INT32 checkSelection(const QString &file)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
const CResult & getResult() const
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
static CLocaleString fromUtf8(const std::string &utf8)
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 CQSensResultWidget::update ( ListViews::ObjectType  objectType,
ListViews::Action  action,
const std::string &  key 
)
virtual

Reimplemented from CopasiWidget.

Definition at line 120 of file CQSensResultWidget.cpp.

122 {
123  /* if (this->isShown())
124  return loadFromBackend();
125  else
126  return true;*/
127  return true;
128 }

Member Data Documentation

const CArrayAnnotation* CQSensResultWidget::mpCollapsedResult
protected

Definition at line 55 of file CQSensResultWidget.h.

Referenced by newResult().

const CArrayAnnotation* CQSensResultWidget::mpResult
protected

Definition at line 53 of file CQSensResultWidget.h.

Referenced by enterProtected(), and newResult().

const CArrayAnnotation* CQSensResultWidget::mpScaledResult
protected

Definition at line 54 of file CQSensResultWidget.h.

Referenced by newResult().


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