diff --git a/NAMESPACE b/NAMESPACE index f23e3c15..5b07c831 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -323,6 +323,7 @@ export(SWEAbstractDataComponent) export(SWEAbstractObject) export(SWEAbstractSimpleComponent) export(SWECount) +export(SWEText) export(cacheISOClasses) export(convert_metadata) export(geometaLogger) diff --git a/R/SWECount.R b/R/SWECount.R index 61986b4e..db499dfe 100644 --- a/R/SWECount.R +++ b/R/SWECount.R @@ -28,10 +28,8 @@ SWECount <- R6Class("SWECount", #'@description Initializes an object of class \link{SWECount} #'@param xml object of class \link{XMLInternalNode-class} from \pkg{XML} - #'@param element element - #'@param attrs attrs - #'@param defaults defaults - #'@param wrap wrap + #'@param constraint constraint + #'@param value value initialize = function(xml = NULL, constraint = NULL, value = NULL){ super$initialize(xml, element = private$xmlElement) if(is.null(xml)){ diff --git a/R/SWEText.R b/R/SWEText.R new file mode 100644 index 00000000..a56027e4 --- /dev/null +++ b/R/SWEText.R @@ -0,0 +1,53 @@ +#' SWEText +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO SWE +#' @return Object of \code{\link{R6Class}} for modelling an SWE Text +#' @format \code{\link{R6Class}} object. +#' +#' @references +#' OGC Geography Markup Language. https://www.ogc.org/standards/swecommon +#' +#' @author Emmanuel Blondel +#' +SWEText <- R6Class("SWEText", + inherit = SWEAbstractSimpleComponent, + private = list( + xmlElement = "Text", + xmlNamespacePrefix = "SWE" + ), + public = list( + + #'@field constraint constraint + constraint = NULL, + + #'@field value value + value = NULL, + + #'@description Initializes an object of class \link{SWEText} + #'@param xml object of class \link{XMLInternalNode-class} from \pkg{XML} + #'@param constraint constraint + #'@param value value + initialize = function(xml = NULL, constraint = NULL, value = NULL){ + super$initialize(xml, element = private$xmlElement) + if(is.null(xml)){ + self$constraint <- constraint + self$value <- value + } + }, + + #'@description setConstraint + #'@param constraint + setConstraint = function(constraint){ + self$constraint <- constraint + }, + + #'@description setValue + #'@param value + setValue = function(value){ + self$value <- value + } + ) +) \ No newline at end of file diff --git a/README.md b/README.md index 1f9cd035..a3472829 100644 --- a/README.md +++ b/README.md @@ -37,4 +37,4 @@ We thank in advance people that use ``geometa`` for citing it in their work / pu |GML 3.2.1 (ISO 19136) |Geographic Markup Language |GML |[![GML 3.2.1 (ISO 19136)](https://img.shields.io/badge/-37%25-ff0c0c.svg)](https://github.com/eblondel/geometa) | 63| 106| |GML 3.2.1 Coverage (OGC GMLCOV) |OGC GML Coverage Implementation Schema |GMLCOV |[![GML 3.2.1 Coverage (OGC GMLCOV)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 1| 0| |GML 3.3 Referenceable Grid (OGC GML) |OGC GML Referenceable Grid |GMLRGRID |[![GML 3.3 Referenceable Grid (OGC GML)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 5| 0| -|SWE 2.0 |Sensor Web Enablement (SWE) Common Data Model |SWE |[![SWE 2.0](https://img.shields.io/badge/-16%25-ad0f0f.svg)](https://github.com/eblondel/geometa) | 5| 26| +|SWE 2.0 |Sensor Web Enablement (SWE) Common Data Model |SWE |[![SWE 2.0](https://img.shields.io/badge/-17%25-ad0f0f.svg)](https://github.com/eblondel/geometa) | 5| 25| diff --git a/inst/extdata/coverage/geometa_coverage_inventory.csv b/inst/extdata/coverage/geometa_coverage_inventory.csv index 63fedf6f..3a3ee821 100644 --- a/inst/extdata/coverage/geometa_coverage_inventory.csv +++ b/inst/extdata/coverage/geometa_coverage_inventory.csv @@ -487,7 +487,6 @@ "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","CategoryRange","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Component","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Count","SWECount",TRUE -"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Count","SWECount",TRUE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","CountRange","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataArray","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataChoice","",FALSE @@ -497,7 +496,7 @@ "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","NilValues","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Quantity","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","QuantityRange","",FALSE -"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Text","",FALSE +"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Text","SWEText",TRUE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","TextEncoding","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Time","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","TimeRange","",FALSE diff --git a/inst/extdata/coverage/geometa_coverage_summary.csv b/inst/extdata/coverage/geometa_coverage_summary.csv index 1bafaff8..9a53281d 100644 --- a/inst/extdata/coverage/geometa_coverage_summary.csv +++ b/inst/extdata/coverage/geometa_coverage_summary.csv @@ -8,4 +8,4 @@ "GML 3.2.1 (ISO 19136)","Geographic Markup Language","GML",63,106,37.28 "GML 3.2.1 Coverage (OGC GMLCOV)","OGC GML Coverage Implementation Schema","GMLCOV",1,0,100 "GML 3.3 Referenceable Grid (OGC GML)","OGC GML Referenceable Grid","GMLRGRID",5,0,100 -"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE",5,26,16.13 +"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE",5,25,16.67 diff --git a/inst/extdata/coverage/geometa_coverage_summary.md b/inst/extdata/coverage/geometa_coverage_summary.md index 05f0d53b..a0d07d51 100644 --- a/inst/extdata/coverage/geometa_coverage_summary.md +++ b/inst/extdata/coverage/geometa_coverage_summary.md @@ -9,4 +9,4 @@ |GML 3.2.1 (ISO 19136) |Geographic Markup Language |GML |[![GML 3.2.1 (ISO 19136)](https://img.shields.io/badge/-37%25-ff0c0c.svg)](https://github.com/eblondel/geometa) | 63| 106| |GML 3.2.1 Coverage (OGC GMLCOV) |OGC GML Coverage Implementation Schema |GMLCOV |[![GML 3.2.1 Coverage (OGC GMLCOV)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 1| 0| |GML 3.3 Referenceable Grid (OGC GML) |OGC GML Referenceable Grid |GMLRGRID |[![GML 3.3 Referenceable Grid (OGC GML)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 5| 0| -|SWE 2.0 |Sensor Web Enablement (SWE) Common Data Model |SWE |[![SWE 2.0](https://img.shields.io/badge/-16%25-ad0f0f.svg)](https://github.com/eblondel/geometa) | 5| 26| +|SWE 2.0 |Sensor Web Enablement (SWE) Common Data Model |SWE |[![SWE 2.0](https://img.shields.io/badge/-17%25-ad0f0f.svg)](https://github.com/eblondel/geometa) | 5| 25| diff --git a/man/SWECount.Rd b/man/SWECount.Rd index eb02081c..e80cd498 100644 --- a/man/SWECount.Rd +++ b/man/SWECount.Rd @@ -10,13 +10,9 @@ \arguments{ \item{xml}{object of class \link{XMLInternalNode-class} from \pkg{XML}} -\item{element}{element} +\item{constraint}{constraint} -\item{attrs}{attrs} - -\item{defaults}{defaults} - -\item{wrap}{wrap} +\item{value}{value} } \value{ Object of \code{\link{R6Class}} for modelling an SWE Count diff --git a/man/SWEText.Rd b/man/SWEText.Rd new file mode 100644 index 00000000..3a94f412 --- /dev/null +++ b/man/SWEText.Rd @@ -0,0 +1,42 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/SWEText.R +\docType{class} +\name{SWEText} +\alias{SWEText} +\title{SWEText} +\format{ +\code{\link{R6Class}} object. +} +\arguments{ +\item{xml}{object of class \link{XMLInternalNode-class} from \pkg{XML}} + +\item{constraint}{constraint} + +\item{value}{value} +} +\value{ +Object of \code{\link{R6Class}} for modelling an SWE Text +} +\description{ +Initializes an object of class \link{SWEText} + +setConstraint + +setValue +} +\section{Fields}{ + +\describe{ +\item{\code{constraint}}{constraint} + +\item{\code{value}}{value} +}} + +\references{ +OGC Geography Markup Language. https://www.ogc.org/standards/swecommon +} +\author{ +Emmanuel Blondel +} +\keyword{ISO} +\keyword{SWE} diff --git a/tests/testthat/test_SWEText.R b/tests/testthat/test_SWEText.R new file mode 100644 index 00000000..6a52b64a --- /dev/null +++ b/tests/testthat/test_SWEText.R @@ -0,0 +1,23 @@ +# test_SWEText.R +# Author: Emmanuel Blondel +# +# Description: Unit tests for classes inheriting SWEText.R +#======================= +require(geometa, quietly = TRUE) +require(sf) +require(testthat) + +context("SWEText") + +test_that("SWEText",{ + testthat::skip_on_cran() + #encoding + txt <- SWEText$new(value = "some free text") + xml <- txt$encode() + expect_is(xml, "XMLInternalNode") + #decoding + txt2 <- SWEText$new(xml = xml) + xml2 <- txt2$encode() + #assert object identity + expect_true(ISOAbstractObject$compare(txt, txt2)) +})