Skip to content

Commit

Permalink
#181 rdoc for LAN + new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Dec 8, 2024
1 parent 847c479 commit 5889cf7
Show file tree
Hide file tree
Showing 14 changed files with 179 additions and 24 deletions.
4 changes: 3 additions & 1 deletion R/ISOCharacterSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#' charset <- ISOCharacterSet$new(value = "utf8")
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_MD_CharacterSetCode}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/lan/1.0/lan/#element_MD_CharacterSetCode}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
4 changes: 3 additions & 1 deletion R/ISOCountry.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#' charset <- ISOCountry$new(value = "utf8")
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_Country}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/lan/1.0/lan/#element_CountryCode}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
4 changes: 3 additions & 1 deletion R/ISOFreeText.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#' ft <- ISOFreeText$new()
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_PT_FreeText}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/lan/1.0/lan/#element_PT_FreeText}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
4 changes: 3 additions & 1 deletion R/ISOLanguage.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#' eng <- ISOLanguage$new(value = "eng")
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_LanguageCode}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/lan/1.0/lan/#element_LanguageCode}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
4 changes: 3 additions & 1 deletion R/ISOLocale.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#' loc$setCharacterSet("utf8")
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_PT_Locale}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/lan/1.0/lan/#element_PT_Locale}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
85 changes: 76 additions & 9 deletions R/ISOLocaleContainer.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#' @format \code{\link{R6Class}} object.
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_PT_LocaleContainer}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/lan/1.0/lan/#element_PT_LocaleContainer}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand All @@ -23,6 +25,12 @@ ISOLocaleContainer <- R6Class("ISOLocaleContainer",
),
public = list(

#'@field language language [1..1]: ISOLanguage
language = NULL,
#'@field country country [0..1]: ISOCountry
country = NULL,
#'@field characterEncoding character encoding [0..1]: ISOCharacterSet
characterEncoding = NULL,
#'@field description description [1..1]
description = NULL,
#'@field locale locale [1..1]
Expand All @@ -40,6 +48,45 @@ ISOLocaleContainer <- R6Class("ISOLocaleContainer",
super$initialize(xml = xml)
},

#'@description Set language
#'@param language object of class \link{ISOLanguage} or \link{character}
setLanguage = function(language){
if(!is(language, "ISOLanguage")){
if(is(language,"character")){
language = ISOLanguage$new(value = language)
}else{
stop("The argument 'language' should be an object of class 'ISOLanguage' or 'character'")
}
}
self$language = language
},

#'@description Set country
#'@param country object of class \link{ISOCountry} or \link{character}
setCountry = function(country){
if(!is(country, "ISOCountry")){
if(is(country,"character")){
country = ISOCountry$new(value = country)
}else{
stop("The argument 'country' should be an object of class 'ISOCountry' or 'character'")
}
}
self$country = country
},

#'@description Set character encoding
#'@param characterEncoding object of class \link{ISOCharacterSet} or \link{character}
setCharacterEncoding = function(characterEncoding){
if(!is(characterEncoding, "ISOCharacterSet")){
if(is(characterEncoding,"character")){
characterEncoding = ISOCharacterSet$new(value = characterEncoding)
}else{
stop("The argument 'characterEncoding' should be an object of class 'ISOCharacterSet' or 'character'")
}
}
self$characterEncoding = characterEncoding
},

#'@description Set description
#'@param description description
#'@param locales list of localized texts. Default is \code{NULL}
Expand Down Expand Up @@ -80,22 +127,42 @@ ISOLocaleContainer <- R6Class("ISOLocaleContainer",
},

#'@description Adds responsible party
#'@param responsibleParty object of class \link{ISOResponsibleParty}
#'@param responsibleParty object of class \link{ISOResponsibleParty} (in ISO 19139) or
#'\link{ISOResponsibility} (in ISO 19115-3)
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addResponsibleParty = function(responsibleParty){
if(!is(responsibleParty, "ISOResponsibleParty")){
stop("The argument 'responsibleParty' should be an object of class 'ISOResponsibleParty'")
}
switch(getMetadataStandard(),
"19139" = {
if(!is(responsibleParty, "ISOResponsibleParty")){
stop("The argument 'responsibleParty' should be an object of class 'ISOResponsibleParty'")
}
},
"19115-3" = {
if(!is(responsibleParty, "ISOResponsibility")){
stop("The argument 'responsibleParty' should be an object of class 'ISOResponsibility'")
}
}
)
return(self$addListElement("responsibleParty", responsibleParty))
},

#'@description Deletes responsible party
#'@param responsibleParty object of class \link{ISOResponsibleParty}
#'@param responsibleParty object of class \link{ISOResponsibleParty} (in ISO 19139) or
#'\link{ISOResponsibility} (in ISO 19115-3)
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delResponsibleParty = function(responsibleParty){
if(!is(responsibleParty, "ISOResponsibleParty")){
stop("The argument 'responsibleParty' should be an object of class 'ISOResponsibleParty'")
}
switch(getMetadataStandard(),
"19139" = {
if(!is(responsibleParty, "ISOResponsibleParty")){
stop("The argument 'responsibleParty' should be an object of class 'ISOResponsibleParty'")
}
},
"19115-3" = {
if(!is(responsibleParty, "ISOResponsibility")){
stop("The argument 'responsibleParty' should be an object of class 'ISOResponsibility'")
}
}
)
return(self$delListElement("responsibleParty", responsibleParty))
},

Expand Down
4 changes: 3 additions & 1 deletion R/ISOLocalisedCharacterString.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
#' str$encode()
#'
#' @references
#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_LocalisedCharacterString}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/lan/1.0/lan/#element_LocalisedCharacterString}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
4 changes: 3 additions & 1 deletion man/ISOCharacterSet.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/ISOCountry.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/ISOFreeText.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/ISOLanguage.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/ISOLocale.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 67 additions & 3 deletions man/ISOLocaleContainer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/ISOLocalisedCharacterString.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5889cf7

Please sign in to comment.