Skip to content

Commit c840ce1

Browse files
committed
wcs - enabled invert/ignore axis
1 parent 6bf5af0 commit c840ce1

File tree

4 files changed

+61
-49
lines changed

4 files changed

+61
-49
lines changed

src/gui/qgsnewhttpconnection.cpp

+23-16
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,39 @@ QgsNewHttpConnection::QgsNewHttpConnection(
5151
txtName->setText( connName );
5252
txtUrl->setText( settings.value( key + "/url" ).toString() );
5353

54-
if ( mBaseKey == "/Qgis/connections-wms/" )
54+
cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() );
55+
cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() );
56+
cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() );
57+
cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );
58+
59+
txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() );
60+
txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() );
61+
}
62+
63+
if ( mBaseKey != "/Qgis/connections-wms/" )
64+
{
65+
if ( mBaseKey == "/Qgis/connections-wcs/" )
5566
{
56-
cbxIgnoreGetMapURI->setChecked( settings.value( key + "/ignoreGetMapURI", false ).toBool() );
57-
cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );
58-
cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() );
59-
cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() );
67+
cbxIgnoreGetMapURI->setText( tr( "Ignore GetCoverage URI reported in capabilities" ) );
68+
cbxIgnoreAxisOrientation->setText( tr( "Ignore axis orientation" ) );
6069
}
6170
else
6271
{
6372
cbxIgnoreGetMapURI->setVisible( false );
64-
cbxIgnoreGetFeatureInfoURI->setVisible( false );
6573
cbxIgnoreAxisOrientation->setVisible( false );
6674
cbxInvertAxisOrientation->setVisible( false );
75+
mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI );
76+
mGroupBox->layout()->removeWidget( cbxIgnoreAxisOrientation );
77+
mGroupBox->layout()->removeWidget( cbxInvertAxisOrientation );
6778
}
6879

69-
txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() );
70-
txtPassword->setText( settings.value( credentialsKey + "/password" ).toString() );
71-
}
72-
if ( mBaseKey != "/Qgis/connections-wms/" )
73-
{
74-
cbxIgnoreGetMapURI->setVisible( false );
7580
cbxIgnoreGetFeatureInfoURI->setVisible( false );
76-
mGroupBox->layout()->removeWidget( cbxIgnoreGetMapURI );
7781
mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );
82+
7883
// Adjust height
7984
int w = width();
8085
adjustSize();
8186
resize( w, height() );
82-
8387
}
8488

8589
on_txtName_textChanged( connName );
@@ -134,13 +138,16 @@ void QgsNewHttpConnection::accept()
134138
}
135139

136140
settings.setValue( key + "/url", url.toString() );
137-
if ( mBaseKey == "/Qgis/connections-wms/" )
141+
if ( mBaseKey == "/Qgis/connections-wms/" || mBaseKey == "/Qgis/connections-wcs/" )
138142
{
139143
settings.setValue( key + "/ignoreGetMapURI", cbxIgnoreGetMapURI->isChecked() );
140-
settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() );
141144
settings.setValue( key + "/ignoreAxisOrientation", cbxIgnoreAxisOrientation->isChecked() );
142145
settings.setValue( key + "/invertAxisOrientation", cbxInvertAxisOrientation->isChecked() );
143146
}
147+
if ( mBaseKey == "/Qgis/connections-wms/" )
148+
{
149+
settings.setValue( key + "/ignoreGetFeatureInfoURI", cbxIgnoreGetFeatureInfoURI->isChecked() );
150+
}
144151

145152
settings.setValue( credentialsKey + "/username", txtUserName->text() );
146153
settings.setValue( credentialsKey + "/password", txtPassword->text() );

