Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
wms provider: recover the possibility to configure the feature count …
…in WMS requests
  • Loading branch information
jef-n committed Jun 29, 2015
1 parent 4be87f8 commit 1dfe005
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
12 changes: 12 additions & 0 deletions src/providers/wms/qgswmscapabilities.cpp
Expand Up @@ -1838,6 +1838,18 @@ bool QgsWmsCapabilities::shouldInvertAxisOrientation( const QString& ogcCrs )
return changeXY;
}

int QgsWmsCapabilities::identifyCapabilities() const
{
int capability = QgsRasterInterface::NoCapabilities;

foreach ( QgsRaster::IdentifyFormat f, mIdentifyFormats.keys() )
{
capability |= QgsRasterDataProvider::identifyFormatToCapability( f );
}

return capability;
}



// -----------------
Expand Down
7 changes: 5 additions & 2 deletions src/providers/wms/qgswmscapabilities.h
Expand Up @@ -530,7 +530,7 @@ class QgsWmsSettings
};


/** keeps information about capabilities of particular URI */
/** Keeps information about capabilities of particular URI */
class QgsWmsCapabilities
{
public:
Expand Down Expand Up @@ -577,6 +577,9 @@ class QgsWmsCapabilities
/** Find out whether to invert axis orientation when parsing/writing coordinates */
bool shouldInvertAxisOrientation( const QString& ogcCrs );

/** Find out identify capabilities */
int identifyCapabilities() const;

protected:
bool parseCapabilitiesDom( QByteArray const &xml, QgsWmsCapabilitiesProperty& capabilitiesProperty );

Expand Down Expand Up @@ -674,7 +677,7 @@ class QgsWmsCapabilities



/** class that handles download of capabilities */
/** Class that handles download of capabilities */
class QgsWmsCapabilitiesDownload : public QObject
{
Q_OBJECT
Expand Down
15 changes: 1 addition & 14 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -1323,7 +1323,7 @@ int QgsWmsProvider::capabilities() const

if ( canIdentify )
{
capability = identifyCapabilities();
capability = mCaps.identifyCapabilities();
if ( capability )
{
capability |= Identify;
Expand All @@ -1334,19 +1334,6 @@ int QgsWmsProvider::capabilities() const
return capability;
}

int QgsWmsProvider::identifyCapabilities() const
{
int capability = NoCapabilities;

foreach ( QgsRaster::IdentifyFormat f, mCaps.mIdentifyFormats.keys() )
{
capability |= identifyFormatToCapability( f );
}

QgsDebugMsg( QString( "capability = %1" ).arg( capability ) );
return capability;
}

QString QgsWmsProvider::layerMetadata( QgsWmsLayerProperty &layer )
{
QString metadata;
Expand Down
25 changes: 11 additions & 14 deletions src/providers/wms/qgswmsprovider.h
Expand Up @@ -128,7 +128,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
QgsRasterInterface * clone() const override;


/*! Get the QgsCoordinateReferenceSystem for this layer
/** Get the QgsCoordinateReferenceSystem for this layer
* @note Must be reimplemented by each provider.
* If the provider isn't capable of returning
* its projection an empty srs will be return, ti will return 0
Expand Down Expand Up @@ -176,26 +176,26 @@ class QgsWmsProvider : public QgsRasterDataProvider
*/
virtual QgsRectangle extent() override;

/**Returns true if layer is valid
/** Returns true if layer is valid
*/
bool isValid() override;

#if 0
/**Returns true if layer has tile set profiles
/** Returns true if layer has tile set profiles
*/
virtual bool hasTiles() const;
#endif

/**Returns the GetMap url */
/** Returns the GetMap url */
virtual QString getMapUrl() const;

/**Returns the GetFeatureInfo url */
/** Returns the GetFeatureInfo url */
virtual QString getFeatureInfoUrl() const;

/**Return the GetTile url */
/** Return the GetTile url */
virtual QString getTileUrl() const;

/**Return the GetLegendGraphic url
/** Return the GetLegendGraphic url
* @added in 2.1
*/
virtual QString getLegendGraphicUrl() const;
Expand Down Expand Up @@ -265,9 +265,6 @@ class QgsWmsProvider : public QgsRasterDataProvider
*/
int capabilities() const override;

/** Server identify capabilities, used by source select. */
int identifyCapabilities() const;

QGis::DataType dataType( int bandNo ) const override;
QGis::DataType srcDataType( int bandNo ) const override;
int bandCount() const override;
Expand Down Expand Up @@ -305,7 +302,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
*/
QString lastErrorFormat() override;

/** return a provider name
/** Return a provider name
Essentially just returns the provider key. Should be used to build file
dialogs so that providers can be shown with their supported types. Thus
Expand All @@ -322,7 +319,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
QString name() const override;


/** return description
/** Return description
Return a terse string describing what the provider is.
Expand All @@ -335,7 +332,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
*/
QString description() const override;

/**Reloads the data from the source. Needs to be implemented by providers with data caches to
/** Reloads the data from the source. Needs to be implemented by providers with data caches to
synchronize with changes in the data source*/
virtual void reloadData() override;

Expand Down Expand Up @@ -433,7 +430,7 @@ class QgsWmsProvider : public QgsRasterDataProvider

private:

/**Return the full url to request legend graphic
/** Return the full url to request legend graphic
* The visibleExtent isi only used if provider supports contextual
* legends according to the QgsWmsSettings
* @added in 2.8
Expand Down
2 changes: 2 additions & 0 deletions src/providers/wms/qgswmssourceselect.cpp
Expand Up @@ -474,6 +474,8 @@ void QgsWMSSourceSelect::on_btnConnect_clicked()
return;
}

mFeatureCount->setEnabled( caps.identifyCapabilities() != QgsRasterInterface::NoCapabilities );

populateLayerList( caps );
}

Expand Down

0 comments on commit 1dfe005

Please sign in to comment.