Skip to content

Commit b05f7e8

Browse files
committed
fix: revert "remove export and theme args from mf_init() and mf_export()"
This reverts commit 2454035.
1 parent 17a3057 commit b05f7e8

File tree

10 files changed

+63
-9
lines changed

10 files changed

+63
-9
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ message: 'To cite package "mapsf" in publications use:'
88
type: software
99
license: GPL-3.0-or-later
1010
title: 'mapsf: Thematic Cartography'
11-
version: 0.10.0
11+
version: 0.10.1
1212
abstract: Create and integrate thematic maps in your workflow. This package helps
1313
to design various cartographic representations such as proportional symbols, choropleth
1414
or typology maps. It also offers several functions to display layout elements that

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: mapsf
22
Title: Thematic Cartography
3-
Version: 0.10.0
3+
Version: 0.10.1
44
Authors@R:
55
c(person(given = "Timothée",
66
family = "Giraud",

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# mapsf 0.10.1
2+
3+
## Fix
4+
- revert previous remove "export" and "theme" args from mf_export() to accommodate dependencies
5+
- revert previous remove "theme" from mf_init() to accommodate dependencies
6+
7+
18
# mapsf 0.10.0
29

310
## Fix

R/mf_export.R

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
#' @param x object of class \code{sf}, \code{sfc} or \code{SpatRaster}
1212
#' @param expandBB fractional values to expand the bounding box with, in each
1313
#' direction (bottom, left, top, right)
14+
#' @param theme apply a theme (deprecated)
1415
#' @param filename path to the exported file. If the file extention is ".png" a
1516
#' png graphic device is opened, if the file extension is ".svg" a svg graphic
1617
#' device is opened.
18+
#' @param export deprecated
1719
#' @param width width of the figure (pixels for png, inches for svg)
1820
#' @param height height of the figure (pixels for png, inches for svg)
1921
#' @param res resolution (for png)
@@ -34,7 +36,25 @@ mf_export <- function(x,
3436
height,
3537
res = 96,
3638
...,
37-
expandBB = rep(0, 4)) {
39+
expandBB = rep(0, 4),
40+
theme,
41+
export = "png") {
42+
# deprecated args mgmt
43+
if (!missing(theme)) {
44+
warning(
45+
paste0(
46+
"'theme' is deprecated.\n",
47+
"In the next version of mapsf the current theme ",
48+
"will be applied to the export."
49+
),
50+
call. = FALSE
51+
)
52+
mf_theme(theme)
53+
}
54+
if (!missing(export)) {
55+
message('"export" is deprecated.')
56+
}
57+
3858
# input test
3959
if (!inherits(x, c("bbox", "SpatVector", "SpatRaster", "sf", "sfc", "sfg"))) {
4060
stop(

R/mf_init.R

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#' @param x object of class \code{sf}, \code{sfc} or \code{SpatRaster}
88
#' @param expandBB fractional values to expand the bounding box with, in each
99
#' direction (bottom, left, top, right)
10+
#' @param theme apply a theme (deprecated)
1011
#' @export
1112
#' @importFrom sf st_bbox st_as_sfc st_geometry st_crs<-
1213
#' @return No return value, a map is initiated.
@@ -15,8 +16,18 @@
1516
#' target <- mtq[30, ]
1617
#' mf_init(target)
1718
#' mf_map(mtq, add = TRUE)
18-
mf_init <- function(x, expandBB = rep(0, 4)) {
19-
19+
mf_init <- function(x, expandBB = rep(0, 4), theme) {
20+
if (!missing(theme)) {
21+
warning(
22+
paste0(
23+
"'theme' is deprecated.\n",
24+
"In the next version of mapsf the current theme ",
25+
"will be applied."
26+
),
27+
call. = FALSE
28+
)
29+
mf_theme(theme)
30+
}
2031
bgmap <- getOption("mapsf.bg")
2132

2233
if (inherits(x, "SpatRaster")) {

codemeta.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"codeRepository": "https://riatelab.github.io/mapsf/",
88
"issueTracker": "https://github.com/riatelab/mapsf/issues/",
99
"license": "https://spdx.org/licenses/GPL-3.0",
10-
"version": "0.10.0",
10+
"version": "0.10.1",
1111
"programmingLanguage": {
1212
"@type": "ComputerLanguage",
1313
"name": "R",
@@ -239,5 +239,5 @@
239239
},
240240
"SystemRequirements": null
241241
},
242-
"fileSize": "3252.531KB"
242+
"fileSize": "3253.942KB"
243243
}

inst/tinytest/test_export.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ dev.off()
1616
expect_silent(mf_export(mtq, filename = paste0(tempfile(), ".svg"),
1717
width = 6, height = 6))
1818
dev.off()
19+
expect_warning(mf_export(mtq, theme = "darkula",
20+
filename = paste0(tempfile(), ".svg")))
21+
dev.off()
1922

2023
expect_silent(mf_export(mtq, filename = paste0(tempfile(), ".svg")))
2124
dev.off()
@@ -34,6 +37,10 @@ expect_silent(mf_export(r))
3437
mf_raster(r, add = TRUE)
3538
dev.off()
3639

40+
expect_message(mf_export(mtq, height = 600, export = "png",
41+
filename = paste0(tempfile(), ".png")))
42+
dev.off()
43+
3744
expect_silent(mf_export(st_transform(mtq, "epsg:4326"),
3845
filename = paste0(tempfile(), ".png")))
3946
dev.off()

inst/tinytest/test_init.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
mtq <- mf_get_mtq()
33
expect_silent(mf_init(mtq))
44
expect_silent(mf_init(mtq, expandBB = c(0, 0, 0, .4)))
5+
expect_warning(mf_init(mtq, theme = "darkula"))
56
b <- terra::rast(system.file("ex/elev.tif", package = "terra"))
67
expect_silent(mf_init(b))
78
mf_raster(b, add = TRUE)

man/mf_export.Rd

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/mf_init.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)