qCC_db version 2.13.alpha (Qt) - 31 May 2022
CloudCompare 3D entities
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ccScalarField Class Reference

A scalar field associated to display-related parameters. More...

#include <ccScalarField.h>

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

Classes

struct  Histogram
 Simple histogram structure. More...
 
class  Range
 Scalar field range structure. More...
 

Public Member Functions

 ccScalarField (const char *name=nullptr)
 Default constructor. More...
 
 ccScalarField (const ccScalarField &sf)
 Copy constructor. More...
 
const RangedisplayRange () const
 Access to the range of displayed values. More...
 
const RangesaturationRange () const
 Access to the range of saturation values. More...
 
const RangelogSaturationRange () const
 Access to the range of log scale saturation values. More...
 
void setMinDisplayed (ScalarType val)
 Sets the minimum displayed value.
 
void setMaxDisplayed (ScalarType val)
 Sets the maximum displayed value.
 
void setSaturationStart (ScalarType val)
 Sets the value at which to start color gradient.
 
void setSaturationStop (ScalarType val)
 Sets the value at which to stop color gradient.
 
const ccColor::RgbgetColor (ScalarType value) const
 Returns the color corresponding to a given value (wrt to the current display parameters) More...
 
const ccColor::RgbgetValueColor (unsigned index) const
 Shortcut to getColor.
 
void showNaNValuesInGrey (bool state)
 Sets whether NaN/out of displayed range values should be displayed in grey or hidden.
 
bool areNaNValuesShownInGrey () const
 Returns whether NaN values are displayed in grey or hidden.
 
void alwaysShowZero (bool state)
 Sets whether 0 should always appear in associated color ramp or not.
 
bool isZeroAlwaysShown () const
 Returns whether 0 should always appear in associated color ramp or not.
 
void setSymmetricalScale (bool state)
 Sets whether the color scale should be symmetrical or not. More...
 
bool symmetricalScale () const
 Returns whether the color scale s symmetrical or not. More...
 
void setLogScale (bool state)
 Sets whether scale is logarithmic or not.
 
bool logScale () const
 Returns whether scalar field is logarithmic or not.
 
void computeMinAndMax () override
 
const ccColorScale::SharedgetColorScale () const
 Returns associated color scale.
 
void setColorScale (ccColorScale::Shared scale)
 Sets associated color scale.
 
unsigned getColorRampSteps () const
 Returns number of color ramp steps.
 
void setColorRampSteps (unsigned steps)
 Sets number of color ramp steps used for display.
 
const HistogramgetHistogram () const
 Returns associated histogram values (for display)
 
bool mayHaveHiddenValues () const
 Returns whether the scalar field in its current configuration MAY have 'hidden' values or not. More...
 
void setModificationFlag (bool state)
 Sets modification flag state.
 
bool getModificationFlag () const
 Returns modification flag state.
 
void importParametersFrom (const ccScalarField *sf)
 Imports the parameters from another scalar field.
 
bool isSerializable () const override
 Returns whether object is serializable of not. More...
 
bool toFile (QFile &out) const override
 Saves data to binary stream. More...
 
bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
 Loads data from binary stream. More...
 
double getGlobalShift () const
 Returns the global shift (if any)
 
void setGlobalShift (double shift)
 Sets the global shift.
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()=default
 Destructor.
 
virtual bool isSerializable () const
 Returns whether object is serializable of not. More...
 
virtual bool toFile (QFile &out) const
 Saves data to binary stream. More...
 
virtual bool fromFile (QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
 Loads data from binary stream. More...
 

Protected Member Functions

 ~ccScalarField () override=default
 Default destructor. More...
 
void updateSaturationBounds ()
 Updates saturation values.
 
ScalarType normalize (ScalarType val) const
 Normalizes a scalar value between 0 and 1 (wrt to current parameters) More...
 

Protected Attributes

Range m_displayRange
 Displayed values range.
 
Range m_saturationRange
 Saturation values range. More...
 
Range m_logSaturationRange
 saturation values range (log scale mode) More...
 
bool m_showNaNValuesInGrey
 Whether NaN values are shown in grey or are hidden.
 
bool m_symmetricalScale
 Whether color scale is symmetrical or not. More...
 
bool m_logScale
 Whether scale is logarithmic or not.
 
bool m_alwaysShowZero
 Whether 0 should always appear in associated color ramp.
 
ccColorScale::Shared m_colorScale
 Active color ramp (for display)
 
unsigned m_colorRampSteps
 Number of color ramps steps (for display)
 
Histogram m_histogram
 Associated histogram values (for display)
 
bool m_modified
 Modification flag. More...
 
double m_globalShift
 Global shift.
 

Additional Inherited Members

- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS = 1 , DF_SCALAR_VAL_32_BITS = 2 }
 Deserialization flags (bit-field) More...
 
