Skip to content

Commit 9ce7361

Browse files
committedOct 19, 2017
Possibility to set a WMS print layer for WMS/WMTS layers in qgis server. This print layer is then advertized in the GetProjectSettings output
1 parent ac7e041 commit 9ce7361

File tree

3 files changed

+52
-16
lines changed

3 files changed

+52
-16
lines changed
 

‎src/app/qgsrasterlayerproperties.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,13 @@ void QgsRasterLayerProperties::sync()
786786
mLayerLegendUrlLineEdit->setText( mRasterLayer->legendUrl() );
787787
mLayerLegendUrlFormatComboBox->setCurrentIndex( mLayerLegendUrlFormatComboBox->findText( mRasterLayer->legendUrlFormat() ) );
788788

789+
//WMS print layer
790+
QVariant wmsPrintLayer = mRasterLayer->customProperty( QStringLiteral( "WMSPrintLayer" ) );
791+
if ( wmsPrintLayer.isValid() )
792+
{
793+
mWMSPrintLayerLineEdit->setText( wmsPrintLayer.toString() );
794+
}
795+
789796
/*
790797
* Legend Tab
791798
*/
@@ -1013,6 +1020,12 @@ void QgsRasterLayerProperties::apply()
10131020
mMetadataFilled = false;
10141021
mRasterLayer->setLegendUrlFormat( mLayerLegendUrlFormatComboBox->currentText() );
10151022

1023+
QString wmsPrintLayer = mWMSPrintLayerLineEdit->text();
1024+
if ( !wmsPrintLayer.isEmpty() )
1025+
{
1026+
mRasterLayer->setCustomProperty( QStringLiteral( "WMSPrintLayer" ), mWMSPrintLayerLineEdit->text() );
1027+
}
1028+
10161029
// update symbology
10171030
emit refreshLegend( mRasterLayer->id(), false );
10181031

‎src/server/services/wms/qgswmsgetcapabilities.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,6 +1692,17 @@ namespace QgsWms
16921692

16931693
layerElem.appendChild( attributesElem );
16941694
}
1695+
else if ( currentLayer->type() == QgsMapLayer::RasterLayer )
1696+
{
1697+
QVariant wmsPrintLayer = currentLayer->customProperty( QStringLiteral( "WMSPrintLayer" ) );
1698+
if ( wmsPrintLayer.isValid() )
1699+
{
1700+
QDomElement wmsPrintLayerElem = doc.createElement( "WMSPrintLayer" );
1701+
QDomText wmsPrintLayerText = doc.createTextNode( wmsPrintLayer.toString() );
1702+
wmsPrintLayerElem.appendChild( wmsPrintLayerText );
1703+
layerElem.appendChild( wmsPrintLayerElem );
1704+
}
1705+
}
16951706
}
16961707

16971708
}

‎src/ui/qgsrasterlayerpropertiesbase.ui

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>789</width>
10-
<height>593</height>
9+
<width>815</width>
10+
<height>777</height>
1111
</rect>
1212
</property>
1313
<property name="minimumSize">
@@ -236,7 +236,7 @@
236236
</sizepolicy>
237237
</property>
238238
<property name="currentIndex">
239-
<number>2</number>
239+
<number>9</number>
240240
</property>
241241
<widget class="QWidget" name="mOptsPage_Information">
242242
<layout class="QVBoxLayout" name="verticalLayout_20">
@@ -272,8 +272,8 @@
272272
<rect>
273273
<x>0</x>
274274
<y>0</y>
275-
<width>608</width>
276-
<height>527</height>
275+
<width>311</width>
276+
<height>106</height>
277277
</rect>
278278
</property>
279279
<layout class="QVBoxLayout" name="verticalLayout_7">
@@ -392,8 +392,8 @@ border-radius: 2px;</string>
392392
<rect>
393393
<x>0</x>
394394
<y>0</y>
395-
<width>545</width>
396-
<height>544</height>
395+
<width>562</width>
396+
<height>578</height>
397397
</rect>
398398
</property>
399399
<layout class="QVBoxLayout" name="verticalLayout_10">
@@ -1023,8 +1023,8 @@ border-radius: 2px;</string>
10231023
<rect>
10241024
<x>0</x>
10251025
<y>0</y>
1026-
<width>368</width>
1027-
<height>502</height>
1026+
<width>371</width>
1027+
<height>550</height>
10281028
</rect>
10291029
</property>
10301030
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -1476,8 +1476,8 @@ border-radius: 2px;</string>
14761476
<rect>
14771477
<x>0</x>
14781478
<y>0</y>
1479-
<width>617</width>
1480-
<height>199</height>
1479+
<width>642</width>
1480+
<height>206</height>
14811481
</rect>
14821482
</property>
14831483
<layout class="QVBoxLayout" name="verticalLayout_12">
@@ -1540,7 +1540,7 @@ border-radius: 2px;</string>
15401540
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
15411541
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
15421542
p, li { white-space: pre-wrap; }
1543-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'.SF NS Text'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
1543+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
15441544
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Cantarell'; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
15451545
</property>
15461546
</widget>
@@ -1646,8 +1646,8 @@ p, li { white-space: pre-wrap; }
16461646
<rect>
16471647
<x>0</x>
16481648
<y>0</y>
1649-
<width>85</width>
1650-
<height>31</height>
1649+
<width>100</width>
1650+
<height>30</height>
16511651
</rect>
16521652
</property>
16531653
<layout class="QVBoxLayout" name="verticalLayout_16">
@@ -1721,8 +1721,8 @@ p, li { white-space: pre-wrap; }
17211721
<rect>
17221722
<x>0</x>
17231723
<y>0</y>
1724-
<width>383</width>
1725-
<height>539</height>
1724+
<width>630</width>
1725+
<height>724</height>
17261726
</rect>
17271727
</property>
17281728
<layout class="QGridLayout" name="gridLayout_12">
@@ -2072,6 +2072,18 @@ p, li { white-space: pre-wrap; }
20722072
</widget>
20732073
</item>
20742074
<item row="4" column="0">
2075+
<widget class="QgsCollapsibleGroupBox" name="mWMSPrintGroupBox">
2076+
<property name="title">
2077+
<string>WMS Print layer</string>
2078+
</property>
2079+
<layout class="QGridLayout" name="gridLayout_4">
2080+
<item row="0" column="0">
2081+
<widget class="QLineEdit" name="mWMSPrintLayerLineEdit"/>
2082+
</item>
2083+
</layout>
2084+
</widget>
2085+
</item>
2086+
<item row="5" column="0">
20752087
<spacer name="verticalSpacer_4">
20762088
<property name="orientation">
20772089
<enum>Qt::Vertical</enum>

0 commit comments

Comments
 (0)
Please sign in to comment.