Skip to content
Permalink
Browse files
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 0e4b7e6358aa9afe629aaaa5aeca9b12608f0a7c
Showing with 11 additions and 23 deletions.
  1. +0 −15 src/gui/qgsmapcanvasitem.cpp
  2. +9 −8 src/gui/qgsmapcanvasitem.h
  3. +2 −0 src/gui/qgsmapcanvasmap.cpp
@@ -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;
@@ -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 );

};


@@ -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 );

0 comments on commit 0e4b7e6

Please sign in to comment.