BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ProjectionsPlot Class Reference

A customplot based widget to display projections of IntensityDataItem on X,Y axes. More...

Inheritance diagram for ProjectionsPlot:
[legend]
Collaboration diagram for ProjectionsPlot:
[legend]

Public Slots

void onMarginsChanged (double left, double right)
 

Public Member Functions

 ProjectionsPlot (const QString &projectionType, QWidget *parent=0)
 
 ~ProjectionsPlot ()
 
virtual QList< QAction * > actionList ()
 
SessionItemcurrentItem ()
 
const SessionItemcurrentItem () const
 
virtual void setItem (SessionItem *item)
 

Protected Member Functions

virtual void hideEvent (QHideEvent *)
 
void onProjectionPropertyChanged (SessionItem *item, const QString &property)
 
virtual void showEvent (QShowEvent *)
 
void subscribeToItem ()
 
void unsubscribeFromItem ()
 

Private Member Functions

void clearProjection (SessionItem *item)
 Removes plot corresponding to given projection item. More...
 
void clearProjections ()
 Clears all graphs corresponding to projection items. More...
 
QCPGraph * graphForItem (SessionItem *item)
 
IntensityDataItemintensityItem ()
 
bool isHorizontalType ()
 Returns true, if widget is intended for horizontal projections. More...
 
void onAxisPropertyChanged (const QString &axisName, const QString &propertyName)
 Updates zoom of projections in accordance with IntensityDataItem. More...
 
void onIntensityItemPropertyChanged (const QString &propertyName)
 Updates projection appearance (line style, etc) More...
 
ProjectionContainerItemprojectionContainerItem ()
 
QVector< SessionItem * > projectionItems ()
 
void replot ()
 
void setGraphFromItem (QCPGraph *graph, SessionItem *item)
 Sets the data to graph from given projection iten. More...
 
void setInterpolate (bool isInterpolated)
 
void setLogz (bool isLogz)
 
void unsubscribeFromChildren ()
 
void updateAxesRange ()
 Updates canva's axes to match current zoom level of IntensityDataItem. More...
 
void updateAxesTitle ()
 
void updateProjections ()
 Runs through all projection items and generates missed plots. More...
 
void updateProjectionsData ()
 Creates cached 2D histogram for later projection calculations. More...
 

Private Attributes

bool m_block_plot_update
 
QCustomPlot * m_customPlot
 
std::unique_ptr< Histogram2Dm_hist2d
 
QMap< SessionItem *, QCPGraph * > m_item_to_graph
 
SessionItemControllerm_itemController
 
QString m_projectionType
 

Detailed Description

A customplot based widget to display projections of IntensityDataItem on X,Y axes.

Definition at line 30 of file ProjectionsPlot.h.

Constructor & Destructor Documentation

◆ ProjectionsPlot()

ProjectionsPlot::ProjectionsPlot ( const QString &  projectionType,
QWidget *  parent = 0 
)

Definition at line 26 of file ProjectionsPlot.cpp.

27  : SessionItemWidget(parent)
28  , m_projectionType(projectionType)
29  , m_customPlot(new QCustomPlot)
30  , m_block_plot_update(false)
31 {
32  QVBoxLayout* vlayout = new QVBoxLayout(this);
33  vlayout->setMargin(0);
34  vlayout->setSpacing(0);
35  vlayout->addWidget(m_customPlot);
36  setLayout(vlayout);
37 
38  m_customPlot->xAxis->setTickLabelFont(
39  QFont(QFont().family(), Constants::plot_tick_label_size()));
40  m_customPlot->yAxis->setTickLabelFont(
41  QFont(QFont().family(), Constants::plot_tick_label_size()));
42 
44 }
QCustomPlot * m_customPlot
QString m_projectionType
SessionItemWidget(QWidget *parent=0)
void setDefaultMargins(QCustomPlot *customPlot)
Sets default margins for axes rectangle plot.
int plot_tick_label_size()

References m_customPlot, Constants::plot_tick_label_size(), and ColorMapUtils::setDefaultMargins().

Here is the call graph for this function:

◆ ~ProjectionsPlot()

ProjectionsPlot::~ProjectionsPlot ( )

Definition at line 46 of file ProjectionsPlot.cpp.

47 {
49 }
void unsubscribeFromChildren()

References unsubscribeFromChildren().

Here is the call graph for this function:

Member Function Documentation

◆ actionList()

QList< QAction * > SessionItemWidget::actionList ( )
virtualinherited

◆ clearProjection()

void ProjectionsPlot::clearProjection ( SessionItem item)
private

