Search in sources :

Example 11 with BoundsBuilder

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

the class BoundsBuilderTest method testDatelinePoints.

@Test
public void testDatelinePoints() {
    BoundsBuilder bldr = new BoundsBuilder();
    bldr.extend(40, -170);
    bldr.extend(30, 170);
    assertEquals(new GWTBounds(30, 170, 40, -170), bldr.getBounds());
}
Also used : GWTBounds(org.opennms.features.poller.remote.gwt.client.GWTBounds) BoundsBuilder(org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder) Test(org.junit.Test)

Example 12 with BoundsBuilder

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

the class BoundsBuilderTest method testExtendWestThenEast.

@Test
public void testExtendWestThenEast() {
    BoundsBuilder bldr = new BoundsBuilder();
    bldr.extend(0.0, 0.0);
    bldr.extend(0.0, -170.0);
    assertEquals(new GWTBounds(0.0, -170, 0, 0), bldr.getBounds());
    bldr.extend(0.0, 90.0);
    assertEquals(new GWTBounds(0, -170, 0, 90), bldr.getBounds());
}
Also used : GWTBounds(org.opennms.features.poller.remote.gwt.client.GWTBounds) BoundsBuilder(org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder) Test(org.junit.Test)

Example 13 with BoundsBuilder

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

the class BoundsBuilderTest method testDistanceFromWesternHemi.

@Test
public void testDistanceFromWesternHemi() {
    BoundsBuilder bldr = new BoundsBuilder();
    bldr.extend(10, -170);
    bldr.extend(0, -160);
    assertEquals(335.0, bldr.distanceEast(175), 0.0);
    assertEquals(35.0, bldr.distanceWest(155), 0.0);
    assertEquals(345.0, bldr.distanceEast(-175), 0.0);
    assertEquals(5.0, bldr.distanceWest(-175), 0.0);
}
Also used : BoundsBuilder(org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder) Test(org.junit.Test)

Example 14 with BoundsBuilder

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

the class BoundsBuilderTest method testAddManyPoints.

@Test
public void testAddManyPoints() {
    BoundsBuilder bldr = new BoundsBuilder();
    for (int i = 0; i <= 10; i++) {
        bldr.extend(0.0 + i, 0.0);
        bldr.extend(0.0, 0.0 - i);
    }
    assertEquals(new GWTBounds(0.0, -10.0, 10.0, 0.0), bldr.getBounds());
}
Also used : GWTBounds(org.opennms.features.poller.remote.gwt.client.GWTBounds) BoundsBuilder(org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder) Test(org.junit.Test)

Example 15 with BoundsBuilder

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

the class BoundsBuilderTest method testAddInteriorPoint.

@Test
public void testAddInteriorPoint() {
    BoundsBuilder bldr = new BoundsBuilder();
    bldr.extend(0.0, 0.0);
    bldr.extend(2.0, 2.0);
    assertEquals(new GWTBounds(0.0, 0.0, 2.0, 2.0), bldr.getBounds());
    bldr.extend(1.0, 1.0);
    // nothing happens because its in the interior
    assertEquals(new GWTBounds(0.0, 0.0, 2.0, 2.0), bldr.getBounds());
}
Also used : GWTBounds(org.opennms.features.poller.remote.gwt.client.GWTBounds) BoundsBuilder(org.opennms.features.poller.remote.gwt.client.utils.BoundsBuilder) Test(org.junit.Test)

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