How can one change the buildWMSOptions of the WMSGetFeatureInfo after definition of the control

94 Views Asked by At

The actual case is that a definition of a WMS request with additional CQL parameters is defined in the beginning of the Map initialisation.

When afterwards the CQL parameter change for the selection the initial WMSGetFeatureInfo(wmsGetFeatureInfoOptions) seem not be possible to be changed.

On the other hand when one change the CQL parameter for displaying a WMS this can be done in GWT-OPenLayers with the mergeNewParams

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

The buildWMSOptions (openLayers) should do something similar for the wmsGetFeatureInfoOptions.

1

There are 1 best solutions below

0
eric smets On

The response to the question is to reissue the original wmsGetFeatureInfo and rebuild this when the CQL Parameter has been change on the origina

    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()
        {