Removes plot corresponding to given projection item.

Definition at line 232 of file ProjectionsPlot.cpp.

233 {
234  if (auto graph = graphForItem(item)) {
235  m_block_plot_update = true;
236  m_customPlot->removePlottable(graph);
237  m_item_to_graph.remove(item);
238  replot();
239  m_block_plot_update = false;
240  }
241 }
QCPGraph * graphForItem(SessionItem *item)
QMap< SessionItem *, QCPGraph * > m_item_to_graph

References graphForItem(), m_block_plot_update, m_customPlot, m_item_to_graph, and replot().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ clearProjections()

void ProjectionsPlot::clearProjections ( )
private

Clears all graphs corresponding to projection items.

Definition at line 218 of file ProjectionsPlot.cpp.

219 {
220  m_block_plot_update = true;
221 
222  m_customPlot->clearPlottables();
223  m_item_to_graph.clear();
224 
225  replot();
226 
227  m_block_plot_update = false;
228 }

References m_block_plot_update, m_customPlot, m_item_to_graph, and replot().

Referenced by unsubscribeFromItem().

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

◆ graphForItem()

QCPGraph * ProjectionsPlot::graphForItem ( SessionItem item)
private

Definition at line 144 of file ProjectionsPlot.cpp.

145 {
146  if (item->modelType() != m_projectionType)
147  return nullptr;
148 
149  QCPGraph* graph = m_item_to_graph[item];
150  if (!graph) {
151  graph = m_customPlot->addGraph();
152  QPen pen;
153  pen.setColor(QColor(0, 0, 255, 200));
154  graph->setLineStyle(intensityItem()->isInterpolated() ? QCPGraph::lsLine
155  : QCPGraph::lsStepCenter);
156  graph->setPen(pen);
157  m_item_to_graph[item] = graph;
158  }
159 
160  return graph;
161 }
IntensityDataItem * intensityItem()
QString modelType() const
Get model type.

References intensityItem(), m_customPlot, m_item_to_graph, m_projectionType, and SessionItem::modelType().

Referenced by clearProjection(), onProjectionPropertyChanged(), and updateProjections().

Here is the call graph for this function:

◆ 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:

◆ intensityItem()

IntensityDataItem * ProjectionsPlot::intensityItem ( )
private

Definition at line 124 of file ProjectionsPlot.cpp.

125 {
126  IntensityDataItem* result = dynamic_cast<IntensityDataItem*>(currentItem());
127  ASSERT(result);
128  return result;
129 }
#define ASSERT(condition)
Definition: Assert.h:31

References ASSERT, and SessionItemWidget::currentItem().

Referenced by graphForItem(), onAxisPropertyChanged(), onIntensityItemPropertyChanged(), projectionContainerItem(), subscribeToItem(), updateAxesRange(), updateAxesTitle(), and updateProjectionsData().

Here is the call graph for this function:

◆ isHorizontalType()

bool ProjectionsPlot::isHorizontalType ( )
private

Returns true, if widget is intended for horizontal projections.

Definition at line 312 of file ProjectionsPlot.cpp.

313 {
314  return m_projectionType == "HorizontalLineMask";
315 }

References m_projectionType.

Referenced by updateAxesRange(), and updateAxesTitle().

◆ onAxisPropertyChanged()

void ProjectionsPlot::onAxisPropertyChanged ( const QString &  axisName,
const QString &  propertyName 
)
private

Updates zoom of projections in accordance with IntensityDataItem.

Definition at line 255 of file ProjectionsPlot.cpp.

256 {
257  Q_UNUSED(axisName);
258 
259  if (propertyName == BasicAxisItem::P_MIN_DEG || propertyName == BasicAxisItem::P_MAX_DEG)
260  updateAxesRange();
261  else if (propertyName == BasicAxisItem::P_TITLE)
262  updateAxesTitle();
263  else if (propertyName == AmplitudeAxisItem::P_IS_LOGSCALE)
264  setLogz(intensityItem()->isLogz());
265 
266  replot();
267 }
static const QString P_IS_LOGSCALE
Definition: AxesItems.h:55
static const QString P_MAX_DEG
Definition: AxesItems.h:28
static const QString P_TITLE
Definition: AxesItems.h:29
static const QString P_MIN_DEG
Definition: AxesItems.h:27
void updateAxesRange()
Updates canva's axes to match current zoom level of IntensityDataItem.
void setLogz(bool isLogz)

References intensityItem(), AmplitudeAxisItem::P_IS_LOGSCALE, BasicAxisItem::P_MAX_DEG, BasicAxisItem::P_MIN_DEG, BasicAxisItem::P_TITLE, replot(), setLogz(), updateAxesRange(), and updateAxesTitle().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ onIntensityItemPropertyChanged()

