19 #include <sbml/packages/layout/sbml/ReactionGlyph.h>
20 #include <sbml/packages/layout/sbml/SpeciesReferenceGlyph.h>
22 #if LIBSBML_VERSION >= 50800
23 #include <sbml/packages/layout/sbml/GraphicalObject.h>
24 #include <sbml/packages/layout/sbml/Layout.h>
25 #include <sbml/packages/layout/sbml/SpeciesGlyph.h>
26 #include <sbml/packages/layout/sbml/CompartmentGlyph.h>
27 #include <sbml/packages/layout/sbml/GeneralGlyph.h>
28 #include <sbml/packages/layout/sbml/ReferenceGlyph.h>
50 const std::map<std::string, std::string> & modelmap,
51 std::map<std::string, std::string> & layoutmap,
56 #if LIBSBML_VERSION >= 50800
57 const GeneralGlyph* general =
dynamic_cast<const GeneralGlyph *
>(&sbml);
59 if (general && general->isSetCurve())
61 CLCurve copy(*general->getCurve());
65 const ReferenceGlyph* rG =
dynamic_cast<const ReferenceGlyph *
>(&sbml);
67 if (rG && rG->isSetCurve())
73 #endif // LIBSBML_VERSION >= 50800
78 if (
this == &rhs)
return *
this;
117 , mGlyphKey(src.mGlyphKey)
121 #if LIBSBML_VERSION >= 50800
123 const std::map<std::string, std::string> & modelmap,
124 std::map<std::string, std::string> & layoutmap,
131 if (sbml.isSetReferenceId())
133 std::map<std::string, std::string>::const_iterator it = modelmap.find(sbml.getReferenceId());
135 if (it != modelmap.end())
140 if (sbml.isSetGlyphId())
142 std::map<std::string, std::string>::const_iterator it = layoutmap.find(sbml.getGlyphId());
144 if (it != layoutmap.end())
148 if (sbml.isSetRole())
149 mRole = sbml.getRole();
152 #endif // LIBSBML_VERSION >= 50800
156 if (
this == &rhs)
return *
this;
174 const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
175 std::map<std::string, const SBase*>& sbmlIDs,
176 const std::map<const CLBase*, const SBase*> & layoutmap)
const
188 std::map<const CLBase*, const SBase*>::const_iterator it = layoutmap.find(tmp);
190 if (it != layoutmap.end())
196 const GraphicalObject* pGO =
dynamic_cast<const GraphicalObject*
>(it->second);
199 g->setGlyphId(pGO->getId());
217 os <<
" refers to a Glyph that refers to "
230 const std::string CLMetabReferenceGlyph::RoleName[] =
243 const std::string CLMetabReferenceGlyph::XMLRole[] =
266 mMetabGlyphKey(src.mMetabGlyphKey),
271 const std::map<std::string, std::string> & modelmap,
272 std::map<std::string, std::string> & layoutmap,
276 mRole((
Role)sbml.getRole())
279 if (sbml.getSpeciesReferenceId() !=
"")
281 std::map<std::string, std::string>::const_iterator it = modelmap.find(sbml.getSpeciesReferenceId());
283 if (it != modelmap.end())
288 if (sbml.getSpeciesGlyphId() !=
"")
290 std::map<std::string, std::string>::const_iterator it = layoutmap.find(sbml.getSpeciesGlyphId());
292 if (it != layoutmap.end())
299 CLCurve copy(*sbml.getCurve());
306 if (
this == &rhs)
return *
this;
324 const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
325 std::map<std::string, const SBase*>& sbmlIDs,
326 const std::map<const CLBase*, const SBase*> & layoutmap)
const
338 std::map<const CLBase*, const SBase*>::const_iterator it = layoutmap.find(tmp);
340 if (it != layoutmap.end())
346 const GraphicalObject* pGO =
dynamic_cast<const GraphicalObject*
>(it->second);
349 g->setSpeciesGlyphId(pGO->getId());
358 g->setRole((SpeciesReferenceRole_t)
mRole);
366 os <<
" Role: " << CLMetabReferenceGlyph::RoleName[g.
getRole()] <<
"\n";
371 os <<
" refers to a MetabGlyph that refers to "
387 , mvReferences(
"ListOfReferenceGlyphs", this)
388 , mvSubglyphs(
"ListOfSubglyphs", this)
394 , mvReferences(src.mvReferences, this)
395 , mvSubglyphs(
"ListOfSubglyphs", this)
399 for (i = 0; i < imax; ++i)
405 const std::map<std::string, std::string> & modelmap,
406 std::map<std::string, std::string> & layoutmap,
409 , mvReferences(
"ListOfReferenceGlyphs", this)
410 , mvSubglyphs(
"ListOfSubglyphs", this)
412 #if LIBSBML_VERSION >= 50800
414 const GeneralGlyph* general =
dynamic_cast<const GeneralGlyph *
>(&sbml);
420 if (general->isSetReferenceId())
422 std::map<std::string, std::string>::const_iterator it = modelmap.find(general->getReferenceId());
424 if (it != modelmap.end())
427 it = layoutmap.find(general->getReferenceId());
429 if (it != layoutmap.end())
434 C_INT32 i, imax = general->getListOfReferenceGlyphs()->size();
436 for (i = 0; i < imax; ++i)
438 const ReferenceGlyph* tmp
439 =
dynamic_cast<const ReferenceGlyph*
>(general->getListOfReferenceGlyphs()->get(i));
445 imax = general->getListOfSubGlyphs()->size();
447 for (i = 0; i < imax; ++i)
449 const GraphicalObject* graphical = general->getListOfSubGlyphs()->get(i);
450 const TextGlyph* text =
dynamic_cast<const TextGlyph*
>(graphical);
451 const SpeciesGlyph* species =
dynamic_cast<const SpeciesGlyph*
>(graphical);
452 const CompartmentGlyph* comp =
dynamic_cast<const CompartmentGlyph*
>(graphical);
464 #endif // LIBSBML_VERSION >= 50800
469 if (
this == &rhs)
return *
this;
479 for (i = 0; i < imax; ++i)
485 for (i = 0; i < imax; ++i)
509 for (i = 0; i < imax; ++i)
514 for (i = 0; i < imax; ++i)
519 const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
520 std::map<std::string, const SBase*>& sbmlIDs,
521 std::map<const CLBase*, const SBase*> & layoutmap)
const
528 #if LIBSBML_VERSION >= 50800
530 GeneralGlyph *general =
dynamic_cast<GeneralGlyph *
>(g);
532 if (!general)
return;
539 std::map<const CCopasiObject*, SBase*>::const_iterator it = copasimodelmap.find(tmp);
541 if (it != copasimodelmap.end())
544 general->setReferenceId(it->second->getId());
551 std::map<const CLBase*, const SBase*>::const_iterator it2 = layoutmap.find(base);
553 if (it2 != layoutmap.end())
556 general->setReferenceId(it2->second->getId());
567 for (i = 0; i < imax; ++i)
572 std::map<const CCopasiObject*, SBase*>::const_iterator it;
573 it = copasimodelmap.find(tmp);
577 if (it == copasimodelmap.end())
579 pG = general->createReferenceGlyph();
583 pG =
dynamic_cast<ReferenceGlyph*
>(it->second);
586 layoutmap.insert(std::pair<const CLBase*, const SBase*>(tmp, pG));
587 tmp->
exportToSBML(pG, copasimodelmap, sbmlIDs, layoutmap);
592 for (i = 0; i < imax; ++i)
601 std::map<const CCopasiObject*, SBase*>::const_iterator it;
602 it = copasimodelmap.find(tmp);
604 GraphicalObject * pG;
606 if (it == copasimodelmap.end())
609 pG = ((Layout*)g->getParentSBMLObject()->getParentSBMLObject())->createSpeciesGlyph();
611 pG = ((Layout*)g->getParentSBMLObject()->getParentSBMLObject())->createCompartmentGlyph();
613 pG = ((Layout*)g->getParentSBMLObject()->getParentSBMLObject())->createGeneralGlyph();
615 pG = ((Layout*)g->getParentSBMLObject()->getParentSBMLObject())->createTextGlyph();
617 pG = ((Layout*)g->getParentSBMLObject()->getParentSBMLObject())->createAdditionalGraphicalObject();
621 pG =
dynamic_cast<GraphicalObject*
>(it->second);
624 layoutmap.insert(std::pair<const CLBase*, const SBase*>(tmp, pG));
627 metab->
exportToSBML(static_cast<SpeciesGlyph*>(pG), copasimodelmap, sbmlIDs);
629 comp->
exportToSBML(static_cast<CompartmentGlyph*>(pG), copasimodelmap, sbmlIDs);
631 text->
exportToSBML(static_cast<TextGlyph*>(pG), copasimodelmap, sbmlIDs);
633 gg->
exportToSBML(pG, copasimodelmap, sbmlIDs, layoutmap);
638 #endif // LIBSBML_VERSION >= 50800
650 os <<
" List of reference glyphs: \n";
652 for (i = 0; i < imax; ++i)
660 os <<
" List of reference glyphs: \n";
662 for (i = 0; i < imax; ++i)
677 mvMetabReferences(
"ListOfMetabReferenceGlyphs", this)
683 mvMetabReferences(src.mvMetabReferences, this)
689 const std::map<std::string, std::string> & modelmap,
690 std::map<std::string, std::string> & layoutmap,
693 mvMetabReferences(
"ListOfMetabReferenceGlyphs", this)
696 if (sbml.getReactionId() !=
"")
698 std::map<std::string, std::string>::const_iterator it = modelmap.find(sbml.getReactionId());
700 if (it != modelmap.end())
705 C_INT32 i, imax = sbml.getListOfSpeciesReferenceGlyphs()->size();
707 for (i = 0; i < imax; ++i)
709 const SpeciesReferenceGlyph* tmp
710 =
dynamic_cast<const SpeciesReferenceGlyph*
>(sbml.getListOfSpeciesReferenceGlyphs()->get(i));
719 CLCurve copy(*sbml.getCurve());
726 if (
this == &rhs)
return *
this;
733 for (i = 0; i < imax; ++i)
765 for (i = 0; i < imax; ++i)
770 const std::map<const CCopasiObject*, SBase*> & copasimodelmap,
771 std::map<std::string, const SBase*>& sbmlIDs,
772 std::map<const CLBase*, const SBase*> & layoutmap)
const
784 std::map<const CCopasiObject*, SBase*>::const_iterator it = copasimodelmap.find(tmp);
786 if (it != copasimodelmap.end())
789 g->setReactionId(it->second->getId());
799 for (i = 0; i < imax; ++i)
804 std::map<const CCopasiObject*, SBase*>::const_iterator it;
805 it = copasimodelmap.find(tmp);
807 SpeciesReferenceGlyph * pG;
809 if (it == copasimodelmap.end())
811 pG =
new SpeciesReferenceGlyph;
812 g->getListOfSpeciesReferenceGlyphs()->appendAndOwn(pG);
816 pG =
dynamic_cast<SpeciesReferenceGlyph*
>(it->second);
819 layoutmap.insert(std::pair<const CLBase*, const SBase*>(tmp, pG));
820 tmp->
exportToSBML(pG, copasimodelmap, sbmlIDs, layoutmap);
833 os <<
" List of metab reference glyphs: \n";
835 for (i = 0; i < imax; ++i)
std::string getModelObjectDisplayName(bool regular=true, bool richtext=false) const
void print(std::ostream *ostream) const
CLGlyphWithCurve & operator=(const CLGlyphWithCurve &rhs)
virtual void exportToSBML(ReactionGlyph *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs, std::map< const CLBase *, const SBase * > &layoutmap) const
virtual void moveBy(const CLPoint &p)
std::ostream & operator<<(std::ostream &os, const CLGlyphWithCurve &g)
void addReferenceGlyph(CLReferenceGlyph *glyph)
void exportToSBML(Curve *c, const std::map< const CCopasiObject *, SBase * > &copasimodelmap) const
virtual size_t size() const
CLReactionGlyph(const std::string &name="ReactionGlyph", const CCopasiContainer *pParent=NULL)
CLGeneralGlyph & operator=(const CLGeneralGlyph &rhs)
CCopasiObject * get(const std::string &key)
void addSubglyph(CLGraphicalObject *glyph)
void addMetabReferenceGlyph(CLMetabReferenceGlyph *glyph)
void print(std::ostream *ostream) const
CLGraphicalObject * getTargetGlyph() const
virtual void exportToSBML(CompartmentGlyph *cg, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
virtual void moveBy(const CLPoint &p)
void setModelObjectKey(const std::string &k)
CLGlyphWithCurve(const std::string &name="ReferenceGlyph", const CCopasiContainer *pParent=NULL)
virtual bool add(const CType &src)
virtual void exportToSBML(GraphicalObject *sbmlobject, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
CCopasiVector< CLReferenceGlyph > mvReferences
CLReferenceGlyph(const std::string &name="ReferenceGlyph", const CCopasiContainer *pParent=NULL)
CCopasiVector< CLGraphicalObject > mvSubglyphs
CLGraphicalObject & operator=(const CLGraphicalObject &rhs)
CCopasiObject * getModelObject() const
static CKeyFactory * getKeyFactory()
virtual void moveBy(const CLPoint &p)
void print(std::ostream *ostream) const
virtual void moveBy(const CLPoint &p)
virtual void exportToSBML(TextGlyph *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
CCopasiVector< CLMetabReferenceGlyph > mvMetabReferences
virtual void exportToSBML(GraphicalObject *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs, std::map< const CLBase *, const SBase * > &layoutmap) const
void print(std::ostream *ostream) const
virtual void moveBy(const CLPoint &p)
CLReactionGlyph & operator=(const CLReactionGlyph &rhs)
CLReferenceGlyph & operator=(const CLReferenceGlyph &rhs)
CLGeneralGlyph(const std::string &name="GeneralGlyph", const CCopasiContainer *pParent=NULL)