#include <LinearDBFormat.h>
|
| ~LinearDBFormat () 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 17 of file LinearDBFormat.h.
◆ ~LinearDBFormat()
LinearDBFormat::~LinearDBFormat |
( |
| ) |
|
|
overridedefault |
◆ Instance()
◆ RulerFormat()
RulerFormat::RulerFormat |
( |
| ) |
|
|
inlineexplicitprivate |
◆ SetLabelString()
void LinearDBFormat::SetLabelString |
( |
wxString & |
s, |
|
|
double |
d, |
|
|
double |
units, |
|
|
double |
minor, |
|
|
int |
mDigits, |
|
|
TickType |
tickType |
|
) |
| const |
|
overridevirtual |
Implements RulerFormat.
Definition at line 82 of file LinearDBFormat.cpp.
85{
86
87 if (d < 0.0 && (d + mMinor > 0.0))
88 d = 0.0;
89 if (mMinor >= 1.0)
90 s.Printf(
wxT(
"%d"), (
int)floor(d + 0.5));
91 else {
92 int precision = -log10(mMinor);
93 s.Printf(
wxT(
"%.*f"), precision, d);
94 }
95}
References wxT().
◆ SetTickSizes()
void LinearDBFormat::SetTickSizes |
( |
double |
units, |
|
|
double & |
major, |
|
|
double & |
minor, |
|
|
double & |
minorMinor, |
|
|
int & |
mDigits |
|
) |
| const |
|
overridevirtual |
Implements RulerFormat.
Definition at line 20 of file LinearDBFormat.cpp.
24{
25 if (units < 0.001) {
26 minor = 0.001;
27 major = 0.005;
28 return;
29 }
30 if (units < 0.01) {
31 minor = 0.01;
32 major = 0.05;
33 return;
34 }
35 if (units < 0.1) {
36 minor = 0.1;
37 major = 0.5;
38 return;
39 }
40 if (units < 1.0) {
41 minor = 1.0;
42 major = 6.0;
43 return;
44 }
45 if (units < 3.0) {
46 minor = 3.0;
47 major = 12.0;
48 return;
49 }
50 if (units < 6.0) {
51 minor = 6.0;
52 major = 24.0;
53 return;
54 }
55 if (units < 12.0) {
56 minor = 12.0;
57 major = 48.0;
58 return;
59 }
60 if (units < 24.0) {
61 minor = 24.0;
62 major = 96.0;
63 return;
64 }
65 double d = 20.0;
66 for (;;) {
67 if (units < d) {
68 minor = d;
69 major = d * 5.0;
70 return;
71 }
72 d *= 5.0;
73 if (units < d) {
74 minor = d;
75 major = d * 5.0;
76 return;
77 }
78 d *= 2.0;
79 }
80}
The documentation for this class was generated from the following files: