Skip to content

Commit

Permalink
Merge pull request #38349 from mhugent/wms_layer_visibility_checked
Browse files Browse the repository at this point in the history
WMS Server: display visibilityChecked property of a layer in GetProjectSettings
  • Loading branch information
mhugent committed Aug 19, 2020
2 parents ecdec26 + cfa719f commit c8082b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/server/services/wms/qgswmsgetcapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ namespace QgsWms
if ( projectSettings )
{
layerElem.setAttribute( QStringLiteral( "visible" ), treeNode->isVisible() );
layerElem.setAttribute( QStringLiteral( "visibilityChecked" ), treeNode->itemVisibilityChecked() );
layerElem.setAttribute( QStringLiteral( "expanded" ), treeNode->isExpanded() );
}

Expand Down
18 changes: 9 additions & 9 deletions tests/testdata/qgis_server/getprojectsettings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Content-Type: text/xml; charset=utf-8
<BoundingBox maxy="5606043.446" maxx="913283.462" miny="5605986.581" CRS="EPSG:3857" minx="913170.942"/>
<BoundingBox maxy="8.204165" maxx="44.901599" miny="8.203154" CRS="EPSG:4326" minx="44.901236"/>
<TreeName>QGIS Test Project</TreeName>
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>layer_with_short_name</Name>
<Title>A Layer with a short name</Title>
<Abstract>A Layer with an abstract</Abstract>
Expand Down Expand Up @@ -171,7 +171,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer queryable="1" visible="1" opacity="1" expanded="0">
<Layer queryable="1" visible="1" visibilityChecked="1" opacity="1" expanded="0">
<Name>landsat</Name>
<Title>landsat</Title>
<CRS>CRS:84</CRS>
Expand All @@ -195,7 +195,7 @@ Content-Type: text/xml; charset=utf-8
</Style>
<TreeName>landsat</TreeName>
</Layer>
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>testlayer èé</Name>
<Title>A test vector layer</Title>
<Abstract>A test vector layer with unicode òà</Abstract>
Expand Down Expand Up @@ -225,7 +225,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer geometryType="Point" queryable="1" displayField="alias_name" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="alias_name" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>fields_alias</Name>
<Title>A test vector layer</Title>
<Abstract>A test vector layer with unicode òà</Abstract>
Expand Down Expand Up @@ -255,7 +255,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>exclude_attribute</Name>
<Title>A test vector layer</Title>
<Abstract>A test vector layer with unicode òà</Abstract>
Expand Down Expand Up @@ -284,7 +284,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer mutuallyExclusive="0" visible="1" queryable="1" expanded="1">
<Layer mutuallyExclusive="0" visible="1" visibilityChecked="1" queryable="1" expanded="1">
<Name>group_name</Name>
<Title>Group title</Title>
<Abstract>Group abstract</Abstract>
Expand All @@ -300,7 +300,7 @@ Content-Type: text/xml; charset=utf-8
<BoundingBox maxy="5606025.239" maxx="913214.676" miny="5606011.456" CRS="EPSG:3857" minx="913204.911"/>
<BoundingBox maxy="8.203548" maxx="44.901483" miny="8.203459" CRS="EPSG:4326" minx="44.901394"/>
<TreeName>groupwithshortname</TreeName>
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>testlayer2</Name>
<Title>testlayer2</Title>
<CRS>CRS:84</CRS>
Expand Down Expand Up @@ -330,7 +330,7 @@ Content-Type: text/xml; charset=utf-8
</Attributes>
</Layer>
</Layer>
<Layer mutuallyExclusive="0" queryable="0" visible="1" expanded="1">
<Layer mutuallyExclusive="0" queryable="0" visible="1" visibilityChecked="1" expanded="1">
<Name>groupwithoutshortname</Name>
<Title>groupwithoutshortname</Title>
<CRS>CRS:84</CRS>
Expand All @@ -345,7 +345,7 @@ Content-Type: text/xml; charset=utf-8
<BoundingBox maxy="5606025.239" maxx="913214.676" miny="5606011.456" CRS="EPSG:3857" minx="913204.911"/>
<BoundingBox maxy="8.203548" maxx="44.901483" miny="8.203459" CRS="EPSG:4326" minx="44.901394"/>
<TreeName>groupwithoutshortname</TreeName>
<Layer geometryType="Point" queryable="0" displayField="name" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="0" displayField="name" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>testlayer3</Name>
<Title>testlayer3</Title>
<CRS>CRS:84</CRS>
Expand Down
18 changes: 9 additions & 9 deletions tests/testdata/qgis_server/getprojectsettings_opacity.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Content-Type: text/xml; charset=utf-8
<BoundingBox maxy="5606043.446" maxx="913283.462" miny="5605986.581" CRS="EPSG:3857" minx="913170.942"/>
<BoundingBox maxy="8.204165" maxx="44.901599" miny="8.203154" CRS="EPSG:4326" minx="44.901236"/>
<TreeName>QGIS Test Project</TreeName>
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>layer_with_short_name</Name>
<Title>A Layer with a short name</Title>
<Abstract>A Layer with an abstract</Abstract>
Expand Down Expand Up @@ -171,7 +171,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer queryable="1" visible="1" opacity="1" expanded="0">
<Layer queryable="1" visible="1" visibilityChecked="1" opacity="1" expanded="0">
<Name>landsat</Name>
<Title>landsat</Title>
<CRS>CRS:84</CRS>
Expand All @@ -195,7 +195,7 @@ Content-Type: text/xml; charset=utf-8
</Style>
<TreeName>landsat</TreeName>
</Layer>
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" opacity="0.5" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" visibilityChecked="1" opacity="0.5" expanded="1">
<Name>testlayer èé</Name>
<Title>A test vector layer</Title>
<Abstract>A test vector layer with unicode òà</Abstract>
Expand Down Expand Up @@ -225,7 +225,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer geometryType="Point" queryable="1" displayField="alias_name" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="alias_name" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>fields_alias</Name>
<Title>A test vector layer</Title>
<Abstract>A test vector layer with unicode òà</Abstract>
Expand Down Expand Up @@ -255,7 +255,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="name" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>exclude_attribute</Name>
<Title>A test vector layer</Title>
<Abstract>A test vector layer with unicode òà</Abstract>
Expand Down Expand Up @@ -284,7 +284,7 @@ Content-Type: text/xml; charset=utf-8
<Attribute precision="0" type="QString" editType="TextEdit" typeName="String" name="utf8nameè" comment="" length="13"/>
</Attributes>
</Layer>
<Layer mutuallyExclusive="0" visible="1" queryable="1" expanded="1">
<Layer mutuallyExclusive="0" visible="1" visibilityChecked="1" queryable="1" expanded="1">
<Name>group_name</Name>
<Title>Group title</Title>
<Abstract>Group abstract</Abstract>
Expand All @@ -300,7 +300,7 @@ Content-Type: text/xml; charset=utf-8
<BoundingBox maxy="5606025.239" maxx="913214.676" miny="5606011.456" CRS="EPSG:3857" minx="913204.911"/>
<BoundingBox maxy="8.203548" maxx="44.901483" miny="8.203459" CRS="EPSG:4326" minx="44.901394"/>
<TreeName>groupwithshortname</TreeName>
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" opacity="1" expanded="1">
<Layer geometryType="Point" queryable="1" displayField="id" visible="1" visibilityChecked="1" opacity="1" expanded="1">
<Name>testlayer2</Name>
<Title>testlayer2</Title>
<CRS>CRS:84</CRS>
Expand Down Expand Up @@ -330,7 +330,7 @@ Content-Type: text/xml; charset=utf-8
</Attributes>
</Layer>
</Layer>
<Layer mutuallyExclusive="0" queryable="0" visible="1" expanded="1">
<Layer mutuallyExclusive="0" queryable="0" visible="1" visibilityChecked="1" expanded="1">
<Name>groupwithoutshortname</Name>
<Title>groupwithoutshortname</Title>
<CRS>CRS:84</CRS>
Expand All @@ -345,7 +345,7 @@ Content-Type: text/xml; charset=utf-8
<BoundingBox maxy="5606025.239" maxx="913214.676" miny="5606011.456" CRS="EPSG:3857" minx="913204.911"/>
<BoundingBox maxy="8.203548" maxx="44.901483" miny="8.203459" CRS="EPSG:4326" minx="44.901394"/>
<TreeName>groupwithoutshortname</TreeName>
<Layer geometryType="Point" queryable="0" displayField="name" visible="1" opacity="0.8" expanded="1">
<Layer geometryType="Point" queryable="0" displayField="name" visible="1" visibilityChecked="1" opacity="0.8" expanded="1">
<Name>testlayer3</Name>
<Title>testlayer3</Title>
<CRS>CRS:84</CRS>
Expand Down

0 comments on commit c8082b9

Please sign in to comment.