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;
136 if (
layer()->type() != Qgis::LayerType::Vector )
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 );
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.
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 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 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.