当前位置: 首页>>代码示例>>C++>>正文


C++ QwtDoublePoint类代码示例

本文整理汇总了C++中QwtDoublePoint的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoublePoint类的具体用法?C++ QwtDoublePoint怎么用?C++ QwtDoublePoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QwtDoublePoint类的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 );
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:7,代码来源:qwt_polar_plot.cpp

示例2: if

/*!
  Draw lines from the pole

  \param painter Painter
  \param canvasRect Contents rect of the canvas in painter coordinates
  \param pole Position of the pole in painter coordinates
  \param radius Length of the lines in painter coordinates
  \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
  \param values Azimuth values, indicating the direction of the lines
*/
void QwtPolarGrid::drawRays(
  QPainter *painter, const QwtDoubleRect &canvasRect,
  const QwtDoublePoint &pole, double radius,
  const QwtScaleMap &azimuthMap, const QwtValueList &values ) const
{
  for ( int i = 0; i < int( values.size() ); i++ )
  {
    double azimuth = azimuthMap.xTransform( values[i] );
    azimuth = ::fmod( azimuth, 2 * M_PI );

    bool skipLine = false;
    if ( testDisplayFlag( SmartScaleDraw ) )
    {
      const QwtAbstractScaleDraw::ScaleComponent bone =
        QwtAbstractScaleDraw::Backbone;
      if ( isClose( azimuth, 0.0 ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisRight];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
      else if ( isClose( azimuth, M_PI / 2 ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisTop];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
      else if ( isClose( azimuth, M_PI ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisLeft];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
      else if ( isClose( azimuth, 3 * M_PI / 2.0 ) )
      {
        const AxisData &axis = d_data->axisData[QwtPolar::AxisBottom];
        if ( axis.isVisible && axis.scaleDraw->hasComponent( bone ) )
          skipLine = true;
      }
    }
    if ( !skipLine )
    {
      const QwtDoublePoint pos = qwtPolar2Pos( pole, radius, azimuth );

      /*
          Qt4 is horrible slow, when painting primitives,
          with coordinates far outside the visible area.
       */

      QwtPolygon pa( 2 );
      pa.setPoint( 0, pole.toPoint() );
      pa.setPoint( 1, pos.toPoint() );

      if ( testDisplayFlag( ClipGridLines ) )
        pa = QwtClipper::clipPolygon( canvasRect.toRect(), pa );

      QwtPainter::drawPolyline( painter, pa );
    }
  }
}
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:70,代码来源:qwt_polar_grid.cpp

示例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())
{
}
开发者ID:luisMbedder,项目名称:SpectrumScan,代码行数:12,代码来源:qwt_double_rect.cpp

示例4: 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())
    );
}
开发者ID:376473984,项目名称:pvb,代码行数:15,代码来源:qwt_plot_picker.cpp

示例5: 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()));
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:13,代码来源:LineMarker.cpp

示例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
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:25,代码来源:qwt_plot_picker.cpp

示例7: 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()));
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:13,代码来源:LineMarker.cpp

示例8: 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;
}
开发者ID:DTUautopilot,项目名称:qgroundcontrol,代码行数:35,代码来源:qwt_clipper.cpp

示例9: 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 ) ;
}
开发者ID:chongle,项目名称:prorata,代码行数:46,代码来源:proRataPeptideTable.cpp

示例10: 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);
}
开发者ID:376473984,项目名称:pvb,代码行数:29,代码来源:qwt_plot_picker.cpp

示例11: 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;
}
开发者ID:DTUautopilot,项目名称:qgroundcontrol,代码行数:18,代码来源:qwt_clipper.cpp

示例12: trackerText

/**
 *  This overrides the base class trackerText() function so that we can
 *  continuously emit a signal as the mouse is moved.
 *
 *  @param pos  The current mouse location.
 */
QwtText TrackingPicker::trackerText(const QwtDoublePoint &pos) const {
  emit mouseMoved(pos.toPoint());
  if (m_hideReadout) {
    return QwtText();
  } else // call super class trackerText
  {      // so the tracker text still works
    return QwtPlotPicker::trackerText(pos);
  }
}
开发者ID:DanNixon,项目名称:mantid,代码行数:15,代码来源:TrackingPicker.cpp

示例13: 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();

}
开发者ID:Metras,项目名称:viradi,代码行数:12,代码来源:specbox.cpp

示例14: scaleDiv

/*!
   \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;
}
开发者ID:ACorradini,项目名称:QGIS,代码行数:44,代码来源:qwt_polar_plot.cpp

示例15: 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();
	}
}
开发者ID:trnielsen,项目名称:mantid,代码行数:39,代码来源:LineDialog.cpp


注:本文中的QwtDoublePoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。