COPASI API  4.16.103
CLRenderPoint.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLRenderPoint.cpp,v $
3 // $Revision: 1.4 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2012/04/23 15:44:50 $
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 <sstream>
15 #include <limits>
16 
17 #include <sbml/packages/render/sbml/RenderPoint.h>
18 
19 #include "CLRenderPoint.h"
20 
21 /**
22  * Creates a new point with x,y and z set to 0.0.
23  */
25  CLBase(),
26  mXOffset(CLRelAbsVector(0.0, 0.0)),
27  mYOffset(CLRelAbsVector(0.0, 0.0)),
28  mZOffset(CLRelAbsVector(0.0, 0.0))
29 {
30 }
31 
32 /**
33  * Copy constructor.
34  */
36  CLBase(orig),
37  mXOffset(orig.mXOffset),
38  mYOffset(orig.mYOffset),
39  mZOffset(orig.mZOffset)
40 {
41 }
42 
43 /**
44  * Constructor to generate object from the corresponding SBML object.
45  */
46 CLRenderPoint::CLRenderPoint(const RenderPoint& source):
47  CLBase(),
48  mXOffset(source.x()),
49  mYOffset(source.y()),
50  mZOffset(source.z())
51 {
52 }
53 
55 {
56  if (&orig != this)
57  {
58  this->CLBase::operator=(orig);
59  this->mXOffset = orig.mXOffset;
60  this->mYOffset = orig.mYOffset;
61  this->mZOffset = orig.mZOffset;
62  }
63 
64  return *this;
65 }
66 
67 /**
68  * Creates a new point with the given ccordinates.
69  */
71  CLBase()
72  , mXOffset(x)
73  , mYOffset(y)
74  , mZOffset(z)
75 {
76 }
77 
78 /**
79  * Sets the Z offset to 0.0.
80  */
82 {
83  this->setZOffset(0.0);
84 }
85 
86 /**
87  * Destructor.
88  */
90 {
91 }
92 
93 /**
94  * Sets the coordinates to the given values.
95  */
96 void
98 {
99  this->setXOffset(x);
100  this->setYOffset(y);
101  this->setZOffset(z);
102 }
103 
104 /**
105  * Sets the x offset.
106  */
107 void
109 {
110  this->setX(x);
111 }
112 
113 /**
114  * Sets the y offset.
115  */
116 void
118 {
119  this->setY(y);
120 }
121 
122 /**
123  * Sets the z offset.
124  */
125 void
127 {
128  this->setZ(z);
129 }
130 
131 /**
132  * Sets the x offset.
133  */
134 void
136 {
137  this->mXOffset = x;
138 }
139 
140 /**
141  * Sets the y offset.
142  */
143 void
145 {
146  this->mYOffset = y;
147 }
148 
149 /**
150  * Sets the z offset.
151  */
152 void
154 {
155  this->mZOffset = z;
156 }
157 
158 /**
159  * Returns the x offset.
160  */
161 const CLRelAbsVector&
163 {
164  return this->x();
165 }
166 
167 /**
168  * Returns the y offset.
169  */
170 const CLRelAbsVector&
172 {
173  return this->y();
174 }
175 
176 /**
177  * Returns the z offset.
178  */
179 const CLRelAbsVector&
181 {
182  return this->z();
183 }
184 
185 /**
186  * Returns the x offset.
187  */
188 const CLRelAbsVector&
190 {
191  return this->mXOffset;
192 }
193 
194 /**
195  * Returns the y offset.
196  */
197 const CLRelAbsVector&
199 {
200  return this->mYOffset;
201 }
202 
203 /**
204  * Returns the z offset.
205  */
206 const CLRelAbsVector&
208 {
209  return this->mZOffset;
210 }
211 
212 /**
213  * Returns the x offset.
214  */
217 {
218  return this->x();
219 }
220 
221 /**
222  * Returns the y offset.
223  */
226 {
227  return this->y();
228 }
229 
230 /**
231  * Returns the z offset.
232  */
235 {
236  return this->z();
237 }
238 
239 /**
240  * Returns the x offset.
241  */
244 {
245  return this->mXOffset;
246 }
247 
248 /**
249  * Returns the y offset.
250  */
253 {
254  return this->mYOffset;
255 }
256 
257 /**
258  * Returns the z offset.
259  */
262 {
263  return this->mZOffset;
264 }
265 
266 /**
267  * Comparison operator.
268  */
270 {
271  return (this->mXOffset == left.mXOffset && this->mYOffset == left.mYOffset && this->mZOffset == left.mZOffset);
272 }
273 
274 /**
275  * Converts this object to the corresponding SBML object.
276  */
277 RenderPoint* CLRenderPoint::toSBML(unsigned int level, unsigned int version) const
278 {
279  RenderPoint* pP = new RenderPoint(level, version);
280  this->addSBMLAttributes(pP);
281  return pP;
282 }
283 
284 /**
285  * Adds the attributes for a render point object to the passed in.
286  * object.
287  */
288 void CLRenderPoint::addSBMLAttributes(RenderPoint* pPoint) const
289 {
290  RelAbsVector* pV1 = this->mXOffset.toSBML();
291  RelAbsVector* pV2 = this->mYOffset.toSBML();
292  RelAbsVector* pV3 = this->mZOffset.toSBML();
293  pPoint->setCoordinates(*pV1, *pV2, *pV3);
294  delete pV1;
295  delete pV2;
296  delete pV3;
297 }
CLRelAbsVector mXOffset
Definition: CLRenderPoint.h:26
CLRenderPoint & operator=(const CLRenderPoint &orig)
void setOffsets(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z=CLRelAbsVector(0.0, 0.0))
void setZ(const CLRelAbsVector &z)
const CLRelAbsVector & z() const
const CLRelAbsVector & getZOffset() const
void setZOffset(const CLRelAbsVector &z)
void setY(const CLRelAbsVector &y)
CLRelAbsVector mZOffset
Definition: CLRenderPoint.h:28
const CLRelAbsVector & y() const
virtual RenderPoint * toSBML(unsigned int level, unsigned int version) const
void setXOffset(const CLRelAbsVector &x)
RelAbsVector * toSBML() const
Definition: CLBase.h:33
const CLRelAbsVector & getXOffset() const
const CLRelAbsVector & getYOffset() const
virtual ~CLRenderPoint()
CLRelAbsVector mYOffset
Definition: CLRenderPoint.h:27
const CLRelAbsVector & x() const
void setYOffset(const CLRelAbsVector &y)
virtual void addSBMLAttributes(RenderPoint *pPoint) const
void setX(const CLRelAbsVector &x)
bool operator==(const CLRenderPoint &left)