COPASI API  4.16.103
Public Member Functions | Protected Attributes | List of all members
CLGraphicalPrimitive1D Class Reference

#include <CLGraphicalPrimitive1D.h>

Inheritance diagram for CLGraphicalPrimitive1D:
Inheritance graph
[legend]
Collaboration diagram for CLGraphicalPrimitive1D:
Collaboration graph
[legend]

Public Member Functions

virtual void addSBMLAttributes (GraphicalPrimitive1D *pPrimitive) const
 
 CLGraphicalPrimitive1D ()
 
 CLGraphicalPrimitive1D (const GraphicalPrimitive1D &source)
 
const std::vector< unsigned int > & getDashArray () const
 
const std::string & getStroke () const
 
double getStrokeWidth () const
 
bool isSetDashArray () const
 
bool isSetStroke () const
 
bool isSetStrokeWidth () const
 
void parseDashArray (const std::string &s)
 
void setDashArray (const std::vector< unsigned int > &array)
 
void setStroke (const std::string &key)
 
void setStrokeWidth (double width)
 
- Public Member Functions inherited from CLTransformation2D
 CLTransformation2D ()
 
 CLTransformation2D (const double m[6])
 
 CLTransformation2D (const Transformation2D &source)
 
std::string get2DTransformationString () const
 
const double * getMatrix2D () const
 
virtual void parseTransformation (const std::string &transformationString)
 
void setMatrix (const double m[12])
 
void setMatrix2D (const double m[6])
 
- Public Member Functions inherited from CLTransformation
 CLTransformation ()
 
 CLTransformation (const double matrix[12])
 
std::string get3DTransformationString () const
 
virtual const double * getMatrix () const
 
bool is2DTransformation () const
 
bool isIdentityMatrix () const
 
bool isSetMatrix () const
 
void setMatrix (const double m[12])
 
- Public Member Functions inherited from CLBase
 CLBase ()
 
 CLBase (const CLBase &b)
 
 CLBase (const SBase &)
 
const std::string & getTag () const
 
bool hasTag () const
 
virtual void moveBy (const CLPoint &)
 
void setTag (const std::string &tag)
 
virtual ~CLBase ()
 

Protected Attributes

std::string mStroke
 
std::vector< unsigned int > mStrokeDashArray
 
double mStrokeWidth
 
- Protected Attributes inherited from CLTransformation2D
double mMatrix2D [6]
 
- Protected Attributes inherited from CLTransformation
double mMatrix [12]
 
- Protected Attributes inherited from CLBase
std::string mTag
 

Additional Inherited Members

- Static Public Member Functions inherited from CLTransformation2D
static const double * getIdentityMatrix2D ()
 
- Static Public Member Functions inherited from CLTransformation
static const double * getIdentityMatrix ()
 
- Static Public Attributes inherited from CLTransformation2D
static const double IDENTITY2D [6] = {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}
 
- Static Public Attributes inherited from CLTransformation
static const double IDENTITY3D [12] = {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0}
 
- Protected Member Functions inherited from CLTransformation2D
virtual void addSBMLAttributes (Transformation2D *pTransformation) const
 
void updateMatrix2D ()
 
void updateMatrix3D ()
 

Detailed Description

Definition at line 24 of file CLGraphicalPrimitive1D.h.

Constructor & Destructor Documentation

CLGraphicalPrimitive1D::CLGraphicalPrimitive1D ( )

Constructor.

Definition at line 24 of file CLGraphicalPrimitive1D.cpp.

24  :
26  mStroke(""),
27  mStrokeWidth(std::numeric_limits<double>::quiet_NaN())
28 {
29 }
CLGraphicalPrimitive1D::CLGraphicalPrimitive1D ( const GraphicalPrimitive1D &  source)

Constructor to generate object from the corresponding SBML object.

Definition at line 34 of file CLGraphicalPrimitive1D.cpp.

34  :
35  CLTransformation2D(source),
36  mStroke(source.getStroke()),
37  mStrokeWidth(source.getStrokeWidth()),
38  mStrokeDashArray(source.getDashArray())
39 {
40 }
std::vector< unsigned int > mStrokeDashArray

Member Function Documentation

void CLGraphicalPrimitive1D::addSBMLAttributes ( GraphicalPrimitive1D *  pPrimitive) const
virtual

Adds the attributes for a graphical primitive 1D object to the passed in. object.

Converts this object to the corresponding SBML object.

Definition at line 189 of file CLGraphicalPrimitive1D.cpp.

References CLTransformation2D::addSBMLAttributes(), mStroke, mStrokeDashArray, and mStrokeWidth.

Referenced by CLGraphicalPrimitive2D::addSBMLAttributes(), CLRenderCurve::toSBML(), and CLText::toSBML().

190 {
191  this->CLTransformation2D::addSBMLAttributes(pPrimitive);
192  pPrimitive->setStroke(this->mStroke);
193  pPrimitive->setStrokeWidth(this->mStrokeWidth);
194  pPrimitive->setDashArray(this->mStrokeDashArray);
195 }
virtual void addSBMLAttributes(Transformation2D *pTransformation) const
std::vector< unsigned int > mStrokeDashArray
const std::vector< unsigned int > & CLGraphicalPrimitive1D::getDashArray ( ) const

Returns the stroke color.

Definition at line 85 of file CLGraphicalPrimitive1D.cpp.

References mStrokeDashArray.

Referenced by CLLayoutRenderer::extract_1d_attributes(), getPen(), CCopasiXML::save1DAttributes(), and CLLayoutRenderer::update_textures_and_colors().

