Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #41

Merged
merged 8 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions R/legend.R
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,10 @@ makeSizeIcons <- function(values,
#'
#' character string of style argument for HTML text
#'
#' @param marker
#'
#' whether to show the marker or only the icon
#'
#' @param orientation
#'
#' stack the legend items vertically or horizontally
Expand Down Expand Up @@ -1337,6 +1341,7 @@ makeSizeIcons <- function(values,
#' labelStyle = 'font-size: 16px;') |>
#' addLegendAwesomeIcon(iconSet = iconSet,
#' orientation = 'vertical',
#' marker = FALSE,
#' title = htmltools::tags$div(
#' style = 'font-size: 20px;',
#' 'Awesome Icons'),
Expand All @@ -1346,6 +1351,7 @@ addLegendAwesomeIcon <- function(map,
title = NULL,
labelStyle = '',
orientation = c('vertical', 'horizontal'),
marker = TRUE,
group = NULL,
className = 'info legend leaflet-control',
...) {
Expand All @@ -1361,13 +1367,16 @@ addLegendAwesomeIcon <- function(map,
Map(icon = iconSet,
label = names(iconSet),
f = function(icon, label) {
markerClass <- ''
if ( marker ) {
markerClass <- sprintf('awesome-marker-icon-%s awesome-marker %s',
icon[['markerColor']],
ifelse(icon[['squareMarker']], 'awesome-marker-square', ''))
}
htmltools::tagList(
wrapElements(
htmltools::tags$div(style = 'vertical-align: middle; display: inline-block; position: relative;',
class =
sprintf('awesome-marker-icon-%s awesome-marker %s',
icon[['markerColor']],
ifelse(icon[['squareMarker']], 'awesome-marker-square', '')),
class = markerClass,
htmltools::tags$i(class = sprintf('%1$s %1$s-%2$s %3$s',
icon[['library']],
icon[['icon']],
Expand Down
51 changes: 11 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,43 +68,14 @@ leaflet() %>%

## Map Symbols

<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Crect%20id%3D%22rect%22%20x%3D%222%22%20y%3D%222%22%20height%3D%2250%22%20width%3D%2250%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Frect%3E%0A%3C%2Fsvg%3E" alt="rect" width="50" height="50" title="rect"/>
<p style="text-align: center;">rect</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Ccircle%20id%3D%22circle%22%20cx%3D%2227%22%20cy%3D%2227%22%20r%3D%2225%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fcircle%3E%0A%3C%2Fsvg%3E" alt="circle" width="50" height="50" title="circle"/>
<p style="text-align: center;">circle</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Cpolygon%20id%3D%22triangle%22%20points%3D%222%2C52%2052%2C52%2027%2C2%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E" alt="triangle" width="50" height="50" title="triangle"/>
<p style="text-align: center;">triangle</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Cpolygon%20id%3D%22plus%22%20points%3D%2222%2C2%2022%2C22%202%2C22%202%2C32%2022%2C32%2022%2C52%2032%2C52%2032%2C32%2052%2C32%2052%2C22%2032%2C22%2032%2C2%2022%2C2%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E" alt="plus" width="50" height="50" title="plus"/>
<p style="text-align: center;">plus</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Cpolygon%20id%3D%22cross%22%20points%3D%229.07106781186548%2C2%202%2C9.07106781186548%2019.9289321881345%2C27%202%2C44.9289321881345%209.07106781186548%2C52%2027%2C34.0710678118655%2044.9289321881345%2C52%2052%2C44.9289321881345%2034.0710678118655%2C27%2052%2C9.07106781186548%2044.9289321881345%2C2%2027%2C19.9289321881345%209.07106781186548%2C2%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E" alt="cross" width="50" height="50" title="cross"/>
<p style="text-align: center;">cross</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Cpolygon%20id%3D%22diamond%22%20points%3D%2227%2C2%202%2C27%2027%2C52%2052%2C27%2027%2C2%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E" alt="diamond" width="50" height="50" title="diamond"/>
<p style="text-align: center;">diamond</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Cpolygon%20id%3D%22star%22%20points%3D%2222%2C2%2022%2C14.92893%209.07107%2C2%202%2C9.07107%2014.92893%2C22%202%2C22%202%2C32%2014.92893%2C32%202%2C44.92893%209.07107%2C52%2022%2C39.07107%2022%2C52%2032%2C52%2032%2C39.07107%2044.92893%2C52%2052%2C44.92893%2039.07107%2C32%2052%2C32%2052%2C22%2039.07107%2C22%2052%2C9.07107%2044.92893%2C2%2032%2C14.92893%2032%2C2%2022%2C2%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E" alt="star" width="50" height="50" title="star"/>
<p style="text-align: center;">star</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Crect%20id%3D%22stadium%22%20x%3D%222%22%20y%3D%222%22%20height%3D%2250%22%20width%3D%2250%22%20rx%3D%2225%25%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Frect%3E%0A%3C%2Fsvg%3E" alt="stadium" width="50" height="50" title="stadium"/>
<p style="text-align: center;">stadium</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Cline%20id%3D%22line%22%20x1%3D%222%22%20x2%3D%2252%22%20y1%3D%2227%22%20y2%3D%2227%22%20stroke%3D%22black%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fline%3E%0A%3C%2Fsvg%3E" alt="line" width="50" height="50" title="line"/>
<p style="text-align: center;">line</p>
</div>
<div style="width: 50px; display: inline-block;">
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20version%3D%221.1%22%20width%3D%2254%22%20height%3D%2254%22%3E%0A%20%20%3Cpolygon%20id%3D%22polygon%22%20points%3D%2227%2C2%203.22358709262116%2C19.2745751406263%2012.3053686926882%2C47.2254248593737%2041.6946313073118%2C47.2254248593737%2050.7764129073788%2C19.2745751406263%2027%2C2%22%20stroke%3D%22black%22%20fill%3D%22transparent%22%20stroke-opacity%3D%221%22%20fill-opacity%3D%221%22%20stroke-width%3D%222%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E" alt="polygon" width="50" height="50" title="polygon"/>
<p style="text-align: center;">polygon</p>
</div>

<img src="man/figures/rect.svg" alt="rect" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/circle.svg" alt="circle" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/triangle.svg" alt="triangle" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/plus.svg" alt="plus" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/cross.svg" alt="cross" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/diamond.svg" alt="diamond" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/star.svg" alt="star" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/stadium.svg" alt="stadium" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/line.svg" alt="line" width = 50 height = 70 style="margin: 5px;"></img>
<img src="man/figures/polygon.svg" alt="polygon" width = 50 height = 70 style="margin: 5px;"></img>
4 changes: 4 additions & 0 deletions man/addLegendAwesomeIcon.Rd

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

4 changes: 4 additions & 0 deletions man/figures/circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/diamond.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/polygon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/rect.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/stadium.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/star.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions man/figures/triangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.