Changeset 8127 in ntrip for trunk/BNC/qwt/qwt_clipper.cpp
- Timestamp:
- May 10, 2017, 3:20:54 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_clipper.cpp
r4271 r8127 11 11 #include "qwt_point_polar.h" 12 12 #include <qrect.h> 13 #include <string.h> 14 #include <stdlib.h> 13 15 14 16 #if QT_VERSION < 0x040601 … … 44 46 { 45 47 double dy = ( p1.y() - p2.y() ) / double( p1.x() - p2.x() ); 46 return Point( d_x1, ( Value )( p2.y() + ( d_x1 - p2.x() ) * dy ) );48 return Point( d_x1, static_cast< Value >( p2.y() + ( d_x1 - p2.x() ) * dy ) ); 47 49 } 48 50 private: … … 67 69 { 68 70 double dy = ( p1.y() - p2.y() ) / double( p1.x() - p2.x() ); 69 return Point( d_x2, ( Value )( p2.y() + ( d_x2 - p2.x() ) * dy ) );71 return Point( d_x2, static_cast<Value>( p2.y() + ( d_x2 - p2.x() ) * dy ) ); 70 72 } 71 73 … … 91 93 { 92 94 double dx = ( p1.x() - p2.x() ) / double( p1.y() - p2.y() ); 93 return Point( ( Value )( p2.x() + ( d_y1 - p2.y() ) * dx ), d_y1 );95 return Point( static_cast<Value>( p2.x() + ( d_y1 - p2.y() ) * dx ), d_y1 ); 94 96 } 95 97 … … 115 117 { 116 118 double dx = ( p1.x() - p2.x() ) / double( p1.y() - p2.y() ); 117 return Point( ( Value )( p2.x() + ( d_y2 - p2.y() ) * dx ), d_y2 );119 return Point( static_cast<Value>( p2.x() + ( d_y2 - p2.y() ) * dx ), d_y2 ); 118 120 } 119 121 … … 138 140 { 139 141 if ( m_buffer ) 140 qFree( m_buffer );142 ::free( m_buffer ); 141 143 } 142 144 … … 146 148 147 149 m_size = numPoints; 148 qMemCopy( m_buffer, points, m_size * sizeof( Point ) );150 ::memcpy( m_buffer, points, m_size * sizeof( Point ) ); 149 151 } 150 152 … … 191 193 m_capacity *= 2; 192 194 193 m_buffer = ( Point * ) qRealloc(194 m_buffer, m_capacity * sizeof( Point) );195 m_buffer = static_cast<Point *>( 196 ::realloc( m_buffer, m_capacity * sizeof( Point ) ) ); 195 197 } 196 198 … … 230 232 Polygon p; 231 233 p.resize( points1.size() ); 232 qMemCopy( p.data(), points1.data(), points1.size() * sizeof( Point ) );234 ::memcpy( p.data(), points1.data(), points1.size() * sizeof( Point ) ); 233 235 234 236 return p; … … 335 337 QList<QPointF> points; 336 338 for ( int edge = 0; edge < NEdges; edge++ ) 337 points += cuttingPoints( ( Edge )edge, pos, radius );339 points += cuttingPoints( static_cast<Edge>(edge), pos, radius ); 338 340 339 341 QVector<QwtInterval> intv; … … 444 446 */ 445 447 QPolygon QwtClipper::clipPolygon( 448 const QRectF &clipRect, const QPolygon &polygon, bool closePolygon ) 449 { 450 const int minX = qCeil( clipRect.left() ); 451 const int maxX = qFloor( clipRect.right() ); 452 const int minY = qCeil( clipRect.top() ); 453 const int maxY = qFloor( clipRect.bottom() ); 454 455 const QRect r( minX, minY, maxX - minX, maxY - minY ); 456 457 QwtPolygonClipper<QPolygon, QRect, QPoint, int> clipper( r ); 458 return clipper.clipPolygon( polygon, closePolygon ); 459 } 460 /*! 461 Sutherland-Hodgman polygon clipping 462 463 \param clipRect Clip rectangle 464 \param polygon Polygon 465 \param closePolygon True, when the polygon is closed 466 467 \return Clipped polygon 468 */ 469 QPolygon QwtClipper::clipPolygon( 446 470 const QRect &clipRect, const QPolygon &polygon, bool closePolygon ) 447 471 { … … 469 493 Circle clipping 470 494 471 clipCircle() d evides a circle into intervals of angles representing arcs495 clipCircle() divides a circle into intervals of angles representing arcs 472 496 of the circle. When the circle is completely inside the clip rectangle 473 497 an interval [0.0, 2 * M_PI] is returned.
Note:
See TracChangeset
for help on using the changeset viewer.