BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
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.
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... | |
void | initScatter () |
Adds scatter ro real data plot. 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 | |
void | hideEvent (QHideEvent *) override |
void | showEvent (QShowEvent *) override |
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. Also sets logarithmic scale on y-axis if necessary. 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 *specularItem) |
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 |
|
stronginherited |
Enumerator | |
---|---|
Plot1D | |
Plot2D |
Definition at line 31 of file ScientificPlot.h.
|
explicit |
Definition at line 33 of file SpecularPlot.cpp.
References initPlot(), m_custom_plot, and ScientificPlot::setMouseTrackingEnabled().
|
virtualinherited |
Reimplemented in IntensityDataProjectionsWidget, SpecularDataWidget, SpecularDataCanvas, FitComparisonWidget1D, FitComparisonWidget, IntensityDataWidget, IntensityDataCanvas, SpecularDataImportWidget, 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 52 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by Plot1D::eventInfo(), eventInfo(), and ColorMap::eventInfo().
|
inherited |
Definition at line 41 of file SessionItemWidget.cpp.
Referenced by FitFlowWidget::fitSuiteItem(), RealDataMaskWidget::intensityDataItem(), IntensityDataCanvas::intensityDataItem(), IntensityDataWidget::intensityDataItem(), IntensityDataProjectionsWidget::intensityDataItem(), ProjectionsPlot::intensityItem(), ColorMap::intensityItem(), JobResultsPresenter::itemPresentation(), FitParameterWidget::jobItem(), ParameterTuningWidget::jobItem(), RunFitControlWidget::jobItem(), FitComparisonWidget::jobItem(), FitComparisonWidget1D::jobItem(), IntensityDataPropertyWidget::jobItem(), SpecularDataPropertyWidget::jobItem(), SpecularDataImportWidget::realDataItem(), ItemComboWidget::setPresentation(), JobResultsPresenter::setPresentation(), SpecularDataImportWidget::specularDataItem(), SpecularDataCanvas::specularDataItem(), SpecularDataWidget::specularDataItem(), specularItem(), ItemComboWidget::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 51 of file SpecularPlot.cpp.
References ScientificPlot::axesRangeContains(), m_custom_plot, ScientificPlot::plotType(), PlotEventInfo::setInAxesRange(), PlotEventInfo::setNx(), PlotEventInfo::setValue(), PlotEventInfo::setX(), specularItem(), and PlotEventInfo::x().
|
overrideprotectedinherited |
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 135 of file SpecularPlot.cpp.
References m_custom_plot, and GUI::Constants::plot_tick_label_size().
Referenced by SpecularPlot().
void SpecularPlot::initScatter | ( | ) |
Adds scatter ro real data plot.
Definition at line 149 of file SpecularPlot.cpp.
References m_custom_plot, and specularItem().
Referenced by SpecularPlotCanvas::initScatter().
|
inlineoverride |
Definition at line 39 of file SpecularPlot.h.
|
private |
Definition at line 263 of file SpecularPlot.cpp.
References BasicAxisItem::isBoundsPropertiesName(), AmplitudeAxisItem::isLogScalePropertyName(), BasicAxisItem::isTitlePropertyName(), BasicAxisItem::isTitleVisiblePropertyName(), SpecularDataItem::isXaxisPropertyName(), SpecularDataItem::isYaxisPropertyName(), m_block_update, m_custom_plot, replot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setLog(), and specularItem().
Referenced by subscribeToItem().
|
privateslot |
updates plot depending on IntensityDataItem properties
Definition at line 77 of file SpecularPlot.cpp.
References DataItem::isAxesUnitsPropertyName(), m_block_update, replot(), setAxesRangeFromItem(), and specularItem().
Referenced by subscribeToItem().
|
privateslot |
Replots SpecularPlot.
Definition at line 104 of file SpecularPlot.cpp.
References m_custom_plot.
Referenced by setUpdateTimerConnected().
|
privateslot |
Propagate xmin, xmax back to IntensityDataItem.
Definition at line 88 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 96 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 37 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ScientificPlotEvent::currentPlotDescriptor(), and ColorMapSceneAdaptor::fromSceneX().
|
inherited |
Definition at line 42 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 Plot1D::eventInfo(), eventInfo(), ColorMap::eventInfo(), and FontScalingEvent::setTickLabelFont().
|
private |
Schedule replot for later execution by onTimeReplot() slot.
Definition at line 296 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 72 of file SpecularPlot.cpp.
References SpecularDataItem::resetView(), and specularItem().
|
private |
Sets X,Y axes labels from item.
Definition at line 223 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 165 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 211 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 159 of file SpecularPlot.cpp.
References setAxesRangeConnected(), and setUpdateTimerConnected().
Referenced by subscribeToItem(), and unsubscribeFromItem().
|
private |
Sets the intensity values to SpecularPlot.
Definition at line 238 of file SpecularPlot.cpp.
References DataItem::getDatafield(), and m_custom_plot.
Referenced by setPlotFromItem().
|
virtualinherited |
Reimplemented in SpecularPlotCanvas, SpecularDataImportWidget, SpecularDataWidget, IntensityDataWidget, JobResultsPresenter, ItemComboWidget, ProjectionsWidget, SpecularDataCanvas, IntensityDataCanvas, ColorMapCanvas, and Plot1DCanvas.
Definition at line 28 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, SessionItemController::setItem(), and SessionItemController::subscribe().
Referenced by MaskGraphicsProxy::setIntensityItem(), FitSessionWidget::setItem(), Plot1DCanvas::setItem(), ColorMapCanvas::setItem(), IntensityDataCanvas::setItem(), SpecularDataCanvas::setItem(), ProjectionsWidget::setItem(), ItemComboWidget::setItem(), IntensityDataWidget::setItem(), SpecularDataWidget::setItem(), SpecularDataImportWidget::setItem(), SpecularPlotCanvas::setItem(), ItemComboWidget::setPresentation(), FitComparisonWidget::subscribeToItem(), and FitComparisonWidget1D::subscribeToItem().
|
private |
Sets label to axis.
Definition at line 229 of file SpecularPlot.cpp.
References BasicAxisItem::isTitleVisible().
Referenced by setAxesLabelsFromItem().
void SpecularPlot::setLog | ( | bool | log | ) |
sets logarithmic scale
Definition at line 66 of file SpecularPlot.cpp.
References m_custom_plot, and GUI::View::RangeUtils::setLogz().
Referenced by modifyAxesProperties(), and setAxesRangeFromItem().
|
inherited |
Tracks move events (used when showing profile histograms and printing status string)
Definition at line 47 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 195 of file SpecularPlot.cpp.
References m_block_update, m_custom_plot, replot(), setAxesLabelsFromItem(), setAxesRangeFromItem(), setDataFromItem(), and specularItem().
Referenced by subscribeToItem().
|
private |
Definition at line 186 of file SpecularPlot.cpp.
References m_update_timer, onTimeToReplot(), and UpdateTimer::timeToUpdate().
Referenced by setConnected().
|
overrideprotectedinherited |
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 252 of file SpecularPlot.cpp.
Referenced by eventInfo(), initScatter(), modifyAxesProperties(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), resetView(), setPlotFromItem(), and subscribeToItem().
|
private |
Definition at line 257 of file SpecularPlot.cpp.
References SessionItemWidget::currentItem().
|
signalinherited |
Referenced by ScientificPlotEvent::onCustomMouseMove(), and PlotStatusLabel::setConnected().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 109 of file SpecularPlot.cpp.
References SessionItem::itemName(), BasicAxisItem::M_TYPE, AmplitudeAxisItem::M_TYPE, SessionItem::mapper(), SessionItem::modelType(), modifyAxesProperties(), GUI::RealSpace::Particles::name(), onPropertyChanged(), setConnected(), ModelMapper::setOnChildPropertyChange(), ModelMapper::setOnPropertyChange(), ModelMapper::setOnValueChange(), setPlotFromItem(), and specularItem().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 130 of file SpecularPlot.cpp.
References setConnected().
|
inherited |
transform axes coordinates to CustomPlot widget coordinates
Definition at line 27 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneX(), and ColorMap::viewportRectangleInWidgetCoordinates().
|
inherited |
Definition at line 32 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneY(), and ColorMap::viewportRectangleInWidgetCoordinates().
|
private |
Definition at line 111 of file SpecularPlot.h.
Referenced by modifyAxesProperties(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), and setPlotFromItem().
|
private |
Definition at line 108 of file SpecularPlot.h.
Referenced by SpecularPlot(), customPlot(), eventInfo(), initPlot(), initScatter(), 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 109 of file SpecularPlot.h.
Referenced by replot(), and setUpdateTimerConnected().