BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ScientificPlot.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotUtil/ScientificPlot.cpp
6 //! @brief Implements class ScientificPlot
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
16 #include <qcustomplot.h>
17 
18 ScientificPlot::ScientificPlot(QWidget* parent, PLOT_TYPE plot_type)
19  : SessionItemWidget(parent)
20  , m_plot_type(plot_type)
21  , m_event(new ScientificPlotEvent(this))
22 {
23 }
24 
26 
27 double ScientificPlot::xAxisCoordToPixel(double axis_coordinate) const
28 {
29  return customPlot()->xAxis->coordToPixel(axis_coordinate);
30 }
31 
32 double ScientificPlot::yAxisCoordToPixel(double axis_coordinate) const
33 {
34  return customPlot()->yAxis->coordToPixel(axis_coordinate);
35 }
36 
37 double ScientificPlot::pixelToXaxisCoord(double pixel) const
38 {
39  return customPlot()->xAxis->pixelToCoord(pixel);
40 }
41 
42 double ScientificPlot::pixelToYaxisCoord(double pixel) const
43 {
44  return customPlot()->yAxis->pixelToCoord(pixel);
45 }
46 
48 {
50 }
51 
52 bool ScientificPlot::axesRangeContains(double xpos, double ypos) const
53 {
54  return customPlot()->xAxis->range().contains(xpos)
55  && customPlot()->yAxis->range().contains(ypos);
56 }
Defines class ScientificPlotEvent.
Helps ScientificPlot to handle mouse events. Particularly, it constructs a valid status string....
void setMouseTrackingEnabled(bool enable)
Sets tracking of the mouse for parent DescriptedPlot.
ScientificPlot(QWidget *parent, PLOT_TYPE plot_type)
bool axesRangeContains(double xpos, double ypos) const
Returns true if axes rectangle contains given in axes coordinates.
virtual QCustomPlot * customPlot()=0
double yAxisCoordToPixel(double axis_coordinate) const
~ScientificPlot() override
double pixelToYaxisCoord(double pixel) const
ScientificPlotEvent * m_event
double pixelToXaxisCoord(double pixel) const
transform widget coordinates to axes coordinates
void setMouseTrackingEnabled(bool enable)
Tracks move events (used when showing profile histograms and printing status string)
double xAxisCoordToPixel(double axis_coordinate) const
transform axes coordinates to CustomPlot widget coordinates
The SessionItemWidget class is a base for all widgets representing the content of SessionItem....