示例#1
0
  public FeatureCollection getFeatures(
      org.deegree.protocol.wms.ops.GetFeatureInfo gfi, List<String> headers) throws OWSException {
    List<LayerQuery> queries = prepareGetFeatures(gfi);
    List<LayerData> list = new ArrayList<LayerData>();

    double scale =
        calcScaleWMS130(
            gfi.getWidth(),
            gfi.getHeight(),
            gfi.getEnvelope(),
            gfi.getCoordinateSystem(),
            DEFAULT_PIXEL_SIZE);

    ListIterator<LayerQuery> queryIter = queries.listIterator();
    for (LayerRef n : gfi.getQueryLayers()) {
      LayerQuery query = queryIter.next();
      for (org.deegree.layer.Layer l : Themes.getAllLayers(themeMap.get(n.getName()))) {
        if (l.getMetadata().getScaleDenominators().first > scale
            || l.getMetadata().getScaleDenominators().second < scale) {
          continue;
        }

        if (!l.getMetadata().isQueryable()) {
          continue;
        }

        list.add(l.infoQuery(query, headers));
      }
    }

    List<Feature> feats = new ArrayList<Feature>(gfi.getFeatureCount());
    for (LayerData d : list) {
      FeatureCollection col = d.info();
      if (col != null) {
        feats.addAll(col);
      }
    }

    feats = Features.clearDuplicates(feats);

    if (feats.size() > gfi.getFeatureCount()) {
      feats = feats.subList(0, gfi.getFeatureCount());
    }
    GenericFeatureCollection col = new GenericFeatureCollection();
    col.addAll(feats);
    return col;
  }
示例#2
0
  private List<LayerQuery> prepareGetFeatures(org.deegree.protocol.wms.ops.GetFeatureInfo gfi) {
    List<LayerQuery> queries = new ArrayList<LayerQuery>();

    Iterator<LayerRef> layerItr = gfi.getQueryLayers().iterator();
    Iterator<StyleRef> styleItr = gfi.getStyles().iterator();
    List<OperatorFilter> filters = gfi.getFilters();
    Iterator<OperatorFilter> filterItr = filters == null ? null : filters.iterator();
    while (layerItr.hasNext()) {
      LayerRef lr = layerItr.next();
      StyleRef sr = styleItr.next();
      OperatorFilter f = filterItr == null ? null : filterItr.next();
      final int layerRadius = defaultLayerOptions.getFeatureInfoRadius();
      LayerQuery query =
          new LayerQuery(
              gfi.getEnvelope(),
              gfi.getWidth(),
              gfi.getHeight(),
              gfi.getX(),
              gfi.getY(),
              gfi.getFeatureCount(),
              f,
              sr,
              gfi.getParameterMap(),
              gfi.getDimensions(),
              new MapOptionsMaps(),
              gfi.getEnvelope(),
              layerRadius);
      queries.add(query);
    }
    return queries;
  }