COPASI API  4.40.278
CCopasiSpringLayout Class Reference

#include <CCopasiSpringLayout.h>

Inheritance diagram for CCopasiSpringLayout:
[legend]

Classes

struct  CoordinateRelation
 
class  Parameters
 
struct  UpdateAction
 this describes one update action that has to be performed during setState() More...
 

Public Member Functions

 CCopasiSpringLayout (CLayout *layout, Parameters *ppp=NULL)
 
bool createVariables ()
 
void finalizeState ()
 
CLCompartmentGlyphfindCompartmentForReactionNode (CLReactionGlyph &r)
 
virtual const std::vector< double > & getInitialValues () const
 
virtual double getPotential ()
 
virtual const std::vector< UpdateAction > & getUpdateActions () const
 
void randomize ()
 
virtual bool setState (const std::vector< double > &vars)
 
void updateFixedRelations ()
 
- Public Member Functions inherited from CAbstractLayoutInterface
 CAbstractLayoutInterface ()
 
virtual const std::vector< double > & getMassVector () const
 
std::vector< double >::size_type getNumVariables () const
 
const std::vector< VariableDescription > & getVariablesDescription () const
 
virtual ~CAbstractLayoutInterface ()
 

Static Public Member Functions

static CLayoutcreateLayout (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=NULL)
 

Protected Member Functions

void addCompartmentVariables (CLCompartmentGlyph *cg)
 create variables for size and position of a compartment glyph More...
 
void addPositionVariables (CLGraphicalObject *pGO)
 create variables for the position of a species glyph More...
 
void addReactionVariables (CLReactionGlyph *rg)
 create variables for the position of a reaction glyph More...
 
CLPoint borderProjection (CLGraphicalObject *go, const CLPoint &p, double d)
 
bool initFromLayout (CLayout *layout, Parameters *ppp)
 performs all initializations that are later needed to calculate the potential More...
 
double potEdge (const CLMetabReferenceGlyph &e, const CLReactionGlyph &r) const
 
double potGeneralEdge (const CLReferenceGlyph &e, const CLGeneralGlyph &r) const
 
double potReactionCompartment (const CLReactionGlyph &r, const CLCompartmentGlyph &c) const
 
double potReactionReaction (const CLReactionGlyph &a, const CLReactionGlyph &b) const
 
double potSecondOrderEdge (const CLMetabReferenceGlyph &e1, const CLMetabReferenceGlyph &e2, double &dist) const
 
double potSpeciesCompartment (const CLMetabGlyph &s, const CLCompartmentGlyph &c) const
 
double potSpeciesReaction (const CLMetabGlyph &a, const CLReactionGlyph &b) const
 
double potSpeciesSpecies (const CLMetabGlyph &a, const CLMetabGlyph &b) const
 

Static Protected Member Functions

static double bound_distance (const double &x1, const double &y1, const double &x2, const double &y2, const double &max)
 
static double distance (const double &x1, const double &y1, const double &x2, const double &y2)
 

Protected Attributes

std::map< CLBase *, CLCompartmentGlyph * > mCompartmentMap
 this map contains information about the compartment glyph a given glyph is located in More...
 
std::vector< CoordinateRelationmFixedRelations
 a list of fixed positon relations between objects. Should be constructed in initFromLayout() More...
 
std::vector< double > mInitialState
 
CLayoutmpLayout
 
ParametersmpPar
 
std::vector< UpdateActionmUpdateActions
 this is the list of all update actions that have to be performed during setState(); More...
 
- Protected Attributes inherited from CAbstractLayoutInterface
std::vector< double > mMassVector
 
std::vector< VariableDescriptionmVarDescription
 

Detailed Description

This class defines how a layout optimization algorithm will see a COPASI layout, using a spring approach. No copy of the layout will be generated, meaning that setState() will change the layout.

Constructor & Destructor Documentation

◆ CCopasiSpringLayout()

CCopasiSpringLayout::CCopasiSpringLayout ( CLayout layout,
Parameters ppp = NULL 
)

generate a spring layout view of a COPASI layout.

References initFromLayout().

Member Function Documentation

◆ addCompartmentVariables()

◆ addPositionVariables()

◆ addReactionVariables()

◆ borderProjection()

CLPoint CCopasiSpringLayout::borderProjection ( CLGraphicalObject go,
const CLPoint p,
double  d 
)
protected

calculate a point just outside the bounding box of a given graphical object on the line between the center of the object and the point p. d specifies the distance from the border of the object.

References CLGraphicalObject::getBoundingBox(), CLBoundingBox::getCenter(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLPoint::getX(), and CLPoint::getY().

Referenced by finalizeState().

◆ bound_distance()

static double CCopasiSpringLayout::bound_distance ( const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2,
const double &  max 
)
inlinestaticprotected

◆ 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 = NULL 
)
static

