Пример #1
0
  private void layer(StringBuilder str, TileLayer layer, String baseurl) {
    str.append("  <Layer>\n");
    LayerMetaInformation layerMeta = layer.getMetaInformation();

    if (layerMeta == null) {
      appendTag(str, "    ", "ows:Title", layer.getName(), null);
    } else {
      appendTag(str, "    ", "ows:Title", layerMeta.getTitle(), null);
      appendTag(str, "    ", "ows:Abstract", layerMeta.getDescription(), null);
    }

    layerWGS84BoundingBox(str, layer);
    appendTag(str, "    ", "ows:Identifier", layer.getName(), null);

    // We need the filters for styles and dimensions
    List<ParameterFilter> filters = layer.getParameterFilters();

    layerStyles(str, layer, filters);

    layerFormats(str, layer);

    layerInfoFormats(str, layer);

    if (filters != null) {
      layerDimensions(str, layer, filters);
    }

    layerGridSubSets(str, layer);
    // TODO REST
    // str.append("    <ResourceURL format=\"image/png\" resourceType=\"tile\"
    // template=\"http://www.maps.cat/wmts/BlueMarbleNextGeneration/default/BigWorldPixel/{TileMatrix}/{TileRow}/{TileCol}.png\"/>\n");
    str.append("  </Layer>\n");
  }
Пример #2
0
 private static String makeModifiableParameters(TileLayer tl) {
   List<ParameterFilter> parameterFilters = tl.getParameterFilters();
   if (parameterFilters == null || parameterFilters.size() == 0) {
     return "";
   }
   parameterFilters = new ArrayList<ParameterFilter>(parameterFilters);
   Collections.sort(
       parameterFilters,
       new Comparator<ParameterFilter>() {
         public int compare(ParameterFilter o1, ParameterFilter o2) {
           return o1.getKey().compareTo(o2.getKey());
         }
       });
   StringBuilder doc = new StringBuilder();
   doc.append("Modifiable Parameters:\n");
   doc.append("<table>\n");
   for (ParameterFilter pf : parameterFilters) {
     Assert.notNull(pf);
     String key = pf.getKey();
     String defaultValue = pf.getDefaultValue();
     List<String> legalValues = pf.getLegalValues();
     doc.append("<tr><td>").append(key.toUpperCase()).append(": ").append("</td><td>");
     String parameterId = key;
     if (pf instanceof StringParameterFilter) {
       Map<String, String> keysValues = makeParametersMap(defaultValue, legalValues);
       makePullDown(doc, parameterId, keysValues, defaultValue);
     } else if (pf instanceof RegexParameterFilter) {
       makeTextInput(doc, parameterId, 25);
     } else if (pf instanceof FloatParameterFilter) {
       FloatParameterFilter floatParam = (FloatParameterFilter) pf;
       if (floatParam.getValues().isEmpty()) {
         // accepts any value
         makeTextInput(doc, parameterId, 25);
       } else {
         Map<String, String> keysValues = makeParametersMap(defaultValue, legalValues);
         makePullDown(doc, parameterId, keysValues, defaultValue);
       }
     } else if ("org.geowebcache.filter.parameters.NaiveWMSDimensionFilter"
         .equals(pf.getClass().getName())) {
       makeTextInput(doc, parameterId, 25);
     } else {
       // Unknown filter type
       if (legalValues == null) {
         // Doesn't have a defined set of values, just provide a text field
         makeTextInput(doc, parameterId, 25);
       } else {
         // Does have a defined set of values, so provide a drop down
         Map<String, String> keysValues = makeParametersMap(defaultValue, legalValues);
         makePullDown(doc, parameterId, keysValues, defaultValue);
       }
     }
     doc.append("</td></tr>\n");
   }
   doc.append("</table>\n");
   return doc.toString();
 }
