Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zone closure msg #119

Merged
merged 3 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 41 additions & 25 deletions inst/ShinyFiles/MainApp/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -5185,45 +5185,57 @@ server = function(input, output, session) {

h4(tags$b('Define how alternative fishing choices are calculated between occurrence and alternative location')),

fluidRow(
column(5,
add_prompter(

selectizeInput('altc_occasion', 'occurrence:',
choices=c('Centroid of zonal assignment' = 'zone',
'Fishing centroid' = 'fish', 'Port' = 'port',
'Lon-Lat Coordinates' = 'lon-lat')),

message = 'A centroid table must be saved to the FishSET database to be used as trip/haul occurances',
type = 'info', size = 'large', position = 'right'),

conditionalPanel("input.altc_occasion=='zone'||input.altc_alt_var=='zone'",
uiOutput('altc_zone_cent_ui')),

bslib::layout_column_wrap(
width = 1/2,
bslib::card(card_header("Starting location"),
bslib::card_body(
fillable = FALSE,

bslib::layout_column_wrap(
width = 1/2,
fillable = FALSE,
padding = 0,
selectizeInput('altc_occasion', '',
choices=c('Centroid of zonal assignment' = 'zone',
'Fishing centroid' = 'fish',
'Port' = 'port',
'Lon-Lat Coordinates' = 'lon-lat')),

conditionalPanel("input.altc_occasion == 'zone'||input.altc_occasion == 'fish'",
h6(tags$em('A centroid table must be saved to the FishSET database to be used as trip/haul occurances'))),


selectizeInput('altc_zoneID', 'Column containing zone identifier',
choices = colnames(values$dataset), options = list(maxItems = 1),
multiple = TRUE)
),
)),

column(5,
add_prompter(

selectizeInput('altc_alt_var', 'alternative location:',
),
bslib::card(card_header("Alternative locations"),
bslib::card_body(
fillable = TRUE,
bslib::layout_column_wrap(
width = 1/2,
fillable = FALSE,
selectizeInput('altc_alt_var', '',

choices=c('Centroid of zonal assignment' = 'zone',
'Fishing centroid' = 'fish',
'Nearest Point' = 'near')),

message = 'A centroid table must be saved to the FishSET database to be used as trip/haul occurances',
type = 'info', size = 'large', position = 'right'),
conditionalPanel("input.altc_alt_var == 'zone'||input.altc_alt_var == 'fish'",
h6(tags$em('A centroid table must be saved to the FishSET database to be used as trip/haul occurances')))
),

conditionalPanel("input.altc_occasion=='zone'||input.altc_alt_var=='zone'",
uiOutput('altc_zone_cent_ui')),

selectizeInput('altc_dist','Distance units', choices = c('miles','kilometers','meters'),
selected = 'miles'),

numericInput('altc_min_haul', 'Include zones with more observations than',
min = 1, max = 1000, value = 1)
)
),
min = 1, max = 1000, value = 1),


conditionalPanel("input.altc_occasion=='fish'||input.altc_alt_var=='fish'",

Expand All @@ -5234,6 +5246,10 @@ server = function(input, output, session) {
uiOutput('altc_spat_ui')),

uiOutput('altc_occ_var_ui')
)
)

)
)
})

Expand Down
11 changes: 10 additions & 1 deletion inst/ShinyFiles/MainApp/zone_closure_Server.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ zone_closure_mapServer <- function(id, project, spatdat, clicked_ids, V, closure


observeEvent(input$select_zone_cat, {


req(project)

Expand All @@ -53,6 +54,8 @@ zone_closure_mapServer <- function(id, project, spatdat, clicked_ids, V, closure
mod_zones$data <- NULL
}
return(mod_zones$data)



})

Expand All @@ -66,6 +69,8 @@ zone_closure_mapServer <- function(id, project, spatdat, clicked_ids, V, closure
mutate(zone = as.character(spatdat[[input$select_zone_cat]]))

})




output$zmap <- leaflet::renderLeaflet({
Expand All @@ -78,7 +83,7 @@ output$zmap <- leaflet::renderLeaflet({
req(input$select_zone_cat)
req(zone_df())

showNotification("Can take up to a few seconds to run.", duration = 10, type = "warning")
# Generate map
if(any(!is_empty(mod_zones$data))) {

Expand Down Expand Up @@ -129,12 +134,14 @@ output$zmap <- leaflet::renderLeaflet({
}



})

# })

observeEvent(input$zmap_shape_click, {


# create object for clicked polygon
click <- input$zmap_shape_click

Expand Down Expand Up @@ -181,6 +188,8 @@ output$zmap <- leaflet::renderLeaflet({
layerId = clicked_polys[[z_id]])

}


})

# add closure ----
Expand Down
Loading