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

#include <CQEFMSpeciesDM.h>

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

Public Member Functions

virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
 
 CQEFMSpeciesDM (QObject *parent=0)
 
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 
virtual Qt::ItemFlags flags (const QModelIndex &index) const
 
virtual QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
virtual bool isDefaultRow (const QModelIndex &i) const
 
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
 
virtual bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
 
void setTask (const CEFMTask *pTask)
 
- Public Member Functions inherited from CQBaseDataModel
virtual bool clear ()
 
 CQBaseDataModel (QObject *parent=0)
 
QString createNewName (const QString name, const int nameCol)
 
bool insertRow ()
 
bool removeRow (int position)
 

Protected Member Functions

virtual bool insertRows (int position, int rows, const QModelIndex &index=QModelIndex())
 
virtual bool removeRows (int position, int rows, const QModelIndex &index=QModelIndex())
 

Private Attributes

std::vector< CFluxMode >
::const_iterator 
mBeginModes
 
std::vector< CMetab * >
::const_iterator 
mBeginSpecies
 
size_t mModesSize
 
const CModelmpModel
 
const CEFMTaskmpTask
 
size_t mSpeciesSize
 

Additional Inherited Members

- Signals inherited from CQBaseDataModel
void notifyGUI (ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
 

Detailed Description

Definition at line 31 of file CQEFMSpeciesDM.h.

Constructor & Destructor Documentation

CQEFMSpeciesDM::CQEFMSpeciesDM ( QObject *  parent = 0)

Definition at line 29 of file CQEFMSpeciesDM.cpp.

29  :
30  CQBaseDataModel(parent),
31  mpTask(NULL),
32  mBeginModes(),
33  mModesSize(0),
34  mpModel(NULL),
35  mBeginSpecies(),
36  mSpeciesSize(0)
37 {}
std::vector< CFluxMode >::const_iterator mBeginModes
std::vector< CMetab * >::const_iterator mBeginSpecies
const CEFMTask * mpTask
CQBaseDataModel(QObject *parent=0)
const CModel * mpModel

Member Function Documentation

int CQEFMSpeciesDM::columnCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Definition at line 47 of file CQEFMSpeciesDM.cpp.

References mpTask, and mSpeciesSize.

48 {
49  if (mpTask == NULL)
50  return 0;
51 
52  return (int)(mSpeciesSize + 1); // For flux mode number
53 }
const CEFMTask * mpTask
QVariant CQEFMSpeciesDM::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
virtual

Implements CQBaseDataModel.

Definition at line 63 of file CQEFMSpeciesDM.cpp.

References COL_ROW_NUMBER, CEFMTask::getSpeciesChanges(), mBeginModes, mBeginSpecies, mpTask, and rowCount().

64 {
65  if (!index.isValid())
66  return QVariant();
67 
68  if (index.row() >= rowCount())
69  return QVariant();
70 
71  if (role == Qt::DisplayRole || role == Qt::EditRole)
72  {
73  //std::vector< CFluxMode >::const_iterator itMode = mBeginModes + index.row();
74 
75  switch (index.column())
76  {
77  case COL_ROW_NUMBER:
78  return QVariant(index.row() + 1);
79  break;
80 
81  default:
82  {
83  std::pair< C_FLOAT64, C_FLOAT64 > Changes =
84  mpTask->getSpeciesChanges(*(mBeginModes + index.row()), **(mBeginSpecies + index.column() - 1));
85 
86  if (Changes.first > 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon() ||
87  Changes.second > 100.0 * std::numeric_limits< C_FLOAT64 >::epsilon())
88  {
89  return QVariant(QString("-" + QString::number(Changes.first) + " | +" + QString::number(Changes.second)));
90  }
91 
92  return QVariant();
93  }
94  }
95  }
96 
97  return QVariant();
98 }
std::pair< C_FLOAT64, C_FLOAT64 > getSpeciesChanges(const CFluxMode &fluxMode, const CMetab &metab) const
Definition: CEFMTask.cpp:216
std::vector< CFluxMode >::const_iterator mBeginModes
std::vector< CMetab * >::const_iterator mBeginSpecies
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
const CEFMTask * mpTask
#define COL_ROW_NUMBER
Qt::ItemFlags CQEFMSpeciesDM::flags ( const QModelIndex &  index) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 55 of file CQEFMSpeciesDM.cpp.

56 {
57  if (!index.isValid())
58  return Qt::ItemIsEnabled;
59 
60  return QAbstractItemModel::flags(index) & ~Qt::ItemIsEditable;
61 }
QVariant CQEFMSpeciesDM::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
virtual

Implements CQBaseDataModel.

Definition at line 100 of file CQEFMSpeciesDM.cpp.

References COL_ROW_NUMBER, FROM_UTF8, CMetabNameInterface::getDisplayName(), mBeginSpecies, and mpModel.

102 {
103  if (role != Qt::DisplayRole)
104  return QVariant();
105 
106  if (orientation == Qt::Horizontal)
107  {
108  switch (section)
109  {
110  case COL_ROW_NUMBER:
111  return QVariant(QString("#"));
112  break;
113 
114  default:
115  return QVariant(QString(FROM_UTF8(CMetabNameInterface::getDisplayName(mpModel, **(mBeginSpecies + section - 1), false))));
116  break;
117  }
118  }
119 
120  return QString("%1").arg(section + 1);
121 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
std::vector< CMetab * >::const_iterator mBeginSpecies
static std::string getDisplayName(const CModel *model, const std::string &key, const bool &quoted)
const CModel * mpModel
#define COL_ROW_NUMBER
bool CQEFMSpeciesDM::insertRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 158 of file CQEFMSpeciesDM.cpp.

159 {
160  return false;
161 }
bool CQEFMSpeciesDM::isDefaultRow ( const QModelIndex &  i) const
virtual

Reimplemented from CQBaseDataModel.

Definition at line 170 of file CQEFMSpeciesDM.cpp.

171 {
172  return false;
173 }
bool CQEFMSpeciesDM::removeRows ( int  position,
int  rows,
const QModelIndex &  index = QModelIndex() 
)
protectedvirtual

Implements CQBaseDataModel.

Definition at line 164 of file CQEFMSpeciesDM.cpp.

165 {
166  return false;
167 }
int CQEFMSpeciesDM::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Definition at line 39 of file CQEFMSpeciesDM.cpp.

References mModesSize, and mpTask.

Referenced by data().

40 {
41  if (mpTask == NULL)
42  return 0;
43 
44  return (int) mModesSize;
45 }
const CEFMTask * mpTask
bool CQEFMSpeciesDM::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
virtual

Implements CQBaseDataModel.

Definition at line 152 of file CQEFMSpeciesDM.cpp.

153 {
154  return false;
155 }
void CQEFMSpeciesDM::setTask ( const CEFMTask pTask)

Definition at line 123 of file CQEFMSpeciesDM.cpp.

References CCopasiVector< T >::begin(), CEFMTask::getFluxModes(), CModel::getMetabolites(), CCopasiProblem::getModel(), CCopasiTask::getProblem(), mBeginModes, mBeginSpecies, mModesSize, mpModel, mpTask, mSpeciesSize, pTask, and CCopasiVector< T >::size().

Referenced by CQEFMResultWidget::loadResult().

124 {
125  mpTask = pTask;
126 
127  if (mpTask != NULL)
128  {
129  mBeginModes = mpTask->getFluxModes().begin();
130  mModesSize = mpTask->getFluxModes().size();
131 
133 
134  if (mpModel != NULL)
135  {
138  }
139  else
140  {
141  mSpeciesSize = 0;
142  }
143  }
144  else
145  {
146  mModesSize = 0;
147  mpModel = NULL;
148  mSpeciesSize = 0;
149  }
150 }
CCopasiProblem * getProblem()
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
std::vector< CFluxMode >::const_iterator mBeginModes
std::vector< CMetab * >::const_iterator mBeginSpecies
virtual size_t size() const
iterator begin()
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMTask.cpp:183
CTSSATask * pTask
const CEFMTask * mpTask
CModel * getModel() const
const CModel * mpModel

Member Data Documentation

std::vector< CFluxMode >::const_iterator CQEFMSpeciesDM::mBeginModes
private

Definition at line 60 of file CQEFMSpeciesDM.h.

Referenced by data(), and setTask().

std::vector< CMetab * >::const_iterator CQEFMSpeciesDM::mBeginSpecies
private

Definition at line 64 of file CQEFMSpeciesDM.h.

Referenced by data(), headerData(), and setTask().

size_t CQEFMSpeciesDM::mModesSize
private

Definition at line 61 of file CQEFMSpeciesDM.h.

Referenced by rowCount(), and setTask().

const CModel* CQEFMSpeciesDM::mpModel
private

Definition at line 63 of file CQEFMSpeciesDM.h.

Referenced by headerData(), and setTask().

const CEFMTask* CQEFMSpeciesDM::mpTask
private

Definition at line 58 of file CQEFMSpeciesDM.h.

Referenced by columnCount(), data(), rowCount(), and setTask().

size_t CQEFMSpeciesDM::mSpeciesSize
private

Definition at line 65 of file CQEFMSpeciesDM.h.

Referenced by columnCount(), and setTask().


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