@@ -36,20 +36,83 @@ static const QString WCS_NAMESPACE = "http://www.opengis.net/wcs";
36
36
static const QString GML_NAMESPACE = " http://www.opengis.net/gml" ;
37
37
static const QString OGC_NAMESPACE = " http://www.opengis.net/ogc" ;
38
38
39
- QgsWCSServer::QgsWCSServer ( QMap<QString, QString> parameters )
40
- : mParameterMap( parameters )
41
- , mConfigParser( 0 )
39
+ QgsWCSServer::QgsWCSServer ( const QString& configFilePath, QMap<QString, QString> parameters, QgsConfigParser* cp,
40
+ QgsRequestHandler* rh ): QgsOWSServer( configFilePath, parameters, cp, rh )
42
41
{
43
42
}
44
43
45
44
QgsWCSServer::~QgsWCSServer ()
46
45
{
47
46
}
48
47
49
- QgsWCSServer::QgsWCSServer ()
48
+ QgsWCSServer::QgsWCSServer (): QgsOWSServer( QString(), QMap<QString, QString>(), 0, 0 )
50
49
{
51
50
}
52
51
52
+ void QgsWCSServer::executeRequest ()
53
+ {
54
+ // request type
55
+ QString request = mParameters .value ( " REQUEST" );
56
+ if ( request.isEmpty () )
57
+ {
58
+ // do some error handling
59
+ QgsDebugMsg ( " unable to find 'REQUEST' parameter, exiting..." );
60
+ mRequestHandler ->sendServiceException ( QgsMapServiceException ( " OperationNotSupported" , " Please check the value of the REQUEST parameter" ) );
61
+ return ;
62
+ }
63
+
64
+ if ( request.compare ( " GetCapabilities" , Qt::CaseInsensitive ) == 0 )
65
+ {
66
+ QDomDocument capabilitiesDocument;
67
+ try
68
+ {
69
+ capabilitiesDocument = getCapabilities ();
70
+ }
71
+ catch ( QgsMapServiceException& ex )
72
+ {
73
+ mRequestHandler ->sendServiceException ( ex );
74
+ return ;
75
+ }
76
+ QgsDebugMsg ( " sending GetCapabilities response" );
77
+ mRequestHandler ->sendGetCapabilitiesResponse ( capabilitiesDocument );
78
+ return ;
79
+ }
80
+ else if ( request.compare ( " DescribeCoverage" , Qt::CaseInsensitive ) == 0 )
81
+ {
82
+ QDomDocument describeDocument;
83
+ try
84
+ {
85
+ describeDocument = describeCoverage ();
86
+ }
87
+ catch ( QgsMapServiceException& ex )
88
+ {
89
+ mRequestHandler ->sendServiceException ( ex );
90
+ return ;
91
+ }
92
+ QgsDebugMsg ( " sending GetCapabilities response" );
93
+ mRequestHandler ->sendGetCapabilitiesResponse ( describeDocument );
94
+ return ;
95
+ }
96
+ else if ( request.compare ( " GetCoverage" , Qt::CaseInsensitive ) == 0 )
97
+ {
98
+ QByteArray* coverageOutput;
99
+ try
100
+ {
101
+ coverageOutput = getCoverage ();
102
+ }
103
+ catch ( QgsMapServiceException& ex )
104
+ {
105
+ mRequestHandler ->sendServiceException ( ex );
106
+ return ;
107
+ }
108
+ if ( coverageOutput )
109
+ {
110
+ mRequestHandler ->sendGetCoverageResponse ( coverageOutput );
111
+ }
112
+ return ;
113
+ }
114
+ }
115
+
53
116
QDomDocument QgsWCSServer::getCapabilities ()
54
117
{
55
118
QgsDebugMsg ( " Entering." );
@@ -153,15 +216,15 @@ QDomDocument QgsWCSServer::describeCoverage()
153
216
// defining coverage name
154
217
QString coveName = " " ;
155
218
// read COVERAGE
156
- QMap<QString, QString>::const_iterator cove_name_it = mParameterMap .find ( " COVERAGE" );
157
- if ( cove_name_it != mParameterMap .end () )
219
+ QMap<QString, QString>::const_iterator cove_name_it = mParameters .find ( " COVERAGE" );
220
+ if ( cove_name_it != mParameters .end () )
158
221
{
159
222
coveName = cove_name_it.value ();
160
223
}
161
224
if ( coveName == " " )
162
225
{
163
- QMap<QString, QString>::const_iterator cove_name_it = mParameterMap .find ( " IDENTIFIER" );
164
- if ( cove_name_it != mParameterMap .end () )
226
+ QMap<QString, QString>::const_iterator cove_name_it = mParameters .find ( " IDENTIFIER" );
227
+ if ( cove_name_it != mParameters .end () )
165
228
{
166
229
coveName = cove_name_it.value ();
167
230
}
@@ -181,15 +244,15 @@ QByteArray* QgsWCSServer::getCoverage()
181
244
// defining coverage name
182
245
QString coveName = " " ;
183
246
// read COVERAGE
184
- QMap<QString, QString>::const_iterator cove_name_it = mParameterMap .find ( " COVERAGE" );
185
- if ( cove_name_it != mParameterMap .end () )
247
+ QMap<QString, QString>::const_iterator cove_name_it = mParameters .find ( " COVERAGE" );
248
+ if ( cove_name_it != mParameters .end () )
186
249
{
187
250
coveName = cove_name_it.value ();
188
251
}
189
252
if ( coveName == " " )
190
253
{
191
- QMap<QString, QString>::const_iterator cove_name_it = mParameterMap .find ( " IDENTIFIER" );
192
- if ( cove_name_it != mParameterMap .end () )
254
+ QMap<QString, QString>::const_iterator cove_name_it = mParameters .find ( " IDENTIFIER" );
255
+ if ( cove_name_it != mParameters .end () )
193
256
{
194
257
coveName = cove_name_it.value ();
195
258
}
@@ -216,8 +279,8 @@ QByteArray* QgsWCSServer::getCoverage()
216
279
QString crs = " " ;
217
280
218
281
// read BBOX
219
- QMap<QString, QString>::const_iterator bbIt = mParameterMap .find ( " BBOX" );
220
- if ( bbIt == mParameterMap .end () )
282
+ QMap<QString, QString>::const_iterator bbIt = mParameters .find ( " BBOX" );
283
+ if ( bbIt == mParameters .end () )
221
284
{
222
285
minx = 0 ; miny = 0 ; maxx = 0 ; maxy = 0 ;
223
286
}
@@ -240,11 +303,11 @@ QByteArray* QgsWCSServer::getCoverage()
240
303
}
241
304
242
305
// read WIDTH
243
- width = mParameterMap .value ( " WIDTH" , " 0" ).toInt ( &conversionSuccess );
306
+ width = mParameters .value ( " WIDTH" , " 0" ).toInt ( &conversionSuccess );
244
307
if ( !conversionSuccess )
245
308
width = 0 ;
246
309
// read HEIGHT
247
- height = mParameterMap .value ( " HEIGHT" , " 0" ).toInt ( &conversionSuccess );
310
+ height = mParameters .value ( " HEIGHT" , " 0" ).toInt ( &conversionSuccess );
248
311
if ( !conversionSuccess )
249
312
{
250
313
height = 0 ;
@@ -255,7 +318,7 @@ QByteArray* QgsWCSServer::getCoverage()
255
318
mErrors << QString ( " The WIDTH and HEIGHT are mandatory and have to be integer" );
256
319
}
257
320
258
- crs = mParameterMap .value ( " CRS" , " " );
321
+ crs = mParameters .value ( " CRS" , " " );
259
322
if ( crs == " " )
260
323
{
261
324
mErrors << QString ( " The CRS is mandatory" );
@@ -281,7 +344,7 @@ QByteArray* QgsWCSServer::getCoverage()
281
344
{
282
345
// RESPONSE_CRS
283
346
QgsCoordinateReferenceSystem responseCRS = rLayer->crs ();
284
- crs = mParameterMap .value ( " RESPONSE_CRS" , " " );
347
+ crs = mParameters .value ( " RESPONSE_CRS" , " " );
285
348
if ( crs != " " )
286
349
{
287
350
responseCRS = QgsCRSCache::instance ()->crsByAuthId ( crs );
0 commit comments