30 QMap<int, QString> labels;
42 if ( dim.name == wmsDimInfo.
name )
47 mWmsDimensions.append( wmsDimInfo );
53 for (
int i = 0; i < mWmsDimensions.size(); ++i )
55 if ( mWmsDimensions[ i ].name == wmsDimName )
57 mWmsDimensions.removeAt( i );
66 return mWmsDimensions;
73 const QDomNode wmsDimsNode = layer_node.namedItem( QStringLiteral(
"wmsDimensions" ) );
74 if ( !wmsDimsNode.isNull() )
76 const QDomElement wmsDimsElem = wmsDimsNode.toElement();
77 QDomNodeList wmsDimsList = wmsDimsElem.elementsByTagName( QStringLiteral(
"dimension" ) );
78 for (
int i = 0; i < wmsDimsList.size(); ++i )
80 QDomElement dimElem = wmsDimsList.
at( i ).toElement();
81 QString dimName = dimElem.attribute( QStringLiteral(
"name" ) );
82 QString dimFieldName = dimElem.attribute( QStringLiteral(
"fieldName" ) );
84 int dimFieldNameIndex = fields.
indexOf( dimFieldName );
85 if ( dimFieldNameIndex == -1 )
90 int dimDefaultDisplayType = dimElem.attribute( QStringLiteral(
"defaultDisplayType" ) ).toInt();
93 QString dimRefValueStr = dimElem.attribute( QStringLiteral(
"referenceValue" ) );
94 if ( !dimRefValueStr.isEmpty() )
96 QgsField dimField = fields.
at( dimFieldNameIndex );
97 dimRefValue = QVariant( dimRefValueStr );
105 dimElem.attribute( QStringLiteral(
"endFieldName" ) ),
106 dimElem.attribute( QStringLiteral(
"units" ) ),
107 dimElem.attribute( QStringLiteral(
"unitSymbol" ) ),
108 dimDefaultDisplayType, dimRefValue );
117 if ( mWmsDimensions.size() > 0 )
119 QDomElement wmsDimsElem = document.createElement( QStringLiteral(
"wmsDimensions" ) );
122 QDomElement dimElem = document.createElement( QStringLiteral(
"dimension" ) );
123 dimElem.setAttribute( QStringLiteral(
"name" ), dim.name );
124 dimElem.setAttribute( QStringLiteral(
"fieldName" ), dim.fieldName );
125 dimElem.setAttribute( QStringLiteral(
"endFieldName" ), dim.endFieldName );
126 dimElem.setAttribute( QStringLiteral(
"units" ), dim.units );
127 dimElem.setAttribute( QStringLiteral(
"unitSymbol" ), dim.unitSymbol );
128 dimElem.setAttribute( QStringLiteral(
"defaultDisplayType" ), dim.defaultDisplayType );
129 dimElem.setAttribute( QStringLiteral(
"referenceValue" ), dim.referenceValue.toString() );
130 wmsDimsElem.appendChild( dimElem );
132 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).
const QList< QgsVectorLayerServerProperties::WmsDimensionInfo > wmsDimensions() const
Returns the QGIS Server WMS Dimension list.
QgsVectorLayerServerProperties(QgsVectorLayer *layer=nullptr)
Constructor - Creates a Vector Layer QGIS Server Properties.
bool addWmsDimension(const QgsVectorLayerServerProperties::WmsDimensionInfo &wmsDimInfo)
Adds a QGIS Server WMS Dimension.
void readXml(const QDomNode &layer_node)
Reads server properties from project file.
static QMap< int, QString > wmsDimensionDefaultDisplayLabels()
Returns WMS Dimension default display labels.
bool removeWmsDimension(const QString &wmsDimName)
Removes a QGIS Server WMS Dimension.
void writeXml(QDomNode &layer_node, QDomDocument &document) const
Saves server properties to xml under the layer node.
Represents a vector layer which manages a vector based data sets.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
Setting to define QGIS Server WMS Dimension.
@ MaxValue
Modify current selection to include only select features which match.
@ AllValues
Display all values of the dimension.
@ ReferenceValue
Remove from current selection.
@ MinValue
Add selection to current selection.