本文整理汇总了C++中CLayout::addMetaboliteGlyph方法的典型用法代码示例。如果您正苦于以下问题:C++ CLayout::addMetaboliteGlyph方法的具体用法?C++ CLayout::addMetaboliteGlyph怎么用?C++ CLayout::addMetaboliteGlyph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLayout
的用法示例。
在下文中一共展示了CLayout::addMetaboliteGlyph方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CLayout
//static
CLayout * SBMLDocumentLoader::createLayout(const Layout & sbmlLayout,
const std::map<std::string, std::string> & modelmap,
std::map<std::string, std::string> & layoutmap
#ifdef USE_CRENDER_EXTENSION
, const std::map<std::string, std::string>& globalIdToKeyMap
//,const std::map<std::string,std::map<std::string,std::string> >& globalColorIdToKeyMapMap
//,const std::map<std::string,std::map<std::string,std::string> >& globalGradientIdToKeyMapMap
//,const std::map<std::string,std::map<std::string,std::string> >& globalLineEndingIdToKeyMapMap
#endif /* USE_CRENDER_EXTENSION */
, const CCopasiContainer * pParent
)
{
CLayout* layout = new CLayout(sbmlLayout, layoutmap, pParent);
//compartments
unsigned C_INT32 i, iMax = sbmlLayout.getListOfCompartmentGlyphs()->size();
for (i = 0; i < iMax; ++i)
{
const CompartmentGlyph* tmp
= dynamic_cast<const CompartmentGlyph*>(sbmlLayout.getListOfCompartmentGlyphs()->get(i));
if (tmp)
layout->addCompartmentGlyph(new CLCompartmentGlyph(*tmp, modelmap, layoutmap));
}
//species
iMax = sbmlLayout.getListOfSpeciesGlyphs()->size();
for (i = 0; i < iMax; ++i)
{
const SpeciesGlyph* tmp
= dynamic_cast<const SpeciesGlyph*>(sbmlLayout.getListOfSpeciesGlyphs()->get(i));
if (tmp)
layout->addMetaboliteGlyph(new CLMetabGlyph(*tmp, modelmap, layoutmap));
}
//reactions
iMax = sbmlLayout.getListOfReactionGlyphs()->size();
for (i = 0; i < iMax; ++i)
{
const ReactionGlyph* tmp
= dynamic_cast<const ReactionGlyph*>(sbmlLayout.getListOfReactionGlyphs()->get(i));
if (tmp)
layout->addReactionGlyph(new CLReactionGlyph(*tmp, modelmap, layoutmap));
}
//text
iMax = sbmlLayout.getListOfTextGlyphs()->size();
for (i = 0; i < iMax; ++i)
{
const TextGlyph* tmp
= dynamic_cast<const TextGlyph*>(sbmlLayout.getListOfTextGlyphs()->get(i));
if (tmp)
layout->addTextGlyph(new CLTextGlyph(*tmp, modelmap, layoutmap));
}
//additional
iMax = sbmlLayout.getListOfAdditionalGraphicalObjects()->size();
for (i = 0; i < iMax; ++i)
{
const GraphicalObject* graphical
= dynamic_cast<const GraphicalObject*>(sbmlLayout.getListOfAdditionalGraphicalObjects()->get(i));
if (graphical)
layout->addGeneralGlyph(new CLGeneralGlyph(*graphical, modelmap, layoutmap));
}
//second pass text (the text glyph can refer to other glyphs. These references can)
//only be resolved after all glyphs are created).
iMax = sbmlLayout.getListOfTextGlyphs()->size();
for (i = 0; i < iMax; ++i)
{
const TextGlyph* tmp
= dynamic_cast<const TextGlyph*>(sbmlLayout.getListOfTextGlyphs()->get(i));
if (tmp)
postprocessTextGlyph(*tmp, layoutmap);
}
#ifdef USE_CRENDER_EXTENSION
RenderLayoutPlugin* rlPlugin = (RenderLayoutPlugin*) sbmlLayout.getPlugin("render");
assert(rlPlugin != NULL);
// import the local render information
iMax = rlPlugin->getNumLocalRenderInformationObjects();
std::map<std::string, std::string> idToKeyMap;
CLLocalRenderInformation* pLRI = NULL;
//std::map<std::string,std::string> colorIdToKeyMap;
//std::map<std::string,std::string> gradientIdToKeyMap;
//std::map<std::string,std::string> lineEndingIdToKeyMap;
//.........这里部分代码省略.........
示例2: createLayout
CLayout* CCopasiSpringLayout::createLayout(
CDataContainer *parent,
const std::set<const CCompartment*>& compartments,
const std::set<const CReaction*>& reactions,
const std::set<const CMetab*>& metabs,
const std::set<const CMetab*>& sideMetabs,
Parameters* mParams
)
{
CLayout *pResult = new CLayout("Layout", parent);
double fontSize = 16.0;
double fontHeight = fontSize * 1.5;
// create a species glyph for each species in metabs
std::map<const CCompartment*, CompartmentInfo> compInfo;
std::map<const CMetab*, CLMetabGlyph*> metabMap;
std::set<const CMetab*>::const_iterator metabIt;
for (metabIt = metabs.begin(); metabIt != metabs.end(); ++metabIt)
{
if (sideMetabs.find(*metabIt) != sideMetabs.end())
continue;
//estimate the size of the glyph
double width = (double)((*metabIt)->getObjectName().length() * fontSize);
double height = (double)fontHeight;
if (width < height)
{
width = height;
}
//create the glyph
CLMetabGlyph* pMetabGlyph = new CLMetabGlyph;
pMetabGlyph->setDimensions(CLDimensions(width + 4, height + 4));
pMetabGlyph->setModelObjectKey((*metabIt)->getKey());
pResult->addMetaboliteGlyph(pMetabGlyph);
metabMap[*metabIt] = pMetabGlyph;
//create the text glyph for the label
CLTextGlyph* pTextGlyph = new CLTextGlyph;
pTextGlyph->setDimensions(CLDimensions(width, height));
pTextGlyph->setGraphicalObjectKey(pMetabGlyph->getKey());
pTextGlyph->setModelObjectKey((*metabIt)->getKey());
pResult->addTextGlyph(pTextGlyph);
//add up the sizes for the compartment
const CCompartment* pComp = NULL;
if (compartments.find((*metabIt)->getCompartment()) != compartments.end())
pComp = (*metabIt)->getCompartment();
compInfo[pComp].add((width + 4) * (height + 4));
}
//now the reaction glyphs
std::set<const CReaction*>::const_iterator reactIt;
for (reactIt = reactions.begin(); reactIt != reactions.end(); ++reactIt)
{
CLReactionGlyph* pReactionGlyph = new CLReactionGlyph;
//pResult->setDimensions(CLDimensions(width, height));
pReactionGlyph->setModelObjectKey((*reactIt)->getKey());
//pReactionGlyph->getCurve().addCurveSegment(CLLineSegment(CLPoint(x, y),
// CLPoint(x + length, y)));
bool isReversible = (*reactIt)->isReversible();
pResult->addReactionGlyph(pReactionGlyph);
//now add the species reference glyphs.
//substrates
const CDataVector < CChemEqElement >& substrates = (*reactIt)->getChemEq().getSubstrates();
bool substrateExists = false;
CDataVector<CChemEqElement>::const_iterator elIt;
for (elIt = substrates.begin(); elIt != substrates.end(); ++elIt)
{
const CMetab* pMetab = elIt->getMetabolite();
if (!pMetab)
continue;
CLMetabGlyph* pMetabGlyph = NULL;
CLMetabReferenceGlyph::Role role; // = CLMetabReferenceGlyph::SUBSTRATE;
CLMetabReferenceGlyph::Role functionalRole;
//is it a side reactant? If yes, create a new metab glyph
if (sideMetabs.find(pMetab) != sideMetabs.end())
{
//estimate the size of the glyph
double width = (double)((pMetab)->getObjectName().length() * fontSize);
double height = (double)fontHeight;
if (width < height)
{
//.........这里部分代码省略.........