COPASI API  4.16.103
Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | List of all members
CLayoutState Class Reference

#include <CLayoutState.h>

Collaboration diagram for CLayoutState:
Collaboration graph
[legend]

Public Member Functions

void applyTo (CLayout *layout) const
 
 CLayoutState (const CLayout *layout)
 
virtual ~CLayoutState ()
 

Static Public Member Functions

static void tagLayout (CLayout *layout)
 

Protected Types

typedef std::map< const
std::string, CLBoundingBox * > 
StringBoundMap
 
typedef std::map< const
std::string, CLCurve * > 
StringCurveMap
 

Protected Attributes

std::map< const std::string,
CLBoundingBox * > 
mAdditionalState
 
std::map< const std::string,
CLBoundingBox * > 
mCompartmentState
 
std::map< const std::string,
CLCurve * > 
mCurves
 
std::map< const std::string,
CLBoundingBox * > 
mReactionState
 
std::map< const std::string,
CLBoundingBox * > 
mSpeciesState
 
std::map< const std::string,
CLBoundingBox * > 
mTextState
 

Detailed Description

Definition at line 16 of file CLayoutState.h.

Member Typedef Documentation

typedef std::map<const std::string, CLBoundingBox*> CLayoutState::StringBoundMap
protected

Definition at line 27 of file CLayoutState.h.

typedef std::map<const std::string, CLCurve*> CLayoutState::StringCurveMap
protected

Definition at line 28 of file CLayoutState.h.

Constructor & Destructor Documentation

CLayoutState::CLayoutState ( const CLayout layout)

Definition at line 84 of file CLayoutState.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), CLayout::getListOfTextGlyphs(), mAdditionalState, mCompartmentState, mCurves, mReactionState, mSpeciesState, and mTextState.

87  , mReactionState()
88  , mSpeciesState()
89  , mTextState()
90  , mCurves()
91 {
92  if (layout == NULL) return;
93 
94  const CCopasiVector<CLGeneralGlyph> & general = layout->getListOfGeneralGlyphs();
96 
97  while (generalIt != general.end())
98  {
99  mAdditionalState[(*generalIt)->getTag()] = new CLBoundingBox((*generalIt)->getBoundingBox());
100  ++generalIt;
101  }
102 
105 
106  while (compIt != comps.end())
107  {
108  mCompartmentState[(*compIt)->getTag()] = new CLBoundingBox((*compIt)->getBoundingBox());
109  ++compIt;
110  }
111 
112  const CCopasiVector<CLReactionGlyph> & reactions = layout->getListOfReactionGlyphs();
114 
115  while (reactIt != reactions.end())
116  {
117  mReactionState[(*reactIt)->getTag()] = new CLBoundingBox((*reactIt)->getBoundingBox());
118 
119  mCurves[(*reactIt)->getTag()] = new CLCurve((*reactIt)->getCurve());
120 
121  CCopasiVector<CLMetabReferenceGlyph>::const_iterator refIt = (*reactIt)->getListOfMetabReferenceGlyphs().begin();
122 
123  for (; refIt != (*reactIt)->getListOfMetabReferenceGlyphs().end(); ++refIt)
124  mCurves[(*refIt)->getTag()] = new CLCurve((*refIt)->getCurve());
125 
126  ++reactIt;
127  }
128 
129  const CCopasiVector<CLMetabGlyph> & species = layout->getListOfMetaboliteGlyphs();
131 
132  while (speciesIt != species.end())
133  {
134  mSpeciesState[(*speciesIt)->getTag()] = new CLBoundingBox((*speciesIt)->getBoundingBox());
135  ++speciesIt;
136  }
137 
138  const CCopasiVector<CLTextGlyph> & texts = layout->getListOfTextGlyphs();
140 
141  while (textIt != texts .end())
142  {
143  mTextState[(*textIt)->getTag()] = new CLBoundingBox((*textIt)->getBoundingBox());
144  ++textIt;
145  }
146 }
std::map< const std::string, CLCurve * > mCurves
Definition: CLayoutState.h:34
const CCopasiVector< CLTextGlyph > & getListOfTextGlyphs() const
Definition: CLayout.h:120
iterator begin()
const CCopasiVector< CLCompartmentGlyph > & getListOfCompartmentGlyphs() const
Definition: CLayout.h:81
iterator end()
std::map< const std::string, CLBoundingBox * > mCompartmentState
Definition: CLayoutState.h:30
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
Definition: CLayout.h:94
const CCopasiVector< CLGeneralGlyph > & getListOfGeneralGlyphs() const
Definition: CLayout.h:133
std::map< const std::string, CLBoundingBox * > mSpeciesState
Definition: CLayoutState.h:32
std::map< const std::string, CLBoundingBox * > mAdditionalState
Definition: CLayoutState.h:29
std::map< const std::string, CLBoundingBox * > mTextState
Definition: CLayoutState.h:33
std::map< const std::string, CLBoundingBox * > mReactionState
Definition: CLayoutState.h:31
const CCopasiVector< CLReactionGlyph > & getListOfReactionGlyphs() const
Definition: CLayout.h:107
CLayoutState::~CLayoutState ( )
virtual

