Skip to content

Commit 70a21d4

Browse files
authoredApr 25, 2017
Merge pull request #4415 from rldhont/server-wms-configparser-getcapabilities-part1
[Server] WMS GetCapabilities refactoring - Part 1
2 parents 96151e7 + 27a9053 commit 70a21d4

File tree

7 files changed

+614
-67
lines changed

7 files changed

+614
-67
lines changed
 

‎src/server/qgsserverprojectutils.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,58 @@ int QgsServerProjectUtils::wmsMaxHeight( const QgsProject &project )
8787
return project.readNumEntry( QStringLiteral( "WMSMaxHeight" ), QStringLiteral( "/" ), -1 );
8888
}
8989

90+
bool QgsServerProjectUtils::wmsUseLayerIds( const QgsProject &project )
91+
{
92+
return project.readBoolEntry( QStringLiteral( "WMSUseLayerIDs" ), QStringLiteral( "/" ) );
93+
}
94+
95+
bool QgsServerProjectUtils::wmsInfoFormatSIA2045( const QgsProject &project )
96+
{
97+
QString sia2045 = project.readEntry( QStringLiteral( "WMSInfoFormatSIA2045" ), QStringLiteral( "/" ), "" );
98+
99+
if ( sia2045.compare( QLatin1String( "enabled" ), Qt::CaseInsensitive ) == 0
100+
|| sia2045.compare( QLatin1String( "true" ), Qt::CaseInsensitive ) == 0 )
101+
{
102+
return true;
103+
}
104+
return false;
105+
}
106+
107+
bool QgsServerProjectUtils::wmsInspireActivated( const QgsProject &project )
108+
{
109+
return project.readBoolEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/activated" ) );
110+
}
111+
112+
QString QgsServerProjectUtils::wmsInspireLanguage( const QgsProject &project )
113+
{
114+
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/language" ) );
115+
}
116+
117+
QString QgsServerProjectUtils::wmsInspireMetadataUrl( const QgsProject &project )
118+
{
119+
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataUrl" ) );
120+
}
121+
122+
QString QgsServerProjectUtils::wmsInspireMetadataUrlType( const QgsProject &project )
123+
{
124+
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataUrlType" ) );
125+
}
126+
127+
QString QgsServerProjectUtils::wmsInspireTemporalReference( const QgsProject &project )
128+
{
129+
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/temporalReference" ) );
130+
}
131+
132+
QString QgsServerProjectUtils::wmsInspireMetadataDate( const QgsProject &project )
133+
{
134+
return project.readEntry( QStringLiteral( "WMSInspire" ), QStringLiteral( "/metadataDate" ) );
135+
}
136+
137+
QStringList QgsServerProjectUtils::wmsRestrictedComposers( const QgsProject &project )
138+
{
139+
return project.readListEntry( QStringLiteral( "WMSRestrictedComposers" ), QStringLiteral( "/" ), QStringList() );
140+
}
141+
90142
QString QgsServerProjectUtils::wmsServiceUrl( const QgsProject &project )
91143
{
92144
return project.readEntry( QStringLiteral( "WMSUrl" ), QStringLiteral( "/" ), "" );

‎src/server/qgsserverprojectutils.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,60 @@ namespace QgsServerProjectUtils
113113
*/
114114
SERVER_EXPORT int wmsMaxHeight( const QgsProject &project );
115115

116+
/** Returns if layer ids are used as name in WMS.
117+
* \param project the QGIS project
118+
* \returns if layer ids are used as name.
119+
*/
120+
SERVER_EXPORT bool wmsUseLayerIds( const QgsProject &project );
121+
122+
/** Returns if the info format is SIA20145.
123+
* \param project the QGIS project
124+
* \returns if the info format is SIA20145.
125+
*/
126+
SERVER_EXPORT bool wmsInfoFormatSIA2045( const QgsProject &project );
127+
128+
/** Returns if Inspire is activated.
129+
* \param project the QGIS project
130+
* \returns if Inspire is activated.
131+
*/
132+
SERVER_EXPORT bool wmsInspireActivated( const QgsProject &project );
133+
134+
/** Returns the Inspire language.
135+
* \param project the QGIS project
136+
* \returns the Inspire language if defined in project.
137+
*/
138+
SERVER_EXPORT QString wmsInspireLanguage( const QgsProject &project );
139+
140+
/** Returns the Inspire metadata URL.
141+
* \param project the QGIS project
142+
* \returns the Inspire metadata URL if defined in project.
143+
*/
144+
SERVER_EXPORT QString wmsInspireMetadataUrl( const QgsProject &project );
145+
146+
/** Returns the Inspire metadata URL type.
147+
* \param project the QGIS project
148+
* \returns the Inspire metadata URL type if defined in project.
149+
*/
150+
SERVER_EXPORT QString wmsInspireMetadataUrlType( const QgsProject &project );
151+
152+
/** Returns the Inspire temporal reference.
153+
* \param project the QGIS project
154+
* \returns the Inspire temporal reference if defined in project.
155+
*/
156+
SERVER_EXPORT QString wmsInspireTemporalReference( const QgsProject &project );
157+
158+
/** Returns the Inspire metadata date.
159+
* \param project the QGIS project
160+
* \returns the Inspire metadata date if defined in project.
161+
*/
162+
SERVER_EXPORT QString wmsInspireMetadataDate( const QgsProject &project );
163+
164+
/** Returns the restricted composer list.
165+
* \param project the QGIS project
166+
* \returns the restricted composer list if defined in project.
167+
*/
168+
SERVER_EXPORT QStringList wmsRestrictedComposers( const QgsProject &project );
169+
116170
/** Returns the WMS service url defined in a QGIS project.
117171
* \param project the QGIS project
118172
* \returns url if defined in project, an empty string otherwise.

‎src/server/services/wms/qgswmsgetcapabilities.cpp

Lines changed: 482 additions & 59 deletions
Large diffs are not rendered by default.

‎src/server/services/wms/qgswmsgetcapabilities.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,32 @@
2424
namespace QgsWms
2525
{
2626

27+
/**
28+
* Create WFSLayers element for get capabilities document
29+
*/
30+
QDomElement getWFSLayersElement( QDomDocument &doc, const QgsProject *project );
31+
32+
/**
33+
* Create ComposerTemplates element for get capabilities document
34+
*/
35+
QDomElement getComposerTemplatesElement( QDomDocument &doc, const QgsProject *project );
36+
37+
/**
38+
* Create InspireCapabilities element for get capabilities document
39+
*/
40+
QDomElement getInspireCapabilitiesElement( QDomDocument &doc, const QgsProject *project );
41+
42+
/**
43+
* Create Capability element for get capabilities document
44+
*/
45+
QDomElement getCapabilityElement( QDomDocument &doc, const QgsProject *project, const QString &version,
46+
const QgsServerRequest &request, bool projectSettings );
47+
48+
/**
49+
* Create Service element for get capabilities document
50+
*/
51+
QDomElement getServiceElement( QDomDocument &doc, const QgsProject *project, const QString &version );
52+
2753
/** Output GetCapabilities response
2854
*/
2955
void writeGetCapabilities( QgsServerInterface *serverIface, const QgsProject *project,

‎tests/testdata/qgis_server/getcapabilities.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ Content-Type: text/xml; charset=utf-8
1010
<KeywordList>
1111
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
1212
</KeywordList>
13-
<OnlineResource xlink:type="simple" xlink:href="" xmlns:xlink="http://www.w3.org/1999/xlink"/>
1413
<ContactInformation>
1514
<ContactPersonPrimary>
1615
<ContactPerson>Alessandro Pasotti</ContactPerson>
1716
<ContactOrganization>QGIS dev team</ContactOrganization>
18-
<ContactPosition></ContactPosition>
1917
</ContactPersonPrimary>
20-
<ContactVoiceTelephone></ContactVoiceTelephone>
2118
<ContactElectronicMailAddress>elpaso@itopen.it</ContactElectronicMailAddress>
2219
</ContactInformation>
2320
<Fees>conditions unknown</Fees>

‎tests/testdata/qgis_server/getcapabilities_inspire.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ Content-Type: text/xml; charset=utf-8
1010
<KeywordList>
1111
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
1212
</KeywordList>
13-
<OnlineResource xlink:type="simple" xlink:href="" xmlns:xlink="http://www.w3.org/1999/xlink"/>
1413
<ContactInformation>
1514
<ContactPersonPrimary>
1615
<ContactPerson>Alessandro Pasotti</ContactPerson>
1716
<ContactOrganization>QGIS dev team</ContactOrganization>
1817
<ContactPosition>originator</ContactPosition>
1918
</ContactPersonPrimary>
20-
<ContactVoiceTelephone></ContactVoiceTelephone>
2119
<ContactElectronicMailAddress>elpaso@itopen.it</ContactElectronicMailAddress>
2220
</ContactInformation>
2321
<Fees>conditions unknown</Fees>

‎tests/testdata/qgis_server/getprojectsettings.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ Content-Type: text/xml; charset=utf-8
1010
<KeywordList>
1111
<Keyword vocabulary="ISO">infoMapAccessService</Keyword>
1212
</KeywordList>
13-
<OnlineResource xlink:type="simple" xlink:href="" xmlns:xlink="http://www.w3.org/1999/xlink"/>
1413
<ContactInformation>
1514
<ContactPersonPrimary>
1615
<ContactPerson>Alessandro Pasotti</ContactPerson>
1716
<ContactOrganization>QGIS dev team</ContactOrganization>
18-
<ContactPosition></ContactPosition>
1917
</ContactPersonPrimary>
20-
<ContactVoiceTelephone></ContactVoiceTelephone>
2118
<ContactElectronicMailAddress>elpaso@itopen.it</ContactElectronicMailAddress>
2219
</ContactInformation>
2320
<Fees>conditions unknown</Fees>

0 commit comments

Comments
 (0)
Please sign in to comment.