COPASI API  4.16.103
CLLocalRenderInformation.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 <assert.h>
7 
8 #define USE_LAYOUT 1
9 #define USE_RENDER 1
10 
11 #include <sbml/packages/render/sbml/LocalRenderInformation.h>
12 
14 
17 
18 /**
19  * Constructor.
20  */
22  CLRenderInformationBase("LocalRenderInformation", pParent)
23 {
24  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LocalRenderInformation", this);
25 }
26 
27 /**
28  * Copy constructor
29  */
31  CLRenderInformationBase(source, pParent),
32  mListOfStyles(source.mListOfStyles, this)
33 {
34  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LocalRenderInformation", this);
35 }
36 
37 /**
38  * Constructor to generate object from the corresponding SBML object.
39  */
40 CLLocalRenderInformation::CLLocalRenderInformation(const LocalRenderInformation& source,
41  /*
42  std::map<std::string,std::string>& colorIdToKeyMap,
43  std::map<std::string,std::string>& gradientIdToKeyMap,
44  std::map<std::string,std::string>& lineEndingIdToKeyMap,
45  */
46  CCopasiContainer* pParent):
47  //CLRenderInformationBase(source,"LocalRenderInformation",colorIdToKeyMap,gradientIdToKeyMap,lineEndingIdToKeyMap,pParent)
48  CLRenderInformationBase(source, "LocalRenderInformation", pParent)
49 {
50  this->mKey = CCopasiRootContainer::getKeyFactory()->add("LocalRenderInformation", this);
51  size_t i, iMax = source.getNumStyles();
52 
53  for (i = 0; i < iMax; ++i)
54  {
55  this->mListOfStyles.add(new CLLocalStyle(*source.getStyle((unsigned int) i)), true);
56  }
57 }
58 
59 /**
60  * Returns the number of styles.
61  */
63 {
64  return this->mListOfStyles.size();
65 }
66 
67 /**
68  * Returns a pointer to the LitOfStyles object.
69  */
71 {
72  return &(this->mListOfStyles);
73 }
74 
75 /**
76  * Returns a pointer to the LitOfStyles object.
77  */
79 {
80  return &(this->mListOfStyles);
81 }
82 
83 /**
84  * Returns a pointer to the style with the given index.
85  * If the index is invalid, NULL is returned.
86  */
88 {
89  return (i < this->mListOfStyles.size()) ? this->mListOfStyles[i] : NULL;
90 }
91 
92 /**
93  * Returns a pointer to the style with the given index.
94  * If the index is invalid, NULL is returned.
95  */
97 {
98  return (i < this->mListOfStyles.size()) ? this->mListOfStyles[i] : NULL;
99 }
100 
102 {
103  CLLocalStyle* pStyle = new CLLocalStyle();
104  this->mListOfStyles.add(pStyle, true);
105  return pStyle;
106 }
107 
109 {
110  this->mListOfStyles.add(new CLLocalStyle(*pStyle), true);
111 }
112 
113 /**
114  * Converts this object to the corresponding SBML object.
115  */
116 LocalRenderInformation* CLLocalRenderInformation::toSBML(unsigned int level, unsigned int version) const
117 {
118  LocalRenderInformation* pLRI = new LocalRenderInformation(level, version);
119  //this->addSBMLAttributes(pLRI,colorKeyToIdMap,gradientKeyToIdMap,lineEndingKeyToIdMap);
120  this->addSBMLAttributes(pLRI);
121  size_t i, iMax = this->mListOfStyles.size();
122 
123  for (i = 0; i < iMax; ++i)
124  {
125  LocalStyle* pStyle = this->getStyle(i)->toSBML(level, version);
126  int result = pLRI->addStyle(pStyle);
127  assert(result == LIBSBML_OPERATION_SUCCESS);
128  delete pStyle;
129  }
130 
131  return pLRI;
132 }
void addSBMLAttributes(RenderInformationBase *pBase) const
LocalStyle * toSBML(unsigned int level, unsigned int version) const
virtual size_t size() const
CCopasiVector< CLLocalStyle > mListOfStyles
CLLocalStyle * getStyle(size_t i)
void addStyle(const CLLocalStyle *pStyle)
virtual bool add(const CType &src)
std::string add(const std::string &prefix, CCopasiObject *pObject)
static CKeyFactory * getKeyFactory()
CCopasiVector< CLLocalStyle > * getListOfStyles()
CLLocalRenderInformation(CCopasiContainer *pParent=NULL)
LocalRenderInformation * toSBML(unsigned int level, unsigned int version) const