Beispiel #1
0
 public Integer getCascadedHopCount(LayerInfo layer) {
   if (!(layer.getResource() instanceof WMSLayerInfo)) {
     return null;
   }
   WMSLayerInfo wmsLayerInfo = (WMSLayerInfo) layer.getResource();
   Layer wmsLayer;
   int cascaded = 1;
   try {
     wmsLayer = wmsLayerInfo.getWMSLayer(null);
     cascaded = 1 + wmsLayer.getCascaded();
   } catch (IOException e) {
     LOGGER.log(Level.INFO, "Unable to determina WMSLayer cascaded hop count", e);
   }
   return cascaded;
 }
Beispiel #2
0
  /** Returns true if the layer can be queried */
  public boolean isQueryable(LayerInfo layer) {
    try {
      if (layer.getResource() instanceof WMSLayerInfo) {
        WMSLayerInfo info = (WMSLayerInfo) layer.getResource();
        Layer wl = info.getWMSLayer(null);
        if (!wl.isQueryable()) {
          return false;
        }
        WMSCapabilities caps = info.getStore().getWebMapServer(null).getCapabilities();
        OperationType featureInfo = caps.getRequest().getGetFeatureInfo();
        if (featureInfo == null || !featureInfo.getFormats().contains("application/vnd.ogc.gml")) {
          return false;
        }
      }

      return layer.isQueryable();

    } catch (IOException e) {
      LOGGER.log(Level.INFO, "Failed to determin if the layer is queryable, assuming it's not", e);
      return false;
    }
  }