28 const int mLength = context.
mLength;
32 const double mMin = context.
mMin;
33 const double mMax = context.
mMax;
44 double UPP = (mHiddenMax - mHiddenMin) / mLength;
47 tickSizes.mDigits = 2;
49 double loLog = log10(mMin);
50 double hiLog = log10(mMax);
51 int loDecade = (int)floor(loLog);
54 double startDecade = pow(10., (
double)loDecade);
57 double decade = startDecade;
58 double delta = hiLog - loLog, steps = fabs(delta);
59 double step = delta >= 0 ? 10 : 0.1;
60 double rMin =
std::min(mMin, mMax), rMax = std::max(mMin, mMax);
61 for (
int i = 0; i <= steps; i++)
64 if (val >= rMin && val < rMax) {
65 const int pos(0.5 + mLength * numberScale.ValueToPosition(val));
66 Tick(dc, pos, val, tickSizes, mFonts.
major, majorOutputs, context);
74 float start,
end, mstep;
77 start = 2;
end = 10; mstep = 1;
81 start = 9;
end = 1; mstep = -1;
87 for (
int i = 0; i <= steps; i++) {
88 for (
int j = start; j !=
end; j += mstep) {
90 if (val >= rMin && val < rMax) {
91 const int pos(0.5 + mLength * numberScale.ValueToPosition(val));
92 Tick(dc, pos, val, tickSizes, mFonts.
minor, minorOutputs, context);
102 start = 10;
end = 100; mstep = 1;
106 start = 100;
end = 10; mstep = -1;
112 for (
int i = 0; i <= steps; i++) {
115 for (
int f = start; f != (int)(
end); f += mstep) {
116 if ((
int)(f / 10) != f / 10.0f) {
117 val = decade * f / 10;
118 if (val >= rMin && val < rMax) {
119 const int pos(0.5 + mLength * numberScale.ValueToPosition(val));
120 Tick(dc, pos, val, tickSizes,
121 mFonts.
minorMinor, minorMinorOutputs, context);
Piecewise linear or piecewise exponential function from double to double.
bool Tick(wxDC &dc, int pos, double d, const TickSizes &tickSizes, wxFont font, TickOutputs outputs, const RulerStruct &context) const
static const LogarithmicUpdater & Instance()
~LogarithmicUpdater() override
void Update(wxDC &dc, const Envelope *envelope, UpdateOutputs &allOutputs, const RulerStruct &context) const override
void BoxAdjust(UpdateOutputs &allOutputs, const RulerStruct &context) const
const char * end(const char *str) noexcept
std::unique_ptr< Fonts > mpFonts
const RulerFormat * mpRulerFormat
Labels & minorMinorLabels