svcore
1.9
|
#include <RangeMapper.h>
Public Member Functions | |
LogRangeMapper (int minpos, int maxpos, double minval, double maxval, QString m_unit="", bool inverted=false) | |
Map values in range minval->maxval into integer range minpos->maxpos such that logs of the values are mapped linearly. More... | |
int | getPositionForValue (double value) const override |
Return the position that maps to the given value, rounding to the nearest position and clamping to the minimum and maximum extents of the mapper's positional range. More... | |
int | getPositionForValueUnclamped (double value) const override |
Return the position that maps to the given value, rounding to the nearest position, without clamping. More... | |
double | getValueForPosition (int position) const override |
Return the value mapped from the given position, clamping to the minimum and maximum extents of the mapper's value range. More... | |
double | getValueForPositionUnclamped (int position) const override |
Return the value mapped from the given position, without clamping. More... | |
QString | getUnit () const override |
Get the unit of the mapper's value range. More... | |
virtual QString | getLabel (int) const |
The mapper may optionally provide special labels for one or more individual positions (such as the minimum position, the default, or indeed all positions). More... | |
Static Public Member Functions | |
static void | convertRatioMinLog (double ratio, double minlog, int minpos, int maxpos, double &minval, double &maxval) |
static void | convertMinMax (int minpos, int maxpos, double minval, double maxval, double &minlog, double &ratio) |
Protected Attributes | |
int | m_minpos |
int | m_maxpos |
double | m_ratio |
double | m_minlog |
double | m_maxlog |
QString | m_unit |
bool | m_inverted |
Detailed Description
Definition at line 111 of file RangeMapper.h.
Constructor & Destructor Documentation
LogRangeMapper::LogRangeMapper | ( | int | minpos, |
int | maxpos, | ||
double | minval, | ||
double | maxval, | ||
QString | m_unit = "" , |
||
bool | inverted = false |
||
) |
Map values in range minval->maxval into integer range minpos->maxpos such that logs of the values are mapped linearly.
minval must be greater than zero, and minval and minpos must be less than maxval and maxpos respectively. If inverted is true, the range will be mapped "backwards" (minval to maxpos and maxval to minpos).
Definition at line 94 of file RangeMapper.cpp.
References convertMinMax(), m_maxlog, m_maxpos, m_minlog, m_minpos, and m_ratio.
Member Function Documentation
|
static |
Definition at line 130 of file RangeMapper.cpp.
|
static |
Definition at line 119 of file RangeMapper.cpp.
Referenced by LogRangeMapper().
|
overridevirtual |
Return the position that maps to the given value, rounding to the nearest position and clamping to the minimum and maximum extents of the mapper's positional range.
Implements RangeMapper.
Definition at line 139 of file RangeMapper.cpp.
References getPositionForValueUnclamped(), m_maxpos, and m_minpos.
Referenced by AutoRangeMapper::chooseMappingTypeFor().
|
overridevirtual |
Return the position that maps to the given value, rounding to the nearest position, without clamping.
That is, whatever mapping function is in use will be projected even outside the minimum and maximum extents of the mapper's positional range. (The mapping outside that range is not guaranteed to be exact, except if the mapper is a linear one.)
Implements RangeMapper.
Definition at line 148 of file RangeMapper.cpp.
References m_inverted, m_maxpos, m_minlog, m_minpos, and m_ratio.
Referenced by getPositionForValue().
|
overridevirtual |
Return the value mapped from the given position, clamping to the minimum and maximum extents of the mapper's value range.
Implements RangeMapper.
Definition at line 158 of file RangeMapper.cpp.
References getValueForPositionUnclamped(), m_maxpos, and m_minpos.
|
overridevirtual |
Return the value mapped from the given position, without clamping.
That is, whatever mapping function is in use will be projected even outside the minimum and maximum extents of the mapper's value range. (The mapping outside that range is not guaranteed to be exact, except if the mapper is a linear one.)
Implements RangeMapper.
Definition at line 167 of file RangeMapper.cpp.
References m_inverted, m_maxpos, m_minlog, m_minpos, and m_ratio.
Referenced by getValueForPosition().
|
inlineoverridevirtual |
Get the unit of the mapper's value range.
Reimplemented from RangeMapper.
Definition at line 140 of file RangeMapper.h.
|
inlinevirtualinherited |
The mapper may optionally provide special labels for one or more individual positions (such as the minimum position, the default, or indeed all positions).
These should be used in any display context in preference to just showing the numerical value for the position. If a position has such a label, return it here.
Reimplemented in LinearRangeMapper.
Definition at line 74 of file RangeMapper.h.
Referenced by LinearRangeMapper::getUnit().
Member Data Documentation
|
protected |
Definition at line 143 of file RangeMapper.h.
Referenced by getPositionForValue(), getPositionForValueUnclamped(), getValueForPosition(), getValueForPositionUnclamped(), and LogRangeMapper().
|
protected |
Definition at line 144 of file RangeMapper.h.
Referenced by getPositionForValue(), getPositionForValueUnclamped(), getValueForPosition(), getValueForPositionUnclamped(), and LogRangeMapper().
|
protected |
Definition at line 145 of file RangeMapper.h.
Referenced by getPositionForValueUnclamped(), getValueForPositionUnclamped(), and LogRangeMapper().
|
protected |
Definition at line 146 of file RangeMapper.h.
Referenced by getPositionForValueUnclamped(), getValueForPositionUnclamped(), and LogRangeMapper().
|
protected |
Definition at line 147 of file RangeMapper.h.
Referenced by LogRangeMapper().
|
protected |
Definition at line 148 of file RangeMapper.h.
|
protected |
Definition at line 149 of file RangeMapper.h.
Referenced by getPositionForValueUnclamped(), and getValueForPositionUnclamped().
The documentation for this class was generated from the following files:
Generated by 1.8.11