예제 #1
0
  private void dimensionDescription(
      StringBuilder str, ParameterFilter filter, List<String> values) {
    str.append("    <Dimension>");
    str.append("      <Identifier>" + filter.key + "</Identifier>");
    String defaultStr = TileLayer.encodeDimensionValue(filter.defaultValue);
    str.append("      <Default>" + encodeXmlChars(defaultStr) + "</Default>");

    Iterator<String> iter = values.iterator();
    while (iter.hasNext()) {
      String value = TileLayer.encodeDimensionValue(iter.next());
      str.append("      <Value>" + encodeXmlChars(value) + "</Value>");
    }
    str.append("    </Dimension>");
  }
예제 #2
0
  private void layerStyles(StringBuilder str, TileLayer layer, List<ParameterFilter> filters) {
    String defStyle = layer.getStyles();
    if (filters == null) {
      str.append("    <Style isDefault=\"true\">\n");
      str.append(
          "      <ows:Identifier>"
              + TileLayer.encodeDimensionValue(defStyle)
              + "</ows:Identifier>\n");
      str.append("    </Style>\n");
    } else {
      ParameterFilter stylesFilter = null;
      Iterator<ParameterFilter> iter = filters.iterator();
      while (stylesFilter == null && iter.hasNext()) {
        ParameterFilter filter = iter.next();
        if (filter.key.equalsIgnoreCase("STYLES")) {
          stylesFilter = filter;
        }
      }

      if (stylesFilter != null) {
        String defVal = stylesFilter.defaultValue;
        if (defVal == null) {
          if (defStyle != null) {
            defVal = defStyle;
          } else {
            defVal = "";
          }
        }

        Iterator<String> valIter = stylesFilter.getLegalValues().iterator();
        while (valIter.hasNext()) {
          String value = valIter.next();
          if (value.equals(defVal)) {
            str.append("    <Style isDefault=\"true\">\n");
          } else {
            str.append("    <Style>\n");
          }
          str.append(
              "      <ows:Identifier>"
                  + TileLayer.encodeDimensionValue(value)
                  + "</ows:Identifier>\n");
          str.append("    </Style>\n");
        }
      }
    }
  }