---
title: "Using sen2r() from the GUI"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Using sen2r() from the GUI}
  %\VignetteEngine{knitr::knitr}
  %\usepackage[UTF-8]{inputenc}
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

The simplest way to use 
<span style="color:#5793dd;vertical-align:top;font-size:90%;font-weight:normal;">sen</span><span style="color:#6a7077;vertical-align:baseline;font-size:115%;font-weight:bolder;">2</span><span style="color:#2f66d5;vertical-align:baseline;font-size:90%;font-weight:bold;">r</span>
is to execute it in interactive mode.
These commands will open the GUI provided with by function `sen2r()`:
```{r, eval = FALSE}
library(sen2r)
sen2r()
```

Note that the following error message could be returned:
```
Some missing packages are needed to run the GUI; please install them with the command
> install.packages("leaflet", "leafpm", "mapedit", "shiny", "shinyFiles", "shinydashboard", "shinyjs", "shinyWidgets")
```
This because "graphical" packages required to run the GUI are now suggested dependencies (the package could be used without them, if the user do not require the GUI).
In this case, simply install the missing packages as stated by the error message (which could differ from the previous one).


The GUI is organised in several panels (click on the images below for larger versions), 
allowing users to set all the required processing parameters.
Help pop-up windows (marked with the symbol
<span style = "color:darkcyan;"><i class="fa fa-question-circle"></i></span>)
are provided to aid users regarding the more complex parameters.

<p style="text-align:center;">
  <a href="https://raw.githubusercontent.com/ranghetti/sen2r/devel/man/figures/sen2r_gui_sheet1.png" target="_blank">
    <img src="../man/figures/sen2r_gui_sheet1_small.png">
  </a>
  <a href="https://raw.githubusercontent.com/ranghetti/sen2r/devel/man/figures/sen2r_gui_sheet2.png" target="_blank">
    <img src="../man/figures/sen2r_gui_sheet2_small.png">
  </a>
  <br/>
  <a href="https://raw.githubusercontent.com/ranghetti/sen2r/devel/man/figures/sen2r_gui_sheet3.png" target="_blank">
    <img src="../man/figures/sen2r_gui_sheet3_small.png">
  </a>
  <a href="https://raw.githubusercontent.com/ranghetti/sen2r/devel/man/figures/sen2r_gui_sheet4.png" target="_blank">
    <img src="../man/figures/sen2r_gui_sheet4_small.png">
  </a>
  <a href="https://raw.githubusercontent.com/ranghetti/sen2r/devel/man/figures/sen2r_gui_sheet5.png" target="_blank">
    <img src="../man/figures/sen2r_gui_sheet5_small.png">
  </a>
</p>

The left-side bar of the dashboard allows instead to: 

* save the current parameters to a JSON file for later use
    (this allows for example to easily set-up parameters for a processing chain
    that can be later launched [from the command line](sen2r_cmd.html));
* restore previously saved parameters; 
* specify the path of a log file where processing messages will be saved; 
* launch the processing:
    in this case, the GUI will close and `sen2r()` execution will start
    (the user will be able to monitor `sen2r()` progress from the processing 
    messages sent to R console _or_ to a log file, if this option was chosen 
    with the previous button);
* exit the GUI without launching the processing.
