#include <RealFormat.h>
|
| ~RealFormat () override |
|
void | SetTickSizes (double units, double &major, double &minor, double &minorMinor, int &mDigits) const override |
|
void | SetLabelString (wxString &s, double d, double units, double minor, int mDigits, TickType tickType) const override |
|
| RulerFormat () |
|
virtual | ~RulerFormat () |
|
virtual void | SetTickSizes (double units, double &major, double &minor, double &minorMinor, int &mDigits) const =0 |
|
virtual void | SetLabelString (wxString &s, double d, double units, double minor, int mDigits, TickType tickType) const =0 |
|
Definition at line 18 of file RealFormat.h.
◆ ~RealFormat()
RealFormat::~RealFormat |
( |
| ) |
|
|
overridedefault |
◆ RealFormat()
RealFormat::RealFormat |
( |
bool |
log | ) |
|
|
inlineprivate |
◆ LinearInstance()
◆ LogInstance()
◆ SetLabelString()
void RealFormat::SetLabelString |
( |
wxString & |
s, |
|
|
double |
d, |
|
|
double |
units, |
|
|
double |
minor, |
|
|
int |
mDigits, |
|
|
TickType |
tickType |
|
) |
| const |
|
overridevirtual |
Implements RulerFormat.
Definition at line 60 of file RealFormat.cpp.
63{
64
65 if (d < 0.0 && (d + minor > 0.0) && !
mLog)
66 d = 0.0;
67 if (minor >= 1.0)
68 s.Printf(
wxT(
"%d"), (
int)floor(d + 0.5));
69 else {
70 s.Printf(wxString::Format(
wxT(
"%%.%df"), mDigits), d);
71 }
72}
References mLog, and wxT().
◆ SetTickSizes()
void RealFormat::SetTickSizes |
( |
double |
units, |
|
|
double & |
major, |
|
|
double & |
minor, |
|
|
double & |
minorMinor, |
|
|
int & |
mDigits |
|
) |
| const |
|
overridevirtual |
Implements RulerFormat.
Definition at line 26 of file RealFormat.cpp.
30{
31 double d = 0.000001;
32 mDigits = 6;
33 for (;;) {
34 if (units < d) {
35 minor = d;
36 major = d * 5.0;
37 return;
38 }
39 d *= 5.0;
40 if (units < d) {
41 minor = d;
42 major = d * 2.0;
43 return;
44 }
45 d *= 2.0;
46 mDigits--;
47
48
49 wxASSERT(mDigits >= -10);
50 if (mDigits < -10)
51 break;
52 }
54 mDigits++;
55 }
56 minor = d;
57 major = d * 2.0;
58}
References mLog.
Referenced by TimeFormat::SetTickSizes().
◆ mLog
const bool RealFormat::mLog |
|
private |
The documentation for this class was generated from the following files: