本文整理汇总了C++中QwtDoublePoint::toPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ QwtDoublePoint::toPoint方法的具体用法?C++ QwtDoublePoint::toPoint怎么用?C++ QwtDoublePoint::toPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QwtDoublePoint
的用法示例。
在下文中一共展示了QwtDoublePoint::toPoint方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawRays
/*!
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 );
}
}
}
示例2: 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);
}
}
示例3: updateScaleDraws
/*!
Update the axis scale draw geometries
\param azimuthMap Maps azimuth values to values related to 0.0, M_2PI
\param radialMap Maps radius values into painter coordinates.
\param pole Position of the pole in painter coordinates
\param radius Radius of the complete plot area in painter coordinates
\sa updateScaleDiv()
*/
void QwtPolarGrid::updateScaleDraws(
const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap,
const QwtDoublePoint &pole, double radius ) const
{
const QPoint p = pole.toPoint();
const QwtDoubleInterval interval =
d_data->gridData[QwtPolar::ScaleRadius].scaleDiv.interval();
const int min = radialMap.transform( interval.minValue() );
const int max = radialMap.transform( interval.maxValue() );
const int l = max - min;
for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ )
{
AxisData &axis = d_data->axisData[axisId];
if ( axisId == QwtPolar::AxisAzimuth )
{
QwtRoundScaleDraw *scaleDraw = ( QwtRoundScaleDraw * )axis.scaleDraw;
scaleDraw->setRadius( qRound( radius ) );
scaleDraw->moveCenter( p );
double from = ::fmod( 90.0 - azimuthMap.p1() * 180.0 / M_PI, 360.0 );
if ( from < 0.0 )
from += 360.0;
scaleDraw->setAngleRange( from, from - 360.0 );
scaleDraw->setTransformation( azimuthMap.transformation()->copy() );
}
else
{
QwtScaleDraw *scaleDraw = ( QwtScaleDraw * )axis.scaleDraw;
switch ( axisId )
{
case QwtPolar::AxisLeft:
{
scaleDraw->move( p.x() - min, p.y() );
scaleDraw->setLength( -l );
break;
}
case QwtPolar::AxisRight:
{
scaleDraw->move( p.x() + min, p.y() );
scaleDraw->setLength( l );
break;
}
case QwtPolar::AxisTop:
{
scaleDraw->move( p.x(), p.y() - max );
scaleDraw->setLength( l );
break;
}
case QwtPolar::AxisBottom:
{
scaleDraw->move( p.x(), p.y() + max );
scaleDraw->setLength( -l );
break;
}
}
scaleDraw->setTransformation( radialMap.transformation()->copy() );
}
}
}