◆ createVariables()

bool CCopasiSpringLayout::createVariables ( )

generates the list of variables from the layout. This method will generate variables for the coordinates of all the nodes in the layout. TODO: make it possible to only auto-layout a subset of the graph

References addPositionVariables(), addReactionVariables(), CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), mInitialState, CAbstractLayoutInterface::mMassVector, mpLayout, and CAbstractLayoutInterface::mVarDescription.

◆ distance()

static double CCopasiSpringLayout::distance ( const double &  x1,
const double &  y1,
const double &  x2,
const double &  y2 
)
inlinestaticprotected

◆ finalizeState()

◆ findCompartmentForReactionNode()

CLCompartmentGlyph * CCopasiSpringLayout::findCompartmentForReactionNode ( CLReactionGlyph r)

if all participants of a reaction are in a single compartment return the compartment glyph, otherwise return NULL

References CLReactionGlyph::getListOfMetabReferenceGlyphs(), and mCompartmentMap.

Referenced by initFromLayout().

◆ getInitialValues()

const std::vector< double > & CCopasiSpringLayout::getInitialValues ( ) const
virtual

Implements CAbstractLayoutInterface.

References mInitialState.

◆ getPotential()

◆ getUpdateActions()

const std::vector< CCopasiSpringLayout::UpdateAction > & CCopasiSpringLayout::getUpdateActions ( ) const
virtual

References mUpdateActions.

◆ initFromLayout()

◆ potEdge()

◆ potGeneralEdge()

double CCopasiSpringLayout::potGeneralEdge ( const CLReferenceGlyph e,
const CLGeneralGlyph r 
) const
protected

◆ potReactionCompartment()

double CCopasiSpringLayout::potReactionCompartment ( const CLReactionGlyph r,
const CLCompartmentGlyph c 
) const
protected

◆ potReactionReaction()

double CCopasiSpringLayout::potReactionReaction ( const CLReactionGlyph a,
const CLReactionGlyph b 
) const
protected

◆ potSecondOrderEdge()

double CCopasiSpringLayout::potSecondOrderEdge ( const CLMetabReferenceGlyph e1,
const CLMetabReferenceGlyph e2,
double &  dist 
) const
protected

◆ potSpeciesCompartment()

double CCopasiSpringLayout::potSpeciesCompartment ( const CLMetabGlyph s,
const CLCompartmentGlyph c 
) const
protected

◆ potSpeciesReaction()

double CCopasiSpringLayout::potSpeciesReaction ( const CLMetabGlyph a,
const CLReactionGlyph b 
) const
protected

◆ potSpeciesSpecies()

double CCopasiSpringLayout::potSpeciesSpecies ( const CLMetabGlyph a,
const CLMetabGlyph b 
) const
protected

◆ randomize()

◆ setState()

bool CCopasiSpringLayout::setState ( const std::vector< double > &  vars)
virtual

updates the COPASI layout from the state vector. Only the updates that are needed for the calculation of the potential (or for a rough on the fly drawing) are done.

Implements CAbstractLayoutInterface.

References CCopasiSpringLayout::UpdateAction::COMPARTMENT_4V, mUpdateActions, CAbstractLayoutInterface::mVarDescription, CCopasiSpringLayout::UpdateAction::POSITION_2V, and CCopasiSpringLayout::UpdateAction::REACTION_2V.

◆ updateFixedRelations()

void CCopasiSpringLayout::updateFixedRelations ( )

References mFixedRelations.

Referenced by finalizeState().

Member Data Documentation

◆ mCompartmentMap

std::map<CLBase*, CLCompartmentGlyph*> CCopasiSpringLayout::mCompartmentMap
protected

this map contains information about the compartment glyph a given glyph is located in

Referenced by findCompartmentForReactionNode(), getPotential(), and initFromLayout().

◆ mFixedRelations

std::vector<CoordinateRelation> CCopasiSpringLayout::mFixedRelations
protected

a list of fixed positon relations between objects. Should be constructed in initFromLayout()

Referenced by initFromLayout(), and updateFixedRelations().

◆ mInitialState

std::vector<double> CCopasiSpringLayout::mInitialState
protected

◆ mpLayout

CLayout* CCopasiSpringLayout::mpLayout
protected

◆ mpPar

Parameters* CCopasiSpringLayout::mpPar
protected

◆ mUpdateActions

std::vector<UpdateAction> CCopasiSpringLayout::mUpdateActions
protected

this is the list of all update actions that have to be performed during setState();

Referenced by addCompartmentVariables(), addPositionVariables(), addReactionVariables(), getUpdateActions(), and setState().


The documentation for this class was generated from the following files: