Skip to content

Commit

Permalink
add buildImageParameters helper to viewer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
btfou committed Sep 8, 2015
1 parent 9500fa8 commit e29610a
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions viewer/js/config/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,24 @@ define([
// url to your geometry server.
esriConfig.defaults.geometryService = new GeometryService('http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer');

//image parameters for dynamic services, set to png32 for higher quality exports.
var imageParameters = new ImageParameters();
imageParameters.format = 'png32';
// helper function returning ImageParameters for dynamic layers
// example:
// imageParameters: buildImageParameters({
// layerIds: [0],
// layerOption: 'show'
// })
function buildImageParameters(config) {
config = config || {};
var ip = new ImageParameters();
//image parameters for dynamic services, set to png32 for higher quality exports
ip.format = 'png32';
for (var key in config) {
if (config.hasOwnProperty(key)) {
ip[key] = config[key];
}
}
return ip;
}

return {
// used for debugging your app
Expand Down Expand Up @@ -108,7 +123,7 @@ define([
id: 'louisvillePubSafety',
opacity: 1.0,
visible: true,
imageParameters: imageParameters
imageParameters: buildImageParameters()
},
identifyLayerInfos: {
layerIds: [2, 4, 5, 8, 12, 21]
Expand All @@ -126,7 +141,7 @@ define([
id: 'DamageAssessment',
opacity: 1.0,
visible: true,
imageParameters: imageParameters
imageParameters: buildImageParameters()
},
legendLayerInfos: {
exclude: true
Expand Down

0 comments on commit e29610a

Please sign in to comment.