39 Range() : m_min(0), m_start(0), m_stop(0), m_max(0), m_range(1) {}
42 inline ScalarType
min()
const {
return m_min; }
43 inline ScalarType
start()
const {
return m_start; }
44 inline ScalarType
stop()
const {
return m_stop; }
45 inline ScalarType
max()
const {
return m_max; }
46 inline ScalarType
range()
const {
return m_range; }
47 inline ScalarType
maxRange()
const {
return m_max - m_min; }
52 bool resetStartStop =
true) {
53 assert(minVal <= maxVal);
60 m_start = inbound(m_start);
61 m_stop = inbound(m_stop);
67 m_start = inbound(value);
68 if (m_stop < m_start) m_stop = m_start;
72 m_stop = inbound(value);
73 if (m_stop < m_start) m_start = m_stop;
78 inline ScalarType
inbound(ScalarType val)
const {
79 return (val < m_min ? m_min : (val > m_max ? m_max : val));
83 return (val >= m_min && val <= m_max);
87 return (val >= m_start && val <= m_stop);
115 return m_logScale ? m_logSaturationRange : m_saturationRange;
123 return m_logSaturationRange;
127 void setMinDisplayed(ScalarType val);
129 void setMaxDisplayed(ScalarType val);
131 void setSaturationStart(ScalarType val);
133 void setSaturationStop(ScalarType val);
140 assert(m_colorScale);
141 return m_colorScale->getColorByRelativePos(
142 normalize(value), m_colorRampSteps,
153 void showNaNValuesInGrey(
bool state);
157 return m_showNaNValuesInGrey;
161 void alwaysShowZero(
bool state);
169 void setSymmetricalScale(
bool state);
177 void setLogScale(
bool state);
180 inline bool logScale()
const {
return m_logScale; }
197 void setColorRampSteps(
unsigned steps);
202 unsigned maxValue = 0;
214 bool mayHaveHiddenValues()
const;
226 bool toFile(QFile& out,
short dataVersion)
const override;
231 LoadedIDMap& oldToNewIDMap)
override;
245 void updateSaturationBounds();
252 ScalarType normalize(ScalarType val)
const;
constexpr ScalarType ZERO_TOLERANCE_SCALAR
QSharedPointer< ccColorScale > Shared
Shared pointer type.
Scalar field range structure.
Range()
Default constructor.
void setStop(ScalarType value)
bool isInbound(ScalarType val) const
Returns whether a value is inbound or not.
ScalarType maxRange() const
void updateRange()
Updates actual range.
ScalarType inbound(ScalarType val) const
Returns the nearest inbound value.
bool isInRange(ScalarType val) const
Returns whether a value is inside range or not.
void setBounds(ScalarType minVal, ScalarType maxVal, bool resetStartStop=true)
void setStart(ScalarType value)
A scalar field associated to display-related parameters.
const ccColorScale::Shared & getColorScale() const
Returns associated color scale.
Range m_logSaturationRange
saturation values range (log scale mode)
double m_globalShift
Global shift.
bool getModificationFlag() const
Returns modification flag state.
bool isSerializable() const override
Returns whether object is serializable of not.
bool m_showNaNValuesInGrey
Whether NaN values are shown in grey or are hidden.
bool logScale() const
Returns whether scalar field is logarithmic or not.
void setGlobalShift(double shift)
Sets the global shift.
unsigned getColorRampSteps() const
Returns number of color ramp steps.
Range m_displayRange
Displayed values range.
double getGlobalShift() const
Returns the global shift (if any)
Histogram m_histogram
Associated histogram values (for display)
unsigned m_colorRampSteps
Number of color ramps steps (for display)
bool m_alwaysShowZero
Whether 0 should always appear in associated color ramp.
const Range & saturationRange() const
Access to the range of saturation values.
const Histogram & getHistogram() const
Returns associated histogram values (for display)
bool m_symmetricalScale
Whether color scale is symmetrical or not.
~ccScalarField() override=default
Default destructor.
const Range & displayRange() const
Access to the range of displayed values.
const ecvColor::Rgb * getColor(ScalarType value) const
bool m_logScale
Whether scale is logarithmic or not.
void setModificationFlag(bool state)
Sets modification flag state.
bool symmetricalScale() const
Returns whether the color scale s symmetrical or not.
const Range & logSaturationRange() const
Access to the range of log scale saturation values.
bool m_modified
Modification flag.
const ecvColor::Rgb * getValueColor(unsigned index) const
Shortcut to getColor.
Range m_saturationRange
Saturation values range.
bool areNaNValuesShownInGrey() const
Returns whether NaN values are displayed in gray or hidden.
bool isZeroAlwaysShown() const
Returns whether 0 should always appear in associated color ramp or not.
ccColorScale::Shared m_colorScale
Active color ramp (for display)
Serializable object interface.
virtual short minimumFileVersion() const =0
Returns the minimum file version required to save this instance.
virtual bool toFile(QFile &out, short dataVersion) const
Saves data to binary stream.
virtual bool fromFile(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap)
Loads data from binary stream.
A simple scalar field (to be associated to a point cloud)
virtual void computeMinAndMax()
Determines the min and max values.
ScalarType & getValue(std::size_t index)
constexpr Rgb lightGrey(static_cast< ColorCompType >(MAX *0.8), static_cast< ColorCompType >(MAX *0.8), static_cast< ColorCompType >(MAX *0.8))
Simple histogram structure.