Skip to content

Commit

Permalink
const correct toMapCoordinates and toCanvasCoordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Santilli committed Jan 2, 2015
1 parent dd957d9 commit 0882e9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgsmapcanvasitem.cpp
Expand Up @@ -54,13 +54,13 @@ void QgsMapCanvasItem::paint( QPainter * painter,
paint( painter ); // call the derived item's drawing routines
}

QgsPoint QgsMapCanvasItem::toMapCoordinates( const QPoint& point )
QgsPoint QgsMapCanvasItem::toMapCoordinates( const QPoint& point ) const
{
return mMapCanvas->getCoordinateTransform()->toMapCoordinates( point - mPanningOffset );
}


QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint& point )
QPointF QgsMapCanvasItem::toCanvasCoordinates( const QgsPoint& point ) const
{
double x = point.x(), y = point.y();
mMapCanvas->getCoordinateTransform()->transformInPlace( x, y );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmapcanvasitem.h
Expand Up @@ -72,10 +72,10 @@ class GUI_EXPORT QgsMapCanvasItem : public QGraphicsItem
void setRect( const QgsRectangle& r );

//! transformation from screen coordinates to map coordinates
QgsPoint toMapCoordinates( const QPoint& point );
QgsPoint toMapCoordinates( const QPoint& point ) const;

//! transformation from map coordinates to screen coordinates
QPointF toCanvasCoordinates( const QgsPoint& point );
QPointF toCanvasCoordinates( const QgsPoint& point ) const;

protected:

Expand Down

2 comments on commit 0882e9e

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@strk
Copy link
Contributor

@strk strk commented on 0882e9e Jan 3, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.