改进代码
This commit is contained in:
@@ -31,7 +31,7 @@ static inline QwtInterval qwtLogInterval( double base, const QwtInterval &interv
|
||||
qwtLog( base, interval.maxValue() ) );
|
||||
}
|
||||
|
||||
static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval )
|
||||
static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval )
|
||||
{
|
||||
return QwtInterval( qPow( base, interval.minValue() ),
|
||||
qPow( base, interval.maxValue() ) );
|
||||
@@ -51,7 +51,7 @@ static inline long double qwtIntervalWidthL( const QwtInterval &interval )
|
||||
// this version often doesn't find the best ticks: f.e for 15: 5, 10
|
||||
static double qwtStepSize( double intervalSize, int maxSteps, uint base )
|
||||
{
|
||||
const double minStep =
|
||||
const double minStep =
|
||||
QwtScaleArithmetic::divideInterval( intervalSize, maxSteps, base );
|
||||
|
||||
if ( minStep != 0.0 )
|
||||
@@ -170,8 +170,8 @@ double QwtScaleArithmetic::divideEps( double intervalSize, double numSteps )
|
||||
|
||||
\return Calculated step size
|
||||
*/
|
||||
double QwtScaleArithmetic::divideInterval(
|
||||
double intervalSize, int numSteps, uint base )
|
||||
double QwtScaleArithmetic::divideInterval(
|
||||
double intervalSize, int numSteps, uint base )
|
||||
{
|
||||
if ( numSteps <= 0 )
|
||||
return 0.0;
|
||||
@@ -268,7 +268,7 @@ void QwtScaleEngine::setTransformation( QwtTransform *transform )
|
||||
}
|
||||
|
||||
/*!
|
||||
Create and return a clone of the transformation
|
||||
Create and return a clone of the transformation
|
||||
of the engine. When the engine has no special transformation
|
||||
NULL is returned, indicating no transformation.
|
||||
|
||||
@@ -339,7 +339,7 @@ void QwtScaleEngine::setMargins( double lower, double upper )
|
||||
double QwtScaleEngine::divideInterval(
|
||||
double intervalSize, int numSteps ) const
|
||||
{
|
||||
return QwtScaleArithmetic::divideInterval(
|
||||
return QwtScaleArithmetic::divideInterval(
|
||||
intervalSize, numSteps, d_data->base );
|
||||
}
|
||||
|
||||
@@ -467,16 +467,16 @@ QwtScaleEngine::Attributes QwtScaleEngine::attributes() const
|
||||
|
||||
/*!
|
||||
\brief Specify a reference point
|
||||
\param r new reference value
|
||||
\param reference New reference value
|
||||
|
||||
The reference point is needed if options IncludeReference or
|
||||
Symmetric are active. Its default value is 0.0.
|
||||
|
||||
\sa Attribute
|
||||
*/
|
||||
void QwtScaleEngine::setReference( double r )
|
||||
void QwtScaleEngine::setReference( double reference )
|
||||
{
|
||||
d_data->referenceValue = r;
|
||||
d_data->referenceValue = reference;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -501,7 +501,7 @@ double QwtScaleEngine::reference() const
|
||||
\sa base()
|
||||
*/
|
||||
void QwtScaleEngine::setBase( uint base )
|
||||
{
|
||||
{
|
||||
d_data->base = qMax( base, 2U );
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ void QwtLinearScaleEngine::autoScale( int maxNumSteps,
|
||||
if ( interval.width() == 0.0 )
|
||||
interval = buildInterval( interval.minValue() );
|
||||
|
||||
stepSize = QwtScaleArithmetic::divideInterval(
|
||||
stepSize = QwtScaleArithmetic::divideInterval(
|
||||
interval.width(), qMax( maxNumSteps, 1 ), base() );
|
||||
|
||||
if ( !testAttribute( QwtScaleEngine::Floating ) )
|
||||
@@ -606,7 +606,7 @@ QwtScaleDiv QwtLinearScaleEngine::divideScale( double x1, double x2,
|
||||
if ( maxMajorSteps < 1 )
|
||||
maxMajorSteps = 1;
|
||||
|
||||
stepSize = QwtScaleArithmetic::divideInterval(
|
||||
stepSize = QwtScaleArithmetic::divideInterval(
|
||||
interval.width(), maxMajorSteps, base() );
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ QwtInterval QwtLinearScaleEngine::align(
|
||||
double x1 = interval.minValue();
|
||||
double x2 = interval.maxValue();
|
||||
|
||||
// when there is no rounding beside some effect, when
|
||||
// when there is no rounding beside some effect, when
|
||||
// calculating with doubles, we keep the original value
|
||||
|
||||
const double eps = 0.000000000001; // since Qt 4.8: qFuzzyIsNull
|
||||
@@ -867,7 +867,7 @@ void QwtLogScaleEngine::autoScale( int maxNumSteps,
|
||||
if ( interval.width() == 0.0 )
|
||||
interval = buildInterval( interval.minValue() );
|
||||
|
||||
stepSize = divideInterval( qwtLogInterval( logBase, interval ).width(),
|
||||
stepSize = divideInterval( qwtLogInterval( logBase, interval ).width(),
|
||||
qMax( maxNumSteps, 1 ) );
|
||||
if ( stepSize < 1.0 )
|
||||
stepSize = 1.0;
|
||||
@@ -927,7 +927,7 @@ QwtScaleDiv QwtLogScaleEngine::divideScale( double x1, double x2,
|
||||
if ( maxMajorSteps < 1 )
|
||||
maxMajorSteps = 1;
|
||||
|
||||
stepSize = divideInterval(
|
||||
stepSize = divideInterval(
|
||||
qwtLogInterval( logBase, interval ).width(), maxMajorSteps );
|
||||
if ( stepSize < 1.0 )
|
||||
stepSize = 1.0; // major step must be >= 1 decade
|
||||
@@ -1032,8 +1032,8 @@ void QwtLogScaleEngine::buildMinorTicks(
|
||||
double minStep = divideInterval( stepSize, maxMinorSteps + 1 );
|
||||
if ( minStep == 0.0 )
|
||||
return;
|
||||
|
||||
const int numSteps = qRound( stepSize / minStep );
|
||||
|
||||
const int numSteps = qRound( stepSize / minStep );
|
||||
|
||||
int mediumTickIndex = -1;
|
||||
if ( ( numSteps > 2 ) && ( numSteps % 2 == 0 ) )
|
||||
@@ -1087,7 +1087,7 @@ void QwtLogScaleEngine::buildMinorTicks(
|
||||
}
|
||||
|
||||
if ( numTicks < 1 )
|
||||
return;
|
||||
return;
|
||||
|
||||
int mediumTickIndex = -1;
|
||||
if ( ( numTicks > 2 ) && ( numTicks % 2 ) )
|
||||
|
||||
Reference in New Issue
Block a user