Skip to content

Commit

Permalink
#69 AbstractCoordinateOperation + #71 ISO*PositionalAccuracy GMD classes
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jun 26, 2017
1 parent 7939b93 commit 83e198c
Show file tree
Hide file tree
Showing 20 changed files with 983 additions and 9 deletions.
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export(GMLTimePeriod)
export(GMLUnitDefinition)
export(GMLUserDefinedCS)
export(GMLVerticalCS)
export(ISOAbsoluteExternalPositionalAccuracy)
export(ISOAbstractCatalogue)
export(ISOAbstractObject)
export(ISOAbstractPositionalAccuracy)
export(ISOAddress)
export(ISOAngle)
export(ISOAssociationRole)
Expand Down Expand Up @@ -62,6 +64,7 @@ export(ISOCoverageContentType)
export(ISOCoverageDescription)
export(ISODataIdentification)
export(ISODataQuality)
export(ISODataQualityAbstractElement)
export(ISODate)
export(ISODateType)
export(ISODefinitionReference)
Expand All @@ -73,6 +76,7 @@ export(ISODistance)
export(ISODistribution)
export(ISODistributor)
export(ISODomainConsistency)
export(ISOEvaluationMethodType)
export(ISOExtent)
export(ISOFeatureAttribute)
export(ISOFeatureCatalogue)
Expand All @@ -87,6 +91,7 @@ export(ISOGeometricObjectType)
export(ISOGeometricObjects)
export(ISOGeoreferenceable)
export(ISOGridSpatialRepresentation)
export(ISOGriddedDataPositionalAccuracy)
export(ISOHierarchyLevel)
export(ISOIdentification)
export(ISOIdentifier)
Expand Down Expand Up @@ -116,6 +121,7 @@ export(ISORecord)
export(ISORecordType)
export(ISOReferenceIdentifier)
export(ISOReferenceSystem)
export(ISORelativeInternalPositionalAccuracy)
export(ISORepresentativeFraction)
export(ISOResponsibleParty)
export(ISORestriction)
Expand Down
8 changes: 4 additions & 4 deletions R/GMLAbstractCoordinateOperation.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#' Sets version
#' }
#' \item{\code{addAccuracy(accuracy)}}{
#' Adds coordinate operation accuracty
#' Adds coordinate operation accuracy, object extending \code{ISOAbstractPositionalAccuracy}
#' }
#' \item{\code{delAccuracy(accuracy)}}{
#' Deletes coordinate operation accuracty
#' Deletes coordinate operation accuracy, object extending \code{ISOAbstractPositionalAccuracy}
#' }
#' \item{\code{setSourceCRS(sourceCRS)}}{
#' Sets the source CRS, object extending \code{GMLAbstractSingleCRS}
Expand Down Expand Up @@ -83,8 +83,8 @@ GMLAbstractCoordinateOperation <- R6Class("GMLAbstractCoordinateOperation",

#delAccuracy
delAccuracy = function(accuracy){
if(!inherits(accuracy, "ISOPositionalAccuracy")){
stop("The argument value should be an object of class 'ISOPositionalAccuracy")
if(!inherits(accuracy, "ISOAbstractPositionalAccuracy")){
stop("The argument value should be an object of class 'ISOAbstractPositionalAccuracy")
}
return(self$delListElement("coordinateOperationAccuracy",
GMLElement$create("coordinateOperationAccuracy",
Expand Down
56 changes: 56 additions & 0 deletions R/ISOAbsoluteExternalPositionalAccuracy.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#' ISOAbsoluteExternalPositionalAccuracy
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO data quality absolute external positional accuracy
#' @return Object of \code{\link{R6Class}} for modelling an ISOAbsoluteExternalPositionalAccuracy
#' @format \code{\link{R6Class}} object.
#'
#' @section Inherited methods from \code{ISODataQualityAbstractElement}
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml)}}{
#' This method is used to instantiate an ISOAbsoluteExternalPositionalAccuracy
#' }
#' }
#'
#' @examples
#' #encoding
#' dq <- ISOAbsoluteExternalPositionalAccuracy$new()
#' dq$addNameOfMeasure("measure")
#' metaId <- ISOMetaIdentifier$new(code = "measure-id")
#' dq$setMeasureIdentification(metaId)
#' dq$setMeasureDescription("description")
#' dq$setEvaluationMethodDescription("method description")
#' dq$setEvaluationMethodType("indirect")
#' dq$setDateTime(ISOdate(2015,1,1,12,10,49))
#' spec <- ISOCitation$new()
#' spec$setTitle("specification title")
#' spec$setAlternateTitle("specification alternate title")
#' d <- ISODate$new()
#' d$setDate(ISOdate(2015, 1, 1, 1))
#' d$setDateType("publication")
#' spec$addDate(d)
#' dq$setEvaluationProcedure(spec)
#' result <- ISOConformanceResult$new()
#' result$setSpecification(spec)
#' result$setExplanation("some explanation about the conformance")
#' result$setPass(TRUE)
#' dq$addResult(result)
#' xml <- dq$encode()
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOAbsoluteExternalPositionalAccuracy <- R6Class("ISOAbsoluteExternalPositionalAccuracy",
inherit = ISOAbstractPositionalAccuracy,
private = list(
xmlElement = "DQ_AbsoluteExternalPositionalAccuracy",
xmlNamespacePrefix = "GMD"
),
public = list()
)
31 changes: 31 additions & 0 deletions R/ISOAbstractPositionalAccuracy.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#' ISOAbstractPositionalAccuracy
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO data quality abstract positional accuracy
#' @return Object of \code{\link{R6Class}} for modelling an ISOAbstractPositionalAccuracy
#' @format \code{\link{R6Class}} object.
#'
#' @section Inherited methods from \code{ISODataQualityAbstractElement}
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml)}}{
#' This method is used to instantiate an ISOAbstractPositionalAccuracy
#' }
#' }
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOAbstractPositionalAccuracy <- R6Class("ISOAbstractPositionalAccuracy",
inherit = ISODataQualityAbstractElement,
private = list(
xmlElement = "AbstractDQ_PositionalAccuracy",
xmlNamespacePrefix = "GMD"
),
public = list()
)
3 changes: 2 additions & 1 deletion R/ISOCodelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ fetchISOCodelists <- function(){
ISOCodelist$new(gmxCL, "MD_ClassificationCode"),
ISOCodelist$new(gmxCL, "MD_CellGeometryCode"),
ISOCodelist$new(gmxCL, "MD_DimensionNameTypeCode"),
ISOCodelist$new(gmxCL, "MD_CoverageContentTypeCode")
ISOCodelist$new(gmxCL, "MD_CoverageContentTypeCode"),
ISOCodelist$new(gmxCL, "DQ_EvaluationMethodTypeCode")
)
names(codelists) <- sapply(codelists, function(cl){cl$identifier})
.geometa.iso$codelists <- codelists
Expand Down
2 changes: 1 addition & 1 deletion R/ISODataQuality.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml,value)}}{
#' \item{\code{new(xml)}}{
#' This method is used to instantiate an ISODataQuality
#' }
#' \item{\code{setScope(scope)}}{
Expand Down
159 changes: 159 additions & 0 deletions R/ISODataQualityAbstractElement.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#' ISODataQualityAbstractElement
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO data quality abstract element
#' @return Object of \code{\link{R6Class}} for modelling an ISODataQualityAbstractElement
#' @format \code{\link{R6Class}} object.
#'
#' @field nameOfMeasure
#' @field measureIdentification
#' @field measureDescription
#' @field evaluationMethodType
#' @field evaluationMethodDescription
#' @field evaluationProcedure
#' @field dateTime
#' @field result
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml)}}{
#' This method is used to instantiate an ISODataQuality
#' }
#' \item{\code{addNameOfMeasure(name)}}{
#' Add name
#' }
#' \item{\code{delNameOfMeasure(name)}}{
#' Deletes name
#' }
#' \item{\code{setMeasureIdentification(identification)}}{
#' Sets measure identifier, an object of class \code{ISOMetaIdentifier}
#' }
#' \item{\code{setMeasureDescription(description)}}{
#' Sets measure description
#' }
#' \item{\code{setEvaluationMethodType(type)}}{
#' Sets the type of evaluation method, an object of class \code{ISOEvaluationMethodType}
#' or any \code{character} value among code{ISOEvaluationMethodType$values()}
#' }
#' \item{\code{setEvaluationMethodDescription(description)}}{
#' Sets the description of evaluation method
#' }
#' \item{\code{setEvaluationMethodProcedure(procedure)}}{
#' Sets the procedure as an object of class \code{ISOCitation}
#' }
#' \item{\code{setDateTime(dateTime)}}{
#' Sets datetime, object class 'POSIXct'/'POSIXt'
#' }
#' \item{\code{addResult(result)}}{
#' Sets conformance result, object of class \code{ISOConformanceResult}
#' }
#' \item{\code{delResult(result)}}{
#' Deletes conformance result, object of class \code{ISOConformanceResult}
#' }
#' }
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODataQualityAbstractElement <- R6Class("ISODataQualityAbstractElement",
inherit = ISOAbstractObject,
private = list(
xmlElement = "AbstractDQ_Element",
xmlNamespacePrefix = "GMD"
),
public = list(

#+ nameOfMeasure [0..*]: character
nameOfMeasure = list(),
#+ measureIdentification [0..1]: ISOMetaIdentifier
measureIdentification = NULL,
#+ measureDescription [0..1]: character
measureDescription = NULL,
#+ evaluationMethodType [0..1]: ISOEvaluationMethodType
evaluationMethodType = NULL,
#+ evaluationMethodDescription [0..1]: character
evaluationMethodDescription = NULL,
#+ evaluationProcedure [0..1]: ISOCitation
evaluationProcedure = NULL,
#+ dateTime [0..1]: ISODateTime
dateTime = NULL,
#+ result [1..2]: ISOConformanceResult
result = list(),

initialize = function(xml = NULL){
super$initialize(xml = xml)
},

#addNameOfMeasure
addNameOfMeasure = function(name){
return(self$addListElement("nameOfMeasure", name))
},

#delNameOfMeasure
delNameOfMeasure = function(name){
return(self$delListElement("nameOfMeasure", name))
},

#setMeasureIdentification
setMeasureIdentification = function(identification){
if(!is(identification, "ISOMetaIdentifier")){
stop("The argument value should be an object of class 'ISOMetaIdentifier")
}
self$measureIdentification = identification
},

#setMeasureDescription
setMeasureDescription = function(description){
self$measureDescription <- description
},

#setEvaluationMethodType
setEvaluationMethodType = function(type){
if(!is(type, "ISOEvaluationMethodType")){
type <- ISOEvaluationMethodType$new(value = type)
}
self$evaluationMethodType <- type
},

#setEvaluationMethodDescription
setEvaluationMethodDescription = function(description){
self$evaluationMethodDescription <- description
},

#setEvaluationProcedure
setEvaluationProcedure = function(procedure){
if(!is(procedure, "ISOCitation")){
stop("The argument value should be an object of class 'ISOCitation'")
}
self$evaluationProcedure <- procedure
},

#setDateTime
setDateTime = function(dateTime){
if(!all(class(dateTime) == c("POSIXct","POSIXt"))){
stop("The argument should be an 'POSIXct'/'POSIXt' object")
}
self$dateTime <- dateTime
},

#addResult
addResult = function(result){
if(!is(result, "ISOConformanceResult")){
stop("The argument value should be an object of class 'ISOConformanceResult'")
}
return(self$addListElement("result", result))
},

#delResult
delResult = function(result){
if(!is(result, "ISOConformanceResult")){
stop("The argument value should be an object of class 'ISOConformanceResult'")
}
return(self$delListElement("result", result))
}
)
)
46 changes: 46 additions & 0 deletions R/ISOEvaluationMethodType.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#' ISOEvaluationMethodType
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO EvaluationMethodType
#' @return Object of \code{\link{R6Class}} for modelling an ISO EvaluationMethodType
#' @format \code{\link{R6Class}} object.
#'
#' @field value
#'
#' @section Methods:
#' \describe{
#' \item{\code{new(xml,value)}}{
#' This method is used to instantiate an ISOEvaluationMethodType
#' }
#' }
#'
#' @examples
#' #possible values
#' values <- ISOEvaluationMethodType$values(labels = TRUE)
#'
#' #example of EvaluationMethodType
#' indirect <- ISOEvaluationMethodType$new(value = "indirect")
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOEvaluationMethodType <- R6Class("ISOEvaluationMethodType",
inherit = ISOCodeListValue,
private = list(
xmlElement = "DQ_EvaluationMethodTypeCode",
xmlNamespacePrefix = "GMD"
),
public = list(
initialize = function(xml = NULL, value){
super$initialize(xml = xml, id = private$xmlElement, value = value, setValue = FALSE)
}
)
)

ISOEvaluationMethodType$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOEvaluationMethodType, labels))
}
Loading

0 comments on commit 83e198c

Please sign in to comment.