Commit a6cc1931 authored by BrittainJackson7's avatar BrittainJackson7
Browse files

remove symbols on dataset switch

Fixes #20
parent 0de83ba6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
      }
    }
+8 −8
Original line number Diff line number Diff line
@@ -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 = [];
   }
});