本文整理汇总了C++中QwtDoubleRect::right方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoubleRect::right方法的具体用法?C++ QwtDoubleRect::right怎么用?C++ QwtDoubleRect::right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoubleRect
的用法示例。
在下文中一共展示了QwtDoubleRect::right方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boundingRect
QwtDoubleRect PlotCurve::boundingRect() const
{
QwtDoubleRect r = QwtPlotCurve::boundingRect();
double percent = 0.01;
double dw = percent*fabs(r.right() - r.left());
double left = r.left() - dw;
if (left <= 0.0) {
ScaleEngine *sc_engine = (ScaleEngine *)this->plot()->axisScaleEngine(xAxis());
if (sc_engine && (sc_engine->type() == ScaleTransformation::Log10 ||
sc_engine->type() == ScaleTransformation::Log2 ||
sc_engine->type() == ScaleTransformation::Ln))
left = r.left();
}
r.setLeft(left);
r.setRight(r.right() + dw);
double dh = percent*fabs(r.top() - r.bottom());
r.setBottom(r.bottom() + dh);
double top = r.top() - dh;
if (top <= 0.0) {
ScaleEngine *sc_engine = (ScaleEngine *)this->plot()->axisScaleEngine(yAxis());
if (sc_engine && (sc_engine->type() == ScaleTransformation::Log10 ||
sc_engine->type() == ScaleTransformation::Log2 ||
sc_engine->type() == ScaleTransformation::Ln))
top = r.top();
}
r.setTop(top);
return r;
}
示例2: clearCurve
/**
* Remove the curve. Rescale the axes if there are stored curves.
*/
void OneCurvePlot::clearCurve()
{
// remove the curve
if (m_curve)
{
m_curve->attach(0);
m_curve = NULL;
}
clearPeakLabels();
// if there are stored curves rescale axes to make them fully visible
if (hasStored())
{
QMap<QString,QwtPlotCurve*>::const_iterator curve = m_stored.begin();
QwtDoubleRect br = (**curve).boundingRect();
double xmin = br.left();
double xmax = br.right();
double ymin = br.top();
double ymax = br.bottom();
++curve;
for(;curve!=m_stored.end();++curve)
{
QwtDoubleRect br = (**curve).boundingRect();
if (br.left() < xmin) xmin = br.left();
if (br.right() > xmax) xmax = br.right();
if (br.top() < ymin) ymin = br.top();
if (br.bottom() > ymax) ymax = br.bottom();
}
setXScale(xmin,xmax);
setYScale(ymin,ymax);
}
}
示例3: viewBox
/*!
Calculate the viewBox from an rect and boundingRect().
\param rect Rectangle in scale coordinates
\return viewBox View Box, see QSvgRenderer::viewBox
*/
QwtDoubleRect QwtPlotSvgItem::viewBox(const QwtDoubleRect &rect) const
{
#if QT_VERSION >= 0x040100
const QSize sz = d_data->renderer.defaultSize();
#else
#if QT_VERSION > 0x040000
const QSize sz(d_data->picture.width(),
d_data->picture.height());
#else
QPaintDeviceMetrics metrics(&d_data->picture);
const QSize sz(metrics.width(), metrics.height());
#endif
#endif
const QwtDoubleRect br = boundingRect();
if ( !rect.isValid() || !br.isValid() || sz.isNull() )
return QwtDoubleRect();
QwtScaleMap xMap;
xMap.setScaleInterval(br.left(), br.right());
xMap.setPaintInterval(0, sz.width());
QwtScaleMap yMap;
yMap.setScaleInterval(br.top(), br.bottom());
yMap.setPaintInterval(sz.height(), 0);
const double x1 = xMap.xTransform(rect.left());
const double x2 = xMap.xTransform(rect.right());
const double y1 = yMap.xTransform(rect.bottom());
const double y2 = yMap.xTransform(rect.top());
return QwtDoubleRect(x1, y1, x2 - x1, y2 - y1);
}
示例4: QwtDoubleRect
/*!
Returns the intersection of this rectangle and rectangle other.
Returns an empty rectangle if there is no intersection.
*/
QwtDoubleRect QwtDoubleRect::operator&(const QwtDoubleRect &other) const
{
if (isNull() || other.isNull())
return QwtDoubleRect();
const QwtDoubleRect r1 = normalized();
const QwtDoubleRect r2 = other.normalized();
const double minX = qwtMax(r1.left(), r2.left());
const double maxX = qwtMin(r1.right(), r2.right());
const double minY = qwtMax(r1.top(), r2.top());
const double maxY = qwtMin(r1.bottom(), r2.bottom());
return QwtDoubleRect(minX, minY, maxX - minX, maxY - minY);
}
示例5: boundingRect
QwtDoubleRect QwtErrorPlotCurve::boundingRect() const
{
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
int size = dataSize();
QwtArray <double> X(size), Y(size), min(size), max(size);
for (int i=0; i<size; i++)
{
X[i]=x(i);
Y[i]=y(i);
if (type == Vertical)
{
min[i] = y(i) - err[i];
max[i] = y(i) + err[i];
}
else
{
min[i] = x(i) - err[i];
max[i] = x(i) + err[i];
}
}
QwtArrayData *erMin, *erMax;
if (type == Vertical)
{
erMin=new QwtArrayData(X, min);
erMax=new QwtArrayData(X, max);
}
else
{
erMin=new QwtArrayData(min, Y);
erMax=new QwtArrayData(max, Y);
}
QwtDoubleRect minrect = erMin->boundingRect();
QwtDoubleRect maxrect = erMax->boundingRect();
rect.setTop(QMIN(minrect.top(), maxrect.top()));
rect.setBottom(QMAX(minrect.bottom(), maxrect.bottom()));
rect.setLeft(QMIN(minrect.left(), maxrect.left()));
rect.setRight(QMAX(minrect.right(), maxrect.right()));
delete erMin;
delete erMax;
return rect;
}
示例6: boundingRect
QwtDoubleRect HistogramItem::boundingRect() const
{
QwtDoubleRect rect = d_data->data.boundingRect();
if ( !rect.isValid() )
return rect;
if ( d_data->attributes & Xfy )
{
rect = QwtDoubleRect( rect.y(), rect.x(),
rect.height(), rect.width() );
if ( rect.left() > d_data->reference )
rect.setLeft( d_data->reference );
else if ( rect.right() < d_data->reference )
rect.setRight( d_data->reference );
}
else
{
if ( rect.bottom() < d_data->reference )
rect.setBottom( d_data->reference );
else if ( rect.top() > d_data->reference )
rect.setTop( d_data->reference );
}
return rect;
}
示例7: boundingRect
QwtDoubleRect QwtBarCurve::boundingRect() const {
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
double n = (double)dataSize();
if (bar_style == Vertical) {
double dx = (rect.right() - rect.left()) / n;
rect.setLeft(rect.left() - dx);
rect.setRight(rect.right() + dx);
} else {
double dy = (rect.bottom() - rect.top()) / n;
rect.setTop(rect.top() - dy);
rect.setBottom(rect.bottom() + dy);
}
return rect;
}
示例8: boundingRect
QwtDoubleRect QwtHistogram::boundingRect() const {
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
rect.setLeft(rect.left() - x(1));
rect.setRight(rect.right() + x(dataSize() - 1));
rect.setTop(0);
rect.setBottom(1.2 * rect.bottom());
return rect;
}
示例9: boundingInterval
/*!
Interval, that is necessary to display the item
This interval can be useful for operations like clipping or autoscaling
\param scaleId Scale index
\return bounding interval
\sa QwtData::boundingRect()
*/
QwtDoubleInterval QwtPolarCurve::boundingInterval( int scaleId ) const
{
const QwtDoubleRect boundingRect = d_points->boundingRect();
if ( scaleId == QwtPolar::ScaleAzimuth )
return QwtDoubleInterval( boundingRect.left(), boundingRect.right() );
else if ( scaleId == QwtPolar::ScaleRadius )
return QwtDoubleInterval( boundingRect.top(), boundingRect.bottom() );
return QwtDoubleInterval();
}
示例10: boundingRect
QwtDoubleRect BoxCurve::boundingRect() const {
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
double dy = 0.2 * (rect.bottom() - rect.top());
rect.setTop(rect.top() - dy);
rect.setBottom(rect.bottom() + dy);
rect.setLeft(rect.left() - 0.5);
rect.setRight(rect.right() + 0.5);
return rect;
}
示例11: transform
/*!
Translate a rectangle from plot into pixel coordinates
\return Rectangle in pixel coordinates
\sa QwtPlotPicker::invTransform()
*/
QRect QwtPlotPicker::transform(const QwtDoubleRect &rect) const
{
QwtScaleMap xMap = plot()->canvasMap(d_xAxis);
QwtScaleMap yMap = plot()->canvasMap(d_yAxis);
const int left = xMap.transform(rect.left());
const int right = xMap.transform(rect.right());
const int top = yMap.transform(rect.top());
const int bottom = yMap.transform(rect.bottom());
return QRect(left, top, right - left, bottom - top);
}
示例12: boundingRect
QwtDoubleRect VectorCurve::boundingRect() const {
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
QwtDoubleRect vrect = vectorEnd->boundingRect();
if (d_style == XYXY) {
rect.setTop(qMin((double)rect.top(), (double)vrect.top()));
rect.setBottom(qMax((double)rect.bottom(), (double)vrect.bottom()));
rect.setLeft(qMin((double)rect.left(), (double)vrect.left()));
rect.setRight(qMax((double)rect.right(), (double)vrect.right()));
} else {
const double angle = vectorEnd->x(0);
double mag = vectorEnd->y(0);
switch (d_position) {
case Tail:
rect.setTop(
qMin((double)rect.top(), (double)(rect.top() + mag * sin(angle))));
rect.setBottom(qMax((double)rect.bottom(),
(double)(rect.bottom() + mag * sin(angle))));
rect.setLeft(
qMin((double)rect.left(), (double)(rect.left() + mag * cos(angle))));
rect.setRight(qMax((double)rect.right(),
(double)(rect.right() + mag * cos(angle))));
break;
case Middle: {
mag *= 0.5;
rect.setTop(qMin((double)rect.top(),
(double)(rect.top() - fabs(mag * sin(angle)))));
rect.setBottom(qMax((double)rect.bottom(),
(double)(rect.bottom() + fabs(mag * sin(angle)))));
rect.setLeft(qMin((double)rect.left(),
(double)(rect.left() - fabs(mag * cos(angle)))));
rect.setRight(qMax((double)rect.right(),
(double)(rect.right() + fabs(mag * cos(angle)))));
} break;
case Head:
rect.setTop(
qMin((double)rect.top(), (double)(rect.top() - mag * sin(angle))));
rect.setBottom(qMax((double)rect.bottom(),
(double)(rect.bottom() - mag * sin(angle))));
rect.setLeft(
qMin((double)rect.left(), (double)(rect.left() - mag * cos(angle))));
rect.setRight(qMax((double)rect.right(),
(double)(rect.right() - mag * cos(angle))));
break;
}
}
return rect;
}
示例13: visibleInterval
/*!
Calculate the bounding interval of the radial scale that is
visible on the canvas.
*/
QwtDoubleInterval QwtPolarPlot::visibleInterval() const
{
const QwtScaleDiv *sd = scaleDiv( QwtPolar::Radius );
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 )
//.........这里部分代码省略.........
示例14: updateAxes
//! Rebuild the scales and maps
void QwtPlot::updateAxes()
{
// Find bounding interval of the item data
// for all axes, where autoscaling is enabled
QwtDoubleInterval intv[axisCnt];
const QwtPlotItemList& itmList = itemList();
QwtPlotItemIterator it;
for ( it = itmList.begin(); it != itmList.end(); ++it )
{
const QwtPlotItem *item = *it;
if ( !item->testItemAttribute(QwtPlotItem::AutoScale) )
continue;
if ( axisAutoScale(item->xAxis()) || axisAutoScale(item->yAxis()) )
{
const QwtDoubleRect rect = item->boundingRect();
intv[item->xAxis()] |= QwtDoubleInterval(rect.left(), rect.right());
intv[item->yAxis()] |= QwtDoubleInterval(rect.top(), rect.bottom());
}
}
// Adjust scales
for (int axisId = 0; axisId < axisCnt; axisId++)
{
AxisData &d = *d_axisData[axisId];
double minValue = d.minValue;
double maxValue = d.maxValue;
double stepSize = d.stepSize;
if ( d.doAutoScale && intv[axisId].isValid() )
{
d.scaleDiv.invalidate();
minValue = intv[axisId].minValue();
maxValue = intv[axisId].maxValue();
d.scaleEngine->autoScale(d.maxMajor,
minValue, maxValue, stepSize);
}
if ( !d.scaleDiv.isValid() )
{
d.scaleDiv = d.scaleEngine->divideScale(
minValue, maxValue,
d.maxMajor, d.maxMinor, stepSize);
}
QwtScaleWidget *scaleWidget = axisWidget(axisId);
scaleWidget->setScaleDiv(
d.scaleEngine->transformation(), d.scaleDiv);
int startDist, endDist;
scaleWidget->getBorderDistHint(startDist, endDist);
scaleWidget->setBorderDist(startDist, endDist);
}
for ( it = itmList.begin(); it != itmList.end(); ++it )
{
QwtPlotItem *item = *it;
item->updateScaleDiv( *axisScaleDiv(item->xAxis()),
*axisScaleDiv(item->yAxis()));
}
}
示例15: RectSelected
void MatrixViewer::RectSelected (const QwtDoubleRect &rect) {
ui->SB_xFrom->setValue((int)rect.left()+_p_from.x());
ui->SB_yFrom->setValue((int)rect.top()+_p_from.y());
ui->SB_xTo->setValue((int)rect.right()+_p_from.x());
ui->SB_yTo->setValue((int)rect.bottom()+_p_from.y());
}