Example usage for com.google.gwt.maps.client.overlay Icon newInstance

List of usage examples for com.google.gwt.maps.client.overlay Icon newInstance

Introduction

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

Prototype

public static native Icon newInstance() ;

Source Link

Document

Construct a new Icon object.

Usage

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);//from  www  . j  a v  a 2  s  .co  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: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//w ww .j a  va2 s  . c om
 ****/

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.SearchOriginMapPresenter.java

License:Apache License

public void handleUpdate(StateEvent event) {

    State state = event.getState();

    if (state instanceof SearchLocationUpdatedState) {

        if (_marker != null) {
            _mapOverlayManager.removeOverlay(_marker);
            _marker = null;/*from  w w w  . j  av a2s  .  c  o m*/
        }

        LatLng location = _queryModel.getLocation();

        if (location == null) {
            System.err.println("PROBLEM!");
            return;
        }

        MapResources resources = MapResources.INSTANCE;
        DataResource resource = resources.getImageRouteStart();
        Icon icon = Icon.newInstance();
        icon.setImageURL(resource.getUrl());
        icon.setIconSize(Size.newInstance(20, 34));
        icon.setIconAnchor(Point.newInstance(10, 34));
        MarkerOptions opts = MarkerOptions.newInstance(icon);

        _marker = new Marker(location, opts);
        _mapOverlayManager.addOverlay(_marker);
    }

}

From source file:org.opennms.features.poller.remote.gwt.client.GoogleMapsPanel.java

License:Open Source License

private Marker createMarker(final GWTMarkerState marker) {
    final Icon icon = Icon.newInstance();
    icon.setIconSize(Size.newInstance(32, 32));
    icon.setIconAnchor(Point.newInstance(16, 32));
    String markerImageURL = marker.getImageURL();
    icon.setImageURL(markerImageURL);//from   www. ja va 2 s.  com

    final MarkerOptions markerOptions = MarkerOptions.newInstance();
    markerOptions.setAutoPan(true);
    markerOptions.setClickable(true);
    markerOptions.setTitle(marker.getName());
    markerOptions.setIcon(icon);

    Marker m = new Marker(toLatLng(marker.getLatLng()), markerOptions);
    m.setVisible(marker.isVisible());
    m.addMarkerClickHandler(new DefaultMarkerClickHandler(marker));
    return m;
}

From source file:org.ow2.aspirerdfid.tracking.demo.client.TrackingDemo.java

License:Open Source License

protected void buildUi() {
    LatLng AthensCity = LatLng.newInstance(37.58, 23.43);

    map = new MapWidget(AthensCity, 2);
    map.setSize("100%", "100%");
    // Add some controls for the zoom level
    map.addControl(new LargeMapControl());
    map.setScrollWheelZoomEnabled(true);

    // // Add a marker
    // map.addOverlay(new Marker(AthensCity));

    mainPanel.add(map);// w  ww.j  av a  2  s  .  com

    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    baseIcon = Icon.newInstance();
    baseIcon.setShadowURL("http://google-maps-icons.googlecode.com/files/shadow.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));

}