Skip to content

Commit

Permalink
wcs - enabled invert/ignore axis
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Jul 12, 2012
1 parent 6bf5af0 commit c840ce1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 49 deletions.
39 changes: 23 additions & 16 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -51,35 +51,39 @@ QgsNewHttpConnection::QgsNewHttpConnection(
txtName->setText( connName );
txtUrl->setText( settings.value( key + "/url" ).toString() );

if ( mBaseKey == "/Qgis/connections-wms/" )
cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() );
cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() );
cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() );
cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );

txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() );
txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() );
}

if ( mBaseKey != "/Qgis/connections-wms/" )
{
if ( mBaseKey == "/Qgis/connections-wcs/" )
{
cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() );
cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );
cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() );
cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() );
cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) );
cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) );
}
else
{
cbxIgnoreGetMapURI->setVisible( false );
cbxIgnoreGetFeatureInfoURI->setVisible( false );
cbxIgnoreAxisOrientation->setVisible( false );
cbxInvertAxisOrientation->setVisible( false );
mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI );
mGroupBox->layout()->removeWidget( cbxIgnoreAxisOrientation );
mGroupBox->layout()->removeWidget( cbxInvertAxisOrientation );
}

txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() );
txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() );
}
if ( mBaseKey != "/Qgis/connections-wms/" )
{
cbxIgnoreGetMapURI->setVisible( false );
cbxIgnoreGetFeatureInfoURI->setVisible( false );
mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI );
mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );

// Adjust height
int w = width();
adjustSize();
resize( w, height() );

}

on_txtName_textChanged( connName );
Expand Down Expand Up @@ -134,13 +138,16 @@ void QgsNewHttpConnection::accept()
}

settings.setValue( key + "/url", url.toString() );
if ( mBaseKey == "/Qgis/connections-wms/" )
if ( mBaseKey == "/Qgis/connections-wms/" || mBaseKey == "/Qgis/connections-wcs/" )
{
settings.setValue( key + "/ignoreGetMapURI", cbxIgnoreGetMapURI->isChecked() );
settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() );
settings.setValue( key + "/ignoreAxisOrientation", cbxIgnoreAxisOrientation->isChecked() );
settings.setValue( key + "/invertAxisOrientation", cbxInvertAxisOrientation->isChecked() );
}
if ( mBaseKey == "/Qgis/connections-wms/" )
{
settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() );
}

