Skip to content
Permalink
Browse files
No contact information in service capabilities of wfs and wcs
  • Loading branch information
mhugent committed May 29, 2014
1 parent 0e70646 commit 49eba8caa428e20d20ad6b1fbaa485a80e9ca218
@@ -419,60 +419,63 @@ void QgsServerProjectParser::serviceCapabilities( QDomElement& parentElement, QD

serviceElem.appendChild( onlineResourceElem );

//Contact information
QDomElement contactInfoElem = doc.createElement( "ContactInformation" );
if ( service.compare( "WMS", Qt::CaseInsensitive ) == 0 ) //no contact information in WFS 1.0 and WCS 1.0
{
//Contact information
QDomElement contactInfoElem = doc.createElement( "ContactInformation" );

//Contact person primary
QDomElement contactPersonPrimaryElem = doc.createElement( "ContactPersonPrimary" );
//Contact person primary
QDomElement contactPersonPrimaryElem = doc.createElement( "ContactPersonPrimary" );

//Contact person
QDomElement contactPersonElem = propertiesElement.firstChildElement( "WMSContactPerson" );
QString contactPersonString;
if ( !contactPersonElem.isNull() )
{
contactPersonString = contactPersonElem.text();
}
QDomElement wmsContactPersonElem = doc.createElement( "ContactPerson" );
QDomText contactPersonText = doc.createTextNode( contactPersonString );
wmsContactPersonElem.appendChild( contactPersonText );
contactPersonPrimaryElem.appendChild( wmsContactPersonElem );
//Contact person
QDomElement contactPersonElem = propertiesElement.firstChildElement( "WMSContactPerson" );
QString contactPersonString;
if ( !contactPersonElem.isNull() )
{
contactPersonString = contactPersonElem.text();
}
QDomElement wmsContactPersonElem = doc.createElement( "ContactPerson" );
QDomText contactPersonText = doc.createTextNode( contactPersonString );
wmsContactPersonElem.appendChild( contactPersonText );
contactPersonPrimaryElem.appendChild( wmsContactPersonElem );


//Contact organisation
QDomElement contactOrganizationElem = propertiesElement.firstChildElement( "WMSContactOrganization" );
QString contactOrganizationString;
if ( !contactOrganizationElem.isNull() )
{
contactOrganizationString = contactOrganizationElem.text();
}
QDomElement wmsContactOrganizationElem = doc.createElement( "ContactOrganization" );
QDomText contactOrganizationText = doc.createTextNode( contactOrganizationString );
wmsContactOrganizationElem.appendChild( contactOrganizationText );
contactPersonPrimaryElem.appendChild( wmsContactOrganizationElem );
contactInfoElem.appendChild( contactPersonPrimaryElem );
//Contact organisation
QDomElement contactOrganizationElem = propertiesElement.firstChildElement( "WMSContactOrganization" );
QString contactOrganizationString;
if ( !contactOrganizationElem.isNull() )
{
contactOrganizationString = contactOrganizationElem.text();
}
QDomElement wmsContactOrganizationElem = doc.createElement( "ContactOrganization" );
QDomText contactOrganizationText = doc.createTextNode( contactOrganizationString );
wmsContactOrganizationElem.appendChild( contactOrganizationText );
contactPersonPrimaryElem.appendChild( wmsContactOrganizationElem );
contactInfoElem.appendChild( contactPersonPrimaryElem );

//phone
QDomElement phoneElem = propertiesElement.firstChildElement( "WMSContactPhone" );
if ( !phoneElem.isNull() )
{
QDomElement wmsPhoneElem = doc.createElement( "ContactVoiceTelephone" );
QDomText wmsPhoneText = doc.createTextNode( phoneElem.text() );
wmsPhoneElem.appendChild( wmsPhoneText );
contactInfoElem.appendChild( wmsPhoneElem );
}

//phone
QDomElement phoneElem = propertiesElement.firstChildElement( "WMSContactPhone" );
if ( !phoneElem.isNull() )
{
QDomElement wmsPhoneElem = doc.createElement( "ContactVoiceTelephone" );
QDomText wmsPhoneText = doc.createTextNode( phoneElem.text() );
wmsPhoneElem.appendChild( wmsPhoneText );
contactInfoElem.appendChild( wmsPhoneElem );
}
//mail
QDomElement mailElem = propertiesElement.firstChildElement( "WMSContactMail" );
if ( !mailElem.isNull() )
{
QDomElement wmsMailElem = doc.createElement( "ContactElectronicMailAddress" );
QDomText wmsMailText = doc.createTextNode( mailElem.text() );
wmsMailElem.appendChild( wmsMailText );
contactInfoElem.appendChild( wmsMailElem );
}

//mail
QDomElement mailElem = propertiesElement.firstChildElement( "WMSContactMail" );
if ( !mailElem.isNull() )
{
QDomElement wmsMailElem = doc.createElement( "ContactElectronicMailAddress" );
QDomText wmsMailText = doc.createTextNode( mailElem.text() );
wmsMailElem.appendChild( wmsMailText );
contactInfoElem.appendChild( wmsMailElem );
serviceElem.appendChild( contactInfoElem );
}

serviceElem.appendChild( contactInfoElem );

//Fees
QDomElement feesElem = propertiesElement.firstChildElement( "WMSFees" );
if ( !feesElem.isNull() )
@@ -30,90 +30,6 @@ QgsWCSProjectParser::~QgsWCSProjectParser()
void QgsWCSProjectParser::serviceCapabilities( QDomElement& parentElement, QDomDocument& doc ) const
{
mProjectParser.serviceCapabilities( parentElement, doc, "WCS" );
#if 0
QDomElement serviceElem = doc.createElement( "Service" );

QDomElement propertiesElem = mProjectParser.propertiesElem();
if ( propertiesElem.isNull() )
{
QgsConfigParserUtils::fallbackServiceCapabilities( parentElement, doc );
return;
}

QDomElement serviceCapabilityElem = propertiesElem.firstChildElement( "WMSServiceCapabilities" );
if ( serviceCapabilityElem.isNull() || serviceCapabilityElem.text().compare( "true", Qt::CaseInsensitive ) != 0 )
{
QgsConfigParserUtils::fallbackServiceCapabilities( parentElement, doc );
return;
}

//Service name is always WCS
QDomElement wcsNameElem = doc.createElement( "name" );
QDomText wcsNameText = doc.createTextNode( "WCS" );
wcsNameElem.appendChild( wcsNameText );
serviceElem.appendChild( wcsNameElem );

//WMS title
QDomElement titleElem = propertiesElem.firstChildElement( "WMSServiceTitle" );
if ( !titleElem.isNull() )
{
QDomElement wcsLabelElem = doc.createElement( "label" );
QDomText wcsLabelText = doc.createTextNode( titleElem.text() );
wcsLabelElem.appendChild( wcsLabelText );
serviceElem.appendChild( wcsLabelElem );
}

//WMS abstract
QDomElement abstractElem = propertiesElem.firstChildElement( "WMSServiceAbstract" );
if ( !abstractElem.isNull() )
{
QDomElement wcsDescriptionElem = doc.createElement( "description" );
QDomText wcsDescriptionText = doc.createTextNode( abstractElem.text() );
wcsDescriptionElem.appendChild( wcsDescriptionText );
serviceElem.appendChild( wcsDescriptionElem );
}

//keyword list
QDomElement keywordListElem = propertiesElem.firstChildElement( "WMSKeywordList" );
if ( !keywordListElem.isNull() && !keywordListElem.text().isEmpty() )
{
QDomNodeList keywordList = keywordListElem.elementsByTagName( "value" );
if ( keywordList.size() > 0 )
{
QDomElement wcsKeywordsElem = doc.createElement( "keywords" );
for ( int i = 0; i < keywordList.size(); ++i )
{
QDomElement wcsKeywordElem = doc.createElement( "keyword" );
QDomText keywordText = doc.createTextNode( keywordList.at( i ).toElement().text() );
wcsKeywordElem.appendChild( keywordText );
wcsKeywordsElem.appendChild( wcsKeywordElem );
}
serviceElem.appendChild( wcsKeywordsElem );
}
}

//Fees
QDomElement feesElem = propertiesElem.firstChildElement( "WMSFees" );
if ( !feesElem.isNull() )
{
QDomElement wcsFeesElem = doc.createElement( "fees" );
QDomText wcsFeesText = doc.createTextNode( feesElem.text() );
wcsFeesElem.appendChild( wcsFeesText );
serviceElem.appendChild( wcsFeesElem );
}

//AccessConstraints
QDomElement accessConstraintsElem = propertiesElem.firstChildElement( "WMSAccessConstraints" );
if ( !accessConstraintsElem.isNull() )
{
QDomElement wcsAccessConstraintsElem = doc.createElement( "accessConstraints" );
QDomText wcsAccessConstraintsText = doc.createTextNode( accessConstraintsElem.text() );
wcsAccessConstraintsElem.appendChild( wcsAccessConstraintsText );
serviceElem.appendChild( wcsAccessConstraintsElem );
}

parentElement.appendChild( serviceElem );
#endif //0
}

QString QgsWCSProjectParser::wcsServiceUrl() const
@@ -32,102 +32,6 @@ QgsWFSProjectParser::~QgsWFSProjectParser()
void QgsWFSProjectParser::serviceCapabilities( QDomElement& parentElement, QDomDocument& doc ) const
{
mProjectParser.serviceCapabilities( parentElement, doc, "WFS" );

#if 0
QDomElement serviceElem = doc.createElement( "Service" );

QDomElement propertiesElem = mProjectParser.propertiesElem();
if ( propertiesElem.isNull() )
{
QgsConfigParserUtils::fallbackServiceCapabilities( parentElement, doc );
return;
}

QDomElement serviceCapabilityElem = propertiesElem.firstChildElement( "WMSServiceCapabilities" );
if ( serviceCapabilityElem.isNull() || serviceCapabilityElem.text().compare( "true", Qt::CaseInsensitive ) != 0 )
{
QgsConfigParserUtils::fallbackServiceCapabilities( parentElement, doc );
return;
}

QDomElement wmsNameElem = doc.createElement( "Name" );
QDomText wmsNameText = doc.createTextNode( "WFS" );
wmsNameElem.appendChild( wmsNameText );
serviceElem.appendChild( wmsNameElem );

//WMS title
QDomElement titleElem = propertiesElem.firstChildElement( "WMSServiceTitle" );
if ( !titleElem.isNull() )
{
QDomElement wmsTitleElem = doc.createElement( "Title" );
QDomText wmsTitleText = doc.createTextNode( titleElem.text() );
wmsTitleElem.appendChild( wmsTitleText );
serviceElem.appendChild( wmsTitleElem );
}

//WMS abstract
QDomElement abstractElem = propertiesElem.firstChildElement( "WMSServiceAbstract" );
if ( !abstractElem.isNull() )
{
QDomElement wmsAbstractElem = doc.createElement( "Abstract" );
QDomText wmsAbstractText = doc.createTextNode( abstractElem.text() );
wmsAbstractElem.appendChild( wmsAbstractText );
serviceElem.appendChild( wmsAbstractElem );
}

//keyword list
QDomElement keywordListElem = propertiesElem.firstChildElement( "WMSKeywordList" );
if ( !keywordListElem.isNull() && !keywordListElem.text().isEmpty() )
{
QDomNodeList keywordList = keywordListElem.elementsByTagName( "value" );
QStringList keywords;
for ( int i = 0; i < keywordList.size(); ++i )
{
keywords << keywordList.at( i ).toElement().text();
}

if ( keywordList.size() > 0 )
{
QDomElement wfsKeywordElem = doc.createElement( "Keywords" );
QDomText keywordText = doc.createTextNode( keywords.join( ", " ) );
wfsKeywordElem.appendChild( keywordText );
serviceElem.appendChild( wfsKeywordElem );
}
}

//OnlineResource element is mandatory according to the WMS specification
QDomElement wmsOnlineResourceElem = propertiesElem.firstChildElement( "WMSOnlineResource" );
QDomElement onlineResourceElem = doc.createElement( "OnlineResource" );
onlineResourceElem.setAttribute( "xmlns:xlink", "http://www.w3.org/1999/xlink" );
onlineResourceElem.setAttribute( "xlink:type", "simple" );
if ( !wmsOnlineResourceElem.isNull() )
{
onlineResourceElem.setAttribute( "xlink:href", wmsOnlineResourceElem.text() );
}

serviceElem.appendChild( onlineResourceElem );

//Fees
QDomElement feesElem = propertiesElem.firstChildElement( "WMSFees" );
if ( !feesElem.isNull() )
{
QDomElement wmsFeesElem = doc.createElement( "Fees" );
QDomText wmsFeesText = doc.createTextNode( feesElem.text() );
wmsFeesElem.appendChild( wmsFeesText );
serviceElem.appendChild( wmsFeesElem );
}

//AccessConstraints
QDomElement accessConstraintsElem = propertiesElem.firstChildElement( "WMSAccessConstraints" );
if ( !accessConstraintsElem.isNull() )
{
QDomElement wmsAccessConstraintsElem = doc.createElement( "AccessConstraints" );
QDomText wmsAccessConstraintsText = doc.createTextNode( accessConstraintsElem.text() );
wmsAccessConstraintsElem.appendChild( wmsAccessConstraintsText );
serviceElem.appendChild( wmsAccessConstraintsElem );
}
parentElement.appendChild( serviceElem );
#endif //0
}

QString QgsWFSProjectParser::serviceUrl() const

0 comments on commit 49eba8c

Please sign in to comment.