加载map.addPopups后html布局更改

时间:2014-05-13 07:11:48

标签: popup openlayers geoserver getfeatureinfo

我正在使用WMSGetFeatureInfo控件从geoserver中检索要素属性并在弹出窗口中显示。

我已在localhost设置了proxyhost,弹出窗口现在正常工作。我正在使用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

0 个答案:

没有答案