23
23
#include < QPainter>
24
24
25
25
QgsMapCanvasMap::QgsMapCanvasMap ( QgsMapCanvas* canvas )
26
- : QgsMapCanvasItem( canvas ), mRotation( 0.0 )
26
+ : QgsMapCanvasItem( canvas )
27
27
{
28
28
setZValue ( -10 );
29
29
}
@@ -32,9 +32,8 @@ QgsMapCanvasMap::~QgsMapCanvasMap()
32
32
{
33
33
}
34
34
35
- void QgsMapCanvasMap::setContent ( const QImage& image, const QgsRectangle& rect, double rotation )
35
+ void QgsMapCanvasMap::setContent ( const QImage& image, const QgsRectangle& rect )
36
36
{
37
- mRotation = rotation;
38
37
mImage = image;
39
38
40
39
// For true retro fans: this is approximately how the graphics looked like in 1990
@@ -48,27 +47,12 @@ void QgsMapCanvasMap::setContent( const QImage& image, const QgsRectangle& rect,
48
47
void QgsMapCanvasMap::paint ( QPainter* painter )
49
48
{
50
49
int w = qRound ( boundingRect ().width () ) - 2 , h = qRound ( boundingRect ().height () ) - 2 ; // setRect() makes the size +2 :-(
51
- int wi = mImage .width ();
52
- int hi = mImage .height ();
53
-
54
- double ar = h ? double (w)/h : 0.0 ; // aspect ratio of bounding rect
55
- double ari = hi ? double (wi)/hi : 0.0 ; // aspect ratio of image
56
- double ard = fabs (ari-ar); // aspect ratio difference
57
-
58
- #if 0
59
- QgsDebugMsg( QString( "XXXX img %1,%2 (%3) item %4,%5 (%6) ardiff %7" )
60
- .arg( wi ).arg( hi ).arg( ari )
61
- .arg( w ).arg( h ).arg( ar )
62
- .arg ( ard )
63
- );
64
- #endif
65
-
66
50
if ( mImage .size () != QSize ( w, h ) )
67
51
{
68
- QgsDebugMsg ( QString ( " map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ).arg ( wi ).arg ( hi ).arg ( w ).arg ( h ) );
52
+ QgsDebugMsg ( QString ( " map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ).arg ( mImage . width () ).arg ( mImage . height () ).arg ( w ).arg ( h ) );
69
53
}
70
54
71
- if ( mRotation )
55
+ if ( mMapCanvas -> getCoordinateTransform ()-> mapRotation () )
72
56
{
73
57
int tX = ( w - mImage .width () ) / 2.0 ;
74
58
int tY = ( h - mImage .height () ) / 2.0 ;
0 commit comments