Skip to content

Commit

Permalink
Added new layerIds option to layerControl configuration.
Browse files Browse the repository at this point in the history
This array determines which sublayer and folder controls are visible.
The visibility of the actual sublayers is not affected.

Also includes `layerIds` array in imageParameters to demonstrate how to
set the initial visibility of sublayers.
  • Loading branch information
tmcgee committed Nov 6, 2015
1 parent 711693a commit 5dacdd2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion viewer/js/config/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,17 @@ define([
id: 'louisvillePubSafety',
opacity: 1.0,
visible: true,
imageParameters: buildImageParameters()
imageParameters: buildImageParameters({
layerIds: [0, 2, 4, 5, 8, 10, 12, 21],
layerOption: 'show'
})
},
identifyLayerInfos: {
layerIds: [2, 4, 5, 8, 12, 21]
},
layerControlLayerInfos: {
layerIds: [0, 2, 4, 5, 8, 9, 10, 12, 21]
},
legendLayerInfos: {
layerInfo: {
hideLayers: [21]
Expand Down
4 changes: 4 additions & 0 deletions viewer/js/gis/dijit/LayerControl/controls/_DynamicFolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ define([
_expandClickHandler: null,
postCreate: function () {
this.inherited(arguments);
// Should the control be visible or hidden?
if (this.control.controlOptions.layerIds && this.control.controlOptions.layerIds.indexOf(this.sublayerInfo.id) < 0) {
domClass.add(this.domNode, 'layerControlHidden');
}
var checkNode = this.checkNode;
domAttr.set(checkNode, 'data-sublayer-id', this.sublayerInfo.id);
domClass.add(checkNode, this.control.layer.id + '-layerControlSublayerCheck');
Expand Down
4 changes: 4 additions & 0 deletions viewer/js/gis/dijit/LayerControl/controls/_DynamicSublayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ define([
_expandClickHandler: null,
postCreate: function () {
this.inherited(arguments);
// Should the control be visible or hidden?
if (this.control.controlOptions.layerIds && this.control.controlOptions.layerIds.indexOf(this.sublayerInfo.id) < 0) {
domClass.add(this.domNode, 'layerControlHidden');
}
var checkNode = this.checkNode;
domAttr.set(checkNode, 'data-sublayer-id', this.sublayerInfo.id);
domClass.add(checkNode, this.control.layer.id + '-layerControlSublayerCheck');
Expand Down
7 changes: 7 additions & 0 deletions viewer/js/gis/dijit/LayerControl/css/LayerControl.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
text-align: center;
}

.layerControlDijit .layerControlHidden {
display: none;
}
.layerControlDijit .layerControlVisible {
display: block;
}

.layerControlDijit .layerControlIndent {
padding-left: 22px;
}
Expand Down

0 comments on commit 5dacdd2

Please sign in to comment.