Example usage for com.google.gwt.maps.client MapTypeId ROADMAP

List of usage examples for com.google.gwt.maps.client MapTypeId ROADMAP

Introduction

In this page you can find the example usage for com.google.gwt.maps.client MapTypeId ROADMAP.

Prototype

MapTypeId ROADMAP

To view the source code for com.google.gwt.maps.client MapTypeId ROADMAP.

Click Source Link

Document

This map type displays a normal street map.

Usage

From source file:com.google.gwt.maps.testing.client.maps.AdvancedLayersWidget.java

License:Apache License

private void drawMap() {
    LatLng center = LatLng.newInstance(42.35, -71.07);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(14);//from  w  ww.j  a v  a2 s  .c  o m
    opts.setCenter(center);
    opts.setMapTypeId(MapTypeId.ROADMAP);

    mapWidget = new MapWidget(opts);
    pWidget.add(mapWidget);
    mapWidget.setSize("750px", "500px");

    mapWidget.addClickHandler(new ClickMapHandler() {
        public void onEvent(ClickMapEvent event) {
            // TODO fix the event getting, getting ....
            GWT.log("clicked on latlng=" + event.getMouseEvent().getLatLng());
        }
    });
}

From source file:com.google.gwt.maps.testing.client.maps.FusionTablesMapWidget.java

License:Apache License

private void setupMap() {
    // chicago//  w  ww . j  a  v  a 2  s  . c om
    LatLng center = LatLng.newInstance(41.898, -87.632);

    MapOptions options = MapOptions.newInstance();
    options.setCenter(center);
    options.setZoom(12);
    options.setMapTypeId(MapTypeId.ROADMAP);

    mapWidget = new MapWidget(options);
    pWidget.add(mapWidget);

    mapWidget.setSize("750px", "500px");
}

From source file:com.google.gwt.maps.testing.client.maps.KmlMapWidget.java

License:Apache License

private void drawMap() {
    LatLng center = LatLng.newInstance(49.496675, -102.65625);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(4);//from www .ja  v a2  s.  c  o  m
    opts.setCenter(center);
    opts.setMapTypeId(MapTypeId.ROADMAP);

    mapWidget = new MapWidget(opts);
    pWidget.add(mapWidget);
    mapWidget.setSize("750px", "500px");
}

From source file:com.google.gwt.maps.testing.client.maps.OpenStreetMapLayerWidget.java

License:Apache License

/**
 * Creates map widget and adds to container
 *//*  ww w .j a  va2  s.c  o m*/
private void drawMap() {

    int zoomLevel = 13;
    LatLng center = LatLng.newInstance(42.35, -71.07);
    String osmMapTypeName = "OSM"; // need to be consistent in the
    // controlOptions and mapTypeRegistry

    /* Create a map and add the OSM layer */
    MapTypeControlOptions controlOptions = MapTypeControlOptions.newInstance();
    controlOptions.setMapTypeIds(new String[] { osmMapTypeName, MapTypeId.ROADMAP.toString() });

    MapOptions options = MapOptions.newInstance();
    options.setZoom(zoomLevel);
    options.setCenter(center);
    options.setMapTypeControlOptions(controlOptions);
    options.setMapTypeId(osmMapTypeName); // set the OSM as the selected type
    mapWidget = new MapWidget(options);

    // Add the new map type we created to the registry so it can be used by
    // the map
    mapWidget.getMapTypeRegistry().set(osmMapTypeName, getOsmMapType());

    pWidget.add(mapWidget);
    mapWidget.setSize("750px", "500px");
}

From source file:com.google.gwt.maps.testing.client.maps.StreetViewSideBySideMapWidget.java

License:Apache License

/**
 * setup the map on the left//from   ww  w .  j ava  2s  . c  o  m
 */
private void drawMap() {
    LatLng berkley = LatLng.newInstance(21.271525, -157.822731);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(16);
    opts.setCenter(berkley);
    opts.setMapTypeId(MapTypeId.ROADMAP);

    mapWidget = new MapWidget(opts);
    hp.add(mapWidget);
    mapWidget.setSize("375px", "500px");

    mapWidget.addClickHandler(new ClickMapHandler() {
        public void onEvent(ClickMapEvent event) {
            GWT.log("clicked on latlng=" + event.getMouseEvent().getLatLng());
            processClick(event.getMouseEvent().getLatLng());
        }
    });
}

From source file:com.google.gwt.maps.testing.client.maps.StyledMapWidget.java

License:Apache License