src/providers/wcs/qgswcscapabilities.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ bool QgsWcsCapabilities::supportedCoverages( QVector<QgsWcsCoverageSummary> &cov
131131

132132
QString QgsWcsCapabilities::getCoverageUrl() const
133133
{
134-
QString url = mCapabilities.operationsMetadata.getCoverage.getUrl;
134+
QString url = mCapabilities.getCoverageGetUrl;
135135
if ( url.isEmpty() )
136136
{
137137
url = mUri.param( "url" );
@@ -401,7 +401,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
401401
capabilities.abstract = domElementText( docElem, "Service.description" );
402402
// There is also "label" in 1.0
403403

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

406406
parseContentMetadata( domElement( docElem, "ContentMetadata" ), capabilities.contents );
407407
}
@@ -415,7 +415,7 @@ bool QgsWcsCapabilities::parseCapabilitiesDom( QByteArray const &xml, QgsWcsCapa
415415
{
416416
if ( el.attribute( "name" ) == "GetCoverage" )
417417
{
418-
capabilities.operationsMetadata.getCoverage.getUrl = domElement( el, "DCP.HTTP.Get" ).attribute( "xlink:href" );
418+
capabilities.getCoverageGetUrl = domElement( el, "DCP.HTTP.Get" ).attribute( "xlink:href" );
419419
}
420420
}
421421

@@ -1033,3 +1033,24 @@ QgsWcsCoverageSummary* QgsWcsCapabilities::coverageSummary( QString const & theI
10331033
}
10341034
return 0;
10351035
}
1036+
1037+
QList<QgsWcsCoverageSummary> QgsWcsCapabilities::coverages( )
1038+
{
1039+
return coverageSummaries( );
1040+
}
1041+
1042+
QList<QgsWcsCoverageSummary> QgsWcsCapabilities::coverageSummaries( QgsWcsCoverageSummary* parent )
1043+
{
1044+
QList<QgsWcsCoverageSummary> list;
1045+
if ( !parent )
1046+
{
1047+
parent = &( mCapabilities.contents );
1048+
}
1049+
1050+
for ( QVector<QgsWcsCoverageSummary>::iterator c = parent->coverageSummary.begin(); c != parent->coverageSummary.end(); ++c )
1051+
{
1052+
list.append( *c );
1053+
list.append( coverageSummaries( c ) );
1054+
}
1055+
return list;
1056+
}

src/providers/wcs/qgswcscapabilities.h

+11-26
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,10 @@
3030
#include <QVector>
3131
#include <QUrl>
3232

33-
//class QgsCoordinateTransform;
3433
class QNetworkAccessManager;
3534
class QNetworkReply;
3635
class QNetworkRequest;
3736

38-
/** Operation type structure */
39-
struct QgsWcsOperation
40-
{
41-
QString getUrl;
42-
};
43-
44-
/** OperationsMetadata */
45-
struct QgsWcsOperationsMetadata
46-
{
47-
QgsWcsOperation getCoverage;
48-
};
49-
50-
/** ServiceerviceIdentification structure */
51-
struct QgsWcsServiceIdentification
52-
{
53-
QString title;
54-
QString abstract;
55-
};
56-
5737
/** CoverageSummary structure */
5838
struct QgsWcsCoverageSummary
5939
{
@@ -81,12 +61,12 @@ struct QgsWcsCoverageSummary
8161
/** Capability Property structure */
8262
struct QgsWcsCapabilitiesProperty
8363
{
84-
QString version;
85-
QString title;
86-
QString abstract;
87-
QgsWcsOperationsMetadata operationsMetadata;
64+
QString version;
65+
QString title;
66+
QString abstract;
67+
QString getCoverageGetUrl;
8868
// using QgsWcsCoverageSummary for contents for simplification
89-
QgsWcsCoverageSummary contents;
69+
QgsWcsCoverageSummary contents;
9070
};
9171

9272
/**
@@ -124,7 +104,6 @@ class QgsWcsCapabilities : public QObject
124104
*/
125105
bool supportedCoverages( QVector<QgsWcsCoverageSummary> &coverageSummary );
126106

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

115+
//! Get list of all coverage summaries
116+
QList<QgsWcsCoverageSummary> coverages();
117+
136118
/**
137119
* \brief Prepare the URI so that we can later simply append param=value
138120
* \param uri uri to prepare
@@ -225,6 +207,9 @@ class QgsWcsCapabilities : public QObject
225207
//! Get coverage summary for identifier
226208
QgsWcsCoverageSummary * coverageSummary( QString const & theIdentifier, QgsWcsCoverageSummary* parent = 0 );
227209

210+
// ! Get list of all sub coverages
211+
QList<QgsWcsCoverageSummary> coverageSummaries( QgsWcsCoverageSummary* parent = 0 );
212+
228213
void initCoverageSummary( QgsWcsCoverageSummary &coverageSummary );
229214

230215
void clear();

src/providers/wcs/qgswcsprovider.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ QString QgsWcsProvider::metadata()
12301230
metadata += htmlRow(( "WCS Version" ), mCapabilities.version() );
12311231
metadata += htmlRow( tr( "Title" ), mCapabilities.capabilities().title );
12321232
metadata += htmlRow( tr( "Abstract" ), mCapabilities.capabilities().abstract );
1233-
// TODO
1233+
// TODO: probably apply stylesheet in QgsWcsCapabilities and save as html
12341234
//metadata += htmlRow ( tr( "Keywords" ), mCapabilities.service.keywordList.join( "<br />" ) );
12351235
//metadata += htmlRow ( tr( "Online Resource" ), "-" );
12361236
//metadata += htmlRow ( tr( "Contact Person" ),
@@ -1241,7 +1241,7 @@ QString QgsWcsProvider::metadata()
12411241
//metadata += htmlRow ( tr( "Access Constraints" ), mCapabilities.service.accessConstraints );
12421242
//metadata += htmlRow ( tr( "Image Formats" ), mCapabilities.capability.request.getMap.format.join( "<br />" ) );
12431243
//metadata += htmlRow ( tr( "GetCapabilitiesUrl" ), mBaseUrl );
1244-
metadata += htmlRow( tr( "Get Coverage Url" ), mCapabilities.capabilities().operationsMetadata.getCoverage.getUrl + ( mIgnoreGetCoverageUrl ? tr( "&nbsp;<font color=\"red\">(advertised but ignored)</font>" ) : "" ) );
1244+
metadata += htmlRow( tr( "Get Coverage Url" ), mCapabilities.getCoverageUrl() + ( mIgnoreGetCoverageUrl ? tr( "&nbsp;<font color=\"red\">(advertised but ignored)</font>" ) : "" ) );
12451245

12461246
// Close the nested table
12471247
metadata += "</table>";
@@ -1252,9 +1252,8 @@ QString QgsWcsProvider::metadata()
12521252
metadata += tr( "Coverages" );
12531253
metadata += "</th></tr>";
12541254

1255-
for ( int i = 0; i < mCapabilities.capabilities().contents.coverageSummary.size(); i++ )
1255+
foreach( QgsWcsCoverageSummary c, mCapabilities.coverages() )
12561256
{
1257-
QgsWcsCoverageSummary c = mCapabilities.capabilities().contents.coverageSummary.value( i );
12581257
metadata += coverageMetadata( c );
12591258
}
12601259

0 commit comments

Comments
 (0)