/* * Creates a new ColorDefinition object with the given SBML level * and SBML version. * * @param level SBML level of the new object * @param level SBML version of the new object */ ColorDefinition::ColorDefinition (unsigned int level, unsigned int version, unsigned int pkgVersion) : SBase(level,version) ,mId("") ,mRed(0) ,mGreen(0) ,mBlue(0) ,mAlpha(255) { if (!hasValidLevelVersionNamespaceCombination()) throw SBMLConstructorException(); // set an SBMLNamespaces derived object (GroupsPkgNamespaces) of this package. setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level,version,pkgVersion)); // connect child elements to this element. connectToChild(); }
LIBSBML_CPP_NAMESPACE_BEGIN /** @cond doxygenLibsbmlInternal */ /* * Creates a new Style object with the given SBML level * and SBML version. * * @param level SBML level of the new object * @param level SBML version of the new object */ Style::Style (unsigned int level, unsigned int version, unsigned int pkgVersion) : SBase(level,version) ,mId("") ,mGroup(level,version) { setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level,version,pkgVersion)); connectToChild(); }
/** * Creates a new LineSegment from the given XMLNode */ LineSegment::LineSegment(const XMLNode& node, unsigned int l2version) : SBase (2, l2version) , mStartPoint(2, l2version) , mEndPoint (2, l2version) { const XMLAttributes& attributes=node.getAttributes(); const XMLNode* child; //ExpectedAttributes ea(getElementName()); ExpectedAttributes ea; addExpectedAttributes(ea); this->readAttributes(attributes,ea); unsigned int n=0,nMax = node.getNumChildren(); while(n<nMax) { child=&node.getChild(n); const std::string& childName=child->getName(); if(childName=="start") { this->mStartPoint=Point(*child); } else if(childName=="end") { this->mEndPoint=Point(*child); } else if(childName=="annotation") { this->mAnnotation=new XMLNode(*child); } else if(childName=="notes") { this->mNotes=new XMLNode(*child); } else { //throw; } ++n; } connectToChild(); setSBMLNamespacesAndOwn(new LayoutPkgNamespaces(2,l2version)); }
/* * Creates a new Text object from the given XMLNode object. * The XMLNode object has to contain a valid XML representation of a * Text object as defined in the render extension specification. * This method is normally called when render information is read from a file and * should normally not have to be called explicitely. * * @param node the XMLNode object reference that describes the Text * object to be instantiated. */ Text::Text(const XMLNode& node, unsigned int l2version):GraphicalPrimitive1D(node, l2version) { const XMLAttributes& attributes=node.getAttributes(); ExpectedAttributes ea; addExpectedAttributes(ea); this->readAttributes(attributes,ea); unsigned int i,iMax=node.getNumChildren(); for(i=0;i<iMax;++i) { if(node.getChild(i).isText()) { mText=node.getChild(i).getCharacters(); break; } } setSBMLNamespacesAndOwn(new RenderPkgNamespaces(2,l2version)); connectToChild(); }
/** * Ctor. */ ListOfSpeciesReferenceGlyphs::ListOfSpeciesReferenceGlyphs(unsigned int level, unsigned int version, unsigned int pkgVersion) : ListOf(level,version) { setSBMLNamespacesAndOwn(new LayoutPkgNamespaces(level,version,pkgVersion)); };
/* * Ctor. */ ListOfLineSegments::ListOfLineSegments(unsigned int level, unsigned int version, unsigned int pkgVersion) : ListOf(level,version) { setSBMLNamespacesAndOwn(new LayoutPkgNamespaces(level,version,pkgVersion)); };
/* * Creates a new ReactionGlyph from the given XMLNode */ Curve::Curve(const XMLNode& node, unsigned int l2version) : SBase (2,l2version) ,mCurveSegments(2,l2version) { const XMLAttributes& attributes=node.getAttributes(); const XMLNode* child; //ExpectedAttributes ea(getElementName()); ExpectedAttributes ea; addExpectedAttributes(ea); this->readAttributes(attributes,ea); unsigned int n=0,nMax = node.getNumChildren(); while(n<nMax) { child=&node.getChild(n); const std::string& childName=child->getName(); if(childName=="annotation") { this->mAnnotation=new XMLNode(*child); } else if(childName=="notes") { this->mNotes=new XMLNode(*child); } else if(childName=="listOfCurveSegments") { const XMLNode* innerChild; unsigned int i=0,iMax=child->getNumChildren(); while(i<iMax) { innerChild=&child->getChild(i); const std::string innerChildName=innerChild->getName(); if(innerChildName=="curveSegment") { // get the type const XMLAttributes& innerAttributes=innerChild->getAttributes(); int typeIndex=innerAttributes.getIndex("type"); if(typeIndex==-1 || innerAttributes.getURI(typeIndex)!="http://www.w3.org/2001/XMLSchema-instance") { // throw ++i; continue; } if(innerAttributes.getValue(typeIndex)=="LineSegment") { this->mCurveSegments.appendAndOwn(new LineSegment(*innerChild)); } else if(innerAttributes.getValue(typeIndex)=="CubicBezier") { this->mCurveSegments.appendAndOwn(new CubicBezier(*innerChild)); } else { // throw } } else if(innerChildName=="annotation") { this->mCurveSegments.setAnnotation(new XMLNode(*innerChild)); } else if(innerChildName=="notes") { this->mCurveSegments.setNotes(new XMLNode(*innerChild)); } else { // throw } ++i; } } else { //throw; } ++n; } setSBMLNamespacesAndOwn(new LayoutPkgNamespaces(2,l2version)); connectToChild(); }
/* * Ctor. */ ListOfGlobalStyles::ListOfGlobalStyles(unsigned int level, unsigned int version, unsigned int pkgVersion) : ListOf(level,version) { setSBMLNamespacesAndOwn(new RenderPkgNamespaces(level,version,pkgVersion)); };
/* * Creates a new Style object from the given XMLNode object. * The XMLNode object has to contain a valid XML representation of a * Style object as defined in the render extension specification. * This method is normally called when render information is read from a file and * should normally not have to be called explicitely. * * @param node the XMLNode object reference that describes the Style * object to be instantiated. */ Style::Style(const XMLNode& node, unsigned int l2version) : SBase(2,l2version), mGroup(2,l2version) { mURI = RenderExtension::getXmlnsL3V1V1(); const XMLNode* child; const XMLAttributes& attributes=node.getAttributes(); ExpectedAttributes ea; addExpectedAttributes(ea); this->readAttributes(attributes, ea); unsigned int n=0,nMax = node.getNumChildren(); while(n<nMax) { child=&node.getChild(n); const std::string& childName=child->getName(); if(childName=="g") { this->mGroup=RenderGroup(*child); // set the unset values to the defaults if(!this->mGroup.isSetStroke()) { this->mGroup.setStroke("none"); } if(!this->mGroup.isSetStrokeWidth()) { this->mGroup.setStrokeWidth(0.0); } if(!this->mGroup.isSetDashArray()) { this->mGroup.setDashArray(std::vector<unsigned int>()); } if(!this->mGroup.isSetFillColor()) { this->mGroup.setFillColor("none"); } if(!this->mGroup.isSetFillRule()) { this->mGroup.setFillRule(GraphicalPrimitive2D::NONZERO); } if(!this->mGroup.isSetFontFamily()) { this->mGroup.setFontFamily("sans-serif"); } if(!this->mGroup.isSetFontSize()) { this->mGroup.setFontSize(0); } if(!this->mGroup.isSetFontWeight()) { this->mGroup.setFontWeight(Text::WEIGHT_NORMAL); } if(!this->mGroup.isSetFontStyle()) { this->mGroup.setFontStyle(Text::STYLE_NORMAL); } if(!this->mGroup.isSetStartHead()) { this->mGroup.setStartHead("none"); } if(!this->mGroup.isSetEndHead()) { this->mGroup.setEndHead("none"); } } else if(childName=="annotation") { this->mAnnotation=new XMLNode(*child); } else if(childName=="notes") { this->mNotes=new XMLNode(*child); } ++n; } setSBMLNamespacesAndOwn(new RenderPkgNamespaces(2,l2version)); connectToChild(); }