COPASI API  4.16.103
CLReactionGlyph.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #ifndef CLREACG_H_
16 #define CLREACG_H_
17 
18 #include "sbml/common/libsbml-version.h"
20 
21 #include "CLCurve.h"
22 #include "CLGraphicalObject.h"
23 #include "CLGlyphs.h"
24 
25 class SpeciesReferenceGlyph;
26 class ReactionGlyph;
27 
28 #if LIBSBML_VERSION >= 50800
29 class ReferenceGlyph;
30 class GeneralGlyph;
31 #endif // LIBSBML_VERSION >= 50800
32 
34 {
35 protected:
37 
38 public:
39  CLGlyphWithCurve(const std::string & name = "ReferenceGlyph",
40  const CCopasiContainer * pParent = NULL);
41 
43  const CCopasiContainer * pParent = NULL);
44 
45  /**
46  * constructor from libsbml object
47  */
48  CLGlyphWithCurve(const GraphicalObject & sbml, //TODO preliminary
49  const std::map<std::string, std::string> & modelmap,
50  std::map<std::string, std::string> & layoutmap,
51  const CCopasiContainer * pParent = NULL);
52 
53  /**
54  * assignment operator.
55  */
57 
58  const CLCurve & getCurve() const {return mCurve;};
59  CLCurve & getCurve() {return mCurve;};
60  void setCurve(const CLCurve & c) {mCurve = c;};
61 
62  virtual void moveBy(const CLPoint &p);
63 
64  /**
65  * insert operator
66  */
67  friend std::ostream & operator<<(std::ostream &os, const CLGlyphWithCurve & g);
68  void print(std::ostream * ostream) const;
69 };
70 
71 /**
72  * Graphical representation of a Link between different Glyphs. This correspondents to
73  * the sbml ReferenceGlyph.
74  */
76 {
77 protected:
78 
79  /**
80  * Key of a Glyph.
81  */
82  std::string mGlyphKey;
83  std::string mRole;
84 
85 public:
86  CLReferenceGlyph(const std::string & name = "ReferenceGlyph",
87  const CCopasiContainer * pParent = NULL);
88 
90  const CCopasiContainer * pParent = NULL);
91 
92 #if LIBSBML_VERSION >= 50800
93  /**
94  * constructor from libsbml object
95  */
96  CLReferenceGlyph(const ReferenceGlyph & sbml, //TODO preliminary
97  const std::map<std::string, std::string> & modelmap,
98  std::map<std::string, std::string> & layoutmap,
99  const CCopasiContainer * pParent = NULL);
100 #endif // LIBSBML_VERSION >= 50800
101 
102  /**
103  * assignment operator.
104  */
106 
107  const std::string& getRole() const {return mRole;}
108  void setRole(const std::string& r) {mRole = r;}
109 
110  const std::string & getTargetGlyphKey() const {return mGlyphKey;}
112  void setTargetGlyphKey(const std::string & k) {mGlyphKey = k;}
113 
114  virtual CLGraphicalObject* clone() const {return new CLReferenceGlyph(*this, NULL);};
115 
116 #if LIBSBML_VERSION >= 50800
117  /**
118  * This method writes the information of the COPASI layout object into the
119  * corresponding SBML object
120  * layoutmap contains a map from COPASI layout objects to libsbml layout objects.
121  * this is needed for resolving the reference to the metab glyph.
122  */
123  virtual void exportToSBML(ReferenceGlyph * g, //TODO
124  const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
125  std::map<std::string, const SBase*>& sbmlIDs,
126  const std::map<const CLBase*, const SBase*> & layoutmap) const;
127 #endif // LIBSBML_VERSION >= 50800
128 
129  /**
130  * insert operator
131  */
132  friend std::ostream & operator<<(std::ostream &os, const CLReferenceGlyph & g);
133  void print(std::ostream * ostream) const;
134 };
135 
136 /**
137  * Graphical representation of a CChemEqElement. This correspondents to
138  * the sbml SpeciesReferenceGlyph. The copasi equivalent is the CChemEqElement,
139  * however it has no key, so it cannot be referred to.
140  */
142 {
143 public:
144 
145  /**
146  * Enum type for the role of the metab reference
147  * This enum must be synchronized with the corresponding
148  * enum in libsbml (sbml/layout/SpeciesReferenceRole.h)
149  */
150  enum Role
151  {
160  };
161 
162  /**
163  * String literals for the GUI to display the role of
164  * a metab reference
165  */
166  static const std::string RoleName[];
167 
168  /**
169  * XML type names of the roles. This is used in the XML
170  * importer and exporter
171  */
172  static const std::string XMLRole[];
173 
174 private:
175  /**
176  * Key of a CLMetabGlyph.
177  */
178  std::string mMetabGlyphKey;
179 
181 
182 public:
183  CLMetabReferenceGlyph(const std::string & name = "MetabReferenceGlyph",
184  const CCopasiContainer * pParent = NULL);
185 
187  const CCopasiContainer * pParent = NULL);
188 
189  /**
190  * constructor from libsbml object
191  */
192  CLMetabReferenceGlyph(const SpeciesReferenceGlyph & sbml,
193  const std::map<std::string, std::string> & modelmap,
194  std::map<std::string, std::string> & layoutmap,
195  const CCopasiContainer * pParent = NULL);
196 
197  /**
198  * assignment operator.
199  */
201 
202  const std::string & getMetabGlyphKey() const {return mMetabGlyphKey;};
203  CLMetabGlyph* getMetabGlyph() const;
204  void setMetabGlyphKey(const std::string & k) {mMetabGlyphKey = k;};
205 
206  Role getRole() const {return mRole;};
207  void setRole(Role r) {mRole = r;};
208 
209  const std::string & getRoleDisplayName() const
210  {return RoleName[mRole];};
211 
212  virtual CLGraphicalObject* clone() const {return new CLMetabReferenceGlyph(*this, NULL);};
213 
214  /**
215  * This method writes the information of the COPASI layout object into the
216  * corresponding SBML object
217  * layoutmap contains a map from COPASI layout objects to libsbml layout objects.
218  * this is needed for resolving the reference to the metab glyph.
219  */
220  virtual void exportToSBML(SpeciesReferenceGlyph * g,
221  const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
222  std::map<std::string, const SBase*>& sbmlIDs,
223  const std::map<const CLBase*, const SBase*> & layoutmap) const;
224 
225  /**
226  * insert operator
227  */
228  friend std::ostream & operator<<(std::ostream &os, const CLMetabReferenceGlyph & g);
229  void print(std::ostream * ostream) const;
230 };
231 
232 /**
233  * general glyph
234  */
236 {
237 protected:
240 
241 public:
242  CLGeneralGlyph(const std::string & name = "GeneralGlyph",
243  const CCopasiContainer * pParent = NULL);
244 
245  CLGeneralGlyph(const CLGeneralGlyph & src,
246  const CCopasiContainer * pParent = NULL);
247 
248  /**
249  * constructor from libsbml object
250  */
251  CLGeneralGlyph(const GraphicalObject & sbml, //TODO
252  const std::map<std::string, std::string> & modelmap,
253  std::map<std::string, std::string> & layoutmap,
254  const CCopasiContainer * pParent = NULL);
255 
256 // CLGeneralGlyph(const ReactionGlyph & sbml, //TODO
257 // const std::map<std::string, std::string> & modelmap,
258 // std::map<std::string, std::string> & layoutmap,
259 // const CCopasiContainer * pParent = NULL);
260 
261  /**
262  * assignment operator.
263  * makes a deep copy
264  */
266 
268  {return mvReferences;};
269 
271  {return mvReferences;};
272 
274  {return mvSubglyphs;};
275 
277  {return mvSubglyphs;};
278 
279  /**
280  * add Glyph to general glyph. The general glyph takes ownership of the glyph.
281  */
282  void addReferenceGlyph(CLReferenceGlyph * glyph);
283 
284  /**
285  * add sub glyph to general glyph. The general glyph takes ownership of the glyph.
286  */
287  void addSubglyph(CLGraphicalObject * glyph);
288 
289  virtual void moveBy(const CLPoint &p);
290 
291  virtual CLGraphicalObject* clone() const {return new CLGeneralGlyph(*this, NULL);};
292 
293  /**
294  * this exports the general glyph to a generic SBML GraphicalObject (throwing away most of the information)
295  * This should be removed once libsbml supports general glyphs.
296  */
297  virtual void exportToSBML(GraphicalObject * g,
298  const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
299  std::map<std::string, const SBase*>& sbmlIDs,
300  std::map<const CLBase*, const SBase*> & layoutmap) const;
301 
302  /**
303  * insert operator
304  */
305  friend std::ostream & operator<<(std::ostream &os, const CLGeneralGlyph & g);
306  void print(std::ostream * ostream) const;
307 };
308 
309 /**
310  * Graphical representation of a reaction
311  */
313 {
314 protected:
316 
317 public:
318  CLReactionGlyph(const std::string & name = "ReactionGlyph",
319  const CCopasiContainer * pParent = NULL);
320 
321  CLReactionGlyph(const CLReactionGlyph & src,
322  const CCopasiContainer * pParent = NULL);
323 
324  /**
325  * constructor from libsbml object
326  */
327  CLReactionGlyph(const ReactionGlyph & sbml,
328  const std::map<std::string, std::string> & modelmap,
329  std::map<std::string, std::string> & layoutmap,
330  const CCopasiContainer * pParent = NULL);
331 
332  /**
333  * assignment operator.
334  * makes a deep copy
335  */
337 
339  {return mvMetabReferences;};
340 
342  {return mvMetabReferences;};
343 
344  /**
345  * add Glyph to reaction glyph. The reaction glyph takes ownership of the glyph.
346  */
348 
349  virtual void moveBy(const CLPoint &p);
350 
351  virtual CLGraphicalObject* clone() const {return new CLReactionGlyph(*this, NULL);};
352  /**
353  * This method writes the information of the COPASI layout object into the
354  * corresponding SBML object
355  * layoutmap contains a map from COPASI layout objects to libsbml layout objects.
356  * the exported metab reference glyphs will be added.
357  */
358  virtual void exportToSBML(ReactionGlyph * g,
359  const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
360  std::map<std::string, const SBase*>& sbmlIDs,
361  std::map<const CLBase*, const SBase*> & layoutmap) const;
362 
363  /**
364  * insert operator
365  */
366  friend std::ostream & operator<<(std::ostream &os, const CLReactionGlyph & g);
367  void print(std::ostream * ostream) const;
368 };
369 
370 #endif
friend std::ostream & operator<<(std::ostream &os, const CLGlyphWithCurve &g)
virtual CLGraphicalObject * clone() const
friend std::ostream & operator<<(std::ostream &os, const CLMetabReferenceGlyph &g)
void print(std::ostream *ostream) const
std::string mGlyphKey
static const std::string RoleName[]
CLGlyphWithCurve & operator=(const CLGlyphWithCurve &rhs)
virtual void exportToSBML(ReactionGlyph *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs, std::map< const CLBase *, const SBase * > &layoutmap) const
virtual void moveBy(const CLPoint &p)
void addReferenceGlyph(CLReferenceGlyph *glyph)
CCopasiVector< CLMetabReferenceGlyph > & getListOfMetabReferenceGlyphs()
friend std::ostream & operator<<(std::ostream &os, const CLReactionGlyph &g)
CLReactionGlyph(const std::string &name="ReactionGlyph", const CCopasiContainer *pParent=NULL)
CLGeneralGlyph & operator=(const CLGeneralGlyph &rhs)
void addSubglyph(CLGraphicalObject *glyph)
void addMetabReferenceGlyph(CLMetabReferenceGlyph *glyph)
void print(std::ostream *ostream) const
friend std::ostream & operator<<(std::ostream &os, const CLGeneralGlyph &g)
const std::string & getRoleDisplayName() const
CLGraphicalObject * getTargetGlyph() const
const CCopasiVector< CLGraphicalObject > & getListOfSubglyphs() const
void setTargetGlyphKey(const std::string &k)
const std::string & getRole() const
const std::string & getMetabGlyphKey() const
CLMetabReferenceGlyph(const std::string &name="MetabReferenceGlyph", const CCopasiContainer *pParent=NULL)
CCopasiVector< CLGraphicalObject > & getListOfSubglyphs()
virtual void exportToSBML(SpeciesReferenceGlyph *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs, const std::map< const CLBase *, const SBase * > &layoutmap) const
CLGlyphWithCurve(const std::string &name="ReferenceGlyph", const CCopasiContainer *pParent=NULL)
Definition: CLBase.h:54
CLMetabReferenceGlyph & operator=(const CLMetabReferenceGlyph &rhs)
virtual void exportToSBML(GraphicalObject *sbmlobject, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
void setCurve(const CLCurve &c)
const CCopasiVector< CLReferenceGlyph > & getListOfReferenceGlyphs() const
virtual CLGraphicalObject * clone() const
CLMetabGlyph * getMetabGlyph() const
virtual CLGraphicalObject * clone() const
std::string mRole
CCopasiVector< CLReferenceGlyph > mvReferences
CLReferenceGlyph(const std::string &name="ReferenceGlyph", const CCopasiContainer *pParent=NULL)
CCopasiVector< CLGraphicalObject > mvSubglyphs
void setMetabGlyphKey(const std::string &k)
virtual CLGraphicalObject * clone() const
friend std::ostream & operator<<(std::ostream &os, const CLReferenceGlyph &g)
virtual void moveBy(const CLPoint &p)
void print(std::ostream *ostream) const
void setRole(const std::string &r)
CLCurve & getCurve()
const CCopasiVector< CLMetabReferenceGlyph > & getListOfMetabReferenceGlyphs() const
static const std::string XMLRole[]
CCopasiVector< CLMetabReferenceGlyph > mvMetabReferences
virtual void exportToSBML(GraphicalObject *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs, std::map< const CLBase *, const SBase * > &layoutmap) const
const std::string & getTargetGlyphKey() const
void print(std::ostream *ostream) const
const CLCurve & getCurve() const
virtual void moveBy(const CLPoint &p)
void print(std::ostream *ostream) const
CLReactionGlyph & operator=(const CLReactionGlyph &rhs)
CLReferenceGlyph & operator=(const CLReferenceGlyph &rhs)
CLGeneralGlyph(const std::string &name="GeneralGlyph", const CCopasiContainer *pParent=NULL)
CCopasiVector< CLReferenceGlyph > & getListOfReferenceGlyphs()