diff --git a/R/GMLLineString.R b/R/GMLLineString.R index 8abfd64b..a4ad1816 100644 --- a/R/GMLLineString.R +++ b/R/GMLLineString.R @@ -37,7 +37,7 @@ GMLLineString <- R6Class("GMLLineString", initialize = function(xml = NULL, sfg){ super$initialize(xml, element = private$xmlElement, wrap = TRUE) if(is.null(xml)){ - if(!is(sfg, c("sfg","XY","LINESTRING"))) stop("Input 'sfg' object should be a 'linestring'") + if(!all(sapply(c("sfg","XY", "LINESTRING"), function(x){is(sfg, x)}))) stop("Input 'sfg' object should be a 'linestring'") m <- as.matrix(sfg) self$posList <- m self$setAttr("srsDimension", as.character(dim(m)[2])) diff --git a/R/GMLMultiCurve.R b/R/GMLMultiCurve.R index 62dfad64..18679844 100644 --- a/R/GMLMultiCurve.R +++ b/R/GMLMultiCurve.R @@ -45,7 +45,7 @@ GMLMultiCurve <- R6Class("GMLMultiCurve", super$initialize(xml, element = private$xmlElement, wrap = TRUE) if(is.null(xml)){ if(!is.null(sfg)){ - if(!is(sfg, c("sfg","XY","MULTILINESTRING"))) stop("Input 'sfg' object should be a 'multilinestring'") + if(!all(sapply(c("sfg","XY", "MULTILINESTRING"), function(x){is(sfg, x)}))) stop("Input 'sfg' object should be a 'multilinestring'") coords.list <- sfg class(coords.list) <- "list" for(coords in coords.list){ diff --git a/R/GMLMultiPoint.R b/R/GMLMultiPoint.R index 5739082c..0b511fbd 100644 --- a/R/GMLMultiPoint.R +++ b/R/GMLMultiPoint.R @@ -44,7 +44,7 @@ GMLMultiPoint <- R6Class("GMLMultiPoint", super$initialize(xml, element = private$xmlElement, wrap = TRUE) if(is.null(xml)){ if(!is.null(sfg)){ - if(!is(sfg, c("sfg","XY","MULTIPOINT"))) stop("Input 'sfg' object should be a 'multipoint'") + if(!all(sapply(c("sfg","XY", "MULTIPOINT"), function(x){is(sfg, x)}))) stop("Input 'sfg' object should be a 'multipoint'") coords.list <- sfg class(coords.list) <- "matrix" for(i in 1:dim(coords.list)[1]){ diff --git a/R/GMLMultiSurface.R b/R/GMLMultiSurface.R index e6761b43..f9513556 100644 --- a/R/GMLMultiSurface.R +++ b/R/GMLMultiSurface.R @@ -45,7 +45,7 @@ GMLMultiSurface <- R6Class("GMLMultiSurface", super$initialize(xml, element = private$xmlElement, wrap = TRUE) if(is.null(xml)){ if(!is.null(sfg)){ - if(!is(sfg, c("sfg","XY","MULTIPOLYGON"))) stop("Input 'sfg' object should be a 'multipolygon'") + if(!all(sapply(c("sfg","XY", "MULTIPOLYGON"), function(x){is(sfg, x)}))) stop("Input 'sfg' object should be a 'multipolygon'") coords.list <- sfg class(coords.list) <- "list" for(coords in coords.list){ diff --git a/R/GMLPoint.R b/R/GMLPoint.R index 8127e600..4b7b35d4 100644 --- a/R/GMLPoint.R +++ b/R/GMLPoint.R @@ -39,7 +39,7 @@ GMLPoint <- R6Class("GMLPoint", super$initialize(xml, element = private$xmlElement, wrap = TRUE) if(is.null(xml)){ if(!is.null(sfg)){ - if(!is(sfg, c("sfg","POINT"))) stop("Input 'sfg' object should be a 'point'") + if(!all(sapply(c("sfg","POINT"), function(x){is(sfg, x)}))) stop("Input 'sfg' object should be a 'point'") m <- as.matrix(sfg) }else if(!is.null(m)){ if(!is.matrix(m)){ diff --git a/R/GMLPolygon.R b/R/GMLPolygon.R index 40a0ad5d..f115ac36 100644 --- a/R/GMLPolygon.R +++ b/R/GMLPolygon.R @@ -38,7 +38,7 @@ GMLPolygon <- R6Class("GMLPolygon", initialize = function(xml = NULL, sfg){ super$initialize(xml, element = private$xmlElement, wrap = TRUE) if(is.null(xml)){ - if(!is(sfg, c("sfg","XY","POLYGON"))) stop("Input 'sfg' object should be a 'polygon'") + if(!all(sapply(c("sfg","XY", "POLYGON"), function(x){is(sfg, x)}))) stop("Input 'sfg' object should be a 'polygon'") rings <- sfg class(rings) <- "list" self$exterior <- GMLLinearRing$new(m=rings[[1]])