From 115ebf1524d789e55677c573691cecf4b697412b Mon Sep 17 00:00:00 2001 From: btfou Date: Tue, 1 Sep 2015 01:17:46 -0700 Subject: [PATCH] a little housekeeping --- Gruntfile.js | 1 + viewer/index.html | 29 +++++++++++------------ viewer/js/config/viewer.js | 47 +++++++++++++++++++++++--------------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 44ad2291d..ac8d86f17 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,3 +1,4 @@ +/* global module */ module.exports = function(grunt) { // middleware for grunt.connect diff --git a/viewer/index.html b/viewer/index.html index 8cbf2bdbb..927192f81 100644 --- a/viewer/index.html +++ b/viewer/index.html @@ -34,21 +34,6 @@ - @@ -62,7 +47,19 @@ file = 'config/' + file; } } - require(['viewer/Controller', file], function(Controller, config){ + require({ + async: true, + packages: [{ + name: 'viewer', + location: location.pathname.replace(/[^\/]+$/, '') + 'js/viewer' + },{ + name: 'config', + location: location.pathname.replace(/[^\/]+$/, '') + 'js/config' + },{ + name: 'gis', + location: location.pathname.replace(/[^\/]+$/, '') + 'js/gis' + }] + }, ['viewer/Controller', file], function(Controller, config){ Controller.startup(config); }); diff --git a/viewer/js/config/viewer.js b/viewer/js/config/viewer.js index 8067cb55e..ac0b9c7d4 100644 --- a/viewer/js/config/viewer.js +++ b/viewer/js/config/viewer.js @@ -1,20 +1,31 @@ define([ - 'esri/units', - 'esri/geometry/Extent', - 'esri/config', - 'esri/tasks/GeometryService', - 'esri/layers/ImageParameters' -], function (units, Extent, esriConfig, GeometryService, ImageParameters) { + 'dojo/_base/lang', + 'esri/units', + 'esri/geometry/Extent', + 'esri/config', + /*'esri/urlUtils',*/ + 'esri/tasks/GeometryService', + 'esri/layers/ImageParameters' +], function (lang, units, Extent, esriConfig, /*urlUtils,*/ GeometryService, ImageParameters) { - // url to your proxy page, must be on same machine hosting you app. See proxy folder for readme. + // esri config + esriConfig.defaults.geometryService = new GeometryService('https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer'); esriConfig.defaults.io.proxyUrl = 'proxy/proxy.ashx'; esriConfig.defaults.io.alwaysUseProxy = false; - // url to your geometry server. - esriConfig.defaults.geometryService = new GeometryService('http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer'); + // esriConfig.defaults.io.corsDetection = false; + // urlUtils.addProxyRule({ + // urlPrefix: 'geocode.arcgis.com', + // proxyUrl: 'proxy/proxy.ashx' + // }); - //image parameters for dynamic services, set to png32 for higher quality exports. - var imageParameters = new ImageParameters(); - imageParameters.format = 'png32'; + // additional functions, defines, etc you may need in config go here + function ipMix(params) { + return lang.mixin(new ImageParameters(), params); + } + + var imageParams = ipMix({ + format: 'png32' + }); return { // used for debugging your app @@ -80,7 +91,7 @@ define([ title: 'My layer' } } - }, { + }, { type: 'feature', url: 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0', title: 'San Francisco 311 Incidents', @@ -91,7 +102,7 @@ define([ outFields: ['req_type', 'req_date', 'req_time', 'address', 'district'], mode: 0 } - }, { + }, { type: 'dynamic', url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer', title: 'Louisville Public Safety', @@ -99,7 +110,7 @@ define([ id: 'louisvillePubSafety', opacity: 1.0, visible: true, - imageParameters: imageParameters + imageParameters: imageParams }, identifyLayerInfos: { layerIds: [2, 4, 5, 8, 12, 21] @@ -109,7 +120,7 @@ define([ hideLayers: [21] } } - }, { + }, { type: 'dynamic', url: 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/MapServer', title: 'Damage Assessment', @@ -117,7 +128,7 @@ define([ id: 'DamageAssessment', opacity: 1.0, visible: true, - imageParameters: imageParameters + imageParameters: imageParams }, legendLayerInfos: { exclude: true @@ -127,7 +138,7 @@ define([ metadataUrl: true, expanded: true } - }], + }], // set include:true to load. For titlePane type set position the the desired order in the sidebar widgets: { growler: {