Skip to content

Commit c3604cf

Browse files
author
mhugent
committedJun 8, 2007
Fix for ticket #652 also for 0.8.1
git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6987 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 8c0d00c commit c3604cf

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed
 

‎src/gui/qgsmaptoolidentify.cpp

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,43 @@ void QgsMapToolIdentify::identifyRasterWmsLayer(QgsRasterLayer* layer, const Qgs
159159
return;
160160
}
161161

162-
QString text = layer->identifyAsText(point);
162+
//if WMS layer does not cover the view origin,
163+
//we need to map the view pixel coordinates
164+
//to WMS layer pixel coordinates
165+
QgsRect viewExtent = mCanvas->extent();
166+
double mupp = mCanvas->mupp();
167+
if(mupp == 0)
168+
{
169+
return;
170+
}
171+
double xMinView = viewExtent.xMin();
172+
double yMaxView = viewExtent.yMax();
173+
174+
QgsRect layerExtent = layer->extent();
175+
double xMinLayer = layerExtent.xMin();
176+
double yMaxLayer = layerExtent.yMax();
177+
178+
double i, j;
179+
180+
if(xMinView < xMinLayer)
181+
{
182+
i = (int)(point.x() - (xMinLayer - xMinView) / mupp);
183+
}
184+
else
185+
{
186+
i = point.x();
187+
}
188+
189+
if(yMaxView > yMaxLayer)
190+
{
191+
j = (int)(point.y() - (yMaxView - yMaxLayer) / mupp);
192+
}
193+
else
194+
{
195+
j = point.y();
196+
}
197+
198+
QString text = layer->identifyAsText(QgsPoint(i, j));
163199

164200
if (text.isEmpty())
165201
{

0 commit comments

Comments
 (0)