qCC version 2.13.alpha (Qt) - 31 May 2022
Main CloudCompare application (GUI & command line)
Public Types | Signals | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ccHistogramWindow Class Reference

Histogram widget. More...

#include <ccHistogramWindow.h>

Inheritance diagram for ccHistogramWindow:
Inheritance graph
[legend]
Collaboration diagram for ccHistogramWindow:
Collaboration graph
[legend]

Public Types

enum  HISTOGRAM_COLOR_SCHEME { USE_SOLID_COLOR , USE_CUSTOM_COLOR_SCALE , USE_SF_SCALE }
 
enum class  AxisDisplayOption { None = 0x0 , XAxis = 0x01 , YAxis = 0x02 , All = XAxis | YAxis }
 
enum class  SFInteractionMode { None = 0x0 , DisplayRange = 0x01 , SaturationRange = 0x02 , All = DisplayRange | SaturationRange }
 

Signals

void sfMinDispValChanged (double)
 
void sfMaxDispValChanged (double)
 
void sfMinSatValChanged (double)
 
void sfMaxSatValChanged (double)
 

Public Member Functions

 ccHistogramWindow (QWidget *parent=0)
 Default constructor.
 
virtual ~ccHistogramWindow ()
 Destructor.
 
void setTitle (const QString &str)
 Sets title.
 
void setAxisLabels (const QString &xLabel, const QString &yLabel)
 Sets axis labels.
 
void fromSF (ccScalarField *sf, unsigned initialNumberOfClasses=0, bool numberOfClassesCanBeChanged=true, bool showNaNValuesInGrey=true)
 Computes histogram from a scalar field. More...
 
void fromBinArray (const std::vector< unsigned > &histoValues, double minVal, double maxVal)
 Creates histogram from a bin array (each bin = number of elements per class) More...
 
void setCurveValues (const std::vector< double > &curveValues)
 Sets overlay curve values. More...
 
void setColorScheme (HISTOGRAM_COLOR_SCHEME scheme)
 Sets how the gradient bars should be colored.
 
void setSolidColor (QColor color)
 Sets solid color. More...
 
void setColorScale (ccColorScale::Shared scale)
 Sets gradient color scale. More...
 
void clear ()
 Clears the display.
 
void refresh ()
 Updates the display.
 
void refreshBars ()
 Updates the histogram bars only. More...
 
const std::vector< unsigned > & histoValues () const
 Returns the current histogram bins.
 
double minVal () const
 Returns the current histogram min value.
 
double maxVal () const
 Returns the current histogram max value.
 
void setSFInteractionMode (SFInteractionModes modes)
 Enables SF interaction mode.
 
void setAxisDisplayOption (AxisDisplayOptions axisOptions)
 
void setRefreshAfterResize (bool refreshAfterResize)
 
void setMinDispValue (double)
 
void setMaxDispValue (double)
 
void setMinSatValue (double)
 
void setMaxSatValue (double)
 

Protected Types

enum  SELECTABLE_ITEMS {
  NONE , LEFT_AREA , RIGHT_AREA , BOTH_AREAS ,
  LEFT_ARROW , RIGHT_ARROW , BOTH_ARROWS
}
 Selectable items in "SF interaction" mode.
 

Protected Member Functions

void setNumberOfClasses (size_t n)
 Changes the current number of classes. More...
 
void mousePressEvent (QMouseEvent *event)
 
void mouseMoveEvent (QMouseEvent *event)
 
void wheelEvent (QWheelEvent *event)
 
void resizeEvent (QResizeEvent *event)
 
unsigned getMaxHistoVal ()
 Returns current maximum bin size.
 
void clearInternal ()
 Clears internal structures.
 
bool computeBinArrayFromSF (size_t binCount)
 Dynamically computes histogram bins from scalar field.
 
void updateOverlayCurveWidth (int w, int h)
 Updates overlay curve width depending on the widget display size.
 

