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 );
QgsVectorLayerServerProperties(QgsVectorLayer *layer=nullptr)
Constructor - Creates a Vector Layer QGIS Server Properties.
Setting to define QGIS Server WMS Dimension.
Modify current selection to include only select features which match.
const QList< QgsVectorLayerServerProperties::WmsDimensionInfo > wmsDimensions() const
Returns the QGIS Server WMS Dimension list.
bool convertCompatible(QVariant &v) const
Converts the provided variant to a compatible format.
Container of fields for a vector layer.
Display all values of the dimension.
void writeXml(QDomNode &layer_node, QDomDocument &document) const
Saves server properties to xml under the layer node.
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
static QMap< int, QString > wmsDimensionDefaultDisplayLabels()
Returns WMS Dimension default display labels.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
bool removeWmsDimension(const QString &wmsDimName)
Removes a QGIS Server WMS Dimension.
void readXml(const QDomNode &layer_node)
Reads server properties from project file.
Encapsulate a field in an attribute table or data source.
Remove from current selection.
Add selection to current selection.
int indexOf(const QString &fieldName) const
Gets the field index from the field name.
bool addWmsDimension(const QgsVectorLayerServerProperties::WmsDimensionInfo &wmsDimInfo)
Adds a QGIS Server WMS Dimension.
Represents a vector layer which manages a vector based data sets.