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 );
243 const QDomElement shortNameElem = layer_node.firstChildElement( QStringLiteral(
"shortname" ) );
244 if ( !shortNameElem.isNull() )
246 mShortName = shortNameElem.text();
250 const QDomElement titleElem = layer_node.firstChildElement( QStringLiteral(
"title" ) );
251 if ( !titleElem.isNull() )
253 mTitle = titleElem.text();
254 mWfsTitle = titleElem.attribute( QStringLiteral(
"wfs" ) );
258 const QDomElement abstractElem = layer_node.firstChildElement( QStringLiteral(
"abstract" ) );
259 if ( !abstractElem.isNull() )
261 mAbstract = abstractElem.text();
265 const QDomElement keywordListElem = layer_node.firstChildElement( QStringLiteral(
"keywordList" ) );
266 if ( !keywordListElem.isNull() )
269 for ( QDomNode n = keywordListElem.firstChild(); !n.isNull(); n = n.nextSibling() )
271 kwdList << n.toElement().text();
273 mKeywordList = kwdList.join( QLatin1String(
", " ) );
277 const QDomElement dataUrlElem = layer_node.firstChildElement( QStringLiteral(
"dataUrl" ) );
278 if ( !dataUrlElem.isNull() )
280 mDataUrl = dataUrlElem.text();
281 mDataUrlFormat = dataUrlElem.attribute( QStringLiteral(
"format" ), QString() );
285 const QDomElement attribElem = layer_node.firstChildElement( QStringLiteral(
"attribution" ) );
286 if ( !attribElem.isNull() )
288 mAttribution = attribElem.text();
289 mAttributionUrl = attribElem.attribute( QStringLiteral(
"href" ), QString() );
Encapsulate a field in an attribute table or data source.
bool convertCompatible(QVariant &v, QString *errorMessage=nullptr) const
Converts the provided variant to a compatible format.
Container of fields for a vector layer.
Q_INVOKABLE int indexOf(const QString &fieldName) const
Gets the field index from the field name.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
Manages QGIS Server properties for a map layer.
void readXml(const QDomNode &layer_node)
Reads server properties from project file.
void setDataUrl(const QString &dataUrl)
Sets the DataUrl of the layer used by QGIS Server in GetCapabilities request.
void setAbstract(const QString &abstract)
Sets the abstract of the layer used by QGIS Server in GetCapabilities request.
void setDataUrlFormat(const QString &dataUrlFormat)
Sets the DataUrl format of the layerused by QGIS Server in GetCapabilities request.
void setAttributionUrl(const QString &url)
Sets the attribution url of the layer used by QGIS Server in GetCapabilities request.
void setAttribution(const QString &attrib)
Sets the attribution of the layer used by QGIS Server in GetCapabilities request.
void setShortName(const QString &name)
Sets the short name of the layer used by QGIS Server to identify the layer.
void copyTo(QgsMapLayerServerProperties *properties) const
Copy properties to another instance.
QgsMapLayerServerProperties(QgsMapLayer *layer=nullptr)
Constructor - Creates a Map Layer QGIS Server Properties.
void writeXml(QDomNode &layer_node, QDomDocument &document) const
Saves server properties to xml under the layer node.
void setTitle(const QString &title)
Sets the title of the layer used by QGIS Server in GetCapabilities request.
void setKeywordList(const QString &keywords)
Sets the keywords list of the layerused by QGIS Server in GetCapabilities request.
void reset()
Reset properties to default.
Base class for all map layer types.
Manages QGIS Server properties for Wms dimensions.
void readXml(const QDomNode &layer_node)
Reads server properties from project file.
static QMap< int, QString > wmsDimensionDefaultDisplayLabels()
Returns WMS Dimension default display labels.
void writeXml(QDomNode &layer_node, QDomDocument &document) const
Saves server properties to xml under the layer node.
void reset()
Reset properties to default.
bool addWmsDimension(const QgsServerWmsDimensionProperties::WmsDimensionInfo &wmsDimInfo)
Adds a QGIS Server WMS Dimension.
void copyTo(QgsServerWmsDimensionProperties *properties) const
Copy properties to another instance.
bool removeWmsDimension(const QString &wmsDimName)
Removes a QGIS Server WMS Dimension.
const QList< QgsServerWmsDimensionProperties::WmsDimensionInfo > wmsDimensions() const
Returns the QGIS Server WMS Dimension list.
void setWmsDimensions(const QList< QgsServerWmsDimensionProperties::WmsDimensionInfo > &dimensions)
Set WMS Dimensions.
Represents a vector layer which manages a vector based data sets.
Setting to define QGIS Server WMS Dimension.
@ MinValue
Add selection to current selection.
@ MaxValue
Modify current selection to include only select features which match.
@ AllValues
Display all values of the dimension.
@ ReferenceValue
Remove from current selection.