COPASI API  4.16.103
CLRadialGradient.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLRadialGradient.cpp,v $
3 // $Revision: 1.4 $
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 <limits>
15 
16 #include <sbml/packages/render/sbml/RadialGradient.h>
17 
18 #include "CLRadialGradient.h"
19 
22 
23 /**
24  * Constructor.
25  */
27  : CLGradientBase("RadialGradient", pParent),
28  mCX(CLRelAbsVector(0.0, 50.0)),
29  mCY(CLRelAbsVector(0.0, 50.0)),
30  mCZ(CLRelAbsVector(0.0, 50.0)),
31  mRadius(CLRelAbsVector(0.0, 50.0)),
32  mFX(CLRelAbsVector(0.0, 50.0)),
33  mFY(CLRelAbsVector(0.0, 50.0)),
34  mFZ(CLRelAbsVector(0.0, 50.0))
35 {
36  this->mKey = CCopasiRootContainer::getKeyFactory()->add("RadialGradient", this);
37 }
38 
39 /**
40  * Copy Constructor.
41  */
43  CLGradientBase(source, pParent),
44  mCX(source.mCX),
45  mCY(source.mCY),
46  mCZ(source.mCZ),
47  mRadius(source.mRadius),
48  mFX(source.mFX),
49  mFY(source.mFY),
50  mFZ(source.mFZ)
51 {
52  this->mKey = CCopasiRootContainer::getKeyFactory()->add("RadialGradient", this);
53 }
54 
55 /**
56  * Constructor to generate object from the corresponding SBML object.
57  */
58 CLRadialGradient::CLRadialGradient(const RadialGradient& source, CCopasiContainer* pParent):
59  CLGradientBase(source, "RadialGradient", pParent),
60  mCX(source.getCenterX()),
61  mCY(source.getCenterY()),
62  mCZ(source.getCenterZ()),
63  mRadius(source.getRadius()),
64  mFX(source.getFocalPointX()),
65  mFY(source.getFocalPointY()),
66  mFZ(source.getFocalPointZ())
67 {
68  this->mKey = CCopasiRootContainer::getKeyFactory()->add("RadialGradient", this);
69 }
70 
71 /**
72  * Sets the 3D coordinates for the center and the focal
73  * point as well as the radius.
74  */
76 {
77  this->setCenter(x, y, z);
78  this->setRadius(r);
79  this->setFocalPoint(fx, fy, fz);
80 }
81 
82 /**
83  * Sets the 2D coordinates for center and the focal point as well as
84  * the radius.
85  */
87 {
88  this->setCoordinates(x, y, CLRelAbsVector(0.0, 50.0), r, fx, fy, CLRelAbsVector(0.0, 50.0));
89 }
90 
91 /**
92  * Sets the coordinates for the first point.
93  */
95 {
96  this->mCX = x;
97  this->mCY = y;
98  this->mCZ = z;
99 }
100 
101 /**
102  * Sets the coordinates for the second point.
103  */
105 {
106  this->mFX = x;
107  this->mFY = y;
108  this->mFZ = z;
109 }
110 
111 /**
112  * Sets the radius.
113  */
115 {
116  this->mRadius = r;
117 }
118 
119 /**
120  * Returns the x coordinate for the center point.
121  */
123 {
124  return this->mCX;
125 }
126 
127 /**
128  * Returns the y coordinate for the center point.
129  */
131 {
132  return this->mCY;
133 }
134 
135 /**
136  * Returns the z coordinate for the center point.
137  */
139 {
140  return this->mCZ;
141 }
142 
143 /**
144  * Returns the x coordinate for the focal point.
145  */
147 {
148  return this->mFX;
149 }
150 
151 /**
152  * Returns the x coordinate for the focal point.
153  */
155 {
156  return this->mFY;
157 }
158 
159 /**
160  * Returns the x coordinate for the focal point.
161  */
163 {
164  return this->mFZ;
165 }
166 
167 /**
168  * Returns the radius.
169  */
171 {
172  return this->mRadius;
173 }
174 
175 /**
176  * Returns the x coordinate for the center point.
177  */
179 {
180  return this->mCX;
181 }
182 
183 /**
184  * Returns the y coordinate for the center point.
185  */
187 {
188  return this->mCY;
189 }
190 
191 /**
192  * Returns the z coordinate for the center point.
193  */
195 {
196  return this->mCZ;
197 }
198 
199 /**
200  * Returns the x coordinate for the focal point.
201  */
203 {
204  return this->mFX;
205 }
206 
207 /**
208  * Returns the x coordinate for the focal point.
209  */
211 {
212  return this->mFY;
213 }
214 
215 /**
216  * Returns the x coordinate for the focal point.
217  */
219 {
220  return this->mFZ;
221 }
222 
223 /**
224  * Returns the radius.
225  */
227 {
228  return this->mRadius;
229 }
230 
231 /**
232  * Converts this object to the corresponding SBML object.
233  */
234 RadialGradient* CLRadialGradient::toSBML(unsigned int level, unsigned int version) const
235 {
236  RadialGradient* pRG = new RadialGradient(level, version);
237  this->addSBMLAttributes(pRG);
238  RelAbsVector* pV1 = this->getCenterX().toSBML();
239  RelAbsVector* pV2 = this->getCenterY().toSBML();
240  RelAbsVector* pV3 = this->getCenterZ().toSBML();
241  pRG->setCenter(*pV1, *pV2, *pV3);
242  delete pV1;
243  delete pV2;
244  delete pV3;
245  pV1 = this->getFocalPointX().toSBML();
246  pV2 = this->getFocalPointY().toSBML();
247  pV3 = this->getFocalPointZ().toSBML();
248  pRG->setFocalPoint(*pV1, *pV2, *pV3);
249  pV1 = this->getRadius().toSBML();
250  pRG->setRadius(*pV1);
251  delete pV1;
252  return pRG;
253 }
const CLRelAbsVector & getRadius() const
void setRadius(const CLRelAbsVector &r)
const CLRelAbsVector & getCenterY() const
const CLRelAbsVector & getCenterX() const
void setCenter(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z=CLRelAbsVector(0.0, 0.0))
CLRadialGradient(CCopasiContainer *pParent=NULL)
CLRelAbsVector mFY
void setCoordinates(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z, const CLRelAbsVector &r, const CLRelAbsVector &fx, const CLRelAbsVector &fy, const CLRelAbsVector &fz)
CLRelAbsVector mFZ
virtual RadialGradient * toSBML(unsigned int level, unsigned int version) const
const CLRelAbsVector & getCenterZ() const
CLRelAbsVector mCZ
virtual void addSBMLAttributes(GradientBase *pBase) const
CLRelAbsVector mFX
std::string mKey
CLRelAbsVector mRadius
const CLRelAbsVector & getFocalPointY() const
RelAbsVector * toSBML() const
std::string add(const std::string &prefix, CCopasiObject *pObject)
static CKeyFactory * getKeyFactory()
const CLRelAbsVector & getFocalPointX() const
CLRelAbsVector mCY
void setFocalPoint(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z=CLRelAbsVector(0.0, 0.0))
CLRelAbsVector mCX
const CLRelAbsVector & getFocalPointZ() const