Skip to content

Commit

Permalink
Merge pull request #39 from rscheitlin/master
Browse files Browse the repository at this point in the history
Changes for WAB 1.2
  • Loading branch information
rscheitlin committed Aug 31, 2015
2 parents 29392cf + 342d396 commit beeda4a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
30 changes: 9 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LocalLayerWidget 1.6
LocalLayerWidget 1.2
==

The LocalLayer Widget for ArcGIS Web AppBuilder is intended to allow the direct addition of ArcGIS for Server Mapservices to an ArcGIS Web AppBuilder application, without needing to wrap the desired services in an ArcGIS Online/Portal Web Map. The Legend, LayerList, and AttributeTable widgets should continue to work with your local layers.
Expand All @@ -7,7 +7,8 @@ The LocalLayer Widget for ArcGIS Web AppBuilder is intended to allow the direct

###Setting up the Widget

Please note that this is not an in-panel widget. To add it to your ArcGIS Web AppBuilder, add the widget to your \client\stemapp\widgets directory, and add a reference to the widget in the standard default2Dapp configuration located at \client\builder\predefined-apps\default2DApp\config.json for v1.0 and \client\stemapp\predefined-apps\default\config.json for v1.1, under the widgetOnScreen section.
Please note that this is not an in-panel widget. To add it to your ArcGIS Web AppBuilder, add the widget to your \client\stemapp\widgets directory, and add a reference to the widget in the standard default2Dapp configuration located at \client\stemapp\predefined-apps\default\config.json for v1.2, under the widgetOnScreen section.
If you plan to use the Local Layer widget with the other predfined apps like basic_viewer, editor, or simple_map_viewer then just repeat the above step in those folders.