Protected Attributes

QString m_titleStr
 
QCPTextElement * m_titlePlot
 
HISTOGRAM_COLOR_SCHEME m_colorScheme
 Color scheme.
 
QColor m_solidColor
 Solid color.
 
ccColorScale::Shared m_colorScale
 Gradient color scale.
 
ccScalarField * m_associatedSF
 Associated scalar field.
 
bool m_numberOfClassesCanBeChanged
 
bool m_refreshAfterResize
 
QCPColoredBarsm_histogram
 
std::vector< unsigned > m_histoValues
 
double m_minVal
 
double m_maxVal
 
unsigned m_maxHistoVal
 
QCPGraph * m_overlayCurve
 Overlay curve.
 
std::vector< double > m_curveValues
 
QCPBarsWithTextm_vertBar
 
bool m_drawVerticalIndicator
 
double m_verticalIndicatorPositionPercent
 
QFont m_renderingFont
 Rendering font.
 
AxisDisplayOptions m_axisDisplayOptions
 
SFInteractionModes m_sfInteractionModes
 Which SF interaction modes are enabled.
 
SELECTABLE_ITEMS m_selectedItem
 Currently selected item.
 
QCPHiddenAream_areaLeft
 Left greyed area.
 
double m_areaLeftlastValue
 
QCPHiddenAream_areaRight
 Right greyed area.
 
double m_areaRightlastValue
 
QCPArrowm_arrowLeft
 Left arrow.
 
double m_arrowLeftlastValue
 
QCPArrowm_arrowRight
 Right arrow.
 
double m_arrowRightlastValue
 
QPoint m_lastMouseClick
 Last mouse click.
 

Detailed Description

Histogram widget.

Member Function Documentation

◆ fromBinArray()

void ccHistogramWindow::fromBinArray ( const std::vector< unsigned > &  histoValues,
double  minVal,
double  maxVal 
)

Creates histogram from a bin array (each bin = number of elements per class)

Number of classes can't be modified.

Parameters
histoValuesarray of bins
minValminimum value
maxValmaximum value

◆ fromSF()

void ccHistogramWindow::fromSF ( ccScalarField *  sf,
unsigned  initialNumberOfClasses = 0,
bool  numberOfClassesCanBeChanged = true,
bool  showNaNValuesInGrey = true 
)

Computes histogram from a scalar field.

Number of classes can be freely modified afterwards (if enabled).

Parameters
sfassociated scalar field
initialNumberOfClassesinitial number of classes
numberOfClassesCanBeChangedwhether to allow the user to modify the number of classes
showNaNValuesInGreyshow NaN values (in gray)

◆ refreshBars()

void ccHistogramWindow::refreshBars ( )

Updates the histogram bars only.

Only works if a SF is associated and color scheme is USE_SF_SCALE.

◆ setColorScale()

void ccHistogramWindow::setColorScale ( ccColorScale::Shared  scale)
inline

Sets gradient color scale.

Only used if color scheme is set to USE_CUSTOM_COLOR_SCALE.

◆ setCurveValues()

void ccHistogramWindow::setCurveValues ( const std::vector< double > &  curveValues)

Sets overlay curve values.

The curve will only appear over an histogram

Parameters
curveValuescurve points 'Y' coordinates only (regularly sampled between the min and max histogram values)

◆ setNumberOfClasses()

void ccHistogramWindow::setNumberOfClasses ( size_t  n)
protected

Changes the current number of classes.

Warning: n should be a multiple of 4.

◆ setSolidColor()

void ccHistogramWindow::setSolidColor ( QColor  color)
inline

Sets solid color.

Only used if color scheme is set to USE_SOLID_COLOR.

Member Data Documentation

◆ m_numberOfClassesCanBeChanged

bool ccHistogramWindow::m_numberOfClassesCanBeChanged
protected

Only possible with an associated scalar field.


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