Example usage for com.google.gwt.maps.client.geom Size newInstance

List of usage examples for com.google.gwt.maps.client.geom Size newInstance

Introduction

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

Prototype

public static native Size newInstance(int width, int height) ;

Source Link

Document

Construct a new Size object.

Usage

From source file:com.google.gwt.gadgets.sample.traveler.client.TravelMap.java

License:Apache License

private TravelMap(boolean doubleClickToZoom) {
    map = new MapWidget();
    map.setSize("100%", "100%");
    map.setCenter(zero, 0);//from  w  w w  .j  a v a2 s  .c om
    MapUIOptions options = MapUIOptions.newInstance(Size.newInstance(200, 200));
    options.setDoubleClick(doubleClickToZoom);
    map.setUI(options);
    DockLayoutPanel panel = new DockLayoutPanel(Unit.PCT);
    panel.add(map);
    initWidget(panel);
}

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

License:Apache License

public AdsManagerDemo() {
    MapOptions mapOptions = MapOptions.newInstance();
    mapOptions.setSize(Size.newInstance(500, 600));

    // Mountain View
    LatLng city = LatLng.newInstance(37.4419, -122.1419);
    map = new MapWidget(city, 13, mapOptions);
    map.setUIToDefault();/*from   w w w .j a v a 2 s .  co  m*/

    AdsManagerOptions adsOptions = AdsManagerOptions.newInstance();
    adsOptions.setMaxAdsOnMap(3);
    adsOptions.setStyle(AdsManagerOptions.STYLE_ADUNIT);
    String publisherId = "pub-1234567890123456"; // bogus publisher id
    AdsManager adsManager = AdsManager.newInstance(map, publisherId, adsOptions);
    adsManager.setEnabled(true);

    initWidget(map);
}

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

License:Apache License

public GoogleBarDemo() {
    GoogleBarAdsOptions adsOptions = GoogleBarAdsOptions.newInstance();
    adsOptions.setAdSafe(AdSafeOption.ADSAFE_MEDIUM);
    GoogleBarOptions googleBarOptions = GoogleBarOptions.newInstance();
    googleBarOptions.setAdsOptions(adsOptions);
    googleBarOptions.setShowOnLoad(true);
    googleBarOptions.setStyle("new");
    MapOptions mapOptions = MapOptions.newInstance();
    mapOptions.setGoogleBarOptions(googleBarOptions);
    mapOptions.setSize(Size.newInstance(500, 600));
    // Dublin/* w  w w .j a  v a  2s  . c om*/
    map = new MapWidget(LatLng.newInstance(53.350705, -6.264095), 13, mapOptions);
    // map.setUIToDefault();
    map.setGoogleBarEnabled(true);

    initWidget(map);
}

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

License:Apache License

public IconClassDemo() {
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    initWidget(map);//w  ww.  ja va2s .  c o  m

    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());

    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    baseIcon = Icon.newInstance();
    baseIcon.setShadowURL("http://www.google.com/mapfiles/shadow50.png");
    baseIcon.setIconSize(Size.newInstance(20, 34));
    baseIcon.setShadowSize(Size.newInstance(37, 34));
    baseIcon.setIconAnchor(Point.newInstance(9, 34));
    baseIcon.setInfoWindowAnchor(Point.newInstance(9, 2));
    // TOOD(sgross): undocumented?
    // baseIcon.setInfoShadowAnchor(new GPoint(18, 25));
}

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

License:Apache License

