Example usage for com.google.gwt.maps.client MapType MapType

List of usage examples for com.google.gwt.maps.client MapType MapType

Introduction

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

Prototype

public MapType(TileLayer[] layers, Projection projection, String name) 

Source Link

Document

Creates a new custom map type from the tile layers, projection, and name.

Usage

From source file:com.google.gwt.maps.sample.hellomaps.client.CustomMapTypeDemo.java

License:Apache License

public CustomMapTypeDemo() {

    VerticalPanel vertPanel = new VerticalPanel();
    vertPanel.setStyleName("hm-panel");

    map = new MapWidget(LatLng.newInstance(33.7814790, -84.3880580), 13);
    map.setSize("500px", "450px");

    CopyrightCollection myCopyright = new CopyrightCollection("");
    myCopyright.addCopyright(new Copyright(1,
            LatLngBounds.newInstance(LatLng.newInstance(34, -81), LatLng.newInstance(36, -79)), 10, ""));
    TileLayer tileLayer = new TileLayer(myCopyright, 10, 18) {
        @Override/*from w  ww. j  av  a2s  .co m*/
        public double getOpacity() {
            return 1.0;
        }

        @Override
        public String getTileURL(Point tile, int zoomLevel) {
            return "http://www.google.com/apis/maps/documentation/examples/include/tile_crosshairs.png";
        }

        @Override
        public boolean isPng() {
            return true;
        }
    };

    MapType mapType = new MapType(new TileLayer[] { tileLayer }, new MercatorProjection(20), "MyMap");
    map.addMapType(mapType);
    map.addControl(new MapTypeControl());

    vertPanel.add(map);

    initWidget(vertPanel);
}

From source file:org.sigmah.client.map.MapTypeFactory.java

License:Open Source License

/**
 * Creates the default MapType for "localisation", that is selecting
 * the geographic position of sites./*w ww  . j  a  v a 2 s  . c om*/
 *
 * @param country  The country for which to return the MapType
 * @return  a GoogleMaps MapType
 */
public static MapType createLocalisationMapType(CountryDTO country) {
    // TODO: generalize
    // There are probably other cases where we need to add custom tiles
    // for poorly covered countries
    if (country.getName().equals("RDC")) {
        TileLayer[] layers = new TileLayer[1];
        layers[0] = new RgcTileLayer("http://www.pear.cd/ActivityInfo/tiles/admin", 6, 10);
        Projection projection = new MercatorProjection(11);
        return new MapType(layers, projection, "Admin");
    } else {
        return MapType.getNormalMap();
    }
}

From source file:org.sigmah.client.map.MapTypeFactory.java

License:Open Source License

/**
 * Creates a GoogleMaps MapType for a given ActivityInfo BaseMap object.
 *
 * @param baseMap//from   ww  w  .j  av  a 2  s  . c  o  m
 * @return
 */
public static MapType mapTypeForBaseMap(BaseMap baseMap) {
    TileLayer[] layers = new TileLayer[1];
    layers[0] = new BaseMapLayer(baseMap);
    Projection projection = new MercatorProjection(baseMap.getMaxZoom() + 1);

    return new MapType(layers, projection, baseMap.getName());
}