Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_point_polar.cpp


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (3 weeks ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/qwt/qwt_point_polar.cpp

    r9383 r11158  
    1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
     1/******************************************************************************
    22 * QwtPolar Widget Library
    33 * Copyright (C) 2008   Uwe Rathmann
    … …  
    1010#include "qwt_math.h"
    1111
    12 #if QT_VERSION < 0x040601
    13 #define qAtan2(y, x) ::atan2(y, x)
     12#if QT_VERSION >= 0x050200
     13
     14static QwtPointPolar qwtPointToPolar( const QPointF& point )
     15{
     16    return QwtPointPolar( point );
     17}
     18
    1419#endif
     20
     21namespace
     22{
     23    static const struct RegisterQwtPointPolar
     24    {
     25        inline RegisterQwtPointPolar()
     26        {
     27            qRegisterMetaType< QwtPointPolar >();
     28
     29#if QT_VERSION >= 0x050200
     30            QMetaType::registerConverter< QPointF, QwtPointPolar >( qwtPointToPolar );
     31            QMetaType::registerConverter< QwtPointPolar, QPointF >( &QwtPointPolar::toPoint );
     32#endif
     33        }
     34
     35    } qwtRegisterQwtPointPolar;
     36}
    1537
    1638/*!
    … …  
    1941   \param p Point in Cartesian coordinates
    2042   \sa setPoint(), toPoint()
    21 */
    22 QwtPointPolar::QwtPointPolar( const QPointF &p )
     43 */
     44QwtPointPolar::QwtPointPolar( const QPointF& p )
    2345{
    24     d_radius = qSqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
    25     d_azimuth = qAtan2( p.y(), p.x() );
     46    m_radius = std::sqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
     47    m_azimuth = std::atan2( p.y(), p.x() );
    2648}
    2749
    … …  
    2951   Convert and assign values from a point in Cartesian coordinates
    3052   \param p Point in Cartesian coordinates
    31 */
    32 void QwtPointPolar::setPoint( const QPointF &p )
     53 */
     54void QwtPointPolar::setPoint( const QPointF& p )
    3355{
    34     d_radius = qSqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
    35     d_azimuth = qAtan2( p.y(), p.x() );
     56    m_radius = std::sqrt( qwtSqr( p.x() ) + qwtSqr( p.y() ) );
     57    m_azimuth = std::atan2( p.y(), p.x() );
    3658}
    3759
    … …  
    4365   \note Invalid or null points will be returned as QPointF(0.0, 0.0)
    4466   \sa isValid(), isNull()
    45 */
     67 */
    4668QPointF QwtPointPolar::toPoint() const
    4769{
    48     if ( d_radius <= 0.0 )
     70    if ( m_radius <= 0.0 )
    4971        return QPointF( 0.0, 0.0 );
    5072
    51     const double x = d_radius * qCos( d_azimuth );
    52     const double y = d_radius * qSin( d_azimuth );
     73    const double x = m_radius * std::cos( m_azimuth );
     74    const double y = m_radius * std::sin( m_azimuth );
    5375
    5476    return QPointF( x, y );
    … …  
    6587
    6688    \sa normalized()
    67 */
    68 bool QwtPointPolar::operator==( const QwtPointPolar &other ) const
     89 */
     90bool QwtPointPolar::operator==( const QwtPointPolar& other ) const
    6991{
    70     return d_radius == other.d_radius && d_azimuth == other.d_azimuth;
     92    return m_radius == other.m_radius && m_azimuth == other.m_azimuth;
    7193}
    7294
    … …  
    80102    \return True if the point is not equal to other; otherwise return false.
    81103    \sa normalized()
    82 */
    83 bool QwtPointPolar::operator!=( const QwtPointPolar &other ) const
     104 */
     105bool QwtPointPolar::operator!=( const QwtPointPolar& other ) const
    84106{
    85     return d_radius != other.d_radius || d_azimuth != other.d_azimuth;
     107    return m_radius != other.m_radius || m_azimuth != other.m_azimuth;
    86108}
    87109
    … …  
    93115
    94116   \return Normalized point
    95 */
     117 */
    96118QwtPointPolar QwtPointPolar::normalized() const
    97119{
    98     const double radius = qMax( d_radius, 0.0 );
     120    const double radius = qwtMaxF( m_radius, 0.0 );
    99121
    100     double azimuth = d_azimuth;
     122    double azimuth = m_azimuth;
    101123    if ( azimuth < -2.0 * M_PI || azimuth >= 2 * M_PI )
    102         azimuth = ::fmod( d_azimuth, 2 * M_PI );
     124        azimuth = std::fmod( m_azimuth, 2 * M_PI );
    103125
    104126    if ( azimuth < 0.0 )
    … …  
    110132#ifndef QT_NO_DEBUG_STREAM
    111133
    112 QDebug operator<<( QDebug debug, const QwtPointPolar &point )
     134#include <qdebug.h>
     135
     136QDebug operator<<( QDebug debug, const QwtPointPolar& point )
    113137{
    114138    debug.nospace() << "QwtPointPolar("
    115         << point.azimuth() << "," << point.radius() << ")";
     139                    << point.azimuth() << "," << point.radius() << ")";
    116140
    117141    return debug.space();
Note: See TracChangeset for help on using the changeset viewer.