BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ScientificPlot Class Referenceabstract

Description

Common interface for plot-descriptor interaction.

Definition at line 27 of file ScientificPlot.h.

Inheritance diagram for ScientificPlot:
[legend]
Collaboration diagram for ScientificPlot:
[legend]

Public Types

enum class  PLOT_TYPE { Plot1D , Plot2D }
 

Signals

void statusString (const QString &text)
 

Public Member Functions

 ScientificPlot (QWidget *parent, PLOT_TYPE plot_type)
 
 ~ScientificPlot () override
 
virtual QList< QAction * > actionList ()
 
bool axesRangeContains (double xpos, double ypos) const
 Returns true if axes rectangle contains given in axes coordinates. More...
 
SessionItemcurrentItem ()
 
const SessionItemcurrentItem () const
 
virtual const QCustomPlot * customPlot () const =0
 
virtual QCustomPlot * customPlot ()=0
 
virtual PlotEventInfo eventInfo (double xpos, double ypos) const =0
 Returns plot descriptor corresponding to given axes coordinates. More...
 
double pixelToXaxisCoord (double pixel) const
 transform widget coordinates to axes coordinates More...
 
double pixelToYaxisCoord (double pixel) const
 
ScientificPlotEventplotEvent ()
 
PLOT_TYPE plotType () const
 Returns the type of current plot. More...
 
virtual void setItem (SessionItem *item)
 
void setMouseTrackingEnabled (bool enable)
 Tracks move events (used when showing profile histograms and printing status string) More...
 
double xAxisCoordToPixel (double axis_coordinate) const
 transform axes coordinates to CustomPlot widget coordinates More...
 
double yAxisCoordToPixel (double axis_coordinate) const
 

Protected Member Functions

void hideEvent (QHideEvent *) override
 
void showEvent (QShowEvent *) override
 
virtual void subscribeToItem ()
 
virtual void unsubscribeFromItem ()
 

Private Attributes

ScientificPlotEventm_event
 
SessionItemControllerm_itemController
 
PLOT_TYPE m_plot_type
 

Member Enumeration Documentation

◆ PLOT_TYPE

Enumerator
Plot1D 
Plot2D 

Definition at line 31 of file ScientificPlot.h.

31 { Plot1D, Plot2D };
The Plot1D class presents data of several 1D DataItems contained in a Data1DViewItem....
Definition: Plot1D.h:32

Constructor & Destructor Documentation

◆ ScientificPlot()

ScientificPlot::ScientificPlot ( QWidget *  parent,
PLOT_TYPE  plot_type 
)
explicit

Definition at line 18 of file ScientificPlot.cpp.

19  : SessionItemWidget(parent)
20  , m_plot_type(plot_type)
21  , m_event(new ScientificPlotEvent(this))
22 {
23 }
Helps ScientificPlot to handle mouse events. Particularly, it constructs a valid status string....
PLOT_TYPE m_plot_type
ScientificPlotEvent * m_event
SessionItemWidget(QWidget *parent=nullptr)

◆ ~ScientificPlot()

ScientificPlot::~ScientificPlot ( )
overridedefault

Member Function Documentation

◆ actionList()

QList< QAction * > SessionItemWidget::actionList ( )
virtualinherited

◆ axesRangeContains()

bool ScientificPlot::axesRangeContains ( double  xpos,
double  ypos 
) const

Returns true if axes rectangle contains given in axes coordinates.

Definition at line 52 of file ScientificPlot.cpp.

53 {
54  return customPlot()->xAxis->range().contains(xpos)
55  && customPlot()->yAxis->range().contains(ypos);
56 }
virtual QCustomPlot * customPlot()=0

References customPlot().

Referenced by Plot1D::eventInfo(), SpecularPlot::eventInfo(), and ColorMap::eventInfo().

Here is the call graph for this function:

◆ currentItem() [1/2]

◆ currentItem() [2/2]

const SessionItem * SessionItemWidget::currentItem ( ) const
inherited

Definition at line 46 of file SessionItemWidget.cpp.

47 {
48  return m_itemController->currentItem();
49 }
SessionItemController * m_itemController

References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.

Here is the call graph for this function:

◆ customPlot() [1/2]

virtual const QCustomPlot* ScientificPlot::customPlot ( ) const
pure virtual

Implemented in ColorMap, SpecularPlot, and Plot1D.

◆ customPlot() [2/2]

◆ eventInfo()

virtual PlotEventInfo ScientificPlot::eventInfo ( double  xpos,
double  ypos 
) const
pure virtual

Returns plot descriptor corresponding to given axes coordinates.

Implemented in ColorMap, SpecularPlot, and Plot1D.

