/*
 * Creates a new point element.
 * The element is added to and owned by the curve.
 *
 * @return The newly created RenderCubicBezier object.
 */
RenderPoint* RenderCurve::createPoint()
{
    RenderPoint* pRenderPoint=NULL;
    try
    {
      RENDER_CREATE_NS(renderns, this->getSBMLNamespaces());
      pRenderPoint = new RenderPoint(renderns);
	 delete renderns;
    }
    catch (...)
    {
        /* here we do not create a default object as the level/version must
         * match the parent object
         *
         * so do nothing
         */
    }


    if(pRenderPoint != NULL)
    {
        this->mListOfElements.appendAndOwn(pRenderPoint);
    }
    return pRenderPoint;
}
/*
 * Creates a new GlobalStyle object. The object is added to and owned
 * by the GlobalRenderInformation object.
 * 
 * @param id for the new style.
 * 
 * @ return a pointer to the newly created GlobalStyle object.
 */
GlobalStyle* GlobalRenderInformation::createStyle(const std::string& id)
{
    GlobalStyle* pStyle=NULL;
    try
    {
      RENDER_CREATE_NS(renderns, this->getSBMLNamespaces());
      pStyle = new GlobalStyle(renderns);
      pStyle->setId(id);
	 delete renderns;
    }
    catch (...)
    {
        /* here we do not create a default object as the level/version must
         * match the parent object
         *
         * so do nothing
         */
    }

    if(pStyle != NULL)
    {
        this->mListOfStyles.appendAndOwn(pStyle);
    }
    return pStyle;
}
Beispiel #3
0
/*
 * @return the SBML object corresponding to next XMLToken in the
 * XMLInputStream or NULL if the token was not recognized.
 */
SBase* ListOfGlobalStyles::createObject (XMLInputStream& stream)
{
    const std::string& name   = stream.peek().getName();
    SBase*        object = NULL;

    RENDER_CREATE_NS(renderns, this->getSBMLNamespaces());

    if (name == "style")
    {
        object = new GlobalStyle(renderns);
        if (object!=NULL) mItems.push_back(object);
    }
    delete renderns;
    return object;
}
/*
 * @return the SBML object corresponding to next XMLToken in the
 * XMLInputStream or NULL if the token was not recognized.
 */
SBase* ListOfColorDefinitions::createObject (XMLInputStream& stream)
{
  const std::string& name   = stream.peek().getName();
  SBase*        object = NULL;


  if (name == "colorDefinition")
  {
    RENDER_CREATE_NS(renderns, this->getSBMLNamespaces());
    object = new ColorDefinition(renderns);
    if(object != NULL) this->mItems.push_back(object);
    delete renderns;
  }
  return object;
}