Skip to content

Commit 90db597

Browse files
author
Sandro Santilli
committedDec 13, 2014
Simplify the change by not modifing interfaces
.. I've found a link from gsMapCanvasMap and the QgsMapToPixel class
1 parent 05d0306 commit 90db597

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed
 

‎src/gui/qgsmapcanvas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ void QgsMapCanvas::rendererJobFinished()
724724
p.end();
725725

726726
QgsRectangle rect = mSettings.visibleExtent();
727-
mMap->setContent( img, rect, mSettings.rotation() );
727+
mMap->setContent( img, rect );
728728
}
729729

730730
// now we are in a slot called from mJob - do not delete it immediately

‎src/gui/qgsmapcanvasmap.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <QPainter>
2424

2525
QgsMapCanvasMap::QgsMapCanvasMap( QgsMapCanvas* canvas )
26-
: QgsMapCanvasItem( canvas ), mRotation(0.0)
26+
: QgsMapCanvasItem( canvas )
2727
{
2828
setZValue( -10 );
2929
}
@@ -32,9 +32,8 @@ QgsMapCanvasMap::~QgsMapCanvasMap()
3232
{
3333
}
3434

35-
void QgsMapCanvasMap::setContent( const QImage& image, const QgsRectangle& rect, double rotation )
35+
void QgsMapCanvasMap::setContent( const QImage& image, const QgsRectangle& rect )
3636
{
37-
mRotation = rotation;
3837
mImage = image;
3938

4039
// 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,
4847
void QgsMapCanvasMap::paint( QPainter* painter )
4948
{
5049
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-
6650
if ( mImage.size() != QSize( w, h ) )
6751
{
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 ) );
6953
}
7054

71-
if ( mRotation )
55+
if ( mMapCanvas->getCoordinateTransform()->mapRotation() )
7256
{
7357
int tX = ( w - mImage.width() ) / 2.0;
7458
int tY = ( h - mImage.height() ) / 2.0;

‎src/gui/qgsmapcanvasmap.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ class GUI_EXPORT QgsMapCanvasMap : public QgsMapCanvasItem // public QObject, p
4141
~QgsMapCanvasMap();
4242

4343
//! @note added in 2.4
44-
//! @note rotation parameter added in 2.8
45-
void setContent( const QImage& image, const QgsRectangle& rect, double rotation=0.0 );
44+
void setContent( const QImage& image, const QgsRectangle& rect );
4645

4746
//! @note added in 2.4
4847
QImage contentImage() const { return mImage; }
@@ -76,8 +75,6 @@ class GUI_EXPORT QgsMapCanvasMap : public QgsMapCanvasItem // public QObject, p
7675
private:
7776

7877
QImage mImage;
79-
80-
double mRotation;
8178
};
8279

8380
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.