diff --git a/DESCRIPTION b/DESCRIPTION index 60d1ce9db..2c33f680a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -64,5 +64,5 @@ Suggests: RJSONIO, purrr, testthat -RoxygenNote: 5.0.1 +RoxygenNote: 6.0.1 LazyData: true diff --git a/NAMESPACE b/NAMESPACE index 2c0a90379..add9de3e2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ S3method("[",leaflet_awesome_icon_set) S3method("[",leaflet_icon_set) +S3method(metaData,SharedData) S3method(metaData,SpatialLinesDataFrame) S3method(metaData,SpatialPointsDataFrame) S3method(metaData,SpatialPolygonsDataFrame) @@ -9,7 +10,6 @@ S3method(metaData,data.frame) S3method(metaData,list) S3method(metaData,map) S3method(metaData,sf) -S3method(metaData,sharedData) S3method(pointData,POINT) S3method(pointData,SharedData) S3method(pointData,SpatialPoints) diff --git a/R/layers.R b/R/layers.R index b1435aab4..cc48b4126 100644 --- a/R/layers.R +++ b/R/layers.R @@ -1121,8 +1121,11 @@ addPolygons <- function( dashArray = dashArray, smoothFactor = smoothFactor, noClip = noClip )) pgons = derivePolygons(data, lng, lat, missing(lng), missing(lat), "addPolygons") - invokeMethod(map, data, 'addPolygons', pgons, layerId, group, options, popup, popupOptions, safeLabel(label, data), labelOptions, highlightOptions) %>% - expandLimitsBbox(pgons) + invokeMethod( + map, data, 'addPolygons', pgons, layerId, group, options, popup, + popupOptions, safeLabel(label, data), labelOptions, highlightOptions, + getCrosstalkOptions(data) + ) %>% expandLimitsBbox(pgons) } #' @rdname remove diff --git a/R/normalize-SharedData.R b/R/normalize-SharedData.R index 45d06e0f0..5ac833e4b 100644 --- a/R/normalize-SharedData.R +++ b/R/normalize-SharedData.R @@ -1,5 +1,5 @@ #' @export -metaData.sharedData <- function(obj) { +metaData.SharedData <- function(obj) { obj$data(withSelection = TRUE, withFilter = FALSE, withKey = TRUE) } diff --git a/inst/examples/plotly.R b/inst/examples/plotly.R new file mode 100644 index 000000000..826c25f40 --- /dev/null +++ b/inst/examples/plotly.R @@ -0,0 +1,19 @@ +library(crosstalk) +library(plotly) +library(leaflet) + +sd <- SharedData$new(quakes) + +p <- plot_ly(sd, x = ~depth, y = ~mag) %>% + add_markers(alpha = 0.5) %>% + layout(dragmode = "select") %>% + highlight(dynamic = TRUE, persistent = TRUE) + +map <- leaflet(sd) %>% + addTiles() %>% + addCircles() + +# let leaflet know this is persistent selection +options(persistent = TRUE) + +htmltools::browsable(htmltools::tagList(p, map)) diff --git a/inst/htmlwidgets/leaflet.js b/inst/htmlwidgets/leaflet.js index 78317d550..c5de0ceff 100644 --- a/inst/htmlwidgets/leaflet.js +++ b/inst/htmlwidgets/leaflet.js @@ -818,6 +818,8 @@ var LayerManager = function () { // Need to save this info so we know what to set opacity to later layer.options.origOpacity = typeof layer.options.opacity !== "undefined" ? layer.options.opacity : 0.5; layer.options.origFillOpacity = typeof layer.options.fillOpacity !== "undefined" ? layer.options.fillOpacity : 0.2; + layer.options.origColor = typeof layer.options.color !== "undefined" ? layer.options.color : "#03F"; + layer.options.origFillColor = typeof layer.options.fillColor !== "undefined" ? layer.options.fillColor : layer.options.origColor; } var ctg = _this._byCrosstalkGroup[ctGroup]; @@ -856,7 +858,12 @@ var LayerManager = function () { for (var i = 0; i < groupKeys.length; i++) { var key = groupKeys[i]; var _layerInfo3 = _this._byStamp[ctg[key]]; - _this._setOpacity(_layerInfo3, 1.0); + // reset the crosstalk style params + _layerInfo3.layer.options.ctOpacity = undefined; + _layerInfo3.layer.options.ctFillOpacity = undefined; + _layerInfo3.layer.options.ctColor = undefined; + _layerInfo3.layer.options.ctFillColor = undefined; + _this._setStyle(_layerInfo3); } } else { var selectedKeys = {}; @@ -864,10 +871,25 @@ var LayerManager = function () { selectedKeys[e.value[_i3]] = true; } var _groupKeys2 = Object.keys(ctg); + // for compatability with plotly's ability to colour selections + // https://github.com/jcheng5/plotly/blob/71cf8a/R/crosstalk.R#L96-L100 + var selectionColour = crosstalk.group(ctGroup).var("plotlySelectionColour").get(); + var ctOpts = crosstalk.var("plotlyCrosstalkOpts").get() || { opacityDim: 0.2 }; + var persist = ctOpts.persistent === true; for (var _i4 = 0; _i4 < _groupKeys2.length; _i4++) { var _key2 = _groupKeys2[_i4]; var _layerInfo4 = _this._byStamp[ctg[_key2]]; - _this._setOpacity(_layerInfo4, selectedKeys[_groupKeys2[_i4]] ? 1.0 : 0.2); + var selected = selectedKeys[_groupKeys2[_i4]]; + var opts = _layerInfo4.layer.options; + + // remember "old" selection colors if this is persistent selection + _layerInfo4.layer.options.ctColor = selected ? selectionColour : persist ? opts.ctColor : opts.origColor; + _layerInfo4.layer.options.ctFillColor = selected ? selectionColour : persist ? opts.ctFillColor : opts.origFillColor; + + _layerInfo4.layer.options.ctOpacity = selected ? opts.origOpacity : persist && opts.origOpacity == opts.ctOpacity ? opts.origOpacity : ctOpts.opacityDim * opts.origOpacity; + _layerInfo4.layer.options.ctFillOpacity = selected ? opts.origFillOpacity : persist && opts.origFillOpacity == opts.ctFillOpacity ? opts.origFillOpacity : ctOpts.opacityDim * opts.origFillOpacity; + + _this._setStyle(_layerInfo4); } } }; @@ -943,16 +965,18 @@ var LayerManager = function () { } } }, { - key: "_setOpacity", - value: function _setOpacity(layerInfo, opacity) { - if (layerInfo.layer.setOpacity) { - layerInfo.layer.setOpacity(opacity); - } else if (layerInfo.layer.setStyle) { - layerInfo.layer.setStyle({ - opacity: opacity * layerInfo.layer.options.origOpacity, - fillOpacity: opacity * layerInfo.layer.options.origFillOpacity - }); + key: "_setStyle", + value: function _setStyle(layerInfo) { + var opts = layerInfo.layer.options; + if (!layerInfo.layer.setStyle) { + return; } + layerInfo.layer.setStyle({ + opacity: opts.ctOpacity || opts.origOpacity, + fillOpacity: opts.ctFillOpacity || opts.origFillOpacity, + color: opts.ctColor || opts.origColor, + fillColor: opts.ctFillColor || opts.origFillColor + }); } }, { key: "getLayer", @@ -1097,7 +1121,7 @@ var LayerManager = function () { if (layerInfo.ctGroup) { var ctGroup = this._byCrosstalkGroup[layerInfo.ctGroup]; var layersForKey = ctGroup[layerInfo.ctKey]; - var idx = layersForKey ? layersForKey.indexOf(stamp) : -1; + var idx = layersForKey ? layersForKey.indexOf(+stamp) : -1; if (idx >= 0) { if (layersForKey.length === 1) { delete ctGroup[layerInfo.ctKey]; @@ -1605,9 +1629,9 @@ methods.addRectangles = function (lat1, lng1, lat2, lng2, layerId, group, option * @param lat Array of arrays of latitude coordinates for polygons * @param lng Array of arrays of longitude coordinates for polygons */ -methods.addPolygons = function (polygons, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions) { +methods.addPolygons = function (polygons, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions, crosstalkOptions) { if (polygons.length > 0) { - var df = new _dataframe2.default().col("shapes", polygons).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).col("highlightOptions", highlightOptions).cbind(options); + var df = new _dataframe2.default().col("shapes", polygons).col("layerId", layerId).col("group", group).col("popup", popup).col("popupOptions", popupOptions).col("label", label).col("labelOptions", labelOptions).col("highlightOptions", highlightOptions).cbind(options).cbind(crosstalkOptions || {}); addLayers(this, "shape", df, function (df, i) { // This code used to use L.multiPolygon, but that caused @@ -2348,7 +2372,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons // pixel of the original image has some contribution to the downscaled image) // as opposed to a single-step downscaling which will discard a lot of data // (and with sparse images at small scales can give very surprising results). - var Mipmapper = function () { function Mipmapper(img) { _classCallCheck(this, Mipmapper); diff --git a/javascript/src/layer-manager.js b/javascript/src/layer-manager.js index e9ff4ed4b..89edaf53f 100644 --- a/javascript/src/layer-manager.js +++ b/javascript/src/layer-manager.js @@ -95,6 +95,9 @@ export default class LayerManager { // Need to save this info so we know what to set opacity to later layer.options.origOpacity = typeof(layer.options.opacity) !== "undefined" ? layer.options.opacity : 0.5; layer.options.origFillOpacity = typeof(layer.options.fillOpacity) !== "undefined" ? layer.options.fillOpacity : 0.2; + layer.options.origColor = typeof(layer.options.color) !== "undefined" ? layer.options.color : "#03F"; + layer.options.origFillColor = typeof(layer.options.fillColor) !== "undefined" ? layer.options.fillColor : layer.options.origColor; + } let ctg = this._byCrosstalkGroup[ctGroup]; @@ -132,7 +135,12 @@ export default class LayerManager { for (let i = 0; i < groupKeys.length; i++) { let key = groupKeys[i]; let layerInfo = this._byStamp[ctg[key]]; - this._setOpacity(layerInfo, 1.0); + // reset the crosstalk style params + layerInfo.layer.options.ctOpacity = undefined; + layerInfo.layer.options.ctFillOpacity = undefined; + layerInfo.layer.options.ctColor = undefined; + layerInfo.layer.options.ctFillColor = undefined; + this._setStyle(layerInfo); } } else { let selectedKeys = {}; @@ -140,10 +148,35 @@ export default class LayerManager { selectedKeys[e.value[i]] = true; } let groupKeys = Object.keys(ctg); + // for compatability with plotly's ability to colour selections + // https://github.com/jcheng5/plotly/blob/71cf8a/R/crosstalk.R#L96-L100 + let selectionColour = crosstalk.group(ctGroup).var("plotlySelectionColour").get(); + let ctOpts = crosstalk.var("plotlyCrosstalkOpts").get() || {opacityDim: 0.2}; + let persist = ctOpts.persistent === true; for (let i = 0; i < groupKeys.length; i++) { let key = groupKeys[i]; let layerInfo = this._byStamp[ctg[key]]; - this._setOpacity(layerInfo, selectedKeys[groupKeys[i]] ? 1.0 : 0.2); + let selected = selectedKeys[groupKeys[i]]; + let opts = layerInfo.layer.options; + + // remember "old" selection colors if this is persistent selection + layerInfo.layer.options.ctColor = + selected ? selectionColour : + persist ? opts.ctColor : opts.origColor; + layerInfo.layer.options.ctFillColor = + selected ? selectionColour : + persist ? opts.ctFillColor : opts.origFillColor; + + layerInfo.layer.options.ctOpacity = + selected ? opts.origOpacity : + (persist && opts.origOpacity == opts.ctOpacity) ? opts.origOpacity : + ctOpts.opacityDim * opts.origOpacity; + layerInfo.layer.options.ctFillOpacity = + selected ? opts.origFillOpacity : + (persist && opts.origFillOpacity == opts.ctFillOpacity) ? opts.origFillOpacity : + ctOpts.opacityDim * opts.origFillOpacity; + + this._setStyle(layerInfo); } } }; @@ -214,15 +247,17 @@ export default class LayerManager { } } - _setOpacity(layerInfo, opacity) { - if (layerInfo.layer.setOpacity) { - layerInfo.layer.setOpacity(opacity); - } else if (layerInfo.layer.setStyle) { - layerInfo.layer.setStyle({ - opacity: opacity * layerInfo.layer.options.origOpacity, - fillOpacity: opacity * layerInfo.layer.options.origFillOpacity - }); + _setStyle(layerInfo) { + let opts = layerInfo.layer.options; + if (!layerInfo.layer.setStyle) { + return; } + layerInfo.layer.setStyle({ + opacity: opts.ctOpacity || opts.origOpacity, + fillOpacity: opts.ctFillOpacity || opts.origFillOpacity, + color: opts.ctColor || opts.origColor, + fillColor: opts.ctFillColor || opts.origFillColor + }); } getLayer(category, layerId) { @@ -349,7 +384,7 @@ export default class LayerManager { if (layerInfo.ctGroup) { let ctGroup = this._byCrosstalkGroup[layerInfo.ctGroup]; let layersForKey = ctGroup[layerInfo.ctKey]; - let idx = layersForKey ? layersForKey.indexOf(stamp) : -1; + let idx = layersForKey ? layersForKey.indexOf(+stamp) : -1; if (idx >= 0) { if (layersForKey.length === 1) { delete ctGroup[layerInfo.ctKey]; diff --git a/javascript/src/methods.js b/javascript/src/methods.js index abbf73655..8bf258c55 100644 --- a/javascript/src/methods.js +++ b/javascript/src/methods.js @@ -521,7 +521,7 @@ methods.addRectangles = function(lat1, lng1, lat2, lng2, layerId, group, options * @param lat Array of arrays of latitude coordinates for polygons * @param lng Array of arrays of longitude coordinates for polygons */ -methods.addPolygons = function(polygons, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions) { +methods.addPolygons = function(polygons, layerId, group, options, popup, popupOptions, label, labelOptions, highlightOptions, crosstalkOptions) { if(polygons.length>0) { let df = new DataFrame() .col("shapes", polygons) @@ -532,7 +532,8 @@ methods.addPolygons = function(polygons, layerId, group, options, popup, popupOp .col("label", label) .col("labelOptions", labelOptions) .col("highlightOptions", highlightOptions) - .cbind(options); + .cbind(options) + .cbind(crosstalkOptions || {}); addLayers(this, "shape", df, function(df, i) { // This code used to use L.multiPolygon, but that caused diff --git a/man/addAwesomeMarkers.Rd b/man/addAwesomeMarkers.Rd index 21e710728..d6f3a988a 100644 --- a/man/addAwesomeMarkers.Rd +++ b/man/addAwesomeMarkers.Rd @@ -60,4 +60,3 @@ initially, but can be overridden} \description{ Add Awesome Markers } - diff --git a/man/addGraticule.Rd b/man/addGraticule.Rd index a8d38bf7f..be74c8de9 100644 --- a/man/addGraticule.Rd +++ b/man/addGraticule.Rd @@ -36,4 +36,3 @@ leaf <- leaflet() \%>\% addGraticule() } - diff --git a/man/addLayersControl.Rd b/man/addLayersControl.Rd index 61cecbc1d..4c33baf60 100644 --- a/man/addLayersControl.Rd +++ b/man/addLayersControl.Rd @@ -58,4 +58,3 @@ leaflet() \%>\% } } - diff --git a/man/addLegend.Rd b/man/addLegend.Rd index ac40aea50..380192061 100644 --- a/man/addLegend.Rd +++ b/man/addLegend.Rd @@ -128,4 +128,3 @@ leaflet(df) \%>\% transform = function(x) 100 * x )) } - diff --git a/man/addMeasure.Rd b/man/addMeasure.Rd index 0a3bc3d9a..1b7dbc8e4 100644 --- a/man/addMeasure.Rd +++ b/man/addMeasure.Rd @@ -79,4 +79,3 @@ leaf \%>\% addMeasure( ) } - diff --git a/man/addMiniMap.Rd b/man/addMiniMap.Rd index 68daa263b..8318e1621 100644 --- a/man/addMiniMap.Rd +++ b/man/addMiniMap.Rd @@ -87,4 +87,3 @@ leaf <- leaflet() \%>\% \seealso{ \code{\link{providers}} } - diff --git a/man/addProviderTiles.Rd b/man/addProviderTiles.Rd index 453a8888e..eef263de0 100644 --- a/man/addProviderTiles.Rd +++ b/man/addProviderTiles.Rd @@ -45,4 +45,3 @@ leaflet() \%>\% addProviderTiles("Stamen.TonerHybrid") } - diff --git a/man/addRasterImage.Rd b/man/addRasterImage.Rd index e650544fe..d51a95d3f 100644 --- a/man/addRasterImage.Rd +++ b/man/addRasterImage.Rd @@ -73,4 +73,3 @@ crs(r) <- CRS("+init=epsg:4326") leaflet() \%>\% addTiles() \%>\% addRasterImage(r, colors = "Spectral", opacity = 0.8) } - diff --git a/man/addScaleBar.Rd b/man/addScaleBar.Rd index 7eb0e3b36..ecb4cf915 100644 --- a/man/addScaleBar.Rd +++ b/man/addScaleBar.Rd @@ -2,8 +2,8 @@ % Please edit documentation in R/scalebar.R \name{addScaleBar} \alias{addScaleBar} -\alias{removeScaleBar} \alias{scaleBarOptions} +\alias{removeScaleBar} \title{Add or remove a scale bar} \usage{ addScaleBar(map, position = c("topright", "bottomright", "bottomleft", @@ -48,4 +48,3 @@ leaflet() \%>\% } } - diff --git a/man/addSimpleGraticule.Rd b/man/addSimpleGraticule.Rd index 86d4a7baa..af35567a4 100644 --- a/man/addSimpleGraticule.Rd +++ b/man/addSimpleGraticule.Rd @@ -38,4 +38,3 @@ leaflet() \%>\% addSimpleGraticule() } - diff --git a/man/addTerminator.Rd b/man/addTerminator.Rd index aaa9c2795..5fbbb446e 100644 --- a/man/addTerminator.Rd +++ b/man/addTerminator.Rd @@ -34,4 +34,3 @@ leaf <- leaflet() \%>\% addTerminator() } - diff --git a/man/atlStorms2005.Rd b/man/atlStorms2005.Rd index a5e9595ce..3271bfb9b 100644 --- a/man/atlStorms2005.Rd +++ b/man/atlStorms2005.Rd @@ -12,4 +12,3 @@ Atlantic Ocean storms 2005 This dataset contains storm tracks for selected storms in the Atlantic Ocean basin for the year 2005 } - diff --git a/man/awesomeIconList.Rd b/man/awesomeIconList.Rd index ad5a3614a..c66fafeaa 100644 --- a/man/awesomeIconList.Rd +++ b/man/awesomeIconList.Rd @@ -21,4 +21,3 @@ iconSet = awesomeIconList( iconSet[c('home', 'flag')] } - diff --git a/man/awesomeIcons.Rd b/man/awesomeIcons.Rd index c1a8cc0e4..f57d50957 100644 --- a/man/awesomeIcons.Rd +++ b/man/awesomeIcons.Rd @@ -47,4 +47,3 @@ An icon can be represented as a list of the form \code{list(icon, library, icon data. Shorter argument values will be re-cycled. \code{NULL} values for these arguments will be ignored. } - diff --git a/man/breweries91.Rd b/man/breweries91.Rd index 3aabdfcde..a58f0d4e7 100644 --- a/man/breweries91.Rd +++ b/man/breweries91.Rd @@ -14,4 +14,3 @@ subset of a larger database that was compiled by students at the University of Marburg for a seminar called "The Geography of Beer, sustainability in the food industry" } - diff --git a/man/colorNumeric.Rd b/man/colorNumeric.Rd index e16965849..6536ddae9 100644 --- a/man/colorNumeric.Rd +++ b/man/colorNumeric.Rd @@ -1,10 +1,11 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/colors.R \name{colorNumeric} +\alias{colorNumeric} \alias{colorBin} +\alias{colorQuantile} \alias{colorFactor} \alias{colorNumeric} -\alias{colorQuantile} \title{Color mapping} \usage{ colorNumeric(palette, domain, na.color = "#808080", alpha = FALSE, @@ -120,4 +121,3 @@ previewColors(colorFactor("RdYlBu", domain = NULL), factor(LETTERS[1:5], levels= previewColors(colorFactor("RdYlBu", levels = LETTERS), LETTERS[1:5]) } } - diff --git a/man/deprecated.Rd b/man/deprecated.Rd index 6290db916..62f74d6f4 100644 --- a/man/deprecated.Rd +++ b/man/deprecated.Rd @@ -21,4 +21,3 @@ These functions are provided for backwards compatibility with the first iteration of the leaflet bindings (\url{https://github.com/jcheng5/leaflet-shiny}). } - diff --git a/man/derivePoints.Rd b/man/derivePoints.Rd index 557298e40..29ad9c930 100644 --- a/man/derivePoints.Rd +++ b/man/derivePoints.Rd @@ -27,4 +27,3 @@ Given a data object and lng/lat arguments (which may be NULL [meaning infer from data], formula [which should be evaluated with respect to the data], or vector data [which should be used as-is]) return a lng/lat data frame. } - diff --git a/man/derivePolygons.Rd b/man/derivePolygons.Rd index 495122184..39d254de7 100644 --- a/man/derivePolygons.Rd +++ b/man/derivePolygons.Rd @@ -27,4 +27,3 @@ Given a data object and lng/lat arguments (which may be NULL [meaning infer from data], formula [which should be evaluated with respect to the data], or vector data [which should be used as-is]) return a spatial object } - diff --git a/man/dispatch.Rd b/man/dispatch.Rd index 5095ec4c5..af4a5016c 100644 --- a/man/dispatch.Rd +++ b/man/dispatch.Rd @@ -39,4 +39,3 @@ this \code{dispatch} call; for error message purposes} \description{ Extension points for plugins } - diff --git a/man/easyButton.Rd b/man/easyButton.Rd index 1ad708081..9e6c27623 100644 --- a/man/easyButton.Rd +++ b/man/easyButton.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/plugin-easybutton.R \name{easyButtonState} +\alias{easyButtonState} +\alias{easyButton} \alias{addEasyButton} \alias{addEasyButtonBar} -\alias{easyButton} -\alias{easyButtonState} \title{Create an easyButton statestate} \usage{ easyButtonState(stateName, icon, title, onClick) @@ -56,6 +56,7 @@ see \url{https://github.com/CliffCloud/Leaflet.EasyButton} \item \code{addEasyButtonBar}: add an EasyButton to the map }} + \examples{ library(leaflet) @@ -86,4 +87,3 @@ leaf <- leaflet() \%>\% \code{\link{addEasyButton}} } - diff --git a/man/evalFormula.Rd b/man/evalFormula.Rd index 646ed44b1..4636fab64 100644 --- a/man/evalFormula.Rd +++ b/man/evalFormula.Rd @@ -16,4 +16,3 @@ evalFormula(list, data) Evaluate list members that are formulae, using the map data as the environment (if provided, otherwise the formula environment) } - diff --git a/man/expandLimits.Rd b/man/expandLimits.Rd index f41eac401..27d0cf519 100644 --- a/man/expandLimits.Rd +++ b/man/expandLimits.Rd @@ -16,4 +16,3 @@ expandLimits(map, lat, lng) \description{ Notifies the map of new latitude/longitude of items of interest on the map } - diff --git a/man/expandLimitsBbox.Rd b/man/expandLimitsBbox.Rd index d6fca7a26..05b2b0cdb 100644 --- a/man/expandLimitsBbox.Rd +++ b/man/expandLimitsBbox.Rd @@ -16,4 +16,3 @@ expandLimitsBbox(map, poly) Same as expandLimits, but takes a polygon (that presumably has a bbox attr) rather than lat/lng. } - diff --git a/man/filterNULL.Rd b/man/filterNULL.Rd index e084e4b1f..1204a08be 100644 --- a/man/filterNULL.Rd +++ b/man/filterNULL.Rd @@ -12,4 +12,3 @@ filterNULL(x) \description{ remove NULL elements from a list } - diff --git a/man/gadmCHE.Rd b/man/gadmCHE.Rd index 413e3f26e..1aef55318 100644 --- a/man/gadmCHE.Rd +++ b/man/gadmCHE.Rd @@ -15,4 +15,3 @@ Administrative borders of Switzerland (level 1) This dataset comes from \url{http://gadm.org}. It was downloaded using \code{\link{getData}}. } - diff --git a/man/getMapData.Rd b/man/getMapData.Rd index 94a17b5b0..bb2894fa3 100644 --- a/man/getMapData.Rd +++ b/man/getMapData.Rd @@ -12,4 +12,3 @@ getMapData(map) \description{ returns the map's data } - diff --git a/man/iconList.Rd b/man/iconList.Rd index b4be78627..4bd2c2411 100644 --- a/man/iconList.Rd +++ b/man/iconList.Rd @@ -21,4 +21,3 @@ iconSet = iconList( iconSet[c('red', 'green', 'red')] } - diff --git a/man/icons.Rd b/man/icons.Rd index 0cb527660..4ee397379 100644 --- a/man/icons.Rd +++ b/man/icons.Rd @@ -114,4 +114,3 @@ leaflet() \%>\% addMarkers( unlink(iconFiles) # clean up the tmp png files that have been embedded } - diff --git a/man/leaflet.Rd b/man/leaflet.Rd index 755a74c81..e27097d3e 100644 --- a/man/leaflet.Rd +++ b/man/leaflet.Rd @@ -2,8 +2,8 @@ % Please edit documentation in R/leaflet.R \name{leaflet} \alias{leaflet} -\alias{leafletCRS} \alias{leafletOptions} +\alias{leafletCRS} \title{Create a Leaflet map widget} \usage{ leaflet(data = NULL, width = NULL, height = NULL, padding = 0, @@ -97,6 +97,7 @@ formulae will be evaluated in the \code{data}. \item \code{leafletCRS}: class to create a custom CRS }} + \examples{ # !formatR library(leaflet) @@ -262,4 +263,3 @@ m \%>\% addCircleMarkers(~lng, ~lat, radius = ~size, \url{http://leafletjs.com/reference.html#map-options} for details. } - diff --git a/man/leafletDependencies.Rd b/man/leafletDependencies.Rd index 25884f0c7..54d8959ad 100644 --- a/man/leafletDependencies.Rd +++ b/man/leafletDependencies.Rd @@ -20,4 +20,3 @@ addBootStrap <- function(map) { } } \keyword{datasets} - diff --git a/man/leafletProxy.Rd b/man/leafletProxy.Rd index d01619128..cec845f12 100644 --- a/man/leafletProxy.Rd +++ b/man/leafletProxy.Rd @@ -72,4 +72,3 @@ shinyApp(ui, server) } } - diff --git a/man/makeAwesomeIcon.Rd b/man/makeAwesomeIcon.Rd index a0617a997..71f34ac4a 100644 --- a/man/makeAwesomeIcon.Rd +++ b/man/makeAwesomeIcon.Rd @@ -40,4 +40,3 @@ argument of \code{\link{addAwesomeMarkers}()}.} \description{ Make Awesome Icon } - diff --git a/man/makeIcon.Rd b/man/makeIcon.Rd index 3c0771c15..fc9bef26d 100644 --- a/man/makeIcon.Rd +++ b/man/makeIcon.Rd @@ -54,4 +54,3 @@ popups will "open", relative to the icon anchor} \description{ Define icon sets } - diff --git a/man/map-layers.Rd b/man/map-layers.Rd index 0d53a911b..fb991f6ba 100644 --- a/man/map-layers.Rd +++ b/man/map-layers.Rd @@ -1,20 +1,20 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/controls.R, R/layers.R, R/plugin-omnivore.R \name{addControl} -\alias{addCircleMarkers} -\alias{addCircles} \alias{addControl} -\alias{addGeoJSON} -\alias{addLabelOnlyMarkers} +\alias{addTiles} +\alias{addWMSTiles} +\alias{addPopups} \alias{addMarkers} -\alias{addPolygons} +\alias{addLabelOnlyMarkers} +\alias{addCircleMarkers} +\alias{highlightOptions} +\alias{addCircles} \alias{addPolylines} -\alias{addPopups} \alias{addRectangles} -\alias{addTiles} +\alias{addPolygons} +\alias{addGeoJSON} \alias{addTopoJSON} -\alias{addWMSTiles} -\alias{highlightOptions} \title{Graphics elements and layers} \usage{ addControl(map, html, position = c("topleft", "topright", "bottomleft", @@ -241,6 +241,7 @@ Options to highlight shapes (polylines/polygons/circles/rectangles) \item \code{addTopoJSON}: Add TopoJSON layers to the map }} + \references{ The Leaflet API documentation: \url{http://leafletjs.com/reference.html} @@ -250,4 +251,3 @@ The Leaflet API documentation: \code{\link{popupOptions}}, \code{\link{markerOptions}}, \code{\link{pathOptions}} } - diff --git a/man/map-methods.Rd b/man/map-methods.Rd index 010af837c..5c05c846b 100644 --- a/man/map-methods.Rd +++ b/man/map-methods.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/methods.R \name{setView} -\alias{clearBounds} +\alias{setView} \alias{fitBounds} \alias{setMaxBounds} -\alias{setView} +\alias{clearBounds} \title{Methods to manipulate the map widget} \usage{ setView(map, lng, lat, zoom, options = list()) @@ -47,6 +47,7 @@ A series of methods to manipulate the map. automatically determined from latitudes and longitudes of the map elements if available (otherwise the full world view is used) }} + \examples{ library(leaflet) m = leaflet() \%>\% addTiles() \%>\% setView(-71.0382679, 42.3489054, zoom = 18) @@ -57,4 +58,3 @@ m \%>\% clearBounds() # world view \references{ \url{http://leafletjs.com/reference.html#map-set-methods} } - diff --git a/man/map-options.Rd b/man/map-options.Rd index c119ab3ab..2a8680227 100644 --- a/man/map-options.Rd +++ b/man/map-options.Rd @@ -1,13 +1,13 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/layers.R \name{tileOptions} +\alias{tileOptions} \alias{WMSTileOptions} +\alias{popupOptions} \alias{labelOptions} -\alias{markerClusterOptions} \alias{markerOptions} +\alias{markerClusterOptions} \alias{pathOptions} -\alias{popupOptions} -\alias{tileOptions} \title{Extra options for map elements and layers} \usage{ tileOptions(minZoom = 0, maxZoom = 18, maxNativeZoom = NULL, @@ -118,8 +118,8 @@ listed in the layer functions. \item \code{pathOptions}: Options for vector layers (polylines, polygons, rectangles, and circles, etc) }} + \seealso{ \code{\link{leafletCRS}} to map CRS (don't change this if you're not sure what it means) } - diff --git a/man/map-shiny.Rd b/man/map-shiny.Rd index 6a65fc999..bd38a6a76 100644 --- a/man/map-shiny.Rd +++ b/man/map-shiny.Rd @@ -40,4 +40,3 @@ app = shinyApp( if (interactive()) print(app)} } - diff --git a/man/mapOptions.Rd b/man/mapOptions.Rd index 2089402be..019dcd5a4 100644 --- a/man/mapOptions.Rd +++ b/man/mapOptions.Rd @@ -26,4 +26,3 @@ leaflet() \%>\% addPopups(174.7690922, -36.8523071, 'R was born here!') \%>\% mapOptions(zoomToLimits = "first") } - diff --git a/man/previewColors.Rd b/man/previewColors.Rd index 9214856b9..507f76024 100644 --- a/man/previewColors.Rd +++ b/man/previewColors.Rd @@ -17,4 +17,3 @@ An HTML-based list of the colors and values \description{ Color previewing utility } - diff --git a/man/providers.Rd b/man/providers.Rd index e038d57f7..7a093b66b 100644 --- a/man/providers.Rd +++ b/man/providers.Rd @@ -15,4 +15,3 @@ providers List of all providers with their variations } \keyword{datasets} - diff --git a/man/providers.details.Rd b/man/providers.details.Rd index 5d749a778..707ecee27 100644 --- a/man/providers.details.Rd +++ b/man/providers.details.Rd @@ -15,4 +15,3 @@ providers.details List of all providers with their variations and additional info } \keyword{datasets} - diff --git a/man/remove.Rd b/man/remove.Rd index 2edab9e1a..21cfcb925 100644 --- a/man/remove.Rd +++ b/man/remove.Rd @@ -1,28 +1,29 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/controls.R, R/layers.R, R/plugin-measure.R, R/plugin-omnivore.R +% Please edit documentation in R/controls.R, R/layers.R, R/plugin-measure.R, +% R/plugin-omnivore.R \name{removeControl} +\alias{removeControl} \alias{clearControls} -\alias{clearGeoJSON} \alias{clearGroup} +\alias{removeImage} \alias{clearImages} -\alias{clearMarkerClusters} -\alias{clearMarkers} -\alias{clearPopups} -\alias{clearShapes} -\alias{clearTiles} -\alias{clearTopoJSON} \alias{remove} -\alias{removeControl} -\alias{removeGeoJSON} -\alias{removeImage} +\alias{removeTiles} +\alias{clearTiles} +\alias{removePopup} +\alias{clearPopups} \alias{removeMarker} +\alias{clearMarkers} \alias{removeMarkerCluster} +\alias{clearMarkerClusters} \alias{removeMarkerFromCluster} -\alias{removeMeasure} -\alias{removePopup} \alias{removeShape} -\alias{removeTiles} +\alias{clearShapes} +\alias{removeGeoJSON} +\alias{clearGeoJSON} +\alias{removeMeasure} \alias{removeTopoJSON} +\alias{clearTopoJSON} \title{Remove elements from a map} \usage{ removeControl(map, layerId) @@ -100,4 +101,3 @@ When used with a \code{\link{leaflet}}() map object, these functions WMS tile layers are extensions of tile layers, so they can also be removed or cleared via \code{removeTiles()} or \code{clearTiles()}. } - diff --git a/man/safeLabel.Rd b/man/safeLabel.Rd index ef53b8a29..4a4aab84e 100644 --- a/man/safeLabel.Rd +++ b/man/safeLabel.Rd @@ -18,4 +18,3 @@ labels. It prevents strings from unintentionally being treated as HTML when they are intended to be plaintext. } \keyword{internal} - diff --git a/man/showGroup.Rd b/man/showGroup.Rd index da61c683c..35b5e7511 100644 --- a/man/showGroup.Rd +++ b/man/showGroup.Rd @@ -1,8 +1,8 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/layers.R \name{showGroup} -\alias{hideGroup} \alias{showGroup} +\alias{hideGroup} \title{Show or hide layer groups} \usage{ showGroup(map, group) @@ -23,4 +23,3 @@ adding functions. \code{\link{addLayersControl}} to allow users to show/hide layer groups interactively } - diff --git a/man/validateCoords.Rd b/man/validateCoords.Rd index 9474c6c85..086821a27 100644 --- a/man/validateCoords.Rd +++ b/man/validateCoords.Rd @@ -18,4 +18,3 @@ validateCoords(lng, lat, funcName, warn = T) \description{ Utility function to check if a coordinates is valid } -