BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The ColorMap class presents 2D intensity data from IntensityDataItem as color map. More...
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 | |
virtual void | hideEvent (QHideEvent *) |
virtual void | showEvent (QShowEvent *) |
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 |
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.
|
stronginherited |
Enumerator | |
---|---|
Plot1D | |
Plot2D |
Definition at line 31 of file ScientificPlot.h.
|
explicit |
Definition at line 30 of file ColorMap.cpp.
References initColorMap(), m_customPlot, 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 eventInfo(), Plot1D::eventInfo(), and SpecularPlot::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 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(), 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().
|
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 65 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().
|
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 234 of file ColorMap.cpp.
References m_colorBarLayout, m_colorMap, m_colorScale, m_customPlot, marginsChangedNotify(), Constants::plot_colorbar_size(), Constants::plot_tick_label_size(), and StyleUtils::SizeOfLetterM().
Referenced by ColorMap().
|
private |
Definition at line 445 of file ColorMap.cpp.
Referenced by eventInfo(), onAxisPropertyChanged(), onDataRangeChanged(), onIntensityModified(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), resetView(), setColorMapFromItem(), setColorScaleAppearanceFromItem(), and subscribeToItem().
|
private |
Definition at line 450 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 430 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 124 of file ColorMap.cpp.
References intensityItem(), ColorMapUtils::itemZoomX(), ColorMapUtils::itemZoomY(), m_block_update, m_customPlot, AmplitudeAxisItem::P_IS_LOGSCALE, BasicAxisItem::P_IS_VISIBLE, BasicAxisItem::P_MAX_DEG, BasicAxisItem::P_MIN_DEG, BasicAxisItem::P_TITLE, BasicAxisItem::P_TITLE_IS_VISIBLE, IntensityDataItem::P_XAXIS, IntensityDataItem::P_YAXIS, IntensityDataItem::P_ZAXIS, replot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setColorScaleVisible(), setDataRangeFromItem(), and setLogz().
Referenced by subscribeToItem().
|
privateslot |
Propagate zmin, zmax back to IntensityDataItem.
Definition at line 170 of file ColorMap.cpp.
References intensityItem(), m_block_update, and IntensityDataItem::setLowerAndUpperZ().
Referenced by setDataRangeConnected().
|
privateslot |
Definition at line 99 of file ColorMap.cpp.
References intensityItem(), replot(), setAxesRangeFromItem(), and setDataFromItem().
Referenced by subscribeToItem().
|
privateslot |
updates color map depending on IntensityDataItem properties
Definition at line 107 of file ColorMap.cpp.
References intensityItem(), ColorMapUtils::itemGradient(), m_block_update, m_colorMap, DataItem::P_AXES_UNITS, IntensityDataItem::P_GRADIENT, IntensityDataItem::P_IS_INTERPOLATED, replot(), and setAxesRangeFromItem().
Referenced by subscribeToItem().
|
privateslot |
Replots ColorMap.
Definition at line 204 of file ColorMap.cpp.
References m_customPlot.
Referenced by setUpdateTimerConnected().
|
privateslot |
Propagate xmin, xmax back to IntensityDataItem.
Definition at line 178 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 187 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 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 eventInfo(), Plot1D::eventInfo(), SpecularPlot::eventInfo(), and FontScalingEvent::setTickLabelFont().
|
privateslot |
Schedule replot for later execution by onTimeReplot() slot.
Definition at line 197 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 94 of file ColorMap.cpp.
References intensityItem(), and IntensityDataItem::resetView().
|
private |
Sets X,Y axes labels from item.
Definition at line 358 of file ColorMap.cpp.
References IntensityDataItem::getXaxisTitle(), IntensityDataItem::getYaxisTitle(), m_colorScale, m_customPlot, BasicAxisItem::P_TITLE_IS_VISIBLE, 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 268 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 338 of file ColorMap.cpp.
References IntensityDataItem::getNbinsX(), IntensityDataItem::getNbinsY(), ColorMapUtils::itemXrange(), ColorMapUtils::itemYrange(), m_colorMap, and m_customPlot.
Referenced by onIntensityModified(), onPropertyChanged(), and setColorMapFromItem().
|
private |
Sets zoom range of X,Y axes as in intensity item.
Definition at line 348 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 318 of file ColorMap.cpp.
References ASSERT, 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 394 of file ColorMap.cpp.
References SessionItem::getItem(), SessionItem::getItemValue(), intensityItem(), ColorMapUtils::itemGradient(), m_colorMap, m_colorScale, m_customPlot, BasicAxisItem::P_IS_VISIBLE, IntensityDataItem::P_ZAXIS, and setColorScaleVisible().
Referenced by setColorMapFromItem().
|
private |
Definition at line 416 of file ColorMap.cpp.
References m_colorBarLayout, and m_customPlot.
Referenced by onAxisPropertyChanged(), and setColorScaleAppearanceFromItem().
|
private |
Definition at line 259 of file ColorMap.cpp.
References setAxesRangeConnected(), setDataRangeConnected(), and setUpdateTimerConnected().
Referenced by subscribeToItem(), and unsubscribeFromItem().
|
private |
Sets the intensity values to ColorMap.
Definition at line 377 of file ColorMap.cpp.
References IntensityDataItem::getNbinsX(), IntensityDataItem::getNbinsY(), DataItem::getOutputData(), and m_colorMap.
Referenced by onIntensityModified(), and setColorMapFromItem().
|
private |
Connects/disconnects signals related to ColorMap's Z-axis (min,max) change.
Definition at line 292 of file ColorMap.cpp.
References m_colorMap, and onDataRangeChanged().
Referenced by setConnected(), and setDataRangeFromItem().
|
private |
Definition at line 408 of file ColorMap.cpp.
References IntensityDataItem::isLogz(), ColorMapUtils::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 311 of file ColorMap.cpp.
References m_customPlot, and ColorMapUtils::setDefaultMargins().
|
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().
|
slot |
sets logarithmic scale
Definition at line 87 of file ColorMap.cpp.
References m_colorBarLayout, m_colorScale, and ColorMapUtils::setLogz().
Referenced by onAxisPropertyChanged(), and setDataRangeFromItem().
|
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(), Plot1D::Plot1D(), SpecularPlot::SpecularPlot(), and PlotStatusLabel::setPlotLabelEnabled().
|
private |
Definition at line 301 of file ColorMap.cpp.
References m_updateTimer, 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 42 of file ColorMap.h.
|
signalinherited |
Referenced by ScientificPlotEvent::onCustomMouseMove(), and PlotStatusLabel::setConnected().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 209 of file ColorMap.cpp.
References intensityItem(), SessionItem::itemName(), SessionItem::mapper(), SessionItem::modelType(), RealSpace::Particles::name(), onAxisPropertyChanged(), onIntensityModified(), onPropertyChanged(), setColorMapFromItem(), setConnected(), ModelMapper::setOnChildPropertyChange(), ModelMapper::setOnPropertyChange(), and ModelMapper::setOnValueChange().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 228 of file ColorMap.cpp.
References setConnected().
QRectF ColorMap::viewportRectangleInWidgetCoordinates | ( | ) |
returns rectangle representing current axes zoom state in widget coordinates
Definition at line 51 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 25 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneX(), and viewportRectangleInWidgetCoordinates().
|
inherited |
Definition at line 30 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().