19#include "moc_qgsmaplayerserverproperties.cpp"
41 mMetadataUrls.clear();
46 QDomElement element = layer_node.namedItem( QStringLiteral(
"metadataUrls" ) ).toElement();
47 mMetadataUrls.clear();
48 const QDomNodeList el = element.elementsByTagName( QStringLiteral(
"metadataUrl" ) );
49 for (
int i = 0; i < el.size(); i++ )
51 element = el.at( i ).toElement();
53 oneUrl.
type = element.attribute( QStringLiteral(
"type" ) );
54 oneUrl.
format = element.attribute( QStringLiteral(
"format" ) );
55 oneUrl.
url = element.text();
62 QDomElement urls = document.createElement( QStringLiteral(
"metadataUrls" ) );
65 QDomElement urlElement = document.createElement( QStringLiteral(
"metadataUrl" ) );
66 urlElement.setAttribute( QStringLiteral(
"type" ), url.type );
67 urlElement.setAttribute( QStringLiteral(
"format" ), url.format );
68 urlElement.appendChild( document.createTextNode( url.url ) );
69 urls.appendChild( urlElement );
71 layer_node.appendChild( urls );
83 mWmsDimensions.clear();
88 mWmsDimensions = dimensions;
93 QMap<int, QString> labels;
105 if ( dim.name == wmsDimInfo.
name )
110 mWmsDimensions.append( wmsDimInfo );
116 for (
int i = 0; i < mWmsDimensions.size(); ++i )
118 if ( mWmsDimensions[ i ].name == wmsDimName )
120 mWmsDimensions.removeAt( i );
129 return mWmsDimensions;
142 const QDomNode wmsDimsNode = layer_node.namedItem( QStringLiteral(
"wmsDimensions" ) );
143 if ( wmsDimsNode.isNull() )
147 const QDomElement wmsDimsElem = wmsDimsNode.toElement();
148 const QDomNodeList wmsDimsList = wmsDimsElem.elementsByTagName( QStringLiteral(
"dimension" ) );
149 for (
int i = 0; i < wmsDimsList.size(); ++i )
151 const QDomElement dimElem = wmsDimsList.
at( i ).toElement();
152 const QString dimName = dimElem.attribute( QStringLiteral(
"name" ) );
153 const QString dimFieldName = dimElem.attribute( QStringLiteral(
"fieldName" ) );
155 const int dimFieldNameIndex = fields.
indexOf( dimFieldName );
156 if ( dimFieldNameIndex == -1 )
160 QVariant dimRefValue;
161 const int dimDefaultDisplayType = dimElem.attribute( QStringLiteral(
"defaultDisplayType" ) ).toInt();
164 const QString dimRefValueStr = dimElem.attribute( QStringLiteral(
"referenceValue" ) );
165 if ( !dimRefValueStr.isEmpty() )
167 const QgsField dimField = fields.
at( dimFieldNameIndex );
168 dimRefValue = QVariant( dimRefValueStr );
176 dimElem.attribute( QStringLiteral(
"endFieldName" ) ),
177 dimElem.attribute( QStringLiteral(
"units" ) ),
178 dimElem.attribute( QStringLiteral(
"unitSymbol" ) ),
179 dimDefaultDisplayType, dimRefValue );
183 mWmsDimensions.append( dim );
190 if ( ! mWmsDimensions.isEmpty() )
192 QDomElement wmsDimsElem = document.createElement( QStringLiteral(
"wmsDimensions" ) );
195 QDomElement dimElem = document.createElement( QStringLiteral(
"dimension" ) );
196 dimElem.setAttribute( QStringLiteral(
"name" ), dim.name );
197 dimElem.setAttribute( QStringLiteral(
"fieldName" ), dim.fieldName );
198 dimElem.setAttribute( QStringLiteral(
"endFieldName" ), dim.endFieldName );
199 dimElem.setAttribute( QStringLiteral(
"units" ), dim.units );
200 dimElem.setAttribute( QStringLiteral(
"unitSymbol" ), dim.unitSymbol );
201 dimElem.setAttribute( QStringLiteral(
"defaultDisplayType" ), dim.defaultDisplayType );
202 dimElem.setAttribute( QStringLiteral(
"referenceValue" ), dim.referenceValue.toString() );
203 wmsDimsElem.appendChild( dimElem );
205 layer_node.appendChild( wmsDimsElem );
246 const QDomElement shortNameElem = layer_node.firstChildElement( QStringLiteral(
"shortname" ) );
247 if ( !shortNameElem.isNull() )
249 mShortName = shortNameElem.text();
253 const QDomElement titleElem = layer_node.firstChildElement( QStringLiteral(
"title" ) );
254 if ( !titleElem.isNull() )
256 mTitle = titleElem.text();
257 mWfsTitle = titleElem.attribute( QStringLiteral(
"wfs" ) );
261 const QDomElement abstractElem = layer_node.firstChildElement( QStringLiteral(
"abstract" ) );
262 if ( !abstractElem.isNull() )
264 mAbstract = abstractElem.text();
268 const QDomElement keywordListElem = layer_node.firstChildElement( QStringLiteral(
"keywordList" ) );
269 if ( !keywordListElem.isNull() )
272 for ( QDomNode n = keywordListElem.firstChild(); !n.isNull(); n = n.nextSibling() )
274 kwdList << n.toElement().text();
276 mKeywordList = kwdList.join( QLatin1String(
", " ) );
280 const QDomElement dataUrlElem = layer_node.firstChildElement( QStringLiteral(
"dataUrl" ) );
281 if ( !dataUrlElem.isNull() )
283 mDataUrl = dataUrlElem.text();
284 mDataUrlFormat = dataUrlElem.attribute( QStringLiteral(
"format" ), QString() );
288 const QDomElement attribElem = layer_node.firstChildElement( QStringLiteral(
"attribution" ) );
289 if ( !attribElem.isNull() )
291 mAttribution = attribElem.text();
292 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 setLegendUrl(const QString &legendUrl)
Sets the URL for the layer's legend.
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 setLegendUrlFormat(const QString &legendUrlFormat)
Sets the format for a URL based layer legend.
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.