0

实际情况是在 Map 初始化的开头定义了带有附加 CQL 参数的 WMS 请求的定义。

之后选择选择的CQL参数更改时,似乎无法更改初始WMSGetFeatureInfo(WMSGetFeatureInfooptions)。

另一方面,当更改用于显示 WMS 的 CQL 参数时,可以使用 mergeNewParams 在 GWT-OPenLayers 中完成

最终 WMSParams wmsParams = 新 WMSParams(); wmsParams.setCQLFilter(this.makeCqlString()); wmsParams.setParameter(((Double) Math.random()).toString(), ((Double) Math.random()).toString()); this.infoWMS.mergeNewParams(wmsParams);

buildWMSOptions (openLayers) 应该为 wmsGetFeatureInfoOptions 做类似的事情。

4

1 回答 1

0

对问题的回应是重新发布原始 wmsGetFeatureInfo 并在原始 CQL 参数已更改时重新生成它

    public void reDrawInfoLayer()
    {
        final WMSParams wmsParams = new WMSParams();
        wmsParams.setCQLFilter(this.makeCqlString());
        wmsParams.setParameter(((Double) Math.random()).toString(), ((Double) Math.random()).toString());
        this.infoWMS.mergeNewParams(wmsParams);
        this.infoWMS.redraw();

        if (mapPanel.getWmsGetFeatureInfo() != null)
        {
            mapPanel.getWmsGetFeatureInfo().disable();
            mapPanel.getWmsGetFeatureInfo().deactivate();
            mapPanel.getMap().removeControl(mapPanel.getWmsGetFeatureInfo());
        }

        mapPanel.getWmsGetFeatureInfoOptions().setInfoFormat(GetFeatureInfoFormat.GML.toString());
        mapPanel.getWmsGetFeatureInfoOptions().setMaxFeaturess(1);

        // determine the currently visible WMS layers
        final List<WMS> lLayers = this.getVisibleWmsLayers();

        mapPanel.getWmsGetFeatureInfoOptions().setLayers(lLayers.toArray(new WMS[lLayers.size()]));

        // create the WmsGetFeatureInfo
        mapPanel.setWmsGetFeatureInfo(new WMSGetFeatureInfo(mapPanel.getWmsGetFeatureInfoOptions()));
        mapPanel.getMap().addControl(mapPanel.getWmsGetFeatureInfo());
        mapPanel.getWmsGetFeatureInfo().activate();



        // Add get FeatureListener
        mapPanel.getWmsGetFeatureInfo().addGetFeatureListener(new GetFeatureInfoListener()
        {
于 2014-09-18T16:59:10.067 回答