COPASI API  4.16.103
CLRectangle.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLRectangle.cpp,v $
3 // $Revision: 1.6 $
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 <sbml/packages/render/sbml/Rectangle.h>
15 
16 #define sbmlRectangle Rectangle
17 #include "CLRectangle.h"
18 
21 
22 /**
23  * Constructor.
24  */
27  CCopasiObject("Rectangle", pParent),
28  mKey("")
29 {
30  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Rectangle", this);
31 }
32 
33 /**
34  * Copy Constructor.
35  */
37  CLGraphicalPrimitive2D(source),
38  CCopasiObject(source, pParent),
39  mX(source.mX),
40  mY(source.mY),
41  mZ(source.mZ),
42  mWidth(source.mWidth),
43  mHeight(source.mHeight),
44  mRX(source.mRX),
45  mRY(source.mRY),
46  mKey("")
47 {
48  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Rectangle", this);
49 }
50 
51 /**
52  * Constructor that takes an id, the x, y and z coordinate values, the width and the
53  * height.
54  */
57  CCopasiObject("Rectangle", pParent),
58  mX(x),
59  mY(y),
60  mZ(z),
61  mWidth(w),
62  mHeight(h),
63  mRX(CLRelAbsVector(0.0, 0.0)),
64  mRY(CLRelAbsVector(0.0, 0.0)),
65  mKey("")
66 {
67  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Rectangle", this);
68 }
69 
70 /**
71  * Constructor that takes an id, x and y coordinate values, the width and the
72  * height.
73  */
76  CCopasiObject("Rectangle", pParent),
77  mX(x),
78  mY(y),
79  mZ(CLRelAbsVector(0.0, 0.0)),
80  mWidth(w),
81  mHeight(h),
82  mRX(CLRelAbsVector(0.0, 0.0)),
83  mRY(CLRelAbsVector(0.0, 0.0)),
84  mKey("")
85 {
86  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Rectangle", this);
87 }
88 
89 /**
90  * Constructor to generate object from the corresponding SBML object.
91  */
92 CLRectangle::CLRectangle(const Rectangle& source, CCopasiContainer* pParent):
93  CLGraphicalPrimitive2D(source),
94  CCopasiObject("Rectangle", pParent),
95  mX(source.getX()),
96  mY(source.getY()),
97  mZ(source.getZ()),
98  mWidth(source.getWidth()),
99  mHeight(source.getHeight()),
100  mRX(source.getRadiusX()),
101  mRY(source.getRadiusY()),
102  mKey("")
103 {
104  this->mKey = CCopasiRootContainer::getKeyFactory()->add("Rectangle", this);
105 }
106 
107 /**
108  * Destructor
109  */
111 {
113 }
114 
115 /**
116  * Sets the position, the width and the height.
117  */
119 {
120  this->setCoordinates(x, y, z);
121  this->setSize(w, h);
122 }
123 
124 /**
125  * Sets the position.
126  */
128 {
129  this->mX = x;
130  this->mY = y;
131  this->mZ = z;
132 }
133 
134 /**
135  * Sets the size.
136  */
138 {
139  this->mWidth = w;
140  this->mHeight = h;
141 }
142 
143 /**
144  * Sets the size.
145  */
147 {
148  this->mRX = rx;
149  this->mRY = ry;
150 }
151 
152 /**
153  * Returns the x coordinate.
154  */
156 {
157  return this->mX;
158 }
159 
160 /**
161  * Returns the y coordinate.
162  */
164 {
165  return this->mY;
166 }
167 
168 /**
169  * Returns the z coordinate.
170  */
172 {
173  return this->mZ;
174 }
175 
176 /**
177  * Returns the width.
178  */
180 {
181  return this->mWidth;
182 }
183 
184 /**
185  * Returns the height.
186  */
188 {
189  return this->mHeight;
190 }
191 
192 /**
193  * Returns the corner radius along th x axis.
194  */
196 {
197  return this->mRX;
198 }
199 
200 /**
201  * Returns the corner radius along the y axis.
202  */
204 {
205  return this->mRY;
206 }
207 
208 /**
209  * Returns the x coordinate.
210  */
212 {
213  return this->mX;
214 }
215 
216 /**
217  * Returns the y coordinate.
218  */
220 {
221  return this->mY;
222 }
223 
224 /**
225  * Returns the z coordinate.
226  */
228 {
229  return this->mZ;
230 }
231 
232 /**
233  * Returns the width.
234  */
236 {
237  return this->mWidth;
238 }
239 
240 /**
241  * Returns the height.
242  */
244 {
245  return this->mHeight;
246 }
247 
248 /**
249  * Returns the corner radius along th x axis.
250  */
252 {
253  return this->mRX;
254 }
255 
256 /**
257  * Returns the corner radius along the y axis.
258  */
260 {
261  return this->mRY;
262 }
263 
264 /**
265  * Sets the width.
266  */
268 {
269  this->mWidth = w;
270 }
271 
272 /**
273  * Sets the height.
274  */
276 {
277  this->mHeight = h;
278 }
279 
280 /**
281  * Sets the x radius for the corners.
282  */
284 {
285  this->mRX = rx;
286 }
287 
288 /**
289  * Sets the y radius for the corners.
290  */
292 {
293  this->mRY = ry;
294 }
295 
296 /**
297  * Sets the x position.
298  */
300 {
301  this->mX = x;
302 }
303 
304 /**
305  * Sets the y position.
306  */
308 {
309  this->mY = y;
310 }
311 
312 /**
313  * Sets the z position.
314  */
316 {
317  this->mZ = z;
318 }
319 
320 /**
321  * Returns the key of the rectangle
322  */
323 const std::string& CLRectangle::getKey() const
324 {
325  return this->mKey;
326 }
327 
328 /**
329  * Converts this object to the corresponding SBML object.
330  */
331 Rectangle* CLRectangle::toSBML(unsigned int level, unsigned int version) const
332 {
333  Rectangle* pRectangle = new Rectangle(level, version);
334  RelAbsVector* pV1 = this->mX.toSBML();
335  RelAbsVector* pV2 = this->mY.toSBML();
336  RelAbsVector* pV3 = this->mZ.toSBML();
337  RelAbsVector* pV4 = this->mWidth.toSBML();
338  RelAbsVector* pV5 = this->mHeight.toSBML();
339  pRectangle->setCoordinatesAndSize(*pV1, *pV2, *pV3, *pV4, *pV5);
340  delete pV1;
341  delete pV2;
342  delete pV3;
343  delete pV4;
344  delete pV5;
345  this->addSBMLAttributes(pRectangle);
346  pV1 = this->mRX.toSBML();
347  pV2 = this->mRY.toSBML();
348  pRectangle->setRadii(*pV1, *pV2);
349  delete pV1;
350  delete pV2;
351  return pRectangle;
352 }
void setSize(const CLRelAbsVector &w, const CLRelAbsVector &h)
const std::string & getKey() const
bool remove(const std::string &key)
void setRadiusX(const CLRelAbsVector &rx)
CLRelAbsVector mRY
Definition: CLRectangle.h:37
CLRelAbsVector mY
Definition: CLRectangle.h:32
const CLRelAbsVector & getRadiusY() const
const CLRelAbsVector & getWidth() const
CLRelAbsVector mZ
Definition: CLRectangle.h:33
void setRadiusY(const CLRelAbsVector &ry)
void setCoordinates(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z)
sbmlRectangle * toSBML(unsigned int level, unsigned int version) const
CLRelAbsVector mWidth
Definition: CLRectangle.h:34
void setX(const CLRelAbsVector &x)
const CLRelAbsVector & getX() const
void setY(const CLRelAbsVector &y)
const CLRelAbsVector & getY() const
const CLRelAbsVector & getRadiusX() const
CLRelAbsVector mX
Definition: CLRectangle.h:31
const CLRelAbsVector & getHeight() const
CLRelAbsVector mRX
Definition: CLRectangle.h:36
void setCoordinatesAndSize(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z, const CLRelAbsVector &w, const CLRelAbsVector &h)
RelAbsVector * toSBML() const
virtual void addSBMLAttributes(GraphicalPrimitive2D *pPrimitive) const
std::string add(const std::string &prefix, CCopasiObject *pObject)
std::string mKey
Definition: CLRectangle.h:42
CLRelAbsVector mHeight
Definition: CLRectangle.h:35
CLRectangle(CCopasiContainer *pParent=NULL)
Definition: CLRectangle.cpp:25
static CKeyFactory * getKeyFactory()
void setZ(const CLRelAbsVector &z)
void setRadii(const CLRelAbsVector &rx, const CLRelAbsVector &ry)
void setHeight(const CLRelAbsVector &h)
const CLRelAbsVector & getZ() const
void setWidth(const CLRelAbsVector &w)