Skip to content

Commit

Permalink
Fix for ticket #652 also for 0.8.1
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6987 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 8, 2007
1 parent 8c0d00c commit c3604cf
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion src/gui/qgsmaptoolidentify.cpp
Expand Up @@ -159,7 +159,43 @@ void QgsMapToolIdentify::identifyRasterWmsLayer(QgsRasterLayer* layer, const Qgs
return;
}

QString text = layer->identifyAsText(point);
//if WMS layer does not cover the view origin,
//we need to map the view pixel coordinates
//to WMS layer pixel coordinates
QgsRect viewExtent = mCanvas->extent();
double mupp = mCanvas->mupp();
if(mupp == 0)
{
return;
}
double xMinView = viewExtent.xMin();
double yMaxView = viewExtent.yMax();

QgsRect layerExtent = layer->extent();
double xMinLayer = layerExtent.xMin();
double yMaxLayer = layerExtent.yMax();

double i, j;

if(xMinView < xMinLayer)
{
i = (int)(point.x() - (xMinLayer - xMinView) / mupp);
}
else
{
i = point.x();
}

if(yMaxView > yMaxLayer)
{
j = (int)(point.y() - (yMaxView - yMaxLayer) / mupp);
}
else
{
j = point.y();
}

QString text = layer->identifyAsText(QgsPoint(i, j));

if (text.isEmpty())
{
Expand Down

0 comments on commit c3604cf

Please sign in to comment.