示例#1
0
  private void handleSldFromStyleStore(
      File file,
      String namedLayer,
      Map<String, String> map,
      String layerName,
      Map<String, Pair<File, URL>> legends,
      Map<String, Boolean> glgUrls) {
    // already loaded from workspace
    String styleId = file.getName().substring(0, file.getName().length() - 4);
    StyleStore store = styleManager.get(styleId);

    if (store != null) {
      LOG.info("Using SLD file loaded from style store.");
      for (Style s : store.getAll(namedLayer)) {
        s.setName(map.get(s.getName()));
        registry.put(layerName, s, false);
        Pair<File, URL> p = legends.get(s.getName());
        if (p != null && p.first != null) {
          s.setLegendFile(p.first);
        } else if (p != null) {
          s.setLegendURL(p.second);
        }
        s.setPrefersGetLegendGraphicUrl(
            glgUrls.get(s.getName()) != null && glgUrls.get(s.getName()));
      }
      return;
    }
  }