BornAgain  1.19.0
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/coregui/Views/IntensityDataWidgets/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), m_plot_type(plot_type), m_event(new ScientificPlotEvent(this))
20 {
21 }
22 
24 
25 double ScientificPlot::xAxisCoordToPixel(double axis_coordinate) const
26 {
27  return customPlot()->xAxis->coordToPixel(axis_coordinate);
28 }
29 
30 double ScientificPlot::yAxisCoordToPixel(double axis_coordinate) const
31 {
32  return customPlot()->yAxis->coordToPixel(axis_coordinate);
33 }
34 
35 double ScientificPlot::pixelToXaxisCoord(double pixel) const
36 {
37  return customPlot()->xAxis->pixelToCoord(pixel);
38 }
39 
40 double ScientificPlot::pixelToYaxisCoord(double pixel) const
41 {
42  return customPlot()->yAxis->pixelToCoord(pixel);
43 }
44 
46 {
48 }
49 
50 bool ScientificPlot::axesRangeContains(double xpos, double ypos) const
51 {
52  return customPlot()->xAxis->range().contains(xpos)
53  && customPlot()->yAxis->range().contains(ypos);
54 }
Defines class ScientificPlotEvent.
Helps ScientificPlot to handle mouse events.
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.