COPASI API  4.16.103
CLEllipse.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLEllipse.cpp,v $
3 // $Revision: 1.7 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2012/04/23 15:44:51 $
7 // End CVS Header
8 
9 // Copyright (C) 2012 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 #include <string>
15 
16 #include <sbml/packages/render/sbml/Ellipse.h>
17 
18 #define sbmlEllipse Ellipse
19 #include "CLEllipse.h"
20 
23 
24 /**
25  * Constructor.
26  */
29  CCopasiObject("Ellipse", pParent),
30  mCX(0.0),
31  mCY(0.0),
32  mCZ(0.0),
33  mKey("")
34 {
35  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Ellipse", this);
36  setRadii(0.0, 0.0);
37 }
38 
39 /**
40  * Constructor with 2D center and radius.
41  */
44  CCopasiObject("Ellipse", pParent),
45  mCX(cx),
46  mCY(cy),
47  mCZ(0.0),
48  mKey("")
49 {
50  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Ellipse", this);
51  setRadii(r, r);
52 }
53 
54 /**
55  * Constructor with 2D center and radii.
56  */
59  CCopasiObject("Ellipse", pParent),
60  mCX(cx),
61  mCY(cy),
62  mCZ(CLRelAbsVector(0.0, 50.0)),
63  mKey("")
64 {
65  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Ellipse", this);
66  setRadii(rx, ry);
67 }
68 
69 /**
70  * Constructor with 3D center and radii.
71  */
72 CLEllipse::CLEllipse(const CLRelAbsVector& cx, const CLRelAbsVector& cy, const CLRelAbsVector& cz, const CLRelAbsVector& rx, const CLRelAbsVector& ry, CCopasiContainer* pParent):
74  CCopasiObject("Ellipse", pParent),
75  mCX(cx),
76  mCY(cy),
77  mCZ(cz),
78  mKey("")
79 {
80  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Ellipse", this);
81  setRadii(rx, ry);
82 }
83 
84 /**
85  * Copy Constructor
86  */
88  CLGraphicalPrimitive2D(source),
89  CCopasiObject(source, pParent),
90  mCX(source.mCX),
91  mCY(source.mCY),
92  mCZ(source.mCZ),
93  mRX(source.mRX),
94  mRY(source.mRY),
95  mKey("")
96 {
97  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Ellipse", this);
98 }
99 
100 /**
101  * Constructor to generate object from the corresponding SBML object.
102  */
103 CLEllipse::CLEllipse(const Ellipse& source, CCopasiContainer* pParent):
104  CLGraphicalPrimitive2D(source),
105  CCopasiObject("Ellipse", pParent),
106  mCX(source.getCX()),
107  mCY(source.getCY()),
108  mCZ(source.getCZ()),
109  mRX(source.getRX()),
110  mRY(source.getRY()),
111  mKey("")
112 {
113  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Ellipse", this);
114 }
115 
116 /**
117  * Destructor
118  */
120 {
122 }
123 
124 /**
125  * Returns the x component of the center.
126  */
128 {
129  return this->mCX;
130 }
131 
132 /**
133  * Returns the y component of the center.
134  */
136 {
137  return this->mCY;
138 }
139 
140 /**
141  * Returns the z component of the center.
142  */
144 {
145  return this->mCZ;
146 }
147 
148 /**
149  * Returns the radius along the x axis.
150  */
152 {
153  return this->mRX;
154 }
155 
156 /**
157  * Returns the radius along the y axis.
158  */
160 {
161  return this->mRY;
162 }
163 
164 /**
165  * Returns the x component of the center.
166  */
168 {
169  return this->mCX;
170 }
171 
172 /**
173  * Returns the y component of the center.
174  */
176 {
177  return this->mCY;
178 }
179 
180 /**
181  * Returns the z component of the center.
182  */
184 {
185  return this->mCZ;
186 }
187 
188 /**
189  * Returns the radius along the x axis.
190  */
192 {
193  return this->mRX;
194 }
195 
196 /**
197  * Returns the radius along the y axis.
198  */
200 {
201  return this->mRY;
202 }
203 
204 /**
205  * Sets the x component of the center.
206  */
208 {
209  this->mCX = cx;
210 }
211 
212 /**
213  * Sets the y component of the center.
214  */
216 {
217  this->mCY = cy;
218 }
219 
220 /**
221  * Sets the z component of the center.
222  */
224 {
225  this->mCZ = cz;
226 }
227 
228 /**
229  * Sets the radius along the x axis.
230  */
232 {
233  this->mRX = rx;
234 }
235 
236 /**
237  * Sets the radius along the y axis.
238  */
240 {
241  this->mRY = ry;
242 }
243 
244 /**
245  * Sets the 2D center.
246  */
248 {
249  this->mCX = cx;
250  this->mCY = cy;
251  this->mCZ = CLRelAbsVector(0.0, 50.0);
252 }
253 
254 /**
255  * Sets the 3D center.
256  */
258 {
259  this->mCX = cx;
260  this->mCY = cy;
261  this->mCZ = cz;
262 }
263 
264 /**
265  * Sets the radii.
266  */
268 {
269  this->mRX = rx;
270  this->mRY = ry;
271 }
272 
273 /**
274  * Returns the key of the render information
275  */
276 const std::string& CLEllipse::getKey() const
277 {
278  return this->mKey;
279 }
280 
281 /**
282  * Converts this object to the corresponding SBML object.
283  */
284 Ellipse* CLEllipse::toSBML(unsigned int level, unsigned int version) const
285 {
286  Ellipse* pE = new Ellipse(level, version);
287  this->addSBMLAttributes(pE);
288  RelAbsVector* pV = this->getCX().toSBML();
289  pE->setCX(*pV);
290  delete pV;
291  pV = this->getCY().toSBML();
292  pE->setCY(*pV);
293  delete pV;
294  pV = this->getCZ().toSBML();
295  pE->setCZ(*pV);
296  delete pV;
297  pV = this->getRX().toSBML();
298  pE->setRX(*pV);
299  delete pV;
300  pV = this->getRY().toSBML();
301  pE->setRY(*pV);
302  delete pV;
303  return pE;
304 }
bool remove(const std::string &key)
void setCX(const CLRelAbsVector &cx)
Definition: CLEllipse.cpp:207
CLRelAbsVector mRX
Definition: CLEllipse.h:36
void setCZ(const CLRelAbsVector &cz)
Definition: CLEllipse.cpp:223
CLRelAbsVector mCX
Definition: CLEllipse.h:33
const CLRelAbsVector & getRX() const
Definition: CLEllipse.cpp:151
const CLRelAbsVector & getCY() const
Definition: CLEllipse.cpp:135
std::string mKey
Definition: CLEllipse.h:42
const std::string & getKey() const
Definition: CLEllipse.cpp:276
void setRadii(const CLRelAbsVector &rx, const CLRelAbsVector &ry)
Definition: CLEllipse.cpp:267
RelAbsVector * toSBML() const
virtual void addSBMLAttributes(GraphicalPrimitive2D *pPrimitive) const
CLRelAbsVector mCY
Definition: CLEllipse.h:34
void setRX(const CLRelAbsVector &rx)
Definition: CLEllipse.cpp:231
std::string add(const std::string &prefix, CCopasiObject *pObject)
sbmlEllipse * toSBML(unsigned int level, unsigned int version) const
Definition: CLEllipse.cpp:284
const CLRelAbsVector & getCZ() const
Definition: CLEllipse.cpp:143
CLRelAbsVector mRY
Definition: CLEllipse.h:37
const CLRelAbsVector & getRY() const
Definition: CLEllipse.cpp:159
CLRelAbsVector mCZ
Definition: CLEllipse.h:35
static CKeyFactory * getKeyFactory()
void setCY(const CLRelAbsVector &cy)
Definition: CLEllipse.cpp:215
CLEllipse(CCopasiContainer *pParent=NULL)
Definition: CLEllipse.cpp:27
void setRY(const CLRelAbsVector &ry)
Definition: CLEllipse.cpp:239
void setCenter3D(const CLRelAbsVector &cx, const CLRelAbsVector &cy, const CLRelAbsVector &cz)
Definition: CLEllipse.cpp:257
const CLRelAbsVector & getCX() const
Definition: CLEllipse.cpp:127
void setCenter2D(const CLRelAbsVector &cx, const CLRelAbsVector &cy)
Definition: CLEllipse.cpp:247