QwtScaleDiv(3)

NAME
QwtScaleDiv - A class for building scale divisions.

SYNOPSIS

#include <qwt_scldiv.h>

  Public Methods
QwtScaleDiv ()
virtual ~QwtScaleDiv ()
QwtScaleDiv (const QwtScaleDiv &s)
QwtScaleDiv & operator= (const QwtScaleDiv &s)
int operator== (const QwtScaleDiv &s) const
int operator!= (const QwtScaleDiv &s) const
double lBound () const
double hBound () const
int minCnt () const
int majCnt () const
bool logScale () const
double majMark (int i) const
double minMark (int i) const
double majStep () const
void reset ()
bool rebuild (double lBound, double hBound, int maxMaj, int maxMin, bool log, double step=0.0, bool ascend=TRUE)

DETAILED DESCRIPTION

A class for building scale divisions.

 The QwtScaleDiv class can build linear and logarithmic scale divisions for specified intervals. It uses an adjustable algorithm to generate the major and minor step widths automatically. A scale division has a minimum value, a maximum value, a vector of major marks, and a vector of minor marks.

Warning:
QwtScaleDiv uses implicit sharing for the mark vectors.

Example
 To build a logarithmic scale division from 0.01 to 1000 and print out the major and minor marks.

#include '../include/qwt_scldiv.h>
#include <iostream.h>
main()
{
  int i,k;
  QwtScaleDiv sd;
  sd.rebuild(0.01, 100, 10, 10, TRUE, 0.0);
  k=0;
  for (i=0;i<sd.majCnt();i++)
  {
    while(k < sd.minCnt())
    {
      if (sd.minMark(k) < sd.majMark(i))
      {
        cout << ' - ' << sd.minMark(i) << ';
  k++;
      }
      else
        break;
    }
    cout << '-- ' << sd.majMark(i) << ';
  }
  while(k < sd.minCnt())
  {
    cout << ' - ' << sd.minMark(i) << ';
    k++;
  }
}

CONSTRUCTOR & DESTRUCTOR DOCUMENTATION

  QwtScaleDiv::QwtScaleDiv ()

Construct a QwtScaleDiv instance.

  QwtScaleDiv::~QwtScaleDiv () [virtual]

Destroy a QwtScaleDiv instance.

  QwtScaleDiv::QwtScaleDiv (const QwtScaleDiv & s)

Copy Constructor.

 Calls copy().

MEMBER FUNCTION DOCUMENTATION

  int QwtScaleDiv::operator!= (const QwtScaleDiv & s) const

Inequality.

Returns:
TRUE if this instance is not equal to s

  QwtScaleDiv & QwtScaleDiv::operator= (const QwtScaleDiv & s)

Copy Assignment.

  int QwtScaleDiv::operator== (const QwtScaleDiv & s) const

Equality operator.

Returns:
TRUE if this instance is equal to s

  bool QwtScaleDiv::rebuild (double x1, double x2, int maxMajSteps, int maxMinSteps, bool log, double step = 0.0, bool ascend = TRUE)

Build a scale width major and minor divisions If no fixed step width is specified or if it is set to 0, the major step width will be calculated automatically according to the the value of maxMajSteps. The maxMajSteps parameter has no effect if a fixed step size is specified. The minor step width is always calculated automatically.

 If the step width is to be calculated automatically, the algorithm tries to find reasonable values fitting into the scheme {1,2,5}*10^n with an integer number n for linear scales.

For logarithmic scales, there are three different cases

If the major step width is one decade, the minor marks will fit into one of the schemes {1,2,...9}, {2,4,6,8}, {2,5} or {5}, depending on the maxMinSteps parameter.

If the major step size spans more than one decade, the minor step size will be {1,2,5}*10^n decades with a natural number n.

If the whole range is less than one decade, a linear scale division will be built.

Parameters:

x1  first boundary value

x2  second boundary value

maxMajSteps
    max. number of major step intervals

maxMinSteps
    max. number of minor step intervals

bool
    log logarithmic division (TRUE/FALSE)

step
    fixed major step width. Defaults to 0.0.

ascend
    if TRUE, sort in ascending order from min(x1, x2) to max(x1, x2). If FALSE, sort in the direction from x1 to x2. Defaults to TRUE.

Returns:
True if the arrays have been allocated successfully.

Warning:
For logarithmic scales, the step width is measured in decades.

  void QwtScaleDiv::reset ()

Detach the shared data and set everything to zero.

AUTHOR

Generated automatically by Doxygen for Qwt User's Guide from the source code.