COPASI API  4.16.103
Static Protected Member Functions | List of all members
CLayoutInitializer Class Reference

#include <CLayoutInitializer.h>

Static Protected Member Functions

static CLCompartmentGlyphcreateCompartmentGlyph (const CCompartment *c)
 
static CLMetabGlyphcreateMetabGlyph (const CMetab *m)
 
static CLReactionGlyphcreateReactionGlyph (const CReaction *r, const std::map< std::string, std::string > &mm)
 

Detailed Description

This class contains (static) methods that initialize the layout data structure from a copasi model. A proper layout is not generated, this is rather a starting point for the layout algorithms

Definition at line 37 of file CLayoutInitializer.h.

Member Function Documentation

CLCompartmentGlyph * CLayoutInitializer::createCompartmentGlyph ( const CCompartment c)
staticprotected

one layout element is created for every model element. This acts as a pseudo constructor for a CLayout.

Definition at line 69 of file CLayoutInitializer.cpp.

References CModelEntity::getKey(), and CLGraphicalObject::setModelObjectKey().

70 {
71  if (!c) return NULL;
72 
74  cg->setModelObjectKey(c->getKey());
75 
76  return cg;
77 }
void setModelObjectKey(const std::string &k)
virtual const std::string & getKey() const
CLMetabGlyph * CLayoutInitializer::createMetabGlyph ( const CMetab m)
staticprotected

Definition at line 79 of file CLayoutInitializer.cpp.

References CModelEntity::getKey(), and CLGraphicalObject::setModelObjectKey().

80 {
81  if (!m) return NULL;
82 
83  CLMetabGlyph* cg = new CLMetabGlyph();
84  cg->setModelObjectKey(m->getKey());
85 
86  return cg;
87 }
void setModelObjectKey(const std::string &k)
virtual const std::string & getKey() const
CLReactionGlyph * CLayoutInitializer::createReactionGlyph ( const CReaction r,
const std::map< std::string, std::string > &  mm 
)
staticprotected

Definition at line 89 of file CLayoutInitializer.cpp.

References CLReactionGlyph::addMetabReferenceGlyph(), CReaction::getChemEq(), CReaction::getKey(), CChemEq::getModifiers(), CChemEq::getProducts(), CChemEq::getSubstrates(), CLMetabReferenceGlyph::MODIFIER, CLMetabReferenceGlyph::PRODUCT, CLMetabReferenceGlyph::setMetabGlyphKey(), CLGraphicalObject::setModelObjectKey(), CLMetabReferenceGlyph::setRole(), CCopasiVector< T >::size(), and CLMetabReferenceGlyph::SUBSTRATE.

91 {
92  if (!r) return NULL;
93 
94  CLReactionGlyph* rg = new CLReactionGlyph();
95  rg->setModelObjectKey(r->getKey());
96 
97  const CChemEq & ce = r->getChemEq();
98  size_t i, imax;
99 
100  //substrates
101  imax = ce.getSubstrates().size();
102 
103  for (i = 0; i < imax; ++i)
104  {
105  //create metab reference glyph and add to reaction glyph
108  rg->addMetabReferenceGlyph(tmpMRG);
109 
110  //get the metab key from the copasi reaction
111  std::string metabKey = ce.getSubstrates()[i]->getMetaboliteKey();
112 
113  //set the corresponding metab glyph key
114  const std::map<std::string, std::string>::const_iterator it = mm.find(metabKey);
115 
116  if (it != mm.end())
117  tmpMRG->setMetabGlyphKey(it->second);
118  }
119 
120  //products
121  imax = ce.getProducts().size();
122 
123  for (i = 0; i < imax; ++i)
124  {
125  //create metab reference glyph and add to reaction glyph
128  rg->addMetabReferenceGlyph(tmpMRG);
129 
130  //get the metab key from the copasi reaction
131  std::string metabKey = ce.getProducts()[i]->getMetaboliteKey();
132 
133  //set the corresponding metab glyph key
134  const std::map<std::string, std::string>::const_iterator it = mm.find(metabKey);
135 
136  if (it != mm.end())
137  tmpMRG->setMetabGlyphKey(it->second);
138  }
139 
140  //modifier
141  imax = ce.getModifiers().size();
142 
143  for (i = 0; i < imax; ++i)
144  {
145  //create metab reference glyph and add to reaction glyph
148  rg->addMetabReferenceGlyph(tmpMRG);
149 
150  //get the metab key from the copasi reaction
151  std::string metabKey = ce.getModifiers()[i]->getMetaboliteKey();
152 
153  //set the corresponding metab glyph key
154  const std::map<std::string, std::string>::const_iterator it = mm.find(metabKey);
155 
156  if (it != mm.end())
157  tmpMRG->setMetabGlyphKey(it->second);
158  }
159 
160  return rg;
161 }
virtual size_t size() const
virtual const std::string & getKey() const
Definition: CReaction.cpp:190
void addMetabReferenceGlyph(CLMetabReferenceGlyph *glyph)
void setModelObjectKey(const std::string &k)
const CCopasiVector< CChemEqElement > & getProducts() const
Definition: CChemEq.cpp:63
const CCopasiVector< CChemEqElement > & getSubstrates() const
Definition: CChemEq.cpp:60
void setMetabGlyphKey(const std::string &k)
const CCopasiVector< CChemEqElement > & getModifiers() const
Definition: CChemEq.cpp:66
const CChemEq & getChemEq() const
Definition: CReaction.cpp:223

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