-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathserver.R
222 lines (174 loc) · 7.17 KB
/
server.R
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
server <- function(input, output, session) {
source("config/global_variables.R", local = T)
source("config/server_variables.R", local = T)
source("config/static_variables.R", local = T)
source("functions/input.R", local = T)
source("functions/js_handling.R", local = T)
source("functions/init.R", local = T)
source("functions/reset.R", local = T)
source("functions/render.R", local = T)
source("functions/general.R", local = T)
source("functions/igraph/general.R", local = T)
source("functions/igraph/layout.R", local = T)
source("functions/igraph/cluster.R", local = T)
source("functions/igraph/topology.R", local = T)
source("functions/vr.R", local = T)
source("functions/edges.R", local = T)
# API GET file request ####
observeEvent(session$clientData$url_search, {
resolveAPI()
})
# START ####
initializeServerApp()
# ~Welcome ####
observeEvent(input$link_to_examples, {
updateNavbarPage(session, "navBar", selected = "Help")
}, ignoreInit = T)
observeEvent(input$link_to_fileInput, {
updateNavbarPage(session, "navBar", selected = "File")
}, ignoreInit = T)
# JS variables ####
observeEvent(input$js_direction_checkbox_flag, {
updateCheckboxInputFromJS(input$js_direction_checkbox_flag[1],
input$js_direction_checkbox_flag[2])
}, ignoreInit = T)
observeEvent(input$js_edgeByWeight_checkbox_flag, {
updateCheckboxInputFromJS(input$js_edgeByWeight_checkbox_flag[1],
input$js_edgeByWeight_checkbox_flag[2])
}, ignoreInit = T)
observeEvent(input$js_edgeFileColorPriority_checkbox_flag, {
updateCheckboxInputFromJS(input$js_edgeFileColorPriority_checkbox_flag[1],
input$js_edgeFileColorPriority_checkbox_flag[2])
}, ignoreInit = T)
observeEvent(input$js_channel_curvature_flag, {
toggleCurvatureInputsFromJS()
}, ignoreInit = T)
# FILE I/O ####
observeEvent(input$input_network_file, {
handleUploadNetwork()
}, ignoreInit = T)
observeEvent(input$load_network_file, {
handleLoadSession()
}, ignoreInit = T)
observeEvent(input$node_attributes_file, {
handleInputNodeAttributeFileUpload()
}, ignoreInit = T)
observeEvent(input$edge_attributes_file, {
handleInputEdgeAttributeFileUpload()
}, ignoreInit = T)
observeEvent(input$exampleButton, {
handleLoadExample()
}, ignoreInit = T)
observeEvent(input$loadExample_ok, {
handleLoadExampleAccept()
}, ignoreInit = T)
# LAYOUT ####
observeEvent(input$runLayout, {
handleLayout()
}, ignoreInit = T)
observeEvent(input$clusteringAlgorithmChoice, {
handleClusterAlgorithmSelection()
}, ignoreInit = T)
observeEvent(input$runTopologyScale, {
handleTopologyScaling()
}, ignoreInit = T)
# SCENE ####
observeEvent(input$toggleSceneCoords, {
callJSHandler("handler_toggleSceneCoords", input$toggleSceneCoords)
}, ignoreInit = T)
observeEvent(input$autoRotateScene, {
callJSHandler("handler_autoRotateScene", input$autoRotateScene)
}, ignoreInit = T)
observeEvent(input$predefined_layout, {
callJSHandler("handler_applyPredefinedLayout", input$predefined_layout)
}, ignoreInit = T)
# ~VR ####
observeEvent(input$vr_button, {
handleVRCall()
}, ignoreInit = T)
# LAYERS ####
observeEvent(input$selectAllLayersCheckbox, {
callJSHandler("handler_selectAllLayers", input$selectAllLayersCheckbox)
}, ignoreInit = T)
observeEvent(input$showLayerLabelsRadio, {
callJSHandler("handler_showLayerLabels", input$showLayerLabelsRadio)
}, ignoreInit = T)
observeEvent(input$resizeLayerLabels, {
callJSHandler("handler_resizeLayerLabels", input$resizeLayerLabels)
}, ignoreInit = T)
observeEvent(input$showLayerCoords, {
callJSHandler("handler_showLayerCoords", input$showLayerCoords)
}, ignoreInit = T)
observeEvent(input$showWireFrames, {
callJSHandler("handler_showWireFrames", input$showWireFrames)
}, ignoreInit = T)
observeEvent(input$layerColorPriorityRadio, {
callJSHandler("handler_setLayerColorPriority", input$layerColorPriorityRadio)
}, ignoreInit = T)
observeEvent(input$layerOpacity, {
callJSHandler("handler_floorOpacity", input$layerOpacity)
}, ignoreInit = T)
# NODES ####
observeEvent(input$showNodeLabelsRadio, {
callJSHandler("handler_showNodeLabels", input$showNodeLabelsRadio)
}, ignoreInit = T)
observeEvent(input$resizeNodeLabels, {
callJSHandler("handler_resizeNodeLabels", input$resizeNodeLabels)
}, ignoreInit = T)
observeEvent(input$selectAllNodes, {
callJSHandler("handler_selectAllNodes", input$selectAllNodes)
}, ignoreInit = T)
observeEvent(input$nodeGeometryRadio, {
callJSHandler("handler_setNodeShape", input$nodeGeometryRadio)
}, ignoreInit = T)
observeEvent(input$nodeColorPriorityRadio, {
callJSHandler("handler_setNodeColorPriority", input$nodeColorPriorityRadio)
}, ignoreInit = T)
observeEvent(input$nodeSelectedColorPriority, {
callJSHandler("handler_setNodeSelectedColorPriority", input$nodeSelectedColorPriority)
}, ignoreInit = T)
# EDGES ####
observeEvent(input$edgeSelectedColorPriority, {
callJSHandler("handler_setEdgeSelectedColorPriority", input$edgeSelectedColorPriority)
}, ignoreInit = T)
observeEvent(input$edgeFileColorPriority, {
callJSHandler("handler_setEdgeFileColorPriority", input$edgeFileColorPriority)
}, ignoreInit = T)
observeEvent(input$edgeWidthByWeight, {
handleEdgeWidthByWeightCheckbox()
}, ignoreInit = T)
observeEvent(input$edgeDirectionToggle, {
handleEdgeDirectionCheckbox()
}, ignoreInit = T)
observeEvent(input$interDirectionArrowSize, {
callJSHandler("handler_setInterDirectionArrowSize", input$interDirectionArrowSize)
}, ignoreInit = T)
observeEvent(input$intraDirectionArrowSize, {
callJSHandler("handler_setIntraDirectionArrowSize", input$intraDirectionArrowSize)
}, ignoreInit = T)
observeEvent(input$intraLayerEdgeOpacity, {
callJSHandler("handler_setIntraLayerEdgeOpacity", input$intraLayerEdgeOpacity)
}, ignoreInit = T)
observeEvent(input$interLayerEdgeOpacity, {
callJSHandler("handler_setInterLayerEdgeOpacity", input$interLayerEdgeOpacity)
}, ignoreInit = T)
observeEvent(input$intraChannelCurvature, {
callJSHandler("handler_toggleIntraChannelCurvature", input$intraChannelCurvature)
}, ignoreInit = T)
observeEvent(input$interChannelCurvature, {
callJSHandler("handler_toggleInterChannelCurvature", input$interChannelCurvature)
}, ignoreInit = T)
observeEvent(input$js_selectedEdges, {
updateSelectedEdgesView(jsonlite::fromJSON(input$js_selectedEdges))
}, ignoreInit = T)
# FPS ####
observeEvent(input$fps, {
callJSHandler("handler_fps", input$fps)
}, ignoreInit = T)
# ~Hide buttons ####
lapply(HIDE_BUTTONS, function(buttonId) {
observeEvent(input[[buttonId]], {
updateNavbarPage(session, "navBar", selected = "Main View")
}, ignoreInit = T)
})
}