libSBML C++ API
libSBML 5.17.2 C++ API
|
Simple example of using the SBML graphical layout specification, in both Level 2 and Level 3.
#include <iostream>
#include <string>
#if (!defined LIBSBML_HAS_PACKAGE_LAYOUT)
#error "This example requires libSBML to be built with the layout extension."
#endif
using namespace std;
int main(int argc, char** argv){
if (argc != 2)
{
cout << endl << "Usage: addLayout input-filename"
<< endl << endl;
return 2;
}
{
}
else
{
{
}
{
}
= static_cast<LayoutModelPlugin*>(model->
getPlugin(
"layout"));
layout->
setId(
"Layout_1");
layout->setDimensions(&dim);
}
}
Spatial dimensions of a 2D or 3D shape.
Definition: Dimensions.h:61
Include all SBML types in a single header file.
Extension of Model.
Definition: LayoutModelPlugin.h:58
static const std::string & getXmlnsL3V1V1()
Returns the XML namespace URI of the SBML Level 3 package implemented by this libSBML extension.
Definition: LayoutExtension.cpp:94
Layout * createLayout()
Creates a new layout object and adds it to the list of layout objects and returns it.
Definition: LayoutModelPlugin.cpp:471
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:100
SBMLDocument_t * readSBML(const char *filename)
unsigned int getVersion() const
Returns the Version within the SBML Level of the SBMLDocument object containing this object.
Definition: SBase.cpp:3010
unsigned int getNumErrors() const
Returns the number of errors or warnings encountered during parsing, consistency checking,...
Definition: SBMLDocument.cpp:1176
const Model * getModel() const
Returns the Model object stored in this SBMLDocument.
Definition: SBMLDocument.cpp:353
The layout of a diagram of an SBML model.
Definition: Layout.h:779
An SBML model.
Definition: Model.h:475
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
Include all SBML types of layout extension in a single header file.
void printErrors(std::ostream &stream=std::cerr) const
Prints all the errors or warnings encountered trying to parse, check, or translate this SBML document...
Definition: SBMLDocument.cpp:1199
unsigned int getLevel() const
Returns the SBML Level of the SBMLDocument object containing this object.
Definition: SBase.cpp:2995
int enablePackage(const std::string &pkgURI, const std::string &pkgPrefix, bool flag)
Enables or disables the given SBML Level 3 package on this object.
Definition: SBase.cpp:3580
#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.