COPASI API
4.16.103
|
#include <CCopasiSpringLayout.h>
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 () |
CLCompartmentGlyph * | findCompartmentForReactionNode (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) |
![]() | |
CAbstractLayoutInterface () | |
virtual const std::vector < double > & | getMassVector () const |
unsigned int | getNumVariables () const |
const std::vector < VariableDescription > & | getVariablesDescription () const |
virtual | ~CAbstractLayoutInterface () |
Static Public Member Functions | |
static CLayout * | createLayout (CCopasiContainer *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< CoordinateRelation > | mFixedRelations |
a list of fixed positon relations between objects. Should be constructed in initFromLayout() More... | |
std::vector< double > | mInitialState |
CLayout * | mpLayout |
Parameters * | mpPar |
std::vector< UpdateAction > | mUpdateActions |
this is the list of all update actions that have to be performed during setState(); More... | |
![]() | |
std::vector< double > | mMassVector |
std::vector< VariableDescription > | mVarDescription |
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.
Definition at line 34 of file CCopasiSpringLayout.h.
CCopasiSpringLayout::CCopasiSpringLayout | ( | CLayout * | layout, |
Parameters * | ppp = NULL |
||
) |
generate a spring layout view of a COPASI layout.
Definition at line 72 of file CCopasiSpringLayout.cpp.
References initFromLayout().
|
protected |
create variables for size and position of a compartment glyph
Definition at line 217 of file CCopasiSpringLayout.cpp.
References CCopasiSpringLayout::UpdateAction::COMPARTMENT_4V, CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), CLGraphicalObject::getY(), CAbstractLayoutInterface::VariableDescription::isAngle, mInitialState, CAbstractLayoutInterface::mMassVector, mUpdateActions, and CAbstractLayoutInterface::mVarDescription.
|
protected |
create variables for the position of a species glyph
Definition at line 250 of file CCopasiSpringLayout.cpp.
References CLGraphicalObject::getX(), CLGraphicalObject::getY(), CAbstractLayoutInterface::VariableDescription::isAngle, mInitialState, CAbstractLayoutInterface::mMassVector, mUpdateActions, CAbstractLayoutInterface::mVarDescription, and CCopasiSpringLayout::UpdateAction::POSITION_2V.
Referenced by createVariables().
|
protected |
create variables for the position of a reaction glyph
Definition at line 275 of file CCopasiSpringLayout.cpp.
References C_FLOAT64, CLGlyphWithCurve::getCurve(), CLCurve::getCurveSegments(), CLGraphicalObject::getHeight(), CLCurve::getNumCurveSegments(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), CLGraphicalObject::getY(), CAbstractLayoutInterface::VariableDescription::isAngle, mInitialState, CAbstractLayoutInterface::mMassVector, mUpdateActions, CAbstractLayoutInterface::mVarDescription, and CCopasiSpringLayout::UpdateAction::REACTION_2V.
Referenced by createVariables().
|
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.
Definition at line 519 of file CCopasiSpringLayout.cpp.
References CLGraphicalObject::getBoundingBox(), CLBoundingBox::getCenter(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLPoint::getX(), and CLPoint::getY().
Referenced by finalizeState().
|
inlinestaticprotected |
Definition at line 190 of file CCopasiSpringLayout.h.
References max.
Referenced by potReactionReaction(), potSpeciesReaction(), and potSpeciesSpecies().
|
static |
This method creates a random layout using the elements in the compartments, reactions, species and side species containers.
Definition at line 991 of file CCopasiSpringLayout.cpp.
References CLayout::addCompartmentGlyph(), CLayout::addGeneralGlyph(), CLayout::addMetaboliteGlyph(), CLReactionGlyph::addMetabReferenceGlyph(), CLayout::addReactionGlyph(), CLGeneralGlyph::addReferenceGlyph(), CLayout::addTextGlyph(), CModelEntity::ASSIGNMENT, CCopasiVector< T >::begin(), CLayout::calculateBoundingBox(), CCopasiVector< T >::end(), CMetab::getCompartment(), CLBoundingBox::getDimensions(), CLDimensions::getHeight(), CLGraphicalObject::getKey(), CModelEntity::getKey(), CLayout::getListOfMetaboliteGlyphs(), CLGraphicalObject::getModelObject(), CModelEntity::getStatus(), CLDimensions::getWidth(), CLMetabReferenceGlyph::MODIFIER, CModelEntity::ODE, pResult, CLMetabReferenceGlyph::PRODUCT, randomize(), CLayout::setDimensions(), CLGraphicalObject::setDimensions(), CLTextGlyph::setGraphicalObjectKey(), CLMetabReferenceGlyph::setMetabGlyphKey(), CLGraphicalObject::setModelObjectKey(), CLGraphicalObject::setObjectRole(), CLGraphicalObject::setPosition(), CLReferenceGlyph::setRole(), CLMetabReferenceGlyph::setRole(), CLReferenceGlyph::setTargetGlyphKey(), CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, CCopasiVector< T >::size(), and CLMetabReferenceGlyph::SUBSTRATE.
Referenced by CQLayoutsWidget::slotBtnNewClicked().
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
Definition at line 184 of file CCopasiSpringLayout.cpp.
References addPositionVariables(), addReactionVariables(), CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), mInitialState, CAbstractLayoutInterface::mMassVector, mpLayout, CAbstractLayoutInterface::mVarDescription, and CCopasiVector< T >::size().
Referenced by CQLayoutThread::run().
|
inlinestaticprotected |
Definition at line 183 of file CCopasiSpringLayout.h.
Referenced by potEdge(), potGeneralEdge(), and potSecondOrderEdge().
void CCopasiSpringLayout::finalizeState | ( | ) |
complete the update of the layout. This updates the things that are not needed for the calculation of the potential. After calling this method the layout should be ready for drawing or storing
Definition at line 358 of file CCopasiSpringLayout.cpp.
References CLCurve::addCurveSegment(), borderProjection(), CLayout::calculateAndAssignBounds(), CLCurve::clear(), CLPoint::dot(), CLGraphicalObject::getBoundingBox(), CLBoundingBox::getCenter(), CLGlyphWithCurve::getCurve(), CLayout::getListOfGeneralGlyphs(), CLReactionGlyph::getListOfMetabReferenceGlyphs(), CLayout::getListOfReactionGlyphs(), CLGeneralGlyph::getListOfReferenceGlyphs(), CLMetabReferenceGlyph::getMetabGlyph(), CLCurve::getNumCurveSegments(), CLGraphicalObject::getPosition(), CLMetabReferenceGlyph::getRole(), CLReferenceGlyph::getTargetGlyph(), CLPoint::getX(), CLPoint::getY(), mFixedRelations, mpLayout, CLMetabReferenceGlyph::PRODUCT, CLPoint::scale(), CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, CCopasiVector< T >::size(), and CLMetabReferenceGlyph::SUBSTRATE.
Referenced by CQLayoutThread::finalize(), randomize(), and CQLayoutScene::updatePosition().
CLCompartmentGlyph * CCopasiSpringLayout::findCompartmentForReactionNode | ( | CLReactionGlyph & | r | ) |
if all participants of a reaction are in a single compartment return the compartment glyph, otherwise return NULL
Definition at line 145 of file CCopasiSpringLayout.cpp.
References CLReactionGlyph::getListOfMetabReferenceGlyphs(), mCompartmentMap, and CCopasiVector< T >::size().
Referenced by initFromLayout().
|
virtual |
Implements CAbstractLayoutInterface.
Definition at line 859 of file CCopasiSpringLayout.cpp.
References mInitialState.
|
virtual |
Implements CAbstractLayoutInterface.
Definition at line 707 of file CCopasiSpringLayout.cpp.
References CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLReactionGlyph::getListOfMetabReferenceGlyphs(), CLayout::getListOfReactionGlyphs(), CLGeneralGlyph::getListOfReferenceGlyphs(), mCompartmentMap, mpLayout, mpPar, potEdge(), potGeneralEdge(), potReactionCompartment(), potReactionReaction(), potSecondOrderEdge(), potSpeciesCompartment(), potSpeciesReaction(), potSpeciesSpecies(), CLMetabReferenceGlyph::PRODUCT, CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, CCopasiVector< T >::size(), CLMetabReferenceGlyph::SUBSTRATE, and CCopasiSpringLayout::Parameters::values.
|
virtual |
Definition at line 864 of file CCopasiSpringLayout.cpp.
References mUpdateActions.
|
protected |
performs all initializations that are later needed to calculate the potential
Definition at line 84 of file CCopasiSpringLayout.cpp.
References CCopasiSpringLayout::CoordinateRelation::diff, findCompartmentForReactionNode(), CMetab::getCompartment(), CModelEntity::getKey(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), CLayout::getListOfTextGlyphs(), CLGraphicalObject::getPosition(), mCompartmentMap, mFixedRelations, mpLayout, mpPar, CCopasiVector< T >::size(), CCopasiSpringLayout::CoordinateRelation::source, and CCopasiSpringLayout::CoordinateRelation::target.
Referenced by CCopasiSpringLayout().
|
protected |
Definition at line 573 of file CCopasiSpringLayout.cpp.
References distance(), CLGraphicalObject::getHeight(), CLMetabReferenceGlyph::getMetabGlyph(), CLMetabReferenceGlyph::getRole(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), CLGraphicalObject::getY(), CLMetabReferenceGlyph::MODIFIER, mpPar, CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, and CCopasiSpringLayout::Parameters::values.
Referenced by getPotential().
|
protected |
Definition at line 600 of file CCopasiSpringLayout.cpp.
References distance(), CLGraphicalObject::getHeight(), CLReferenceGlyph::getTargetGlyph(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
s.charge
Definition at line 676 of file CCopasiSpringLayout.cpp.
References CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
Definition at line 563 of file CCopasiSpringLayout.cpp.
References bound_distance(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
Definition at line 590 of file CCopasiSpringLayout.cpp.
References distance(), CLGraphicalObject::getHeight(), CLMetabReferenceGlyph::getMetabGlyph(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
s.charge
Definition at line 660 of file CCopasiSpringLayout.cpp.
References CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
Definition at line 553 of file CCopasiSpringLayout.cpp.
References bound_distance(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
Definition at line 542 of file CCopasiSpringLayout.cpp.
References bound_distance(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
void CCopasiSpringLayout::randomize | ( | ) |
Randomizes the layout
This function produces a random layout. It first shufles around metab glyphs and reaction centers, and finally corrects all ars
Definition at line 905 of file CCopasiSpringLayout.cpp.
References CRandom::createGenerator(), finalizeState(), CMetab::getCompartment(), CLayout::getDimensions(), CModelEntity::getKey(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLReactionGlyph::getListOfMetabReferenceGlyphs(), CLayout::getListOfReactionGlyphs(), CLGraphicalObject::getModelObject(), CRandom::getRandomCC(), CRandom::getSystemSeed(), mpLayout, CRandom::mt19937, placeTextGlyphs(), randomlyPlaceGlyphInCompartmentGlyph(), randomlyPlaceGlyphInDimensions(), CLGraphicalObject::setPosition(), and CCopasiVector< T >::size().
Referenced by createLayout(), and CQLayoutThread::randomizeLayout().
|
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.
Definition at line 315 of file CCopasiSpringLayout.cpp.
References CCopasiSpringLayout::UpdateAction::COMPARTMENT_4V, mUpdateActions, CAbstractLayoutInterface::mVarDescription, CCopasiSpringLayout::UpdateAction::POSITION_2V, and CCopasiSpringLayout::UpdateAction::REACTION_2V.
|
protected |
this map contains information about the compartment glyph a given glyph is located in
Definition at line 261 of file CCopasiSpringLayout.h.
Referenced by findCompartmentForReactionNode(), getPotential(), and initFromLayout().
|
protected |
a list of fixed positon relations between objects. Should be constructed in initFromLayout()
Definition at line 275 of file CCopasiSpringLayout.h.
Referenced by finalizeState(), and initFromLayout().
|
protected |
Definition at line 226 of file CCopasiSpringLayout.h.
Referenced by addCompartmentVariables(), addPositionVariables(), addReactionVariables(), createVariables(), and getInitialValues().
|
protected |
Definition at line 222 of file CCopasiSpringLayout.h.
Referenced by createVariables(), finalizeState(), getPotential(), initFromLayout(), and randomize().
|
protected |
Definition at line 224 of file CCopasiSpringLayout.h.
Referenced by getPotential(), initFromLayout(), and potEdge().
|
protected |
this is the list of all update actions that have to be performed during setState();
Definition at line 258 of file CCopasiSpringLayout.h.
Referenced by addCompartmentVariables(), addPositionVariables(), addReactionVariables(), getUpdateActions(), and setState().