24 #include <qcustomplot.h>
28 , m_projectionType(projectionType)
29 , m_customPlot(new QCustomPlot)
30 , m_block_plot_update(false)
32 QVBoxLayout* vlayout =
new QVBoxLayout(
this);
33 vlayout->setMargin(0);
34 vlayout->setSpacing(0);
54 m_customPlot->axisRect()->setMargins(QMargins(left, orig.top(), right, orig.bottom()));
153 pen.setColor(QColor(0, 0, 255, 200));
154 graph->setLineStyle(
intensityItem()->isInterpolated() ? QCPGraph::lsLine
155 : QCPGraph::lsStepCenter);
273 std::unique_ptr<Histogram1D> hist;
275 if (item->
modelType() ==
"HorizontalLineMask") {
277 hist.reset(
m_hist2d->projectionX(value));
280 hist.reset(
m_hist2d->projectionY(value));
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()));
297 graph->setLineStyle(isInterpolated ? QCPGraph::lsLine : QCPGraph::lsStepCenter);
#define ASSERT(condition)
Defines various axis items.
Defines ColorMapUtils namespace.
Defines class Histogram1D.
Defines class Histogram2D.
Defines class IntensityDataItem.
Defines MaskItems classes.
Defines items related to projections over color map.
Defines class ProjectionsPlot.
static const QString P_IS_LOGSCALE
static const QString P_MAX_DEG
static const QString P_TITLE
static const QString P_MIN_DEG
static const QString P_POSY
static const QString T_PROJECTIONS
static const QString P_IS_INTERPOLATED
void unsubscribe(const void *caller)
Cancells all subscribtion of given caller.
void setOnValueChange(std::function< void(void)> f, const void *caller=0)
void setOnChildPropertyChange(std::function< void(SessionItem *, QString)> f, const void *caller=0)
Calls back on child property change, report childItem and property name.
void setOnAboutToRemoveChild(std::function< void(SessionItem *)> f, const void *caller=0)
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=0)
void setOnChildrenChange(std::function< void(SessionItem *)> f, const void *caller=0)
Calls back when number of children has changed, reports newChild.
A container to hold ProjectionItems, intended to store projections of color map on X,...
QCustomPlot * m_customPlot
void updateProjectionsData()
Creates cached 2D histogram for later projection calculations.
std::unique_ptr< Histogram2D > m_hist2d
IntensityDataItem * intensityItem()
void onIntensityItemPropertyChanged(const QString &propertyName)
Updates projection appearance (line style, etc)
QVector< SessionItem * > projectionItems()
void clearProjection(SessionItem *item)
Removes plot corresponding to given projection item.
void setGraphFromItem(QCPGraph *graph, SessionItem *item)
Sets the data to graph from given projection iten.
void onMarginsChanged(double left, double right)
ProjectionsPlot(const QString &projectionType, QWidget *parent=0)
void unsubscribeFromItem()
void unsubscribeFromChildren()
void updateAxesRange()
Updates canva's axes to match current zoom level of IntensityDataItem.
void setLogz(bool isLogz)
QCPGraph * graphForItem(SessionItem *item)
QMap< SessionItem *, QCPGraph * > m_item_to_graph
bool isHorizontalType()
Returns true, if widget is intended for horizontal projections.
void updateProjections()
Runs through all projection items and generates missed plots.
ProjectionContainerItem * projectionContainerItem()
void onAxisPropertyChanged(const QString &axisName, const QString &propertyName)
Updates zoom of projections in accordance with IntensityDataItem.
void setInterpolate(bool isInterpolated)
void clearProjections()
Clears all graphs corresponding to projection items.
void onProjectionPropertyChanged(SessionItem *item, const QString &property)
QString itemName() const
Get item name, return display name if no name is set.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QVector< SessionItem * > getChildrenOfType(const QString &model_type) const
Returns a vector of all children of the given type.
QString modelType() const
Get model type.
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
static const QString P_POSX
QCPRange itemDataZoom(const IntensityDataItem *item)
Returns z-axis visible range (zoom).
QCPRange itemZoomY(const IntensityDataItem *item)
Returns y-axis vizible range (zoom).
void setDefaultMargins(QCustomPlot *customPlot)
Sets default margins for axes rectangle plot.
QCPRange itemZoomX(const IntensityDataItem *item)
Returns x-axis vizible range (zoom).
void setLogz(QCPColorScale *scale, bool isLogz)
int plot_tick_label_size()
QVector< double > fromStdVector(const std::vector< double > &data)
QString const & name(EShape k)
Defines various constants for plotting.