Example usage for com.google.gwt.maps.client.base HasLatLngBounds contains

List of usage examples for com.google.gwt.maps.client.base HasLatLngBounds contains

Introduction

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

Prototype

public boolean contains(HasLatLng point);

Source Link

Document

Returns true if the given lat/lng is in this bounds.

Usage

From source file:com.google.mobile.trippy.web.client.presenter.BaseMapPresenter.java

License:Apache License

protected void highlightResultIndex(final int index, final Item item, EventCallback eventCallback) {
    mapPresenter.setMarkerImage(currentItem, resultPinUrl);
    mapPresenter.setMarkerImage(index, TrippyBundle.INSTANCE.mapMarkerHighlighted().getURL());
    final HasLatLng point = mapPresenter.getLatLng(item.getLatitude(), item.getLongitude());
    HasLatLngBounds mapBounds = mapPresenter.getMapBounds();
    if (mapBounds.getJso() != null && !mapBounds.contains(point)) {
        mapPresenter.setCenter(point);//  www. ja  va 2 s.co  m
    }

    // show info window for highlighted item
    infoWindow.setContent(item.getName());
    infoWindow.setPosition(point);
    infoWindow.setClickHandler(eventCallback);
    infoWindow.open(null, null);
    currentItem = index;
}