-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElevationProfileTable.js
134 lines (102 loc) · 4.23 KB
/
ElevationProfileTable.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
'dijit/registry',
'dijit/layout/ContentPane',
'dojo/topic',
'esri/toolbars/draw',
'esri/symbols/SimpleLineSymbol',
'esri/symbols/CartographicLineSymbol',
'esri/graphic',
'esri/units',
'esri/dijit/ElevationProfile',
'esri/Color',
'dojo/dom',
'dojo/on',
'dojo/_base/lang',
'dojo/query',
'dojo/domReady!'
], function (declare, _WidgetBase, registry, ContentPane, topic, Draw,
SimpleLineSymbol, CartographicLineSymbol, Graphic, Units, ElevationProfile, Color, dom, on, lang, query
) {return declare([_WidgetBase], {
postCreate: function () {
this.inherited(arguments);
},
startup: function () {
this.inherited(arguments);
var tabsid = query(".attributesTabContainer")[0].id;
var tabs = registry.byId(tabsid);
var pane = new ContentPane({ title: "Elevation Table", content: '<div id="profileChartNode"></div>' });
tabs.addChild(pane);
tabs.selectChild(pane);
var map = this.map;
tb = new Draw(map);
var chartOptions = {
title: "Elevation Profile",
chartTitleFontSize: 14,
axisTitleFontSize: 11,
axisLabelFontSize: 9,
//indicatorFontColor: '#eee',
indicatorFontColor: '#000000',
indicatorFillColor: '#666',
//titleFontColor: '#eee',
titleFontColor: '#000000',
//axisFontColor: '#ccc',
axisFontColor: '#000000',
axisMajorTickColor: '#333',
skyTopColor: "#B0E0E6",
skyBottomColor: "#4682B4",
waterLineColor: "#eee",
waterTopColor: "#ADD8E6",
waterBottomColor: "#0000FF",
elevationLineColor: "#D2B48C",
elevationTopColor: "#8B4513",
elevationBottomColor: "#CD853F"
};
lineSymbol = new CartographicLineSymbol(
CartographicLineSymbol.STYLE_SOLID,
new Color([255, 0, 0]), 2,
CartographicLineSymbol.CAP_ROUND,
CartographicLineSymbol.JOIN_MITER, 2
);
var elevationProfile = new ElevationProfile({
map: map,
profileTaskUrl: "http://elevation.arcgis.com/arcgis/rest/services/Tools/ElevationSync/GPServer",
scalebarUnits: Units.MILES,
chartOptions: chartOptions
}, dom.byId("profileChartNode"));
elevationProfile.startup();
topic.subscribe("elevation/polylineclick", function () {
initToolbar(arguments[0]);
});
topic.subscribe("elevation/measureUnits", function () {
elevationProfile.set("measureUnits", arguments[0]);
});
topic.subscribe("elevation/deactivate", function () {
tb.deactivate();
map.graphics.clear();
elevationProfile.clearProfile();
});
function initToolbar(toolName) {
elevationProfile.clearProfile(); //Clear profile
map.graphics.clear();
tb.on("draw-end", addGraphic);
tb.activate(toolName);
map.disableMapNavigation();
}
function addGraphic(evt) {
//deactivate the toolbar and clear existing graphics
tb.deactivate();
map.enableMapNavigation();
var symbol = lineSymbol;
map.graphics.add(new Graphic(evt.geometry, symbol));
elevationProfile.set("profileGeometry", evt.geometry);
var sel = dom.byId("unitsSelect");
if (sel) {
var val = sel.options[sel.selectedIndex].value;
elevationProfile.set("measureUnits", val);
}
}
},
});
});