COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
COutputHandlerPlot Class Reference

#include <COutputHandlerPlot.h>

Inheritance diagram for COutputHandlerPlot:
Inheritance graph
[legend]
Collaboration diagram for COutputHandlerPlot:
Collaboration graph
[legend]

Public Member Functions

virtual bool compile (std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel *pDataModel)
 
 COutputHandlerPlot ()
 
 COutputHandlerPlot (const COutputHandlerPlot &src)
 
virtual void removeInterface (COutputInterface *pInterface)
 
void setOutputDefinitionVector (COutputDefinitionVector *pDefinitionVector)
 
virtual ~COutputHandlerPlot ()
 
- Public Member Functions inherited from COutputHandler
virtual void addInterface (COutputInterface *pInterface)
 
 COutputHandler ()
 
 COutputHandler (const COutputHandler &src)
 
virtual void finish ()
 
std::set< COutputInterface * > getInterfaces () const
 
bool isMaster () const
 
virtual void output (const Activity &activity)
 
virtual void separate (const Activity &activity)
 
void setMaster (COutputHandler *pMaster)
 
virtual ~COutputHandler ()
 
- Public Member Functions inherited from COutputInterface
virtual void close ()
 
 COutputInterface ()
 
 COutputInterface (const COutputInterface &src)
 
virtual const std::set< const
CCopasiObject * > & 
getObjects () const
 
virtual ~COutputInterface ()
 

Private Attributes

COutputDefinitionVectormpDefinitionVector
 
std::map< std::string,
PlotWindow * > 
mPlotMap
 

Additional Inherited Members

- Public Types inherited from COutputInterface
enum  Activity { BEFORE = 0x01, DURING = 0x02, AFTER = 0x04 }
 
- Protected Member Functions inherited from COutputHandler
bool compileRefresh (const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiDataModel *pDataModel)
 
void refresh ()
 
- Protected Attributes inherited from COutputHandler
std::set< COutputInterface * > mInterfaces
 
std::vector< Refresh * > mObjectRefreshes
 
COutputHandlermpMaster
 
- Protected Attributes inherited from COutputInterface
std::set< const CCopasiObject * > mObjects
 

Detailed Description

This is used to call the plotting routines from the tasks We do not want to call gui stuff directly from the trajectory task.

Definition at line 32 of file COutputHandlerPlot.h.

Constructor & Destructor Documentation

COutputHandlerPlot::COutputHandlerPlot ( )

Default constructor

Definition at line 27 of file COutputHandlerPlot.cpp.

27  :
29  mpDefinitionVector(NULL)
30 {}
COutputDefinitionVector * mpDefinitionVector
COutputHandlerPlot::COutputHandlerPlot ( const COutputHandlerPlot src)

Copy constructor

Parameters
constCOutputHandlerPlot & src

Definition at line 32 of file COutputHandlerPlot.cpp.

32  :
33  COutputHandler(src),
35 {}
COutputDefinitionVector * mpDefinitionVector
COutputHandlerPlot::~COutputHandlerPlot ( )
virtual

Destructor

Definition at line 37 of file COutputHandlerPlot.cpp.

38 {}

Member Function Documentation

bool COutputHandlerPlot::compile ( std::vector< CCopasiContainer * >  listOfContainer,
const CCopasiDataModel pDataModel 
)
virtual

compile the object list from name vector

Parameters
std::vector<CCopasiContainer * > listOfContainer
constCCopasiDataModel* pDataModel
Returns
bool success

Reimplemented from COutputHandler.

Definition at line 40 of file COutputHandlerPlot.cpp.

References COutputHandler::compile(), CCopasiRootContainer::getDatamodelList(), CopasiUI3Window::getMainWindow(), CPlotItem::getTitle(), CPlotSpecification::isActive(), CopasiUI3Window::isMainThread(), COutputHandler::mInterfaces, mpDefinitionVector, mPlotMap, CCopasiVector< T >::size(), and TO_UTF8.

42 {
43  if (!mpDefinitionVector) return false;
44 
45  // This must only be executed in the main thread.
47  {
48  mInterfaces.clear();
49 
50  //step through the vector of specifications and create the plot windows
51  std::string key;
52 
53  size_t i, imax = mpDefinitionVector->size();
54 
55  for (i = 0; i < imax; i++)
56  {
57  CPlotSpecification * pSpecification = (*mpDefinitionVector)[i];
58 
59  if (pSpecification->isActive())
60  {
61  key = pSpecification->CCopasiParameter::getKey();
62 
63  if (!mPlotMap.count(key))
64  mPlotMap[key] = new PlotWindow(this, pSpecification, CopasiUI3Window::getMainWindow());
65  else if ("COPASI Plot: " + pSpecification->getTitle() !=
66  TO_UTF8(mPlotMap[key]->windowTitle()))
67  mPlotMap[key] = new PlotWindow(this, pSpecification, CopasiUI3Window::getMainWindow());
68  else
69  mPlotMap[key]->initFromSpec(pSpecification);
70 
71  mPlotMap[key]->show();
72 
73  mInterfaces.insert(mPlotMap[key]);
74  }
75  }
76  }
77 
78  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
79  return COutputHandler::compile(listOfContainer, pDataModel);
80 }
virtual size_t size() const
static bool isMainThread()
const bool & isActive() const
static CopasiUI3Window * getMainWindow()
COutputDefinitionVector * mpDefinitionVector
std::map< std::string, PlotWindow * > mPlotMap
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel *pDataModel)
std::set< COutputInterface * > mInterfaces
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
const std::string & getTitle() const
Definition: CPlotItem.cpp:228
void COutputHandlerPlot::removeInterface ( COutputInterface pInterface)
virtual

Perform an output event for the current activity

Parameters
constActivity & activity Introduce an additional separator into the output
constActivity & activity Finish the output Remove an interface
COutputInterface* pInterface;

Reimplemented from COutputHandler.

Definition at line 82 of file COutputHandlerPlot.cpp.

References mPlotMap, and COutputHandler::removeInterface().

Referenced by PlotWindow::closeEvent(), and PlotWindow::~PlotWindow().

83 {
84  std::map<std::string, PlotWindow*>::iterator it = mPlotMap.begin();
85  std::map<std::string, PlotWindow*>::iterator end = mPlotMap.end();
86 
87  for (; it != end; ++it)
88  if (it->second == pInterface)
89  {
90  mPlotMap.erase(it);
91  return;
92  }
93 
95  return;
96 }
virtual void removeInterface(COutputInterface *pInterface)
std::map< std::string, PlotWindow * > mPlotMap
void COutputHandlerPlot::setOutputDefinitionVector ( COutputDefinitionVector pDefinitionVector)

Member Data Documentation

COutputDefinitionVector* COutputHandlerPlot::mpDefinitionVector
private

The plot definition

Definition at line 88 of file COutputHandlerPlot.h.

Referenced by compile(), and setOutputDefinitionVector().

std::map<std::string, PlotWindow*> COutputHandlerPlot::mPlotMap
private

This maps the key of a plot spec to a plot window

Definition at line 93 of file COutputHandlerPlot.h.

Referenced by compile(), and removeInterface().


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