gwt - How to clear and redraw the entire map -
i using gwt , google maps api v3. able render map inside simple panel overlays custom shapes. if new query provided want clear panel , render map again.
public resultspanel(scolopaxcontroller _controller, scolopaxconstants _constants) { super(); controller = _controller; layout = new simplepanel(); paging = new horizontalpanel(); paging.setwidth("100%"); paging.setspacing(0); layout.add(paging); this.setwidget(paging); } //after processing values in server method called public void setplots(plotsetoutput result) { this.page = 1; this.loadmapapi(result); controller.getscolopaxgui().addresultstab(); } private void loadmapapi(final plotsetoutput result) { paging.clear(); // not work // load libs use in maps arraylist<loadlibrary> loadlibraries = new arraylist<loadapi.loadlibrary>(); loadlibraries.add(loadlibrary.adsense); loadlibraries.add(loadlibrary.drawing); loadlibraries.add(loadlibrary.geometry); loadlibraries.add(loadlibrary.panoramio); loadlibraries.add(loadlibrary.places); loadlibraries.add(loadlibrary.weather); loadlibraries.add(loadlibrary.visualization); runnable onload = new runnable() { @override public void run() { draw(result); } }; loadapi.go(onload, loadlibraries, sensor); } private void draw(plotsetoutput result) { drawheatmap(result); } private void addmapwidget(widget widget) { paging.add(widget); } private void drawheatmap(plotsetoutput result) { displayonmap wmap = new displayonmap(result); addmapwidget(wmap); }
this displayonmap method
private final verticalpanel pwidget; private mapwidget mapwidget; private static rectangle rectangle; private static final latlng uscenter = latlng.newinstance(33.68,-116.17); public displayonmap(plotsetoutput result) { pwidget = new verticalpanel(); initwidget(pwidget); draw(result); } private void draw(plotsetoutput result) { mapoptions mapopts = mapoptions.newinstance(); mapopts.setzoom(4); mapopts.setcenter(uscenter); mapopts.setmaptypeid(maptypeid.terrain); mapwidget = new mapwidget(mapopts); pwidget.add(mapwidget); mapwidget.setsize("800px", "800px"); .... }
i tried clear pagging panel when server called setplots method. tried clear pwidget panel nothing works. output looks when second query called
Comments
Post a Comment