-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathui.R
199 lines (183 loc) · 10.5 KB
/
ui.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
########################
##setup user interface##
##StaMPS-Visualizer ##
########################
library(leaflet)
library(shinydashboard)
library(shinycssloaders)
library(shinyalert)
# prepare UI
shinyUI(fluidPage(
# load custom css stylesheet
includeCSS("www/style.css"),
# use shiny alert for messages
useShinyalert(),
# load dashboard page layout
dashboardPage(
skin = "blue",
dashboardHeader(title="StaMPS-Visualizer 3.0", titleWidth = 200),
dashboardSidebar(width = 200,
sidebarMenu(HTML(paste0(
"<br>",
"<a href='https://github.com/thho/StaMPS_Visualizer' target='_blank'><img style = 'display: block; margin-left: auto; margin-right: auto;' src='stamps-visualizer.png' width = '100'></a>",
"<br>",
"<p style = 'text-align: center;'><small><a href='https://github.com/thho/StaMPS_Visualizer' target='_blank'>3.0</a></small></p>",
"<table style='margin-left:auto; margin-right:auto;'>",
"<tr>",
"<td style='padding: 5px;'><a href='https://www.researchgate.net/publication/327939547_Analysing_the_Capabilities_and_Limitations_of_InSAR_using_Sentinel-1_Data_for_Landslide_Detection_and_Monitoring' target='_blank'><i class='fab fa-researchgate fa-lg'></i></a></td>",
"<td style='padding: 5px;'><a href='https://github.com/thho/StaMPS_Visualizer/blob/master/LICENSE.md' target='_blank'><i class='fab fa-creative-commons-by fa-lg'></i></a></td>",
"<td style='padding: 5px;'><a href='https://github.com/thho/StaMPS_Visualizer' target='_blank'><i class='fab fa-github fa-lg'></i></a></td>",
"</tr>",
"</table>",
"<br>")),
menuItem("Visualizer", tabName = "vismap", icon = icon("map marked alt")),
#menuItem("TS Explorer", tabName = "tsexp", icon = icon("chart-line")),
menuItem("Baseline Plot", tabName = "blplot", icon = icon("project-diagram")),
#menuItem("Data Manager", tabName = "datman", icon = icon("folder-open")),
#menuItem("Explanation", tabName = "expl", icon = icon("comment")),
menuItem("Settings", tabName = "settings", icon = icon("sliders-h")),
menuItem("Manual", tabName = "manual", icon = icon("book-open")),
#menuItem("Literature", tabName = "lit", icon = icon("book")),
menuItem("Cite", tabName = "cite", icon = icon("graduation-cap"))
)# end dashboard Meu
),# end dashboard sidebar
# begin dashboard body
dashboardBody(
tabItems(
# begin visualizer map tab item
tabItem(tabName = "vismap",
# map with PS time series tools
leafletOutput("map") %>% withSpinner(color = "#2a84b5"),
# begin container box for toggle controls action button
fixedPanel(id = "cbox", class = "panel pael-default",
draggable = F, top = 75, left = "auto",
right = 50, bottom = "auto", width = 110, height = 30,
actionButton('plotBtn', 'Toggle Controls', "data-toggle"='collapse', "data-target"='#controls')),
# begin collapsable control panel
fixedPanel(id = "controls", class = "collapse",
draggable = T, top = 130, left = "auto", right = 35, bottom = 20,
width = 850, height = 900,
h4("Map tools"),
fluidRow(column(3,
#selectInput("stusi", "Select Case Study", stusi,
#selected = stusi[1], width = "200px")
uiOutput("stusi")
),
column(3,
sliderInput("pcex", label = "Point size",
min = 1, max = 10, value = 5)),
column(4,
fileInput("geojson", "Upload custom geometry (.geojson)",
accept = ".geojson"))
),
h4("Time series tools"),
fluidRow(column(3,
dateInput('date',
label = 'Date of event',
value = Sys.Date())),
column(4,
selectInput('add.trend', 'Add trendline',
choices = c('Connect MP' = 'ctrend',
'Linear trend' = 'ltrend',
'2nd order polynomial trend' = 'ptrend'),
selected = 'ctrend')),
column(2,
actionButton('sub.offset', label = 'Subtr. offset',
style = "margin-top: 25px;"))#,
#column(3,
# actionButton('add.ts', label = 'Add point to TS-Selection',
# style = "margin-top: 25px;"))
),
plotOutput("psts", height = 600, width = 800),
fluidRow(verbatimTextOutput("Click_text")) # end control panel inputs/outputs
) # end collapsable control panel
),# end visualizer map tab item
# start manual tab item
tabItem(tabName = "manual",
includeMarkdown("www/manual.md")
), # end manual tab item
# start manual tab item
tabItem(tabName = "cite",
includeMarkdown("www/cite.md")
), # end manual tab item
tabItem(tabName = "blplot",
fluidPage(
# title
titlePanel("Baseline Plot"),
# panel layout with input and output defs
sidebarLayout(
# sidebar panel for Baseline Plot inputs
sidebarPanel(
selectInput(inputId = "bl.file",
label = "Select table with baseline data",
choices = bl.info,
selected = bl.info[1]),
# select SBAS or PS plot
radioButtons(inputId = "blopt",
label = "DInSAR approach:",
choiceNames = list(
"Persistent Scatterer PS", "Small BAseline Subset SBAS"),
choiceValues = list(
"ps.a", "sbas.a"),
selected = "ps.a"),
# static input slider for temporal baseline
# sliderInput(inputId = "bl.temp",
# label = "Temporal Baseline Threshold",
# min = 1,
# max = 365,
# value = 48,
# step = 1),
#
# dynamic input slider for PS SBAS option
uiOutput("bl.temp"),
# input slider for spatial baseline
sliderInput(inputId = "bl.spat",
label = "Perpendicular baseline threshold",
min = 1,
max = 200,
value = 200,
step = 1)
),
# main panel for Baseline Plot tab
mainPanel(
# output baseline plot
plotOutput(outputId = "bl.plot"),
fluidRow(verbatimTextOutput("bl.text"))
)
)
)), # end baseline plot tab
tabItem(tabName = "settings",
includeMarkdown("www/settings.md"),
fluidRow(
column(2, actionButton("load.def.settings",
label = "Load default settings"#,
#icon = "archive"
)),
column(4, verbatimTextOutput("text.settings")),
),
includeMarkdown("www/settings_maxnpoints.md"),
fluidRow(
column(2, numericInput(inputId = "select.max.n.points",
label = "max.n.points",
value = settings$max.n.points,
min = 1,
max = 500000,
width = "200px")),
column(2, actionButton("set.max.n.points",
label = "Enable for current session",
style = "margin-top: 25px;"
#icon = "cogs"
)),
column(2, actionButton("save.max.n.points",
label = "Save to user settings",
style = "margin-top: 25px;"
#icon = "user-cog"
)),
column(3, verbatimTextOutput("text.max.n.points"),
style = "margin-top: 25px;")
)
) # end setting tab
) # end body items
) # end dashboard body
) # end dashboard page
)) # end UI