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

Public Member Functions

virtual void end (const XML_Char *pszName)
 
 RectangleElement (CCopasiXMLParser &parser, SCopasiXMLParserCommon &common)
 
virtual void start (const XML_Char *pszName, const XML_Char **papszAttrs)
 
virtual ~RectangleElement ()
 
- 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 { Rectangle = 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 4116 of file CCopasiXMLParser.h.

Member Enumeration Documentation

Enumerator
Rectangle 

Definition at line 4123 of file CCopasiXMLParser.h.

Constructor & Destructor Documentation

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

Destructor

Definition at line 11684 of file CCopasiXMLParser.cpp.

References pdelete.

11685 {
11687 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 11794 of file CCopasiXMLParser.cpp.

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

11795 {
11796  switch (mCurrentElement)
11797  {
11798  case Rectangle:
11799 
11800  if (strcmp(pszName, "Rectangle"))
11802  pszName, "Rectangle", mParser.getCurrentLineNumber());
11803 
11805 
11806  //reset handler
11808  //call parent handler
11809  mParser.onEndElement(pszName);
11810  break;
11811 
11812  case UNKNOWN_ELEMENT:
11814  break;
11815 
11816  default:
11818  pszName, "???", mParser.getCurrentLineNumber());
11819  break;
11820  }
11821 
11822  return;
11823 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::RectangleElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 11689 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, CLRectangle::setCoordinatesAndSize(), CLGraphicalPrimitive2D::setFillColor(), CLGraphicalPrimitive2D::setFillRule(), CLRectangle::setRadii(), CLGraphicalPrimitive1D::setStroke(), CLGraphicalPrimitive1D::setStrokeWidth(), strToDouble(), and UNKNOWN_ELEMENT.

11691 {
11692  mCurrentElement++; /* We should always be on the next element */
11693 
11694  const char * Transform;
11695  const char * Stroke;
11696  const char * StrokeWidth;
11697  const char * StrokeDashArray;
11698  const char * Fill;
11699  const char * FillRule;
11700  const char * X;
11701  const char * Y;
11702  const char * Z;
11703  const char * WIDTH;
11704  const char * HEIGHT;
11705  const char * RX;
11706  const char * RY;
11707  CLRectangle* pRectangle = NULL;
11708 
11709  switch (mCurrentElement)
11710  {
11711  case Rectangle:
11712 
11713  if (strcmp(pszName, "Rectangle"))
11715  pszName, "Rectangle", mParser.getCurrentLineNumber());
11716 
11717  Transform = mParser.getAttributeValue("transform", papszAttrs, false);
11718  Stroke = mParser.getAttributeValue("stroke", papszAttrs, false);
11719  StrokeWidth = mParser.getAttributeValue("stroke-width", papszAttrs, false);
11720  StrokeDashArray = mParser.getAttributeValue("stroke-dasharray", papszAttrs, false);
11721  Fill = mParser.getAttributeValue("fill", papszAttrs, false);
11722  FillRule = mParser.getAttributeValue("fill-rule", papszAttrs, false);
11723  X = mParser.getAttributeValue("x", papszAttrs);
11724  Y = mParser.getAttributeValue("y", papszAttrs);
11725  Z = mParser.getAttributeValue("z", papszAttrs, "0.0");
11726  WIDTH = mParser.getAttributeValue("width", papszAttrs);
11727  HEIGHT = mParser.getAttributeValue("height", papszAttrs);
11728  RX = mParser.getAttributeValue("rx", papszAttrs, "0.0");
11729  RY = mParser.getAttributeValue("ry", papszAttrs, "0.0");
11730  pRectangle = new CLRectangle();
11731 
11732  if (Transform != NULL)
11733  {
11734  pRectangle->parseTransformation(Transform);
11735  }
11736 
11737  if (Stroke != NULL)
11738  {
11739  pRectangle->setStroke(Stroke);
11740  }
11741 
11742  if (StrokeWidth != NULL)
11743  {
11744  double width = strToDouble(StrokeWidth, NULL);
11745  pRectangle->setStrokeWidth(width);
11746  }
11747 
11748  if (StrokeDashArray != NULL)
11749  {
11750  pRectangle->parseDashArray(StrokeDashArray);
11751  }
11752 
11753  if (Fill != NULL)
11754  {
11755  pRectangle->setFillColor(Fill);
11756  }
11757 
11758  if (FillRule != NULL)
11759  {
11760  std::string f(FillRule);
11761 
11762  if (f == "nonzero")
11763  {
11765  }
11766  else if (f == "evenodd")
11767  {
11769  }
11770  else
11771  {
11773  }
11774  }
11775 
11777  pRectangle->setRadii(CLRelAbsVector(RX), CLRelAbsVector(RY));
11778  mCommon.pGroup->addChildElement(pRectangle);
11779  // delete the gradient stop again since the add method made a copy
11780  delete pRectangle;
11781  break;
11782 
11783  default:
11787  mParser.onStartElement(pszName, papszAttrs);
11788  break;
11789  }
11790 
11791  return;
11792 }
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 setCoordinatesAndSize(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z, const CLRelAbsVector &w, const CLRelAbsVector &h)
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 setRadii(const CLRelAbsVector &rx, const CLRelAbsVector &ry)
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: