COPASI API  4.16.103
CPlotSpecification.cpp
Go to the documentation of this file.
1 /* Begin CVS Header
2  $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/plot/CPlotSpecification.cpp,v $
3  $Revision: 1.17 $
4  $Name: $
5  $Author: shoops $
6  $Date: 2011/03/14 19:20:01 $
7  End CVS Header */
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 #include "model/CModel.h"
24 
25 #include "CPlotSpecification.h"
27 
28 CPlotSpecification::CPlotSpecification(const std::string & name,
29  const CCopasiContainer * pParent,
30  const CPlotSpecification::Type & type):
31  CPlotItem(name, pParent, type),
32  items("Curves", this),
33  mActive(true)
34 {initObjects();}
35 
37  const CCopasiContainer * pParent):
38  CPlotItem(src, pParent),
39  items(src.getItems(), this),
40  mActive(src.mActive)
41 {initObjects();}
42 
44 
46 {
47  items.cleanup();
48  this->CPlotItem::cleanup();
49 }
50 
52 {
53  // CCopasiContainer::addObjectReference("Active", mActive, CCopasiObject::ValueBool);
54 }
55 
56 //*************************************
57 
58 void CPlotSpecification::setActive(const bool & active)
59 {mActive = active;}
60 
61 const bool & CPlotSpecification::isActive() const
62 {return mActive;}
63 
65 {
66  return *getValue("log X").pBOOL;
67 }
68 
70 {
71  return *getValue("log Y").pBOOL;
72 }
73 
75 {
76  setValue("log X", l);
77 }
78 
80 {
81  setValue("log Y", l);
82 }
83 
84 //*************************************
85 
87 {
88  CPlotItem * itm = new CPlotItem(name, NULL, type);
89 
90  if (!items.add(itm, true))
91  {
92  delete itm;
93  return NULL;
94  }
95 
96  return itm;
97 }
98 
100 {
101  mActive = true;
102 
103  //TODO cleanup before?
104  //title = "Default Data Plot 2D";
105 
106  CPlotItem * plItem;
107  std::string itemTitle;
108  CPlotDataChannelSpec name2;
109  const CCopasiObject * tmp;
110 
111  CPlotDataChannelSpec name1 = model->getValueReference()->getCN();
112 
113  size_t i, imax = model->getMetabolites().size();
114 
115  for (i = 0; i < imax; ++i)
116  {
117  tmp = model->getMetabolites()[i]->getConcentrationReference();
118  name2 = tmp->getCN();
119  itemTitle = tmp->getObjectDisplayName();
120 
121  plItem = this->createItem(itemTitle, CPlotItem::curve2d);
122  plItem->addChannel(name1);
123  plItem->addChannel(name2);
124  }
125 
126  return true; //TODO: really check;
127 }
CPlotItem(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=curve2d)
Definition: CPlotItem.cpp:75
virtual std::string getObjectDisplayName(bool regular=true, bool richtext=false) const
virtual CCopasiObjectName getCN() const
const CCopasiVector< CMetab > & getMetabolites() const
Definition: CModel.cpp:1051
virtual size_t size() const
bool createDefaultPlot(const CModel *model)
void setActive(const bool &active)
void addChannel(const CPlotDataChannelSpec &channel)
Definition: CPlotItem.cpp:223
const bool & isActive() const
CCopasiVector< CPlotItem > items
CPlotItem * createItem(const std::string &name, CPlotItem::Type type)
virtual void cleanup()
virtual bool add(const CType &src)
const Value & getValue() const
bool setValue(const std::string &name, const CType &value)
void cleanup()
Definition: CPlotItem.cpp:150
Definition: CModel.h:50
CPlotSpecification(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const CPlotItem::Type &type=plot2d)
CCopasiObject * getValueReference() const