COPASI API  4.16.103
Classes | Functions
CCopasiSpringLayout.cpp File Reference
#include <iostream>
#include <map>
#include <layout/CCopasiSpringLayout.h>
#include <layout/CLGlyphs.h>
#include <layout/CLReactionGlyph.h>
#include <layout/CLayout.h>
#include <model/CCompartment.h>
#include <model/CReaction.h>
#include <model/CMetab.h>
#include <randomGenerator/CRandom.h>
Include dependency graph for CCopasiSpringLayout.cpp:

Go to the source code of this file.

Classes

class  CompartmentInfo
 

Functions

void placeTextGlyphs (CLayout *pLayout)
 
void randomlyPlaceGlyphInCompartmentGlyph (CLGraphicalObject *pGl, const CLGraphicalObject *pContainer, CRandom *pRandom)
 
void randomlyPlaceGlyphInDimensions (CLGraphicalObject *pGl, const CLDimensions *pContainer, CRandom *pRandom)
 

Function Documentation

void placeTextGlyphs ( CLayout pLayout)

Definition at line 885 of file CCopasiSpringLayout.cpp.

References CLTextGlyph::getGraphicalObject(), CLayout::getListOfTextGlyphs(), CLGraphicalObject::getX(), CLGraphicalObject::getY(), CLGraphicalObject::setPosition(), and CCopasiVector< T >::size().

Referenced by CCopasiSpringLayout::randomize().

886 {
887  size_t i;
888 
889  for (i = 0; i < pLayout->getListOfTextGlyphs().size(); ++i)
890  {
891  CLTextGlyph* pTG = pLayout->getListOfTextGlyphs()[i];
893 
894  if (!pGO)
895  continue;
896 
897  pTG->setPosition(CLPoint(pGO->getX() + 2, pGO->getY() + 2));
898  }
899 }
const CCopasiVector< CLTextGlyph > & getListOfTextGlyphs() const
Definition: CLayout.h:120
virtual size_t size() const
const C_FLOAT64 & getX() const
Definition: CLBase.h:54
void setPosition(const CLPoint &p)
CLGraphicalObject * getGraphicalObject() const
Definition: CLGlyphs.cpp:262
const C_FLOAT64 & getY() const
void randomlyPlaceGlyphInCompartmentGlyph ( CLGraphicalObject pGl,
const CLGraphicalObject pContainer,
CRandom pRandom 
)

Definition at line 869 of file CCopasiSpringLayout.cpp.

References CLGraphicalObject::getDimensions(), CLDimensions::getHeight(), CLGraphicalObject::getPosition(), CRandom::getRandomCC(), CLDimensions::getWidth(), CLPoint::getX(), CLPoint::getY(), and CLGraphicalObject::setPosition().

Referenced by CCopasiSpringLayout::randomize().

870 {
871  double x = pContainer->getPosition().getX()
872  + pRandom->getRandomCC() * (pContainer->getDimensions().getWidth() - pGl->getDimensions().getWidth());
873  double y = pContainer->getPosition().getY()
874  + pRandom->getRandomCC() * (pContainer->getDimensions().getHeight() - pGl->getDimensions().getHeight());
875  pGl->setPosition(CLPoint(x, y));
876 }
const C_FLOAT64 & getWidth() const
Definition: CLBase.h:211
const CLPoint & getPosition() const
virtual C_FLOAT64 getRandomCC()
Definition: CRandom.cpp:235
const C_FLOAT64 & getX() const
Definition: CLBase.h:83
Definition: CLBase.h:54
void setPosition(const CLPoint &p)
const C_FLOAT64 & getY() const
Definition: CLBase.h:84
const C_FLOAT64 & getHeight() const
Definition: CLBase.h:212
const CLDimensions & getDimensions() const
void randomlyPlaceGlyphInDimensions ( CLGraphicalObject pGl,
const CLDimensions pContainer,
CRandom pRandom 
)

Definition at line 878 of file CCopasiSpringLayout.cpp.

References CLGraphicalObject::getDimensions(), CLDimensions::getHeight(), CRandom::getRandomCC(), CLDimensions::getWidth(), and CLGraphicalObject::setPosition().

Referenced by CCopasiSpringLayout::randomize().

879 {
880  double x = pRandom->getRandomCC() * (pContainer->getWidth() - pGl->getDimensions().getWidth());
881  double y = pRandom->getRandomCC() * (pContainer->getHeight() - pGl->getDimensions().getHeight());
882  pGl->setPosition(CLPoint(x, y));
883 }
const C_FLOAT64 & getWidth() const
Definition: CLBase.h:211
virtual C_FLOAT64 getRandomCC()
Definition: CRandom.cpp:235
Definition: CLBase.h:54
void setPosition(const CLPoint &p)
const C_FLOAT64 & getHeight() const
Definition: CLBase.h:212
const CLDimensions & getDimensions() const