COPASI API  4.16.103
Public Slots | Public Member Functions | Protected Member Functions | List of all members
LogPlotZoomer Class Reference

#include <scrollzoomer.h>

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

Public Slots

virtual void move (double x, double y)
 

Public Member Functions

 LogPlotZoomer (QwtPlotCanvas *canvas)
 

Protected Member Functions

virtual QwtText trackerText (const QwtDoublePoint &pos) const
 

Detailed Description

Definition at line 39 of file scrollzoomer.h.

Constructor & Destructor Documentation

LogPlotZoomer::LogPlotZoomer ( QwtPlotCanvas *  canvas)

Definition at line 33 of file scrollzoomer.cpp.

33  :
34  QwtPlotZoomer(canvas)
35 {}

Member Function Documentation

void LogPlotZoomer::move ( double  x,
double  y 
)
virtualslot

Definition at line 67 of file scrollzoomer.cpp.

Referenced by ScrollZoomer::scrollBarMoved().

68 {
69  //QwtPlotZoomer::move(x,y);
70 
71  x = qwtMax(x, zoomBase().left());
72  x = qwtMin(x, zoomBase().right() - zoomRect().width());
73 
74  y = qwtMax(y, zoomBase().top());
75  y = qwtMin(y, zoomBase().bottom() - zoomRect().height());
76 
77  if (x != zoomRect().left() || y != zoomRect().top())
78  {
79  //zoomStack()[zoomRectIndex()].moveTo(x, y);
80  QwtDoubleRect & rect = const_cast<QwtDoubleRect &>(zoomStack()[zoomRectIndex()]);
81 
82  //handle x axis
83  const int xAxis = QwtPlotZoomer::xAxis();
84  const QwtScaleEngine *sex = plot()->axisScaleEngine(xAxis);
85 
86  if (dynamic_cast<const QwtLog10ScaleEngine*>(sex))
87  {
88  //logarithmic
89  double factor = rect.right() / rect.left();
90  rect.setRight(x * factor);
91  rect.setLeft(x);
92  }
93  else
94  {
95  rect.moveLeft(x);
96  }
97 
98  const int yAxis = QwtPlotZoomer::yAxis();
99 
100  const QwtScaleEngine *sey = plot()->axisScaleEngine(yAxis);
101 
102  if (dynamic_cast<const QwtLog10ScaleEngine*>(sey))
103  {
104  //logarithmic
105  double factor = rect.bottom() / rect.top();
106  rect.setBottom(y * factor);
107  rect.setTop(y);
108  }
109  else
110  {
111  rect.moveTop(y);
112  }
113 
114  //zoomStack()[zoomRectIndex()].moveTo(x, y);
115  rescale();
116  }
117 }
QwtText LogPlotZoomer::trackerText ( const QwtDoublePoint &  pos) const
protectedvirtual

Definition at line 37 of file scrollzoomer.cpp.

38 {
39  switch (rubberBand())
40  {
41  case HLineRubberBand:
42  return QString().sprintf("%.4g", pos.y());
43  case VLineRubberBand:
44  return QString().sprintf("%.4g", pos.x());
45  default:
46  return QString().sprintf("%.4g, %.4g", pos.x(), pos.y());
47  }
48 
49  return QwtText(); // make some dumb compilers happy
50 }

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