Skip to content

Commit

Permalink
more brushing extensins for #164
Browse files Browse the repository at this point in the history
  • Loading branch information
dcooley committed Feb 2, 2020
1 parent d3a2837 commit 479eb6b
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 27 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# mapdeck 0.3


* `show_view_state` option to overlay the current View State [issue238](https://github.com/SymbolixAU/mapdeck/issues/238)
* performance improvements for dates and factors [issue235](https://github.com/SymbolixAU/mapdeck/issues/235)
* `add_bitmap()` to add a bitmap / image to the map
Expand Down
1 change: 1 addition & 0 deletions R/map_layer_greatcircle.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ add_greatcircle <- function(
focus_layer = FALSE,
transitions = NULL,
digits = 6
#brush_radius = NULL
) {
brush_radius = NULL

Expand Down
5 changes: 3 additions & 2 deletions R/map_layer_line.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ add_line <- function(
update_view = TRUE,
focus_layer = FALSE,
digits = 6,
transitions = NULL
transitions = NULL,
brush_radius = NULL
) {

l <- list()
Expand Down Expand Up @@ -179,7 +180,7 @@ add_line <- function(
invoke_method(
map, "add_line_geo", map_type( map ), shape[["data"]], layer_id, auto_highlight,
highlight_colour, shape[["legend"]], bbox, update_view, focus_layer,
js_transitions
js_transitions, brush_radius
)
}

Expand Down
5 changes: 3 additions & 2 deletions R/map_layer_mesh.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ add_mesh <- function(
update_view = TRUE,
focus_layer = FALSE,
digits = 6,
transitions = NULL
transitions = NULL,
brush_radius = NULL
) {

#if( is.null( stroke_colour )) stroke_colour <- fill_colour
Expand Down Expand Up @@ -171,7 +172,7 @@ add_mesh <- function(
invoke_method(
map, jsfunc, map_type( map ), shape[["data"]], layer_id, light_settings,
auto_highlight, highlight_colour, shape[["legend"]], bbox, update_view, focus_layer,
js_transitions, is_extruded
js_transitions, is_extruded, brush_radius
)
}

Expand Down
5 changes: 3 additions & 2 deletions R/map_layer_path.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ add_path <- function(
update_view = TRUE,
focus_layer = FALSE,
digits = 6,
transitions = NULL
transitions = NULL,
brush_radius = NULL
) {

l <- list()
Expand Down Expand Up @@ -154,7 +155,7 @@ add_path <- function(
invoke_method(
map, jsfunc, map_type( map ), shape[["data"]], layer_id, auto_highlight,
highlight_colour, shape[["legend"]], bbox, update_view, focus_layer,
js_transitions, billboard
js_transitions, billboard, brush_radius
)
}

Expand Down
5 changes: 3 additions & 2 deletions R/map_layer_polygon.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ add_polygon <- function(
update_view = TRUE,
focus_layer = FALSE,
digits = 6,
transitions = NULL
transitions = NULL,
brush_radius = NULL
) {

#if( is.null( stroke_colour )) stroke_colour <- fill_colour
Expand Down Expand Up @@ -218,7 +219,7 @@ add_polygon <- function(
invoke_method(
map, jsfunc, map_type( map ), shape[["data"]], layer_id, light_settings,
auto_highlight, highlight_colour, shape[["legend"]], bbox, update_view, focus_layer,
js_transitions, is_extruded, elevation_scale
js_transitions, is_extruded, elevation_scale, brush_radius
)
}

Expand Down
24 changes: 20 additions & 4 deletions inst/htmlwidgets/lib/line/line.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

function add_line_geo( map_id, map_type, line_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition ) {
function add_line_geo( map_id, map_type, line_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, brush_radius ) {

var extensions = [];

if ( brush_radius > 0 ) {
extensions.push( new BrushingExtension() );
}

const lineLayer = new LineLayer({
map_id: map_id,
id: 'line-'+layer_id,
Expand All @@ -17,7 +23,9 @@ function add_line_geo( map_id, map_type, line_data, layer_id, auto_highlight, hi
onHover: md_update_tooltip,
autoHighlight: auto_highlight,
highlightColor: md_hexToRGBA( highlight_colour ),
transitions: js_transition || {}
transitions: js_transition || {},
brushingRadius: brush_radius,
extensions: extensions
});

if( map_type == "google_map") {
Expand All @@ -33,8 +41,14 @@ function add_line_geo( map_id, map_type, line_data, layer_id, auto_highlight, hi
}


function add_line_polyline( map_id, map_type, line_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition ) {
function add_line_polyline( map_id, map_type, line_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, brush_radius ) {

var extensions = [];

if ( brush_radius > 0 ) {
extensions.push( new BrushingExtension() );
}

const lineLayer = new LineLayer({
map_id: map_id,
id: 'line-'+layer_id,
Expand All @@ -51,7 +65,9 @@ function add_line_polyline( map_id, map_type, line_data, layer_id, auto_highligh
onHover: md_update_tooltip,
autoHighlight: auto_highlight,
highlightColor: md_hexToRGBA( highlight_colour ),
transitions: js_transition || {}
transitions: js_transition || {},
brushingRadius: brush_radius,
extensions: extensions
});

if( map_type == "google_map") {
Expand Down
11 changes: 9 additions & 2 deletions inst/htmlwidgets/lib/mesh/mesh.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function add_mesh( map_id, map_type, polygon_data, layer_id, light_settings, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, is_extruded ) {
function add_mesh( map_id, map_type, polygon_data, layer_id, light_settings, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, is_extruded, brush_radius ) {


/*
Expand Down Expand Up @@ -34,6 +34,11 @@ function add_mesh( map_id, map_type, polygon_data, layer_id, light_settings, aut
MeshLayer.layerName = 'MeshLayer';
*/

var extensions = [];

if ( brush_radius > 0 ) {
extensions.push( new BrushingExtension() );
}

const meshLayer = new PolygonLayer({
map_id: map_id,
Expand All @@ -55,7 +60,9 @@ function add_mesh( map_id, map_type, polygon_data, layer_id, light_settings, aut
highlightColor: md_hexToRGBA( highlight_colour ),
onHover: md_update_tooltip,
onClick: info => md_layer_click( map_id, "mesh", info ),
transitions: js_transition || {}
transitions: js_transition || {},
brushingRadius: brush_radius,
extensions: extensions
});

console.log( meshLayer );
Expand Down
25 changes: 20 additions & 5 deletions inst/htmlwidgets/lib/path/path.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@


function add_path_geo( map_id, map_type, path_data, layer_id, auto_highlight, highlight_colour,
legend, bbox, update_view, focus_layer, js_transition, billboard ) {
function add_path_geo( map_id, map_type, path_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, billboard, brush_radius ) {

var extensions = [];

if ( brush_radius > 0 ) {
extensions.push( new BrushingExtension() );
}

const pathLayer = new PathLayer({
map_id: map_id,
Expand All @@ -23,7 +28,9 @@ legend, bbox, update_view, focus_layer, js_transition, billboard ) {
onHover: md_update_tooltip,
autoHighlight: auto_highlight,
highlightColor: md_hexToRGBA( highlight_colour ),
transitions: js_transition || {}
transitions: js_transition || {},
brushingRadius: brush_radius,
extensions: extensions
});

if( map_type == "google_map") {
Expand All @@ -38,7 +45,13 @@ legend, bbox, update_view, focus_layer, js_transition, billboard ) {
md_layer_view( map_id, map_type, layer_id, focus_layer, bbox, update_view );
}

function add_path_polyline( map_id, map_type, path_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, billboard ) {
function add_path_polyline( map_id, map_type, path_data, layer_id, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, billboard, brush_radius ) {

var extensions = [];

if ( brush_radius > 0 ) {
extensions.push( new BrushingExtension() );
}

const pathLayer = new PathLayer({
map_id: map_id,
Expand All @@ -60,7 +73,9 @@ function add_path_polyline( map_id, map_type, path_data, layer_id, auto_highligh
onHover: md_update_tooltip,
autoHighlight: auto_highlight,
highlightColor: md_hexToRGBA( highlight_colour ),
transitions: js_transition || {}
transitions: js_transition || {},
brushingRadius: brush_radius,
extensions: extensions
});

if( map_type == "google_map") {
Expand Down
24 changes: 20 additions & 4 deletions inst/htmlwidgets/lib/polygon/polygon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

function add_polygon_geo( map_id, map_type, polygon_data, layer_id, light_settings, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, is_extruded, elevation_scale ) {
function add_polygon_geo( map_id, map_type, polygon_data, layer_id, light_settings, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, is_extruded, elevation_scale, brush_radius ) {

var extensions = [];

if ( brush_radius > 0 ) {
extensions.push( new BrushingExtension() );
}

const polygonLayer = new PolygonLayer({
map_id: map_id,
Expand All @@ -22,7 +28,9 @@ function add_polygon_geo( map_id, map_type, polygon_data, layer_id, light_settin
highlightColor: md_hexToRGBA( highlight_colour ),
onHover: md_update_tooltip,
onClick: info => md_layer_click( map_id, "polygon", info ),
transitions: js_transition || {}
transitions: js_transition || {},
brushingRadius: brush_radius,
extensions: extensions
});

if( map_type == "google_map") {
Expand All @@ -39,7 +47,13 @@ function add_polygon_geo( map_id, map_type, polygon_data, layer_id, light_settin
}


function add_polygon_polyline( map_id, map_type, polygon_data, layer_id, light_settings, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, is_extruded, elevation_scale ) {
function add_polygon_polyline( map_id, map_type, polygon_data, layer_id, light_settings, auto_highlight, highlight_colour, legend, bbox, update_view, focus_layer, js_transition, is_extruded, elevation_scale, brush_radius ) {

var extensions = [];

if ( brush_radius > 0 ) {
extensions.push( new BrushingExtension() );
}

const polygonLayer = new PolygonLayer({
map_id: map_id,
Expand All @@ -62,7 +76,9 @@ function add_polygon_polyline( map_id, map_type, polygon_data, layer_id, light_s
highlightColor: md_hexToRGBA( highlight_colour ),
onHover: md_update_tooltip,
onClick: info => md_layer_click( map_id, "polygon", info ),
transitions: js_transition || {}
transitions: js_transition || {},
brushingRadius: brush_radius,
extensions: extensions
});

if( map_type == "google_map") {
Expand Down
4 changes: 4 additions & 0 deletions man/add_column.Rd

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

6 changes: 5 additions & 1 deletion man/add_line.Rd

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

6 changes: 5 additions & 1 deletion man/add_mesh.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_path.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/add_pointcloud.Rd

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

6 changes: 5 additions & 1 deletion man/add_polygon.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/add_scatterplot.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/add_text.Rd

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

0 comments on commit 479eb6b

Please sign in to comment.