Skip to content

Commit 0e4b7e6

Browse files
author
Sandro Santilli
committedDec 13, 2014
Further drop now-unused code added with map rotation support
Also add some documenting comments
1 parent 6967381 commit 0e4b7e6

File tree

3 files changed

+11
-23
lines changed

3 files changed

+11
-23
lines changed
 

‎src/gui/qgsmapcanvasitem.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,6 @@ QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint& point )
6767
return QPointF( x, y ) + mPanningOffset;
6868
}
6969

70-
// private
71-
QRectF QgsMapCanvasItem::toCanvasCoordinates( const QRectF& rect )
72-
{
73-
QPointF tl( toCanvasCoordinates( rect.topLeft() ) );
74-
QPointF bl( toCanvasCoordinates( rect.bottomLeft() ) );
75-
QPointF br( toCanvasCoordinates( rect.bottomRight() ) );
76-
QPointF tr( toCanvasCoordinates( rect.topRight() ) );
77-
double xmin = std::min( tl.x(), std::min( bl.x(), std::min( br.x(), tr.x() ) ) );
78-
double ymin = std::min( tl.y(), std::min( bl.y(), std::min( br.y(), tr.y() ) ) );
79-
double xmax = std::max( tl.x(), std::max( bl.x(), std::max( br.x(), tr.x() ) ) );
80-
double ymax = std::max( tl.y(), std::max( bl.y(), std::max( br.y(), tr.y() ) ) );
81-
return QRectF( QPointF( xmin, ymin ), QPointF( xmax, ymax ) );
82-
}
83-
84-
8570
QgsRectangle QgsMapCanvasItem::rect() const
8671
{
8772
return mRect;

‎src/gui/qgsmapcanvasitem.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,24 @@ class GUI_EXPORT QgsMapCanvasItem : public QGraphicsItem
8282
//! pointer to map canvas
8383
QgsMapCanvas* mMapCanvas;
8484

85-
//! canvas item rectangle (in map coordinates)
85+
//! cached canvas item rectangle in map coordinates
86+
//! encodes position (xmin,ymax) and size (width/height)
87+
//! used to re-position and re-size the item on zoom/pan
88+
//! while waiting for the renderer to complete.
89+
//!
90+
//! NOTE: does not include rotation information, so cannot
91+
//! be used to correctly present pre-rendered map
92+
//! on rotation change
8693
QgsRectangle mRect;
8794

8895
//! offset from normal position due current panning operation,
8996
//! used when converting map coordinates to move map canvas items
97+
//! @deprecated since v2.4
9098
QPoint mPanningOffset;
9199

92100
//! cached size of the item (to return in boundingRect())
93101
QSizeF mItemSize;
94102

95-
private:
96-
97-
//! transformation from map coordinates to screen coordinates
98-
//! if rotation is set it is taken in consideration so that
99-
//! the returned rectangle is the bounding box of the rotated input
100-
QRectF toCanvasCoordinates( const QRectF& rect );
101-
102103
};
103104

104105

‎src/gui/qgsmapcanvasmap.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ void QgsMapCanvasMap::paint( QPainter* painter )
5050
if ( mImage.size() != QSize( w, h ) )
5151
{
5252
QgsDebugMsg( QString( "map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ).arg( mImage.width() ).arg( mImage.height() ).arg( w ).arg( h ) );
53+
// This happens on zoom events when ::paint is called before
54+
// the renderer has completed
5355
}
5456

5557
painter->drawImage( QRect( 0, 0, w, h ), mImage );

0 commit comments

Comments
 (0)
Please sign in to comment.