```javascript
Example:
Expand All @@ -26,31 +27,18 @@ Example:

:bulb: Also, please note that the "/LocalLayer/" portion of the uri path above must match the folder name in which the widget resides on your local deployment.

:exclamation: IMPORTANT: Two minor changes will need to be made to your \client\stemapp\jimu.js\LayerInfos\LayerInfoForMapService.js file to make this tool operational.
For version 1.0 Line 433 should be changed from:
For version 1.1 Line 450 should be changed from:
:exclamation::exclamation: IMPORTANT: The changes that need to be made for WAB 1.2 to make this tool operational have changed. For new apps you only need to make this one change in the \client\stemapp\jimu.js\LayerInfos\LayerInfos.js. For existing/upgraded apps you only need to make this one change in the \server\apps\[App Number]\jimu.js\LayerInfos\LayerInfos.js
Change Line 439 from:
```
var url = this.originOperLayer.url + '/' + subId;
if (layer.url) {
```

To:
```
var url = this.originOperLayer.layerObject.url + '/' + subId;
if (layer.url && !layer.noservicename) {
```

for v1.0 And line 406 should be changed from:
for v1.1 And line 423 should be changed from:

```
var url = this.originOperLayer.url + '/layers';
```

To:
```
var url = this.originOperLayer.layerObject.url + '/layers';
```

:bulb: The default theme in WAB is the foldable theme so adding the Local Layer widget to the Tab theme involves another step.
:bulb: The default theme in WAB is the foldable theme so adding the Local Layer widget to the any of the other themes theme involves another step.

```
Example:
Expand All @@ -64,7 +52,7 @@ Example:
]
}
```
1. open the client\stemapp\themes\TabTheme\layouts\default\config.json in a text editor and add the code block above. This will take care of adding the Local Layer widget to default
1. open the client\stemapp\themes\[theme name]\layouts\default\config.json in a text editor and add the code block above. This will take care of adding the Local Layer widget to default

:bulb: If you would like labels to display on your Feature Services by default, make sure to add "showLabels":true under the mapOptions setting of your config.json file located under \client\stemapp\ (or at the root of your current app), in addition to checking the "Show Labels?" checkbox under the Feature Layer Settings Menu. Please note that there is currently an ESRI API bug preventing complex labelling expressions from being displayed on Feature Layers, such as expressions containing the CONCAT operator, and hopefully this will be addressed by esri in future releases.

Expand Down
28 changes: 20 additions & 8 deletions Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define([
'esri/urlUtils',
'dojo/_base/array',
'dojo/_base/query',
"dojo/_base/connect",
'dojo/topic',
'esri/layers/ArcGISDynamicMapServiceLayer',
'esri/layers/ArcGISTiledMapServiceLayer',
'esri/layers/FeatureLayer',
Expand All @@ -27,7 +27,7 @@ define([
urlUtils,
array,
query,
connect,
topic,
ArcGISDynamicMapServiceLayer,
ArcGISTiledMapServiceLayer,
FeatureLayer,
Expand All @@ -38,6 +38,7 @@ define([
esriBasemaps,
PopupTemplate) {
var clazz = declare([BaseWidget], {

constructor: function() {
this._originalWebMap = null;
},
Expand All @@ -46,11 +47,11 @@ define([
if (query('.jimu-popup.widget-setting-popup', window.parent.document).length === 0){
var _currentExtent = dojo.clone(this.map.extent);
var _changedData = {itemId:this._originalWebMap};
var _newBasemap = connect.subscribe("mapChanged", function(_map){
var _newBasemap = topic.subscribe("mapChanged", function(_map){
_newBasemap.remove();
_map.setExtent(_currentExtent);
});
MapManager.getInstance().onAppConfigChanged(ConfigManager.getConfig(),'mapChange', _changedData);
MapManager.getInstance().onAppConfigChanged(this.appConfig,'mapChange', _changedData);
}
},

Expand Down Expand Up @@ -98,16 +99,17 @@ define([
if(layer.imageformat){
var ip = new ImageParameters();
ip.format = layer.imageformat;
if(layer.hasOwnProperty('hidelayers')){
ip.layerIds = layer.hidelayers.split(',');
ip.layerOption = ImageParameters.LAYER_OPTION_HIDE;
}
if(layer.hasOwnProperty('imagedpi')){
ip.dpi = layer.imagedpi;
}
lOptions.imageParameters = ip;
}
lLayer = new ArcGISDynamicMapServiceLayer(layer.url, lOptions);
if(layer.name){
lLayer._titleForLegend = layer.name;
lLayer.title = layer.name;
lLayer.noservicename = true;
}
if (layer.popup){
var finalInfoTemp = {};
array.forEach(layer.popup.infoTemplates, function(_infoTemp){
Expand Down Expand Up @@ -176,6 +178,11 @@ define([
lOptions.showLabels = true;
}
lLayer = new FeatureLayer(layer.url, lOptions);
if(layer.name){
lLayer._titleForLegend = layer.name;
lLayer.title = layer.name;
lLayer.noservicename = true;
}
lLayer.on('load',function(evt){
evt.layer.name = lOptions.id;
});
Expand All @@ -188,6 +195,11 @@ define([
lOptions.refreshInterval = layer.autorefresh;
}
lLayer = new ArcGISTiledMapServiceLayer(layer.url, lOptions);
if(layer.name){
lLayer._titleForLegend = layer.name;
lLayer.title = layer.name;
lLayer.noservicename = true;
}
if (layer.popup){
var finalInfoTemp2 = {};
array.forEach(layer.popup.infoTemplates, function(_infoTemp){
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "LocalLayer",
"label": "Local Layer Widget",
"platform": "HTML",
"version": "1.6",
"wabVersion": "1.2",
"version": "1.2",
"wabVersion": "1.3",
"author": "Adam Drackley (adam.drackley@gmail.com) & Robert Scheitlin",
"description": "This widget is for adding local layer to Web AppBuilder",
"copyright": "",
Expand Down

0 comments on commit beeda4a

Please sign in to comment.