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

Public Member Functions

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

Member Enumeration Documentation

Enumerator
Image 

Definition at line 4083 of file CCopasiXMLParser.h.

4084  {
4085  Image = 0
4086  };

Constructor & Destructor Documentation

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

Destructor

Definition at line 12504 of file CCopasiXMLParser.cpp.

References pdelete.

12505 {
12507 }
#define pdelete(p)
Definition: copasi.h:215

Member Function Documentation

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

End element handler

Parameters
constXML_Char *pszName

Definition at line 12564 of file CCopasiXMLParser.cpp.

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

12565 {
12566  switch (mCurrentElement)
12567  {
12568  case Image:
12569 
12570  if (strcmp(pszName, "Image"))
12572  pszName, "Image", mParser.getCurrentLineNumber());
12573 
12575 
12576  //reset handler
12578  //call parent handler
12579  mParser.onEndElement(pszName);
12580  break;
12581 
12582  case UNKNOWN_ELEMENT:
12584  break;
12585 
12586  default:
12588  pszName, "???", mParser.getCurrentLineNumber());
12589  break;
12590  }
12591 
12592  return;
12593 }
#define START_ELEMENT
#define MCXML
virtual void onEndElement(const XML_Char *pszName)
#define UNKNOWN_ELEMENT
int getCurrentLineNumber() const
Definition: CExpat.h:470
void CCopasiXMLParser::ImageElement::start ( const XML_Char *  pszName,
const XML_Char **  papszAttrs 
)
virtual

Start element handler

Parameters
constXML_Char *pszName
constXML_Char **papszAttrs

Definition at line 12509 of file CCopasiXMLParser.cpp.

References CLGroup::addChildElement(), CCopasiMessage::EXCEPTION, CCopasiXMLParser::mCommon, MCXML, CExpatTemplate< CExpat >::mParser, CLTransformation2D::parseTransformation(), SCopasiXMLParserCommon::pGroup, CLImage::setCoordinates(), CLImage::setDimensions(), CLImage::setImageReference(), and UNKNOWN_ELEMENT.

12511 {
12512  mCurrentElement++; /* We should always be on the next element */
12513 
12514  const char * Transform;
12515  const char * X;
12516  const char * Y;
12517  const char * Z;
12518  const char * WIDTH;
12519  const char * HEIGHT;
12520  const char * HREF;
12521  CLImage* pImage = NULL;
12522 
12523  switch (mCurrentElement)
12524  {
12525  case Image:
12526 
12527  if (strcmp(pszName, "Image"))
12529  pszName, "Image", mParser.getCurrentLineNumber());
12530 
12531  Transform = mParser.getAttributeValue("transform", papszAttrs, false);
12532  X = mParser.getAttributeValue("x", papszAttrs);
12533  Y = mParser.getAttributeValue("y", papszAttrs);
12534  Z = mParser.getAttributeValue("z", papszAttrs, "0.0");
12535  WIDTH = mParser.getAttributeValue("width", papszAttrs);
12536  HEIGHT = mParser.getAttributeValue("height", papszAttrs);
12537  HREF = mParser.getAttributeValue("href", papszAttrs);
12538  pImage = new CLImage();
12539 
12540  if (Transform != NULL)
12541  {
12542  pImage->parseTransformation(Transform);
12543  }
12544 
12546  pImage->setDimensions(CLRelAbsVector(WIDTH), CLRelAbsVector(HEIGHT));
12547  pImage->setImageReference(HREF);
12548  mCommon.pGroup->addChildElement(pImage);
12549  // delete the image again since the add method made a copy
12550  delete pImage;
12551  break;
12552 
12553  default:
12557  mParser.onStartElement(pszName, papszAttrs);
12558  break;
12559  }
12560 
12561  return;
12562 }
UnknownElement mUnknownElement
const char * getAttributeValue(const std::string &name, const char **attributes, const bool &required=true) const
Definition: CExpat.h:685
#define MCXML
#define UNKNOWN_ELEMENT
virtual void onStartElement(const XML_Char *pszName, const XML_Char **papszAttrs)
void setImageReference(const std::string &ref)
Definition: CLImage.cpp:124
void pushElementHandler(CXMLElementHandler< CCopasiXMLParser, SCopasiXMLParserCommon > *elementHandler)
void setCoordinates(const CLRelAbsVector &x, const CLRelAbsVector &y, const CLRelAbsVector &z=CLRelAbsVector(0.0, 0.0))
Definition: CLImage.cpp:140
int getCurrentLineNumber() const
Definition: CExpat.h:470
void setDimensions(const CLRelAbsVector &width, const CLRelAbsVector &height)
Definition: CLImage.cpp:83
void addChildElement(const CLTransformation2D *pChild)
Definition: CLGroup.cpp:517
virtual void parseTransformation(const std::string &transformationString)

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