Definition at line 148 of file CLayoutState.cpp.

References mAdditionalState, mCompartmentState, mCurves, mReactionState, mSpeciesState, and mTextState.

149 {
150  std::map<const std::string, CLBoundingBox*>::reverse_iterator it;
151 
152  for (it = mAdditionalState.rbegin(); it != mAdditionalState.rend(); ++it)
153  {
154  delete it->second;
155  }
156 
157  for (it = mCompartmentState.rbegin(); it != mCompartmentState.rend(); ++it)
158  {
159  delete it->second;
160  }
161 
162  for (it = mReactionState.rbegin(); it != mReactionState.rend(); ++it)
163  {
164  delete it->second;
165  }
166 
167  for (it = mSpeciesState.rbegin(); it != mSpeciesState.rend(); ++it)
168  {
169  delete it->second;
170  }
171 
172  for (it = mTextState.rbegin(); it != mTextState.rend(); ++it)
173  {
174  delete it->second;
175  }
176 
177  std::map<const std::string, CLCurve*>::reverse_iterator curveIt;
178 
179  for (curveIt = mCurves.rbegin(); curveIt != mCurves.rend(); ++curveIt)
180  {
181  delete curveIt->second;
182  }
183 }
std::map< const std::string, CLCurve * > mCurves
Definition: CLayoutState.h:34
std::map< const std::string, CLBoundingBox * > mCompartmentState
Definition: CLayoutState.h:30
std::map< const std::string, CLBoundingBox * > mSpeciesState
Definition: CLayoutState.h:32
std::map< const std::string, CLBoundingBox * > mAdditionalState
Definition: CLayoutState.h:29
std::map< const std::string, CLBoundingBox * > mTextState
Definition: CLayoutState.h:33
std::map< const std::string, CLBoundingBox * > mReactionState
Definition: CLayoutState.h:31

Member Function Documentation

void CLayoutState::applyTo ( CLayout layout) const

Definition at line 198 of file CLayoutState.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), CLayout::getListOfTextGlyphs(), mAdditionalState, mCompartmentState, mCurves, mReactionState, mSpeciesState, mTextState, and STATE_SET_POSITIONS.

199 {
200  if (layout == NULL) return;
201 
202  CLayoutState current(layout);
203 
205  CCopasiVector<CLGeneralGlyph>::iterator generalIt = general.begin();
206  STATE_SET_POSITIONS(mAdditionalState, generalIt, general.end());
207 
210  STATE_SET_POSITIONS(mCompartmentState, compIt, comps.end());
211 
213  CCopasiVector<CLReactionGlyph>::iterator reactIt = reactions.begin();
214  STATE_SET_POSITIONS(mReactionState, reactIt, reactions.end());
215 
216  for (reactIt = reactions.begin(); reactIt != reactions.end(); ++reactIt)
217  {
218  const std::string& rkey = ((*reactIt)->getTag());
219  StringCurveMap::const_iterator cIt = mCurves.find(rkey);
220 
221  if (cIt != mCurves.end())
222  {
223  CLCurve* current = cIt->second;
224  (*reactIt)->setCurve(*current);
225  }
226 
227  CCopasiVector<CLMetabReferenceGlyph>::iterator refIt = (*reactIt)->getListOfMetabReferenceGlyphs().begin();
228 
229  for (; refIt != (*reactIt)->getListOfMetabReferenceGlyphs().end(); ++refIt)
230  {
231  const std::string& key = ((*refIt)->getTag());
232  cIt = mCurves.find(key);
233 
234  if (cIt == mCurves.end())
235  continue;
236 
237  CLCurve* current = cIt->second;
238  (*refIt)->setCurve(*current);
239  }
240  }
241 
243  CCopasiVector<CLMetabGlyph>::iterator speciesIt = species.begin();
244  STATE_SET_POSITIONS(mSpeciesState, speciesIt, species.end());
245 
248  STATE_SET_POSITIONS(mTextState, textIt, texts.end());
249 }
std::map< const std::string, CLCurve * > mCurves
Definition: CLayoutState.h:34
const CCopasiVector< CLTextGlyph > & getListOfTextGlyphs() const
Definition: CLayout.h:120
iterator begin()
#define STATE_SET_POSITIONS(objectMap, it, endIt)
const CCopasiVector< CLCompartmentGlyph > & getListOfCompartmentGlyphs() const
Definition: CLayout.h:81
iterator end()
std::map< const std::string, CLBoundingBox * > mCompartmentState
Definition: CLayoutState.h:30
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
Definition: CLayout.h:94
const CCopasiVector< CLGeneralGlyph > & getListOfGeneralGlyphs() const
Definition: CLayout.h:133
std::map< const std::string, CLBoundingBox * > mSpeciesState
Definition: CLayoutState.h:32
std::map< const std::string, CLBoundingBox * > mAdditionalState
Definition: CLayoutState.h:29
std::map< const std::string, CLBoundingBox * > mTextState
Definition: CLayoutState.h:33
std::map< const std::string, CLBoundingBox * > mReactionState
Definition: CLayoutState.h:31
const CCopasiVector< CLReactionGlyph > & getListOfReactionGlyphs() const
Definition: CLayout.h:107
void CLayoutState::tagLayout ( CLayout layout)
static

