Commit faffd08a authored by Clark's avatar Clark
Browse files

added nomenclature Layer to overlays

parent 4753b331
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ export default L.Map.AstroMap = L.Map.extend({
    let layers = {
      base: [],
      overlays: [],
      nomenclature: [],
      wfs: []
    };

@@ -218,6 +219,10 @@ export default L.Map.AstroMap = L.Map.extend({
              // Do not add "Show Feature Names" PNG layer.
              if (currentLayer["displayname"] != "Show Feature Names") {
                layers["overlays"].push(currentLayer);
              } else {
                if(currentLayer["layer"] == "NOMENCLATURE"){
                  layers["nomenclature"].push(currentLayer);
                }
              }
            }
          } else {
+25 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ export default L.LayerCollection = L.Class.extend({
      throw "No base layers created. At least one base layer is needed.";
    }
    this.createOverlays(layerInfo["overlays"]);
    this.createNomenclature(layerInfo["nomenclature"])
  },

  /**
@@ -108,6 +109,29 @@ export default L.LayerCollection = L.Class.extend({
    // }
  },
    
  /**
   * @function LayerCollection.prototype.createNomenclatures
   * @description Creates nomenclature layers and adds them to the list of overlays.
   * @param  {List} layers - List of nomenclature information.
   */
    createNomenclature: function(layers){
      for (let i = 0; i < layers.length; i++){
        let layer = layers[i];
        let nomenclature = L.tileLayer.wms(
          String(layer["url"]) + "?map=" + String(layer["map"]),
          {
            layers: String(layer["layer"]),
            transparent: true,
            format: "image/png",
            noWrap: true,
            bounds: [[-90, 360], [90, 0]]
          }
        );
        let name = String(layer["displayname"]);
        this._overlays[name] = nomenclature;
      }
    },
  
  /**
   * @function LayerCollection.prototype.addTo
   * @description Removes the current layers, adds the base layers and overlays to the map, and sets the default layer.