00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef QGSMAPTOPIXEL
00019 #define QGSMAPTOPIXEL
00020
00021 #include "qgspoint.h"
00022 #include <vector>
00023
00024 #include <cassert>
00025
00026 class QgsPoint;
00027 class QPoint;
00028
00034 class CORE_EXPORT QgsMapToPixel
00035 {
00036 public:
00037
00038
00039
00040
00041
00042
00043 QgsMapToPixel( double mapUnitsPerPixel = 0, double ymax = 0, double ymin = 0,
00044 double xmin = 0 );
00046 ~QgsMapToPixel();
00051 QgsPoint transform( const QgsPoint& p ) const;
00052 void transform( QgsPoint* p ) const;
00059 QgsPoint transform( double x, double y ) const;
00066
00067
00068
00069 void transformInPlace( double& x, double& y ) const;
00070
00071
00072
00073
00074 void transformInPlace( std::vector<double>& x,
00075 std::vector<double>& y ) const;
00076
00077 QgsPoint toMapCoordinates( int x, int y ) const;
00078
00081 QgsPoint toMapCoordinatesF( double x, double y ) const;
00082
00087 QgsPoint toMapCoordinates( QPoint p ) const;
00088
00089 QgsPoint toMapPoint( double x, double y ) const;
00093 void setMapUnitsPerPixel( double mapUnitsPerPixel );
00094
00096 double mapUnitsPerPixel() const;
00097
00099 void setYMaximum( double ymax );
00101 void setYMinimum( double ymin );
00103 void setXMinimum( double xmin );
00110 void setParameters( double mapUnitsPerPixel, double xmin, double ymin, double ymax );
00112 QString showParameters();
00113
00114 private:
00115 double mMapUnitsPerPixel;
00116 double yMax;
00117 double yMin;
00118 double xMin;
00119 double xMax;
00120
00121 };
00122
00123
00124 #endif // QGSMAPTOPIXEL