Skip to content

Commit

Permalink
Merge pull request #460 from cmv/btfou-updates-1
Browse files Browse the repository at this point in the history
updates
  • Loading branch information
tmcgee committed Sep 9, 2015
2 parents 4abc00d + b39680f commit e48424a
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 46 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global module */
module.exports = function(grunt) {

// middleware for grunt.connect
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ There are many ways to contribute to CMV:

2. __Create documentation__ Please contribute to the [cmv documentation repo](https://github.com/cmv/cmv-docs).

3. __Answer Questions at Stack Exchange__ - [gis.stackexchange.com](https://gis.stackexchange.com/tag/cmv) is the prime destination for our Frequently Asked Questions (FAQs). Please answer questions and help new developers get more comfortable with CMV.
3. __Answer Questions at Stack Exchange__ - [gis.stackexchange.com](https://gis.stackexchange.com/tags/cmv) is the prime destination for our Frequently Asked Questions (FAQs). Please answer questions and help new developers get more comfortable with CMV.

4. __Join the Chat Room__ - Lots of us in CMV community hang out in the chat room on [Gitter](https://gitter.im/cmv/cmv-app/). Feel free to hangout with us, answer questions and throw out ideas.

Expand Down
33 changes: 3 additions & 30 deletions viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>Configurable Map Viewer</title>
<link rel="stylesheet" type="text/css" href="//js.arcgis.com/3.14compact/esri/css/esri.css">
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/theme/dbootstrap/dbootstrap.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
Expand All @@ -34,37 +34,10 @@
</div>
</div>
</div>
<script type="text/javascript">
var dojoConfig = {
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'
}]
};
</script>
<!--[if lt IE 9]>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/es5-shim/4.0.3/es5-shim.min.js"></script>
<![endif]-->
<script type="text/javascript" src="//js.arcgis.com/3.14compact/"></script>
<script type="text/javascript">
// get the config file from the url if present
var file = 'config/viewer', s = window.location.search, q = s.match(/config=([^&]*)/i);
if (q && q.length > 0) {
file = q[1];
if(file.indexOf('/') < 0) {
file = 'config/' + file;
}
}
require(['viewer/Controller', file], function(Controller, config){
Controller.startup(config);
});
</script>
<script src="//js.arcgis.com/3.14compact/"></script>
<script src="js/config/app.js"></script>
</body>
</html>
32 changes: 32 additions & 0 deletions viewer/js/config/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(function () {

// globel dojoConfig is required for async loading of gmaps api
window.dojoConfig = {
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'
}]
};

// get the config file from the url if present
var file = 'config/viewer',
s = window.location.search,
q = s.match(/config=([^&]*)/i);
if (q && q.length > 0) {
file = q[1];
if (file.indexOf('/') < 0) {
file = 'config/' + file;
}
}

require(window.dojoConfig, ['viewer/Controller', file, 'dojo/domReady!'], function (Controller, config) {
Controller.startup(config);
});
})();
54 changes: 39 additions & 15 deletions viewer/js/config/viewer.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
define([
'esri/units',
'esri/geometry/Extent',
'esri/config',
'esri/tasks/GeometryService',
'esri/layers/ImageParameters'
], function (units, Extent, esriConfig, GeometryService, ImageParameters) {
'esri/units',
'esri/geometry/Extent',
'esri/config',
/*'esri/urlUtils',*/
'esri/tasks/GeometryService',
'esri/layers/ImageParameters'
], function (units, Extent, esriConfig, /*urlUtils,*/ GeometryService, ImageParameters) {

// url to your proxy page, must be on same machine hosting you app. See proxy folder for readme.
esriConfig.defaults.io.proxyUrl = 'proxy/proxy.ashx';
esriConfig.defaults.io.alwaysUseProxy = false;

// add a proxy rule to force specific domain requests through proxy
// be sure the domain is added in proxy.config
/*urlUtils.addProxyRule({
urlPrefix: 'www.example.com',
proxyUrl: 'proxy/proxy.ashx'
});*/

// 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 @@ -80,7 +104,7 @@ define([
title: 'My layer'
}
}
}, {
}, {
type: 'feature',
url: 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0',
title: 'San Francisco 311 Incidents',
Expand All @@ -91,15 +115,15 @@ 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',
options: {
id: 'louisvillePubSafety',
opacity: 1.0,
visible: true,
imageParameters: imageParameters
imageParameters: buildImageParameters()
},
identifyLayerInfos: {
layerIds: [2, 4, 5, 8, 12, 21]
Expand All @@ -109,15 +133,15 @@ define([
hideLayers: [21]
}
}
}, {
}, {
type: 'dynamic',
url: 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/DamageAssessment/MapServer',
title: 'Damage Assessment',
options: {
id: 'DamageAssessment',
opacity: 1.0,
visible: true,
imageParameters: imageParameters
imageParameters: buildImageParameters()
},
legendLayerInfos: {
exclude: true
Expand All @@ -127,7 +151,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: {
Expand Down

0 comments on commit e48424a

Please sign in to comment.