COPASI API  4.16.103
CLGraphicalPrimitive2D.cpp
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/layout/CLGraphicalPrimitive2D.cpp,v $
3 // $Revision: 1.3 $
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 <sbml/packages/render/sbml/GraphicalPrimitive2D.h>
15 
16 #include "CLGraphicalPrimitive2D.h"
17 
18 /**
19  * Constructor.
20  */
23  mFillRule(CLGraphicalPrimitive2D::UNSET),
24  mFill("")
25 {}
26 
27 /**
28  * Constructor to generate object from the corresponding SBML object.
29  */
30 CLGraphicalPrimitive2D::CLGraphicalPrimitive2D(const GraphicalPrimitive2D& source):
31  CLGraphicalPrimitive1D(source),
32  mFill(source.getFillColor())
33 {
34  switch (source.getFillRule())
35  {
36  case GraphicalPrimitive2D::UNSET:
38  break;
39  case GraphicalPrimitive2D::NONZERO:
41  break;
42  case GraphicalPrimitive2D::EVENODD:
44  break;
45  case GraphicalPrimitive2D::INHERIT:
47  break;
48  }
49 }
50 
51 /**
52  * Set fill color.
53  */
54 void CLGraphicalPrimitive2D::setFillColor(const std::string& color)
55 {
56  this->mFill = color;
57 }
58 
59 /**
60  * Sets the fill rule
61  */
63 {
64  this->mFillRule = rule;
65 }
66 
67 /**
68  * Returns the fill color.
69  */
70 const std::string& CLGraphicalPrimitive2D::getFillColor() const
71 {
72  return this->mFill;
73 }
74 
75 /**
76  * Returns the fill rule.
77  */
79 {
80  return this->mFillRule;
81 }
82 
83 /**
84  * Returns true if the fill attribute is set or false otherwise.
85  */
87 {
88  return !this->mFill.empty();
89 }
90 
91 /**
92  * Returns true if the fill rule attribute is set or false otherwise.
93  */
95 {
97 }
98 
99 /**
100  * Adds the attributes for a 2d graphical primitive object to the passed in.
101  * object.
102  */
103 void CLGraphicalPrimitive2D::addSBMLAttributes(GraphicalPrimitive2D* pPrimitive) const
104 {
106  pPrimitive->setFillColor(this->mFill);
107 
108  switch (this->mFillRule)
109  {
111  pPrimitive->setFillRule(GraphicalPrimitive2D::UNSET);
112  break;
114  pPrimitive->setFillRule(GraphicalPrimitive2D::NONZERO);
115  break;
117  pPrimitive->setFillRule(GraphicalPrimitive2D::EVENODD);
118  break;
120  pPrimitive->setFillRule(GraphicalPrimitive2D::INHERIT);
121  break;
122  }
123 }
virtual void addSBMLAttributes(GraphicalPrimitive2D *pPrimitive) const
void setFillColor(const std::string &color)
const std::string & getFillColor() const
virtual void addSBMLAttributes(GraphicalPrimitive1D *pPrimitive) const
void setFillRule(FILL_RULE rule)