Search in sources :

Example 16 with BoundsBuilder

use of org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder in project opennms by OpenNMS.

the class OpenLayersMapPanel method toGWTBounds.

private static GWTBounds toGWTBounds(final Bounds fromBounds) {
    if (fromBounds == null) {
        return new GWTBounds(-180, -90, 180, 90);
    }
    final Bounds bounds = fromBounds.transform(PROJECTION_SPHERICAL_MERCATOR, PROJECTION_LAT_LON);
    BoundsBuilder bldr = new BoundsBuilder();
    bldr.extend(Math.max(-90, bounds.getLowerLeftY()), Math.max(-180, bounds.getLowerLeftX()));
    bldr.extend(Math.min(90, bounds.getUpperRightY()), Math.min(180, bounds.getUpperRightX()));
    return bldr.getBounds();
}
Also used : Bounds(org.gwtopenmaps.openlayers.client.Bounds) BoundsBuilder(org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder)

Aggregations

BoundsBuilder (org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder)16 Test (org.junit.Test)13 GWTBounds (org.opennms.features.poller.remote.gwt.client.GWTBounds)11 Bounds (org.gwtopenmaps.openlayers.client.Bounds)1 GWTLatLng (org.opennms.features.poller.remote.gwt.client.GWTLatLng)1 LocationInfo (org.opennms.features.poller.remote.gwt.client.location.LocationInfo)1