Referenced by ScientificPlotEvent::currentPlotDescriptor().

◆ hideEvent()

void SessionItemWidget::hideEvent ( QHideEvent *  )
overrideprotectedinherited

Definition at line 56 of file SessionItemWidget.cpp.

57 {
59 }
void unsubscribe()
Fully unsubscribes the parent from listening item's signals. Controller stays active to track item de...

References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().

Here is the call graph for this function:

◆ pixelToXaxisCoord()

double ScientificPlot::pixelToXaxisCoord ( double  pixel) const

transform widget coordinates to axes coordinates

Definition at line 37 of file ScientificPlot.cpp.

38 {
39  return customPlot()->xAxis->pixelToCoord(pixel);
40 }

References customPlot().

Referenced by ScientificPlotEvent::currentPlotDescriptor(), and ColorMapSceneAdaptor::fromSceneX().

Here is the call graph for this function:

◆ pixelToYaxisCoord()

double ScientificPlot::pixelToYaxisCoord ( double  pixel) const

Definition at line 42 of file ScientificPlot.cpp.

43 {
44  return customPlot()->yAxis->pixelToCoord(pixel);
45 }

References customPlot().

Referenced by ScientificPlotEvent::currentPlotDescriptor(), and ColorMapSceneAdaptor::fromSceneY().

Here is the call graph for this function:

◆ plotEvent()

ScientificPlotEvent* ScientificPlot::plotEvent ( )
inline

Definition at line 42 of file ScientificPlot.h.

42 { return m_event; }

References m_event.

Referenced by ProjectionsEditorCanvas::setConnected().

◆ plotType()

PLOT_TYPE ScientificPlot::plotType ( ) const
inline

Returns the type of current plot.

Definition at line 59 of file ScientificPlot.h.

59 { return m_plot_type; }

References m_plot_type.

Referenced by Plot1D::eventInfo(), SpecularPlot::eventInfo(), ColorMap::eventInfo(), and FontScalingEvent::setTickLabelFont().

◆ setItem()

◆ setMouseTrackingEnabled()

void ScientificPlot::setMouseTrackingEnabled ( bool  enable)

Tracks move events (used when showing profile histograms and printing status string)

Definition at line 47 of file ScientificPlot.cpp.

48 {
50 }
void setMouseTrackingEnabled(bool enable)
Sets tracking of the mouse for parent DescriptedPlot.

References m_event, and ScientificPlotEvent::setMouseTrackingEnabled().

Referenced by ColorMap::ColorMap(), Plot1D::Plot1D(), SpecularPlot::SpecularPlot(), and PlotStatusLabel::setPlotLabelEnabled().

Here is the call graph for this function:

◆ showEvent()

void SessionItemWidget::showEvent ( QShowEvent *  )
overrideprotectedinherited

Definition at line 51 of file SessionItemWidget.cpp.

52 {
54 }

References SessionItemWidget::m_itemController, and SessionItemController::subscribe().

Here is the call graph for this function:

◆ statusString

void ScientificPlot::statusString ( const QString &  text)
signal

◆ subscribeToItem()

◆ unsubscribeFromItem()

virtual void SessionItemWidget::unsubscribeFromItem ( )
inlineprotectedvirtualinherited

◆ xAxisCoordToPixel()

double ScientificPlot::xAxisCoordToPixel ( double  axis_coordinate) const

transform axes coordinates to CustomPlot widget coordinates

Definition at line 27 of file ScientificPlot.cpp.

28 {
29  return customPlot()->xAxis->coordToPixel(axis_coordinate);
30 }

References customPlot().

Referenced by ColorMapSceneAdaptor::toSceneX(), and ColorMap::viewportRectangleInWidgetCoordinates().

Here is the call graph for this function:

◆ yAxisCoordToPixel()

double ScientificPlot::yAxisCoordToPixel ( double  axis_coordinate) const

Definition at line 32 of file ScientificPlot.cpp.

33 {
34  return customPlot()->yAxis->coordToPixel(axis_coordinate);
35 }

References customPlot().

Referenced by ColorMapSceneAdaptor::toSceneY(), and ColorMap::viewportRectangleInWidgetCoordinates().

Here is the call graph for this function:

Member Data Documentation

◆ m_event

ScientificPlotEvent* ScientificPlot::m_event
private

Definition at line 66 of file ScientificPlot.h.

Referenced by plotEvent(), and setMouseTrackingEnabled().

◆ m_itemController

◆ m_plot_type

PLOT_TYPE ScientificPlot::m_plot_type
private

Definition at line 65 of file ScientificPlot.h.

Referenced by plotType().


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