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

#include <CopasiPlot.h>

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

Public Member Functions

 C2DPlotCurve (QMutex *pMutex, const CPlotItem::Type &type, const COutputInterface::Activity &activity, const QString &title)
 
const COutputInterface::ActivitygetActivity () const
 
const C_FLOAT64getIncrement () const
 
const CPlotItem::TypegetType () const
 
void reallocatedData (const CVector< double > *pX, const CVector< double > *pY, const CVector< double > *pY2=0)
 
void setDataSize (const size_t &size)
 
void setIncrement (const C_FLOAT64 &increment)
 

Protected Member Functions

virtual void drawCurve (QPainter *painter, int style, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 
virtual void drawSymbols (QPainter *painter, const QwtSymbol &symbol, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 
void myDrawLines (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
 

Private Attributes

COutputInterface::Activity mActivity
 
CPlotItem::Type mCurveType
 
C_FLOAT64 mIncrement
 
QMutex * mpMutex
 

Detailed Description

Definition at line 164 of file CopasiPlot.h.

Constructor & Destructor Documentation

C2DPlotCurve::C2DPlotCurve ( QMutex *  pMutex,
const CPlotItem::Type type,
const COutputInterface::Activity activity,
const QString &  title 
)
inline

Definition at line 167 of file CopasiPlot.h.

References mpMutex.

168  :
169  QwtPlotCurve(title),
170  mpMutex(pMutex),
171  mCurveType(type),
172  mIncrement(1.0),
173  mActivity(activity)
174  {
175  assert(mpMutex != NULL);
176  }
CPlotItem::Type mCurveType
Definition: CopasiPlot.h:208
QMutex * mpMutex
Definition: CopasiPlot.h:206
COutputInterface::Activity mActivity
Definition: CopasiPlot.h:212
C_FLOAT64 mIncrement
Definition: CopasiPlot.h:210

Member Function Documentation

void C2DPlotCurve::drawCurve ( QPainter *  painter,
int  style,
const QwtScaleMap &  xMap,
const QwtScaleMap &  yMap,
int  from,
int  to 
) const
protectedvirtual

Definition at line 698 of file CopasiPlot.cpp.

References mpMutex, and myDrawLines().

701 {
702  QMutexLocker Locker(mpMutex);
703 
704  if (style == Lines)
705  {
706  myDrawLines(painter, xMap, yMap, from, to);
707  }
708  else
709  {
710  QwtPlotCurve::drawCurve(painter, style, xMap, yMap, from, to);
711  }
712 }
QMutex * mpMutex
Definition: CopasiPlot.h:206
void myDrawLines(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const
Definition: CopasiPlot.cpp:668
void C2DPlotCurve::drawSymbols ( QPainter *  painter,
const QwtSymbol &  symbol,
const QwtScaleMap &  xMap,
const QwtScaleMap &  yMap,
int  from,
int  to 
) const
protectedvirtual

Definition at line 714 of file CopasiPlot.cpp.

717 {
718 
719  int from2 = from;
720  int to2;
721 
722  for (;;)
723  {
724 
725  //find the next not-NaN point
726  while (isnan(x(from2)) || isnan(y(from2)))
727  {
728  ++from2;
729 
730  if (from2 >= to)
731  return;
732  }
733 
734  //find the nex NaN point (or the end of data)
735  to2 = from2;
736 
737  do
738  {
739  ++to2;
740 
741  if (to2 > to)
742  break;
743  }
744  while (!(isnan(x(to2)) || isnan(y(to2))));
745 
746  --to2;
747 
748  QwtPlotCurve::drawSymbols(painter, symbol, xMap, yMap, from2, to2);
749 
750  //are we done?
751  if (to2 >= to)
752  return;
753 
754  //continue with the next data point
755  from2 = to2 + 1;
756  }
757 }
const COutputInterface::Activity & C2DPlotCurve::getActivity ( ) const

Definition at line 662 of file CopasiPlot.cpp.

References mActivity.

663 {
664  return mActivity;
665 }
COutputInterface::Activity mActivity
Definition: CopasiPlot.h:212
const C_FLOAT64 & C2DPlotCurve::getIncrement ( ) const

Definition at line 652 of file CopasiPlot.cpp.

References mIncrement.

653 {
654  return mIncrement;
655 }
C_FLOAT64 mIncrement
Definition: CopasiPlot.h:210
const CPlotItem::Type & C2DPlotCurve::getType ( ) const

Definition at line 657 of file CopasiPlot.cpp.

References mCurveType.

Referenced by CopasiPlot::initFromSpec().

658 {
659  return mCurveType;
660 }
CPlotItem::Type mCurveType
Definition: CopasiPlot.h:208
void C2DPlotCurve::myDrawLines ( QPainter *  painter,
const QwtScaleMap &  xMap,
const QwtScaleMap &  yMap,
int  from,
int  to 
) const
protected

Definition at line 668 of file CopasiPlot.cpp.

Referenced by drawCurve().

671 {
672  int to2;
673 
674  do
675  {
676  int i;
677 
678  for (i = from; i <= to; ++i)
679  if (isnan(x(i)) || isnan(y(i))) //NaN
680  break;
681 
682  if (i == from)
683  {
684  ++from;
685  continue;
686  }
687 
688  to2 = i - 1;
689 
690  QwtPlotCurve::drawLines(painter, xMap, yMap, from, to2);
691 
692  from = to2 + 2;
693  }
694  while (from < to);
695 }
void C2DPlotCurve::reallocatedData ( const CVector< double > *  pX,
const CVector< double > *  pY,
const CVector< double > *  pY2 = 0 
)

Definition at line 624 of file CopasiPlot.cpp.

References CPlotItem::bandedGraph, CPlotItem::curve2d, fatalError, CPlotItem::histoItem1d, and mCurveType.

625 {
626 
627  switch (mCurveType)
628  {
629  case CPlotItem::curve2d:
630  static_cast< C2DCurveData * >(&data())->reallocated(pX, pY);
631  break;
632 
634  static_cast< CBandedGraphData * >(&data())->reallocated(pX, pY, pY2);
635  break;
636 
638  static_cast< CHistoCurveData * >(&data())->reallocated(pX);
639  break;
640 
641  default:
642  fatalError();
643  break;
644  }
645 }
CPlotItem::Type mCurveType
Definition: CopasiPlot.h:208
#define fatalError()
void C2DPlotCurve::setDataSize ( const size_t &  size)

Definition at line 602 of file CopasiPlot.cpp.

References CPlotItem::bandedGraph, CPlotItem::curve2d, fatalError, CPlotItem::histoItem1d, and mCurveType.

603 {
604  switch (mCurveType)
605  {
606  case CPlotItem::curve2d:
607  static_cast< C2DCurveData * >(&data())->setSize(size);
608  break;
609 
611  static_cast< CBandedGraphData * >(&data())->setSize(size);
612  break;
613 
615  static_cast< CHistoCurveData * >(&data())->setSize(size);
616  break;
617 
618  default:
619  fatalError();
620  break;
621  }
622 }
CPlotItem::Type mCurveType
Definition: CopasiPlot.h:208
#define fatalError()
void C2DPlotCurve::setIncrement ( const C_FLOAT64 increment)

Definition at line 647 of file CopasiPlot.cpp.

References mIncrement.

Referenced by CopasiPlot::initFromSpec().

648 {
649  mIncrement = increment;
650 }
C_FLOAT64 mIncrement
Definition: CopasiPlot.h:210

Member Data Documentation

COutputInterface::Activity C2DPlotCurve::mActivity
private

Definition at line 212 of file CopasiPlot.h.

Referenced by getActivity().

CPlotItem::Type C2DPlotCurve::mCurveType
private

Definition at line 208 of file CopasiPlot.h.

Referenced by getType(), reallocatedData(), and setDataSize().

C_FLOAT64 C2DPlotCurve::mIncrement
private

Definition at line 210 of file CopasiPlot.h.

Referenced by getIncrement(), and setIncrement().

QMutex* C2DPlotCurve::mpMutex
private

Definition at line 206 of file CopasiPlot.h.

Referenced by C2DPlotCurve(), and drawCurve().


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