diff --git a/NAMESPACE b/NAMESPACE index d20e3e4c..f46599aa 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,5 @@ # Generated by roxygen2: do not edit by hand -S3method(as_ISOMetadata,emld) -S3method(as_ISOMetadata,ncdf4) export(GMLAbstractCRS) export(GMLAbstractCoordinateOperation) export(GMLAbstractCoordinateSystem) @@ -278,7 +276,6 @@ export(ISOUnlimitedInteger) export(ISOUsage) export(ISOVectorSpatialRepresentation) export(ISOVerticalExtent) -export(as_ISOMetadata) export(geometaLogger) export(geometa_coverage) export(getGeometaOption) diff --git a/R/geometa_mapping.R b/R/geometa_mapping.R index 47244263..bd2f6b28 100644 --- a/R/geometa_mapping.R +++ b/R/geometa_mapping.R @@ -760,18 +760,8 @@ registerMappings <- function(x){ #setters -#' Convert foreign metadata object to an \code{\link{ISOMetadata}} object -#' -#' Convert foreign metadata object to an \code{\link{ISOMetadata}} object -#' @param x object to convert -#' @param ... further arguments -#' @name as_ISOMetadata -#' @export -as_ISOMetadata = function(x, ...) UseMethod("as_ISOMetadata") - -#' @name as_ISOMetadata -#' @export -as_ISOMetadata.emld <- function(from){ +setOldClass("emld") +setAs("emld", "ISOMetadata", function(from){ if(!requireNamespace("EML", quietly = TRUE)) stop("package EML required, please install it first") if(!requireNamespace("emld", quietly = TRUE)) @@ -781,36 +771,17 @@ as_ISOMetadata.emld <- function(from){ out_md <- convert_metadata(in_from, from = "eml", to = "geometa", mappings = .geometa.mappings$rules, verbose = FALSE) return(out_md) -} +}) -#' @name as_ISOMetadata -#' @export -as_ISOMetadata.ncdf4 <- function(from){ +setOldClass("ncdf4") +setAs("ncdf4", "ISOMetadata", function(from){ if(!requireNamespace("ncdf4", quietly = TRUE)) stop("package ncdf4 required, please install it first") out_md <- convert_metadata(from, from = "eml", to = "geometa", mappings = .geometa.mappings$rules, verbose = FALSE) return(out_md) -} - -setOldClass("emld") -#' @name as -#' @rdname coerce-methods -#' @aliases coerce,emld,ISOMetadata-method -setAs("emld", "ISOMetadata", function(from) as_ISOMetadata(from)) - - - -setOldClass("ncdf4") -#' @name as -#' @rdname coerce-methods -#' @aliases coerce,ncdf4,ISOMetadata-method -setAs("ncdf4", "ISOMetadata", function(from) as_ISOMetadata(from)) - +}) -#' @name as -#' @rdname coerce-methods -#' @aliases coerce,ISOMetadata,emld-method setAs("ISOMetadata", "emld", function(from){ if(!requireNamespace("EML", quietly = TRUE)) stop("package EML required, please install it first") diff --git a/man/as_ISOMetadata.Rd b/man/as_ISOMetadata.Rd deleted file mode 100644 index 87f945d9..00000000 --- a/man/as_ISOMetadata.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/geometa_mapping.R -\name{as_ISOMetadata} -\alias{as_ISOMetadata} -\alias{as_ISOMetadata.emld} -\alias{as_ISOMetadata.ncdf4} -\title{Convert foreign metadata object to an \code{\link{ISOMetadata}} object} -\usage{ -as_ISOMetadata(x, ...) - -\method{as_ISOMetadata}{emld}(from) - -\method{as_ISOMetadata}{ncdf4}(from) -} -\arguments{ -\item{x}{object to convert} - -\item{...}{further arguments} -} -\description{ -Convert foreign metadata object to an \code{\link{ISOMetadata}} object -}