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

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

Introduction

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

Prototype

ControlPosition RIGHT_TOP

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

Click Source Link

Document

Elements are positioned on the right, below top-right elements, and flow downwards.

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);/* w  w w  .j  a v a  2s  . com*/
    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();
}