if (!d_prefDlg->get_pasZ_Auto()) {
/* Récupération du pas choisi
****************************/
double pasz = d_prefDlg->get_pasZ();
/* Ajustement des extrema
************************/
nivmax = pasz*ceil(nivmax/pasz);
nivmin = pasz*floor(nivmin/pasz);
/* Nombre de pas
***************/
double nbPas = ((int)(((nivmax-nivmin)/pasz)));
/* Recherche du meilleur pas principal
*************************************/
double major;
for(int ii=8; ii>1; ii--) {
major = floor(nbPas/ii);
if (major > 5)
break;
}
double pasMajor = major*pasz;
int nbPasminor = floor(pasMajor/pasz);
d_polarplot->setScale(QwtPolar::Radius,nivmin, nivmax, pasMajor);
d_polarplot->setScaleMaxMajor(QwtPolar::Radius, major);
d_polarplot->setScaleMaxMinor(QwtPolar::Radius, nbPasminor);
/* Création des pas principaux et secondaires
********************************************/
QList<double>
&majorTicksR
= ticksR
[QwtScaleDiv::MajorTick];
QList<double>
&minorTicksR
= ticksR
[QwtScaleDiv::MinorTick];
for (double niveau=nivmin; niveau <= nivmax; niveau=niveau+pasz) {
if (fmod((niveau-nivmin),major*pasz) == 0) {
majorTicksR.append(niveau);
} else {
minorTicksR.append(niveau);
}
}
majorTicksR.last(), ticksR);
d_polarplot->setScaleDiv(QwtPolar::Radius, myScaleDivR);
if (d_polarplot->scaleDiv(QwtPolar::Radius)->isValid() == false)
Message("Invalide", false);
} else
d_polarplot->setScale(QwtPolar::Radius,nivmin, nivmax);
if (!d_prefDlg->get_pasZ_Auto()) {
/* Récupération du pas choisi
****************************/
double pasz = d_prefDlg->get_pasZ();
/* Ajustement des extrema
************************/
nivmax = pasz*ceil(nivmax/pasz);
nivmin = pasz*floor(nivmin/pasz);
/* Nombre de pas
***************/
double nbPas = ((int)(((nivmax-nivmin)/pasz)));
/* Recherche du meilleur pas principal
*************************************/
double major;
for(int ii=8; ii>1; ii--) {
major = floor(nbPas/ii);
if (major > 5)
break;
}
double pasMajor = major*pasz;
int nbPasminor = floor(pasMajor/pasz);
d_polarplot->setScale(QwtPolar::Radius,nivmin, nivmax, pasMajor);
d_polarplot->setScaleMaxMajor(QwtPolar::Radius, major);
d_polarplot->setScaleMaxMinor(QwtPolar::Radius, nbPasminor);
/* Création des pas principaux et secondaires
********************************************/
QList<double> ticksR[QwtScaleDiv::NTickTypes];
QList<double> &majorTicksR = ticksR[QwtScaleDiv::MajorTick];
QList<double> &minorTicksR = ticksR[QwtScaleDiv::MinorTick];
for (double niveau=nivmin; niveau <= nivmax; niveau=niveau+pasz) {
if (fmod((niveau-nivmin),major*pasz) == 0) {
majorTicksR.append(niveau);
} else {
minorTicksR.append(niveau);
}
}
QwtScaleDiv myScaleDivR = QwtScaleDiv(majorTicksR.first(),
majorTicksR.last(), ticksR);
d_polarplot->setScaleDiv(QwtPolar::Radius, myScaleDivR);
if (d_polarplot->scaleDiv(QwtPolar::Radius)->isValid() == false)
Message("Invalide", false);
} else
d_polarplot->setScale(QwtPolar::Radius,nivmin, nivmax);
To copy to clipboard, switch view to plain text mode
With nivmin = -93, nivmax=-39 and pasz=3, I should get the following major
Bookmarks