Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_compass_rose.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_compass_rose.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_compass_rose.cpp
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 10 10 #include "qwt_compass_rose.h" 11 11 #include "qwt_point_polar.h" 12 #include "qwt_painter.h" 12 13 13 #include <qpainter.h> 14 14 #include <qpainterpath.h> … … 21 21 22 22 QPointF pos; 23 #if QT_VERSION >= 0x050e00 24 if ( line1.intersects( line2, &pos ) == QLineF::NoIntersection ) 25 #else 23 26 if ( line1.intersect( line2, &pos ) == QLineF::NoIntersection ) 27 #endif 24 28 return QPointF(); 25 29 … … 27 31 } 28 32 33 //! Constructor 34 QwtCompassRose::QwtCompassRose() 35 { 36 } 37 38 //! Destructor 39 QwtCompassRose::~QwtCompassRose() 40 { 41 } 42 43 //! Assign a palette 44 void QwtCompassRose::setPalette( const QPalette& p ) 45 { 46 m_palette = p; 47 } 48 49 //! \return Current palette 50 const QPalette& QwtCompassRose::palette() const 51 { 52 return m_palette; 53 } 54 29 55 class QwtSimpleCompassRose::PrivateData 30 56 { 31 public: 32 PrivateData() :33 width( 0.2 ) ,34 numThorns( 8 ) ,35 numThornLevels( -1 ) ,36 shrinkFactor( 0.9 ) 57 public: 58 PrivateData() 59 : width( 0.2 ) 60 , numThorns( 8 ) 61 , numThornLevels( -1 ) 62 , shrinkFactor( 0.9 ) 37 63 { 38 64 } … … 49 75 \param numThorns Number of thorns 50 76 \param numThornLevels Number of thorn levels 51 */ 77 */ 52 78 QwtSimpleCompassRose::QwtSimpleCompassRose( 53 79 int numThorns, int numThornLevels ) 54 80 { 55 d_data = new PrivateData();56 d_data->numThorns = numThorns;57 d_data->numThornLevels = numThornLevels;81 m_data = new PrivateData(); 82 m_data->numThorns = numThorns; 83 m_data->numThornLevels = numThornLevels; 58 84 59 85 const QColor dark( 128, 128, 255 ); … … 70 96 QwtSimpleCompassRose::~QwtSimpleCompassRose() 71 97 { 72 delete d_data;73 } 74 75 /*! 76 Set the Factor how to shrink the thorns with each level 77 The default value is 0.9. 78 79 \param factor Shrink factor 80 \sa shrinkFactor() 81 */ 98 delete m_data; 99 } 100 101 /*! 102 Set the Factor how to shrink the thorns with each level 103 The default value is 0.9. 104 105 \param factor Shrink factor 106 \sa shrinkFactor() 107 */ 82 108 void QwtSimpleCompassRose::setShrinkFactor( double factor ) 83 109 { 84 d_data->shrinkFactor = factor;85 } 86 87 /*! 88 \return Factor how to shrink the thorns with each level 89 \sa setShrinkFactor() 90 */ 110 m_data->shrinkFactor = factor; 111 } 112 113 /*! 114 \return Factor how to shrink the thorns with each level 115 \sa setShrinkFactor() 116 */ 91 117 double QwtSimpleCompassRose::shrinkFactor() const 92 118 { 93 return d_data->shrinkFactor;119 return m_data->shrinkFactor; 94 120 } 95 121 … … 102 128 \param north Position 103 129 \param cg Color group 104 */ 105 void QwtSimpleCompassRose::draw( QPainter *painter, const QPointF¢er,130 */ 131 void QwtSimpleCompassRose::draw( QPainter* painter, const QPointF& center, 106 132 double radius, double north, QPalette::ColorGroup cg ) const 107 133 { … … 109 135 pal.setCurrentColorGroup( cg ); 110 136 111 drawRose( painter, pal, center, radius, north, d_data->width,112 d_data->numThorns,d_data->numThornLevels,d_data->shrinkFactor );137 drawRose( painter, pal, center, radius, north, m_data->width, 138 m_data->numThorns, m_data->numThornLevels, m_data->shrinkFactor ); 113 139 } 114 140 … … 125 151 \param numThornLevels Number of thorn levels 126 152 \param shrinkFactor Factor to shrink the thorns with each level 127 */ 153 */ 128 154 void QwtSimpleCompassRose::drawRose( 129 QPainter *painter,130 const QPalette &palette,131 const QPointF ¢er, double radius, double north, double width,155 QPainter* painter, 156 const QPalette& palette, 157 const QPointF& center, double radius, double north, double width, 132 158 int numThorns, int numThornLevels, double shrinkFactor ) 133 159 { … … 153 179 for ( int j = 1; j <= numThornLevels; j++ ) 154 180 { 155 double step = qPow( 2.0, j ) * M_PI / numThorns;181 double step = std::pow( 2.0, j ) * M_PI / numThorns; 156 182 if ( step > M_PI_2 ) 157 183 break; … … 203 229 204 230 \param width Width 205 */ 231 */ 206 232 void QwtSimpleCompassRose::setWidth( double width ) 207 233 { 208 d_data->width = width;209 if ( d_data->width < 0.03 )210 d_data->width = 0.03;211 212 if ( d_data->width > 0.4 )213 d_data->width = 0.4;214 } 215 216 /*! 217 \return Width of the rose 218 \sa setWidth() 234 m_data->width = width; 235 if ( m_data->width < 0.03 ) 236 m_data->width = 0.03; 237 238 if ( m_data->width > 0.4 ) 239 m_data->width = 0.4; 240 } 241 242 /*! 243 \return Width of the rose 244 \sa setWidth() 219 245 */ 220 246 double QwtSimpleCompassRose::width() const 221 247 { 222 return d_data->width;223 } 224 225 /*! 226 Set the number of thorns on one level 227 The number is aligned to a multiple of 4, with a minimum of 4 228 229 \param numThorns Number of thorns 230 \sa numThorns(), setNumThornLevels() 231 */ 248 return m_data->width; 249 } 250 251 /*! 252 Set the number of thorns on one level 253 The number is aligned to a multiple of 4, with a minimum of 4 254 255 \param numThorns Number of thorns 256 \sa numThorns(), setNumThornLevels() 257 */ 232 258 void QwtSimpleCompassRose::setNumThorns( int numThorns ) 233 259 { … … 238 264 numThorns += 4 - numThorns % 4; 239 265 240 d_data->numThorns = numThorns;266 m_data->numThorns = numThorns; 241 267 } 242 268 … … 244 270 \return Number of thorns 245 271 \sa setNumThorns(), setNumThornLevels() 246 */ 272 */ 247 273 int QwtSimpleCompassRose::numThorns() const 248 274 { 249 return d_data->numThorns;250 } 251 252 /*! 253 Set the of thorns levels 254 255 \param numThornLevels Number of thorns levels 256 \sa setNumThorns(), numThornLevels() 257 */ 275 return m_data->numThorns; 276 } 277 278 /*! 279 Set the of thorns levels 280 281 \param numThornLevels Number of thorns levels 282 \sa setNumThorns(), numThornLevels() 283 */ 258 284 void QwtSimpleCompassRose::setNumThornLevels( int numThornLevels ) 259 285 { 260 d_data->numThornLevels = numThornLevels;286 m_data->numThornLevels = numThornLevels; 261 287 } 262 288 … … 264 290 \return Number of thorn levels 265 291 \sa setNumThorns(), setNumThornLevels() 266 */ 292 */ 267 293 int QwtSimpleCompassRose::numThornLevels() const 268 294 { 269 return d_data->numThornLevels;270 } 295 return m_data->numThornLevels; 296 }
Note:
See TracChangeset
for help on using the changeset viewer.
