COPASI API  4.16.103
CLGradientStop.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLGradientStop.cpp,v $
3 // $Revision: 1.5 $
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 <assert.h>
16 #include <limits>
17 
18 #include <sbml/packages/render/sbml/GradientStop.h>
19 
20 #include "CLGradientStop.h"
21 
24 
25 /**
26  * Constructor.
27  */
29  CLBase(),
30  CCopasiObject("GradientStop", pParent),
31  mOffset(CLRelAbsVector(std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN())),
32  mStopColor("#00000000"),
33  mKey("")
34 {
35  this->mKey = CCopasiRootContainer::getKeyFactory()->add("GradientStop", this);
36 }
37 
38 /**
39  * Copy Constructor
40  */
42  CLBase(source),
43  CCopasiObject(source, pParent),
44  mOffset(source.mOffset),
45  mStopColor(source.mStopColor),
46  mKey("")
47 {
48  this->mKey = CCopasiRootContainer::getKeyFactory()->add("GradientStop", this);
49 }
50 
51 /**
52  * Copy Constructor
53  */
54 CLGradientStop::CLGradientStop(const GradientStop& source, CCopasiContainer* pParent):
55  CLBase(),
56  CCopasiObject("GradientStop", pParent),
57  mOffset(source.getOffset()),
58  mStopColor(source.getStopColor()),
59  mKey("")
60 {
61  this->mKey = CCopasiRootContainer::getKeyFactory()->add("GradientStop", this);
62 }
63 
64 /**
65  * Virtual destructor to satify the linker.
66  * Does nothing , is only in the source file to help the compiler
67  * in determining where to put the vtable.
68  */
70 {
71 }
72 
73 /**
74  * Returns the offset.
75  */
77 {
78  return this->mOffset;
79 }
80 
81 /**
82  * Sets the offset.
83  */
84 void CLGradientStop::setOffset(double x, double y)
85 {
86  this->mOffset = CLRelAbsVector(x, y);
87 }
88 
89 /**
90  * Sets the offset.
91  */
92 void CLGradientStop::setOffset(const std::string& co)
93 {
94  this->mOffset = CLRelAbsVector(co);
95 }
96 
97 /**
98  * Sets the offset.
99  */
101 {
102  this->mOffset = co;
103 }
104 
105 /**
106  * Returns the stop color id.
107  */
108 const std::string& CLGradientStop::getStopColor() const
109 {
110  return this->mStopColor;
111 }
112 
113 /**
114  * Sets the stop color key.
115  */
116 void CLGradientStop::setStopColor(const std::string& key)
117 {
118  this->mStopColor = key;
119 }
120 
121 /**
122  * Converts this object to the corresponding SBML object.
123  */
124 GradientStop* CLGradientStop::toSBML(unsigned int level, unsigned int version) const
125 {
126  GradientStop* pStop = new GradientStop(level, version);
127  RelAbsVector* pV = this->mOffset.toSBML();
128  pStop->setOffset(*pV);
129  delete pV;
130  pStop->setStopColor(this->mStopColor);
131  return pStop;
132 }
133 
134 /**
135  * Returns the key of the color definition.
136  */
137 const std::string& CLGradientStop::getKey() const
138 {
139  return this->mKey;
140 }
CLGradientStop(CCopasiContainer *pParent=NULL)
void setStopColor(const std::string &key)
const std::string & getStopColor() const
virtual ~CLGradientStop()
GradientStop * toSBML(unsigned int level, unsigned int version) const
const CLRelAbsVector & getOffset() const
RelAbsVector * toSBML() const
Definition: CLBase.h:33
void setOffset(double x, double y)
std::string add(const std::string &prefix, CCopasiObject *pObject)
CLRelAbsVector mOffset
std::string mKey
static CKeyFactory * getKeyFactory()
const std::string & getKey() const
std::string mStopColor