Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_raster_data.cpp
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_raster_data.cpp (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_raster_data.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_raster_data.h" 11 11 #include "qwt_point_3d.h" 12 #include "qwt_interval.h" 13 14 #include <qrect.h> 15 #include <qpolygon.h> 12 16 #include <qnumeric.h> 17 #include <qlist.h> 18 #include <qmap.h> 13 19 14 20 class QwtRasterData::ContourPlane 15 21 { 16 public: 17 inline ContourPlane( double z ): 18 d_z( z )22 public: 23 explicit inline ContourPlane( double z ): 24 m_z( z ) 19 25 { 20 26 } … … 23 29 QPointF line[2], bool ignoreOnPlane ) const; 24 30 25 inline double z() const { return d_z; }26 27 private: 31 inline double z() const { return m_z; } 32 33 private: 28 34 inline int compare( double z ) const; 29 35 inline QPointF intersection( 30 const QwtPoint3D& p1, const QwtPoint3D &p2 ) const;31 32 double d_z;36 const QwtPoint3D& p1, const QwtPoint3D& p2 ) const; 37 38 double m_z; 33 39 }; 34 40 … … 65 71 }; 66 72 67 const int edgeType = tab[eq1 +1][eq2+1][eq3+1];73 const int edgeType = tab[eq1 + 1][eq2 + 1][eq3 + 1]; 68 74 switch ( edgeType ) 69 75 { … … 135 141 inline int QwtRasterData::ContourPlane::compare( double z ) const 136 142 { 137 if ( z > d_z )143 if ( z > m_z ) 138 144 return 1; 139 145 140 if ( z < d_z )146 if ( z < m_z ) 141 147 return -1; 142 148 … … 145 151 146 152 inline QPointF QwtRasterData::ContourPlane::intersection( 147 const QwtPoint3D& p1, const QwtPoint3D &p2 ) const148 { 149 const double h1 = p1.z() - d_z;150 const double h2 = p2.z() - d_z;153 const QwtPoint3D& p1, const QwtPoint3D& p2 ) const 154 { 155 const double h1 = p1.z() - m_z; 156 const double h2 = p2.z() - m_z; 151 157 152 158 const double x = ( h2 * p1.x() - h1 * p2.x() ) / ( h2 - h1 ); … … 156 162 } 157 163 164 class QwtRasterData::PrivateData 165 { 166 public: 167 QwtRasterData::Attributes attributes; 168 }; 169 158 170 //! Constructor 159 171 QwtRasterData::QwtRasterData() 160 172 { 173 m_data = new PrivateData(); 161 174 } 162 175 … … 164 177 QwtRasterData::~QwtRasterData() 165 178 { 166 } 167 168 /*! 169 Set the bounding interval for the x, y or z coordinates. 170 171 \param axis Axis 172 \param interval Bounding interval 173 174 \sa interval() 175 */ 176 void QwtRasterData::setInterval( Qt::Axis axis, const QwtInterval &interval ) 177 { 178 d_intervals[axis] = interval; 179 } 180 181 /*! 182 \brief Initialize a raster 183 184 Before the composition of an image QwtPlotSpectrogram calls initRaster(), 185 announcing the area and its resolution that will be requested. 186 187 The default implementation does nothing, but for data sets that 188 are stored in files, it might be good idea to reimplement initRaster(), 189 where the data is resampled and loaded into memory. 190 191 \param area Area of the raster 192 \param raster Number of horizontal and vertical pixels 193 194 \sa initRaster(), value() 195 */ 196 void QwtRasterData::initRaster( const QRectF &area, const QSize &raster ) 179 delete m_data; 180 } 181 182 /*! 183 Specify an attribute of the data 184 185 \param attribute Attribute 186 \param on On/Off 187 /sa Attribute, testAttribute() 188 */ 189 void QwtRasterData::setAttribute( Attribute attribute, bool on ) 190 { 191 if ( on ) 192 m_data->attributes |= attribute; 193 else 194 m_data->attributes &= ~attribute; 195 } 196 197 /*! 198 \return True, when attribute is enabled 199 \sa Attribute, setAttribute() 200 */ 201 bool QwtRasterData::testAttribute( Attribute attribute ) const 202 { 203 return m_data->attributes & attribute; 204 } 205 206 /*! 207 \brief Initialize a raster 208 209 Before the composition of an image QwtPlotSpectrogram calls initRaster(), 210 announcing the area and its resolution that will be requested. 211 212 The default implementation does nothing, but for data sets that 213 are stored in files, it might be good idea to reimplement initRaster(), 214 where the data is resampled and loaded into memory. 215 216 \param area Area of the raster 217 \param raster Number of horizontal and vertical pixels 218 219 \sa initRaster(), value() 220 */ 221 void QwtRasterData::initRaster( const QRectF& area, const QSize& raster ) 197 222 { 198 223 Q_UNUSED( area ); … … 201 226 202 227 /*! 203 \brief Discard a raster 204 205 After the composition of an image QwtPlotSpectrogram calls discardRaster(). 206 207 The default implementation does nothing, but if data has been loaded 208 in initRaster(), it could deleted now. 209 210 \sa initRaster(), value() 211 */ 228 \brief Discard a raster 229 230 After the composition of an image QwtPlotSpectrogram calls discardRaster(). 231 232 The default implementation does nothing, but if data has been loaded 233 in initRaster(), it could deleted now. 234 235 \sa initRaster(), value() 236 */ 212 237 void QwtRasterData::discardRaster() 213 238 { … … 239 264 240 265 \return Bounding rectangle of a pixel 241 */ 242 QRectF QwtRasterData::pixelHint( const QRectF &area ) const266 */ 267 QRectF QwtRasterData::pixelHint( const QRectF& area ) const 243 268 { 244 269 Q_UNUSED( area ); … … 258 283 An adaption of CONREC, a simple contouring algorithm. 259 284 http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/ 260 */ 285 */ 261 286 QwtRasterData::ContourLines QwtRasterData::contourLines( 262 const QRectF &rect, const QSize&raster,263 const QList< double> &levels, ConrecFlags flags ) const287 const QRectF& rect, const QSize& raster, 288 const QList< double >& levels, ConrecFlags flags ) const 264 289 { 265 290 ContourLines contourLines; … … 279 304 ignoreOutOfRange = flags & IgnoreOutOfRange; 280 305 281 QwtRasterData *that = const_cast<QwtRasterData*>( this );306 QwtRasterData* that = const_cast< QwtRasterData* >( this ); 282 307 that->initRaster( rect, raster ); 283 284 #if __GNUC__ >= 9285 #pragma GCC diagnostic push286 #pragma GCC diagnostic ignored "-Wdeprecated-copy"287 #endif288 308 289 309 for ( int y = 0; y < raster.height() - 1; y++ ) … … 313 333 xy[TopRight].setZ( 314 334 value( xy[TopRight].x(), xy[TopRight].y() ) 315 ); 335 ); 316 336 317 337 xy[BottomRight].setX( pos.x() ); … … 319 339 xy[BottomRight].setZ( 320 340 value( xy[BottomRight].x(), xy[BottomRight].y() ) 321 ); 341 ); 322 342 } 323 343 … … 332 352 xy[TopRight].setZ( 333 353 value( xy[TopRight].x(), xy[TopRight].y() ) 334 ); 354 ); 335 355 xy[BottomRight].setZ( 336 356 value( xy[BottomRight].x(), xy[BottomRight].y() ) 337 ); 357 ); 338 358 339 359 double zMin = xy[TopLeft].z(); … … 380 400 if ( level < zMin || level > zMax ) 381 401 continue; 382 QPolygonF &lines = contourLines[level];402 QPolygonF& lines = contourLines[level]; 383 403 const ContourPlane plane( level ); 384 404 … … 404 424 } 405 425 406 #if __GNUC__ >= 9407 #pragma GCC diagnostic pop408 #endif409 410 426 that->discardRaster(); 411 427
Note:
See TracChangeset
for help on using the changeset viewer.
