13 #include "msdevstudio/MSconfig.h"
25 #ifdef ITERATOR_MEMBER_DEFECT
30 using std::upper_bound;
34 using namespace hippodraw;
67 vector<double>::const_iterator
it
68 = upper_bound (
bins.begin(),
bins.end(), x );
69 int i = it -
bins.begin();
83 double high =
bins[i+1];
85 return sqrt(low*high);
91 bins_number = std::min ( bins_number,
m_num_bins -1 );
92 bins_number = std::max ( bins_number, 0 );
94 double width =
bins[bins_number+1] -
bins[bins_number];
95 assert ( width >= 0.0 );
123 double width_parm = 0;
126 width_parm = log10 ( high / low ) / num_bins;
135 assert ( low > 0.0 );
137 vector<double>::iterator
it =
bins.begin();
140 for (
int i = 1; it !=
bins.end(); ++
it,
i++ ) {
141 *it = low * pow ( 10.0,
i *
m_width );
169 throw std::runtime_error(
"BinnerAxisLog::Range: attempt to set range "
170 "to negative values.");
182 assert ( wid > 0.0 );
188 double high = low * pow ( 10.0,
m_num_bins * wid );
201 return ( parm - 50 ) / 50.0;
219 if( offset == 0.0 )
return;
221 double width = low * pow ( 10.0,
m_width );
222 double woffset = width * change;
223 double new_low = low * pow ( 10.0, woffset *
m_width );
224 double new_high = new_low * pow ( 10.0, (
bins.size() -1 ) * m_width );
226 Range r( new_low, new_high );
238 double low = range.
low ();
239 double high = range.
high ();
240 int tmp =
static_cast< int > ( ceil ( log10 ( high/low ) /
243 return tmp ? tmp : 1;
250 int tmp = static_cast <
int > ( ceil ( log10 ( high/low ) /
252 return tmp ? tmp : 1;
BinnerAxisLog()
The default constructor.
void setBins()
Sets the bins structure by calculating the lower edge of each bin.
virtual double axisBinWidth(int bins_number) const
Returns the width of the bin designated by its place number in the bins structure.
double high() const
Returns the maximum of the range object.
hippodraw::BinnerAxisLog class interface
virtual double getCoordinate(int i) const
Returns the coordinate.
std::vector< double > bins
Has the lower edge of each bin, starting with [0] = the first one.
Range m_range_start
The Range at the start of dragging.
virtual void setConstWid()
Sets the constant width parameter.
virtual const Range & setBinWidth(double width)
Sets the bin width and adjusts the range and number of bins accordingly.
virtual void axisSetNumberOfBins(int nb)
Sets m_num_bins.
virtual double calcOffset(int parm, bool dragging) const
Calculates and returns a double corresponding to a bin offset when dragging a slider control...
void setLow(double x)
Sets the minimum of the range object.
void setStartRange(bool dragging) const
Sets the starting Range.
virtual int getNob(double wid) const
Returns the number of bins given the width parameter width.
virtual double getOffset() const
Returns the offset.
Range m_range
The range of the bins.
void setHigh(double x)
Sets the maximum of the range object.
double m_width
The width parameter for the binning.
virtual int axisBinNumber(double x) const
Returns the number of the bin in which the x value and y value are situated.
The base class for the BinnerAxis hierarchy.
BinnerAxis * clone()
The clone function returns an object of its own kind which is a copy of this object at this moment...
The class for bins of logarithmically increasing widths.
virtual double getBinWidth() const
Returns the bin width parameter.
virtual const void setOffset(double offset)
Sets the offset and adjusts the range accordingly.
double calcWidthParm(int number) const
Calculates the bin width parameter given the number of bins.
double low() const
Returns the minimum of the range object.
double m_offset
The offset.
Expresses a range of values.
virtual ~BinnerAxisLog()
The destructor.
int m_num_bins
The number of bins.
virtual double scaleFactorWid()
Returns the bin width associated with the scale factor - in the case of log binning, this is always 1.0.
virtual const Range & setRange(const Range &, bool hold_width=true)
Sets the range.
list< QAction * >::iterator it
virtual double getConstWid() const
Returns the constant width parameter.