From 56473b4a9a5f17b2fffdf28975ee01fd83cc1fd9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Grelot?= <frederic.grelot@irstea.fr>
Date: Mon, 24 Jan 2022 09:58:19 +0100
Subject: [PATCH] =?UTF-8?q?geau=20Version=201.0.13.0=200=20errors=20?=
 =?UTF-8?q?=E2=9C=94=20|=200=20warnings=20=E2=9C=94=20|=200=20notes=20?=
 =?UTF-8?q?=E2=9C=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

- map_so_ii
	- passage à cairo_pdf pour les pdf, car pdf ne gère pas utf-8
	- ajout de device svg
---
 geau/DESCRIPTION      |  2 +-
 geau/R/map_so_ii.r    | 18 +++++++++++++++---
 geau/man/map_so_ii.Rd | 13 ++++++++++++-
 3 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/geau/DESCRIPTION b/geau/DESCRIPTION
index a006216..41acb31 100644
--- a/geau/DESCRIPTION
+++ b/geau/DESCRIPTION
@@ -1,6 +1,6 @@
 Package: geau
 Title: Utilities very useful to share within geau-inondation team
-Version: 1.0.12.0
+Version: 1.0.13.0
 Authors@R:
     c(
         person(given = "Frédéric",
diff --git a/geau/R/map_so_ii.r b/geau/R/map_so_ii.r
index 6ed4265..b86b5c9 100644
--- a/geau/R/map_so_ii.r
+++ b/geau/R/map_so_ii.r
@@ -60,7 +60,17 @@
 #'      years is plotted.}
 #' }
 #' }
-#' 
+#' \subsection{path specification}{
+#' Depending on the extension a device is chosen.
+#' \itemize{
+#'   \item{\strong{pdf}: grDevices::cairo_pdf}
+#'   \item{\strong{png}: grDevices::png}
+#'   \item{\strong{svg}: grDevices::svg}
+#' }
+#' If path is NULL, standard plotting is used. If an extension is not managed,
+#' an error is raised.
+#' }
+#'
 #' @param dataset sf objectf, data to be plotted
 #' @param dataset_legend list of parameters to be passed to legend
 #' @param theme character, choice for the theme (if any). See details.
@@ -68,7 +78,8 @@
 #' @param detail character, detail for theme, depends on theme. See details.
 #' @param year character, the year chosen for some themes. See details.
 #' @param bar logical, should a bar be plotted for the dataset
-#' @param path character, the name of the file to save the plot
+#' @param path character, the name of the file to save the plot. Graphical
+#'  device is chosen depending on extension. See details.
 #' @param ...  some parameters that will be used by plot (from sf)
 #'
 #' @return Nothing useful.
@@ -101,8 +112,9 @@ map_so_ii = function(
     if (!is.null(path)) {
         switch(
             EXPR = tolower(tools::file_ext(path)),
-            "pdf" = grDevices::pdf(path),
+            "pdf" = grDevices::cairo_pdf(path),
             "png" = grDevices::png(path),
+            "svg" = grDevices::svg(path),
             stop(sprintf("%s not recognized", tolower(tools::file_ext(path))))
         )
         on.exit(grDevices::dev.off())
diff --git a/geau/man/map_so_ii.Rd b/geau/man/map_so_ii.Rd
index 8c7cb6d..2dc0259 100644
--- a/geau/man/map_so_ii.Rd
+++ b/geau/man/map_so_ii.Rd
@@ -33,7 +33,8 @@ map_so_ii(
 
 \item{bar}{logical, should a bar be plotted for the dataset}
 
-\item{path}{character, the name of the file to save the plot}
+\item{path}{character, the name of the file to save the plot. Graphical
+device is chosen depending on extension. See details.}
 
 \item{...}{some parameters that will be used by plot (from sf)}
 }
@@ -103,6 +104,16 @@ provided an analysis of the evolution between the range of given
 years is plotted.}
 }
 }
+\subsection{path specification}{
+Depending on the extension a device is chosen.
+\itemize{
+\item{\strong{pdf}: grDevices::cairo_pdf}
+\item{\strong{png}: grDevices::png}
+\item{\strong{svg}: grDevices::svg}
+}
+If path is NULL, standard plotting is used. If an extension is not managed,
+an error is raised.
+}
 }
 \examples{
 
-- 
GitLab