void ProjectionsPlot::onIntensityItemPropertyChanged ( const QString &  propertyName)
private

Updates projection appearance (line style, etc)

Definition at line 245 of file ProjectionsPlot.cpp.

246 {
247  if (propertyName == IntensityDataItem::P_IS_INTERPOLATED) {
248  setInterpolate(intensityItem()->isInterpolated());
249  replot();
250  }
251 }
static const QString P_IS_INTERPOLATED
void setInterpolate(bool isInterpolated)

References intensityItem(), IntensityDataItem::P_IS_INTERPOLATED, replot(), and setInterpolate().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ onMarginsChanged

void ProjectionsPlot::onMarginsChanged ( double  left,
double  right 
)
slot

Definition at line 51 of file ProjectionsPlot.cpp.

52 {
53  QMargins orig = m_customPlot->axisRect()->margins();
54  m_customPlot->axisRect()->setMargins(QMargins(left, orig.top(), right, orig.bottom()));
55  replot();
56 }

References m_customPlot, and replot().

Referenced by ProjectionsWidget::onMarginsChanged().

Here is the call graph for this function:

◆ onProjectionPropertyChanged()

void ProjectionsPlot::onProjectionPropertyChanged ( SessionItem item,
const QString &  property 
)
protected

Definition at line 107 of file ProjectionsPlot.cpp.

108 {
110  return;
111 
112  m_block_plot_update = true;
113 
114  if (property == HorizontalLineItem::P_POSY || property == VerticalLineItem::P_POSX) {
115  if (auto graph = graphForItem(item))
116  setGraphFromItem(graph, item);
117 
118  replot();
119  }
120 
121  m_block_plot_update = false;
122 }
static const QString P_POSY
Definition: MaskItems.h:81
void setGraphFromItem(QCPGraph *graph, SessionItem *item)
Sets the data to graph from given projection iten.
static const QString P_POSX
Definition: MaskItems.h:73

References graphForItem(), m_block_plot_update, VerticalLineItem::P_POSX, HorizontalLineItem::P_POSY, replot(), and setGraphFromItem().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ projectionContainerItem()

ProjectionContainerItem * ProjectionsPlot::projectionContainerItem ( )
private

Definition at line 131 of file ProjectionsPlot.cpp.

