Skip to content

Commit

Permalink
#187 SWE Text
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed May 9, 2022
1 parent 16a1483 commit 98a974b
Show file tree
Hide file tree
Showing 10 changed files with 127 additions and 15 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export(SWEAbstractDataComponent)
export(SWEAbstractObject)
export(SWEAbstractSimpleComponent)
export(SWECount)
export(SWEText)
export(cacheISOClasses)
export(convert_metadata)
export(geometaLogger)
Expand Down
6 changes: 2 additions & 4 deletions R/SWECount.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)){
Expand Down
53 changes: 53 additions & 0 deletions R/SWEText.R
Original file line number Diff line number Diff line change
@@ -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 <emmanuel.blondel1@@gmail.com>
#'
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
}
)
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
3 changes: 1 addition & 2 deletions inst/extdata/coverage/geometa_coverage_inventory.csv
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","CategoryRange","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Component","<missing>",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","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataArray","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataChoice","<missing>",FALSE
Expand All @@ -497,7 +496,7 @@
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","NilValues","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Quantity","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","QuantityRange","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Text","<missing>",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","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Time","<missing>",FALSE
"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","TimeRange","<missing>",FALSE
Expand Down
2 changes: 1 addition & 1 deletion inst/extdata/coverage/geometa_coverage_summary.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion inst/extdata/coverage/geometa_coverage_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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|
8 changes: 2 additions & 6 deletions man/SWECount.Rd

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

42 changes: 42 additions & 0 deletions man/SWEText.Rd

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

23 changes: 23 additions & 0 deletions tests/testthat/test_SWEText.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# test_SWEText.R
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com>
#
# 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))
})

0 comments on commit 98a974b

Please sign in to comment.