COPASI API  4.16.103
CLGlyphs.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 CLMETABG_H_
16 #define CLMETABG_H_
17 
18 //#include<string>
19 //#include"utils.h"
20 
21 #include "CLGraphicalObject.h"
22 
23 class SpeciesGlyph;
24 class CompartmentGlyph;
25 class TextGlyph;
26 
27 /**
28  * Graphical representation of a metabolite
29  */
31 {
32 public:
33  CLMetabGlyph(const std::string & name = "MetabGlyph",
34  const CCopasiContainer * pParent = NULL);
35 
36  CLMetabGlyph(const CLMetabGlyph & src,
37  const CCopasiContainer * pParent = NULL);
38 
39  /**
40  * constructor from libsbml object
41  */
42  CLMetabGlyph(const SpeciesGlyph & sbml,
43  const std::map<std::string, std::string> & modelmap,
44  std::map<std::string, std::string> & layoutmap,
45  const CCopasiContainer * pParent = NULL);
46 
47  /**
48  * assignment operator
49  */
50  CLMetabGlyph & operator= (const CLMetabGlyph & rhs);
51 
52  //virtual void scale (const double & scaleFactor){this->mBBox.scale(scaleFactor);}
53 
54  virtual CLGraphicalObject* clone() const {return new CLMetabGlyph(*this, NULL);};
55 
56  /**
57  * This method writes the information of the copasi layout object into the
58  * corresponding sbml object
59  */
60  virtual void exportToSBML(SpeciesGlyph * g,
61  const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
62  std::map<std::string, const SBase*>& sbmlIDs) const;
63 
64  /**
65  * insert operator
66  */
67  friend std::ostream & operator<<(std::ostream &os, const CLMetabGlyph & g);
68  void print(std::ostream * ostream) const;
69 };
70 
71 /**
72  * Graphical representation of a compartment
73  */
75 {
76 public:
77  CLCompartmentGlyph(const std::string & name = "CompartmentGlyph",
78  const CCopasiContainer * pParent = NULL);
79 
81  const CCopasiContainer * pParent = NULL);
82 
83  /**
84  * constructor from libsbml object
85  */
86  CLCompartmentGlyph(const CompartmentGlyph & sbml,
87  const std::map<std::string, std::string> & modelmap,
88  std::map<std::string, std::string> & layoutmap,
89  const CCopasiContainer * pParent = NULL);
90 
91  //virtual void scale (const double & scaleFactor){this->mBBox.scale(scaleFactor);}
92 
93  /**
94  * assignment operator
95  */
97 
98  /**
99  * insert operator
100  */
101  friend std::ostream & operator<<(std::ostream &os, const CLCompartmentGlyph & g);
102  void print(std::ostream * ostream) const;
103 
104  virtual CLGraphicalObject* clone() const {return new CLCompartmentGlyph(*this, NULL);};
105 
106  /**
107  * This method writes the information of the copasi layout object into the
108  * corresponding sbml object
109  */
110  virtual void exportToSBML(CompartmentGlyph * cg,
111  const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
112  std::map<std::string, const SBase*>& sbmlIDs) const;
113 };
114 
115 /**
116  * Graphical representation of a Label
117  */
119 {
120 protected:
121 
122  /**
123  * indicates if a text is set. If the text is not set the
124  * label text is taken from the model object.
125  */
127  std::string mText;
128 
129  /**
130  * Key of a layout element. If this is set the text glyph is
131  * considered to be a label to this layout element.
132  */
133  std::string mGraphicalObjectKey;
134 
135 public:
136  CLTextGlyph(const std::string & name = "TextGlyph",
137  const CCopasiContainer * pParent = NULL);
138 
139  CLTextGlyph(const CLTextGlyph & src,
140  const CCopasiContainer * pParent = NULL);
141 
142  /**
143  * constructor from libsbml object
144  */
145  CLTextGlyph(const TextGlyph & sbml,
146  const std::map<std::string, std::string> & modelmap,
147  std::map<std::string, std::string> & layoutmap,
148  const CCopasiContainer * pParent = NULL);
149 
150  /**
151  * assignment operator.
152  */
153  CLTextGlyph & operator= (const CLTextGlyph & rhs);
154 
155  virtual std::string getText() const;
156 
157  void setText(const std::string & t);
158 
159  void clearText();
160 
161  bool isTextSet() const {return mIsTextSet;};
162 
163  const std::string & getGraphicalObjectKey() const {return mGraphicalObjectKey;};
165  void setGraphicalObjectKey(const std::string & k);
166 
167  virtual CLGraphicalObject* clone() const {return new CLTextGlyph(*this, NULL);};
168 
169  //virtual void scale (const double & scaleFactor){this->mBBox.scale(scaleFactor);}
170 
171  /**
172  * This method writes the information of the copasi layout object into the
173  * corresponding sbml object.
174  * The reference to other graphical objects cannot be done in this method
175  * since when this method is called not necessarily all other graphical objects
176  * have been created.
177  */
178  virtual void exportToSBML(TextGlyph * g,
179  const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
180  std::map<std::string, const SBase*>& sbmlIDs) const;
181 
182  /**
183  * handle the reference to another graphical object for sbml export.
184  * This should only be called after all other graphical objects are in the
185  * layout map.
186  */
187  void exportReferenceToSBML(TextGlyph * g, const std::map<const CLBase*, const SBase*> & layoutmap) const;
188 
189  /**
190  * insert operator
191  */
192  friend std::ostream & operator<<(std::ostream &os, const CLTextGlyph & g);
193  void print(std::ostream * ostream) const;
194 };
195 
196 #endif
void print(std::ostream *ostream) const
Definition: CLGlyphs.cpp:335
bool isTextSet() const
Definition: CLGlyphs.h:161
std::string mGraphicalObjectKey
Definition: CLGlyphs.h:133
friend std::ostream & operator<<(std::ostream &os, const CLCompartmentGlyph &g)
Definition: CLGlyphs.cpp:169
virtual CLGraphicalObject * clone() const
Definition: CLGlyphs.h:104
CLCompartmentGlyph(const std::string &name="CompartmentGlyph", const CCopasiContainer *pParent=NULL)
Definition: CLGlyphs.cpp:108
virtual std::string getText() const
Definition: CLGlyphs.cpp:238
CLTextGlyph(const std::string &name="TextGlyph", const CCopasiContainer *pParent=NULL)
Definition: CLGlyphs.cpp:180
virtual CLGraphicalObject * clone() const
Definition: CLGlyphs.h:54
virtual CLGraphicalObject * clone() const
Definition: CLGlyphs.h:167
CLCompartmentGlyph & operator=(const CLCompartmentGlyph &rhs)
Definition: CLGlyphs.cpp:134
bool mIsTextSet
Definition: CLGlyphs.h:126
friend std::ostream & operator<<(std::ostream &os, const CLTextGlyph &g)
Definition: CLGlyphs.cpp:320
virtual void exportToSBML(CompartmentGlyph *cg, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
Definition: CLGlyphs.cpp:145
virtual void exportToSBML(SpeciesGlyph *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
Definition: CLGlyphs.cpp:73
void setGraphicalObjectKey(const std::string &k)
Definition: CLGlyphs.cpp:338
CLGraphicalObject * getGraphicalObject() const
Definition: CLGlyphs.cpp:262
void print(std::ostream *ostream) const
Definition: CLGlyphs.cpp:175
CLTextGlyph & operator=(const CLTextGlyph &rhs)
Definition: CLGlyphs.cpp:223
void setText(const std::string &t)
Definition: CLGlyphs.cpp:250
void exportReferenceToSBML(TextGlyph *g, const std::map< const CLBase *, const SBase * > &layoutmap) const
Definition: CLGlyphs.cpp:297
friend std::ostream & operator<<(std::ostream &os, const CLMetabGlyph &g)
Definition: CLGlyphs.cpp:97
virtual void exportToSBML(TextGlyph *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
Definition: CLGlyphs.cpp:267
std::string mText
Definition: CLGlyphs.h:127
void print(std::ostream *ostream) const
Definition: CLGlyphs.cpp:103
void clearText()
Definition: CLGlyphs.cpp:256
const std::string & getGraphicalObjectKey() const
Definition: CLGlyphs.h:163
CLMetabGlyph(const std::string &name="MetabGlyph", const CCopasiContainer *pParent=NULL)
Definition: CLGlyphs.cpp:36
CLMetabGlyph & operator=(const CLMetabGlyph &rhs)
Definition: CLGlyphs.cpp:62