我需要在更新地图上显示的地图文件中的饼图大小(在按钮单击上)后刷新一个拓扑图地图。我无法刷新整个页面或丢失数据。它在我改变缩放级别时起作用。我试过map.updateSize()(没有效果),map.render()(TypeError“a”没有定义),layer.redraw()。我不知道我是否缺少某些与openlayers相关的东西,或者如果这是我的javascript问题。我浏览了一些帖子,但似乎无法得到我的案例中的任何答案。更新图表元素后刷新拓扑图地图
$(document).ready(function() {
map = new OpenLayers.Map('map' ,
{ maxExtent: new OpenLayers.Bounds({{bounds.0}}, {{bounds.1}}, {{bounds.2}}, {{bounds.3}}),
controls:[new OpenLayers.Control.Navigation(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.PanZoomBar()],
numZoomLevels:20
}
);
var mpLayer = new OpenLayers.Layer.MapServer('Zones Layer', '{{ mapserverpath }}', {
map:'{{mapFile}}',
layers:'all',
isBaseLayer: 'true'
},{
singleTile: 'true'
// ratio: 2.0
}
);
map.addLayers([mpLayer]);
//map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.zoomToMaxExtent();
map.events.register("click", map, qryDB);
$(document).on('click', '#bttnMinus', function(){
pieFact*=0.5;
updatePieFact();
mpLayer.redraw();
});
$(document).on('click', '#bttnPlus', function(){
pieFact*=1.5;
updatePieFact();
mpLayer.redraw();
});
$(document).on('click', '#bttnReset', function(){
pieFact=1.0;
updatePieFact();
mpLayer.redraw();
});
});