Simple example of writing a model that uses the SBML Level 3 Groups package and also the SBML Level 3 Layout package.
int main(int argc,char** argv){
sbmlns.addPkgNamespace("layout",1);
sbmlns.addPkgNamespace("groups",1);
model->
setId(
"TestModel");
compartment->
setId(
"Compartment_1");
species1->
setId(
"Species_1");
species2->
setId(
"Species_2");
reaction1->
setId(
"Reaction_1");
reference1->
setId(
"SpeciesReference_1");
reference2->
setId(
"SpeciesReference_2");
reaction2->
setId(
"Reaction_2");
reference3->
setId(
"SpeciesReference_3");
reference4->
setId(
"SpeciesReference_4");
layout->
setId(
"Layout_1");
compartmentGlyph->
setId(
"CompartmentGlyph_1");
speciesGlyph1->
setId(
"SpeciesGlyph_1");
textGlyph1->
setId(
"TextGlyph_01");
speciesGlyph2->
setId(
"SpeciesGlyph_2");
textGlyph2->
setId(
"TextGlyph_02");
reactionGlyph1->
setId(
"ReactionGlyph_1");
Point p(&layoutns,165,105);
p=
Point(&layoutns,165,115);
reactionGlyph2->
setId(
"ReactionGlyph_1");
p=
Point(&layoutns,235,105);
p=
Point(&layoutns,235,115);
speciesReferenceGlyph1->
setId(
"SpeciesReferenceGlyph_1");
Curve* speciesReferenceCurve1=speciesReferenceGlyph1->
getCurve();
p=
Point(&layoutns,165,105);
p=
Point(&layoutns,165,90);
p=
Point(&layoutns,165,90);
p=
Point(&layoutns,195,60);
speciesReferenceGlyph2->
setId(
"SpeciesReferenceGlyph_2");
Curve* speciesReferenceCurve2=speciesReferenceGlyph2->
getCurve();
p=
Point(&layoutns,165,115);
p=
Point(&layoutns,165,130);
p=
Point(&layoutns,165,130);
p=
Point(&layoutns,195,160);
speciesReferenceGlyph3->
setId(
"SpeciesReferenceGlyph_3");
Curve* speciesReferenceCurve3=speciesReferenceGlyph3->
getCurve();
p=
Point(&layoutns,235,115);
p=
Point(&layoutns,235,130);
p=
Point(&layoutns,235,130);
p=
Point(&layoutns,205,160);
speciesReferenceGlyph4->
setId(
"SpeciesReferenceGlyph_4");
Curve* speciesReferenceCurve4=speciesReferenceGlyph4->
getCurve();
p=
Point(&layoutns,235,105);
p=
Point(&layoutns,235,90);
p=
Point(&layoutns,235,90);
p=
Point(&layoutns,205,60);
group->
setId(
"role_substrate");
member->
setIdRef(
"SpeciesReferenceGlyph_1");
member->
setIdRef(
"SpeciesReferenceGlyph_3");
group->
setId(
"role_product");
member->
setIdRef(
"SpeciesReferenceGlyph_2");
member->
setIdRef(
"SpeciesReferenceGlyph_4");
delete document;
}