libSBML C++ API
libSBML 5.17.2 C++ API
|
A version of example3.cpp
for SBML Level 3.
#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");
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_L3.xml");
delete document;
}
A reference to an SBML species in a reaction.
Definition: SpeciesReference.h:271
int setModel(const Model *m)
Sets the Model for this SBMLDocument to a copy of the given Model.
Definition: SBMLDocument.cpp:591
ModifierSpeciesReference * createModifier()
Creates a new ModifierSpeciesReference, adds it to this Reaction's list of modifiers and returns it.
Definition: Reaction.cpp:1007
void setRole(const std::string &role)
Sets the role based on a string.
Definition: SpeciesReferenceGlyph.cpp:334
Spatial dimensions of a 2D or 3D shape.
Definition: Dimensions.h:61
An SBML reaction between species in an SBML model.
Definition: Reaction.h:214
void setBasePoint1(const Point *p)
Initializes first base point with a copy of the given point.
Definition: CubicBezier.cpp:399
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this GraphicalObject.
Definition: GraphicalObject.cpp:381
A Cubic Bézier smooth curve.
Definition: CubicBezier.h:61
Representation of a point.
Definition: Point.h:55
A curve connecting elements in a diagram.
Definition: Curve.h:207
virtual const std::string & getId() const
Returns the value of the "id" attribute of this SimpleSpeciesReference.
Definition: SimpleSpeciesReference.cpp:124
SpeciesReferenceGlyph * createSpeciesReferenceGlyph()
Creates a new SpeciesReferenceGlyph object, adds it to the end of the list of species reference objec...
Definition: ReactionGlyph.cpp:492
LineSegment * createLineSegment()
Creates a new LineSegment and adds it to the end of the list.
Definition: Curve.cpp:355
Include all SBML types in a single header file.
Reaction * createReaction()
Creates a new Reaction inside this Model and returns it.
Definition: Model.cpp:1771
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:453
Extension of Model.
Definition: LayoutModelPlugin.h:58
virtual const std::string & getId() const
Returns the value of the "id" attribute of this Reaction.
Definition: Reaction.cpp:371
int setReversible(bool value)
Sets the value of the "reversible" attribute of this Reaction.
Definition: Reaction.cpp:603
A glyph for an SBML reaction.
Definition: ReactionGlyph.h:245
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:465
Definition: SpeciesReferenceRole.h:52
void setSpeciesId(const std::string &id)
Sets the id of the associated species object.
Definition: SpeciesGlyph.cpp:197
Layout * createLayout()
Creates a new layout object and adds it to the list of layout objects and returns it.
Definition: LayoutModelPlugin.cpp:471
void setEnd(const Point *end)
Initializes the end point with a copy of the given Point object.
Definition: LineSegment.cpp:365
Species * createSpecies()
Creates a new Species inside this Model and returns it.
Definition: Model.cpp:1582
void setSpeciesGlyphId(const std::string &speciesGlyphId)
Sets the id of the associated species glyph.
Definition: SpeciesReferenceGlyph.cpp:280
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this SimpleSpeciesReference.
Definition: SimpleSpeciesReference.cpp:206
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Compartment object.
Definition: Compartment.cpp:470
int addModifier(const ModifierSpeciesReference *msr)
Adds a given ModifierSpeciesReference object as a product in this Reaction.
Definition: Reaction.cpp:900
SpeciesReference * createReactant()
Creates a new SpeciesReference, adds it to this Reaction's list of reactants, and returns it.
Definition: Reaction.cpp:951
const Curve * getCurve() const
Returns the curve object for the reaction glyph.
Definition: ReactionGlyph.cpp:443
void setSpeciesReferenceId(const std::string &id)
Sets the id of the associated species reference.
Definition: SpeciesReferenceGlyph.cpp:300
void setBasePoint2(const Point *p)
Initializes second base point with a copy of the given point.
Definition: CubicBezier.cpp:448
An SBML compartment, where species are located.
Definition: Compartment.h:480
A glyph for an SBML species.
Definition: SpeciesGlyph.h:55
int setSpecies(const std::string &sid)
Sets the "species" attribute of this SimpleSpeciesReference.
Definition: SimpleSpeciesReference.cpp:188
The layout of a diagram of an SBML model.
Definition: Layout.h:779
An SBML model.
Definition: Model.h:475
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Species.
Definition: Species.cpp:582
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:445
int setGraphicalObjectId(const std::string &id)
Sets the id of the associated graphical object.
Definition: TextGlyph.cpp:237
virtual const std::string & getId() const
Returns the value of the "id" attribute of this GraphicalObject.
Definition: GraphicalObject.cpp:363
Include all SBML types of layout extension in a single header file.
A glyph for an SBML compartment.
Definition: CompartmentGlyph.h:50
A bounding box for an item in a diagram.
Definition: BoundingBox.h:54
Representation of a line.
Definition: LineSegment.h:59
SpeciesReference * createProduct()
Creates a new SpeciesReference, adds it to this Reaction's list of products, and returns it.
Definition: Reaction.cpp:979
int setReactionId(const std::string &id)
Sets the id of the associated reaction.
Definition: ReactionGlyph.cpp:315
void setStart(const Point *start)
Initializes the start point with a copy of the given Point object.
Definition: LineSegment.cpp:318
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Reaction.
Definition: Reaction.cpp:512
int setOriginOfTextId(const std::string &orig)
Sets the id of the origin of text.
Definition: TextGlyph.cpp:257
Definition: SpeciesReferenceRole.h:58
Set of SBML Level + Version + namespace triples.
Definition: SBMLNamespaces.h:135
int setCompartmentId(const std::string &id)
Sets the id of the associated compartment.
Definition: CompartmentGlyph.cpp:214
Definition: SpeciesReferenceRole.h:57
int setCompartment(const std::string &sid)
Sets the "compartment" attribute of this Species object.
Definition: Species.cpp:661
virtual const std::string & getId() const
Returns the value of the "id" attribute of this Compartment.
Definition: Compartment.cpp:234
A glyph for a text label.
Definition: TextGlyph.h:55
virtual int setId(const std::string &sid)
Sets the value of the "id" attribute of this Model.
Definition: Model.cpp:709
Compartment * createCompartment()
Creates a new Compartment inside this Model and returns it.
Definition: Model.cpp:1555
A glyph for an SBML species reference.
Definition: SpeciesReferenceGlyph.h:61
void setBoundingBox(const BoundingBox *bb)
Sets the boundingbox for the GraphicalObject.
Definition: GraphicalObject.cpp:466
Definition: SpeciesReferenceRole.h:54
Definition: SpeciesReferenceRole.h:53
An SBML species – a pool of entities.
Definition: Species.h:419
Definition: SpeciesReferenceRole.h:55
virtual const std::string & getId() const
Returns the value of the "id" attribute of this Species.
Definition: Species.cpp:269
#define LIBSBML_CPP_NAMESPACE_USE
Definition: libsbml-namespace.h:63
Overall SBML container object.
Definition: SBMLDocument.h:338
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:3456
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:82
Model * createModel(const std::string &sid="")
Creates a new Model inside this SBMLDocument, and returns a pointer to it.
Definition: SBMLDocument.cpp:635