Example usage for com.google.gwt.maps.client MapWidget getCenter

List of usage examples for com.google.gwt.maps.client MapWidget getCenter

Introduction

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

Prototype

public LatLng getCenter() 

Source Link

Document

get Center

Usage

From source file:org.onebusaway.webapp.gwt.where_library.view.constraints.QueryOperationHandler.java

License:Apache License

@Override
public void handleOperation(OperationContext context) {

    _context = context;/*from   ww w . ja v  a2 s.  co m*/

    StopFinderWidget widget = context.getWidget();
    widget.setSearchText(_query);

    LatLng center = _point;

    if (center == null) {
        MapWidget map = context.getMap();
        center = map.getCenter();
    }

    CoordinateBounds bounds = SphericalGeometryLibrary.bounds(center.getLatitude(), center.getLongitude(),
            20000);

    SearchQueryBean query = new SearchQueryBean();
    query.setBounds(bounds);
    query.setMaxCount(10);
    query.setQuery(_query);

    CombinedSearchService search = new CombinedSearchServiceImpl();
    search.search(query, 5000, this);
}

From source file:org.onebusaway.webapp.gwt.where_library.view.StopFinderPresenter.java

License:Apache License

@Override
public void query(String query) {
    MapWidget map = _widget.getMapWidget();
    LatLng center = map.getCenter();
    String qll = format(center.getLatitude()) + "," + format(center.getLongitude());
    internalQuery(false, KEY_MODE, MODE_QUERY, KEY_QUERY, query, KEY_QUERY_LATLON, qll, KEY_UNIQUE, _unique++);
}

From source file:org.onebusaway.webapp.gwt.where_library.view.StopFinderPresenter.java

License:Apache License

/*****************************************************************************
 * Private Methods//from   ww  w.  java 2  s .  c  om
 * 
 * @param includeView
 ****************************************************************************/

private Context buildContext(Map<String, String> params, boolean includeView) {

    Map<String, String> m = new LinkedHashMap<String, String>();
    m.putAll(params);

    if (includeView) {
        MapWidget map = _widget.getMapWidget();

        LatLng center = map.getCenter();

        LatLngBounds bounds = map.getBounds();
        LatLng ne = bounds.getNorthEast();
        LatLng sw = bounds.getSouthWest();
        double latSpan = Math.abs(ne.getLatitude() - sw.getLatitude());
        double lonSpan = Math.abs(ne.getLongitude() - sw.getLongitude());

        addBoundsToParams(m, center.getLatitude(), center.getLongitude(), latSpan, lonSpan);
    }

    return new ContextImpl(m);
}