private void drawMap() {

    /** Create all your styles **/
    // Style the roads
    MapTypeStyle style1 = MapTypeStyle.newInstance();
    style1.setElementType(MapTypeStyleElementType.GEOMETRY);
    style1.setFeatureType(MapTypeStyleFeatureType.ROAD);
    style1.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#CC3232"),
            MapTypeStyler.newSaturationStyler(100), MapTypeStyler.newLightnessStyler(-45) });

    // Style the landscape

    MapTypeStyle style2 = MapTypeStyle.newInstance();
    style2.setElementType(MapTypeStyleElementType.GEOMETRY);
    style2.setFeatureType(MapTypeStyleFeatureType.LANDSCAPE);
    style2.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#000000"),
            MapTypeStyler.newSaturationStyler(75), MapTypeStyler.newLightnessStyler(-100) });

    // Style the highways
    MapTypeStyle style3 = MapTypeStyle.newInstance();
    style3.setElementType(MapTypeStyleElementType.GEOMETRY);
    style3.setFeatureType(MapTypeStyleFeatureType.ROAD__HIGHWAY);
    style3.setStylers(new MapTypeStyler[] { MapTypeStyler.newHueStyler("#0000FF"),
            MapTypeStyler.newSaturationStyler(5), });

    // consolidate all style information
    MapTypeStyle[] array = { style1, style2, style3 };

    JsArray<MapTypeStyle> styles = ArrayHelper.toJsArray(array); // JS needs
                                                                 // JSArray,
                                                                 // convert
    StyledMapTypeOptions options = StyledMapTypeOptions.newInstance();
    options.setName("My Eyes Hurt!");// the name that appears on map controls
    options.setAlt("Hold onto your retinas!");
    StyledMapType customMapType = StyledMapType.newInstance(styles, options); // apply
                                                                              // to
                                                                              // new
                                                                              // styled
                                                                              // map

    /** Create you map **/
    // basic map options
    LatLng center = LatLng.newInstance(40.6743890, -73.9455);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(12);//  w  w  w  . ja  v a2 s  .  c om
    opts.setCenter(center);
    opts.setMapTypeId(MapTypeId.ROADMAP);

    // NOTE: using the xString methods here on Map options b/c it can handle
    // either MapTypeId|string, but Java cannot.
    // If using custom id's, make sure to use the String methods (i.e. in below
    // block)
    MapTypeControlOptions controlOptions = MapTypeControlOptions.newInstance();
    controlOptions.setMapTypeIds(new String[] { MapTypeId.ROADMAP.toString(), MY_COOL_MAPTYPE });
    opts.setMapTypeControlOptions(controlOptions);
    opts.setMapTypeId(MY_COOL_MAPTYPE);

    mapWidget = new MapWidget(opts);
    pWidget.add(mapWidget);
    mapWidget.setSize("750px", "500px");

    // finally add the map to the type registry
    mapWidget.setCustomMapType(MY_COOL_MAPTYPE, customMapType);

}

From source file:com.google.gwt.maps.testing.client.maps.TransitDirectionsServiceMapWidget.java

License:Apache License

private void drawMap() {
    LatLng center = LatLng.newInstance((MAX_LAT + MIN_LAT) / 2.0, (MIN_LON + MAX_LON) / 2.0);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(10);/*  w  w w  .  ja v  a  2 s.  c o  m*/
    opts.setCenter(center);
    opts.setMapTypeId(MapTypeId.ROADMAP);

    mapWidget = new MapWidget(opts);
    pWidget.add(mapWidget);
    mapWidget.setSize("750px", "500px");

    DirectionsRendererOptions options = DirectionsRendererOptions.newInstance();
    directionsDisplay = DirectionsRenderer.newInstance(options);
    directionsDisplay.setMap(mapWidget);
}

From source file:com.google.sampling.experiential.client.ChartPanel.java

License:Open Source License

/**
 * Create a Map Widget of Lat/Lon data.// w  w  w  .  jav a2  s .  c o m
 */
private void createMap() {

    MapOptions mapOptions = MapOptions.newInstance();
    mapOptions.setCenter(google);
    mapOptions.setZoom(4);
    mapOptions.setMapTypeId(MapTypeId.ROADMAP);
    map = new MapWidget(mapOptions);
    rootPanel.add(map);
    map.setSize(mapWidth + "px", mapHeight + "px");
}

From source file:com.jettmarks.routes.client.activities.showGroup.ShowGroupViewGwtImpl.java

License:Apache License

/**
 * @deprecated - Replaced by the EventSelectionView
 *///from   ww w. j  ava  2s .  co  m
public ShowGroupViewGwtImpl() {

    // Take care of the header for navigation
    viewDetailButton = new HeaderButton();
    viewDetailButton.setForwardButton(true);
    viewDetailButton.setText("Details");
    headerPanel.setRightWidget(viewDetailButton);

    LatLng atlanta = LatLng.newInstance(33.757787d, -84.359741d);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(14);
    opts.setCenter(atlanta);
    opts.setMapTypeId(MapTypeId.ROADMAP);
    opts.setScaleControl(true);

    mapWidget = new MapWidget(opts);
    mapWidget.setSize("100%", "100%");
    ScreenSize.addRegistration(mapWidget);

    mapWidget.setHeight(ScreenSize.getHeight() - 40 + "px");
    mapPanel.add(mapWidget);

}

From source file:com.jettmarks.routes.client.ui.EventViewMapOnlyGwtImpl.java

License:Apache License

/**
 * Setup the Map along with resize registration.
 * //w w w  .j  a  v  a2  s. c om
 * The mapWidget comes out of this.
 */
private MapWidget prepareMap() {
    MapWidget mapWidget;

    LatLng atlanta = LatLng.newInstance(33.757787d, -84.359741d);
    MapOptions opts = MapOptions.newInstance();
    opts.setZoom(currentZoomLevel);
    opts.setCenter(atlanta);
    opts.setMapTypeId(MapTypeId.ROADMAP);
    opts.setScaleControl(true);

    mapWidget = new MapWidget(opts);
    // Only the height has to be spec'd
    mapWidget.setSize("100%", "100%");
    mapWidget.setHeight(ScreenSize.getHeight() - 39 + "px");
    ScreenSize.addRegistration(mapWidget);
    return mapWidget;
}