List of usage examples for com.google.gwt.maps.client.controls ControlPosition TOP_RIGHT
ControlPosition TOP_RIGHT
To view the source code for com.google.gwt.maps.client.controls ControlPosition TOP_RIGHT.
Click Source Link
From source file:com.arcbees.website.client.application.contact.ContactView.java
License:Apache License
private void onMapsLoaded() { // -- HOW TO STYLE A GOOGLE MAP // -> First, we create the style. To help : http://software.stadtwerk.org/google_maps_colorizr/ MapTypeStyle style1 = MapTypeStyle.newInstance(); style1.setElementType(MapTypeStyleElementType.GEOMETRY); style1.setFeatureType(MapTypeStyleFeatureType.ROAD); style1.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#FFF"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(100) }); MapTypeStyle style2 = MapTypeStyle.newInstance(); style2.setElementType(MapTypeStyleElementType.ALL); style2.setFeatureType(MapTypeStyleFeatureType.LANDSCAPE); style2.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#cccccc"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(-10) }); MapTypeStyle style3 = MapTypeStyle.newInstance(); style3.setElementType(MapTypeStyleElementType.ALL); style3.setFeatureType(MapTypeStyleFeatureType.POI); style3.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#f00"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(9), }); MapTypeStyle style4 = MapTypeStyle.newInstance(); style4.setElementType(MapTypeStyleElementType.ALL); style4.setFeatureType(MapTypeStyleFeatureType.WATER); style4.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#1c1c1c"), MapTypeStyler.newSaturationStyler(-100), MapTypeStyler.newLightnessStyler(86), }); MapTypeStyle[] array = { style1, style2, style3, style4 }; JsArray<MapTypeStyle> styles = ArrayHelper.toJsArray(array); // -> Then we tell the map to use our new style by default MapTypeControlOptions controlOptions = MapTypeControlOptions.newInstance(); controlOptions.setMapTypeIds(new String[] {}); controlOptions.setPosition(ControlPosition.TOP_RIGHT); // -> And tell the map what our custom style is StyledMapTypeOptions styledMapTypeOptions = StyledMapTypeOptions.newInstance(); styledMapTypeOptions.setName("Arcbees"); StyledMapType customMapType = StyledMapType.newInstance(styles, styledMapTypeOptions); // -> Then we define our Lat and Long LatLng arcbeesCoord = LatLng.newInstance(46.792097, -71.285362); // -> Then goes the map options MapOptions options = MapOptions.newInstance(); options.setCenter(arcbeesCoord);/* ww w . jav a2s.c o m*/ options.setZoom(16); options.setScrollWheel(false); options.setMapTypeControlOptions(controlOptions); options.setMapTypeId(ARCBEES_MAPTYPE); options.setPanControl(false); options.setDraggable(Window.getClientWidth() > 649); ZoomControlOptions zoomControlOptions = ZoomControlOptions.newInstance(); zoomControlOptions.setPosition(ControlPosition.RIGHT_CENTER); options.setZoomControlOptions(zoomControlOptions); // -> We create the map with our options MapWidget mapWidget = new MapWidget(options); mapWidget.addStyleName(page.style().map()); mapWidget.setCustomMapType(ARCBEES_MAPTYPE, customMapType); // -> We define the marker MarkerOptions markerOptions = MarkerOptions.newInstance(); markerOptions.setIcon(pageContactResources.marker().getSafeUri().asString()); markerOptions.setMap(mapWidget); markerOptions.setPosition(arcbeesCoord); Marker.newInstance(markerOptions); // -> And finally, add it to its container container.add(mapWidget); }
From source file:org.rebioma.client.MapView.java
License:Apache License
private ModelingControl getModelControl() { final ModelingControl modelControl = new ModelingControl(); Scheduler.get().scheduleDeferred(new ScheduledCommand() { public void execute() { // Widget modelControlWidget = modelControl.getControlWidget(); // ControlPosition hideControlPosition = new ControlPosition( // ControlAnchor.TOP_RIGHT, modelControl.getXOffset() // + modelControlWidget.getOffsetWidth() + 10, modelControl // .getYOffset()); HideControl hideControl = new HideControl(); map.setControls(ControlPosition.TOP_RIGHT, hideControl); hideControl.addControlWidgetToHide(modelControl); hideControl.addControlWidgetToHide(geocoder); hideControl.addControlWidgetToHide(envLayerSelector); }//w w w .j a v a2 s. co m }); return modelControl; }
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 ww . ja v a 2s. c om*/ 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(); }