/** * Creates an XMLNode object from this. */ XMLNode ListOfSpeciesReferenceGlyphs::toXML() const { XMLNamespaces xmlns = XMLNamespaces(); XMLTriple triple = XMLTriple("listOfSpeciesReferenceGlyphs", "http://projects.eml.org/bcb/sbml/level2", ""); XMLAttributes att = XMLAttributes(); XMLToken token = XMLToken(triple, att, xmlns); XMLNode node(token); // add the notes and annotations bool end=true; if(this->mNotes) { node.addChild(*this->mNotes); end=false; } if(this->mAnnotation) { node.addChild(*this->mAnnotation); end=false; } unsigned int i,iMax=this->size(); const SpeciesReferenceGlyph* object=NULL; for(i=0;i<iMax;++i) { object=dynamic_cast<const SpeciesReferenceGlyph*>(this->get(i)); assert(object); node.addChild(object->toXML()); } if(end==true && iMax==0) { node.setEnd(); } return node; }
/** * Creates an XMLNode object from this. */ XMLNode Curve::toXML() const { XMLNamespaces xmlns = XMLNamespaces(); XMLTriple triple = XMLTriple("curve", "", ""); XMLAttributes att = XMLAttributes(); // add the SBase Ids addSBaseAttributes(*this,att); XMLToken token = XMLToken(triple, att, xmlns); XMLNode node(token); // add the notes and annotations bool end=true; if(this->mNotes) { node.addChild(*this->mNotes); end=false; } if(this->mAnnotation) { node.addChild(*this->mAnnotation); end=false; } // add the list of line segments if(this->mCurveSegments.size()>0) { node.addChild(this->mCurveSegments.toXML()); end=false; } if(end==true) node.setEnd(); return node; }
/** * Creates an XMLNode object from this. */ XMLNode ReactionGlyph::toXML() const { XMLNamespaces xmlns = XMLNamespaces(); XMLTriple triple = XMLTriple("reactionGlyph", "", ""); XMLAttributes att = XMLAttributes(); // add the SBase Ids addSBaseAttributes(*this,att); addGraphicalObjectAttributes(*this,att); if(this->isSetReactionId()) att.add("reaction",this->mReaction); XMLToken token = XMLToken(triple, att, xmlns); XMLNode node(token); // add the notes and annotations if(this->mNotes) node.addChild(*this->mNotes); if(this->mAnnotation) node.addChild(*this->mAnnotation); if(this->mCurve.getNumCurveSegments()==0) { // write the bounding box node.addChild(this->mBoundingBox.toXML()); } else { // add the curve node.addChild(this->mCurve.toXML()); } // add the list of species reference glyphs if(this->mSpeciesReferenceGlyphs.size()>0) { node.addChild(this->mSpeciesReferenceGlyphs.toXML()); } return node; }
// Instances a element tree based on the stream ElementDocument* Factory::InstanceDocumentStream(Rocket::Core::Context* context, Stream* stream) { Element* element = Factory::InstanceElement(NULL, "body", "body", XMLAttributes()); if (!element) { Log::Message(Log::LT_ERROR, "Failed to instance document, instancer returned NULL."); return NULL; } ElementDocument* document = dynamic_cast< ElementDocument* >(element); if (!document) { Log::Message(Log::LT_ERROR, "Failed to instance document element. Found type '%s', was expecting derivative of ElementDocument.", typeid(element).name()); return NULL; } document->lock_layout = true; document->context = context; XMLParser parser(element); parser.Parse(stream); document->lock_layout = false; return document; }
// Creates the scrollbar corner. bool ElementScroll::CreateCorner() { if (corner != NULL) return true; corner = Factory::InstanceElement(element, "*", "scrollbarcorner", XMLAttributes()); element->AppendChild(corner, false); corner->RemoveReference(); return true; }
/** * Creates an XMLNode object from this. */ XMLNode GraphicalObject::toXML() const { XMLNamespaces xmlns = XMLNamespaces(); XMLTriple triple = XMLTriple("graphicalObject", "", ""); XMLAttributes att = XMLAttributes(); // add the SBase Ids addSBaseAttributes(*this,att); addGraphicalObjectAttributes(*this,att); XMLToken token = XMLToken(triple, att, xmlns); XMLNode node(token); // add the notes and annotations if(this->mNotes) node.addChild(*this->mNotes); if(this->mAnnotation) node.addChild(*this->mAnnotation); // write the bounding box node.addChild(this->mBoundingBox.toXML()); return node; }
/** * Creates an XMLNode object from this. */ XMLNode LineSegment::toXML() const { XMLNamespaces xmlns = XMLNamespaces(); XMLTriple triple = XMLTriple("curveSegment", "", ""); XMLAttributes att = XMLAttributes(); // add the SBase Ids addSBaseAttributes(*this,att); att.add("type","LineSegment","http://www.w3.org/2001/XMLSchema-instance","xsi"); XMLToken token = XMLToken(triple, att, xmlns); XMLNode node(token); // add the notes and annotations if(this->mNotes) node.addChild(*this->mNotes); if(this->mAnnotation) node.addChild(*this->mAnnotation); // add start point node.addChild(this->mStartPoint.toXML("start")); // add end point node.addChild(this->mEndPoint.toXML("end")); return node; }
/** * Creates an XMLNode object from this. */ XMLNode TextGlyph::toXML() const { XMLNamespaces xmlns = XMLNamespaces(); XMLTriple triple = XMLTriple("textGlyph", "", ""); XMLAttributes att = XMLAttributes(); // add the SBase Ids addSBaseAttributes(*this,att); addGraphicalObjectAttributes(*this,att); if(this->isSetText()) att.add("text",this->mText); if(this->isSetGraphicalObjectId()) att.add("graphicalObject",this->mGraphicalObject); if(this->isSetOriginOfTextId()) att.add("originOfText",this->mOriginOfText); XMLToken token = XMLToken(triple, att, xmlns); XMLNode node(token); // add the notes and annotations if(this->mNotes) node.addChild(*this->mNotes); if(this->mAnnotation) node.addChild(*this->mAnnotation); // write the bounding box node.addChild(this->mBoundingBox.toXML()); return node; }
/** * Creates an XMLNode object from this. */ XMLNode Point::toXML(const std::string& name) const { XMLNamespaces xmlns = XMLNamespaces(); XMLTriple triple = XMLTriple(name, "", ""); XMLAttributes att = XMLAttributes(); // add the SBase Ids addSBaseAttributes(*this,att); std::ostringstream os; os << this->mXOffset; att.add("x",os.str()); os.str(""); os << this->mYOffset; att.add("y",os.str()); if(this->mZOffset!=0.0) { os.str(""); os << this->mZOffset; att.add("z",os.str()); } XMLToken token = XMLToken(triple, att, xmlns); XMLNode node(token); // add the notes and annotations bool end=true; if(this->mNotes) { node.addChild(*this->mNotes); end=false; } if(this->mAnnotation) { node.addChild(*this->mAnnotation); end=false; } if(end==true) node.setEnd(); return node; }
XMLAttributes XMLNode::getAttributes() const{ return Nullptr != m_data ? m_data->m_attributes : XMLAttributes(); }
Element* ElementDocument::CreateElement(const String& name) { return Factory::InstanceElement(NULL, name, name, XMLAttributes()); }
// Creates one of the scroll component's scrollbar. bool ElementScroll::CreateScrollbar(Orientation orientation) { if (scrollbars[orientation].element != NULL && scrollbars[orientation].widget != NULL) return true; scrollbars[orientation].element = Factory::InstanceElement(element, "*", orientation == VERTICAL ? "scrollbarvertical" : "scrollbarhorizontal", XMLAttributes()); scrollbars[orientation].element->AddEventListener("scrollchange", this); scrollbars[orientation].element->SetProperty(CLIP, "1"); scrollbars[orientation].widget = new WidgetSliderScroll(scrollbars[orientation].element); scrollbars[orientation].widget->Initialise(orientation == VERTICAL ? WidgetSlider::VERTICAL : WidgetSlider::HORIZONTAL); element->AppendChild(scrollbars[orientation].element, false); scrollbars[orientation].element->RemoveReference(); return true; }