Skip to content

Commit

Permalink
Merge pull request #19 from rscheitlin/Update_UI_to_Config
Browse files Browse the repository at this point in the history
Update map from settings
  • Loading branch information
rscheitlin committed Feb 4, 2015
2 parents e844ecd + d7a0483 commit cdb1926
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,25 @@ define([
}
},

_removeAllLayersExceptBasemap: function(){
for(var l = this.map.layerIds.length - 1; l>1; l--){
var lyr = this.map.getLayer(this.map.layerIds[l]);
if(lyr){
this.map.removeLayer(lyr);
}
}
var f = this.map.graphicsLayerIds.length;
while (f--){
var fl = this.map.getLayer(this.map.graphicsLayerIds[f]);
if(fl.declaredClass === 'esri.layers.FeatureLayer'){
this.map.removeLayer(fl);
}
}
},

startup: function () {
this._originalWebMap = this.map.webMapResponse.itemInfo.item.id;
this._removeAllLayersExceptBasemap();
if (this.config.useProxy) {
urlUtils.addProxyRule({
urlPrefix: this.config.proxyPrefix,
Expand Down
17 changes: 17 additions & 0 deletions setting/Setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,25 @@ define([
this._initLayersTable();
},

_removeAllLayersExceptBasemap: function(){
for(var l = this.map.layerIds.length - 1; l>1; l--){
var lyr = this.map.getLayer(this.map.layerIds[l]);
if(lyr){
this.map.removeLayer(lyr);
}
}
var f = this.map.graphicsLayerIds.length;
while (f--){
var fl = this.map.getLayer(this.map.graphicsLayerIds[f]);
if(fl.declaredClass === 'esri.layers.FeatureLayer'){
this.map.removeLayer(fl);
}
}
},

getConfig: function() {
this.config.layers.layer = this._getAllLayers();
this._removeAllLayersExceptBasemap();
console.info(this.config);
return this.config;
},
Expand Down

0 comments on commit cdb1926

Please sign in to comment.