Skip to content

Commit

Permalink
Merge pull request #104 from tmcgee/master
Browse files Browse the repository at this point in the history
New widgetLoader and 'config' directory.
  • Loading branch information
DavidSpriggs committed Jul 3, 2014
2 parents e15c4c7 + 2a2a886 commit 7d5b709
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 245 deletions.
3 changes: 3 additions & 0 deletions viewer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
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'
Expand Down
98 changes: 98 additions & 0 deletions viewer/js/config/basemaps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
define([
'esri/dijit/Basemap',
'esri/dijit/BasemapLayer',
'esri/layers/osm'
], function (Basemap, BasemapLayer, osm) {
return {
map: true,
//must be either 'agol' or 'custom'
mode: 'agol',
title: 'Basemaps',
// must match one of the basemap keys below
mapStartBasemap: 'streets',
//basemaps to show in menu. define in basemaps object below and reference by name here
// TODO Is this array necessary when the same keys are explicitly included/excluded below?
basemapsToShow: ['streets', 'satellite', 'hybrid', 'topo', 'lightGray', 'gray', 'national-geographic', 'osm', 'oceans'],

// define all valid custom basemaps here. Object of Basemap objects. For custom basemaps, the key name and basemap id must match.
basemaps: {

// agol basemaps
streets: {
title: 'Streets'
},
satellite: {
title: 'Satellite'
},
hybrid: {
title: 'Hybrid'
},
topo: {
title: 'Topo'
},
gray: {
title: 'Gray'
},
oceans: {
title: 'Oceans'
},
'national-geographic': {
title: 'Nat Geo'
},
osm: {
title: 'Open Street Map'
}

// examples of custom basemaps
/*
streets: {
title: 'Streets',
basemap: new Basemap({
id: 'streets',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer'
})]
})
},
satellite: {
title: 'Satellite',
basemap: new Basemap({
id: 'satellite',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
})]
})
},
hybrid: {
title: 'Hybrid',
basemap: new Basemap({
id: 'hybrid',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
}), new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer',
isReference: true,
displayLevels: [0, 1, 2, 3, 4, 5, 6, 7]
}), new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer',
isReference: true,
displayLevels: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
})]
})
},
lightGray: {
title: 'Light Gray Canvas',
basemap: new Basemap({
id: 'lightGray',
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer'
}), new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer',
isReference: true
})]
})
}
*/
}
};
});
18 changes: 18 additions & 0 deletions viewer/js/config/bookmarks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
define({
map: true,
editable: true,
bookmarks: [
{
extent: {
xmin: -15489130.48708616,
ymin: 398794.4860580916,
xmax: -5891085.7193757,
ymax: 8509680.431452557,
spatialReference: {
wkid: 102100
}
},
name: 'USA'
}
]
});
19 changes: 19 additions & 0 deletions viewer/js/config/find.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
define({
map: true,
queries: [
{
description: 'Find A Public Safety Location By Name',
url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [1,2,3,4,5,6,7],
searchFields: ['FDNAME, PDNAME', 'NAME', 'RESNAME'],
minChars: 2
},
{
description: 'Find Incident By Code/Description',
url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [15,17,18],
searchFields: ['FCODE','DESCRIPTION'],
minChars: 4
}
]
});
57 changes: 57 additions & 0 deletions viewer/js/config/identify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
define({
map: true,
mapClickMode: true,
identifyTolerance: 5,

// config object definition:
// {<layer id>:{
// <sub layer number>:{
// <pop-up definition, see link below>
// }
// },
// <layer id>:{
// <sub layer number>:{
// <pop-up definition, see link below>
// }
// }
// }

// for details on pop-up definition see: https://developers.arcgis.com/javascript/jshelp/intro_popuptemplate.html

identifies: {
louisvillePubSafety: {
2: {
title: 'Police Station',
fieldInfos: [{
fieldName: 'Name',
visible: true
}, {
fieldName: 'Address',
visible: true
}, {
fieldName: 'Type',
visible: true
}, {
fieldName: 'Police Function',
visible: true
}, {
fieldName: 'Last Update Date',
visible: true
}]
},
8: {
title: 'Traffic Camera',
description: '{Description} lasted updated: {Last Update Date}',
mediaInfos: [{
title: '',
caption: '',
type: 'image',
value: {
sourceURL: '{Location URL}',
linkURL: '{Location URL}'
}
}]
}
}
}
});
41 changes: 5 additions & 36 deletions viewer/js/viewer/config.js → viewer/js/config/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ define([
noLegend: false,
collapsed: false,
options: {
id: 'louisvillePubSaftey',
id: 'louisvillePubSafety',
opacity: 1.0,
visible: true
}
Expand Down Expand Up @@ -91,25 +91,15 @@ define([
id: 'identify',
type: 'invisible',
path: 'gis/dijit/Identify',
options: {
map: true,
mapClickMode: true,
identifyTolerance: 5
}
options: 'config/identify'
},
basemaps: {
include: true,
id: 'basemaps',
type: 'domNode',
path: 'gis/dijit/Basemaps',
srcNodeRef: 'basemapsDijit',
options: {
map: true,
mode: 'agol', //must be either 'agol' or 'custom'
title: 'Basemaps',
mapStartBasemap: null, //valid options for 'agol' mode: null, 'streets', 'satellite', 'hybrid', 'topo', 'gray', 'oceans', 'national-geographic', 'osm'
basemapsToShow: ['streets', 'satellite', 'hybrid', 'topo', 'gray', 'oceans', 'national-geographic', 'osm'] //basemaps to show in menu. If 'agol' mode use valid values from above, if 'custom' mode then define in basmaps dijit and refrenc by name here
}
options: 'config/basemaps'
},
scalebar: {
include: true,
Expand Down Expand Up @@ -209,10 +199,7 @@ define([
title: 'Bookmarks',
open: false,
position: 2,
options: {
map: true,
editable: true
}
options: 'config/bookmarks'
},
find: {
include: true,
Expand All @@ -222,25 +209,7 @@ define([
title: 'Find',
open: false,
position: 3,
options: {
map: true,
queries: [
{
description: 'Find A Public Safety Location By Name',
url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [1,2,3,4,5,6,7],
searchFields: ['FDNAME, PDNAME', 'NAME', 'RESNAME'],
minChars: 2
},
{
description: 'Find Incident By Code/Description',
url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
layerIds: [15,17,18],
searchFields: ['FCODE','DESCRIPTION'],
minChars: 4
}
]
}
options: 'config/find'
},
draw: {
include: true,
Expand Down
Loading

0 comments on commit 7d5b709

Please sign in to comment.