Skip to content

Commit

Permalink
Overwrite existing boundingBoxes with the same CRS in WMS capabilities.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel authored and m-kuhn committed May 8, 2018
1 parent cdca708 commit a2a2d28
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/providers/wms/qgswmscapabilities.cpp
Original file line number Diff line number Diff line change
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 a2a2d28

Please sign in to comment.