Skip to content

Commit a2a2d28

Browse files
Roelm-kuhn
authored andcommittedMay 8, 2018
Overwrite existing boundingBoxes with the same CRS in WMS capabilities.
1 parent cdca708 commit a2a2d28

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎src/providers/wms/qgswmscapabilities.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@ void QgsWmsCapabilities::parseLayer( QDomElement const &e, QgsWmsLayerProperty &
872872
}
873873
else if ( tagName == QLatin1String( "BoundingBox" ) )
874874
{
875-
// TODO: overwrite inherited
876875
QgsWmsBoundingBoxProperty bbox;
877876
bbox.box = QgsRectangle( e1.attribute( QStringLiteral( "minx" ) ).toDouble(),
878877
e1.attribute( QStringLiteral( "miny" ) ).toDouble(),
@@ -893,7 +892,18 @@ void QgsWmsCapabilities::parseLayer( QDomElement const &e, QgsWmsLayerProperty &
893892
bbox.box = invAxisBbox;
894893
}
895894

896-
layerProperty.boundingBoxes << bbox;
895+
// Overwrite existing bounding boxes with identical CRS
896+
bool inheritedOverwritten = false;
897+
for ( int i = 0; i < layerProperty.boundingBoxes.size(); i++ )
898+
{
899+
if ( layerProperty.boundingBoxes[i].crs == bbox.crs )
900+
{
901+
layerProperty.boundingBoxes[i] = bbox;
902+
inheritedOverwritten = true;
903+
}
904+
}
905+
if ( ! inheritedOverwritten )
906+
layerProperty.boundingBoxes << bbox;
897907
}
898908
else
899909
{

0 commit comments

Comments
 (0)
Please sign in to comment.