|
From: Hutchins, M. C. <Cha...@nr...> - 2011-09-30 23:24:37
|
Jon,
I do not think MapWidget's removeFromParent() does the trick. When I was using extgwt I removed the widget through the container's method (A TabPanel which contained a Panel that wrapped the MapWidget. Made it easier for resize) and just created a new MapWidget for the new projection and attached it.
So, trying to pseudo code SmartGWT (which I am not versed in):
mapPanel.removeMember(Old MapWidget or the Widget that contains it);
MapWidget mapWidgetNew = new MapWidget("100%", "100%", mapOptions);
mapPanel.addMember(mapWidgetNew);
May be removeFromParent() doesn't work because it's not a direct subclass of Widget? I'm not sure but that is what I did with ExtGWT.
Chad
From: Jon Britton [mailto:jon...@go...]
Sent: Friday, September 30, 2011 8:43 AM
To: gwt-openlayers-users
Subject: [Gwt-openlayers-users] Changing map projection by deleting old map and creating new one
Hi,
I need to be able to switch between different projections. I thought the simplest way to do this would be to remove the current map from it's container and add a new one. However, when I add the new map it doesn't get displayed. Essentially what I'm doing is this (I'm using SmartGWT, mapPanel is a HLayout):
MapWidget newMap = createMap("EPSG:4326");
mapWidget.removeFromParent();
mapPanel.addMember(newMap);
Any ideas why my new map isn't displaying?
Thanks.
Jon
|