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

JS-cleanup #47

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 4 additions & 2 deletions R/glify-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ glifyDependencies = function() {
'3.2.0',
system.file("htmlwidgets/Leaflet.glify", package = "leafgl"),
script = c(
"addGlifyPoints.js"
"GlifyUtils.js"
, "addGlifyPoints.js"
, "addGlifyPolygons.js"
, "addGlifyPolylines.js"
, "glify-browser.js"
Expand All @@ -23,7 +24,8 @@ glifyDependenciesSrc = function() {
'3.2.0',
system.file("htmlwidgets/Leaflet.glify", package = "leafgl"),
script = c(
"addGlifyPointsSrc.js"
"GlifyUtils.js"
, "addGlifyPointsSrc.js"
, "addGlifyPolygonsSrc.js"
, "addGlifyPolylinesSrc.js"
, "glify-browser.js"
Expand Down
15 changes: 15 additions & 0 deletions inst/htmlwidgets/Leaflet.glify/GlifyUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
LeafletWidget.methods.clearGlLayers = function() {
this.layerManager.clearLayers("glify");
};

LeafletWidget.methods.removeGlPolygons = function(layerId) {
this.layerManager.removeLayer("glify", layerId);
};

LeafletWidget.methods.removeGlPolylines = function(layerId) {
this.layerManager.removeLayer("glify", layerId);
};

LeafletWidget.methods.removeGlPoints = function(layerId) {
this.layerManager.removeLayer("glify", layerId);
};
9 changes: 0 additions & 9 deletions inst/htmlwidgets/Leaflet.glify/addGlifyPoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,3 @@ LeafletWidget.methods.addGlifyPoints = function(data, cols, popup, label, opacit
// add layer to map using RStudio leaflet's layerManager
map.layerManager.addLayer(pointslayer.layer, "glify", layerId, group);
};


LeafletWidget.methods.removeGlPoints = function(layerId) {
this.layerManager.removeLayer("glify", layerId);
};

LeafletWidget.methods.clearGlLayers = function() {
this.layerManager.clearLayers("glify");
};
22 changes: 0 additions & 22 deletions inst/htmlwidgets/Leaflet.glify/addGlifyPolygons.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,3 @@ LeafletWidget.methods.addGlifyPolygons = function(data, cols, popup, label, opac

map.layerManager.addLayer(shapeslayer.layer, "glify", layerId, group);
};


LeafletWidget.methods.removeGlPolygons = function(layerId) {
this.layerManager.removeLayer("glify", layerId);
};



function json2table(json, cls) {
var cols = Object.keys(json);
var vals = Object.values(json);

var tab = "";

for (let i = 0; i < cols.length; i++) {
tab += "<tr><th>" + cols[i] + "&emsp;</th>" +
"<td align='right'>" + vals[i] + "&emsp;</td></tr>";
}

return "<table class=" + cls + ">" + tab + "</table>";

}
3 changes: 0 additions & 3 deletions inst/htmlwidgets/Leaflet.glify/addGlifyPolylines.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,4 @@ LeafletWidget.methods.addGlifyPolylines = function(data, cols, popup, label, opa
};


LeafletWidget.methods.removeGlPolylines = function(layerId) {
this.layerManager.removeLayer("glify", layerId);
};

Loading