132 {
133  ProjectionContainerItem* result = dynamic_cast<ProjectionContainerItem*>(
135  ASSERT(result);
136  return result;
137 }
static const QString T_PROJECTIONS
A container to hold ProjectionItems, intended to store projections of color map on X,...
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.

References ASSERT, SessionItem::getItem(), intensityItem(), and IntensityDataItem::T_PROJECTIONS.

Referenced by projectionItems(), subscribeToItem(), and unsubscribeFromChildren().

Here is the call graph for this function:

◆ projectionItems()

QVector< SessionItem * > ProjectionsPlot::projectionItems ( )
private

Definition at line 139 of file ProjectionsPlot.cpp.

140 {
142 }
ProjectionContainerItem * projectionContainerItem()
QVector< SessionItem * > getChildrenOfType(const QString &model_type) const
Returns a vector of all children of the given type.

References SessionItem::getChildrenOfType(), m_projectionType, and projectionContainerItem().

Referenced by updateProjections().

Here is the call graph for this function:

◆ replot()

void ProjectionsPlot::replot ( )
private

◆ setGraphFromItem()

void ProjectionsPlot::setGraphFromItem ( QCPGraph *  graph,
SessionItem item 
)
private

Sets the data to graph from given projection iten.

Definition at line 271 of file ProjectionsPlot.cpp.

272 {
273  std::unique_ptr<Histogram1D> hist;
274 
275  if (item->modelType() == "HorizontalLineMask") {
276  double value = item->getItemValue(HorizontalLineItem::P_POSY).toDouble();
277  hist.reset(m_hist2d->projectionX(value));
278  } else {
279  double value = item->getItemValue(VerticalLineItem::P_POSX).toDouble();
280  hist.reset(m_hist2d->projectionY(value));
281  }
282 
283 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
284  auto centers = hist->binCenters();
285  auto values = hist->binValues();
286  graph->setData(QVector<double>(centers.begin(), centers.end()),
287  QVector<double>(values.begin(), values.end()));
288 #else
289  graph->setData(QVector<double>::fromStdVector(hist->binCenters()),
290  QVector<double>::fromStdVector(hist->binValues()));
291 #endif
292 }
std::unique_ptr< Histogram2D > m_hist2d
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
QVector< double > fromStdVector(const std::vector< double > &data)
Definition: GUIHelpers.cpp:225

References GUIHelpers::fromStdVector(), SessionItem::getItemValue(), m_hist2d, SessionItem::modelType(), VerticalLineItem::P_POSX, and HorizontalLineItem::P_POSY.

Referenced by onProjectionPropertyChanged(), and updateProjections().

Here is the call graph for this function:

◆ setInterpolate()

void ProjectionsPlot::setInterpolate ( bool  isInterpolated)
private

Definition at line 294 of file ProjectionsPlot.cpp.

295 {
296  for (auto graph : m_item_to_graph)
297  graph->setLineStyle(isInterpolated ? QCPGraph::lsLine : QCPGraph::lsStepCenter);
298 }

References m_item_to_graph.

Referenced by onIntensityItemPropertyChanged().

◆ 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:

◆ setLogz()

void ProjectionsPlot::setLogz ( bool  isLogz)
private

Definition at line 300 of file ProjectionsPlot.cpp.

301 {
302  ColorMapUtils::setLogz(m_customPlot->yAxis, isLogz);
303 }
void setLogz(QCPColorScale *scale, bool isLogz)

References m_customPlot, and ColorMapUtils::setLogz().

Referenced by onAxisPropertyChanged(), and updateProjectionsData().

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:

◆ subscribeToItem()

void ProjectionsPlot::subscribeToItem ( )
protectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 58 of file ProjectionsPlot.cpp.

59 {
60  // Update projection plot on new item appearance
62  [this](SessionItem* item) {
63  if (item)
65  },
66  this);
67 
68  // Remove projection plot
70  [this](SessionItem* item) { clearProjection(item); }, this);
71 
72  // Update projection position
74  [this](SessionItem* item, const QString& name) { onProjectionPropertyChanged(item, name); },
75  this);
76 
77  // Values of intensity changed, regenerate everything.
79  [this]() {
82  },
83  this);
84 
85  // IntensityItem property (e.g. interpolation changed)
87  [this](const QString& name) { onIntensityItemPropertyChanged(name); }, this);
88 
89  // Update to changed IntensityDataItem axes
91  [this](SessionItem* item, const QString name) {
92  if (item->modelType() == "BasicAxis" || item->modelType() == "AmplitudeAxis")
94  },
95  this);
96 
99 }
void setOnValueChange(std::function< void(void)> f, const void *caller=0)
Definition: ModelMapper.cpp:30
void setOnChildPropertyChange(std::function< void(SessionItem *, QString)> f, const void *caller=0)
Calls back on child property change, report childItem and property name.
Definition: ModelMapper.cpp:49
void setOnAboutToRemoveChild(std::function< void(SessionItem *)> f, const void *caller=0)
Definition: ModelMapper.cpp:92
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=0)
Definition: ModelMapper.cpp:35
void setOnChildrenChange(std::function< void(SessionItem *)> f, const void *caller=0)
Calls back when number of children has changed, reports newChild.
Definition: ModelMapper.cpp:68
void updateProjectionsData()
Creates cached 2D histogram for later projection calculations.
void onIntensityItemPropertyChanged(const QString &propertyName)
Updates projection appearance (line style, etc)
void clearProjection(SessionItem *item)
Removes plot corresponding to given projection item.
void updateProjections()
Runs through all projection items and generates missed plots.
void onAxisPropertyChanged(const QString &axisName, const QString &propertyName)
Updates zoom of projections in accordance with IntensityDataItem.
void onProjectionPropertyChanged(SessionItem *item, const QString &property)
QString itemName() const
Get item name, return display name if no name is set.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString const & name(EShape k)
Definition: particles.cpp:21

References clearProjection(), intensityItem(), SessionItem::itemName(), SessionItem::mapper(), SessionItem::modelType(), RealSpace::Particles::name(), onAxisPropertyChanged(), onIntensityItemPropertyChanged(), onProjectionPropertyChanged(), projectionContainerItem(), ModelMapper::setOnAboutToRemoveChild(), ModelMapper::setOnChildPropertyChange(), ModelMapper::setOnChildrenChange(), ModelMapper::setOnPropertyChange(), ModelMapper::setOnValueChange(), updateProjections(), and updateProjectionsData().

Here is the call graph for this function:

◆ unsubscribeFromChildren()

void ProjectionsPlot::unsubscribeFromChildren ( )
private

Definition at line 163 of file ProjectionsPlot.cpp.

