Skip to content

Commit

Permalink
2.7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dave committed Apr 10, 2023
1 parent 96f24b7 commit b137413
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: googleway
Type: Package
Title: Accesses Google Maps APIs to Retrieve Data and Plot Maps
Version: 2.7.6001
Date: 2022-01-24
Version: 2.7.7
Date: 2023-04-11
Authors@R: c(
person("David", "Cooley", ,"[email protected]", role = c("aut", "cre")),
person("Paulo", "Barcelos", role = "ctb", comment = "Author of c++ decode_pl"),
Expand Down Expand Up @@ -30,7 +30,7 @@ Imports:
scales,
grDevices,
googlePolylines (>= 0.7.1)
RoxygenNote: 7.2.0
RoxygenNote: 7.2.3
BugReports: https://github.com/SymbolixAU/googleway/issues
Suggests:
knitr,
Expand Down
1 change: 1 addition & 0 deletions R/google_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ google_map <- function(data = NULL,
#' google map view
#'
#' @inheritParams google_map
#' @param map a googleway map object created from google_map()
#'
#' @export
google_map_view <- function(map, location, zoom) {
Expand Down
10 changes: 5 additions & 5 deletions R/parameter_checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ validateAvoid <- function(avoid){
validateBounds <- function(bounds){
if(is.null(bounds)) return(NULL)

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

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

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

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

return(tolower(region))
Expand All @@ -623,7 +623,7 @@ validateRegion <- function(region){
validateResultType <- function(result_type){
if(is.null(result_type)) return(NULL)

if(!class(result_type) == "character")
if(!is(result_type, "character") )
stop("result_type must be a vector of strings")

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

if(class(waypoints) != "list")
if(!is(waypoints, "list"))
stop("waypoints must be a list")

if(!all(names(waypoints) %in% c("stop", "via")))
Expand Down
4 changes: 2 additions & 2 deletions R/results_access.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ access_result <- function(res,
.access_result <- function(res, accessor) UseMethod(".access_result")

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

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

#' @export
.access_result.default <- function(res, accessor) stopMessage(res)
Expand Down
9 changes: 5 additions & 4 deletions tests/testthat/test-google_map.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ context("Google map")
test_that("default options are set", {

g <- google_map(key = "abc", location = NULL, zoom = NULL, search_box = F, styles = NULL)
expect_true(g$x$zoom == 8)
expect_true(g$x$lat == -37.9)
expect_true(g$x$lng == 144.5)
expect_true(g$x$zoom == 1)
expect_true(g$x$lat == 0)
expect_true(g$x$lng == 0)
expect_false(g$x$search_box)
expect_null(g$x$styles)
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>")
Expand Down Expand Up @@ -40,7 +40,8 @@ test_that("attributes and map data is attached", {
expect_true(
all(
attributes(g$x)$names ==
c("lat", "lng","zoom","styles","search_box", "update_map_view", "zoomControl",
c("lat", "lng","zoom", "min_zoom", "max_zoom","mapBounds","styles","search_box",
"update_map_view", "zoomControl",
"mapType", "mapTypeControl", "scaleControl", "streetViewControl", "rotateControl",
"fullscreenControl","event_return_type", "split_view", "split_view_options",
"geolocation")
Expand Down

0 comments on commit b137413

Please sign in to comment.