From a2a2d28d344b32d7f461fd716d9a4b36baabc695 Mon Sep 17 00:00:00 2001 From: Roel Huybrechts Date: Sun, 1 Mar 2015 09:26:53 +0100 Subject: [PATCH] Overwrite existing boundingBoxes with the same CRS in WMS capabilities. --- src/providers/wms/qgswmscapabilities.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/providers/wms/qgswmscapabilities.cpp b/src/providers/wms/qgswmscapabilities.cpp index be5377512329..7fa77961cd07 100644 --- a/src/providers/wms/qgswmscapabilities.cpp +++ b/src/providers/wms/qgswmscapabilities.cpp @@ -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(), @@ -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 {