Drop themes by name, or keep only the ones named. The counterpart to
rfp_qgs_theme_set(), and what curating a project's theme list needed
before this existed — the alternative was reaching into an unexported
internal, or QGIS Desktop.
Arguments
- path
Character. Path to the
.qgs.- themes
Character. Theme names to remove.
- keep
Character. Theme names to keep; every other theme is removed.
- backup
Logical. Back up the
.qgsfirst, outside the project (see rfp-backups). DefaultTRUE.
Details
Give exactly one of themes or keep. A name in neither is an error rather
than a silent no-op: theme_rm(p, "Low detail") against a project holding
"Low Detail" would otherwise report success and change nothing.
A removed theme that a layout map, map canvas, 3D view or PDF export list
still names is reported with a catchable warning(), after the write: those
surfaces then follow no theme and draw the current layer state, with nothing
in QGIS saying so. To retire a theme into another one and re-point those
references, use rfp_qgs_theme_rename(), with merge = TRUE when the other
theme already exists.
See also
Other qgs:
rfp_qgs_form_add(),
rfp_qgs_layer_rm(),
rfp_qgs_postgres_add(),
rfp_qgs_preview_set(),
rfp_qgs_raster_add(),
rfp_qgs_service_add(),
rfp_qgs_service_rm(),
rfp_qgs_services(),
rfp_qgs_style_export(),
rfp_qgs_style_set(),
rfp_qgs_subset_get(),
rfp_qgs_subset_set(),
rfp_qgs_theme_add(),
rfp_qgs_theme_lookup(),
rfp_qgs_theme_names(),
rfp_qgs_theme_rename(),
rfp_qgs_theme_set(),
rfp_qgs_theme_unbury(),
rfp_qgs_themes(),
rfp_qgs_vector_add(),
rfp_qwc_config_create(),
rfp_qwc_probe(),
rfp_raster_style_path(),
rfp_raster_styles()
Examples
src <- system.file("templates", "bcrestoration_mobile.qgs", package = "rfp")
p <- file.path(tempdir(), "trimmed.qgs")
file.copy(src, p, overwrite = TRUE)
#> [1] TRUE
rfp_qgs_theme_names(p)
#> [1] "High Detail - Crossings" "Land Tenure"
#> [3] "Low Detail - Bull Trout Model" "Low Detail - Salmon Model"
#> [5] "Low Detail - Steelhead Model"
rfp_qgs_theme_rm(p, keep = "Land Tenure", backup = FALSE)
#> ✔ Removed 4 themes from /tmp/RtmpGuotGj/trimmed.qgs; 1 remains.
