Skip to content

Commit

Permalink
Fix feature info in mapserver
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14171 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Aug 31, 2010
1 parent 748fefb commit a8b107b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/mapserver/qgsgetrequesthandler.cpp
Expand Up @@ -204,7 +204,7 @@ void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoD
}

//feature loop (for vector layers)
QDomNodeList featureNodeList = infoDoc.elementsByTagName( "Feature" );
QDomNodeList featureNodeList = layerElem.elementsByTagName( "Feature" );
QDomElement currentFeatureElement;

if ( featureNodeList.size() < 1 ) //raster layer?
Expand All @@ -229,14 +229,14 @@ void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoD
{
for ( int j = 0; j < featureNodeList.size(); ++j )
{
featureInfoString.append( "<TABLE border=1 width=100%>\n" );
QDomElement featureElement = featureNodeList.at( j ).toElement();
if ( infoFormat == "text/plain" )
{
featureInfoString.append( "Feature " + featureElement.attribute( "id" ) + "\n" );
}
else if ( infoFormat == "text/html" )
{
featureInfoString.append( "<TABLE border=1 width=100%>\n" );
featureInfoString.append( "<TR><TH>Feature</TH><TD>" + featureElement.attribute( "id" ) + "</TD></TR>\n" );
}
//attribute loop
Expand All @@ -254,7 +254,11 @@ void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoD
featureInfoString.append( "<TR><TH>" + attributeElement.attribute( "name" ) + "</TH><TD>" + attributeElement.attribute( "value" ) + "</TD></TR>\n" );
}
}
featureInfoString.append( "</TABLE>\n</BR>\n" );

if ( infoFormat == "text/html" )
{
featureInfoString.append( "</TABLE>\n</BR>\n" );
}
}
}
if ( infoFormat == "text/plain" )
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgswmsserver.cpp
Expand Up @@ -899,7 +899,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer, const QgsPo
//we need a selection rect (0.01 of map width)
QgsRectangle mapRect = mapRender->extent();
QgsRectangle layerRect = mapRender->mapToLayerCoordinates( layer, mapRect );
double searchRadius = ( layerRect.xMaximum() - layerRect.xMinimum() ) / 100;
double searchRadius = ( layerRect.xMaximum() - layerRect.xMinimum() ) / 200;
QgsRectangle searchRect( infoPoint.x() - searchRadius, infoPoint.y() - searchRadius, \
infoPoint.x() + searchRadius, infoPoint.y() + searchRadius );

Expand Down

0 comments on commit a8b107b

Please sign in to comment.