Skip to content

Commit

Permalink
Fix for ticket #562 small bug in WMS getFeatureInfo handling
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@6986 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jun 8, 2007
1 parent 8c523b1 commit 3cfc885
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion src/app/qgsmaptoolidentify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,45 @@ 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())
{
showError(layer);
Expand Down

0 comments on commit 3cfc885

Please sign in to comment.