typedef QMultiMap< unsigned, unsigned > LoadedIDMap
 Map of loaded unique IDs (old ID --> new ID)
 
- Static Public Member Functions inherited from ccSerializableObject
static bool WriteError ()
 Sends a custom error message (write error) and returns 'false'. More...
 
static bool ReadError ()
 Sends a custom error message (read error) and returns 'false'. More...
 
static bool MemoryError ()
 Sends a custom error message (not enough memory) and returns 'false'. More...
 
static bool CorruptError ()
 Sends a custom error message (corrupted file) and returns 'false'. More...
 

Detailed Description

A scalar field associated to display-related parameters.

Extends the CCCoreLib::ScalarField object.

Constructor & Destructor Documentation

◆ ccScalarField() [1/2]

ccScalarField::ccScalarField ( const char *  name = nullptr)
explicit

Default constructor.

Parameters
namescalar field name

◆ ccScalarField() [2/2]

ccScalarField::ccScalarField ( const ccScalarField sf)

Copy constructor.

Parameters
sfscalar field to copy
Warning
May throw a std::bad_alloc exception

◆ ~ccScalarField()

ccScalarField::~ccScalarField ( )
overrideprotecteddefault

Default destructor.

Call release instead

Member Function Documentation

◆ displayRange()

const Range & ccScalarField::displayRange ( ) const
inline

Access to the range of displayed values.

Values outside of the [start;stop] interval will either be grey or invisible (see showNaNValuesInGrey).

◆ fromFile()

bool ccScalarField::fromFile ( QFile &  in,
short  dataVersion,
int  flags,
LoadedIDMap oldToNewIDMap 
)
overridevirtual

Loads data from binary stream.

Parameters
ininput file (already opened)
dataVersionfile version
flagsdeserialization flags (see ccSerializableObject::DeserializationFlags)
oldToNewIDMapmap to link old IDs with new IDs
Returns
success

Reimplemented from ccSerializableObject.

◆ getColor()

const ccColor::Rgb * ccScalarField::getColor ( ScalarType  value) const
inline

Returns the color corresponding to a given value (wrt to the current display parameters)

Warning: must no be called if the SF is not associated to a color scale!

◆ isSerializable()

bool ccScalarField::isSerializable ( ) const
inlineoverridevirtual

Returns whether object is serializable of not.

Reimplemented from ccSerializableObject.

◆ logSaturationRange()

const Range & ccScalarField::logSaturationRange ( ) const
inline

Access to the range of log scale saturation values.

Relative color scales will only be applied to values inside the [start;stop] interval.

◆ mayHaveHiddenValues()

bool ccScalarField::mayHaveHiddenValues ( ) const

Returns whether the scalar field in its current configuration MAY have 'hidden' values or not.

'Hidden' values are typically NaN values or values outside of the 'displayed' interval while those values are not displayed in grey (see ccScalarField::showNaNValuesInGrey).

◆ normalize()

ScalarType ccScalarField::normalize ( ScalarType  val) const
protected

Normalizes a scalar value between 0 and 1 (wrt to current parameters)

Parameters
valscalar value
Returns
a number between 0 and 1 if inside displayed range or -1 otherwise

ValidValue(d) ||

◆ saturationRange()

const Range & ccScalarField::saturationRange ( ) const
inline

Access to the range of saturation values.

Relative color scales will only be applied to values inside the [start;stop] interval.

◆ setSymmetricalScale()

void ccScalarField::setSymmetricalScale ( bool  state)

Sets whether the color scale should be symmetrical or not.

For relative color scales only.

◆ symmetricalScale()

bool ccScalarField::symmetricalScale ( ) const
inline

Returns whether the color scale s symmetrical or not.

For relative color scales only.

◆ toFile()

bool ccScalarField::toFile ( QFile &  out) const
overridevirtual

Saves data to binary stream.

Parameters
outoutput file (already opened)
Returns
success

Reimplemented from ccSerializableObject.

Member Data Documentation

◆ m_logSaturationRange

Range ccScalarField::m_logSaturationRange
protected

saturation values range (log scale mode)

For log scale color mapping with relative scales.

◆ m_modified

bool ccScalarField::m_modified
protected

Modification flag.

Any modification to the scalar field values or parameters will turn this flag on.

◆ m_saturationRange

Range ccScalarField::m_saturationRange
protected

Saturation values range.

For color mapping with relative scales.

◆ m_symmetricalScale

bool ccScalarField::m_symmetricalScale
protected

Whether color scale is symmetrical or not.

For relative color scales only.


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