-
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.
#153 MI_Georeferenceable -> ISOImageryGeoreferenceable, MI_Georectifi…
…ed -> ISOImageryGeorectified
- Loading branch information
Showing
10 changed files
with
359 additions
and
4 deletions.
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,70 @@ | ||
#' ISOImageryGeorectified | ||
#' | ||
#' @docType class | ||
#' @importFrom R6 R6Class | ||
#' @export | ||
#' @keywords ISO image georectified | ||
#' @return Object of \code{\link{R6Class}} for modelling an ISO image Georectified | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @field checkPoint [\code{list} of \code{\link{ISOImageryGCP}}] | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(xml,value)}}{ | ||
#' This method is used to instantiate an \code{\link{ISOImageryGeorectified}} | ||
#' } | ||
#' \item{\code{addCheckPoint(sfg,m)}}{ | ||
#' Adds a check point, either an object of class 'sfg' (from \pkg{sf}) or a 'matrix' | ||
#' } | ||
#' \item{\code{delCheckPoint(sfg,m)}}{ | ||
#' Deletes a check point, either an object of class 'sfg' (from \pkg{sf}) or a 'matrix' | ||
#' } | ||
#' } | ||
#' | ||
#' @section Methods inherited from \code{\link{ISOGridSpatialRepresentation}}: | ||
#' \describe{ | ||
#' See \code{\link{ISOGridSpatialRepresentation}} | ||
#' } | ||
#' | ||
#' @section Methods inherited from \code{\link{ISOGeorectified}}: | ||
#' \describe{ | ||
#' See \code{\link{ISOGeorectified}} | ||
#' } | ||
#' | ||
#' @references | ||
#' ISO 19115-2:2009 - Geographic information -- Metadata -- Part 2: Extensions for imagery and gridded data | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
ISOImageryGeorectified <- R6Class("ISOImageGeorectified", | ||
inherit = ISOGeorectified, | ||
private = list( | ||
xmlElement = "MI_Georectified", | ||
xmlNamespacePrefix = "GMI" | ||
), | ||
public = list( | ||
|
||
#checkPoint [0..*]: ISOImageryGCP | ||
checkPoint = list(), | ||
|
||
initialize = function(xml = NULL){ | ||
super$initialize(xml = xml) | ||
}, | ||
|
||
#addCheckPoint | ||
addcheckPoint = function(sfg = NULL, m = NULL){ | ||
checkPoint <- ISOImageryGCP$new() | ||
checkPoint$setGeographicCoordinates(sfg = sfg, m = m) | ||
return(self$addListElement("checkPoint", checkPoint)) | ||
}, | ||
|
||
#delCheckPoint | ||
delcheckPoint = function(sfg = NULL, m = NULL){ | ||
checkPoint <- ISOImageryGCP$new() | ||
checkPoint$setGeographicCoordinates(sfg = sfg, m = m) | ||
return(self$delListElement("checkPoint", checkPoint)) | ||
} | ||
|
||
) | ||
) |
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,72 @@ | ||
#' ISOImageryGeoreferencerable | ||
#' | ||
#' @docType class | ||
#' @importFrom R6 R6Class | ||
#' @export | ||
#' @keywords ISO imagery Georeferencerable | ||
#' @return Object of \code{\link{R6Class}} for modelling an ISO imagery Georeferencerable | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @field geolocationInformation [\code{list} of \code{\link{ISOImageryAbstractGeolocationInformation}}] | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(xml,value)}}{ | ||
#' This method is used to instantiate an \code{\link{ISOImageryGeoreferencerable}} | ||
#' } | ||
#' \item{\code{addGeolocationInformation(geolocationInformation)}}{ | ||
#' Adds a geolocation information, an object of class \code{\link{ISOImageryAbstractGeolocationInformation}} | ||
#' } | ||
#' \item{\code{delGeolocationInformation(geolocationInformation)}}{ | ||
#' Deletes geolocation information, an object of class \code{\link{ISOImageryAbstractGeolocationInformation}} | ||
#' } | ||
#' } | ||
#' | ||
#' @section Methods inherited from \code{\link{ISOGridSpatialRepresentation}}: | ||
#' \describe{ | ||
#' See \code{\link{ISOGridSpatialRepresentation}} | ||
#' } | ||
#' | ||
#' @section Methods inherited from \code{\link{ISOGeoreferenceable}}: | ||
#' \describe{ | ||
#' See \code{\link{ISOGeoreferenceable}} | ||
#' } | ||
#' | ||
#' @references | ||
#' ISO 19115-2:2009 - Geographic information -- Metadata -- Part 2: Extensions for imagery and gridded data | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
ISOImageryGeoreferencerable <- R6Class("ISOImageryGeoreferencerable", | ||
inherit = ISOGeoreferencerable, | ||
private = list( | ||
xmlElement = "MI_Georeferenceable", | ||
xmlNamespacePrefix = "GMI" | ||
), | ||
public = list( | ||
|
||
#geolocationInformation [0..*]: ISOImageryGeolocationInformation | ||
geolocationInformation = list(), | ||
|
||
initialize = function(xml = NULL){ | ||
super$initialize(xml = xml) | ||
}, | ||
|
||
#addGeolocationInformation | ||
addGeolocationInformation = function(geolocationInfo){ | ||
if(!inherits(geolocationInfo, "ISOImageryAbstractGeolocationInformation")){ | ||
stop("The argument should be an object inheriting 'ISOImageryAbstractGeolocationInformation") | ||
} | ||
return(self$addListElement("geolocationInformation", geolocationInfo)) | ||
}, | ||
|
||
#delGeolocationInformation | ||
delGeolocationInformation = function(geolocationInfo){ | ||
if(!inherits(geolocationInfo, "ISOImageryAbstractGeolocationInformation")){ | ||
stop("The argument should be an object inheriting 'ISOImageryAbstractGeolocationInformation") | ||
} | ||
return(self$delListElement("geolocationInformation", geolocationInfo)) | ||
} | ||
|
||
) | ||
) |
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
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,43 @@ | ||
# test_ISOImageryGeorecrified.R | ||
# Author: Emmanuel Blondel <emmanuel.blondel1@gmail.com> | ||
# | ||
# Description: Unit tests for ISOImageryGeorecrified.R | ||
#======================= | ||
require(geometa, quietly = TRUE) | ||
require(sf, quietly = TRUE) | ||
require(testthat) | ||
|
||
context("ISOImageryGeorecrified") | ||
|
||
test_that("encoding",{ | ||
testthat::skip_on_cran() | ||
testthat::skip_on_travis() | ||
#encoding | ||
md <- ISOImageryGeorecrified$new() | ||
md$setNumberOfDimensions(1) | ||
md$setTransformationParameterAvailability(FALSE) | ||
dim1 <- ISODimension$new() | ||
dim1$setName("row") | ||
dim1$setSize(100) | ||
dim1$setResolution(ISOMeasure$new(value=1,uom="m")) | ||
md$addDimension(dim1) | ||
md$setCellGeometry("area") | ||
|
||
md$setCheckPointAvailability(TRUE) | ||
md$setCheckPointDescription("string") | ||
pt <- st_point(c(1,1)) | ||
md$setCenterPoint(sfg = pt) | ||
md$setPixelOrientation("center") | ||
|
||
md$addCheckPoint(sfg = st_point(c(0,0))) | ||
md$addCheckPoint(sfg = st_point(c(1,1))) | ||
|
||
xml <- md$encode() | ||
expect_is(xml, "XMLInternalNode") | ||
|
||
#decoding | ||
md2 <- ISOImageryGeorecrified$new(xml = xml) | ||
xml2 <- md2$encode() | ||
|
||
expect_true(ISOAbstractObject$compare(md, md2)) | ||
}) |
Oops, something went wrong.