public void run() {
MapOptions defaultMapOptions = new MapOptions();
defaultMapOptions.setNumZoomLevels(16);
final MapWidget mapWidget = new MapWidget("100%", "100%", defaultMapOptions);
mapContainer.add(mapWidget);
final Map map = mapWidget.getMap();
OSM osm = OSM.Mapnik("Mapnik");
osm.setIsBaseLayer(true);
map.addLayer(osm);
vectorLayer = new Vector("Fence");
map.addLayer(vectorLayer);
markers = new Markers("Markers");
map.addLayer(markers);
map.addControl(new OverviewMap());
map.addControl(new ScaleLine());
ModifyFeatureOptions featureOptions = new ModifyFeatureOptions();
featureOptions.setMode(ModifyFeature.RESIZE);
featureOptions.onModificationEnd(new ModifyFeature.OnModificationEndListener() {
@Override
public void onModificationEnd(VectorFeature vectorFeature) {
float diameter = vectorFeature.getGeometry().getBounds().getWidth();
storeBinder.getModel().setRadius(diameter / 2);
}
});
storeBinder.addPropertyChangeHandler("radius", new PropertyChangeHandler<Double>() {
@Override
public void onPropertyChange(PropertyChangeEvent<Double> event) {
reDrawGeoFence(map);
}
});
modifyControl = new ModifyFeature(vectorLayer, featureOptions);
map.addControl(modifyControl);
placeMarkerAtStoreLocation(map);
map.addMapMoveEndListener(new MapMoveEndListener() {
@Override
public void onMapMoveEnd(MapMoveEndEvent eventObject) {
Bounds extent = map.getExtent();
extent.transform(DEFAULT_PROJECTION, new Projection("EPSG:900913"));
// set up autocomplete search box for this place
AutocompleteType[] types = new AutocompleteType[2];
types[0] = AutocompleteType.ESTABLISHMENT;