-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into osm_buildings # Conflicts: # .Rbuildignore # DESCRIPTION # NAMESPACE # man/leaflet.extras2.Rd # tests/testthat.R
- Loading branch information
Showing
266 changed files
with
26,078 additions
and
81,331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: Bug report or feature request | ||
about: Describe a bug you've seen or make a case for a new feature | ||
--- | ||
|
||
Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on <https://stackoverflow.com/> or <https://community.rstudio.com/>. | ||
|
||
Please include a minimal reproducible example (AKA a reprex). If you've never heard of a [reprex](http://reprex.tidyverse.org/) before, start by reading <https://www.tidyverse.org/help/#reprex>. | ||
|
||
Brief description of the problem | ||
|
||
```r | ||
# insert reprex here | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. | ||
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
|
||
name: R-CMD-check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: windows-latest, r: 'release'} | ||
- {os: macOS-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
args: 'c("--no-manual", "--as-cran")' | ||
upload-snapshots: true | ||
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::pkgdown, local::. | ||
needs: website | ||
|
||
- name: Build site | ||
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | ||
shell: Rscript {0} | ||
|
||
- name: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/[email protected] | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
.Rproj.user | ||
newfeatures/ | ||
node_modules/ | ||
docs/ | ||
bower_components/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
Package: leaflet.extras2 | ||
Type: Package | ||
Title: Extra Functionality for 'leaflet' Package | ||
Version: 1.0.0 | ||
Version: 1.2.2.9000 | ||
Authors@R: c( | ||
person("Gatscha", "Sebastian", email = "[email protected]", role = c("aut", "cre")) | ||
person("Gatscha", "Sebastian", email = "[email protected]", role = c("aut", "cre")), | ||
person("Ricardo Rodrigo", "Basa", email = "[email protected]", role = c("ctb")), | ||
person(c("Jeffrey", "O"), "Hanson", email = "[email protected]", role = c("ctb"), comment = c(ORCID = "0000-0002-4716-6134")) | ||
) | ||
Description: This package serves as an add-on to the 'leaflet' package by | ||
providing extra functionality via 'leaflet' plugins. | ||
Description: Several 'leaflet' plugins are integrated, which are available as extension to the 'leaflet' package. | ||
License: GPL-3 | file LICENSE | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Depends: | ||
R (>= 3.1.0), | ||
R (>= 3.5.0), | ||
leaflet (>= 2.0.0) | ||
Imports: | ||
htmlwidgets, | ||
htmltools, | ||
shiny, | ||
jsonlite, | ||
magrittr | ||
magrittr, | ||
utils | ||
Suggests: | ||
jsonlite, | ||
shiny, | ||
sf, | ||
geojsonsf, | ||
sp, | ||
testthat (>= 3.0.0) | ||
URL: https://github.com/trafficonese/leaflet.extras2 | ||
testthat (>= 2.1.0), | ||
fontawesome, | ||
htmlwidgets, | ||
covr, | ||
curl | ||
URL: https://trafficonese.github.io/leaflet.extras2/, https://github.com/trafficonese/leaflet.extras2 | ||
BugReports: https://github.com/trafficonese/leaflet.extras2/issues | ||
RoxygenNote: 7.3.1 | ||
Config/testthat/edition: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
## How to include a new plugin ❓ | ||
|
||
------ | ||
|
||
Fork this repo on your computer and create a **new branch** with the plugin name. | ||
|
||
The plugin [leaflet-arrowheads](https://github.com/slutske22/leaflet-arrowheads) will serve as example for this tutorial. | ||
|
||
1. Create a **new directory** in `./inst/htmlwidgets/` with the prefix `lfx-` and the plugin name. This snippet will do that for you: | ||
|
||
usethis::use_directory("/inst/htmlwidgets/lfx-arrowhead") | ||
|
||
2. Install the **dependencies** via `npm`/`bower` etc if available. If the package cannot be installed, either fork/download the plugin-repo or copy/paste the JavaScript code manually. This plugin can be installed and requires 2 dependencies. I installed them with: | ||
|
||
npm install leaflet-arrowheads --save | ||
npm install leaflet-geometryutil --save | ||
This will add the dependencies in the directory `./node_modules/`. Find the directories with the source files and copy those into the new directory `lfx-arrowhead`. In this case the files: **leaflet.geometryutil.js** and **leaflet-arrowheads.js** | ||
|
||
3. Create a **new R-file** with the name of the plugin in `./R/`. In this case `arrowhead.R` or copy/paste another R-file and rename it accordingly. I copy/pasted the `antpath.R` file and search/replaced `antpath` with `arrowhead` and `Antpath` with `Arrowhead` and adapted the functions and options according to the plugin. | ||
|
||
4. Add a **JavaScript-binding** file in the directory `/inst/htmlwidgets/lfx-arrowhead`. Look at other plugins and their bindings for references and examples. In the beginning I use a lot of `console.log()` and `debugger` statements in the JS-methods to get an idea what the data looks like, if all arguments are passed correctly, etc. In this case I also copy/pasted the file `lfx-ant-path-bindings.js`, renamed it `leaflet-arrowheads-bindings.js` and adapted the JavaScript code. | ||
If the plugin exposes several methods, you can/should write an R-function for every JS-method. The R-function calls the JS-method with `invokeMethod` where the argument *method* should correspond to the JavaScript method you want to invoke. The arrowheads-plugin has the method **deleteArrowheads**. I used that method for two R and JS functions, one where you can remove the arrowheads by **group** (`clearArrowhead`) and one by **layerId** (`removeArrowhead`). In the JS methods `this` always refers to the map-object. If needed, you can also use the `LeafletWidget` object from R-leaflet and the `L` object by leaflet itself. | ||
|
||
5. Add an **example** in `./inst/examples/`. I use this directory to demonstrate/test the plugins in **ShinyApps**. Non-interactive examples go straight in the documentation of the function. | ||
|
||
6. Add a **test** in `./tests/testthat/` or use this function `usethis::use_test("arrowhead")` | ||
|
||
7. **Check** the package and run `devtools::test_coverage()` and try to test all R-code lines. ✅ | ||
You can also check the coverage of just one file with `devtools::test_coverage_file(paste0(getwd(),"/tests/testthat/test-arrowhead.R"))`. You may have to load some libraries manually before that. | ||
|
||
8. Add the new plugin in the **README.md** with a link to the github repo. | ||
|
||
8. Add a short description in the **NEWS.md** file that this plugin is now available. | ||
|
||
9. Add the plugin in the `_pkgdown.yml` file and make sure it matches all functions. | ||
|
||
10. If everything works correctly, push it to your fork and **open a PR**. I will be happy to merge it as soon as possible! 💚 | ||
🤷 If you're stuck somewhere in the process and you just can't get it to work, you can still open a PR and explain what the problem is. I will look into it. | ||
|
||
11. 🎉 Celebrate and use it 🏆 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.