|
Scroom 0.14-49-gb7ae7a6d
|
#include <ruler.hh>

Static Public Member Functions | |
| static int | calculateInterval (double lower, double upper, double allocatedSize) |
| static int | intervalPixelSpacing (double interval, double lower, double upper, double allocatedSize) |
| static int | firstTick (double lower, int interval) |
| static double | scaleToRange (double x, double src_lower, double src_upper, double dest_lower, double dest_upper) |
Static Public Attributes | |
| static constexpr int | MIN_SPACE_MAJORTICKS {80} |
Static Private Attributes | |
| static constexpr std::array< int, 4 > | VALID_INTERVALS {1, 5, 10, 25} |
This class contains the functions a Ruler uses to calculate the interval between major ticks.
|
static |
Calculates an appropriate interval between major ticks on a ruler.
| lower | Lower limit of the ruler range. Must be strictly less than upper. |
| upper | Upper limit of the ruler range. Must be strictly greater than lower. |
| allocatedSize | The allocated width/height in pixels for the ruler. |
Referenced by testCorrectIntervalForMinWidth(), and Ruler::updateMajorTickInterval().


|
static |
Returns the position in the ruler range to start drawing from.
| lower | The lower limit of the ruler range. |
| interval | The interval between major ticks that the ruler will be drawn with. |
Referenced by Ruler::draw().

|
static |
Calculates the spacing in pixels between tick marks for a given interval.
| interval | The interval to calculate the spacing for. |
| lower | Lower limit of the ruler range. Must be strictly less than upper. |
| upper | Upper limit of the ruler range. Must be strictly greater than lower. |
| allocatedSize | The allocated width/height in pixels for the ruler. Must be greater than 0. |
Referenced by calculateInterval(), and Ruler::updateMajorTickInterval().

|
static |
Scales a number x in the range [src_lower, src_upper] to the range [dest_lower, dest_upper]. Used to scale from the ruler range to the drawing space.
| x | The number to scale. |
| src_lower | The lower limit of the source range. Inclusive. |
| src_upper | The upper limit of the source range. Inclusive. |
| dest_lower | The lower limit of the destination range. Inclusive. |
| dest_upper | The upper limit of the destination range. Inclusive. |
x scaled from range source to dest. Referenced by Ruler::drawTicks().

|
staticconstexpr |
The minimum space between major ticks.
Referenced by calculateInterval(), and testCorrectIntervalForMinWidth().
|
staticconstexprprivate |