本文整理汇总了C++中CLayout::addGeneralGlyph方法的典型用法代码示例。如果您正苦于以下问题:C++ CLayout::addGeneralGlyph方法的具体用法?C++ CLayout::addGeneralGlyph怎么用?C++ CLayout::addGeneralGlyph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLayout
的用法示例。
在下文中一共展示了CLayout::addGeneralGlyph方法的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
//.........这里部分代码省略.........
}
else
{
//find the existing metab glyph
std::map<const CMetab*, CLMetabGlyph*>::const_iterator mmIt;
mmIt = metabMap.find(pMetab);
if (mmIt != metabMap.end())
pMetabGlyph = mmIt->second;
role = CLMetabReferenceGlyph::MODIFIER;
}
if (!pMetabGlyph)
continue;
CLMetabReferenceGlyph* pRefGlyph = new CLMetabReferenceGlyph;
//pResult->setModelObjectKey(modelobjectkey);
pRefGlyph->setMetabGlyphKey(pMetabGlyph->getKey());
pRefGlyph->setRole(role);
pReactionGlyph->addMetabReferenceGlyph(pRefGlyph);
} //modifiers
} //reactions
//rules
size_t i;
for (i = 0; i < pResult->getListOfMetaboliteGlyphs().size(); ++i)
{
const CLMetabGlyph* pMetabGlyph = &pResult->getListOfMetaboliteGlyphs()[i];
const CMetab* pMetab = dynamic_cast<const CMetab*>(pMetabGlyph->getModelObject());
if (!pMetab)
continue;
if (pMetab->getStatus() == CModelEntity::Status::ODE || pMetab->getStatus() == CModelEntity::Status::ASSIGNMENT)
{
CLGeneralGlyph* pGG = new CLGeneralGlyph;
pGG->setDimensions(CLDimensions(10, 10));
pGG->setObjectRole("rule");
pResult->addGeneralGlyph(pGG);
CLReferenceGlyph* pRefGlyph = new CLReferenceGlyph;
pRefGlyph->setDimensions(CLDimensions(10, 10));
pRefGlyph->setTargetGlyphKey(pMetabGlyph->getKey());
pRefGlyph->setRole("rule connection");
pGG->addReferenceGlyph(pRefGlyph);
}
}
//after all other glyphs are created, create the compartment glyphs
double xxx = 0;
std::set<const CCompartment*>::const_iterator compIt;
for (compIt = compartments.begin(); compIt != compartments.end(); ++compIt)
{
double compSize = 10000;
std::map<const CCompartment*, CompartmentInfo>::const_iterator ccIt;
ccIt = compInfo.find(*compIt);
if (ccIt != compInfo.end())
{
//some glyphs are placed inside this compartment glyph
compSize = ccIt->second.mAreaSum * 40;
}
//create the glyph
CLCompartmentGlyph* pCompGlyph = new CLCompartmentGlyph;
pCompGlyph->setModelObjectKey((*compIt)->getKey());
pCompGlyph->setDimensions(CLDimensions(CLDimensions(sqrt(compSize), sqrt(compSize))));
pCompGlyph->setPosition(CLPoint(xxx, 5));
xxx += sqrt(compSize) + 10;
pResult->addCompartmentGlyph(pCompGlyph);
}
//
// double sss = sqrt(compInfo[NULL].mAreaSum * 40);
//
// // determine and set the layout dimensions
// CLBoundingBox box = pResult->calculateBoundingBox();
// if (box.getDimensions().getWidth() < sss)
// box.getDimensions().setWidth(sss);
//
// if (box.getDimensions().getHeight() < sss)
// box.getDimensions().setHeight(sss);
//
// pResult->setDimensions(CLDimensions(box.getDimensions().getWidth() + 30.0, box.getDimensions().getHeight() + 30.0));
// randomize
CCopasiSpringLayout l(pResult, mParams);
l.randomize();
// determine and set the layout dimensions
CLBoundingBox box = pResult->calculateBoundingBox();
pResult->setDimensions(CLDimensions(box.getDimensions().getWidth() + 30.0, box.getDimensions().getHeight() + 30.0));
return pResult;
}