コード例 #1
0
  protected static AVList wmsGetParamsFromCapsDoc(Capabilities caps, AVList params) {
    if (caps == null) {
      String message = Logging.getMessage("nullValue.WMSCapabilities");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    if (params == null) {
      String message = Logging.getMessage("nullValue.LayerConfigParams");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    try {
      DataConfigurationUtils.getWMSLayerParams(caps, formatOrderPreference, params);
    } catch (IllegalArgumentException e) {
      String message = Logging.getMessage("WMS.MissingLayerParameters");
      Logging.logger().log(java.util.logging.Level.SEVERE, message, e);
      throw new IllegalArgumentException(message, e);
    } catch (WWRuntimeException e) {
      String message = Logging.getMessage("WMS.MissingCapabilityValues");
      Logging.logger().log(java.util.logging.Level.SEVERE, message, e);
      throw new IllegalArgumentException(message, e);
    }

    setFallbacks(params);

    // Setup WMS URL builder.
    params.setValue(AVKey.WMS_VERSION, caps.getVersion());
    params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(params));
    // Setup default WMS tiled image layer behaviors.
    params.setValue(AVKey.USE_TRANSPARENT_TEXTURES, true);

    return params;
  }
コード例 #2
0
    public URLBuilder(AVList params) {
      this.layerNames = params.getStringValue(AVKey.LAYER_NAMES);
      this.styleNames = params.getStringValue(AVKey.STYLE_NAMES);
      this.imageFormat = params.getStringValue(AVKey.IMAGE_FORMAT);
      this.backgroundColor = params.getStringValue(AVKey.WMS_BACKGROUND_COLOR);
      String version = params.getStringValue(AVKey.WMS_VERSION);

      if (version == null || version.compareTo(MAX_VERSION) >= 0) {
        this.wmsVersion = MAX_VERSION;
        this.crs = "&crs=CRS:84";
      } else {
        this.wmsVersion = version;
        this.crs = "&srs=EPSG:4326";
      }
    }
コード例 #3
0
  protected static void wmsRestoreStateToParams(
      RestorableSupport rs, RestorableSupport.StateObject context, AVList params) {
    // Invoke the BasicTiledImageLayer functionality.
    restoreStateForParams(rs, context, params);
    // Parse any legacy WMSTiledImageLayer state values.
    legacyWmsRestoreStateToParams(rs, context, params);

    String s = rs.getStateValueAsString(context, AVKey.IMAGE_FORMAT);
    if (s != null) params.setValue(AVKey.IMAGE_FORMAT, s);

    s = rs.getStateValueAsString(context, AVKey.TITLE);
    if (s != null) params.setValue(AVKey.TITLE, s);

    s = rs.getStateValueAsString(context, AVKey.DISPLAY_NAME);
    if (s != null) params.setValue(AVKey.DISPLAY_NAME, s);

    RestorableSupport.adjustTitleAndDisplayName(params);

    s = rs.getStateValueAsString(context, AVKey.LAYER_NAMES);
    if (s != null) params.setValue(AVKey.LAYER_NAMES, s);

    s = rs.getStateValueAsString(context, AVKey.STYLE_NAMES);
    if (s != null) params.setValue(AVKey.STYLE_NAMES, s);

    s = rs.getStateValueAsString(context, "wms.Version");
    if (s != null) params.setValue(AVKey.WMS_VERSION, s);
    params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(params));
  }
コード例 #4
0
  protected static void legacyWmsRestoreStateToParams(
      RestorableSupport rs, RestorableSupport.StateObject context, AVList params) {
    // WMSTiledImageLayer has historically used a different format for storing LatLon and Sector
    // properties
    // in the restorable state XML documents. Although WMSTiledImageLayer no longer writes these
    // properties,
    // we must provide support for reading them here.
    Double lat = rs.getStateValueAsDouble(context, AVKey.LEVEL_ZERO_TILE_DELTA + ".Latitude");
    Double lon = rs.getStateValueAsDouble(context, AVKey.LEVEL_ZERO_TILE_DELTA + ".Longitude");
    if (lat != null && lon != null)
      params.setValue(AVKey.LEVEL_ZERO_TILE_DELTA, LatLon.fromDegrees(lat, lon));

    Double minLat = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MinLatitude");
    Double minLon = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MinLongitude");
    Double maxLat = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MaxLatitude");
    Double maxLon = rs.getStateValueAsDouble(context, AVKey.SECTOR + ".MaxLongitude");
    if (minLat != null && minLon != null && maxLat != null && maxLon != null)
      params.setValue(AVKey.SECTOR, Sector.fromDegrees(minLat, maxLat, minLon, maxLon));
  }
コード例 #5
0
  protected static AVList wmsGetParamsFromDocument(Element domElement, AVList params) {
    if (domElement == null) {
      String message = Logging.getMessage("nullValue.DocumentIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    if (params == null) params = new AVListImpl();

    LayerConfiguration.getWMSTiledImageLayerParams(domElement, params);
    BasicTiledImageLayer.getParamsFromDocument(domElement, params);

    params.setValue(AVKey.TILE_URL_BUILDER, new URLBuilder(params));

    return params;
  }