Example usage for com.google.gwt.maps.client.controls ControlPosition TOP_LEFT

List of usage examples for com.google.gwt.maps.client.controls ControlPosition TOP_LEFT

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.controls ControlPosition TOP_LEFT.

Prototype

ControlPosition TOP_LEFT

To view the source code for com.google.gwt.maps.client.controls ControlPosition TOP_LEFT.

Click Source Link

Document

Elements are positioned in the top left and flow towards the middle.

Usage

From source file:org.rebioma.client.MapView.java

License:Apache License

private void initMap() {
    MapOptions mapOptions = MapOptions.newInstance();
    mapOptions.setCenter(HistoryState.DEFAULT_CENTER);
    mapOptions.setZoom(DEFAULT_ZOOM);/*from   w  w w  .  j  ava  2 s  .  c o  m*/
    mapOptions.setDraggableCursor("crosshair");
    mapOptions.setDraggingCursor("move");
    mapOptions.setMapTypeId(DEFAULT_MAP_TYPE);
    mapOptions.setScaleControl(true);
    MapTypeControlOptions mapTypeControlOptions = MapTypeControlOptions.newInstance();
    mapTypeControlOptions.setMapTypeIds(MapTypeId.values());
    mapTypesMap.put(MapTypeId.TERRAIN.toString(), MapTypeId.TERRAIN);
    mapTypesMap.put(MapTypeId.ROADMAP.toString(), MapTypeId.ROADMAP);
    mapTypesMap.put(MapTypeId.SATELLITE.toString(), MapTypeId.SATELLITE);
    mapOptions.setMapTypeControlOptions(mapTypeControlOptions);
    mapOptions.setMapTypeControl(true);
    map = new MapWidget(mapOptions);
    map.setWidth("100%");
    map.setHeight("100%");
    final MapView mapView = this;
    // map.addControl(getModelControl());
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
        @Override
        public void execute() {
            HideControl hideControl = new HideControl();
            map.setControls(ControlPosition.TOP_RIGHT, hideControl);
            controlsGroup.setMap(map, ControlPosition.RIGHT_TOP);
            //          map.setControls(ControlPosition.TOP_RIGHT, geocoder);
            /*ScaleControl scaleControl = new ScaleControl();
            LargeMapControl largeMapControl = new LargeMapControl();
            MenuMapTypeControl mapTypeControl = new MenuMapTypeControl();
                    
            map.addControl(scaleControl);
            map.addControl(largeMapControl);
            map.addControl(mapTypeControl);
                    
            ControlPosition hideControlPosition = new ControlPosition(
               ControlAnchor.TOP_RIGHT, 100, 10);*/
            //           envLayerSelector.setMap(map, ControlPosition.TOP_RIGHT);
            hideControl.addControlWidgetToHide(geocoder);
            hideControl.addControlWidgetToHide(envLayerSelector);

            CoordinatesControl coordinatesControl = new CoordinatesControl(map);

            MapDrawingControl mapDrawingControl = new MapDrawingControl(map, ControlPosition.TOP_CENTER);
            mapDrawingControl.addListener(mapView);
            ClearMapDrawingControl clearMapDrawingControl = new ClearMapDrawingControl(mapDrawingControl);
            map.setControls(ControlPosition.TOP_LEFT, clearMapDrawingControl);
        }
    });
    map.addClickHandler(mapClickHandler);
    map.addZoomChangeHandler(mapZoomHandler);
    map.addMapTypeIdChangeHandler(mapTypeHandler);
    //    map.checkResizeAndCenter();
}