settings.setValue( credentialsKey + "/username", txtUserName->text() );
settings.setValue( credentialsKey + "/password", txtPassword->text() );
Expand Down
27 changes: 24 additions & 3 deletions src/providers/wcs/qgswcscapabilities.cpp
Expand Up @@ -131,7 +131,7 @@ bool QgsWcsCapabilities::supportedCoverages( QVector<QgsWcsCoverageSummary> &cov

QString QgsWcsCapabilities::getCoverageUrl() const
{
QString url = mCapabilities.operationsMetadata.getCoverage.getUrl;
QString url = mCapabilities.getCoverageGetUrl;
if ( url.isEmpty() )
{
url = mUri.param( "url" );
Expand Down Expand Up @@ -401,7 +401,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
capabilities.abstract = domElementText( docElem, "Service.description" );
// There is also "label" in 1.0

capabilities.operationsMetadata.getCoverage.getUrl = domElement( docElem, "Capability.Request.GetCoverage.DCPType.HTTP.Get.OnlineResource" ).attribute( "xlink:href" );
capabilities.getCoverageGetUrl = domElement( docElem, "Capability.Request.GetCoverage.DCPType.HTTP.Get.OnlineResource" ).attribute( "xlink:href" );

parseContentMetadata( domElement( docElem, "ContentMetadata" ), capabilities.contents );
}
Expand All @@ -415,7 +415,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
{
if ( el.attribute( "name" ) == "GetCoverage" )
{
capabilities.operationsMetadata.getCoverage.getUrl = domElement( el, "DCP.HTTP.Get" ).attribute( "xlink:href" );
capabilities.getCoverageGetUrl = domElement( el, "DCP.HTTP.Get" ).attribute( "xlink:href" );
}
}

Expand Down Expand Up @@ -1033,3 +1033,24 @@ QgsWcsCoverageSummary* QgsWcsCapabilities::coverageSummary( QString const & theI
}
return 0;
}

QList<QgsWcsCoverageSummary> QgsWcsCapabilities::coverages( )
{
return coverageSummaries( );
}

QList<QgsWcsCoverageSummary> QgsWcsCapabilities::coverageSummaries( QgsWcsCoverageSummary* parent )
{
QList<QgsWcsCoverageSummary> list;
if ( !parent )
{
parent = &( mCapabilities.contents );
}

for ( QVector<QgsWcsCoverageSummary>::iterator c = parent->coverageSummary.begin(); c != parent->coverageSummary.end(); ++c )
{
list.append( *c );
list.append( coverageSummaries( c ) );
}
return list;
}
37 changes: 11 additions & 26 deletions src/providers/wcs/qgswcscapabilities.h
Expand Up @@ -30,30 +30,10 @@
#include <QVector>
#include <QUrl>

//class QgsCoordinateTransform;
class QNetworkAccessManager;
class QNetworkReply;
class QNetworkRequest;

/** Operation type structure */
struct QgsWcsOperation
{
QString getUrl;
};

/** OperationsMetadata */
struct QgsWcsOperationsMetadata
{
QgsWcsOperation getCoverage;
};

/** ServiceerviceIdentification structure */
struct QgsWcsServiceIdentification
{
QString title;
QString abstract;
};

/** CoverageSummary structure */
struct QgsWcsCoverageSummary
{
Expand Down Expand Up @@ -81,12 +61,12 @@ struct QgsWcsCoverageSummary
/** Capability Property structure */
struct QgsWcsCapabilitiesProperty
{
QString version;
QString title;
QString abstract;
QgsWcsOperationsMetadata operationsMetadata;
QString version;
QString title;
QString abstract;
QString getCoverageGetUrl;
// using QgsWcsCoverageSummary for contents for simplification
QgsWcsCoverageSummary contents;
QgsWcsCoverageSummary contents;
};

/**
Expand Down Expand Up @@ -124,7 +104,6 @@ class QgsWcsCapabilities : public QObject
*/
bool supportedCoverages( QVector<QgsWcsCoverageSummary> &coverageSummary );


/**
* \brief Returns a map for the hierarchy of layers
*/
Expand All @@ -133,6 +112,9 @@ class QgsWcsCapabilities : public QObject
//! Get coverage summary for identifier
QgsWcsCoverageSummary coverage( QString const & theIdentifier );

//! Get list of all coverage summaries
QList<QgsWcsCoverageSummary> coverages();

/**
* \brief Prepare the URI so that we can later simply append param=value
* \param uri uri to prepare
Expand Down Expand Up @@ -225,6 +207,9 @@ class QgsWcsCapabilities : public QObject
//! Get coverage summary for identifier
QgsWcsCoverageSummary * coverageSummary( QString const & theIdentifier, QgsWcsCoverageSummary* parent = 0 );

// ! Get list of all sub coverages
QList<QgsWcsCoverageSummary> coverageSummaries( QgsWcsCoverageSummary* parent = 0 );

void initCoverageSummary( QgsWcsCoverageSummary &coverageSummary );

void clear();
Expand Down
7 changes: 3 additions & 4 deletions src/providers/wcs/qgswcsprovider.cpp
Expand Up @@ -1230,7 +1230,7 @@ QString QgsWcsProvider::metadata()
metadata += htmlRow(( "WCS Version" ), mCapabilities.version() );
metadata += htmlRow( tr( "Title" ), mCapabilities.capabilities().title );
metadata += htmlRow( tr( "Abstract" ), mCapabilities.capabilities().abstract );
// TODO
// TODO: probably apply stylesheet in QgsWcsCapabilities and save as html
//metadata += htmlRow ( tr( "Keywords" ), mCapabilities.service.keywordList.join( "<br />" ) );
//metadata += htmlRow ( tr( "Online Resource" ), "-" );
//metadata += htmlRow ( tr( "Contact Person" ),
Expand All @@ -1241,7 +1241,7 @@ QString QgsWcsProvider::metadata()
//metadata += htmlRow ( tr( "Access Constraints" ), mCapabilities.service.accessConstraints );
//metadata += htmlRow ( tr( "Image Formats" ), mCapabilities.capability.request.getMap.format.join( "<br />" ) );
//metadata += htmlRow ( tr( "GetCapabilitiesUrl" ), mBaseUrl );
metadata += htmlRow( tr( "Get Coverage Url" ), mCapabilities.capabilities().operationsMetadata.getCoverage.getUrl + ( mIgnoreGetCoverageUrl ? tr( "&nbsp;<font color=\"red\">(advertised but ignored)</font>" ) : "" ) );
metadata += htmlRow( tr( "Get Coverage Url" ), mCapabilities.getCoverageUrl() + ( mIgnoreGetCoverageUrl ? tr( "&nbsp;<font color=\"red\">(advertised but ignored)</font>" ) : "" ) );

// Close the nested table
metadata += "</table>";
Expand All @@ -1252,9 +1252,8 @@ QString QgsWcsProvider::metadata()
metadata += tr( "Coverages" );
metadata += "</th></tr>";

for ( int i = 0; i < mCapabilities.capabilities().contents.coverageSummary.size(); i++ )
foreach( QgsWcsCoverageSummary c, mCapabilities.coverages() )
{
QgsWcsCoverageSummary c = mCapabilities.capabilities().contents.coverageSummary.value( i );
metadata += coverageMetadata( c );
}

Expand Down

0 comments on commit c840ce1

Please sign in to comment.