COPASI API  4.16.103
Public Member Functions | Private Types | List of all members
CCopasiXMLParser::EllipseElement Class Reference
Inheritance diagram for CCopasiXMLParser::EllipseElement:
Inheritance graph
[legend]
Collaboration diagram for CCopasiXMLParser::EllipseElement:
Collaboration graph
[legend]

Public Member Functions

 EllipseElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *pszName)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~EllipseElement ()
 
- Public Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
 CXMLElementHandler (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void end (const XML_Char *C_UNUSED(pszName))
 
virtual void reset ()
 
virtual void start (const XML_Char *C_UNUSED(pszName), const XML_Char **C_UNUSED(papszAttrs))
 
virtual ~CXMLElementHandler ()
 

Private Types

enum  Element { Ellipse = 0 }
 

Additional Inherited Members

- Protected Member Functions inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
void addFix (const std::string &key, CCopasiObject *pObject)
 
void deleteCurrentHandler ()
 
- Protected Attributes inherited from CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon >
SCopasiXMLParserCommonmCommon
 
C_INT32 mCurrentElement
 
C_INT32 mLastKnownElement
 
CCopasiXMLParsermParser
 
CXMLElementHandlermpCurrentHandler
 

Detailed Description

Definition at line 4156 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Enumerator
Ellipse 

Definition at line 4163 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

CCopasiXMLParser::EllipseElement::EllipseElement ( CCopasiXMLParser parser,
SCopasiXMLParserCommon common 
)
CCopasiXMLParser::EllipseElement::~EllipseElement ( )
virtual

Destructor

Definition at line 11832 of file CCopasiXMLParser.cpp.

References pdelete.

11833 {
11835 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

void CCopasiXMLParser::EllipseElement::end ( const XML_Char *  pszName)
virtual

End element handler

Parameters
constXML_Char *pszName

Definition at line 11938 of file CCopasiXMLParser.cpp.

References CCopasiMessage::EXCEPTION, MCXML, CExpatTemplate< CExpat >::mParser, START_ELEMENT, and UNKNOWN_ELEMENT.

11939 {
11940  switch (mCurrentElement)
11941  {
11942  case Ellipse:
11943 
11944  if (strcmp(pszName, "Ellipse"))
11946  pszName, "Ellipse", mParser.getCurrentLineNumber());
11947 
11949 
11950  //reset handler
11952  //call parent handler
11953  mParser.onEndElement(pszName);
11954  break;
11955 
11956  case UNKNOWN_ELEMENT:
11958  break;
11959 
11960  default:
11962  pszName, "???", mParser.getCurrentLineNumber());
11963  break;
11964  }
11965 
11966  return;
11967 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::EllipseElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 11837 of file CCopasiXMLParser.cpp.

References CLGroup::addChildElement(), CLGraphicalPrimitive2D::EVENODD, CCopasiMessage::EXCEPTION, CLGraphicalPrimitive2D::INHERIT, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, CLGraphicalPrimitive2D::NONZERO, CLGraphicalPrimitive1D::parseDashArray(), CLTransformation2D::parseTransformation(), SCopasiXMLParserCommon::pGroup, CLEllipse::setCenter3D(), CLGraphicalPrimitive2D::setFillColor(), CLGraphicalPrimitive2D::setFillRule(), CLEllipse::setRadii(), CLGraphicalPrimitive1D::setStroke(), CLGraphicalPrimitive1D::setStrokeWidth(), strToDouble(), and UNKNOWN_ELEMENT.

11839 {
11840  mCurrentElement++; /* We should always be on the next element */
11841 
11842  const char * Transform;
11843  const char * Stroke;
11844  const char * StrokeWidth;
11845  const char * StrokeDashArray;
11846  const char * Fill;
11847  const char * FillRule;
11848  const char * CX;
11849  const char * CY;
11850  const char * CZ;
11851  const char * RX;
11852  const char * RY;
11853  CLEllipse* pEllipse = NULL;
11854 
11855  switch (mCurrentElement)
11856  {
11857  case Ellipse:
11858 
11859  if (strcmp(pszName, "Ellipse"))
11861  pszName, "Ellipse", mParser.getCurrentLineNumber());
11862 
11863  Transform = mParser.getAttributeValue("transform", papszAttrs, false);
11864  Stroke = mParser.getAttributeValue("stroke", papszAttrs, false);
11865  StrokeWidth = mParser.getAttributeValue("stroke-width", papszAttrs, false);
11866  StrokeDashArray = mParser.getAttributeValue("stroke-dasharray", papszAttrs, false);
11867  Fill = mParser.getAttributeValue("fill", papszAttrs, false);
11868  FillRule = mParser.getAttributeValue("fill-rule", papszAttrs, false);
11869  CX = mParser.getAttributeValue("cx", papszAttrs);
11870  CY = mParser.getAttributeValue("cy", papszAttrs);
11871  CZ = mParser.getAttributeValue("cz", papszAttrs, "0.0");
11872  RX = mParser.getAttributeValue("rx", papszAttrs);
11873  RY = mParser.getAttributeValue("ry", papszAttrs, RX);
11874  pEllipse = new CLEllipse();
11875 
11876  if (Transform != NULL)
11877  {
11878  pEllipse->parseTransformation(Transform);
11879  }
11880 
11881  if (Stroke != NULL)
11882  {
11883  pEllipse->setStroke(Stroke);
11884  }
11885 
11886  if (StrokeWidth != NULL)
11887  {
11888  double width = strToDouble(StrokeWidth, NULL);
11889  pEllipse->setStrokeWidth(width);
11890  }
11891 
11892  if (StrokeDashArray != NULL)
11893  {
11894  pEllipse->parseDashArray(StrokeDashArray);
11895  }
11896 
11897  if (Fill != NULL)
11898  {
11899  pEllipse->setFillColor(Fill);
11900  }
11901 
11902  if (FillRule != NULL)
11903  {
11904  std::string f(FillRule);
11905 
11906  if (f == "nonzero")
11907  {
11909  }
11910  else if (f == "evenodd")
11911  {
11913  }
11914  else
11915  {
11917  }
11918  }
11919 
11920  pEllipse->setCenter3D(CLRelAbsVector(CX), CLRelAbsVector(CY), CLRelAbsVector(CZ));
11921  pEllipse->setRadii(CLRelAbsVector(RX), CLRelAbsVector(RY));
11922  mCommon.pGroup->addChildElement(pEllipse);
11923  // delete the gradient stop again since the add method made a copy
11924  delete pEllipse;
11925  break;
11926 
11927  default:
11931  mParser.onStartElement(pszName, papszAttrs);
11932  break;
11933  }
11934 
11935  return;
11936 }
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
void parseDashArray(const std::string &s)
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void setRadii(const CLRelAbsVector &rx, const CLRelAbsVector &ry)
Definition: CLEllipse.cpp:267
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
void setStroke(const std::string &key)
void setFillColor(const std::string &color)
double strToDouble(const char *str, char const **pTail)
Definition: utility.cpp:325
void setCenter3D(const CLRelAbsVector &cx, const CLRelAbsVector &cy, const CLRelAbsVector &cz)
Definition: CLEllipse.cpp:257
int getCurrentLineNumber() const
Definition: CExpat.h:470
void setStrokeWidth(double width)
void addChildElement(const CLTransformation2D *pChild)
Definition: CLGroup.cpp:517
void setFillRule(FILL_RULE rule)
virtual void parseTransformation(const std::string &transformationString)

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