libSBML C++ API
libSBML 5.18.0 C++ API
|
An example layout.
#if (!defined LIBSBML_HAS_PACKAGE_LAYOUT)
#error "This example requires libSBML to be built with the layout extension."
#endif
int main(int argc, char** argv)
{
model->
setId(
"TestModel_with_modifiers");
= static_cast<LayoutModelPlugin*>(model->
getPlugin(
"layout"));
layout->
setId(
"Layout_1");
layout->setDimensions(&dim);
compartment->
setId(
"Yeast");
compartmentGlyph->
setId(
"CompartmentGlyph_1");
species_Gluc->
setId(
"Glucose");
glyph_Gluc->
setId(
"SpeciesGlyph_Glucose");
TextGlyph* tGlyph = layout->createTextGlyph();
tGlyph->
setId(
"TextGlyph_Glucose");
species_G6P->
setId(
"Glucose_hyphen_6_hyphen_phosphate");
glyph_G6P->
setId(
"SpeciesGlyph_G6P");
tGlyph = layout->createTextGlyph();
tGlyph->
setId(
"TextGlyph_G6P");
species_ATP->
setId(
"ATP");
glyph_ATP->
setId(
"SpeciesGlyph_ATP");
tGlyph = layout->createTextGlyph();
tGlyph->
setId(
"TextGlyph_ATP");
species_ADP->
setId(
"ADP");
glyph_ADP->
setId(
"glyph_ADP");
tGlyph = layout->createTextGlyph();
tGlyph->
setId(
"TextGlyph_ADP");
glyph_Pi->
setId(
"SpeciesGlyph_Pi");
tGlyph = layout->createTextGlyph();
tGlyph->
setId(
"TextGlyph_PI");
reaction_Hexokinase->
setId(
"Hexokinase");
glyph_Hexokinase->
setId(
"glyph_Hexokinase");
Point p(&layoutns, 170, 100);
p =
Point(&layoutns, 170, 130);
reference_Gluc->
setId(
"SpeciesReference_Glucose");
speciesReferenceGlyph->
setId(
"SpeciesReferenceGlyph_Glucose");
p =
Point(&layoutns, 170, 100);
p =
Point(&layoutns, 170, 50);
reference_ATP->
setId(
"SpeciesReference_ATP");
speciesReferenceGlyph->
setId(
"SpeciesReferenceGlyph_ATP");
p =
Point(&layoutns, 170, 100);
p =
Point(&layoutns, 170, 80);
p =
Point(&layoutns, 170, 80);
p =
Point(&layoutns, 260, 80);
reference_G6P->
setId(
"SpeciesReference_G6P");
speciesReferenceGlyph->
setId(
"SpeciesReferenceGlyph_G6P_1");
p =
Point(&layoutns, 170, 130);
p =
Point(&layoutns, 170, 180);
reference_ADP->
setId(
"SpeciesReference_ADP");
speciesReferenceGlyph->
setId(
"SpeciesReferenceGlyph_ADP");
p =
Point(&layoutns, 170, 130);
p =
Point(&layoutns, 170, 150);
p =
Point(&layoutns, 170, 150);
p =
Point(&layoutns, 260, 150);
reference_G6P_2->
setId(
"ModifierSpeciesReference_G6P");
speciesReferenceGlyph->
setId(
"SpeciesReferenceGlyph_G6P_2");
p =
Point(&layoutns, 45, 200);
p =
Point(&layoutns, 0, 200);
p =
Point(&layoutns, 0, 120);
p =
Point(&layoutns, 165, 120);
reference_Pi->
setId(
"ModifierSpeciesReference_Pi");
speciesReferenceGlyph->
setId(
"SpeciesReferenceGlyph_PI");
p =
Point(&layoutns, 115, 110);
p =
Point(&layoutns, 140, 110);
p =
Point(&layoutns, 140, 110);
p =
Point(&layoutns, 165, 110);
writeSBML(document,
"layout_example3_L2.xml");
delete document;
}
A reference to an SBML species in a reaction.
Definition: SpeciesReference.h:275
int setModel(const Model *m)
Sets the Model for this SBMLDocument to a copy of the given Model.
Definition: SBMLDocument.cpp:599
ModifierSpeciesReference * createModifier()
Creates a new ModifierSpeciesReference, adds it to this Reaction's list of modifiers and returns it.
Definition: Reaction.cpp:1011
void setRole(const std::string &role)
Sets the role based on a string.
Definition: SpeciesReferenceGlyph.cpp:338
Spatial dimensions of a 2D or 3D shape.
Definition: Dimensions.h:65
An SBML reaction between species in an SBML model.
Definition: Reaction.h:218
void setBasePoint1(const Point *p)
Initializes first base point with a copy of the given point.
Definition: CubicBezier.cpp:403
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this GraphicalObject.
Definition: GraphicalObject.cpp:385
A Cubic Bézier smooth curve.
Definition: CubicBezier.h:65
Representation of a point.
Definition: Point.h:59
A curve connecting elements in a diagram.
Definition: Curve.h:211
virtual const std::string & getId() const
Returns the value of the "id" attribute of this SimpleSpeciesReference.
Definition: SimpleSpeciesReference.cpp:128
SpeciesReferenceGlyph * createSpeciesReferenceGlyph()
Creates a new SpeciesReferenceGlyph object, adds it to the end of the list of species reference objec...
Definition: ReactionGlyph.cpp:496
LineSegment * createLineSegment()
Creates a new LineSegment and adds it to the end of the list.
Definition: Curve.cpp:359
Include all SBML types in a single header file.
Reaction * createReaction()
Creates a new Reaction inside this Model and returns it.
Definition: Model.cpp:1779
LineSegment * createLineSegment()
Creates a new LineSegment object, adds it to the end of the list of curve segment objects of the curv...
Definition: SpeciesReferenceGlyph.cpp:457
Extension of Model.
Definition: LayoutModelPlugin.h:62
virtual const std::string & getId() const
Returns the value of the "id" attribute of this Reaction.
Definition: Reaction.cpp:375
int setReversible(bool value)
Sets the value of the "reversible" attribute of this Reaction.
Definition: Reaction.cpp:607
A glyph for an SBML reaction.
Definition: ReactionGlyph.h:249
CubicBezier * createCubicBezier()
Creates a new CubicBezier object, adds it to the end of the list of curve segment objects of the curv...
Definition: SpeciesReferenceGlyph.cpp:469
Definition: SpeciesReferenceRole.h:56
void setSpeciesId(const std::string &id)
Sets the id of the associated species object.
Definition: SpeciesGlyph.cpp:201
Model * createModel(const std::string sid="")
Creates a new Model inside this SBMLDocument, and returns a pointer to it.
Definition: SBMLDocument.cpp:643
Layout * createLayout()
Creates a new layout object and adds it to the list of layout objects and returns it.
Definition: LayoutModelPlugin.cpp:475
void setEnd(const Point *end)
Initializes the end point with a copy of the given Point object.
Definition: LineSegment.cpp:369
Species * createSpecies()
Creates a new Species inside this Model and returns it.
Definition: Model.cpp:1590
static const std::string & getXmlnsL2()
Returns the XML namespace URI of the SBML Level 2 version of the package implemented by this libSBML ...
Definition: LayoutExtension.cpp:104
void setSpeciesGlyphId(const std::string &speciesGlyphId)
Sets the id of the associated species glyph.
Definition: SpeciesReferenceGlyph.cpp:284
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this SimpleSpeciesReference.
Definition: SimpleSpeciesReference.cpp:210
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Compartment object.
Definition: Compartment.cpp:474
int addModifier(const ModifierSpeciesReference *msr)
Adds a given ModifierSpeciesReference object as a product in this Reaction.
Definition: Reaction.cpp:904
SpeciesReference * createReactant()
Creates a new SpeciesReference, adds it to this Reaction's list of reactants, and returns it.
Definition: Reaction.cpp:955
const Curve * getCurve() const
Returns the curve object for the reaction glyph.
Definition: ReactionGlyph.cpp:447
void setSpeciesReferenceId(const std::string &id)
Sets the id of the associated species reference.
Definition: SpeciesReferenceGlyph.cpp:304
void setBasePoint2(const Point *p)
Initializes second base point with a copy of the given point.
Definition: CubicBezier.cpp:452
An SBML compartment, where species are located.
Definition: Compartment.h:484
A glyph for an SBML species.
Definition: SpeciesGlyph.h:59
int addNamespace(const std::string &uri, const std::string &prefix)
Add an XML namespace (a pair of URI and prefix) to the set of namespaces within this SBMLNamespaces o...
Definition: SBMLNamespaces.cpp:480
int setSpecies(const std::string &sid)
Sets the "species" attribute of this SimpleSpeciesReference.
Definition: SimpleSpeciesReference.cpp:192
The layout of a diagram of an SBML model.
Definition: Layout.h:783
An SBML model.
Definition: Model.h:479
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Species.
Definition: Species.cpp:586
SBMLNamespaces extension for the package.
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Layout.
Definition: Layout.cpp:449
int setGraphicalObjectId(const std::string &id)
Sets the id of the associated graphical object.
Definition: TextGlyph.cpp:241
virtual const std::string & getId() const
Returns the value of the "id" attribute of this GraphicalObject.
Definition: GraphicalObject.cpp:367
Include all SBML types of layout extension in a single header file.
A glyph for an SBML compartment.
Definition: CompartmentGlyph.h:54
A bounding box for an item in a diagram.
Definition: BoundingBox.h:58
Representation of a line.
Definition: LineSegment.h:63
SpeciesReference * createProduct()
Creates a new SpeciesReference, adds it to this Reaction's list of products, and returns it.
Definition: Reaction.cpp:983
int setReactionId(const std::string &id)
Sets the id of the associated reaction.
Definition: ReactionGlyph.cpp:319
void setStart(const Point *start)
Initializes the start point with a copy of the given Point object.
Definition: LineSegment.cpp:322
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Reaction.
Definition: Reaction.cpp:516
int setOriginOfTextId(const std::string &orig)
Sets the id of the origin of text.
Definition: TextGlyph.cpp:261
Definition: SpeciesReferenceRole.h:62
Set of SBML Level + Version + namespace triples.
Definition: SBMLNamespaces.h:139
int setCompartmentId(const std::string &id)
Sets the id of the associated compartment.
Definition: CompartmentGlyph.cpp:218
Definition: SpeciesReferenceRole.h:61
int setCompartment(const std::string &sid)
Sets the "compartment" attribute of this Species object.
Definition: Species.cpp:665
virtual const std::string & getId() const
Returns the value of the "id" attribute of this Compartment.
Definition: Compartment.cpp:238
A glyph for a text label.
Definition: TextGlyph.h:59
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Model.
Definition: Model.cpp:717
Compartment * createCompartment()
Creates a new Compartment inside this Model and returns it.
Definition: Model.cpp:1563
A glyph for an SBML species reference.
Definition: SpeciesReferenceGlyph.h:65
void setBoundingBox(const BoundingBox *bb)
Sets the boundingbox for the GraphicalObject.
Definition: GraphicalObject.cpp:470
Definition: SpeciesReferenceRole.h:58
Definition: SpeciesReferenceRole.h:57
An SBML species – a pool of entities.
Definition: Species.h:423
Definition: SpeciesReferenceRole.h:59
virtual const std::string & getId() const
Returns the value of the "id" attribute of this Species.
Definition: Species.cpp:273
#define LIBSBML_CPP_NAMESPACE_USE
Definition: libsbml-namespace.h:67
Overall SBML container object.
Definition: SBMLDocument.h:342
SBasePlugin * getPlugin(const std::string &package)
Returns a plug-in object (extension interface) for an SBML Level 3 package extension with the given p...
Definition: SBase.cpp:3460
int writeSBML(const SBMLDocument_t *d, const char *filename)
Writes the given SBML document d to the file named by filename.
A reference to an SBML modifier species.
Definition: ModifierSpeciesReference.h:86