-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
257 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#' GMLCompoundCRS | ||
#' | ||
#' @docType class | ||
#' @importFrom R6 R6Class | ||
#' @export | ||
#' @keywords ISO GML compound CRS | ||
#' @return Object of \code{\link{R6Class}} for modelling an GMLCompoundCRS | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @field componentReferenceSystem | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(xml, defaults, id)}}{ | ||
#' This method is used to instantiate a GML Abstract CRS | ||
#' } | ||
#' \item{\code{addComponentReferenceSystem(referenceSystem)}}{ | ||
#' Adds a reference system | ||
#' } | ||
#' \item{\code{delComponentReferenceSystem(referenceSystem)}}{ | ||
#' Deletes a reference system | ||
#' } | ||
#' } | ||
#' | ||
#' @references | ||
#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. | ||
#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 | ||
#' | ||
#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
GMLCompoundCRS <- R6Class("GMLCompoundCRS", | ||
inherit = GMLAbstractCRS, | ||
private = list( | ||
xmlElement = "CompoundCRS", | ||
xmlNamespacePrefix = "GML" | ||
), | ||
public = list( | ||
|
||
#+ componentReferenceSystem [2..*]: instance of AbstractSingleCRS | ||
componentReferenceSystem = list(), | ||
|
||
initialize = function(xml = NULL, defaults = list(), id = NULL){ | ||
super$initialize(xml = xml, defaults = defaults, id = id) | ||
}, | ||
|
||
#addComponentReferenceSystem | ||
addComponentReferenceSystem = function(referenceSystem){ | ||
if(!inherits(referenceSystem, "GMLAbstractSingleCRS")){ | ||
stop("The argument should be a instance of class CRS") | ||
} | ||
return(self$addListElement("componentReferenceSystem", referenceSystem)) | ||
}, | ||
|
||
#delComponentReferenceSystem | ||
delComponentReferenceSystem = function(referenceSystem){ | ||
if(!inherits(referenceSystem, "GMLAbstractSingleCRS")){ | ||
stop("The argument should be a instance of class CRS") | ||
} | ||
return(self$delListElement("componentReferenceSystem", referenceSystem)) | ||
} | ||
|
||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#' GMLTemporalCRS | ||
#' | ||
#' @docType class | ||
#' @importFrom R6 R6Class | ||
#' @export | ||
#' @keywords ISO GML temporal crs | ||
#' @return Object of \code{\link{R6Class}} for modelling an GMLTemporalCRS | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @field timeCS | ||
#' @field temporalDatum | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(xml, defaults, id)}}{ | ||
#' This method is used to instantiate a GML temporal CRS | ||
#' } | ||
#' } | ||
#' | ||
#' @references | ||
#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. | ||
#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 | ||
#' | ||
#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
GMLTemporalCRS <- R6Class("GMLTemporalCRS", | ||
inherit = GMLAbstractSingleCRS, | ||
private = list( | ||
xmlElement = "TemporalCRS", | ||
xmlNamespacePrefix = "GML" | ||
), | ||
public = list( | ||
|
||
timeCS = NULL, | ||
temporalDatum = NULL, | ||
|
||
#setTimeCS | ||
setTimeCS = function(timeCS){ | ||
if(!is(timeCS, "GMLTimeCS")){ | ||
stop("The argument should be an object of class 'GMLTimeCS") | ||
} | ||
self$timeCS <- GMLElement$create("timeCS", timeCS) | ||
}, | ||
|
||
#setTemporalDatum | ||
setTemporalDatum = function(temporalDatum){ | ||
if(!is(temporalDatum, "GMLTemporalDatum")){ | ||
stop("The argument should be an object of class 'GMLTemporalDatum") | ||
} | ||
self$temporalDatum <- GMLElement$create("temporalDatum", temporalDatum) | ||
} | ||
|
||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# test_GMLCompoundCRS.R | ||
# Author: Emmanuel Blondel <[email protected]> | ||
# | ||
# Description: Unit tests for GMLCompoundCRS.R | ||
#======================= | ||
require(geometa, quietly = TRUE) | ||
require(testthat) | ||
require(XML) | ||
|
||
context("GMLCompoundCRS") | ||
|
||
test_that("encoding",{ | ||
|
||
#encoding | ||
gml <- GMLCompoundCRS$new() | ||
gml$setDescriptionReference("someref") | ||
gml$setIdentifier("test", "codespace") | ||
gml$addScope("somescope") | ||
|
||
xml <- gml$encode() | ||
expect_is(xml, "XMLInternalNode") | ||
|
||
#decoding | ||
gml2 <- GMLCompoundCRS$new(xml = xml) | ||
xml2 <- gml2$encode(validate=F) | ||
|
||
expect_true(ISOAbstractObject$compare(gml, gml2)) | ||
|
||
}) |