Skip to content

Commit

Permalink
MinScale and MaxScale options added for relevant layers. Tiled Layer …
Browse files Browse the repository at this point in the history
…displayLayers and webTileLayer subdomains are now comma delineated. Placeholder text added for some fields.
  • Loading branch information
unknown authored and unknown committed Nov 4, 2015
1 parent d6087ba commit 576093c
Show file tree
Hide file tree
Showing 14 changed files with 294 additions and 12 deletions.
47 changes: 46 additions & 1 deletion Widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ define([
if(layer.hasOwnProperty('hidelayers')){
lOptions.hidelayers = layer.hidelayers.split(',');
}
if(layer.hasOwnProperty('minScale')){
lOptions.minScale = layer.minScale
}
if(layer.hasOwnProperty('maxScale')){
lOptions.maxScale = layer.maxScale
}
if(layer.type.toUpperCase() === 'DYNAMIC'){
if(layer.imageformat){
var ip = new ImageParameters();
Expand Down Expand Up @@ -144,6 +150,13 @@ define([
lLayer.setDisableClientCaching(true);
}
lLayer.on('load',function(evt){
//set min/max scales if present
if(lOptions.minScale){
evt.layer.setMinScale(lOptions.minScale)
}
if(lOptions.maxScale){
evt.layer.setMaxScale(lOptions.maxScale)
}
var removeLayers = []
//set defaultvisibility for everything off by default
array.forEach(evt.layer.layerInfos,function(layer){
Expand Down Expand Up @@ -197,6 +210,13 @@ define([
}
lLayer = new WebTiledLayer(layer.url,lOptions)
lLayer.on('load',function(evt){
//set min/max scales if present
if(lOptions.minScale){
evt.layer.setMinScale(lOptions.minScale)
}
if(lOptions.maxScale){
evt.layer.setMaxScale(lOptions.maxScale)
}
evt.layer.name = lOptions.id;
});
this._viewerMap.addLayer(lLayer);
Expand Down Expand Up @@ -254,17 +274,33 @@ define([
lLayer.noservicename = true;
}
lLayer.on('load',function(evt){
//set min/max scales if present
if(lOptions.minScale){
evt.layer.setMinScale(lOptions.minScale)
}
if(lOptions.maxScale){
evt.layer.setMaxScale(lOptions.maxScale)
}
evt.layer.name = lOptions.id;
});
this._viewerMap.addLayer(lLayer);
}else if(layer.type.toUpperCase() === 'TILED'){
if(layer.displayLevels){
lOptions.displayLevels = layer.displayLevels;
lOptions.displayLevels = layer.displayLevels.split(',');
}
if(layer.hasOwnProperty('autorefresh')){
lOptions.refreshInterval = layer.autorefresh;
}
lLayer = new ArcGISTiledMapServiceLayer(layer.url, lOptions);
lLayer.on('load', function(evt){
//set min/max scales if present
if(lOptions.minScale){
evt.layer.setMinScale(lOptions.minScale)
}
if(lOptions.maxScale){
evt.layer.setMaxScale(lOptions.maxScale)
}
})
if(layer.name){
lLayer._titleForLegend = layer.name;
lLayer.title = layer.name;
Expand Down Expand Up @@ -413,6 +449,15 @@ define([
lLayer.noservicename = true;
lLayer.name = lOptions.id;
}
lLayer.on('load', function(evt){
//set min/max scales if present
if(lOptions.minScale){
evt.layer.setMinScale(lOptions.minScale)
}
if(lOptions.maxScale){
evt.layer.setMaxScale(lOptions.maxScale)
}
})
this._viewerMap.addLayer(lLayer);
}), lang.hitch(this, function(err){
console.log('error')
Expand Down
Binary file modified images/Thumbs.db
Binary file not shown.
38 changes: 38 additions & 0 deletions setting/DynamicLayerEdit.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,44 @@
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table style="width:100%;" cellspacing="0">
<tr>
<td style="width:50%;">
<table style="width:100%;" cellspacing="0">
<tbody>
<tr>
<td style="width:200px;text-align:left;">
<span>${nls.minScale}</span>
</td>
<td style="width:auto;">
<input type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-attach-point="minScale"
required="false" data-dojo-props='style:{width:"100%"}'/></input>
</td>
</tr>
</tbody>
</table>
</td>
<td style="width:50%;">
<table style="width:100%;" cellspacing="0">
<tbody>
<tr>
<td style="width:200px;text-align:left;">
<span>${nls.maxScale}</span>
</td>
<td style="width:auto;">
<input type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-attach-point="maxScale"
required="false" data-dojo-props='style:{width:"100%"}'/></input>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table style="width:100%;padding-top:8px;" cellspacing="0">
Expand Down
8 changes: 8 additions & 0 deletions setting/DynamicLayerEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ define(
if(config.imageformat){
this.imgFormat.set('value', config.imageformat);
}
if(config.hasOwnProperty('maxScale')){
this.maxScale.set('value', config.maxScale);
}
if(config.hasOwnProperty('minScale')){
this.minScale.set('value', config.minScale);
}
},

_bindEvents: function() {
Expand Down Expand Up @@ -234,6 +240,8 @@ define(
popup: this.config.popup,
imagedpi: this.imgDPI.get('value'),
disableclientcaching: this.disableClientCachingCbx.getValue(),
minScale: this.minScale.get('value'),
maxScale: this.maxScale.get('value'),
//hidelayers: allHiddenLayers.join()
hidelayers: visibleLayers.join()
};
Expand Down
38 changes: 38 additions & 0 deletions setting/FeatureLayerEdit.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,44 @@
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table style="width:100%;" cellspacing="0">
<tr>
<td style="width:50%;">
<table style="width:100%;" cellspacing="0">
<tbody>
<tr>
<td style="width:200px;text-align:left;">
<span>${nls.minScale}</span>
</td>
<td style="width:auto;">
<input type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-attach-point="minScale"
required="false" data-dojo-props='style:{width:"100%"}'/></input>
</td>
</tr>
</tbody>
</table>
</td>
<td style="width:50%;">
<table style="width:100%;" cellspacing="0">
<tbody>
<tr>
<td style="width:200px;text-align:left;">
<span>${nls.maxScale}</span>
</td>
<td style="width:auto;">
<input type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-attach-point="maxScale"
required="false" data-dojo-props='style:{width:"100%"}'/></input>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table style="width:100%;" cellspacing="0">
Expand Down
8 changes: 8 additions & 0 deletions setting/FeatureLayerEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ define(
if(config.hasOwnProperty('autorefresh')){
this.autoRefresh.set('value', config.autorefresh);
}
if(config.hasOwnProperty('maxScale')){
this.maxScale.set('value', config.maxScale);
}
if(config.hasOwnProperty('minScale')){
this.minScale.set('value', config.minScale);
}
if(config.showLabels === false){
this.showLabelsCbx.setValue(false)
}else{
Expand Down Expand Up @@ -167,6 +173,8 @@ define(
showLabels: this.showLabelsCbx.getValue(),
popup: this.config.popup,
autorefresh: this.autoRefresh.get('value'),
minScale: this.minScale.get('value'),
maxScale: this.maxScale.get('value'),
mode: this.flMode.get('value')
};
return [featurelayer, this.tr];
Expand Down
4 changes: 2 additions & 2 deletions setting/Setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ define([
_initLayersTable: function() {
this.LayersTable.clear();
var layers = this.config && this.config.layers.layer;
array.forEach(layers, lang.hitch(this, function(layerConfig, index) {
array.forEach(layers.reverse(), lang.hitch(this, function(layerConfig, index) {
var args = {
config: layerConfig,
layerindex: index
Expand Down Expand Up @@ -137,7 +137,7 @@ define([
var allLayers = array.map(trs, lang.hitch(this, function (item) {
return item.singleLayer;
}));
return allLayers;
return allLayers.reverse();
},

getNLSLayerType: function(type) {
Expand Down
40 changes: 39 additions & 1 deletion setting/TiledLayerEdit.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</td>
<td style="width:auto;padding-right:10px;">
<input type="text" data-dojo-type="dijit/form/TextBox" data-dojo-attach-point="displayLevels"
data-dojo-props='style:{width:"100%"}'/></input>
data-dojo-props='style:{width:"100%"},placeholder:"${nls.displayLevelsPlaceHolder}"'/></input>
</td>
</tr>
</tbody>
Expand All @@ -102,6 +102,44 @@
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table style="width:100%;" cellspacing="0">
<tr>
<td style="width:50%;">
<table style="width:100%;" cellspacing="0">
<tbody>
<tr>
<td style="width:200px;text-align:left;">
<span>${nls.minScale}</span>
</td>
<td style="width:auto;">
<input type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-attach-point="minScale"
required="false" data-dojo-props='style:{width:"100%"}'/></input>
</td>
</tr>
</tbody>
</table>
</td>
<td style="width:50%;">
<table style="width:100%;" cellspacing="0">
<tbody>
<tr>
<td style="width:200px;text-align:left;">
<span>${nls.maxScale}</span>
</td>
<td style="width:auto;">
<input type="text" data-dojo-type="dijit/form/ValidationTextBox" data-dojo-attach-point="maxScale"
required="false" data-dojo-props='style:{width:"100%"}'/></input>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<table style="width:100%;padding-top:8px;" cellspacing="0">
Expand Down
20 changes: 15 additions & 5 deletions setting/TiledLayerEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ define(
if(config.hasOwnProperty('autorefresh')){
this.autoRefresh.set('value', config.autorefresh);
}
if(config.hasOwnProperty('maxScale')){
this.maxScale.set('value', config.maxScale);
}
if(config.hasOwnProperty('minScale')){
this.minScale.set('value', config.minScale);
}
},

_bindEvents: function() {
Expand Down Expand Up @@ -198,18 +204,22 @@ define(
},

getConfig: function() {
var dls = [];
if(this.displayLevels.get('value') !== ''){
dls = this.displayLevels.get('value').split();
}
//var dls = [];
//if(this.displayLevels.get('value') !== ''){
//dls = this.displayLevels.get('value').split(',');

//}
var tiledlayer = {
type: 'Tiled',
name: this.layerTitle.get('value'),
url: this.layerUrl.get('value'),
opacity: this.layerAlpha.getAlpha(),
displayLevels: (dls.length > 0)?dls:null,
//displayLevels: (dls.length > 0)?dls:null,
displayLevels: this.displayLevels.get('value'),
autorefresh: this.autoRefresh.get('value'),
visible: this.isVisible.getValue(),
minScale: this.minScale.get('value'),
maxScale: this.maxScale.get('value'),
popup: this.config.popup
};
return [tiledlayer, this.tr];
Expand Down
Loading

0 comments on commit 576093c

Please sign in to comment.