Fix feature info in mapserver

git-svn-id: http://svn.osgeo.org/qgis/trunk@14171 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2010-08-31 11:16:07 +00:00
parent d4c7500844
commit 3facbab9a8
2 changed files with 8 additions and 4 deletions

View File

@ -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?
@ -229,7 +229,6 @@ 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" )
{
@ -237,6 +236,7 @@ void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoD
}
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
@ -254,9 +254,13 @@ void QgsGetRequestHandler::sendGetFeatureInfoResponse( const QDomDocument& infoD
featureInfoString.append( "<TR><TH>" + attributeElement.attribute( "name" ) + "</TH><TD>" + attributeElement.attribute( "value" ) + "</TD></TR>\n" );
}
}
if ( infoFormat == "text/html" )
{
featureInfoString.append( "</TABLE>\n</BR>\n" );
}
}
}
if ( infoFormat == "text/plain" )
{
featureInfoString.append( "\n" );

View File

@ -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 );