Skip to content

Commit

Permalink
added check for dimension boolean type attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Samweli committed Dec 28, 2019
1 parent f9ea39c commit 4733102
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
27 changes: 16 additions & 11 deletions src/providers/wms/qgswmscapabilities.cpp
Expand Up @@ -759,27 +759,32 @@ void QgsWmsCapabilities::parseLegendUrl( const QDomElement &element, QgsWmsLegen
}
}

void QgsWmsCapabilities::parseDimensions( const QDomElement &element, QgsWmsDimensionProperty &dimensionProperty )
void QgsWmsCapabilities::parseDimension( const QDomElement &element, QgsWmsDimensionProperty &dimensionProperty )
{

// TODO, check for the name value if it is time, implement WMS-T support
dimensionProperty.name = element.attribute( QStringLiteral( "name" ) );
dimensionProperty.units = element.attribute( QStringLiteral( "units" ) );

if ( !element.attribute( QStringLiteral( "unitSymbol" ) ).isNull() )
dimensionProperty.unitSymbol = element.attribute( QStringLiteral( "unitSymbol" ) );

if ( !element.attribute( QStringLiteral( "default" ) ).isNull() )
dimensionProperty.defaultValue = element.attribute( QStringLiteral( "default" ) );
dimensionProperty.unitSymbol = element.attribute( QStringLiteral( "unitSymbol" ) );
dimensionProperty.defaultValue = element.attribute( QStringLiteral( "default" ) );

if ( !element.attribute( QStringLiteral( "multipleValues" ) ).isNull() )
dimensionProperty.multipleValues = element.attribute( QStringLiteral( "multipleValues" ) ) == QLatin1String( "1" ) ? true : false ;
{
QString multipleValuesAttribute = element.attribute( QStringLiteral( "multipleValues" ) );
dimensionProperty.multipleValues = ( multipleValuesAttribute == QLatin1String( "1" ) || multipleValuesAttribute == QLatin1String( "true" ) ) ? true : false ;
}

if ( !element.attribute( QStringLiteral( "nearestValue" ) ).isNull() )
dimensionProperty.nearestValue = element.attribute( QStringLiteral( "nearestValue" ) ) == QLatin1String( "1" ) ? true : false ;
{
QString nearestValueAttribute = element.attribute( QStringLiteral( "nearestValue" ) );
dimensionProperty.nearestValue = ( nearestValueAttribute == QLatin1String( "1" ) || nearestValueAttribute == QLatin1String( "true" ) ) ? true : false ;
}

if ( !element.attribute( QStringLiteral( "current" ) ).isNull() )
dimensionProperty.current = element.attribute( QStringLiteral( "current" ) ) == QLatin1String( "1" ) ? true : false ;
{
QString currentAttribute = element.attribute( QStringLiteral( "current" ) );
dimensionProperty.current = ( currentAttribute == QLatin1String( "1" ) || currentAttribute == QLatin1String( "true" ) ) ? true : false ;
}

dimensionProperty.extent = element.text();
}
Expand Down Expand Up @@ -959,7 +964,7 @@ void QgsWmsCapabilities::parseLayer( const QDomElement &element, QgsWmsLayerProp
else if ( tagName == QLatin1String( "Dimension" ) )
{
layerProperty.dimensions << QgsWmsDimensionProperty();
parseDimensions( nodeElement, layerProperty.dimensions.last() );
parseDimension( nodeElement, layerProperty.dimensions.last() );
}
else if ( tagName == QLatin1String( "Attribution" ) )
{
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wms/qgswmscapabilities.h
Expand Up @@ -713,7 +713,7 @@ class QgsWmsCapabilities

void parseCapability( const QDomElement &element, QgsWmsCapabilityProperty &capabilityProperty );
void parseRequest( const QDomElement &element, QgsWmsRequestProperty &requestProperty );
void parseDimensions( const QDomElement &element, QgsWmsDimensionProperty &dimensionProperty );
void parseDimension( const QDomElement &element, QgsWmsDimensionProperty &dimensionProperty );
void parseLegendUrl( const QDomElement &element, QgsWmsLegendUrlProperty &legendUrlProperty );
void parseLayer( const QDomElement &element, QgsWmsLayerProperty &layerProperty, QgsWmsLayerProperty *parentProperty = nullptr );
void parseStyle( const QDomElement &element, QgsWmsStyleProperty &styleProperty );
Expand Down

0 comments on commit 4733102

Please sign in to comment.