164 {
165  if (currentItem())
167 }
void unsubscribe(const void *caller)
Cancells all subscribtion of given caller.
Definition: ModelMapper.cpp:98

References SessionItemWidget::currentItem(), SessionItem::mapper(), projectionContainerItem(), and ModelMapper::unsubscribe().

Referenced by ~ProjectionsPlot(), and unsubscribeFromItem().

Here is the call graph for this function:

◆ unsubscribeFromItem()

void ProjectionsPlot::unsubscribeFromItem ( )
protectedvirtual

Reimplemented from SessionItemWidget.

Definition at line 101 of file ProjectionsPlot.cpp.

102 {
105 }
void clearProjections()
Clears all graphs corresponding to projection items.

References clearProjections(), and unsubscribeFromChildren().

Here is the call graph for this function:

◆ updateAxesRange()

void ProjectionsPlot::updateAxesRange ( )
private

Updates canva's axes to match current zoom level of IntensityDataItem.

Definition at line 198 of file ProjectionsPlot.cpp.

199 {
200  if (isHorizontalType())
202  else
204 
206 }
bool isHorizontalType()
Returns true, if widget is intended for horizontal projections.
QCPRange itemDataZoom(const IntensityDataItem *item)
Returns z-axis visible range (zoom).
QCPRange itemZoomY(const IntensityDataItem *item)
Returns y-axis vizible range (zoom).
QCPRange itemZoomX(const IntensityDataItem *item)
Returns x-axis vizible range (zoom).

References intensityItem(), isHorizontalType(), ColorMapUtils::itemDataZoom(), ColorMapUtils::itemZoomX(), ColorMapUtils::itemZoomY(), and m_customPlot.

Referenced by onAxisPropertyChanged(), and updateProjectionsData().

Here is the call graph for this function:

◆ updateAxesTitle()

void ProjectionsPlot::updateAxesTitle ( )
private

Definition at line 208 of file ProjectionsPlot.cpp.

209 {
210  if (isHorizontalType())
211  m_customPlot->xAxis->setLabel(intensityItem()->getXaxisTitle());
212  else
213  m_customPlot->xAxis->setLabel(intensityItem()->getYaxisTitle());
214 }

References intensityItem(), isHorizontalType(), and m_customPlot.

Referenced by onAxisPropertyChanged(), and updateProjectionsData().

Here is the call graph for this function:

◆ updateProjections()

void ProjectionsPlot::updateProjections ( )
private

Runs through all projection items and generates missed plots.

Definition at line 181 of file ProjectionsPlot.cpp.

182 {
184  return;
185 
186  m_block_plot_update = true;
187 
188  for (auto projItem : projectionItems())
189  setGraphFromItem(graphForItem(projItem), projItem);
190 
191  replot();
192 
193  m_block_plot_update = false;
194 }
QVector< SessionItem * > projectionItems()

References graphForItem(), m_block_plot_update, projectionItems(), replot(), and setGraphFromItem().

Referenced by subscribeToItem().

Here is the call graph for this function:

◆ updateProjectionsData()

void ProjectionsPlot::updateProjectionsData ( )
private

Creates cached 2D histogram for later projection calculations.

Definition at line 171 of file ProjectionsPlot.cpp.

172 {
173  m_hist2d = std::make_unique<Histogram2D>(*intensityItem()->getOutputData());
174  updateAxesRange();
175  updateAxesTitle();
176  setLogz(intensityItem()->isLogz());
177 }

References intensityItem(), m_hist2d, setLogz(), updateAxesRange(), and updateAxesTitle().

Referenced by subscribeToItem().

Here is the call graph for this function:

Member Data Documentation

◆ m_block_plot_update

bool ProjectionsPlot::m_block_plot_update
private

◆ m_customPlot

QCustomPlot* ProjectionsPlot::m_customPlot
private

◆ m_hist2d

std::unique_ptr<Histogram2D> ProjectionsPlot::m_hist2d
private

Definition at line 73 of file ProjectionsPlot.h.

Referenced by setGraphFromItem(), and updateProjectionsData().

◆ m_item_to_graph

QMap<SessionItem*, QCPGraph*> ProjectionsPlot::m_item_to_graph
private

Definition at line 74 of file ProjectionsPlot.h.

Referenced by clearProjection(), clearProjections(), graphForItem(), and setInterpolate().

◆ m_itemController

◆ m_projectionType

QString ProjectionsPlot::m_projectionType
private

Definition at line 71 of file ProjectionsPlot.h.

Referenced by graphForItem(), isHorizontalType(), and projectionItems().


The documentation for this class was generated from the following files: