本文整理汇总了C++中QwtDoubleInterval::limited方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleInterval::limited方法的具体用法?C++ QwtDoubleInterval::limited怎么用?C++ QwtDoubleInterval::limited使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoubleInterval
的用法示例。
在下文中一共展示了QwtDoubleInterval::limited方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QwtScaleDiv
/*!
\brief Calculate a scale division
\param x1 First interval limit
\param x2 Second interval limit
\param maxMajSteps Maximum for the number of major steps
\param maxMinSteps Maximum number of minor steps
\param stepSize Step size. If stepSize == 0, the scaleEngine
calculates one.
\sa QwtScaleEngine::stepSize(), QwtLog10ScaleEngine::subDivide()
*/
QwtScaleDiv QwtLog10ScaleEngine::divideScale(double x1, double x2,
int maxMajSteps, int maxMinSteps, double stepSize) const
{
QwtDoubleInterval interval = QwtDoubleInterval(x1, x2).normalized();
interval = interval.limited(LOG_MIN, LOG_MAX);
if (interval.width() <= 0 )
return QwtScaleDiv();
if (interval.maxValue() / interval.minValue() < 10.0)
{
// scale width is less than one decade -> build linear scale
QwtLinearScaleEngine linearScaler;
linearScaler.setAttributes(attributes());
linearScaler.setReference(reference());
linearScaler.setMargins(lowerMargin(), upperMargin());
if ( stepSize != 0.0 )
stepSize = ::pow(10.0, stepSize);
return linearScaler.divideScale(x1, x2,
maxMajSteps, maxMinSteps, stepSize);
}
stepSize = qwtAbs(stepSize);
if ( stepSize == 0.0 )
{
if ( maxMajSteps < 1 )
maxMajSteps = 1;
stepSize = divideInterval(log10(interval).width(), maxMajSteps);
if ( stepSize < 1.0 )
stepSize = 1.0; // major step must be >= 1 decade
}
QwtScaleDiv scaleDiv;
if ( stepSize != 0.0 )
{
QwtValueList ticks[QwtScaleDiv::NTickTypes];
buildTicks(interval, stepSize, maxMinSteps, ticks);
scaleDiv = QwtScaleDiv(interval, ticks);
}
if ( x1 > x2 )
scaleDiv.invert();
return scaleDiv;
}