COPASI API  4.16.103
CLLineEnding.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #include <sstream>
7 #include <assert.h>
8 
9 #define USE_LAYOUT 1
10 #define USE_RENDER 1
11 
12 #include <sbml/packages/render/sbml/LineEnding.h>
13 
14 #include "CLLineEnding.h"
15 
18 
19 /**
20  * Constructor.
21  */
24  CCopasiContainer("LineEnding", pParent),
25  mEnableRotationalMapping(false),
26  mpGroup(NULL),
27  mKey(""),
28  mId("")
29 {
30  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LineEnding", this);
31 }
32 
33 /**
34  * Copy Constructor.
35  */
37  CLGraphicalPrimitive2D(source),
38  CCopasiContainer(source, pParent),
39  mEnableRotationalMapping(source.mEnableRotationalMapping),
40  mBoundingBox(source.mBoundingBox),
41  mpGroup(NULL),
42  mKey(""),
43  mId(source.mId)
44 {
45  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LineEnding", this);
46 
47  if (source.mpGroup != NULL)
48  {
49  this->mpGroup = new CLGroup(*source.mpGroup, this);
50  }
51 }
52 
53 /**
54  * Constructor to generate object from the corresponding SBML object.
55  */
56 CLLineEnding::CLLineEnding(const LineEnding& source, CCopasiContainer* pParent):
57  CLGraphicalPrimitive2D(source),
58  CCopasiContainer("LineEnding", pParent),
59  mEnableRotationalMapping(source.getIsEnabledRotationalMapping()),
60  mBoundingBox(*source.getBoundingBox()),
61  mpGroup(new CLGroup(*source.getGroup(), this)),
62  mKey(""),
63  mId(source.getId())
64 {
65  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LineEnding", this);
66 }
67 
68 /**
69  * Sets whether rotational mapping is to be done or not.
70  */
72 {
73  this->mEnableRotationalMapping = enable;
74 }
75 
76 /**
77  * Returns whether rotational mapping is enabled or not.
78  */
80 {
81  return this->mEnableRotationalMapping;
82 }
83 
84 /**
85  * Sets the bounding box.
86  */
88 {
89  this->mBoundingBox = *box;
90 }
91 
92 /**
93  * Returns the bounding box.
94  */
96 {
97  return &this->mBoundingBox;
98 }
99 
100 /**
101  * Returns the bounding box.
102  */
104 {
105  return &this->mBoundingBox;
106 }
107 
108 /**
109  * Sets the group.
110  */
111 void CLLineEnding::setGroup(const CLGroup* pGroup)
112 {
113  if (pGroup)
114  {
115  if (this->mpGroup != NULL)
116  {
117  delete this->mpGroup;
118  }
119 
120  this->mpGroup = new CLGroup(*pGroup, this);
121  }
122 }
123 
124 /**
125  * Returns the group object.
126  */
128 {
129  return this->mpGroup;
130 }
131 
132 /**
133  * Returns the group object.
134  */
136 {
137  return this->mpGroup;
138 }
139 
140 /**
141  * Returns the key string for the line ending.
142  */
143 const std::string& CLLineEnding::getKey() const
144 {
145  return this->mKey;
146 }
147 
148 /**
149  * Returns the id of the object.
150  */
151 const std::string& CLLineEnding::getId() const
152 {
153  return this->mId;
154 }
155 
156 /**
157  * Sets the id of the object.
158  */
159 void CLLineEnding::setId(const std::string& id)
160 {
161  this->mId = id;
162 }
163 
164 /**
165  * Converts this object to the corresponding SBML object.
166  */
167 LineEnding* CLLineEnding::toSBML(unsigned int level, unsigned int version) const
168 {
169  LineEnding* pLE = new LineEnding(level, version);
170  this->addSBMLAttributes(pLE);
171  pLE->setId(this->mId);
172  pLE->setEnableRotationalMapping(this->mEnableRotationalMapping);
173  BoundingBox bb(level, version);
174  bb.setId("bb");
175  Point p(new LayoutPkgNamespaces(),
176  this->mBoundingBox.getPosition().getX(),
177  this->mBoundingBox.getPosition().getY());
178  bb.setPosition(&p);
179  Dimensions d(new LayoutPkgNamespaces(),
182  bb.setDimensions(&d);
183  pLE->setBoundingBox(&bb);
184  const RenderGroup* pG = this->mpGroup->toSBML(level, version);
185  pLE->setGroup(pG);
186  delete pG;
187  return pLE;
188 }
const C_FLOAT64 & getWidth() const
Definition: CLBase.h:211
void setGroup(const CLGroup *group)
CLLineEnding(CCopasiContainer *pParent=NULL)
void setId(const std::string &id)
std::string mKey
Definition: CLLineEnding.h:40
CLBoundingBox mBoundingBox
Definition: CLLineEnding.h:34
const CLDimensions & getDimensions() const
Definition: CLBase.h:266
CLGroup * mpGroup
Definition: CLLineEnding.h:35
const C_FLOAT64 & getX() const
Definition: CLBase.h:83
const CLPoint & getPosition() const
Definition: CLBase.h:265
virtual void addSBMLAttributes(GraphicalPrimitive2D *pPrimitive) const
const CLGroup * getGroup() const
const std::string & getId() const
std::string add(const std::string &prefix, CCopasiObject *pObject)
LineEnding * toSBML(unsigned int level, unsigned int version) const
const std::string & getKey() const
bool mEnableRotationalMapping
Definition: CLLineEnding.h:33
CLBoundingBox * getBoundingBox()
const C_FLOAT64 & getY() const
Definition: CLBase.h:84
static CKeyFactory * getKeyFactory()
const C_FLOAT64 & getHeight() const
Definition: CLBase.h:212
bool getIsEnabledRotationalMapping() const
void setBoundingBox(const CLBoundingBox *box)
std::string mId
Definition: CLLineEnding.h:48
void setEnableRotationalMapping(bool enable)
RenderGroup * toSBML(unsigned int level, unsigned int version) const
Definition: CLGroup.cpp:799