@Override
public void onShow() {
    map.clearOverlays();//from w w  w .j av a 2 s.  c o m

    // Create our "tiny" marker icon
    Icon icon = Icon.newInstance("http://labs.google.com/ridefinder/images/mm_20_red.png");
    icon.setShadowURL("http://labs.google.com/ridefinder/images/mm_20_shadow.png");
    icon.setIconSize(Size.newInstance(12, 20));
    icon.setShadowSize(Size.newInstance(22, 20));
    icon.setIconAnchor(Point.newInstance(6, 20));
    icon.setInfoWindowAnchor(Point.newInstance(5, 1));

    // Add 10 markers to the map at random locations
    LatLngBounds bounds = map.getBounds();
    LatLng southWest = bounds.getSouthWest();
    LatLng northEast = bounds.getNorthEast();
    double lngSpan = northEast.getLongitude() - southWest.getLongitude();
    double latSpan = northEast.getLatitude() - southWest.getLatitude();
    MarkerOptions options = MarkerOptions.newInstance();
    options.setIcon(icon);
    for (int i = 0; i < 10; i++) {
        LatLng point = LatLng.newInstance(southWest.getLatitude() + latSpan * Math.random(),
                southWest.getLongitude() + lngSpan * Math.random());

        map.addOverlay(new Marker(point, options));
    }
}

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

License:Apache License

public MapUIOptionsDemo() {
    VerticalPanel vp = new VerticalPanel();

    Size smallSize = Size.newInstance(250, 250);
    HorizontalPanel smallMapPanel = new HorizontalPanel();
    new UIOptionsControl(smallMapPanel, smallSize);
    smallMapPanel.getElement().getStyle().setPropertyPx("marginBottom", 20);

    Size largeSize = Size.newInstance(500, 400);
    HorizontalPanel largeMapPanel = new HorizontalPanel();
    new UIOptionsControl(largeMapPanel, largeSize);

    vp.add(new Label("Small Map with default UI style"));
    vp.add(smallMapPanel);/*from  w w w . j  a  v a2  s.c o m*/
    vp.add(new Label("Large Map with default UI style"));
    vp.add(largeMapPanel);
    initWidget(vp);
}

From source file:org.onebusaway.webapp.gwt.common.resources.map.StopIconFactory.java

License:Apache License

public static Marker getStopSelectionCircle(LatLng p, boolean bigger) {
    ImageResource resource = bigger ? _r.getSelectionCircle36() : _r.getSelectionCircle30();

    Icon icon = Icon.newInstance();
    icon.setImageURL(resource.getURL());

    int w = resource.getWidth();
    int h = resource.getHeight();
    int w2 = w / 2;
    int h2 = h / 2;

    icon.setIconSize(Size.newInstance(w, h));
    icon.setIconAnchor(Point.newInstance(w2, h2));
    icon.setInfoWindowAnchor(Point.newInstance(w2, h2));

    MarkerOptions options = MarkerOptions.newInstance(icon);
    return new Marker(p, options);
}

From source file:org.onebusaway.webapp.gwt.common.resources.map.StopIconFactory.java

License:Apache License

/*****
 * Private Methods//from www . ja v  a 2s  .  c  o  m
 ****/

private static Icon getRouteIcon(String url) {
    Icon icon = Icon.newInstance();
    icon.setImageURL(url);
    icon.setIconSize(Size.newInstance(20, 34));
    icon.setIconAnchor(Point.newInstance(10, 34));
    return icon;
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.ActiveResultPresenter.java

License:Apache License

private Icon getStar30Marker() {
    OneBusAwayStandardResources resources = OneBusAwayStandardResources.INSTANCE;
    ImageResource r = resources.getStar30();
    Icon icon = Icon.newInstance(r.getURL());
    icon.setIconSize(Size.newInstance(30, 28));
    icon.setIconAnchor(Point.newInstance(15, 14));
    return icon;//from ww w  . j  ava  2  s  .co  m
}

From source file:org.onebusaway.webapp.gwt.oba_application.view.ActiveResultPresenter.java

License:Apache License

private Icon getStar20Marker() {
    OneBusAwayStandardResources resources = OneBusAwayStandardResources.INSTANCE;
    ImageResource r = resources.getStar20();
    Icon icon = Icon.newInstance(r.getURL());
    icon.setIconSize(Size.newInstance(20, 19));
    icon.setIconAnchor(Point.newInstance(10, 10));
    return icon;/*from   ww  w  .  j  a v a2s  . c  om*/
}