Пример #3
0
  private void capabilityVendorSpecific(StringBuilder str) {
    str.append("  <VendorSpecificCapabilities>\n");
    Iterable<TileLayer> layerIter = tld.getLayerList();
    for (TileLayer layer : layerIter) {
      if (!layer.isEnabled()) {
        continue;
      }

      for (String gridSetId : layer.getGridSubsets()) {
        GridSubset grid = layer.getGridSubset(gridSetId);

        List<String> formats = new ArrayList<String>(2);

        if (layer.getMimeTypes() != null) {
          for (MimeType mime : layer.getMimeTypes()) {
            formats.add(mime.getFormat());
          }
        } else {
          formats.add(ImageMime.png.getFormat());
          formats.add(ImageMime.jpeg.getFormat());
        }

        List<String> styles = getStyles(layer.getParameterFilters());
        for (String format : formats) {
          for (String style : styles) {
            try {
              capabilityVendorSpecificTileset(str, layer, grid, format, style);
            } catch (GeoWebCacheException e) {
              log.error(e.getMessage());
            }
          }
        }
      }
    }
    str.append("  </VendorSpecificCapabilities>\n");
  }
Пример #4
0
  private void capabilityLayerInner(StringBuilder str, TileLayer layer)
      throws GeoWebCacheException {
    if (layer.isQueryable()) {
      str.append("    <Layer queryable=\"1\">\n");
    } else {
      str.append("    <Layer>\n");
    }

    str.append("      <Name>" + layer.getName() + "</Name>\n");

    if (layer.getMetaInformation() != null) {
      LayerMetaInformation metaInfo = layer.getMetaInformation();
      str.append("      <Title>" + metaInfo.getTitle() + "</Title>\n");
      str.append("      <Abstract>" + metaInfo.getDescription() + "</Abstract>\n");
    } else {
      str.append("      <Title>" + layer.getName() + "</Title>\n");
    }

    TreeSet<SRS> srsSet = new TreeSet<SRS>();
    StringBuilder boundingBoxStr = new StringBuilder();
    for (String gridSetId : layer.getGridSubsets()) {
      GridSubset curGridSubSet = layer.getGridSubset(gridSetId);
      SRS curSRS = curGridSubSet.getSRS();
      if (!srsSet.contains(curSRS)) {
        str.append("      <SRS>" + curSRS.toString() + "</SRS>\n");

        // Save bounding boxes for later
        String[] bs = boundsPrep(curGridSubSet.getCoverageBestFitBounds());
        boundingBoxStr.append(
            "      <BoundingBox SRS=\""
                + curGridSubSet.getSRS().toString()
                + "\" minx=\""
                + bs[0]
                + "\" miny=\""
                + bs[1]
                + "\" maxx=\""
                + bs[2]
                + "\" maxy=\""
                + bs[3]
                + "\"/>\n");

        srsSet.add(curSRS);
      }
    }

    GridSubset epsg4326GridSubSet = layer.getGridSubsetForSRS(SRS.getEPSG4326());
    if (null != epsg4326GridSubSet) {
      String[] bs = boundsPrep(epsg4326GridSubSet.getCoverageBestFitBounds());
      str.append(
          "      <LatLonBoundingBox minx=\""
              + bs[0]
              + "\" miny=\""
              + bs[1]
              + "\" maxx=\""
              + bs[2]
              + "\" maxy=\""
              + bs[3]
              + "\"/>\n");
    }

    // Bounding boxes gathered earlier
    str.append(boundingBoxStr);

    // WMS 1.1 Dimensions
    if (layer.getParameterFilters() != null) {
      StringBuilder dims = new StringBuilder();
      StringBuilder extents = new StringBuilder();
      for (ParameterFilter parameterFilter : layer.getParameterFilters()) {
        if (parameterFilter instanceof WMSDimensionProvider) {
          ((WMSDimensionProvider) parameterFilter).appendDimensionElement(dims, "      ");
          ((WMSDimensionProvider) parameterFilter).appendExtentElement(extents, "      ");
        }
      }

      if (dims.length() > 0 && extents.length() > 0) {
        str.append(dims);
        str.append(extents);
      }
    }

    // TODO style?
    str.append("    </Layer>\n");
  }