Skip to content
Permalink
Browse files

const correct toMapCoordinates and toCanvasCoordinates

  • Loading branch information
Sandro Santilli
Sandro Santilli committed Jan 2, 2015
1 parent dd957d9 commit 0882e9ed3ccd98dce9e9e86da116c3e8f36eae38
Showing with 4 additions and 4 deletions.
  1. +2 −2 src/gui/qgsmapcanvasitem.cpp
  2. +2 −2 src/gui/qgsmapcanvasitem.h
@@ -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 );
@@ -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:

2 comments on commit 0882e9e

@nyalldawson

This comment has been minimized.

Copy link
Collaborator

@nyalldawson nyalldawson replied Jan 3, 2015

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

@strk

This comment has been minimized.

Copy link
Contributor

@strk strk replied Jan 3, 2015

Please sign in to comment.
You can’t perform that action at this time.