Beispiel #1
0
  private LayerQuery buildQuery(
      StyleRef style,
      LayerRef lr,
      MapOptionsMaps options,
      List<MapOptions> mapOptions,
      OperatorFilter f,
      org.deegree.protocol.wms.ops.GetMap gm) {

    for (org.deegree.layer.Layer l : Themes.getAllLayers(themeMap.get(lr.getName()))) {
      insertMissingOptions(
          l.getMetadata().getName(), options, l.getMetadata().getMapOptions(), defaultLayerOptions);
      mapOptions.add(options.get(l.getMetadata().getName()));
    }

    LayerQuery query =
        new LayerQuery(
            gm.getBoundingBox(),
            gm.getWidth(),
            gm.getHeight(),
            style,
            f,
            gm.getParameterMap(),
            gm.getDimensions(),
            gm.getPixelSize(),
            options,
            gm.getQueryBox());
    return query;
  }
Beispiel #2
0
  /**
   * @param conf
   * @param adapter
   * @throws MalformedURLException
   */
  public MapService(ServiceConfigurationType conf, Workspace workspace, int updateSequence)
      throws MalformedURLException {
    this.updateSequence = updateSequence;
    this.registry = new StyleRegistry();

    MapServiceBuilder builder = new MapServiceBuilder(conf);

    defaultLayerOptions = builder.buildMapOptions();

    if (conf != null && conf.getThemeId() != null && !conf.getThemeId().isEmpty()) {
      themes = new ArrayList<Theme>();
      newLayers = new HashMap<String, org.deegree.layer.Layer>();
      themeMap = new HashMap<String, Theme>();
      for (String id : conf.getThemeId()) {
        Theme thm = workspace.getResource(ThemeProvider.class, id);
        if (thm == null) {
          LOG.warn("Theme with id {} was not available.", id);
        } else {
          themes.add(thm);
          themeMap.put(thm.getLayerMetadata().getName(), thm);

          for (org.deegree.layer.Layer l : Themes.getAllLayers(thm)) {
            newLayers.put(l.getMetadata().getName(), l);
          }
          for (Theme theme : Themes.getAllThemes(thm)) {
            themeMap.put(theme.getLayerMetadata().getName(), theme);
          }
        }
      }
    }
    getLegendHandler = new GetLegendHandler(this);
  }
Beispiel #3
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;
  }
Beispiel #4
0
 private void getFeatureTypes(Collection<FeatureType> types, String name) {
   for (org.deegree.layer.Layer l : Themes.getAllLayers(themeMap.get(name))) {
     types.addAll(l.getMetadata().getFeatureTypes());
   }
 }