86 {
87  return this->mStrokeDashArray;
88 }
std::vector< unsigned int > mStrokeDashArray
const std::string & CLGraphicalPrimitive1D::getStroke ( ) const
double CLGraphicalPrimitive1D::getStrokeWidth ( ) const

Returns the stroke width.

Definition at line 77 of file CLGraphicalPrimitive1D.cpp.

References mStrokeWidth.

Referenced by CLLayoutRenderer::extract_1d_attributes(), getPen(), and CCopasiXML::save1DAttributes().

78 {
79  return this->mStrokeWidth;
80 }
bool CLGraphicalPrimitive1D::isSetDashArray ( ) const

Returns true is the dash array has been set or false otherwise.

Definition at line 109 of file CLGraphicalPrimitive1D.cpp.

References mStrokeDashArray.

Referenced by CLLayoutRenderer::extract_1d_attributes(), getPen(), CCopasiXML::save1DAttributes(), and CLLayoutRenderer::update_textures_and_colors().

110 {
111  bool result = true;
112 
113  if (mStrokeDashArray.size() < 2 || mStrokeDashArray[0] != mStrokeDashArray[0])
114  {
115  result = false;
116  }
117 
118  return result;
119 }
std::vector< unsigned int > mStrokeDashArray
bool CLGraphicalPrimitive1D::isSetStroke ( ) const

Returns true is the stroke has been set or false otherwise.

Definition at line 101 of file CLGraphicalPrimitive1D.cpp.

References mStroke.

Referenced by CQRenderConverter::applyStyle(), CCopasiXMLParser::GroupElement::end(), CLLayoutRenderer::extract_1d_attributes(), fillItemFromText(), getPen(), CCopasiXML::save1DAttributes(), and CLLayoutRenderer::update_textures_and_colors().

102 {
103  return (!this->mStroke.empty() && this->mStroke != "none");
104 }
bool CLGraphicalPrimitive1D::isSetStrokeWidth ( ) const

Returns true is the stroke width has been set or false otherwise.

Definition at line 93 of file CLGraphicalPrimitive1D.cpp.

References mStrokeWidth.

Referenced by CCopasiXMLParser::GroupElement::end(), CLLayoutRenderer::extract_1d_attributes(), getPen(), and CCopasiXML::save1DAttributes().

94 {
95  return (mStrokeWidth == mStrokeWidth);
96 }
void CLGraphicalPrimitive1D::parseDashArray ( const std::string &  s)

Definition at line 121 of file CLGraphicalPrimitive1D.cpp.

References mStrokeDashArray.

Referenced by CCopasiXMLParser::RectangleElement::start(), CCopasiXMLParser::EllipseElement::start(), CCopasiXMLParser::TextElement::start(), CCopasiXMLParser::RenderCurveElement::start(), CCopasiXMLParser::PolygonElement::start(), and CCopasiXMLParser::GroupElement::start().

122 {
123  this->mStrokeDashArray.clear();
124 
125  if (!s.empty())
126  {
127  std::istringstream is(s);
128  size_t size = s.size() + 1;
129  char* tmp = new char[size];
130  char* tmp2 = tmp;
131  char* tmp3;
132  char** endptr;
133  long value;
134  is.getline(tmp2, size, ',');
135 
136  // continue until the string is empty or the stream is
137  // no longer usable
138  while (tmp2[0] != 0 && is.good())
139  {
140  endptr = &tmp2;
141  tmp3 = tmp2;
142  value = strtol(tmp2, endptr, 10);
143 
144  if (value < 0 || *endptr == tmp3 || (**endptr != '\0' && **endptr != ' ' && **endptr != '\t'))
145  {
146  this->mStrokeDashArray.clear();
147  }
148  else
149  {
150  this->mStrokeDashArray.push_back((unsigned int)value);
151  }
152 
153  // read next element
154  is.getline(tmp2, size, ',');
155  }
156 
157  // check if the string was parsed to the end
158  if (is.eof())
159  {
160  // we have to parse the current tmp2
161  // and check if that was ok
162  endptr = &tmp2;
163  tmp3 = tmp2;
164  value = strtol(tmp2, endptr, 10);
165 
166  if (value < 0 || *endptr == tmp3 || (**endptr != '\0' && **endptr != ' ' && **endptr != '\t'))
167  {
168  this->mStrokeDashArray.clear();
169  }
170  else
171  {
172  this->mStrokeDashArray.push_back((unsigned int)value);
173  }
174  }
175  else
176  {
177  // since we did not parse to the end,
178  // there most have been an error
179  this->mStrokeDashArray.clear();
180  }
181 
182  delete[] tmp;
183  }
184 }
std::vector< unsigned int > mStrokeDashArray
void CLGraphicalPrimitive1D::setDashArray ( const std::vector< unsigned int > &  array)

Sets the dasharray.

Definition at line 61 of file CLGraphicalPrimitive1D.cpp.

References mStrokeDashArray.

62 {
63  this->mStrokeDashArray = array;
64 }
std::vector< unsigned int > mStrokeDashArray
void CLGraphicalPrimitive1D::setStroke ( const std::string &  key)
void CLGraphicalPrimitive1D::setStrokeWidth ( double  width)

Member Data Documentation

std::string CLGraphicalPrimitive1D::mStroke
protected

Definition at line 27 of file CLGraphicalPrimitive1D.h.

Referenced by addSBMLAttributes(), getStroke(), isSetStroke(), and setStroke().

std::vector<unsigned int> CLGraphicalPrimitive1D::mStrokeDashArray
protected
double CLGraphicalPrimitive1D::mStrokeWidth
protected

The documentation for this class was generated from the following files: