Skip to content

Commit b137413

Browse files
author
dave
committed
2.7.7
1 parent 96f24b7 commit b137413

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: googleway
22
Type: Package
33
Title: Accesses Google Maps APIs to Retrieve Data and Plot Maps
4-
Version: 2.7.6001
5-
Date: 2022-01-24
4+
Version: 2.7.7
5+
Date: 2023-04-11
66
Authors@R: c(
77
person("David", "Cooley", ,"dcooley@symbolix.com.au", role = c("aut", "cre")),
88
person("Paulo", "Barcelos", role = "ctb", comment = "Author of c++ decode_pl"),
@@ -30,7 +30,7 @@ Imports:
3030
scales,
3131
grDevices,
3232
googlePolylines (>= 0.7.1)
33-
RoxygenNote: 7.2.0
33+
RoxygenNote: 7.2.3
3434
BugReports: https://github.com/SymbolixAU/googleway/issues
3535
Suggests:
3636
knitr,

R/google_map.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ google_map <- function(data = NULL,
233233
#' google map view
234234
#'
235235
#' @inheritParams google_map
236+
#' @param map a googleway map object created from google_map()
236237
#'
237238
#' @export
238239
google_map_view <- function(map, location, zoom) {

R/parameter_checks.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ validateAvoid <- function(avoid){
261261
validateBounds <- function(bounds){
262262
if(is.null(bounds)) return(NULL)
263263

264-
if(!class(bounds) == "list" | !all(sapply(bounds, class) == "numeric") | length(bounds) != 2)
264+
if(!is(bounds, "list") | !all(sapply(bounds, inherits, "numeric")) | length(bounds) != 2)
265265
stop("bounds must be a list of length 2, each item being a vector of lat/lon coordinate pairs")
266266

267267
if(!all(sapply(bounds, length) == 2))
@@ -381,7 +381,7 @@ validateLocationBias <- function( point, circle, rectangle ) {
381381
validateLanguage <- function(language){
382382
if(is.null(language)) return(NULL)
383383

384-
if(class(language) != "character" | length(language) > 1){
384+
if(!is(language, "character") | length(language) > 1){
385385
stop("language must be a single string")
386386
}
387387
return(tolower(language))
@@ -614,7 +614,7 @@ validateRankBy <- function(rankby, location, search_string){
614614
validateRegion <- function(region){
615615
if(is.null(region)) return(NULL)
616616

617-
if(class(region) != "character" | length(region) > 1)
617+
if(!is(region, "character") | length(region) > 1)
618618
stop("region must be a two-character string")
619619

620620
return(tolower(region))
@@ -623,7 +623,7 @@ validateRegion <- function(region){
623623
validateResultType <- function(result_type){
624624
if(is.null(result_type)) return(NULL)
625625

626-
if(!class(result_type) == "character")
626+
if(!is(result_type, "character") )
627627
stop("result_type must be a vector of strings")
628628

629629
if(length(result_type) > 1){
@@ -687,7 +687,7 @@ validateWaypoints <- function(waypoints, optimise_waypoints, mode){
687687
if(!mode %in% c("driving", "walking","bicycling"))
688688
stop("waypoints are only valid for driving, walking or bicycling modes")
689689

690-
if(class(waypoints) != "list")
690+
if(!is(waypoints, "list"))
691691
stop("waypoints must be a list")
692692

693693
if(!all(names(waypoints) %in% c("stop", "via")))

R/results_access.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ access_result <- function(res,
5353
.access_result <- function(res, accessor) UseMethod(".access_result")
5454

5555
#' @export
56-
.access_result.character <- function(js, accessor) resultJs(js, jsAccessor(accessor))
56+
.access_result.character <- function(res, accessor) resultJs(res, jsAccessor(accessor))
5757

5858
#' @export
59-
.access_result.list <- function(lst, accessor) resultLst(lst, lstAccessor(accessor))
59+
.access_result.list <- function(res, accessor) resultLst(res, lstAccessor(accessor))
6060

6161
#' @export
6262
.access_result.default <- function(res, accessor) stopMessage(res)

tests/testthat/test-google_map.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ context("Google map")
33
test_that("default options are set", {
44

55
g <- google_map(key = "abc", location = NULL, zoom = NULL, search_box = F, styles = NULL)
6-
expect_true(g$x$zoom == 8)
7-
expect_true(g$x$lat == -37.9)
8-
expect_true(g$x$lng == 144.5)
6+
expect_true(g$x$zoom == 1)
7+
expect_true(g$x$lat == 0)
8+
expect_true(g$x$lng == 0)
99
expect_false(g$x$search_box)
1010
expect_null(g$x$styles)
1111
expect_true(g$dependencies[[1]]$head == "<script src=\"https://maps.googleapis.com/maps/api/js?key=abc&libraries=visualization,geometry,places,drawing\"></script><script type=\"text/javascript\" src=\"https://www.gstatic.com/charts/loader.js\"></script>")
@@ -40,7 +40,8 @@ test_that("attributes and map data is attached", {
4040
expect_true(
4141
all(
4242
attributes(g$x)$names ==
43-
c("lat", "lng","zoom","styles","search_box", "update_map_view", "zoomControl",
43+
c("lat", "lng","zoom", "min_zoom", "max_zoom","mapBounds","styles","search_box",
44+
"update_map_view", "zoomControl",
4445
"mapType", "mapTypeControl", "scaleControl", "streetViewControl", "rotateControl",
4546
"fullscreenControl","event_return_type", "split_view", "split_view_options",
4647
"geolocation")

0 commit comments

Comments
 (0)