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

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

Introduction

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

Prototype

public static MarkerOptions newInstance(Icon icon) 

Source Link

Usage

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.oba_application.view.ActiveResultPresenter.java

License:Apache License

public void handleUpdate(StateEvent evevent) {

    State state = evevent.getState();

    if (state instanceof SearchStartedState) {
        reset();/*from w w  w.  jav  a  2 s.co  m*/
    } else if (state instanceof SelectedPlaceChangedState) {

        SelectedPlaceChangedState placeChange = (SelectedPlaceChangedState) state;
        reset();

        TimedLocalSearchResult result = placeChange.getSelectedResult();

        if (result != null) {

            LocalSearchResult entry = result.getLocalSearchResult();
            LatLng point = LatLng.newInstance(entry.getLat(), entry.getLon());

            updatWidgetForResult(result);
            openInfoWindowForResult(result);

            Marker m15 = new Marker(point, MarkerOptions.newInstance(getStar15Marker()));
            Marker m20 = new Marker(point, MarkerOptions.newInstance(getStar20Marker()));
            Marker m30 = new Marker(point, MarkerOptions.newInstance(getStar30Marker()));

            _mapOverlayManager.addOverlay(m15, 0, 14);
            _mapOverlayManager.addOverlay(m20, 14, 17);
            _mapOverlayManager.addOverlay(m30, 17, 20);
            _mapOverlayManager.setCenter(point);

            _currentOverlays.add(m15);
            _currentOverlays.add(m20);
            _currentOverlays.add(m30);
        }
    } else if (state instanceof TripPlansState) {
        hideInfoWindow();
        for (Widget widget : _currentDirectionWidgets)
            widget.setVisible(false);
    }
}

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  a  2s.  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.yocto.sample.client.ui.CurrentYoctoMarker.java

License:Open Source License

private static MarkerOptions createOptions() {
    Icon icon = Icon.newInstance("http://maps.google.com/mapfiles/marker_purple.png");
    icon.setIconSize(Size.newInstance(20, 34));
    icon.setIconAnchor(Point.newInstance(10, 34));
    icon.setInfoWindowAnchor(Point.newInstance(5, 1));
    return MarkerOptions.newInstance(icon);
}

From source file:org.yocto.sample.client.ui.MarkerFactory.java

License:Open Source License

private static MarkerOptions createOptions(String img) {
    Icon icon = Icon.newInstance(img);
    icon.setIconSize(Size.newInstance(20, 34));
    icon.setIconAnchor(Point.newInstance(10, 34));
    icon.setInfoWindowAnchor(Point.newInstance(5, 1));
    return MarkerOptions.newInstance(icon);
}