maptips.patch

Victor Axbom, 2012-05-15 11:43 PM

Download (1.21 KB)

View differences:

src/gui/qgsmaptip.cpp
18 18
#include <qgsvectordataprovider.h>
19 19
#include <qgsvectorlayer.h>
20 20
#include <qgsfield.h>
21
#include <qgscoordinatetransform.h>
21 22

  
22 23
// Qt includes
23 24
#include <QPoint>
......
84 85
  // Protection just in case we get passed a null layer
85 86
  if ( layer )
86 87
  {
88
  
89
    //Reproject coordinates if on-the-fly-reprojection is on
90
    if ( mpMapCanvas->hasCrsTransformEnabled() )
91
    {
92
      long layerCrs = layer->crs().srsid();
93
      long mapCanvasCrs = mpMapCanvas->mapRenderer()->destinationCrs().srsid();
94
		
95
      if ( layerCrs != mapCanvasCrs )
96
      {
97
        QgsPoint transPoint = QgsCoordinateTransform( mapCanvasCrs, layerCrs ).transform( mapPosition );
98
        mapPosition.setX( transPoint.x() );
99
        mapPosition.setY( transPoint.y() );
100
      }
101
	  }
102

  
87 103
    // Get the setting for the search radius from user preferences, if it exists
88 104
    QSettings settings;
89 105
    double identifyValue = settings.value( "/Map/identifyRadius", QGis::DEFAULT_IDENTIFY_RADIUS ).toDouble();