34#ifdef HAVE_SERVER_PYTHON_PLUGINS
38 const QDomDocument *capabilitiesDocument =
nullptr;
40#ifdef HAVE_SERVER_PYTHON_PLUGINS
42 if ( cacheManager && cacheManager->
getCachedDocument( &doc, project, request, accessControl ) )
44 capabilitiesDocument = &doc;
54 capabilitiesDocument = &doc;
58 capabilitiesDocument = &doc;
60 response.
setHeader( QStringLiteral(
"Content-Type" ), QStringLiteral(
"text/xml; charset=utf-8" ) );
61 response.
write( capabilitiesDocument->toByteArray() );
72 QDomElement wcsCapabilitiesElement = doc.createElement( QStringLiteral(
"WCS_Capabilities" ) );
73 wcsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns" ),
WCS_NAMESPACE );
74 wcsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:xsi" ), QStringLiteral(
"http://www.w3.org/2001/XMLSchema-instance" ) );
75 wcsCapabilitiesElement.setAttribute( QStringLiteral(
"xsi:schemaLocation" ),
WCS_NAMESPACE +
" http://schemas.opengis.net/wcs/1.0.0/wcsCapabilities.xsd" );
76 wcsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:gml" ),
GML_NAMESPACE );
77 wcsCapabilitiesElement.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
79 wcsCapabilitiesElement.setAttribute( QStringLiteral(
"updateSequence" ), QStringLiteral(
"0" ) );
80 doc.appendChild( wcsCapabilitiesElement );
86 QDomElement capabilityElement = doc.createElement( QStringLiteral(
"Capability" ) );
87 wcsCapabilitiesElement.appendChild( capabilityElement );
90 QDomElement requestElement = doc.createElement( QStringLiteral(
"Request" ) );
91 capabilityElement.appendChild( requestElement );
94 QDomElement getCapabilitiesElement = doc.createElement( QStringLiteral(
"GetCapabilities" ) );
95 requestElement.appendChild( getCapabilitiesElement );
97 QDomElement dcpTypeElement = doc.createElement( QStringLiteral(
"DCPType" ) );
98 getCapabilitiesElement.appendChild( dcpTypeElement );
99 QDomElement httpElement = doc.createElement( QStringLiteral(
"HTTP" ) );
100 dcpTypeElement.appendChild( httpElement );
105 QDomElement getElement = doc.createElement( QStringLiteral(
"Get" ) );
106 httpElement.appendChild( getElement );
107 QDomElement onlineResourceElement = doc.createElement( QStringLiteral(
"OnlineResource" ) );
108 onlineResourceElement.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
109 onlineResourceElement.setAttribute( QStringLiteral(
"xlink:href" ), hrefString );
110 getElement.appendChild( onlineResourceElement );
112 const QDomElement getCapabilitiesDhcTypePostElement = dcpTypeElement.cloneNode().toElement();
113 getCapabilitiesDhcTypePostElement.firstChild().firstChild().toElement().setTagName( QStringLiteral(
"Post" ) );
114 getCapabilitiesElement.appendChild( getCapabilitiesDhcTypePostElement );
116 QDomElement describeCoverageElement = getCapabilitiesElement.cloneNode().toElement();
117 describeCoverageElement.setTagName( QStringLiteral(
"DescribeCoverage" ) );
118 requestElement.appendChild( describeCoverageElement );
120 QDomElement getCoverageElement = getCapabilitiesElement.cloneNode().toElement();
121 getCoverageElement.setTagName( QStringLiteral(
"GetCoverage" ) );
122 requestElement.appendChild( getCoverageElement );
133 QDomElement serviceElem = doc.createElement( QStringLiteral(
"Service" ) );
136 QDomElement nameElem = doc.createElement( QStringLiteral(
"name" ) );
137 const QDomText nameText = doc.createTextNode(
"WCS" );
138 nameElem.appendChild( nameText );
139 serviceElem.appendChild( nameElem );
142 QDomElement titleElem = doc.createElement( QStringLiteral(
"label" ) );
143 const QDomText titleText = doc.createTextNode( title );
144 titleElem.appendChild( titleText );
145 serviceElem.appendChild( titleElem );
148 if ( !abstract.isEmpty() )
150 QDomElement abstractElem = doc.createElement( QStringLiteral(
"description" ) );
151 const QDomText abstractText = doc.createCDATASection( abstract );
152 abstractElem.appendChild( abstractText );
153 serviceElem.appendChild( abstractElem );
157 if ( !keywords.isEmpty() )
159 QDomElement keywordsElem = doc.createElement( QStringLiteral(
"keywords" ) );
160 for (
int i = 0; i < keywords.size(); ++i )
162 QDomElement keywordElem = doc.createElement( QStringLiteral(
"keyword" ) );
163 const QDomText keywordText = doc.createTextNode( keywords.at( i ) );
164 keywordElem.appendChild( keywordText );
165 keywordsElem.appendChild( keywordElem );
167 serviceElem.appendChild( keywordsElem );
177 if ( !contactPerson.isEmpty() || !contactOrganization.isEmpty() || !contactPosition.isEmpty() || !contactMail.isEmpty() || !contactPhone.isEmpty() || !onlineResource.isEmpty() )
179 QDomElement responsiblePartyElem = doc.createElement( QStringLiteral(
"responsibleParty" ) );
180 if ( !contactPerson.isEmpty() )
182 QDomElement contactPersonElem = doc.createElement( QStringLiteral(
"individualName" ) );
183 const QDomText contactPersonText = doc.createTextNode( contactPerson );
184 contactPersonElem.appendChild( contactPersonText );
185 responsiblePartyElem.appendChild( contactPersonElem );
187 if ( !contactOrganization.isEmpty() )
189 QDomElement contactOrganizationElem = doc.createElement( QStringLiteral(
"organisationName" ) );
190 const QDomText contactOrganizationText = doc.createTextNode( contactOrganization );
191 contactOrganizationElem.appendChild( contactOrganizationText );
192 responsiblePartyElem.appendChild( contactOrganizationElem );
194 if ( !contactPosition.isEmpty() )
196 QDomElement contactPositionElem = doc.createElement( QStringLiteral(
"positionName" ) );
197 const QDomText contactPositionText = doc.createTextNode( contactPosition );
198 contactPositionElem.appendChild( contactPositionText );
199 responsiblePartyElem.appendChild( contactPositionElem );
201 if ( !contactMail.isEmpty() || !contactPhone.isEmpty() || !onlineResource.isEmpty() )
203 QDomElement contactInfoElem = doc.createElement( QStringLiteral(
"contactInfo" ) );
204 if ( !contactMail.isEmpty() )
206 QDomElement contactAddressElem = doc.createElement( QStringLiteral(
"address" ) );
207 QDomElement contactAddressMailElem = doc.createElement( QStringLiteral(
"electronicMailAddress" ) );
208 const QDomText contactAddressMailText = doc.createTextNode( contactMail );
209 contactAddressMailElem.appendChild( contactAddressMailText );
210 contactAddressElem.appendChild( contactAddressMailElem );
211 contactInfoElem.appendChild( contactAddressElem );
213 if ( !contactPhone.isEmpty() )
215 QDomElement contactPhoneElem = doc.createElement( QStringLiteral(
"phone" ) );
216 QDomElement contactVoiceElem = doc.createElement( QStringLiteral(
"voice" ) );
217 const QDomText contactVoiceText = doc.createTextNode( contactPhone );
218 contactVoiceElem.appendChild( contactVoiceText );
219 contactPhoneElem.appendChild( contactVoiceElem );
220 contactInfoElem.appendChild( contactPhoneElem );
222 if ( !onlineResource.isEmpty() )
224 QDomElement onlineResourceElem = doc.createElement( QStringLiteral(
"onlineResource" ) );
225 onlineResourceElem.setAttribute( QStringLiteral(
"xmlns:xlink" ), QStringLiteral(
"http://www.w3.org/1999/xlink" ) );
226 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:type" ), QStringLiteral(
"simple" ) );
227 onlineResourceElem.setAttribute( QStringLiteral(
"xlink:href" ), onlineResource );
228 contactInfoElem.appendChild( onlineResourceElem );
230 responsiblePartyElem.appendChild( contactInfoElem );
232 serviceElem.appendChild( responsiblePartyElem );
235 QDomElement feesElem = doc.createElement( QStringLiteral(
"fees" ) );
236 QDomText feesText = doc.createTextNode( QStringLiteral(
"None" ) );
238 if ( !fees.isEmpty() )
240 feesText = doc.createTextNode( fees );
242 feesElem.appendChild( feesText );
243 serviceElem.appendChild( feesElem );
245 QDomElement accessConstraintsElem = doc.createElement( QStringLiteral(
"accessConstraints" ) );
246 QDomText accessConstraintsText = doc.createTextNode( QStringLiteral(
"None" ) );
248 if ( !accessConstraints.isEmpty() )
250 accessConstraintsText = doc.createTextNode( accessConstraints );
252 accessConstraintsElem.appendChild( accessConstraintsText );
253 serviceElem.appendChild( accessConstraintsElem );