Created
April 1, 2016 19:37
-
-
Save jugalpatel803/888f6e1bf7723336ea5a1db7fab8af29 to your computer and use it in GitHub Desktop.
Customize Layer List Widget for ArcGIS Web App Builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//begin grouping feature layers for rooms and labels | |
if (this.map.itemId) { | |
LayerInfos.getInstance(this.map, this.map.itemInfo) | |
.then(lang.hitch(this, function(operLayerInfos) { | |
this.operLayerInfos = operLayerInfos; | |
//create feature collections (groups) from feature layers | |
var firstFloorLabels = new esri.layers.FeatureLayer("http://services.arcgis.com/2DbqGRRQS9wbBetw/arcgis/rest/services/Pv03_Labels/FeatureServer/0"); | |
firstFloorLabels.setDefinitionExpression("floor='1'"); | |
firstFloorLabels.title = "1st Floor Labels"; | |
var firstFloorRooms = new esri.layers.FeatureLayer("http://services.arcgis.com/2DbqGRRQS9wbBetw/arcgis/rest/services/SM_prototype_2_1/FeatureServer/0"); | |
firstFloorRooms.setDefinitionExpression("floor_key='01'") | |
firstFloorRooms.title = "1st Floor Rooms"; | |
var firstFloorLayers = [firstFloorLabels, firstFloorRooms]; | |
this.operLayerInfos.addFeatureCollection(firstFloorLayers, "1st Floor"); | |
var secondFloorLabels = new esri.layers.FeatureLayer("http://services.arcgis.com/2DbqGRRQS9wbBetw/arcgis/rest/services/Pv03_Labels/FeatureServer/0"); | |
secondFloorLabels.setDefinitionExpression("floor='2'"); | |
secondFloorLabels.title = "2nd Floor Labels"; | |
var secondFloorRooms = new esri.layers.FeatureLayer("http://services.arcgis.com/2DbqGRRQS9wbBetw/arcgis/rest/services/SM_prototype_2_1/FeatureServer/0"); | |
secondFloorRooms.setDefinitionExpression("floor_key='02'") | |
secondFloorRooms.title = "2nd Floor Rooms"; | |
var secondFloorLayers = [secondFloorLabels, secondFloorRooms]; | |
this.operLayerInfos.addFeatureCollection(secondFloorLayers, "2nd Floor"); | |
var thirdFloorLabels = new esri.layers.FeatureLayer("http://services.arcgis.com/2DbqGRRQS9wbBetw/arcgis/rest/services/Pv03_Labels/FeatureServer/0"); | |
thirdFloorLabels.setDefinitionExpression("floor='3'"); | |
thirdFloorLabels.title = "3rd Floor Labels"; | |
var thirdFloorRooms = new esri.layers.FeatureLayer("http://services.arcgis.com/2DbqGRRQS9wbBetw/arcgis/rest/services/SM_prototype_2_1/FeatureServer/0"); | |
thirdFloorRooms.setDefinitionExpression("floor='3'"); | |
thirdFloorRooms.title = "3rd Floor Rooms"; | |
var thirdFloorLayers = [thirdFloorLabels, thirdFloorRooms]; | |
this.operLayerInfos.addFeatureCollection(thirdFloorLayers, "3rd Floor"); | |
//this.showLayers(); | |
//this.bindEvents(); | |
this.own(on(this.operLayerInfos, | |
'layerInfosChanged', | |
lang.hitch(this, this._onLayerInfosChanged))); | |
dom.setSelectable(this.layersSection, false); | |
})); | |
} else { | |
var itemInfo = this._obtainMapLayers(); | |
LayerInfos.getInstance(this.map, itemInfo) | |
.then(lang.hitch(this, function(operLayerInfos) { | |
this.operLayerInfos = operLayerInfos; | |
//this.showLayers(); | |
//this.bindEvents(); | |
this.own(on(this.operLayerInfos, | |
'layerInfosChanged', | |
lang.hitch(this, this._onLayerInfosChanged))); | |
dom.setSelectable(this.layersSection, false); | |
})); | |
} | |
// end of code to group layers | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment