Skip to content

Commit 0882e9e

Browse files
author
Sandro Santilli
committedJan 2, 2015
const correct toMapCoordinates and toCanvasCoordinates
1 parent dd957d9 commit 0882e9e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/gui/qgsmapcanvasitem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ void QgsMapCanvasItem::paint( QPainter * painter,
5454
paint( painter ); // call the derived item's drawing routines
5555
}
5656

57-
QgsPoint QgsMapCanvasItem::toMapCoordinates( const QPoint& point )
57+
QgsPoint QgsMapCanvasItem::toMapCoordinates( const QPoint& point ) const
5858
{
5959
return mMapCanvas->getCoordinateTransform()->toMapCoordinates( point - mPanningOffset );
6060
}
6161

6262

63-
QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint& point )
63+
QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint& point ) const
6464
{
6565
double x = point.x(), y = point.y();
6666
mMapCanvas->getCoordinateTransform()->transformInPlace( x, y );

‎src/gui/qgsmapcanvasitem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ class GUI_EXPORT QgsMapCanvasItem : public QGraphicsItem
7272
void setRect( const QgsRectangle& r );
7373

7474
//! transformation from screen coordinates to map coordinates
75-
QgsPoint toMapCoordinates( const QPoint& point );
75+
QgsPoint toMapCoordinates( const QPoint& point ) const;
7676

7777
//! transformation from map coordinates to screen coordinates
78-
QPointF toCanvasCoordinates( const QgsPoint& point );
78+
QPointF toCanvasCoordinates( const QgsPoint& point ) const;
7979

8080
protected:
8181

2 commit comments

Comments
 (2)

nyalldawson commented on Jan 3, 2015

@nyalldawson
Collaborator

@strk just a reminder - don't forget to update the sip bindings too!

strk commented on Jan 3, 2015

@strk
Contributor
Please sign in to comment.