BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The ColorMap class presents 2D intensity data from IntensityDataItem as color map.
Provides a minimal functionality for data plotting and axes interaction. Should be a component for more complicated plotting widgets. This is a replacement for ColorMapPlot.
Definition at line 36 of file ColorMap.h.
Public Types | |
enum class | PLOT_TYPE { Plot1D , Plot2D } |
Public Slots | |
void | resetView () |
reset all axes min,max to initial value More... | |
void | setLogz (bool logz) |
sets logarithmic scale More... | |
Signals | |
void | marginsChanged (double left, double right) |
void | statusString (const QString &text) |
Public Member Functions | |
ColorMap (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... | |
QCPColorScale * | colorScale () |
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... | |
virtual void | setItem (SessionItem *item) |
void | setMouseTrackingEnabled (bool enable) |
Tracks move events (used when showing profile histograms and printing status string) More... | |
QSize | sizeHint () const override |
QRectF | viewportRectangleInWidgetCoordinates () |
Returns rectangle representing current axes zoom state in widget coordinates. 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 |
void | subscribeToItem () override |
void | unsubscribeFromItem () override |
Private Slots | |
void | marginsChangedNotify () |
Calculates left, right margins around color map to report to projection plot. More... | |
void | onAxisPropertyChanged (const QString &axisName, const QString &propertyName) |
void | onDataRangeChanged (QCPRange newRange) |
Propagate zmin, zmax back to IntensityDataItem. More... | |
void | onIntensityModified () |
void | onPropertyChanged (const QString &property_name) |
updates color map depending on IntensityDataItem properties More... | |
void | onTimeToReplot () |
Replots ColorMap. More... | |
void | onXaxisRangeChanged (QCPRange newRange) |
Propagate xmin, xmax back to IntensityDataItem. More... | |
void | onYaxisRangeChanged (QCPRange newRange) |
Propagate ymin, ymax back to IntensityDataItem. More... | |
void | replot () |
Schedule replot for later execution by onTimeReplot() slot. More... | |
Private Member Functions | |
void | initColorMap () |
creates and initializes the color map More... | |
IntensityDataItem * | intensityItem () |
const IntensityDataItem * | intensityItem () const |
void | setAxesLabelsFromItem (IntensityDataItem *item) |
Sets X,Y axes labels from item. More... | |
void | setAxesRangeConnected (bool isConnected) |
Connects/disconnects signals related to ColorMap's X,Y axes rectangle change. More... | |
void | setAxesRangeFromItem (IntensityDataItem *item) |
Sets (xmin,xmax,nbins) and (ymin,ymax,nbins) of ColorMap from intensity item. More... | |
void | setAxesZoomFromItem (IntensityDataItem *item) |
Sets zoom range of X,Y axes as in intensity item. More... | |
void | setColorMapFromItem (IntensityDataItem *intensityItem) |
Sets initial state of ColorMap to match given intensity item. More... | |
void | setColorScaleAppearanceFromItem (IntensityDataItem *item) |
Sets the appearance of color scale (visibility, gradient type) from intensity item. More... | |
void | setColorScaleVisible (bool visibility_flag) |
void | setConnected (bool isConnected) |
void | setDataFromItem (IntensityDataItem *item) |
Sets the intensity values to ColorMap. More... | |
void | setDataRangeConnected (bool isConnected) |
Connects/disconnects signals related to ColorMap's Z-axis (min,max) change. More... | |
void | setDataRangeFromItem (IntensityDataItem *item) |
void | setFixedColorMapMargins () |
to make fixed margins for whole colormap (change in axes labels wont affect axes rectangle) More... | |
void | setUpdateTimerConnected (bool isConnected) |
Private Attributes | |
bool | m_block_update |
QCPLayoutGrid * | m_colorBarLayout |
QCPColorMap * | m_colorMap |
QCPColorScale * | m_colorScale |
QCustomPlot * | m_customPlot |
ScientificPlotEvent * | m_event |
SessionItemController * | m_itemController |
PLOT_TYPE | m_plot_type |
UpdateTimer * | m_updateTimer |
|
stronginherited |
Enumerator | |
---|---|
Plot1D | |
Plot2D |
Definition at line 31 of file ScientificPlot.h.
|
explicit |
Definition at line 31 of file ColorMap.cpp.
References initColorMap(), m_customPlot, 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(), SpecularPlot::eventInfo(), and eventInfo().
|
inline |
Definition at line 47 of file ColorMap.h.
References m_colorScale.
Referenced by FontScalingEvent::setTickLabelFont().
|
inherited |
Definition at line 41 of file SessionItemWidget.cpp.
Referenced by FitFlowWidget::fitSuiteItem(), RealDataMaskWidget::intensityDataItem(), IntensityDataCanvas::intensityDataItem(), IntensityDataWidget::intensityDataItem(), IntensityDataProjectionsWidget::intensityDataItem(), ProjectionsPlot::intensityItem(), 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(), SpecularPlot::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 45 of file ColorMap.h.
References m_customPlot.
Referenced by ColorMapCanvas::customPlot(), and MaskEditorCanvas::onSavePlotRequest().
|
overridevirtual |
Returns PlotEventInfo corresponding to given axes coordinates.
Implements ScientificPlot.
Definition at line 67 of file ColorMap.cpp.
References ScientificPlot::axesRangeContains(), intensityItem(), m_colorMap, PlotEventInfo::nx(), PlotEventInfo::ny(), ScientificPlot::plotType(), PlotEventInfo::setInAxesRange(), PlotEventInfo::setLogValueAxis(), PlotEventInfo::setNx(), PlotEventInfo::setNy(), PlotEventInfo::setValue(), PlotEventInfo::setX(), and PlotEventInfo::setY().
|
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 233 of file ColorMap.cpp.
References m_colorBarLayout, m_colorMap, m_colorScale, m_customPlot, marginsChangedNotify(), GUI::Constants::plot_colorbar_size(), GUI::Constants::plot_tick_label_size(), and GUI::Util::Style::SizeOfLetterM().
Referenced by ColorMap().
|
private |
Definition at line 443 of file ColorMap.cpp.
Referenced by eventInfo(), onAxisPropertyChanged(), onDataRangeChanged(), onIntensityModified(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), resetView(), setColorMapFromItem(), setColorScaleAppearanceFromItem(), and subscribeToItem().
|
private |
Definition at line 448 of file ColorMap.cpp.
References SessionItemWidget::currentItem().
|
signal |
Referenced by marginsChangedNotify(), and ProjectionsEditorCanvas::setConnected().
|
privateslot |
Calculates left, right margins around color map to report to projection plot.
Definition at line 428 of file ColorMap.cpp.
References m_colorBarLayout, m_customPlot, and marginsChanged().
Referenced by initColorMap().
|
inlineoverride |
Definition at line 43 of file ColorMap.h.
|
privateslot |
Definition at line 126 of file ColorMap.cpp.
References intensityItem(), BasicAxisItem::isBoundsPropertiesName(), AmplitudeAxisItem::isLogScalePropertyName(), BasicAxisItem::isTitlePropertyName(), BasicAxisItem::isTitleVisiblePropertyName(), BasicAxisItem::isVisibilityPropertyName(), IntensityDataItem::isXaxisPropertyName(), IntensityDataItem::isYaxisPropertyName(), IntensityDataItem::isZaxisPropertyName(), GUI::View::RangeUtils::itemZoomX(), GUI::View::RangeUtils::itemZoomY(), m_block_update, m_customPlot, replot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setColorScaleVisible(), setDataRangeFromItem(), and setLogz().
Referenced by subscribeToItem().
|
privateslot |
Propagate zmin, zmax back to IntensityDataItem.
Definition at line 168 of file ColorMap.cpp.
References intensityItem(), m_block_update, and IntensityDataItem::setLowerAndUpperZ().
Referenced by setDataRangeConnected().
|
privateslot |
Definition at line 101 of file ColorMap.cpp.
References intensityItem(), replot(), setAxesRangeFromItem(), and setDataFromItem().
Referenced by subscribeToItem().
|
privateslot |
updates color map depending on IntensityDataItem properties
Definition at line 109 of file ColorMap.cpp.
References intensityItem(), DataItem::isAxesUnitsPropertyName(), IntensityDataItem::isGradientPropertyName(), IntensityDataItem::isInterpolatedPropertyName(), GUI::View::RangeUtils::itemGradient(), m_block_update, m_colorMap, replot(), and setAxesRangeFromItem().
Referenced by subscribeToItem().
|
privateslot |
Replots ColorMap.
Definition at line 202 of file ColorMap.cpp.
References m_customPlot.
Referenced by setUpdateTimerConnected().
|
privateslot |
Propagate xmin, xmax back to IntensityDataItem.
Definition at line 176 of file ColorMap.cpp.
References intensityItem(), m_block_update, IntensityDataItem::setLowerX(), and IntensityDataItem::setUpperX().
Referenced by setAxesRangeConnected().
|
privateslot |
Propagate ymin, ymax back to IntensityDataItem.
Definition at line 185 of file ColorMap.cpp.
References intensityItem(), m_block_update, IntensityDataItem::setLowerY(), and IntensityDataItem::setUpperY().
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(), SpecularPlot::eventInfo(), eventInfo(), and FontScalingEvent::setTickLabelFont().
|
privateslot |
Schedule replot for later execution by onTimeReplot() slot.
Definition at line 195 of file ColorMap.cpp.
References m_updateTimer, and UpdateTimer::scheduleUpdate().
Referenced by onAxisPropertyChanged(), onIntensityModified(), onPropertyChanged(), and setColorMapFromItem().
|
slot |
reset all axes min,max to initial value
Definition at line 96 of file ColorMap.cpp.
References intensityItem(), and IntensityDataItem::resetView().
|
private |
Sets X,Y axes labels from item.
Definition at line 357 of file ColorMap.cpp.
References IntensityDataItem::getXaxisTitle(), IntensityDataItem::getYaxisTitle(), m_colorScale, m_customPlot, IntensityDataItem::xAxisItem(), and IntensityDataItem::yAxisItem().
Referenced by onAxisPropertyChanged(), and setColorMapFromItem().
|
private |
Connects/disconnects signals related to ColorMap's X,Y axes rectangle change.
Definition at line 267 of file ColorMap.cpp.
References m_customPlot, onXaxisRangeChanged(), and onYaxisRangeChanged().
Referenced by onAxisPropertyChanged(), setAxesZoomFromItem(), and setConnected().
|
private |
Sets (xmin,xmax,nbins) and (ymin,ymax,nbins) of ColorMap from intensity item.
Definition at line 336 of file ColorMap.cpp.
References GUI::View::RangeUtils::itemXrange(), GUI::View::RangeUtils::itemYrange(), m_colorMap, m_customPlot, IntensityDataItem::xSize(), and IntensityDataItem::ySize().
Referenced by onIntensityModified(), onPropertyChanged(), and setColorMapFromItem().
|
private |
Sets zoom range of X,Y axes as in intensity item.
Definition at line 347 of file ColorMap.cpp.
References IntensityDataItem::getLowerX(), IntensityDataItem::getLowerY(), IntensityDataItem::getUpperX(), IntensityDataItem::getUpperY(), m_customPlot, and setAxesRangeConnected().
Referenced by setColorMapFromItem().
|
private |
Sets initial state of ColorMap to match given intensity item.
Definition at line 316 of file ColorMap.cpp.
References intensityItem(), m_block_update, replot(), setAxesLabelsFromItem(), setAxesRangeFromItem(), setAxesZoomFromItem(), setColorScaleAppearanceFromItem(), setDataFromItem(), and setDataRangeFromItem().
Referenced by subscribeToItem().
|
private |
Sets the appearance of color scale (visibility, gradient type) from intensity item.
Definition at line 393 of file ColorMap.cpp.
References intensityItem(), GUI::View::RangeUtils::itemGradient(), m_colorMap, m_colorScale, m_customPlot, setColorScaleVisible(), BasicAxisItem::visibilityValue(), and IntensityDataItem::zAxisItem().
Referenced by setColorMapFromItem().
|
private |
Definition at line 413 of file ColorMap.cpp.
References m_colorBarLayout, and m_customPlot.
Referenced by onAxisPropertyChanged(), and setColorScaleAppearanceFromItem().
|
private |
Definition at line 258 of file ColorMap.cpp.
References setAxesRangeConnected(), setDataRangeConnected(), and setUpdateTimerConnected().
Referenced by subscribeToItem(), and unsubscribeFromItem().
|
private |
Sets the intensity values to ColorMap.
Definition at line 376 of file ColorMap.cpp.
References DataItem::getDatafield(), m_colorMap, IntensityDataItem::xSize(), and IntensityDataItem::ySize().
Referenced by onIntensityModified(), and setColorMapFromItem().
|
private |
Connects/disconnects signals related to ColorMap's Z-axis (min,max) change.
Definition at line 290 of file ColorMap.cpp.
References m_colorMap, and onDataRangeChanged().
Referenced by setConnected(), and setDataRangeFromItem().
|
private |
Definition at line 405 of file ColorMap.cpp.
References IntensityDataItem::isLogz(), GUI::View::RangeUtils::itemDataZoom(), m_colorMap, setDataRangeConnected(), and setLogz().
Referenced by onAxisPropertyChanged(), and setColorMapFromItem().
|
private |
to make fixed margins for whole colormap (change in axes labels wont affect axes rectangle)
Definition at line 309 of file ColorMap.cpp.
References m_customPlot, and GUI::View::RangeUtils::setDefaultMargins().
|
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().
|
slot |
sets logarithmic scale
Definition at line 89 of file ColorMap.cpp.
References m_colorBarLayout, m_colorScale, and GUI::View::RangeUtils::setLogz().
Referenced by onAxisPropertyChanged(), and setDataRangeFromItem().
|
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(), Plot1D::Plot1D(), SpecularPlot::SpecularPlot(), and PlotStatusLabel::setPlotLabelEnabled().
|
private |
Definition at line 299 of file ColorMap.cpp.
References m_updateTimer, 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 42 of file ColorMap.h.
|
signalinherited |
Referenced by ScientificPlotEvent::onCustomMouseMove(), and PlotStatusLabel::setConnected().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 207 of file ColorMap.cpp.
References intensityItem(), SessionItem::itemName(), BasicAxisItem::M_TYPE, AmplitudeAxisItem::M_TYPE, SessionItem::mapper(), SessionItem::modelType(), GUI::RealSpace::Particles::name(), onAxisPropertyChanged(), onIntensityModified(), onPropertyChanged(), setColorMapFromItem(), setConnected(), ModelMapper::setOnChildPropertyChange(), ModelMapper::setOnPropertyChange(), and ModelMapper::setOnValueChange().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 227 of file ColorMap.cpp.
References setConnected().
QRectF ColorMap::viewportRectangleInWidgetCoordinates | ( | ) |
Returns rectangle representing current axes zoom state in widget coordinates.
Definition at line 53 of file ColorMap.cpp.
References m_customPlot, ScientificPlot::xAxisCoordToPixel(), and ScientificPlot::yAxisCoordToPixel().
Referenced by ColorMapSceneAdaptor::eventFilter().
|
inherited |
transform axes coordinates to CustomPlot widget coordinates
Definition at line 27 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneX(), and viewportRectangleInWidgetCoordinates().
|
inherited |
Definition at line 32 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneY(), and viewportRectangleInWidgetCoordinates().
|
private |
Definition at line 106 of file ColorMap.h.
Referenced by onAxisPropertyChanged(), onDataRangeChanged(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), and setColorMapFromItem().
|
private |
Definition at line 104 of file ColorMap.h.
Referenced by initColorMap(), marginsChangedNotify(), setColorScaleVisible(), and setLogz().
|
private |
Definition at line 101 of file ColorMap.h.
Referenced by eventInfo(), initColorMap(), onPropertyChanged(), setAxesRangeFromItem(), setColorScaleAppearanceFromItem(), setDataFromItem(), setDataRangeConnected(), and setDataRangeFromItem().
|
private |
Definition at line 102 of file ColorMap.h.
Referenced by colorScale(), initColorMap(), setAxesLabelsFromItem(), setColorScaleAppearanceFromItem(), and setLogz().
|
private |
Definition at line 100 of file ColorMap.h.
Referenced by ColorMap(), customPlot(), initColorMap(), marginsChangedNotify(), onAxisPropertyChanged(), onTimeToReplot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setAxesRangeFromItem(), setAxesZoomFromItem(), setColorScaleAppearanceFromItem(), setColorScaleVisible(), setFixedColorMapMargins(), and viewportRectangleInWidgetCoordinates().
|
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 103 of file ColorMap.h.
Referenced by replot(), and setUpdateTimerConnected().