0

我正在使用该WMSGetFeatureInfo控件从地理服务器检索要素属性并在弹出窗口中显示。

我已经在本地主机上设置了代理主机,并且弹出窗口现在工作正常。我正在使用eventListeners.

在它执行最后一行之后,map.addPopup(popup)html 文件的布局会发生变化,如附图所示。

代码如下:

shelter_info = new OpenLayers.Control.WMSGetFeatureInfo ({
    url:"http://130.95.44.145:8080/geoserver/Bushfire_Com_Study/wms",
    title: 'Identify features by clicking',
    layers:[evacuation_center],
    queryVisible: true,
    hover: true,
    eventListeners:{
        getfeatureinfo: function(event){
            //only display popup when selected the WMS object
            if (event.text.indexOf("<table class=\"featureInfo\">") != -1) { 
                var popup = new OpenLayers.Popup.FramedCloud(
                    "shelter_popup",
                    map.getLonLatFromPixel(event.xy),
                    null,
                    event.text,
                    null,
                    true,
                    null
                );
                popup.autoSize = true;
                popup.minSize = new OpenLayers.Size(180,180);
                map.addPopup(popup);
            }
        }                     
    }
});

添加弹出窗口之前:
https://flic.kr/p/nACiDZ

添加弹窗后:
https://flic.kr/p/nACqxC

4

0 回答 0