Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Further drop now-unused code added with map rotation support
Also add some documenting comments
  • Loading branch information
Sandro Santilli committed Dec 13, 2014
1 parent 6967381 commit 0e4b7e6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
15 changes: 0 additions & 15 deletions src/gui/qgsmapcanvasitem.cpp
Expand Up @@ -67,21 +67,6 @@ QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint& point )
return QPointF( x, y ) + mPanningOffset;
}

// private
QRectF QgsMapCanvasItem::toCanvasCoordinates( const QRectF& rect )
{
QPointF tl( toCanvasCoordinates( rect.topLeft() ) );
QPointF bl( toCanvasCoordinates( rect.bottomLeft() ) );
QPointF br( toCanvasCoordinates( rect.bottomRight() ) );
QPointF tr( toCanvasCoordinates( rect.topRight() ) );
double xmin = std::min( tl.x(), std::min( bl.x(), std::min( br.x(), tr.x() ) ) );
double ymin = std::min( tl.y(), std::min( bl.y(), std::min( br.y(), tr.y() ) ) );
double xmax = std::max( tl.x(), std::max( bl.x(), std::max( br.x(), tr.x() ) ) );
double ymax = std::max( tl.y(), std::max( bl.y(), std::max( br.y(), tr.y() ) ) );
return QRectF( QPointF( xmin, ymin ), QPointF( xmax, ymax ) );
}


QgsRectangle QgsMapCanvasItem::rect() const
{
return mRect;
Expand Down
17 changes: 9 additions & 8 deletions src/gui/qgsmapcanvasitem.h
Expand Up @@ -82,23 +82,24 @@ class GUI_EXPORT QgsMapCanvasItem : public QGraphicsItem
//! pointer to map canvas
QgsMapCanvas* mMapCanvas;

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

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

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

private:

//! transformation from map coordinates to screen coordinates
//! if rotation is set it is taken in consideration so that
//! the returned rectangle is the bounding box of the rotated input
QRectF toCanvasCoordinates( const QRectF& rect );

};


Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsmapcanvasmap.cpp
Expand Up @@ -50,6 +50,8 @@ void QgsMapCanvasMap::paint( QPainter* painter )
if ( mImage.size() != QSize( w, h ) )
{
QgsDebugMsg( QString( "map paint DIFFERENT SIZE: img %1,%2 item %3,%4" ).arg( mImage.width() ).arg( mImage.height() ).arg( w ).arg( h ) );
// This happens on zoom events when ::paint is called before
// the renderer has completed
}

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

0 comments on commit 0e4b7e6

Please sign in to comment.