Skip to content

Commit

Permalink
Merge pull request #6949 from m-kuhn/wms_overwrite_parent_boundingBoxes
Browse files Browse the repository at this point in the history
Wms overwrite parent bounding boxes
  • Loading branch information
m-kuhn committed May 8, 2018
2 parents cfad3aa + 2ee479e commit be6a763
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/providers/wms/qgswmscapabilities.cpp
Expand Up @@ -872,7 +872,6 @@ void QgsWmsCapabilities::parseLayer( QDomElement const &e, QgsWmsLayerProperty &
}
else if ( tagName == QLatin1String( "BoundingBox" ) )
{
// TODO: overwrite inherited
QgsWmsBoundingBoxProperty bbox;
bbox.box = QgsRectangle( e1.attribute( QStringLiteral( "minx" ) ).toDouble(),
e1.attribute( QStringLiteral( "miny" ) ).toDouble(),
Expand All @@ -893,7 +892,18 @@ void QgsWmsCapabilities::parseLayer( QDomElement const &e, QgsWmsLayerProperty &
bbox.box = invAxisBbox;
}

layerProperty.boundingBoxes << bbox;
// Overwrite existing bounding boxes with identical CRS
bool inheritedOverwritten = false;
for ( int i = 0; i < layerProperty.boundingBoxes.size(); i++ )
{
if ( layerProperty.boundingBoxes[i].crs == bbox.crs )
{
layerProperty.boundingBoxes[i] = bbox;
inheritedOverwritten = true;
}
}
if ( ! inheritedOverwritten )
layerProperty.boundingBoxes << bbox;
}
else
{
Expand Down

0 comments on commit be6a763

Please sign in to comment.