src/analog/functions.h

changeset 322
e7ca120d93c7
parent 316
dcd472be9ae8
equal deleted inserted replaced
321:430d4cd2edd6 322:e7ca120d93c7
40 40
41 double minimalStep(double scaleSize, int steps); 41 double minimalStep(double scaleSize, int steps);
42 42
43 43
44 /** 44 /**
45 * Szablonowa funkcja do wyznaczania skali w zadanym przedziale o wyznaczonej ilości punktów skali. 45 * Template function for determining the scale in a given interval with a designated number of scale points.
46 * Na podstawie wartości minimalnej oraz maksymalnej, jaką chcemy osiągnać ustawia 46 * On the basis of the minimum and maximum value that we want to achieve, sets the values of m_min and m_max
47 * wartości m_min oraz m_max w taki sposób cały przedział skali (m_max-m_min) był podzielny 47 * in such a way that the entire scale range (m_max-m_min) was divisible by the number of scale points and
48 * przez ilość punktów skali a odległość pomiędzy punktami skali była wartoscią która jest 48 * the distance between the scale points was the value which is a multiplication of number 5.
49 * wieloktornością liczby 5. Dodatkowo isnieje możliwość przesunięcia skali w lewo lub prawo by 49 * Additionally, it is possible to shift the scale left or right so that it starts as close to the minimum
50 * rozpoczynała się jak najbliżej wartości minimalnej lub kończyła jak najbliżej wartości 50 * value or ends as close to the maximum value.
51 * maksymalnej. 51 *
52 * 52 * @param m_minimum - minimum value on the scale to be visible
53 * @param m_minimum - wartość minilana na skali jaka ma być widoczna 53 * @param m_maximum - maximum value on the scale to be visible
54 * @param m_maximum - wartość maksymalna na skali jaka ma być widoczna 54 * @param m_min - the computed starting value of the scale
55 * @param m_min - wyliczona wartość początkowa skali 55 * @param m_max - the computed end value of the scale
56 * @param m_max - wyliczona wartość końcowa skali 56 * @param stesp - number of nodes to have in the scale
57 * @param stesp - ilość węzłów jaką ma mieć skala 57 * @param left - whether the scale should be left or right aligned (default is right).
58 * @param left - czy skala ma być wyrównana do lewej czy do prawej (domyślnie do prawej). 58 * @return - The function returns the value true if the values of m_min and m_max
59 * @return Funkcja zwraca wartość true jeżeli wartości m_min oraz m_max w wyniku zmiany zakresu 59 * changed their value as a result of changing the range.
60 * zmieniły swoją wartość. Na podstawie tej wartości wiadomo czy należy np. przerysować skalę 60 * Based on this value, it is known whether it is necessary, for example,
61 * - podając wcześniej poprzednie wartości zakresu skali. 61 * to redraw the scale - giving previously previous values of the scale range
62 */ 62 */
63 63
64 template <typename T> 64 template <typename T>
65 bool range(T m_minimum,T m_maximum, T & m_min, T & m_max,unsigned int steps, bool left = false,double inc = 5.0) 65 bool range(T m_minimum,T m_maximum, T & m_min, T & m_max,unsigned int steps, bool left = false,double inc = 5.0)
66 { 66 {
67 //cout<<"("<<m_minimum<<","<<m_maximum<<") ("<<m_min<<","<<m_max<<")"<<endl; 67 //cout<<"("<<m_minimum<<","<<m_maximum<<") ("<<m_min<<","<<m_max<<")"<<endl;

mercurial