blob: b16cb6dac6021a8db55618f917d91d5fd50a20ac [file] [log] [blame]
Simon Huntef31fb22014-12-19 13:16:44 -08001/*
Simon Hunt8ead3a22015-01-06 11:00:15 -08002 * Copyright 2014,2015 Open Networking Laboratory
Simon Huntef31fb22014-12-19 13:16:44 -08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 ONOS GUI -- Topology View Module
Simon Huntef31fb22014-12-19 13:16:44 -080019 */
20
21(function () {
22 'use strict';
Simon Hunt6cc53692015-01-07 11:33:45 -080023
24 var moduleDependencies = [
Simon Hunt36a58c62015-04-08 11:00:07 -070025 'ngCookies',
Simon Hunt6cc53692015-01-07 11:33:45 -080026 'onosUtil',
Simon Hunt1e4a0012015-01-21 11:36:08 -080027 'onosSvg',
28 'onosRemote'
Simon Hunt6cc53692015-01-07 11:33:45 -080029 ];
30
31 // references to injected services etc.
Simon Huntc7ae7952015-04-08 18:59:27 -070032 var $log, $cookies, fs, ks, zs, gs, ms, sus, flash, wss, ps,
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -070033 tes, tfs, tps, tis, tss, tls, tts, tos, fltr, ttbs;
Simon Hunt6cc53692015-01-07 11:33:45 -080034
35 // DOM elements
Simon Hunt7c8ab8d2015-02-03 15:05:15 -080036 var ovtopo, svg, defs, zoomLayer, mapG, forceG, noDevsLayer;
Simon Hunt6cc53692015-01-07 11:33:45 -080037
38 // Internal state
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -070039 var zoomer, actionMap;
Simon Hunt6cc53692015-01-07 11:33:45 -080040
Simon Huntcacce342015-01-07 16:13:05 -080041 // --- Short Cut Keys ------------------------------------------------
42
Simon Hunt5724fb42015-02-05 16:59:40 -080043 function setUpKeys() {
44 // key bindings need to be made after the services have been injected
45 // thus, deferred to here...
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -070046 actionMap = {
Simon Hunt36a58c62015-04-08 11:00:07 -070047 I: [toggleInstances, 'Toggle ONOS instances panel'],
Simon Huntee7a3ce2015-04-09 13:28:37 -070048 O: [toggleSummary, 'Toggle ONOS summary panel'],
49 D: [toggleDetails, 'Disable / enable details panel'],
Simon Huntac4c6f72015-02-03 19:50:53 -080050
Simon Hunt5724fb42015-02-05 16:59:40 -080051 H: [tfs.toggleHosts, 'Toggle host visibility'],
52 M: [tfs.toggleOffline, 'Toggle offline visibility'],
Simon Hunt9e2104c2015-02-26 10:48:59 -080053 P: [tfs.togglePorts, 'Toggle Port Highlighting'],
Simon Hunt86b7c882015-04-02 23:06:08 -070054 dash: [tfs.showBadLinks, 'Show bad links'],
55 B: [toggleMap, 'Toggle background map'],
Simon Huntac4c6f72015-02-03 19:50:53 -080056
Simon Hunt5724fb42015-02-05 16:59:40 -080057 //X: [toggleNodeLock, 'Lock / unlock node positions'],
Simon Hunt96f88c62015-02-19 17:57:25 -080058 Z: [tos.toggleOblique, 'Toggle oblique view (Experimental)'],
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -070059 N: [fltr.clickAction, 'Cycle node layers'],
Simon Hunt5724fb42015-02-05 16:59:40 -080060 L: [tfs.cycleDeviceLabels, 'Cycle device labels'],
Simon Hunt445e8152015-02-06 13:00:12 -080061 U: [tfs.unpin, 'Unpin node (hover mouse over)'],
Simon Hunt5724fb42015-02-05 16:59:40 -080062 R: [resetZoom, 'Reset pan / zoom'],
Simon Hunt90dcc3e2015-03-25 15:01:27 -070063 dot: [ttbs.toggleToolbar, 'Toggle Toolbar'],
Simon Huntac4c6f72015-02-03 19:50:53 -080064
Simon Huntf542d842015-02-11 16:20:33 -080065 V: [tts.showRelatedIntentsAction, 'Show all related intents'],
66 rightArrow: [tts.showNextIntentAction, 'Show next related intent'],
67 leftArrow: [tts.showPrevIntentAction, 'Show previous related intent'],
68 W: [tts.showSelectedIntentTrafficAction, 'Monitor traffic of selected intent'],
69 A: [tts.showAllTrafficAction, 'Monitor all traffic'],
70 F: [tts.showDeviceLinkFlowsAction, 'Show device link flows'],
Simon Huntac4c6f72015-02-03 19:50:53 -080071
Simon Hunt0e48c292015-02-19 16:11:37 -080072 E: [equalizeMasters, 'Equalize mastership roles'],
Simon Huntac4c6f72015-02-03 19:50:53 -080073
Simon Hunt08f841d02015-02-10 14:39:20 -080074 esc: handleEscape,
Simon Huntac4c6f72015-02-03 19:50:53 -080075
Simon Hunt09060142015-03-18 20:23:32 -070076 _keyListener: ttbs.keyListener,
77
Simon Hunt5724fb42015-02-05 16:59:40 -080078 _helpFormat: [
Simon Hunt86b7c882015-04-02 23:06:08 -070079 ['I', 'O', 'D', '-', 'H', 'M', 'P', 'dash', 'B' ],
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -070080 ['X', 'Z', 'N', 'L', 'U', 'R', '-', 'dot'],
Simon Hunt5724fb42015-02-05 16:59:40 -080081 ['V', 'rightArrow', 'leftArrow', 'W', 'A', 'F', '-', 'E' ]
82 ]
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -070083 };
84
85 ks.keyBindings(actionMap);
Simon Huntac4c6f72015-02-03 19:50:53 -080086
Simon Hunt639dc662015-02-18 14:19:20 -080087 ks.gestureNotes([
Simon Hunt5724fb42015-02-05 16:59:40 -080088 ['click', 'Select the item and show details'],
89 ['shift-click', 'Toggle selection state'],
90 ['drag', 'Reposition (and pin) device / host'],
91 ['cmd-scroll', 'Zoom in / out'],
92 ['cmd-drag', 'Pan']
Simon Hunt639dc662015-02-18 14:19:20 -080093 ]);
Simon Hunt5724fb42015-02-05 16:59:40 -080094 }
Simon Hunt6cc53692015-01-07 11:33:45 -080095
Simon Hunt08f841d02015-02-10 14:39:20 -080096 // --- Keystroke functions -------------------------------------------
Simon Huntac4c6f72015-02-03 19:50:53 -080097
Simon Hunt36a58c62015-04-08 11:00:07 -070098 function toggleInstances(x) {
Simon Huntee7a3ce2015-04-09 13:28:37 -070099 updatePrefsState('insts', tis.toggle(x));
Simon Huntac4c6f72015-02-03 19:50:53 -0800100 tfs.updateDeviceColors();
Simon Hunt6cc53692015-01-07 11:33:45 -0800101 }
Simon Huntac4c6f72015-02-03 19:50:53 -0800102
Simon Huntee7a3ce2015-04-09 13:28:37 -0700103 function toggleSummary(x) {
104 updatePrefsState('summary', tps.toggleSummary(x));
Simon Hunt18bf9822015-02-12 17:35:45 -0800105 }
106
Simon Huntee7a3ce2015-04-09 13:28:37 -0700107 function toggleDetails(x) {
108 updatePrefsState('detail', tps.toggleDetails(x));
109 }
110
111 function toggleMap(x) {
112 var on = (x === 'keyev') ? !sus.visible(mapG) : !!x,
113 verb = on ? 'Show' : 'Hide';
114 sus.visible(mapG, on);
115 updatePrefsState('bg', on);
116 flash.flash(verb + ' background map');
117 }
Simon Hunt36a58c62015-04-08 11:00:07 -0700118
Simon Hunt08f841d02015-02-10 14:39:20 -0800119 function resetZoom() {
120 zoomer.reset();
121 }
122
Simon Hunt0e48c292015-02-19 16:11:37 -0800123 function equalizeMasters() {
Simon Hunt237676b52015-03-10 19:04:26 -0700124 wss.sendEvent('equalizeMasters');
Simon Hunt0e48c292015-02-19 16:11:37 -0800125 flash.flash('Equalizing master roles');
126 }
127
Simon Hunt08f841d02015-02-10 14:39:20 -0800128 function handleEscape() {
Simon Hunta142dd22015-02-12 22:07:51 -0800129 if (tis.showMaster()) {
130 // if an instance is selected, cancel the affinity mapping
131 tis.cancelAffinity()
Simon Hunt08f841d02015-02-10 14:39:20 -0800132
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700133 } else if (tss.deselectAll()) {
Simon Hunta0eb0a82015-02-11 12:30:06 -0800134 // else if we have node selections, deselect them all
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700135 // (work already done)
136
137 } else if (tls.deselectLink()) {
138 // else if we have a link selected, deselect it
139 // (work already done)
Simon Hunt08f841d02015-02-10 14:39:20 -0800140
Simon Hunta0eb0a82015-02-11 12:30:06 -0800141 } else if (tis.isVisible()) {
142 // else if the Instance Panel is visible, hide it
143 tis.hide();
144 tfs.updateDeviceColors();
Simon Hunt08f841d02015-02-10 14:39:20 -0800145
Simon Hunta0eb0a82015-02-11 12:30:06 -0800146 } else if (tps.summaryVisible()) {
147 // else if the Summary Panel is visible, hide it
148 tps.hideSummaryPanel();
Simon Hunt08f841d02015-02-10 14:39:20 -0800149
Simon Hunta0eb0a82015-02-11 12:30:06 -0800150 } else {
151 // TODO: set hover mode to hoverModeNone
Simon Hunt62c2f8f2015-02-19 14:19:10 -0800152 // talk to Thomas about this: shouldn't it be done
153 // when we deselect the node (if tss.haveDetails()...)
Simon Hunta0eb0a82015-02-11 12:30:06 -0800154 }
Simon Hunt08f841d02015-02-10 14:39:20 -0800155 }
Simon Huntcacce342015-01-07 16:13:05 -0800156
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700157 // --- Toolbar Functions ---------------------------------------------
158
159 function getActionEntry(key) {
160 var entry = actionMap[key];
161 return fs.isA(entry) || [entry, ''];
162 }
163
164 function setUpToolbar() {
165 ttbs.init({
166 getActionEntry: getActionEntry
167 });
168 ttbs.createToolbar();
169 }
170
Simon Huntcacce342015-01-07 16:13:05 -0800171 // --- Glyphs, Icons, and the like -----------------------------------
172
Simon Hunt6cc53692015-01-07 11:33:45 -0800173 function setUpDefs() {
Simon Huntcacce342015-01-07 16:13:05 -0800174 defs = svg.append('defs');
Simon Hunt6cc53692015-01-07 11:33:45 -0800175 gs.loadDefs(defs);
Simon Hunt0ee28682015-02-12 20:48:11 -0800176 sus.loadGlowDefs(defs);
Simon Hunt6cc53692015-01-07 11:33:45 -0800177 }
178
179
Simon Huntcacce342015-01-07 16:13:05 -0800180 // --- Pan and Zoom --------------------------------------------------
181
182 // zoom enabled predicate. ev is a D3 source event.
183 function zoomEnabled(ev) {
Simon Huntd552ee92015-04-02 17:06:35 -0700184 return fs.isMobile() || (ev.metaKey || ev.altKey);
Simon Huntcacce342015-01-07 16:13:05 -0800185 }
186
187 function zoomCallback() {
Simon Hunt5724fb42015-02-05 16:59:40 -0800188 var sc = zoomer.scale();
Simon Huntcacce342015-01-07 16:13:05 -0800189
Simon Hunt0541fb82015-01-14 18:59:57 -0800190 // keep the map lines constant width while zooming
Simon Hunt737c89f2015-01-28 12:23:19 -0800191 mapG.style('stroke-width', (2.0 / sc) + 'px');
Simon Huntcacce342015-01-07 16:13:05 -0800192 }
193
194 function setUpZoom() {
Simon Hunta7b6a6b2015-01-13 19:53:09 -0800195 zoomLayer = svg.append('g').attr('id', 'topo-zoomlayer');
Simon Huntcacce342015-01-07 16:13:05 -0800196 zoomer = zs.createZoomer({
197 svg: svg,
198 zoomLayer: zoomLayer,
199 zoomEnabled: zoomEnabled,
200 zoomCallback: zoomCallback
201 });
202 }
203
204
Simon Hunt0541fb82015-01-14 18:59:57 -0800205 // callback invoked when the SVG view has been resized..
Simon Hunt3a6eec02015-02-09 21:16:43 -0800206 function svgResized(s) {
207 tfs.newDim([s.width, s.height]);
Simon Hunt0541fb82015-01-14 18:59:57 -0800208 }
209
Simon Hunta7b6a6b2015-01-13 19:53:09 -0800210 // --- Background Map ------------------------------------------------
211
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800212 function setUpNoDevs() {
213 var g, box;
214 noDevsLayer = svg.append('g').attr({
215 id: 'topo-noDevsLayer',
216 transform: sus.translate(500,500)
217 });
218 // Note, SVG viewbox is '0 0 1000 1000', defined in topo.html.
219 // We are translating this layer to have its origin at the center
220
221 g = noDevsLayer.append('g');
222 gs.addGlyph(g, 'bird', 100).attr('class', 'noDevsBird');
223 g.append('text').text('No devices are connected')
224 .attr({ x: 120, y: 80});
225
226 box = g.node().getBBox();
227 box.x -= box.width/2;
228 box.y -= box.height/2;
229 g.attr('transform', sus.translate(box.x, box.y));
230
231 showNoDevs(true);
232 }
233
234 function showNoDevs(b) {
Simon Hunt18bf9822015-02-12 17:35:45 -0800235 sus.visible(noDevsLayer, b);
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800236 }
237
Simon Hunt0541fb82015-01-14 18:59:57 -0800238 function setUpMap() {
Simon Hunt737c89f2015-01-28 12:23:19 -0800239 mapG = zoomLayer.append('g').attr('id', 'topo-map');
Simon Huntac4c6f72015-02-03 19:50:53 -0800240 // returns a promise for the projection...
241 return ms.loadMapInto(mapG, '*continental_us');
Simon Hunt0541fb82015-01-14 18:59:57 -0800242 }
243
Simon Huntc3c5b672015-02-20 11:32:13 -0800244 function opacifyMap(b) {
245 mapG.transition()
246 .duration(1000)
247 .attr('opacity', b ? 1 : 0);
248 }
Simon Hunt737c89f2015-01-28 12:23:19 -0800249
Simon Hunt9c1c45e2015-04-10 13:38:27 -0700250 function addSprites() {
251 var g = zoomLayer.append ('g').attr('id', 'topo-sprites');
252
253 function cloud(g, x, y) {
254 g.append('use').attr({
255 width: 100,
256 height: 100,
257 'xlink:href': '#cloud',
258 transform: sus.translate([x, y]) + sus.scale(4,4)
259 }).style('stroke', 'goldenrod')
260 .style('fill', 'none')
261 .style('stroke-width', 1.0);
262 }
263
264 cloud(g, 0, 50);
265 cloud(g, 800, 40);
266 cloud(g, 400, 450);
267 }
268
Simon Huntc7ae7952015-04-08 18:59:27 -0700269 // --- User Preferemces ----------------------------------------------
Simon Hunt36a58c62015-04-08 11:00:07 -0700270
Simon Huntc7ae7952015-04-08 18:59:27 -0700271 var prefsState = {};
Simon Hunt36a58c62015-04-08 11:00:07 -0700272
Simon Huntc7ae7952015-04-08 18:59:27 -0700273 function updatePrefsState(what, b) {
274 prefsState[what] = b ? 1 : 0;
275 ps.setPrefs('topo_prefs', prefsState);
Simon Hunt36a58c62015-04-08 11:00:07 -0700276 }
277
Simon Hunt36a58c62015-04-08 11:00:07 -0700278
Simon Huntc7ae7952015-04-08 18:59:27 -0700279 function restoreConfigFromPrefs() {
280 // NOTE: toolbar will have set this for us..
281 prefsState = ps.getPrefs('topo_prefs');
Simon Hunt36a58c62015-04-08 11:00:07 -0700282
Simon Huntc7ae7952015-04-08 18:59:27 -0700283 $log.debug('TOPO---- Prefs State:', prefsState);
284
285 toggleInstances(prefsState.insts);
Simon Huntee7a3ce2015-04-09 13:28:37 -0700286 toggleSummary(prefsState.summary);
287 toggleDetails(prefsState.detail);
Simon Hunt36a58c62015-04-08 11:00:07 -0700288 }
289
290
Simon Huntcacce342015-01-07 16:13:05 -0800291 // --- Controller Definition -----------------------------------------
292
Simon Hunt6cc53692015-01-07 11:33:45 -0800293 angular.module('ovTopo', moduleDependencies)
Simon Hunt237676b52015-03-10 19:04:26 -0700294 .controller('OvTopoCtrl', ['$scope', '$log', '$location', '$timeout',
Simon Hunt36a58c62015-04-08 11:00:07 -0700295 '$cookies', 'FnService', 'MastService', 'KeyService', 'ZoomService',
Simon Hunt0e48c292015-02-19 16:11:37 -0800296 'GlyphService', 'MapService', 'SvgUtilService', 'FlashService',
Simon Huntc7ae7952015-04-08 18:59:27 -0700297 'WebSocketService', 'PrefsService',
Simon Huntb0ec1e52015-01-28 18:13:49 -0800298 'TopoEventService', 'TopoForceService', 'TopoPanelService',
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700299 'TopoInstService', 'TopoSelectService', 'TopoLinkService',
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -0700300 'TopoTrafficService', 'TopoObliqueService', 'TopoFilterService',
301 'TopoToolbarService',
Simon Hunt6cc53692015-01-07 11:33:45 -0800302
Simon Hunt36a58c62015-04-08 11:00:07 -0700303 function ($scope, _$log_, $loc, $timeout, _$cookies_, _fs_, mast, _ks_,
Simon Huntc7ae7952015-04-08 18:59:27 -0700304 _zs_, _gs_, _ms_, _sus_, _flash_, _wss_, _ps_, _tes_, _tfs_,
305 _tps_, _tis_, _tss_, _tls_, _tts_, _tos_, _fltr_, _ttbs_) {
Simon Huntac4c6f72015-02-03 19:50:53 -0800306 var self = this,
Simon Hunt1894d792015-02-04 17:09:20 -0800307 projection,
Simon Hunt3a6eec02015-02-09 21:16:43 -0800308 dim,
Simon Hunt1894d792015-02-04 17:09:20 -0800309 uplink = {
310 // provides function calls back into this space
311 showNoDevs: showNoDevs,
312 projection: function () { return projection; },
Simon Huntc3c5b672015-02-20 11:32:13 -0800313 zoomLayer: function () { return zoomLayer; },
Simon Huntfb8ea1f2015-02-24 21:38:09 -0800314 zoomer: function () { return zoomer; },
Simon Hunt237676b52015-03-10 19:04:26 -0700315 opacifyMap: opacifyMap
Simon Huntac4c6f72015-02-03 19:50:53 -0800316 };
317
Simon Hunt6cc53692015-01-07 11:33:45 -0800318 $log = _$log_;
Simon Hunt36a58c62015-04-08 11:00:07 -0700319 $cookies = _$cookies_;
Simon Hunta11b4eb2015-01-28 16:20:50 -0800320 fs = _fs_;
Simon Hunt6cc53692015-01-07 11:33:45 -0800321 ks = _ks_;
Simon Huntcacce342015-01-07 16:13:05 -0800322 zs = _zs_;
Simon Hunt6cc53692015-01-07 11:33:45 -0800323 gs = _gs_;
Simon Hunt1e8eff42015-01-08 17:19:02 -0800324 ms = _ms_;
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800325 sus = _sus_;
Simon Hunt0e48c292015-02-19 16:11:37 -0800326 flash = _flash_;
Simon Hunt237676b52015-03-10 19:04:26 -0700327 wss = _wss_;
Simon Huntc7ae7952015-04-08 18:59:27 -0700328 ps = _ps_;
Simon Huntc252aa62015-02-10 16:45:39 -0800329 tes = _tes_;
Simon Hunt737c89f2015-01-28 12:23:19 -0800330 tfs = _tfs_;
Simon Hunt96f88c62015-02-19 17:57:25 -0800331 // TODO: consider funnelling actions through TopoForceService...
332 // rather than injecting references to these 'sub-modules',
333 // just so we can invoke functions on them.
Simon Huntc252aa62015-02-10 16:45:39 -0800334 tps = _tps_;
Simon Huntac4c6f72015-02-03 19:50:53 -0800335 tis = _tis_;
Simon Hunt6036b192015-02-11 11:20:26 -0800336 tss = _tss_;
Simon Hunt0c6b2d32015-03-26 17:46:29 -0700337 tls = _tls_;
Simon Huntf542d842015-02-11 16:20:33 -0800338 tts = _tts_;
Simon Hunt96f88c62015-02-19 17:57:25 -0800339 tos = _tos_;
Bri Prebilic Coleb5f2b152015-04-07 14:58:09 -0700340 fltr = _fltr_;
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700341 ttbs = _ttbs_;
Simon Huntef31fb22014-12-19 13:16:44 -0800342
Simon Hunt426bd862015-01-14 16:48:41 -0800343 self.notifyResize = function () {
Simon Huntb0ec1e52015-01-28 18:13:49 -0800344 svgResized(fs.windowSize(mast.mastHeight()));
Simon Hunt426bd862015-01-14 16:48:41 -0800345 };
Simon Huntef31fb22014-12-19 13:16:44 -0800346
Simon Hunt54442fa2015-01-26 14:17:38 -0800347 // Cleanup on destroyed scope..
Simon Hunt584122a2015-01-21 15:32:40 -0800348 $scope.$on('$destroy', function () {
349 $log.log('OvTopoCtrl is saying Buh-Bye!');
Thomas Vachuska329af532015-03-10 02:08:33 -0700350 tes.stop();
Simon Hunt626d2102015-01-29 11:54:50 -0800351 tps.destroyPanels();
Simon Hunt4b668592015-01-29 17:33:53 -0800352 tis.destroyInst();
Simon Hunt3a6eec02015-02-09 21:16:43 -0800353 tfs.destroyForce();
Bri Prebilic Coled6219052015-03-19 14:34:02 -0700354 ttbs.destroyToolbar();
Simon Hunt584122a2015-01-21 15:32:40 -0800355 });
356
Simon Huntcacce342015-01-07 16:13:05 -0800357 // svg layer and initialization of components
Simon Hunt426bd862015-01-14 16:48:41 -0800358 ovtopo = d3.select('#ov-topo');
359 svg = ovtopo.select('svg');
Simon Hunta11b4eb2015-01-28 16:20:50 -0800360 // set the svg size to match that of the window, less the masthead
361 svg.attr(fs.windowSize(mast.mastHeight()));
Simon Hunt3a6eec02015-02-09 21:16:43 -0800362 dim = [svg.attr('width'), svg.attr('height')];
Simon Hunt426bd862015-01-14 16:48:41 -0800363
Simon Hunt6cc53692015-01-07 11:33:45 -0800364 setUpKeys();
Bri Prebilic Cole4db8dce2015-03-18 13:57:24 -0700365 setUpToolbar();
Simon Hunt6cc53692015-01-07 11:33:45 -0800366 setUpDefs();
Simon Huntcacce342015-01-07 16:13:05 -0800367 setUpZoom();
Simon Hunt7c8ab8d2015-02-03 15:05:15 -0800368 setUpNoDevs();
Simon Hunt1894d792015-02-04 17:09:20 -0800369 setUpMap().then(
370 function (proj) {
371 projection = proj;
372 $log.debug('** We installed the projection: ', proj);
Simon Huntc7ae7952015-04-08 18:59:27 -0700373 toggleMap(prefsState.bg);
Simon Hunt1894d792015-02-04 17:09:20 -0800374 }
375 );
Simon Hunt9c1c45e2015-04-10 13:38:27 -0700376 // addSprites();
Simon Huntfd1231a2015-01-26 22:14:51 -0800377
Simon Hunt1894d792015-02-04 17:09:20 -0800378 forceG = zoomLayer.append('g').attr('id', 'topo-force');
Simon Huntfb8ea1f2015-02-24 21:38:09 -0800379 tfs.initForce(svg, forceG, uplink, dim);
Simon Hunta142dd22015-02-12 22:07:51 -0800380 tis.initInst({ showMastership: tfs.showMastership });
Simon Hunt237676b52015-03-10 19:04:26 -0700381 tps.initPanels();
Thomas Vachuska329af532015-03-10 02:08:33 -0700382 tes.start();
Simon Hunt6cc53692015-01-07 11:33:45 -0800383
Simon Hunt36a58c62015-04-08 11:00:07 -0700384 // temporary solution for persisting user settings
Simon Huntc7ae7952015-04-08 18:59:27 -0700385 restoreConfigFromPrefs();
Simon Hunt36a58c62015-04-08 11:00:07 -0700386
Simon Hunt6cc53692015-01-07 11:33:45 -0800387 $log.log('OvTopoCtrl has been created');
Simon Huntef31fb22014-12-19 13:16:44 -0800388 }]);
389}());