本文整理汇总了C++中QwtDoublePoint::x方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoublePoint::x方法的具体用法?C++ QwtDoublePoint::x怎么用?C++ QwtDoublePoint::x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoublePoint
的用法示例。
在下文中一共展示了QwtDoublePoint::x方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: qwtDistance
static inline double qwtDistance(
const QwtDoublePoint &p1, const QwtDoublePoint &p2 )
{
double dx = p2.x() - p1.x();
double dy = p2.y() - p1.y();
return ::sqrt( dx * dx + dy * dy );
}
示例2: left
QList<QwtDoublePoint> QwtCircleClipper::cuttingPoints(
Edge edge, const QwtDoublePoint &pos, double radius) const
{
QList<QwtDoublePoint> points;
if ( edge == Left || edge == Right )
{
const double x = (edge == Left) ? left() : right();
if ( qwtAbs(pos.x() - x) < radius )
{
const double off = ::sqrt(qwtSqr(radius) - qwtSqr(pos.x() - x));
const double y1 = pos.y() + off;
if ( y1 >= top() && y1 <= bottom() )
points += QwtDoublePoint(x, y1);
const double y2 = pos.y() - off;
if ( y2 >= top() && y2 <= bottom() )
points += QwtDoublePoint(x, y2);
}
}
else
{
const double y = (edge == Top) ? top() : bottom();
if ( qwtAbs(pos.y() - y) < radius )
{
const double off = ::sqrt(qwtSqr(radius) - qwtSqr(pos.y() - y));
const double x1 = pos.x() + off;
if ( x1 >= left() && x1 <= right() )
points += QwtDoublePoint(x1, y);
const double x2 = pos.x() - off;
if ( x2 >= left() && x2 <= right() )
points += QwtDoublePoint(x2, y);
}
}
return points;
}
示例3:
/*!
Constructs a rectangle with topLeft as the top-left corner and
size as the rectangle size.
*/
QwtDoubleRect::QwtDoubleRect(
const QwtDoublePoint &p, const QwtDoubleSize &size):
d_left(p.x()),
d_right(p.x() + size.width()),
d_top(p.y()),
d_bottom(p.y() + size.height())
{
}
示例4: setCoordStartPoint
void LineMarker::setCoordStartPoint(const QwtDoublePoint& p)
{
if (QwtDoublePoint(d_rect.left(), d_rect.top()) == p)
return;
d_rect.setLeft(p.x());
d_rect.setTop(p.y());
const QwtScaleMap &xMap = d_plot->canvasMap(xAxis());
const QwtScaleMap &yMap = d_plot->canvasMap(yAxis());
d_start = QPoint(xMap.transform(p.x()), yMap.transform(p.y()));
}
示例5: setCoordEndPoint
void LineMarker::setCoordEndPoint(const QwtDoublePoint& p)
{
if (QwtDoublePoint(d_rect.right(), d_rect.bottom()) == p)
return;
d_rect.setRight(p.x());
d_rect.setBottom(p.y());
const QwtScaleMap &xMap = d_plot->canvasMap(xAxis());
const QwtScaleMap &yMap = d_plot->canvasMap(yAxis());
d_end = QPoint(xMap.transform(p.x()), yMap.transform(p.y()));
}
示例6: cursorLabel
/*!
\brief Translate a position into a position string
In case of HLineRubberBand the label is the value of the
y position, in case of VLineRubberBand the value of the x position.
Otherwise the label contains x and y position separated by a ´, ´.
The format for the double to string conversion is "%.4f".
\param pos Position
\return Position string
*/
QString QwtPlotPicker::cursorLabel(const QwtDoublePoint &pos) const
{
switch(rubberBand())
{
case HLineRubberBand:
return QString().sprintf("%.4f", pos.y());
case VLineRubberBand:
return QString().sprintf("%.4f", pos.x());
default:
return QString().sprintf("%.4f, %.4f", pos.x(), pos.y());
}
return QString::null; // make some dumb compilers happy
}
示例7: trackerText
/*!
\brief Translate a position into a position string
In case of HLineRubberBand the label is the value of the
y position, in case of VLineRubberBand the value of the x position.
Otherwise the label contains x and y position separated by a ',' .
The format for the double to string conversion is "%.4f".
\param pos Position
\return Position string
*/
QwtText QwtPlotPicker::trackerText(const QwtDoublePoint &pos) const
{
QString text;
switch(rubberBand())
{
case HLineRubberBand:
text.sprintf("%.4f", pos.y());
break;
case VLineRubberBand:
text.sprintf("%.4f", pos.x());
break;
default:
text.sprintf("%.4f, %.4f", pos.x(), pos.y());
}
return QwtText(text);
}
示例8: insideEdge
bool QwtPolygonClipperF::insideEdge(const QwtDoublePoint &p, Edge edge) const
{
switch(edge)
{
case Left:
return p.x() > left();
case Top:
return p.y() > top();
case Right:
return p.x() < right();
case Bottom:
return p.y() < bottom();
default:
break;
}
return false;
}
示例9: transform
/*!
Translate a point from plot into pixel coordinates
\return Point in pixel coordinates
\sa QwtPlotPicker::invTransform()
*/
QPoint QwtPlotPicker::transform(const QwtDoublePoint &pos) const
{
QwtScaleMap xMap = plot()->canvasMap(d_xAxis);
QwtScaleMap yMap = plot()->canvasMap(d_yAxis);
return QPoint(
xMap.transform(pos.x()),
yMap.transform(pos.y())
);
}
示例10: setMarker
void SpecBox::setMarker(QwtDoublePoint n) {
QString out;
out.setNum(n.x(),'g',3);
//picker->transform(n);
//cout << "marker set at " << n.x() << "\n";
//fcenter->setXValue((double) n.x());
//fcenter->setLabel(QwtText(out));
//plot->LabelFrequency->setLabel(QwtText(out));
plot->replot();
}
示例11: displayCoordinates
void LineDialog::displayCoordinates(int unit)
{
if (unit == ScaleCoordinates){
QwtDoublePoint sp = lm->startPointCoord();
xStartBox->setValue(sp.x());
xStartBox->show();
xStartPixelBox->hide();
yStartBox->setValue(sp.y());
yStartBox->show();
yStartPixelBox->hide();
QwtDoublePoint ep = lm->endPointCoord();
xEndBox->setValue(ep.x());
xEndBox->show();
xEndPixelBox->hide();
yEndBox->setValue(ep.y());
yEndBox->show();
yEndPixelBox->hide();
} else {
QPoint startPoint = lm->startPoint();
QPoint endPoint = lm->endPoint();
xStartBox->hide();
xStartPixelBox->setValue(startPoint.x());
xStartPixelBox->show();
yStartBox->hide();
yStartPixelBox->setValue(startPoint.y());
yStartPixelBox->show();
xEndBox->hide();
xEndPixelBox->setValue(endPoint.x());
xEndPixelBox->show();
yEndBox->hide();
yEndPixelBox->setValue(endPoint.y());
yEndPixelBox->show();
}
}
示例12: displayCoordinates
void LineDialog::displayCoordinates(int unit)
{
if (unit == ScaleCoordinates)
{
QwtDoublePoint sp = lm->startPointCoord();
xStartBox->setText(QString::number(sp.x()));
yStartBox->setText(QString::number(sp.y()));
QwtDoublePoint ep = lm->endPointCoord();
xEndBox->setText(QString::number(ep.x()));
yEndBox->setText(QString::number(ep.y()));
}
else
{
QPoint startPoint = lm->startPoint();
QPoint endPoint = lm->endPoint();
xStartBox->setText(QString::number(startPoint.x()));
yStartBox->setText(QString::number(startPoint.y()));
xEndBox->setText(QString::number(endPoint.x()));
yEndBox->setText(QString::number(endPoint.y()));
}
}
示例13: pointMLESelected
void ProRataPeptideTable::pointMLESelected( const QwtDoublePoint point )
{
int iRow = 0;
unsigned int iMinIndex = 0;
double dMinDistance = 1000;
double dCurrentDistance = 0;
map< unsigned int, double > mIndexDistance;
for( unsigned int i = 0; i < vpepInfo.size(); i++ )
{
if( !vpepInfo.at(i)->getValidity() )
continue;
// the x and y axes are not in the same range
// take a sqrt to compress the difference
dCurrentDistance = sqrt( fabs( point.x() - vpepInfo.at(i)->getPCALog2Ratio() ) )
+ sqrt( fabs( point.y() - vpepInfo.at(i)->getPCALog2SNR() ) );
if( dCurrentDistance < dMinDistance )
{
dMinDistance = dCurrentDistance;
iMinIndex = i;
}
}
if( dMinDistance > 1000 )
return;
//QMessageBox::information( this, "Row to be selected, before intising", QString::number( iMinIndex ) );
iRow = (int)iMinIndex;
//QMessageBox::information( this, "Row to be selected", QString::number( iRow ) );
//qtwTable->selectRow( iRow ) ;
//qtwTable->showRow( iRow );
QAbstractItemView::SelectionMode sm = qtwTable->selectionMode();
qtwTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
qtwTable->selectRow( iRow );
qtwTable->setSelectionMode(sm);
delete ppepRatio;
ppepRatio = new PeptideRatio;
vpepInfo.at(iRow)->setPeptideRatio( ppepRatio );
emit peptideClicked( ppepRatio );
emit peptideClicked( vpepInfo.at(iRow) );
//qtwTable->selectRow( 0 ) ;
}
示例14: plotRect
/*!
\brief Calculate the bounding rect of the plot area
The plot area depends on the zoom parameters.
\param canvasRect Rectangle of the canvas
\return Rectangle for displaying 100% of the plot
*/
QwtDoubleRect QwtPolarPlot::plotRect( const QRect &canvasRect ) const
{
const QwtScaleDiv *sd = scaleDiv( QwtPolar::Radius );
const QwtScaleEngine *se = scaleEngine( QwtPolar::Radius );
const int margin = plotMarginHint();
const QRect cr = canvasRect;
const int radius = qwtMin( cr.width(), cr.height() ) / 2 - margin;
QwtScaleMap map;
map.setTransformation( se->transformation() );
map.setPaintXInterval( 0.0, radius / d_data->zoomFactor );
#if QWT_VERSION < 0x050200
map.setScaleInterval( sd->lBound(), sd->hBound() );
#else
map.setScaleInterval( sd->lowerBound(), sd->upperBound() );
#endif
double v = map.s1();
if ( map.s1() <= map.s2() )
v += d_data->zoomPos.radius();
else
v -= d_data->zoomPos.radius();
v = map.xTransform( v );
const QwtDoublePoint off =
QwtPolarPoint( d_data->zoomPos.azimuth(), v ).toPoint();
QwtDoublePoint center( cr.center().x(), cr.top() + margin + radius );
center -= QwtDoublePoint( off.x(), -off.y() );
QwtDoubleRect rect( 0, 0, 2 * map.p2(), 2 * map.p2() );
rect.moveCenter( center );
return rect;
}
示例15: intersectEdge
QwtDoublePoint QwtPolygonClipperF::intersectEdge(const QwtDoublePoint &p1,
const QwtDoublePoint &p2, Edge edge ) const
{
double x=0.0, y=0.0;
double m = 0;
const double dy = p2.y() - p1.y();
const double dx = p2.x() - p1.x();
switch ( edge )
{
case Left:
x = left();
m = double(qwtAbs(p1.x() - x)) / qwtAbs(dx);
y = p1.y() + int(dy * m);
break;
case Top:
y = top();
m = double(qwtAbs(p1.y() - y)) / qwtAbs(dy);
x = p1.x() + int(dx * m);
break;
case Right:
x = right();
m = double(qwtAbs(p1.x() - x)) / qwtAbs(dx);
y = p1.y() + int(dy * m);
break;
case Bottom:
y = bottom();
m = double(qwtAbs(p1.y() - y)) / qwtAbs(dy);
x = p1.x() + int(dx * m);
break;
default:
break;
}
return QwtDoublePoint(x,y);
}