Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Kuethe committed Oct 4, 2024
1 parent 54444f1 commit 8343dad
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 26 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
9 changes: 5 additions & 4 deletions R/add_control.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#' Title
#'
#' @param map
#' @param control_name
#'
#' @return
#' @param .map A [maplibre()] HTML widget
#' @param control_name The name of the control
#' @param control_position The position of the control.
#' @param ... Control options depending on the type of control.
#' @returns The updated [maplibre()] HTML widget
#' @export
#'
#' @examples
Expand Down
18 changes: 9 additions & 9 deletions R/layer.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
#'
#' @export
Layer <- function(type, id, source = NULL, paint = NULL, layout = NULL, ...) {
if(!is.element(type, LayerType)){
if (!is.element(type, LayerType)) {
stop(
glue::glue("type needs to be one of ",
glue::glue_collapse(unlist(maplibre::LayerType), sep = " "),
"\nSee ?maplibre::LayerType for more information."
glue::glue(
"type needs to be one of ",
glue::glue_collapse(unlist(maplibre::LayerType), sep = " "),
"\nSee ?maplibre::LayerType for more information."
)
)
}
types <- list(type = is.character, id = is.character,
source = function(x) {is.list(x) | is.character(x)}, paint = is.list, layout = is.list)

c(rdantic(
list(
type = type,
id = id,
source = source,
paint = paint,
layout = layout
), types
), TYPES_LAYER
), ...) |>
purrr::compact() |>
set_maplibre_class("MapLibreLayer")
Expand Down Expand Up @@ -63,8 +63,8 @@ LayerType <- list(
)
#' Add a layer to map
#'
#' @param .map
#' @param layer
#' @inherit add_control params return
#' @param layer A [Layer()] object
#'
#' @example examples/layers.R
#' @export
Expand Down
5 changes: 4 additions & 1 deletion R/maplibre.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#' Create a Map Object for MapLibre GL
#'
#'
#'
#' @param map_options [mapOptions()]
#' @param width,height The width and the height of the widget.
#' @param elementId The unique ID of the widgets's HTML element.
#' @param ... Further map options.
#' @import htmlwidgets
#'
#' @export
Expand Down
10 changes: 10 additions & 0 deletions R/types.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ TYPES_BASEMAP_STYLE <- list(
sources = is.list,
layers = is.list
)

TYPES_LAYER <- list(
type = is.character,
id = is.character,
source = function(x) {
is.list(x) | is.character(x)
},
paint = is.list,
layout = is.list
)
2 changes: 1 addition & 1 deletion man/Layer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions man/LayerType.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion man/add_control.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion man/add_layer.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/maplibre.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8343dad

Please sign in to comment.