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

Common interface for plot-descriptor interaction. More...

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

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

Private Attributes

ScientificPlotEventm_event
 
SessionItemControllerm_itemController
 
PLOT_TYPE m_plot_type
 

Detailed Description

Common interface for plot-descriptor interaction.

Definition at line 27 of file ScientificPlot.h.

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), m_plot_type(plot_type), m_event(new ScientificPlotEvent(this))
20 {
21 }
Helps ScientificPlot to handle mouse events.
PLOT_TYPE m_plot_type
ScientificPlotEvent * m_event
SessionItemWidget(QWidget *parent=0)

◆ ~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 50 of file ScientificPlot.cpp.

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

References customPlot().

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

Here is the call graph for this function:

◆ currentItem() [1/2]

SessionItem * SessionItemWidget::currentItem ( )
inherited

Definition at line 41 of file SessionItemWidget.cpp.

42 {
43  return const_cast<SessionItem*>(static_cast<const SessionItemWidget*>(this)->currentItem());
44 }
The SessionItemWidget class is a base for all widgets representing the content of SessionItem.
SessionItem * currentItem()

Referenced by RectangularDetectorEditor::detectorItem(), SphericalDetectorEditor::detectorItem(), FitFlowWidget::fitSuiteItem(), DistributionEditor::groupItem(), DepthProbeInstrumentEditor::instrumentItem(), EnvironmentEditor::instrumentItem(), GISASBeamEditor::instrumentItem(), GISASDetectorEditor::instrumentItem(), GISASInstrumentEditor::instrumentItem(), OffSpecularBeamEditor::instrumentItem(), OffSpecularInstrumentEditor::instrumentItem(), PolarizationAnalysisEditor::instrumentItem(), SpecularBeamEditor::instrumentItem(), SpecularInstrumentEditor::instrumentItem(), RealDataMaskWidget::intensityDataItem(), IntensityDataCanvas::intensityDataItem(), IntensityDataProjectionsWidget::intensityDataItem(), IntensityDataWidget::intensityDataItem(), ProjectionsPlot::intensityItem(), ColorMap::intensityItem(), DetectorPresenter::itemPresentation(), InstrumentPresenter::itemPresentation(), JobResultsPresenter::itemPresentation(), FitComparisonWidget::jobItem(), FitComparisonWidget1D::jobItem(), FitParameterWidget::jobItem(), RunFitControlWidget::jobItem(), JobPropertiesWidget::jobItem(), ParameterTuningWidget::jobItem(), SpecularDataImportWidget::realDataItem(), ItemComboWidget::setPresentation(), JobResultsPresenter::setPresentation(), SpecularDataCanvas::specularDataItem(), SpecularDataImportWidget::specularDataItem(), SpecularDataWidget::specularDataItem(), SpecularPlot::specularItem(), ItemComboWidget::subscribeToItem(), DistributionEditor::subscribeToItem(), GISASDetectorEditor::subscribeToItem(), PolarizationAnalysisEditor::subscribeToItem(), IntensityDataPropertyWidget::subscribeToItem(), JobPropertiesWidget::subscribeToItem(), ProjectionsPropertyPanel::subscribeToItem(), ProjectionsPlot::unsubscribeFromChildren(), and Plot1D::viewItem().

◆ 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 SpecularPlot, Plot1D, and ColorMap.

◆ 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 SpecularPlot, Plot1D, and ColorMap.

Referenced by ScientificPlotEvent::currentPlotDescriptor().

◆ hideEvent()

void SessionItemWidget::hideEvent ( QHideEvent *  )
protectedvirtualinherited

Definition at line 56 of file SessionItemWidget.cpp.

57 {
59 }
void unsubscribe()
Fully unsubscribes the parent from listening item's signals.

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 35 of file ScientificPlot.cpp.

36 {
37  return customPlot()->xAxis->pixelToCoord(pixel);
38 }

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 40 of file ScientificPlot.cpp.

41 {
42  return customPlot()->yAxis->pixelToCoord(pixel);
43 }

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 ColorMap::eventInfo(), Plot1D::eventInfo(), SpecularPlot::eventInfo(), and FontScalingEvent::setTickLabelFont().

◆ setItem()

void SessionItemWidget::setItem ( SessionItem item)
virtualinherited

Reimplemented in SpecularPlotCanvas, SpecularDataImportWidget, SpecularDataWidget, IntensityDataWidget, SpecularDataCanvas, ProjectionsWidget, IntensityDataCanvas, ColorMapCanvas, and Plot1DCanvas.

Definition at line 28 of file SessionItemWidget.cpp.

29 {
31 
32  if (isVisible())
34 }
void setItem(SessionItem *item)
void subscribe()
Subscribe parent to item's signals.

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

Referenced by IntensityDataWidget::onFFTAction(), JobSelectorWidget::onSelectionChanged(), ProjectionsEditor::resetContext(), ProjectionsEditor::setContext(), MaskGraphicsProxy::setIntensityItem(), FitSessionWidget::setItem(), Plot1DCanvas::setItem(), InstrumentEditorWidget::setItem(), ColorMapCanvas::setItem(), IntensityDataCanvas::setItem(), ProjectionsWidget::setItem(), SpecularDataCanvas::setItem(), DistributionDialog::setItem(), IntensityDataWidget::setItem(), SpecularDataWidget::setItem(), SpecularDataImportWidget::setItem(), SpecularPlotCanvas::setItem(), ItemComboWidget::setPresentation(), GISASInstrumentEditor::subscribeToItem(), OffSpecularInstrumentEditor::subscribeToItem(), SpecularInstrumentEditor::subscribeToItem(), FitComparisonWidget::subscribeToItem(), FitComparisonWidget1D::subscribeToItem(), and GISASDetectorEditor::updateDetectorPresenter().

Here is the call graph for this function:

◆ setMouseTrackingEnabled()

void ScientificPlot::setMouseTrackingEnabled ( bool  enable)

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

Definition at line 45 of file ScientificPlot.cpp.

46 {
48 }
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 *  )
protectedvirtualinherited

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()

◆ xAxisCoordToPixel()

double ScientificPlot::xAxisCoordToPixel ( double  axis_coordinate) const

transform axes coordinates to CustomPlot widget coordinates

Definition at line 25 of file ScientificPlot.cpp.

26 {
27  return customPlot()->xAxis->coordToPixel(axis_coordinate);
28 }

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 30 of file ScientificPlot.cpp.

31 {
32  return customPlot()->yAxis->coordToPixel(axis_coordinate);
33 }

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: