VLayout overviewMapLayout = new VLayout();
overviewMapLayout.setShowEdges(true);
overviewMapLayout.setWidth(300);
// Create an overview map:
final OverviewMap overviewMap = new OverviewMap("mapOverviewOsm", "gwt-samples", map, true, true);
overviewMapLayout.addMember(overviewMap);
// Create a layout for a few buttons:
HLayout buttonLayout = new HLayout();
buttonLayout.setHeight(20);
buttonLayout.setAlign(VerticalAlignment.BOTTOM);
buttonLayout.setMembersMargin(10);
// ---------------------------------------------------------------------
// Creating 3 buttons:
// ---------------------------------------------------------------------
// Button1: Toggle the rectangle style:
IButton button1 = new IButton(I18nProvider.getSampleMessages().overviewMapToggleRectStyle());
button1.addClickHandler(new ClickHandler() {
private ShapeStyle nextStyle = new ShapeStyle("#000000", 0.6f, "#000000", 1, 1);
public void onClick(ClickEvent event) {
ShapeStyle temp = nextStyle;
nextStyle = overviewMap.getRectangleStyle();
overviewMap.setRectangleStyle(temp);
}
});
button1.setWidth100();
buttonLayout.addMember(button1);
// Button2: Toggle the maximum extent style:
IButton button2 = new IButton(I18nProvider.getSampleMessages().overviewMapToggleExtentStyle());
button2.addClickHandler(new ClickHandler() {
private ShapeStyle nextStyle = new ShapeStyle("#FF0000", 0.6f, "#FF0000", 1, 3);
public void onClick(ClickEvent event) {
ShapeStyle temp = nextStyle;
nextStyle = overviewMap.getTargetMaxExtentRectangleStyle();
overviewMap.setTargetMaxExtentRectangleStyle(temp);
}
});
button2.setWidth100();
buttonLayout.addMember(button2);
// Button3: Toggle drawing the maximum extent:
IButton button3 = new IButton(I18nProvider.getSampleMessages().overviewMapToggleExtent());
button3.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
overviewMap.setDrawTargetMaxExtent(!overviewMap.isDrawTargetMaxExtent());
}
});
button3.setWidth100();
buttonLayout.addMember(button3);