本文整理汇总了C++中QwtDoubleInterval::setMaxValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleInterval::setMaxValue方法的具体用法?C++ QwtDoubleInterval::setMaxValue怎么用?C++ QwtDoubleInterval::setMaxValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoubleInterval
的用法示例。
在下文中一共展示了QwtDoubleInterval::setMaxValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateBorders
void QwtPlotScaleItem::updateBorders()
{
const QwtPlot *plt = plot();
if ( plt == NULL || !d_data->scaleDivFromAxis )
return;
const QRect r = plt->canvas()->contentsRect();
d_data->canvasRectCache = r;
QwtDoubleInterval interval;
if ( d_data->scaleDraw->orientation() == Qt::Horizontal )
{
const QwtScaleMap map = plt->canvasMap(xAxis());
interval.setMinValue(map.invTransform(r.left()));
interval.setMaxValue(map.invTransform(r.right()));
}
else
{
const QwtScaleMap map = plt->canvasMap(yAxis());
interval.setMinValue(map.invTransform(r.bottom()));
interval.setMaxValue(map.invTransform(r.top()));
}
QwtScaleDiv scaleDiv = d_data->scaleDraw->scaleDiv();
scaleDiv.setInterval(interval);
d_data->scaleDraw->setScaleDiv(scaleDiv);
}
示例2: expandInterval
/*!
Expand the interval
\param interval Interval to be expanded
\param width Distance to be added to the interval
\param direction Direction of the expand operation
\return Expanded interval
*/
QwtDoubleInterval QwtPlotRescaler::expandInterval(
const QwtDoubleInterval &interval, double width,
ExpandingDirection direction) const
{
QwtDoubleInterval expanded = interval;
switch(direction)
{
case ExpandUp:
expanded.setMinValue(interval.minValue());
expanded.setMaxValue(interval.minValue() + width);
break;
case ExpandDown:
expanded.setMaxValue(interval.maxValue());
expanded.setMinValue(interval.maxValue() - width);
break;
case ExpandBoth:
default:
expanded.setMinValue(interval.minValue() +
interval.width() / 2.0 - width / 2.0);
expanded.setMaxValue(expanded.minValue() + width);
}
return expanded;
}
示例3: visibleInterval
//.........这里部分代码省略.........
const QwtDoubleRect cRect = canvas()->contentsRect();
const QwtDoubleRect pRect = plotRect( cRect.toRect() );
if ( cRect.contains( pRect.toRect() ) || !cRect.intersects( pRect ) )
{
#if QWT_VERSION < 0x050200
return QwtDoubleInterval( sd->lBound(), sd->hBound() );
#else
return QwtDoubleInterval( sd->lowerBound(), sd->upperBound() );
#endif
}
const QwtDoublePoint pole = pRect.center();
const QwtDoubleRect scaleRect = pRect & cRect;
const QwtScaleMap map = scaleMap( QwtPolar::Radius );
double dmin = 0.0;
double dmax = 0.0;
if ( scaleRect.contains( pole ) )
{
dmin = 0.0;
QwtDoublePoint corners[4];
corners[0] = scaleRect.bottomRight();
corners[1] = scaleRect.topRight();
corners[2] = scaleRect.topLeft();
corners[3] = scaleRect.bottomLeft();
dmax = 0.0;
for ( int i = 0; i < 4; i++ )
{
const double dist = qwtDistance( pole, corners[i] );
if ( dist > dmax )
dmax = dist;
}
}
else
{
if ( pole.x() < scaleRect.left() )
{
if ( pole.y() < scaleRect.top() )
{
dmin = qwtDistance( pole, scaleRect.topLeft() );
dmax = qwtDistance( pole, scaleRect.bottomRight() );
}
else if ( pole.y() > scaleRect.bottom() )
{
dmin = qwtDistance( pole, scaleRect.bottomLeft() );
dmax = qwtDistance( pole, scaleRect.topRight() );
}
else
{
dmin = scaleRect.left() - pole.x();
dmax = qwtMax( qwtDistance( pole, scaleRect.bottomRight() ),
qwtDistance( pole, scaleRect.topRight() ) );
}
}
else if ( pole.x() > scaleRect.right() )
{
if ( pole.y() < scaleRect.top() )
{
dmin = qwtDistance( pole, scaleRect.topRight() );
dmax = qwtDistance( pole, scaleRect.bottomLeft() );
}
else if ( pole.y() > scaleRect.bottom() )
{
dmin = qwtDistance( pole, scaleRect.bottomRight() );
dmax = qwtDistance( pole, scaleRect.topLeft() );
}
else
{
dmin = pole.x() - scaleRect.right();
dmax = qwtMax( qwtDistance( pole, scaleRect.bottomLeft() ),
qwtDistance( pole, scaleRect.topLeft() ) );
}
}
else if ( pole.y() < scaleRect.top() )
{
dmin = scaleRect.top() - pole.y();
dmax = qwtMax( qwtDistance( pole, scaleRect.bottomLeft() ),
qwtDistance( pole, scaleRect.bottomRight() ) );
}
else if ( pole.y() > scaleRect.bottom() )
{
dmin = pole.y() - scaleRect.bottom();
dmax = qwtMax( qwtDistance( pole, scaleRect.topLeft() ),
qwtDistance( pole, scaleRect.topRight() ) );
}
}
const double radius = pRect.width() / 2.0;
if ( dmax > radius )
dmax = radius;
QwtDoubleInterval interval;
interval.setMinValue( map.invTransform( dmin ) );
interval.setMaxValue( map.invTransform( dmax ) );
return interval;
}