40 mMetadataUrls.clear();
45 QDomElement element = layer_node.namedItem( QStringLiteral(
"metadataUrls" ) ).toElement();
46 mMetadataUrls.clear();
47 const QDomNodeList el = element.elementsByTagName( QStringLiteral(
"metadataUrl" ) );
48 for (
int i = 0; i < el.size(); i++ )
50 element = el.at( i ).toElement();
52 oneUrl.
type = element.attribute( QStringLiteral(
"type" ) );
53 oneUrl.
format = element.attribute( QStringLiteral(
"format" ) );
54 oneUrl.
url = element.text();
61 QDomElement urls = document.createElement( QStringLiteral(
"metadataUrls" ) );
64 QDomElement urlElement = document.createElement( QStringLiteral(
"metadataUrl" ) );
65 urlElement.setAttribute( QStringLiteral(
"type" ), url.type );
66 urlElement.setAttribute( QStringLiteral(
"format" ), url.format );
67 urlElement.appendChild( document.createTextNode( url.url ) );
68 urls.appendChild( urlElement );
70 layer_node.appendChild( urls );
82 mWmsDimensions.clear();
87 mWmsDimensions = dimensions;
92 QMap<int, QString> labels;
104 if ( dim.name == wmsDimInfo.
name )
109 mWmsDimensions.append( wmsDimInfo );
115 for (
int i = 0; i < mWmsDimensions.size(); ++i )
117 if ( mWmsDimensions[ i ].name == wmsDimName )
119 mWmsDimensions.removeAt( i );
128 return mWmsDimensions;
141 const QDomNode wmsDimsNode = layer_node.namedItem( QStringLiteral(
"wmsDimensions" ) );
142 if ( wmsDimsNode.isNull() )
146 const QDomElement wmsDimsElem = wmsDimsNode.toElement();
147 const QDomNodeList wmsDimsList = wmsDimsElem.elementsByTagName( QStringLiteral(
"dimension" ) );
148 for (
int i = 0; i < wmsDimsList.size(); ++i )
150 const QDomElement dimElem = wmsDimsList.
at( i ).toElement();
151 const QString dimName = dimElem.attribute( QStringLiteral(
"name" ) );
152 const QString dimFieldName = dimElem.attribute( QStringLiteral(
"fieldName" ) );
154 const int dimFieldNameIndex = fields.
indexOf( dimFieldName );
155 if ( dimFieldNameIndex == -1 )
159 QVariant dimRefValue;
160 const int dimDefaultDisplayType = dimElem.attribute( QStringLiteral(
"defaultDisplayType" ) ).toInt();
163 const QString dimRefValueStr = dimElem.attribute( QStringLiteral(
"referenceValue" ) );
164 if ( !dimRefValueStr.isEmpty() )
166 const QgsField dimField = fields.
at( dimFieldNameIndex );
167 dimRefValue = QVariant( dimRefValueStr );
175 dimElem.attribute( QStringLiteral(
"endFieldName" ) ),
176 dimElem.attribute( QStringLiteral(
"units" ) ),
177 dimElem.attribute( QStringLiteral(
"unitSymbol" ) ),
178 dimDefaultDisplayType, dimRefValue );
182 mWmsDimensions.append( dim );
189 if ( ! mWmsDimensions.isEmpty() )
191 QDomElement wmsDimsElem = document.createElement( QStringLiteral(
"wmsDimensions" ) );
194 QDomElement dimElem = document.createElement( QStringLiteral(
"dimension" ) );
195 dimElem.setAttribute( QStringLiteral(
"name" ), dim.name );
196 dimElem.setAttribute( QStringLiteral(
"fieldName" ), dim.fieldName );
197 dimElem.setAttribute( QStringLiteral(
"endFieldName" ), dim.endFieldName );
198 dimElem.setAttribute( QStringLiteral(
"units" ), dim.units );
199 dimElem.setAttribute( QStringLiteral(
"unitSymbol" ), dim.unitSymbol );
200 dimElem.setAttribute( QStringLiteral(
"defaultDisplayType" ), dim.defaultDisplayType );
201 dimElem.setAttribute( QStringLiteral(
"referenceValue" ), dim.referenceValue.toString() );
202 wmsDimsElem.appendChild( dimElem );
204 layer_node.appendChild( wmsDimsElem );