Aller à la documentation de ce fichier.
48 #ifndef ATTRIBUTIONURL_H
49 #define ATTRIBUTIONURL_H
51 #include <rok4/utils/ResourceLocator.h>
85 ResourceLocator* logo;
98 if (! doc[
"title"].is_string()) {
99 missingField =
"title";
102 title = doc[
"title"].string_value();
104 if (! doc[
"url"].is_string()) {
105 missingField =
"url";
108 href = doc[
"url"].string_value();
110 if (doc[
"logo"].is_object()) {
111 if (! doc[
"logo"][
"width"].is_number()) {
112 missingField =
"logo.width";
115 width = doc[
"logo"][
"width"].number_value();
116 if (! doc[
"logo"][
"height"].is_number()) {
117 missingField =
"logo.height";
120 height = doc[
"logo"][
"height"].number_value();
122 if (! doc[
"logo"][
"format"].is_string()) {
123 missingField =
"logo.format";
126 if (! doc[
"logo"][
"url"].is_string()) {
127 missingField =
"logo.url";
130 logo =
new ResourceLocator(doc[
"logo"][
"format"].string_value(), doc[
"logo"][
"url"].string_value());
141 std::string res =
"<Attribution><Title>" + title +
"</Title>";
143 res +=
"<Logo width=\"" + std::to_string(width) +
"\" height=\"" + std::to_string(height) +
"\" href=\"" + logo->getHRef() +
"\" mime-type=\"" + logo->getFormat() +
"\" />\n";
145 res +=
"</Attribution>";
154 TiXmlElement* el =
new TiXmlElement (
"Attribution" );
157 TiXmlElement* orEl =
new TiXmlElement (
"OnlineResource" );
158 orEl->SetAttribute (
"xlink:type",
"simple" );
159 orEl->SetAttribute (
"xlink:href", href );
160 el->LinkEndChild ( orEl );
163 TiXmlElement* logoEl =
new TiXmlElement (
"LogoURL" );
164 logoEl->SetAttribute (
"width", width );
165 logoEl->SetAttribute (
"height", height );
168 TiXmlElement* logoOrEl =
new TiXmlElement (
"OnlineResource" );
169 logoOrEl->SetAttribute (
"xlink:type",
"simple" );
170 logoOrEl->SetAttribute (
"xlink:href", logo->getHRef() );
171 logoEl->LinkEndChild ( logoOrEl );
173 el->LinkEndChild ( logoEl );
186 if (logo != NULL)
delete logo;
190 #endif // ATTRIBUTIONURL_H
Gestion des éléments d'attribution des documents de capacités.
Definition: AttributionURL.h:63
std::string getTmsXml()
Export XML pour le GetCapabilities TMS.
Definition: AttributionURL.h:140
TiXmlElement * getWmsXml()
Export XML pour le GetCapabilities WMS.
Definition: AttributionURL.h:153
AttributionURL(json11::Json doc)
Crée un AttributionURL à partir d'un élément JSON.
Definition: AttributionURL.h:96
static TiXmlElement * buildTextNode(std::string elementName, std::string value)
Definition: UtilsXML.h:60
virtual ~AttributionURL()
Destructeur par défaut.
Definition: AttributionURL.h:185