private final MapWidget map;
private final Button removeAddButton;
private final Button showHideButton;
public KmlOverlayDemo() {
Panel panel = new FlowPanel();
map = new MapWidget(LatLng.newInstance(41.875696, -87.624207), 11);
map.setSize("640px", "480px");
map.setUIToDefault();
panel.add(map);
// Toggle the visibility of the overlays by
// adding and removing the overlay.
removeAddButton = new Button("Add KML Overlay");
// Toggle the visibility of the overlays
// using the show() and hide() methods
showHideButton = new Button("Hide");
removeAddButton.setEnabled(false);
removeAddButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
toggleOverlay();
}
});
panel.add(removeAddButton);
showHideButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (geoXml == null) {
return;
}
if (geoXml.isHidden()) {
geoXml.setVisible(true);
showHideButton.setText("Hide");
} else {
geoXml.setVisible(false);
showHideButton.setText("Show");
}
}
});
panel.add(showHideButton);
initWidget(panel);
GeoXmlOverlay.load(KML_DEMO_URI, new GeoXmlLoadCallback() {
@Override