COPASI API  4.16.103
CLLinearGradient.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLLinearGradient.cpp,v $
3 // $Revision: 1.4 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2012/04/23 15:44:52 $
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/LinearGradient.h>
15 
16 #include "CLLinearGradient.h"
17 
21 
22 /**
23  * Constructor.
24  */
26  : CLGradientBase("LinearGradient", pParent),
27  mX1(CLRelAbsVector(0.0, 0.0)),
28  mY1(CLRelAbsVector(0.0, 0.0)),
29  mZ1(CLRelAbsVector(0.0, 0.0)),
30  mX2(CLRelAbsVector(0.0, 100.0)),
31  mY2(CLRelAbsVector(0.0, 100.0)),
32  mZ2(CLRelAbsVector(0.0, 100.0))
33 {
34  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LinearGradient", this);
35 }
36 
37 /**
38  * Copy Constructor
39  */
41  CLGradientBase(source, pParent),
42  mX1(source.mX1),
43  mY1(source.mY1),
44  mZ1(source.mZ1),
45  mX2(source.mX2),
46  mY2(source.mY2),
47  mZ2(source.mZ2)
48 {
49  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LinearGradient", this);
50 }
51 
52 /**
53  * Constructor to generate object from the corresponding SBML object.
54  */
55 CLLinearGradient::CLLinearGradient(const LinearGradient& source, CCopasiContainer* pParent):
56  CLGradientBase(source, "LinearGradient", pParent),
57  mX1(source.getXPoint1()),
58  mY1(source.getYPoint1()),
59  mZ1(source.getZPoint1()),
60  mX2(source.getXPoint2()),
61  mY2(source.getYPoint2()),
62  mZ2(source.getZPoint2())
63 {
64  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LinearGradient", this);
65 }
66 
67 /**
68  * Sets the 3D coordinates for both points.
69  */
71 {
72  this->setPoint1(x1, y1, z1);
73  this->setPoint2(x2, y2, z2);
74 }
75 
76 /**
77  * Sets the 3D coordinates for both points.
78  */
80 {
81  this->setCoordinates(x1, y1, CLRelAbsVector(0.0, 0.0), x2, y2, CLRelAbsVector(0.0, 100.0));
82 }
83 
84 /**
85  * Sets the coordinates for the first point.
86  */
88 {
89  this->mX1 = x;
90  this->mY1 = y;
91  this->mZ1 = z;
92 }
93 
94 /**
95  * Sets the coordinates for the second point.
96  */
98 {
99  this->mX2 = x;
100  this->mY2 = y;
101  this->mZ2 = z;
102 }
103 
104 /**
105  * Returns the x coordinate for the first point.
106  */
108 {
109  return this->mX1;
110 }
111 
112 /**
113  * Returns the x coordinate for the first point.
114  */
116 {
117  return this->mY1;
118 }
119 
120 /**
121  * Returns the x coordinate for the first point.
122  */
124 {
125  return this->mZ1;
126 }
127 
128 /**
129  * Returns the x coordinate for the second point.
130  */
132 {
133  return this->mX2;
134 }
135 
136 /**
137  * Returns the x coordinate for the second point.
138  */
140 {
141  return this->mY2;
142 }
143 
144 /**
145  * Returns the x coordinate for the second point.
146  */
148 {
149  return this->mZ2;
150 }
151 
152 /**
153  * Returns the x coordinate for the first point.
154  */
156 {
157  return this->mX1;
158 }
159 
160 /**
161  * Returns the x coordinate for the first point.
162  */
164 {
165  return this->mY1;
166 }
167 
168 /**
169  * Returns the x coordinate for the first point.
170  */
172 {
173  return this->mZ1;
174 }
175 
176 /**
177  * Returns the x coordinate for the second point.
178  */
180 {
181  return this->mX2;
182 }
183 
184 /**
185  * Returns the x coordinate for the second point.
186  */
188 {
189  return this->mY2;
190 }
191 
192 /**
193  * Returns the x coordinate for the second point.
194  */
196 {
197  return this->mZ2;
198 }
199 
200 /**
201  * Converts this object to the corresponding SBML object.
202  */
203 LinearGradient* CLLinearGradient::toSBML(unsigned int level, unsigned int version) const
204 {
205  LinearGradient* pLG = new LinearGradient(level, version);
206  this->addSBMLAttributes(pLG);
207  RelAbsVector* pV1 = this->getXPoint1().toSBML();
208  RelAbsVector* pV2 = this->getYPoint1().toSBML();
209  RelAbsVector* pV3 = this->getZPoint1().toSBML();
210  pLG->setPoint1(*pV1, *pV2, *pV3);
211  delete pV1;
212  delete pV2;
213  delete pV3;
214  pV1 = this->getXPoint2().toSBML();
215  pV2 = this->getYPoint2().toSBML();
216  pV3 = this->getZPoint2().toSBML();
217  pLG->setPoint2(*pV1, *pV2, *pV3);
218  delete pV1;
219  delete pV2;
220  delete pV3;
221  return pLG;
222 }
CLRelAbsVector mZ1
const CLRelAbsVector & getYPoint1() const
const CLRelAbsVector & getZPoint1() const
void setCoordinates(const CLRelAbsVector &x1, const CLRelAbsVector &y1, const CLRelAbsVector &z1, const CLRelAbsVector &x2, const CLRelAbsVector &y2, const CLRelAbsVector &z2)
CLRelAbsVector mY1
CLRelAbsVector mX2
const CLRelAbsVector & getXPoint2() const
void setPoint1(const CLRelAbsVector &x1, const CLRelAbsVector &y1, const CLRelAbsVector &z1=CLRelAbsVector(0.0, 0.0))
CLRelAbsVector mY2
CLLinearGradient(CCopasiContainer *pParent=NULL)
virtual void addSBMLAttributes(GradientBase *pBase) const
std::string mKey
RelAbsVector * toSBML() const
const CLRelAbsVector & getZPoint2() const
std::string add(const std::string &prefix, CCopasiObject *pObject)
virtual LinearGradient * toSBML(unsigned int level, unsigned int version) const
Header file of class CCopasiContainer.
void setPoint2(const CLRelAbsVector &x1, const CLRelAbsVector &y1, const CLRelAbsVector &z1=CLRelAbsVector(0.0, 0.0))
CLRelAbsVector mZ2
CLRelAbsVector mX1
static CKeyFactory * getKeyFactory()
const CLRelAbsVector & getYPoint2() const
const CLRelAbsVector & getXPoint1() const