Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mtennekes committed Feb 9, 2024
1 parent 05a9db2 commit e69de4c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 21 deletions.
23 changes: 10 additions & 13 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
# Generated by roxygen2: do not edit by hand


if(getRversion() >= "3.6.0") {
S3method(knitr::knit_print, tmap)
} else {
export(knit_print.tmap)
}

if(getRversion() >= "3.6.0") {
S3method(knitr::knit_print, tmap_arrange)
} else {
export(knit_print.tmap_arrange)
}
S3method("+",tmap)
S3method(print,tm_element)
S3method(print,tm_shape)
Expand Down Expand Up @@ -210,6 +198,16 @@ export(tmap_save)
export(tmap_style)
export(ttm)
export(ttmp)
if(getRversion() >= "3.6.0") {
S3method(knitr::knit_print, tmap)
} else {
export(knit_print.tmap)
}
if(getRversion() >= "3.6.0") {
S3method(knitr::knit_print, tmap_arrange)
} else {
export(knit_print.tmap_arrange)
}
import(classInt)
import(cols4all)
import(data.table)
Expand All @@ -235,7 +233,6 @@ importFrom(grDevices,dev.size)
importFrom(grDevices,png)
importFrom(grDevices,rgb)
importFrom(htmlwidgets,saveWidget)
importFrom(leaflet,providers)
importFrom(rlang,expr)
importFrom(rlang,missing_arg)
importFrom(utils,browseURL)
7 changes: 4 additions & 3 deletions R/process_meta.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,11 @@ process_meta = function(o, d, cdt, aux) {
o[paste0("grid.", names(a))] = a
}

bbx = d$bbox[[1]]

# add credits into to o (for view mode in order to reset default attribution text)
cid = which(vapply(cdt$comp, FUN = inherits, "tm_credits", FUN.VALUE = logical(1)))[1]
o$credits.defined = (!is.na(cid))


bbx = d$bbox[[1]]

within(o, {
# sasp shape aspect ratio (NA if free coordinates)
Expand Down
9 changes: 8 additions & 1 deletion R/tmapLeafletAux.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ tmapLeafletTiles = function(bi, bbx, facet_row, facet_col, facet_page, id, pane,

tiles = .TMAP_LEAFLET$tiles[[id]][[bi]]

for (s in tiles$server) lf = leaflet::addProviderTiles(lf, provider = s, group = s)
if (o$credits.defined) {
opt = list(attribution = "")
} else {
opt = list()
}

for (s in tiles$server) lf = leaflet::addProviderTiles(lf, provider = s, group = s, options = opt)

assign_lf(lf, facet_row, facet_col, facet_page)
NULL
}
Expand Down
7 changes: 4 additions & 3 deletions R/tmapLeafletComp.R
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ tmapLeafletLegPlot.tm_scalebar = function(comp, lf, o) {

#' @export
tmapLeafletCompPrepare.tm_credits = function(comp, o) {
comp$show = TRUE
comp
}

Expand All @@ -126,9 +127,9 @@ tmapLeafletCompWidth.tm_credits = function(comp, o) {

#' @export
tmapLeafletLegPlot.tm_credits = function(comp, lf, o) {
#lf %>% leafem::addLogo(system.file(paste0("img/credits_", comp$type, ".png"), package = "tmap"), src = "local", position = paste(unlist(comp$position[c("pos.v", "pos.h")]), collapse = ""), width = 120, height = 120)
message("tm_credits not implemented yet for view mode")
lf
#lf %>% leafem::addLogo(system.file(paste0("img/credits_", comp$type, ".png"), package = "tmsap"), src = "local", position = paste(unlist(comp$position[c("pos.v", "pos.h")]), collapse = ""), width = 120, height = 120)
#message("tm_credits not implemented yet for view mode")
lf %>% leaflet::addTiles(urlTemplate = "", attribution = comp$text)
}


Expand Down
2 changes: 1 addition & 1 deletion R/tmapLeafletInit.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tmapLeafletInit = function(o, return.asp = FALSE, vp) {
if (!is.na(o$set.zoom.limits[1])) leaflet_opts$minZoom = o$set.zoom.limits[1]
if (!is.na(o$set.zoom.limits[2])) leaflet_opts$maxZoom = o$set.zoom.limits[2]

leaflet_opts$attributionControl = FALSE
leaflet_opts$attributionControl = TRUE



Expand Down

0 comments on commit e69de4c

Please sign in to comment.