From c8bfe56bd627e1945815631ce5c2ac27333fa246 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 15 Jul 2019 14:45:52 +0200 Subject: Add chent$emf() function based on devEMF --- R/chent.R | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'R') diff --git a/R/chent.R b/R/chent.R index ae23aeb..f3626de 100644 --- a/R/chent.R +++ b/R/chent.R @@ -403,6 +403,21 @@ chent <- R6Class("chent", png(path, antialias = antialias) plot(self) dev.off() + }, + emf = function(file = paste0(self$identifier, ".emf"), dir = "structures/emf") { + if (!requireNamespace("devEMF")) { + stop("You need to have the devEMF package installed for this function") + } + if (!dir.exists(dir)) { + message("Directory '", dir, "' does not exist") + message("Trying to create directory '", dir, "'") + dir.create(dir, recursive = TRUE) + } + path = file.path(dir, file) + message("Creating file '", path, "'") + devEMF::emf(path) + plot(self) + dev.off() } ) ) -- cgit v1.2.1