本文整理汇总了C++中CCopasiDataModel::getListOfLayouts方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiDataModel::getListOfLayouts方法的具体用法?C++ CCopasiDataModel::getListOfLayouts怎么用?C++ CCopasiDataModel::getListOfLayouts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCopasiDataModel
的用法示例。
在下文中一共展示了CCopasiDataModel::getListOfLayouts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: importCellDesigner
/**
* This method tries to import CellDesigner annotations.
*/
void DataModelGUI::importCellDesigner()
{
// add code to check for CellDesigner annotations
// ask the user if the annotations should be imported
CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
assert(pDataModel != NULL);
if (pDataModel != NULL)
{
SBMLDocument* pSBMLDocument = pDataModel->getCurrentSBMLDocument();
if (pSBMLDocument != NULL &&
pSBMLDocument->getModel() != NULL &&
pSBMLDocument->getModel()->getAnnotation() != NULL)
{
// check for the CellDesigner namespace
std::pair<bool, std::string> foundNamespace = CCellDesignerImporter::findCellDesignerNamespace(pSBMLDocument);
if (foundNamespace.first == true)
{
const XMLNode* pAnno = CCellDesignerImporter::findCellDesignerAnnotation(pSBMLDocument, pSBMLDocument->getModel()->getAnnotation());
// first we check if there are supported cell designer annotations
if (pAnno != NULL)
{
// check if the file contains the correct version
double version = CCellDesignerImporter::determineVersion(pAnno);
if (version < 4.0)
{
CCopasiMessage(CCopasiMessage::RAW, "CellDesigner annotation was found in the file, but the version is not supported.\nPlease open the file in the latest version of CellDesigner and save it again.");
}
else
{
bool importCD = false;
#if LIBSBML_VERSION >= 50400
// if we don't have a layout import it!
LayoutModelPlugin* mplugin = (LayoutModelPlugin*)pSBMLDocument->getModel()->getPlugin("layout");
if (mplugin == NULL || (mplugin != NULL && mplugin->getNumLayouts() == 0))
importCD = true;
#endif
// ask the user if the CellDesigner annotation should be imported
if (importCD || CQMessageBox::question(NULL, "CellDesigner import", "A CellDesigner diagram was found in this file.\nDo you want to import the diagram?" , QMessageBox::Yes | QMessageBox::No , QMessageBox::No) == QMessageBox::Yes)
{
// do the import
CCellDesignerImporter cd_importer(pSBMLDocument);
if (cd_importer.getLayout() == NULL)
{
CCopasiMessage(CCopasiMessage::WARNING, "Sorry, CellDesigner annotations could not be importet.");
}
else
{
// now we have to import the created layout
// create the model map
std::string s1, s2;
std::map<std::string, std::string> modelmap;
std::map<CCopasiObject*, SBase*>::const_iterator it;
std::map<CCopasiObject*, SBase*>::const_iterator itEnd = pDataModel->getCopasi2SBMLMap().end();
for (it = pDataModel->getCopasi2SBMLMap().begin(); it != itEnd; ++it)
{
s1 = SBMLUtils::getIdFromSBase(it->second);
if (it->first)
{
s2 = it->first->getKey();
}
else
{
s2 = "";
}
if ((s1 != "") && (s2 != ""))
{
modelmap[s1] = s2;
}
}
// the layout map and the id to key map can be empty
std::map<std::string, std::string> layoutmap;
std::map<std::string, std::string> idToKeyMap;
#ifdef USE_CRENDER_EXTENSION
CLayout* pLayout = SBMLDocumentLoader::createLayout(*cd_importer.getLayout(), modelmap, layoutmap, idToKeyMap);
#else
CLayout* pLayout = SBMLDocumentLoader::createLayout(*cd_importer.getLayout(), modelmap, layoutmap);
#endif /* USE_CRENDER_EXTENSION */
// add the layout to the DataModel
if (pLayout != NULL && pDataModel->getListOfLayouts() != NULL)
{
// the addLayout methods expects a map as the second argument which currently is
// ignored, so we just pass an empty one
// TODO maybe the methods actually expects one of the maps above (layoutmap or idToKeyMap), but
//.........这里部分代码省略.........