BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The SpecularPlot class presents 1D intensity data from SpecularDataItem. More...
Public Types | |
enum class | PLOT_TYPE { Plot1D , Plot2D } |
Signals | |
void | statusString (const QString &text) |
Public Member Functions | |
SpecularPlot (QWidget *parent=nullptr) | |
virtual QList< QAction * > | actionList () |
bool | axesRangeContains (double xpos, double ypos) const |
Returns true if axes rectangle contains given in axes coordinates. More... | |
SessionItem * | currentItem () |
const SessionItem * | currentItem () const |
const QCustomPlot * | customPlot () const override |
QCustomPlot * | customPlot () override |
PlotEventInfo | eventInfo (double xpos, double ypos) const override |
Returns PlotEventInfo corresponding to given axes coordinates. More... | |
QSize | minimumSizeHint () const override |
double | pixelToXaxisCoord (double pixel) const |
transform widget coordinates to axes coordinates More... | |
double | pixelToYaxisCoord (double pixel) const |
ScientificPlotEvent * | plotEvent () |
PLOT_TYPE | plotType () const |
Returns the type of current plot. More... | |
void | resetView () |
reset all axes min,max to initial value More... | |
virtual void | setItem (SessionItem *item) |
void | setLog (bool log) |
sets logarithmic scale More... | |
void | setMouseTrackingEnabled (bool enable) |
Tracks move events (used when showing profile histograms and printing status string) More... | |
QSize | sizeHint () const override |
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 *) |
void | subscribeToItem () override |
void | unsubscribeFromItem () override |
Private Slots | |
void | onPropertyChanged (const QString &property_name) |
updates plot depending on IntensityDataItem properties More... | |
void | onTimeToReplot () |
Replots SpecularPlot. More... | |
void | onXaxisRangeChanged (QCPRange newRange) |
Propagate xmin, xmax back to IntensityDataItem. More... | |
void | onYaxisRangeChanged (QCPRange newRange) |
Propagate ymin, ymax back to IntensityDataItem. More... | |
Private Member Functions | |
void | initPlot () |
creates and initializes the color map More... | |
void | modifyAxesProperties (const QString &axisName, const QString &propertyName) |
void | replot () |
Schedule replot for later execution by onTimeReplot() slot. More... | |
void | setAxesLabelsFromItem (SpecularDataItem *item) |
Sets X,Y axes labels from item. More... | |
void | setAxesRangeConnected (bool isConnected) |
Connects/disconnects signals related to SpecularPlot's X,Y axes rectangle change. More... | |
void | setAxesRangeFromItem (SpecularDataItem *item) |
Sets (xmin,xmax) and (ymin,ymax) of SpecularPlot from specular item. More... | |
void | setConnected (bool isConnected) |
void | setDataFromItem (SpecularDataItem *item) |
Sets the intensity values to SpecularPlot. More... | |
void | setLabel (const BasicAxisItem *item, QCPAxis *axis, QString label) |
Sets label to axis. More... | |
void | setPlotFromItem (SpecularDataItem *intensityItem) |
Sets initial state of SpecularPlot to match given intensity item. More... | |
void | setUpdateTimerConnected (bool isConnected) |
SpecularDataItem * | specularItem () |
const SpecularDataItem * | specularItem () const |
Private Attributes | |
bool | m_block_update |
QCustomPlot * | m_custom_plot |
ScientificPlotEvent * | m_event |
SessionItemController * | m_itemController |
PLOT_TYPE | m_plot_type |
UpdateTimer * | m_update_timer |
The SpecularPlot class presents 1D intensity data from SpecularDataItem.
Provides minimal functionality for data plotting and axes interaction. Should be a component for more complicated plotting widgets. Corresponds to ColorMap for 2D intensity data.
Definition at line 32 of file SpecularPlot.h.
|
stronginherited |
Enumerator | |
---|---|
Plot1D | |
Plot2D |
Definition at line 31 of file ScientificPlot.h.
|
explicit |
Definition at line 30 of file SpecularPlot.cpp.
References initPlot(), m_custom_plot, and ScientificPlot::setMouseTrackingEnabled().
|
virtualinherited |
Reimplemented in SpecularDataCanvas, FitComparisonWidget1D, FitComparisonWidget, SpecularDataWidget, SpecularDataImportWidget, IntensityDataWidget, IntensityDataPropertyWidget, IntensityDataProjectionsWidget, IntensityDataCanvas, RealDataPresenter, and RealDataMaskWidget.
Definition at line 36 of file SessionItemWidget.cpp.
Referenced by ItemComboWidget::setPresentation().
|
inherited |
Returns true if axes rectangle contains given in axes coordinates.
Definition at line 50 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMap::eventInfo(), Plot1D::eventInfo(), and eventInfo().
|
inherited |
Definition at line 41 of file SessionItemWidget.cpp.
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(), specularItem(), ItemComboWidget::subscribeToItem(), DistributionEditor::subscribeToItem(), GISASDetectorEditor::subscribeToItem(), PolarizationAnalysisEditor::subscribeToItem(), IntensityDataPropertyWidget::subscribeToItem(), JobPropertiesWidget::subscribeToItem(), ProjectionsPropertyPanel::subscribeToItem(), ProjectionsPlot::unsubscribeFromChildren(), and Plot1D::viewItem().
|
inherited |
Definition at line 46 of file SessionItemWidget.cpp.
References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements ScientificPlot.
Definition at line 44 of file SpecularPlot.h.
References m_custom_plot.
Referenced by SpecularPlotCanvas::customPlot().
|
overridevirtual |
Returns PlotEventInfo corresponding to given axes coordinates.
Implements ScientificPlot.
Definition at line 47 of file SpecularPlot.cpp.
References ScientificPlot::axesRangeContains(), m_custom_plot, ScientificPlot::plotType(), PlotEventInfo::setInAxesRange(), PlotEventInfo::setNx(), PlotEventInfo::setValue(), PlotEventInfo::setX(), specularItem(), and PlotEventInfo::x().
|
protectedvirtualinherited |
Definition at line 56 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().
|
private |
creates and initializes the color map
Definition at line 130 of file SpecularPlot.cpp.
References m_custom_plot, and Constants::plot_tick_label_size().
Referenced by SpecularPlot().
|
inlineoverride |
Definition at line 39 of file SpecularPlot.h.
|
private |
Definition at line 249 of file SpecularPlot.cpp.
References m_block_update, m_custom_plot, AmplitudeAxisItem::P_IS_LOGSCALE, BasicAxisItem::P_MAX_DEG, BasicAxisItem::P_MIN_DEG, BasicAxisItem::P_TITLE, BasicAxisItem::P_TITLE_IS_VISIBLE, SpecularDataItem::P_XAXIS, SpecularDataItem::P_YAXIS, replot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setLog(), and specularItem().
Referenced by subscribeToItem().
|
privateslot |
updates plot depending on IntensityDataItem properties
Definition at line 73 of file SpecularPlot.cpp.
References m_block_update, DataItem::P_AXES_UNITS, replot(), setAxesRangeFromItem(), and specularItem().
Referenced by subscribeToItem().
|
privateslot |
Replots SpecularPlot.
Definition at line 100 of file SpecularPlot.cpp.
References m_custom_plot.
Referenced by setUpdateTimerConnected().
|
privateslot |
Propagate xmin, xmax back to IntensityDataItem.
Definition at line 84 of file SpecularPlot.cpp.
References m_block_update, SpecularDataItem::setLowerX(), SpecularDataItem::setUpperX(), and specularItem().
Referenced by setAxesRangeConnected().
|
privateslot |
Propagate ymin, ymax back to IntensityDataItem.
Definition at line 92 of file SpecularPlot.cpp.
References m_block_update, SpecularDataItem::setLowerY(), SpecularDataItem::setUpperY(), and specularItem().
Referenced by setAxesRangeConnected().
|
inherited |
transform widget coordinates to axes coordinates
Definition at line 35 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ScientificPlotEvent::currentPlotDescriptor(), and ColorMapSceneAdaptor::fromSceneX().
|
inherited |
Definition at line 40 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ScientificPlotEvent::currentPlotDescriptor(), and ColorMapSceneAdaptor::fromSceneY().
|
inlineinherited |
Definition at line 42 of file ScientificPlot.h.
References ScientificPlot::m_event.
Referenced by ProjectionsEditorCanvas::setConnected().
|
inlineinherited |
Returns the type of current plot.
Definition at line 59 of file ScientificPlot.h.
References ScientificPlot::m_plot_type.
Referenced by ColorMap::eventInfo(), Plot1D::eventInfo(), eventInfo(), and FontScalingEvent::setTickLabelFont().
|
private |
Schedule replot for later execution by onTimeReplot() slot.
Definition at line 282 of file SpecularPlot.cpp.
References m_update_timer, and UpdateTimer::scheduleUpdate().
Referenced by modifyAxesProperties(), onPropertyChanged(), and setPlotFromItem().
void SpecularPlot::resetView | ( | ) |
reset all axes min,max to initial value
Definition at line 68 of file SpecularPlot.cpp.
References SpecularDataItem::resetView(), and specularItem().
|
private |
Sets X,Y axes labels from item.
Definition at line 209 of file SpecularPlot.cpp.
References SpecularDataItem::getXaxisTitle(), SpecularDataItem::getYaxisTitle(), m_custom_plot, setLabel(), SpecularDataItem::xAxisItem(), and SpecularDataItem::yAxisItem().
Referenced by modifyAxesProperties(), and setPlotFromItem().
|
private |
Connects/disconnects signals related to SpecularPlot's X,Y axes rectangle change.
Definition at line 150 of file SpecularPlot.cpp.
References m_custom_plot, onXaxisRangeChanged(), and onYaxisRangeChanged().
Referenced by modifyAxesProperties(), setAxesRangeFromItem(), and setConnected().
|
private |
Sets (xmin,xmax) and (ymin,ymax) of SpecularPlot from specular item.
Also sets logarithmic scale on y-axis if necessary.
Definition at line 197 of file SpecularPlot.cpp.
References SpecularDataItem::getLowerX(), SpecularDataItem::getLowerY(), SpecularDataItem::getUpperX(), SpecularDataItem::getUpperY(), SpecularDataItem::isLog(), m_custom_plot, setAxesRangeConnected(), and setLog().
Referenced by onPropertyChanged(), and setPlotFromItem().
|
private |
Definition at line 144 of file SpecularPlot.cpp.
References setAxesRangeConnected(), and setUpdateTimerConnected().
Referenced by subscribeToItem(), and unsubscribeFromItem().
|
private |
Sets the intensity values to SpecularPlot.
Definition at line 224 of file SpecularPlot.cpp.
References ASSERT, OutputData< T >::getAxisValue(), DataItem::getOutputData(), and m_custom_plot.
Referenced by setPlotFromItem().
|
virtualinherited |
Reimplemented in SpecularPlotCanvas, SpecularDataImportWidget, SpecularDataWidget, IntensityDataWidget, SpecularDataCanvas, ProjectionsWidget, IntensityDataCanvas, ColorMapCanvas, and Plot1DCanvas.
Definition at line 28 of file SessionItemWidget.cpp.
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().
|
private |
Sets label to axis.
Definition at line 215 of file SpecularPlot.cpp.
References ASSERT, SessionItem::getItemValue(), and BasicAxisItem::P_TITLE_IS_VISIBLE.
Referenced by setAxesLabelsFromItem().
void SpecularPlot::setLog | ( | bool | log | ) |
sets logarithmic scale
Definition at line 62 of file SpecularPlot.cpp.
References m_custom_plot, and ColorMapUtils::setLogz().
Referenced by modifyAxesProperties(), and setAxesRangeFromItem().
|
inherited |
Tracks move events (used when showing profile histograms and printing status string)
Definition at line 45 of file ScientificPlot.cpp.
References ScientificPlot::m_event, and ScientificPlotEvent::setMouseTrackingEnabled().
Referenced by ColorMap::ColorMap(), Plot1D::Plot1D(), SpecularPlot(), and PlotStatusLabel::setPlotLabelEnabled().
|
private |
Sets initial state of SpecularPlot to match given intensity item.
Definition at line 181 of file SpecularPlot.cpp.
References ASSERT, m_block_update, m_custom_plot, replot(), setAxesLabelsFromItem(), setAxesRangeFromItem(), setDataFromItem(), and specularItem().
Referenced by subscribeToItem().
|
private |
Definition at line 172 of file SpecularPlot.cpp.
References m_update_timer, onTimeToReplot(), and UpdateTimer::timeToUpdate().
Referenced by setConnected().
|
protectedvirtualinherited |
Definition at line 51 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, and SessionItemController::subscribe().
|
inlineoverride |
Definition at line 38 of file SpecularPlot.h.
|
private |
Definition at line 238 of file SpecularPlot.cpp.
Referenced by eventInfo(), modifyAxesProperties(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), resetView(), setPlotFromItem(), and subscribeToItem().
|
private |
Definition at line 243 of file SpecularPlot.cpp.
References SessionItemWidget::currentItem().
|
signalinherited |
Referenced by ScientificPlotEvent::onCustomMouseMove(), and PlotStatusLabel::setConnected().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 105 of file SpecularPlot.cpp.
References SessionItem::itemName(), SessionItem::mapper(), SessionItem::modelType(), modifyAxesProperties(), RealSpace::Particles::name(), onPropertyChanged(), setConnected(), ModelMapper::setOnChildPropertyChange(), ModelMapper::setOnPropertyChange(), ModelMapper::setOnValueChange(), setPlotFromItem(), and specularItem().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 125 of file SpecularPlot.cpp.
References setConnected().
|
inherited |
transform axes coordinates to CustomPlot widget coordinates
Definition at line 25 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneX(), and ColorMap::viewportRectangleInWidgetCoordinates().
|
inherited |
Definition at line 30 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneY(), and ColorMap::viewportRectangleInWidgetCoordinates().
|
private |
Definition at line 108 of file SpecularPlot.h.
Referenced by modifyAxesProperties(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), and setPlotFromItem().
|
private |
Definition at line 105 of file SpecularPlot.h.
Referenced by SpecularPlot(), customPlot(), eventInfo(), initPlot(), modifyAxesProperties(), onTimeToReplot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setAxesRangeFromItem(), setDataFromItem(), setLog(), and setPlotFromItem().
|
privateinherited |
Definition at line 66 of file ScientificPlot.h.
Referenced by ScientificPlot::plotEvent(), and ScientificPlot::setMouseTrackingEnabled().
|
privateinherited |
Definition at line 49 of file SessionItemWidget.h.
Referenced by SessionItemWidget::SessionItemWidget(), SessionItemWidget::currentItem(), SessionItemWidget::hideEvent(), SessionItemWidget::setItem(), and SessionItemWidget::showEvent().
|
privateinherited |
Definition at line 65 of file ScientificPlot.h.
Referenced by ScientificPlot::plotType().
|
private |
Definition at line 106 of file SpecularPlot.h.
Referenced by replot(), and setUpdateTimerConnected().