COPASI API  4.16.103
Functions
CQLayoutScene.cpp File Reference
#include <QtCore/QCoreApplication>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsItem>
#include <QtGui/QPainter>
#include <QtGui/QPrinter>
#include <QtGui/QImage>
#include <QtGui/QGraphicsEffect>
#include "copasi.h"
#include "qlayout/CQLayoutScene.h"
#include "qlayout/CQCopasiEffect.h"
#include "qlayout/CQLabelGraphicsItem.h"
#include "qlayout/CQStyledGraphicsItem.h"
#include "qlayout/CQConnectionGraphicsItem.h"
#include "qlayout/CQRenderConverter.h"
#include "layout/CLayout.h"
#include "layout/CLGlyphs.h"
#include "layout/CLText.h"
#include "layout/CLReactionGlyph.h"
#include "layout/CLRenderResolver.h"
#include "layout/CLGlobalRenderInformation.h"
#include "layout/CListOfLayouts.h"
#include "layout/CLLocalRenderInformation.h"
#include "layout/CLDefaultStyles.h"
#include "layout/CCopasiSpringLayout.h"
#include "CopasiDataModel/CCopasiDataModel.h"
#include "copasi/report/CCopasiRootContainer.h"
#include "copasi/report/CKeyFactory.h"
#include <model/CCompartment.h>
#include <model/CMetab.h>
Include dependency graph for CQLayoutScene.cpp:

Go to the source code of this file.

Functions

CLGraphicalObjectgetMetabGlyphForKey (const CLayout *layout, const CMetab *metab)
 
CLGraphicalObjectgetTextForItem (const CLayout *layout, const CLGraphicalObject *obj)
 
void moveObject (CLGraphicalObject *obj, const CLPoint &delta, CLayout *layout)
 

Function Documentation

CLGraphicalObject* getMetabGlyphForKey ( const CLayout layout,
const CMetab metab 
)

Definition at line 285 of file CQLayoutScene.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CModelEntity::getKey(), and CLayout::getListOfMetaboliteGlyphs().

Referenced by moveObject().

286 {
287  const CCopasiVector<CLMetabGlyph> & metabs = layout->getListOfMetaboliteGlyphs();
289 
290  while (it != metabs.end())
291  {
292  if ((*it)->getModelObjectKey() == metab->getKey())
293  return *it;
294 
295  ++it;
296  }
297 
298  return NULL;
299 }
iterator begin()
iterator end()
virtual const std::string & getKey() const
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
Definition: CLayout.h:94
CLGraphicalObject* getTextForItem ( const CLayout layout,
const CLGraphicalObject obj 
)

Definition at line 266 of file CQLayoutScene.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CLGraphicalObject::getKey(), and CLayout::getListOfTextGlyphs().

Referenced by moveObject().

267 {
268  const CCopasiVector<CLTextGlyph> & texts = layout->getListOfTextGlyphs();
270 
271  while (it != texts.end())
272  {
273  if ((*it)->getGraphicalObjectKey() == obj->getKey())
274  return *it;
275 
276  ++it;
277  }
278 
279  return NULL;
280 }
const CCopasiVector< CLTextGlyph > & getListOfTextGlyphs() const
Definition: CLayout.h:120
iterator begin()
virtual const std::string & getKey() const
iterator end()
void moveObject ( CLGraphicalObject obj,
const CLPoint delta,
CLayout layout 
)

Definition at line 301 of file CQLayoutScene.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), getMetabGlyphForKey(), CCompartment::getMetabolites(), CLGraphicalObject::getModelObject(), getTextForItem(), and CLGraphicalObject::moveBy().

Referenced by CQLayoutScene::updatePosition().

302 {
303  if (obj == NULL) return;
304 
305  // move object
306  obj->moveBy(delta);
307 
308  // move its label
309  CLGraphicalObject* text = getTextForItem(layout, obj);
310 
311  if (text != NULL)
312  text->moveBy(delta);
313 
314  // move species within compartments as well
315  CLCompartmentGlyph* lcomp = dynamic_cast<CLCompartmentGlyph*>(obj);
316 
317  if (lcomp == NULL)
318  return;
319 
320  CCompartment* comp = dynamic_cast<CCompartment*>(lcomp ->getModelObject());
321 
322  if (comp == NULL)
323  return;
324 
325  CCopasiVectorNS < CMetab > & metabs = comp->getMetabolites();
327 
328  while (it != metabs.end())
329  {
330  moveObject(getMetabGlyphForKey(layout, (*it)), delta, layout);
331  ++it;
332  }
333 }
CCopasiVectorNS< CMetab > & getMetabolites()
iterator begin()
CLGraphicalObject * getMetabGlyphForKey(const CLayout *layout, const CMetab *metab)
iterator end()
CLGraphicalObject * getTextForItem(const CLayout *layout, const CLGraphicalObject *obj)
CCopasiObject * getModelObject() const
virtual void moveBy(const CLPoint &p)
void moveObject(CLGraphicalObject *obj, const CLPoint &delta, CLayout *layout)