예제 #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 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");
  }