Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_scale_map.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_scale_map.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_scale_map.h
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 13 13 #include "qwt_global.h" 14 14 #include "qwt_transform.h" 15 #include <qrect.h>16 15 17 #ifndef QT_NO_DEBUG_STREAM 18 #include <qdebug.h> 19 #endif 20 16 class QPointF; 21 17 class QRectF; 22 18 … … 27 23 of a scale into the linear coordinate system of a paint device 28 24 and vice versa. 29 */ 25 */ 30 26 class QWT_EXPORT QwtScaleMap 31 27 { 32 public: 28 public: 33 29 QwtScaleMap(); 34 30 QwtScaleMap( const QwtScaleMap& ); … … 36 32 ~QwtScaleMap(); 37 33 38 QwtScaleMap &operator=( const QwtScaleMap& );34 QwtScaleMap& operator=( const QwtScaleMap& ); 39 35 40 void setTransformation( QwtTransform * );41 const QwtTransform *transformation() const;36 void setTransformation( QwtTransform* ); 37 const QwtTransform* transformation() const; 42 38 43 39 void setPaintInterval( double p1, double p2 ); … … 56 52 double sDist() const; 57 53 58 static QRectF transform( const QwtScaleMap &, 59 const QwtScaleMap &, const QRectF & ); 60 static QRectF invTransform( const QwtScaleMap &, 61 const QwtScaleMap &, const QRectF & ); 54 static QRectF transform( const QwtScaleMap&, 55 const QwtScaleMap&, const QRectF& ); 62 56 63 static QPointF transform( const QwtScaleMap &, 64 const QwtScaleMap &, const QPointF & ); 65 static QPointF invTransform( const QwtScaleMap &, 66 const QwtScaleMap &, const QPointF & ); 57 static QRectF invTransform( const QwtScaleMap&, 58 const QwtScaleMap&, const QRectF& ); 59 60 static QPointF transform( const QwtScaleMap&, 61 const QwtScaleMap&, const QPointF& ); 62 63 static QPointF invTransform( const QwtScaleMap&, 64 const QwtScaleMap&, const QPointF& ); 67 65 68 66 bool isInverting() const; 69 67 70 private: 68 private: 71 69 void updateFactor(); 72 70 73 double d_s1, d_s2; // scale interval boundaries74 double d_p1, d_p2; // paint device interval boundaries71 double m_s1, m_s2; // scale interval boundaries 72 double m_p1, m_p2; // paint device interval boundaries 75 73 76 double d_cnv; // conversion factor77 double d_ts1;74 double m_cnv; // conversion factor 75 double m_ts1; 78 76 79 QwtTransform *d_transform;77 QwtTransform* m_transform; 80 78 }; 81 79 82 80 /*! 83 81 \return First border of the scale interval 84 */ 82 */ 85 83 inline double QwtScaleMap::s1() const 86 84 { 87 return d_s1;85 return m_s1; 88 86 } 89 87 90 88 /*! 91 89 \return Second border of the scale interval 92 */ 90 */ 93 91 inline double QwtScaleMap::s2() const 94 92 { 95 return d_s2;93 return m_s2; 96 94 } 97 95 98 96 /*! 99 97 \return First border of the paint interval 100 */ 98 */ 101 99 inline double QwtScaleMap::p1() const 102 100 { 103 return d_p1;101 return m_p1; 104 102 } 105 103 106 104 /*! 107 105 \return Second border of the paint interval 108 */ 106 */ 109 107 inline double QwtScaleMap::p2() const 110 108 { 111 return d_p2;109 return m_p2; 112 110 } 113 111 114 112 /*! 115 113 \return qwtAbs(p2() - p1()) 116 */ 114 */ 117 115 inline double QwtScaleMap::pDist() const 118 116 { 119 return qAbs( d_p2 - d_p1 );117 return qAbs( m_p2 - m_p1 ); 120 118 } 121 119 122 120 /*! 123 121 \return qwtAbs(s2() - s1()) 124 */ 122 */ 125 123 inline double QwtScaleMap::sDist() const 126 124 { 127 return qAbs( d_s2 - d_s1 );125 return qAbs( m_s2 - m_s1 ); 128 126 } 129 127 130 128 /*! 131 Transform a point related to the scale interval into an point 132 related to the interval of the paint device 129 Transform a point related to the scale interval into an point 130 related to the interval of the paint device 133 131 134 \param s Value relative to the coordinates of the scale 135 \return Transformed value 132 \param s Value relative to the coordinates of the scale 133 \return Transformed value 136 134 137 \sa invTransform() 138 */ 135 \sa invTransform() 136 */ 139 137 inline double QwtScaleMap::transform( double s ) const 140 138 { 141 if ( d_transform )142 s = d_transform->transform( s );139 if ( m_transform ) 140 s = m_transform->transform( s ); 143 141 144 return d_p1 + ( s -d_ts1 ) *d_cnv;142 return m_p1 + ( s - m_ts1 ) * m_cnv; 145 143 } 146 144 147 145 /*! 148 Transform an paint device value into a value in the 149 interval of the scale. 146 Transform an paint device value into a value in the 147 interval of the scale. 150 148 151 \param p Value relative to the coordinates of the paint device 152 \return Transformed value 149 \param p Value relative to the coordinates of the paint device 150 \return Transformed value 153 151 154 \sa transform() 155 */ 152 \sa transform() 153 */ 156 154 inline double QwtScaleMap::invTransform( double p ) const 157 155 { 158 double s = d_ts1 + ( p -d_p1 ) /d_cnv;159 if ( d_transform )160 s = d_transform->invTransform( s );156 double s = m_ts1 + ( p - m_p1 ) / m_cnv; 157 if ( m_transform ) 158 s = m_transform->invTransform( s ); 161 159 162 160 return s; … … 166 164 inline bool QwtScaleMap::isInverting() const 167 165 { 168 return ( ( d_p1 < d_p2 ) != (d_s1 < d_s2 ) );166 return ( ( m_p1 < m_p2 ) != ( m_s1 < m_s2 ) ); 169 167 } 170 168 171 169 #ifndef QT_NO_DEBUG_STREAM 172 QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap & );170 QWT_EXPORT QDebug operator<<( QDebug, const QwtScaleMap& ); 173 171 #endif 174 172
Note:
See TracChangeset
for help on using the changeset viewer.