Definition at line 17 of file CLayoutState.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), CLayout::getListOfTextGlyphs(), and tagKey().

Referenced by CQNewMainWindow::createSpringLayout(), CQAnimationWindow::slotAutoLayout(), and CQAnimationWindow::slotRandomizeLayout().

18 {
19  if (layout == NULL) return;
20 
22  CCopasiVector<CLGeneralGlyph>::iterator generalIt = general.begin();
23 
24  while (generalIt != general.end())
25  {
26  tagKey((*generalIt));
27 
28  CCopasiVector<CLReferenceGlyph>::iterator refIt = (*generalIt)->getListOfReferenceGlyphs().begin();
29 
30  for (; refIt != (*generalIt)->getListOfReferenceGlyphs().end(); ++refIt)
31  tagKey(*refIt);
32 
33  CCopasiVector<CLGraphicalObject>::iterator subIt = (*generalIt)->getListOfSubglyphs().begin();
34 
35  for (; subIt != (*generalIt)->getListOfSubglyphs().end(); ++subIt)
36  tagKey(*subIt);
37 
38  ++generalIt;
39  }
40 
43 
44  while (compIt != comps.end())
45  {
46  tagKey((*compIt));
47  ++compIt;
48  }
49 
51  CCopasiVector<CLReactionGlyph>::iterator reactIt = reactions.begin();
52 
53  while (reactIt != reactions.end())
54  {
55  tagKey((*reactIt));
56 
57  CCopasiVector<CLMetabReferenceGlyph>::iterator refIt = (*reactIt)->getListOfMetabReferenceGlyphs().begin();
58 
59  for (; refIt != (*reactIt)->getListOfMetabReferenceGlyphs().end(); ++refIt)
60  tagKey(*refIt);
61 
62  ++reactIt;
63  }
64 
66  CCopasiVector<CLMetabGlyph>::iterator speciesIt = species.begin();
67 
68  while (speciesIt != species.end())
69  {
70  tagKey((*speciesIt));
71  ++speciesIt;
72  }
73 
76 
77  while (textIt != texts .end())
78  {
79  tagKey((*textIt));
80  ++textIt;
81  }
82 }
const CCopasiVector< CLTextGlyph > & getListOfTextGlyphs() const
Definition: CLayout.h:120
iterator begin()
const CCopasiVector< CLCompartmentGlyph > & getListOfCompartmentGlyphs() const
Definition: CLayout.h:81
void tagKey(CLGraphicalObject *element)
iterator end()
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
Definition: CLayout.h:94
const CCopasiVector< CLGeneralGlyph > & getListOfGeneralGlyphs() const
Definition: CLayout.h:133
const CCopasiVector< CLReactionGlyph > & getListOfReactionGlyphs() const
Definition: CLayout.h:107

Member Data Documentation

std::map<const std::string, CLBoundingBox*> CLayoutState::mAdditionalState
protected

Definition at line 29 of file CLayoutState.h.

Referenced by applyTo(), CLayoutState(), and ~CLayoutState().

std::map<const std::string, CLBoundingBox*> CLayoutState::mCompartmentState
protected

Definition at line 30 of file CLayoutState.h.

Referenced by applyTo(), CLayoutState(), and ~CLayoutState().

std::map<const std::string, CLCurve*> CLayoutState::mCurves
protected

Definition at line 34 of file CLayoutState.h.

Referenced by applyTo(), CLayoutState(), and ~CLayoutState().

std::map<const std::string, CLBoundingBox*> CLayoutState::mReactionState
protected

Definition at line 31 of file CLayoutState.h.

Referenced by applyTo(), CLayoutState(), and ~CLayoutState().

std::map<const std::string, CLBoundingBox*> CLayoutState::mSpeciesState
protected

Definition at line 32 of file CLayoutState.h.

Referenced by applyTo(), CLayoutState(), and ~CLayoutState().

std::map<const std::string, CLBoundingBox*> CLayoutState::mTextState
protected

Definition at line 33 of file CLayoutState.h.

Referenced by applyTo(), CLayoutState(), and ~CLayoutState().


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