Skip to content
Snippets Groups Projects
Commit a6cc1931 authored by BrittainJackson7's avatar BrittainJackson7
Browse files

remove symbols on dataset switch

Fixes #20
parent 0de83ba6
No related branches found
No related tags found
No related merge requests found
......@@ -229,7 +229,6 @@ export default L.Map.AstroMap = L.Map.extend({
this.SLDStyler.symbolize_with_icons(this._geoLayers[i], this);
} else {
this._geoLayers[i].removeFrom(this);
this.SLDStyler.remove_symbols();
}
}
}
......@@ -240,6 +239,7 @@ export default L.Map.AstroMap = L.Map.extend({
if(this._geoLayers[i] && this._geoLayers[i].options.id === collectionId){
let wrappedFeatures = this.cloneWestEast(myFeatures);
this._geoLayers[i].addData(wrappedFeatures);
this.SLDStyler.symbolize_with_icons(this._geoLayers[i], this);
}
}
......
......@@ -125,6 +125,7 @@ L.SLDStyler = L.Class.extend({
}
},
initialize: function(sldStringOrXml, options) {
this.symbols = [];
L.Util.setOptions(this, options);
if (sldStringOrXml !== undefined) {
this.featureTypeStylesNameMap = {};
......@@ -522,15 +523,14 @@ L.SLDStyler = L.Class.extend({
svgElement.innerHTML = symbol;
svgElementBounds = [ [ point.y - 0.05, point.x + 0.05 ], [ point.y , point.x ] ];
L.svgOverlay(svgElement, svgElementBounds).addTo(map);
const addedSymbol = L.svgOverlay(svgElement, svgElementBounds).addTo(map);
this.symbols.push(addedSymbol);
},
remove_symbols: function(){
let element = null
// for (var i in svg_ids)
// {
// element = document.getElementById(i);
// element.remove();
// }
remove_symbols: function(map){
for (var i = 0; i < this.symbols.length; i++) {
this.symbols[i].removeFrom(map);
}
this.symbols = [];
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment