package mil.nga.geopackage;

import org.junit.Test;

import junit.framework.TestCase;
import mil.nga.proj.ProjectionConstants;
import mil.nga.proj.ProjectionFactory;
import mil.nga.sf.Point;
import mil.nga.sf.util.GeometryUtils;

/**
 * Bounding Box Tests
 * 
 * @author osbornb
 */
public class BoundingBoxTest {

	/**
	 * Test centroid methods
	 */
	@Test
	public void testCentroid() {

		BoundingBox boundingBox = new BoundingBox(5.0, 10.0, 30.0, 55.0);

		Point centroid = boundingBox.getCentroid();

		TestCase.assertEquals(17.5, centroid.getX());
		TestCase.assertEquals(32.5, centroid.getY());

		Point centroid2 = boundingBox.getCentroid(ProjectionFactory
				.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR));

		TestCase.assertEquals(centroid.getX(), centroid2.getX());
		TestCase.assertEquals(centroid.getY(), centroid2.getY());

		Point geometryCentroid = GeometryUtils
				.getCentroid(boundingBox.buildGeometry());

		TestCase.assertEquals(geometryCentroid.getX(), centroid.getX());
		TestCase.assertEquals(geometryCentroid.getY(), centroid.getY());

		Point degreesCentroid = boundingBox.getDegreesCentroid();

		TestCase.assertEquals(17.5, degreesCentroid.getX(), 0.00000000000001);
		TestCase.assertEquals(33.12597587060761, degreesCentroid.getY());

		Point degreesCentroid2 = boundingBox.getCentroid(ProjectionFactory
				.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM));

		TestCase.assertEquals(degreesCentroid.getX(), degreesCentroid2.getX());
		TestCase.assertEquals(degreesCentroid.getY(), degreesCentroid2.getY());

		Point geometryDegreesCentroid = GeometryUtils
				.getDegreesCentroid(boundingBox.buildGeometry());

		TestCase.assertEquals(geometryDegreesCentroid.getX(),
				degreesCentroid.getX());
		TestCase.assertEquals(geometryDegreesCentroid.getY(),
				degreesCentroid.getY());

	}

}

@@ -187,46 +187,8 @@
 int;
-%0Aimport mil.nga.sf.util.GeometryUtils;
 %0A%0A/*
@@ -832,39 +832,8 @@
 d = 
-GeometryUtils%0A%09%09%09%09.getCentroid(
 boun
@@ -847,32 +847,45 @@
 .buildGeometry()
+.getCentroid(
 );%0A%0A%09%09TestCase.a
@@ -1532,24 +1532,41 @@
 troid = 
+boundingBox.build
 Geometry
 Utils%0A%09%09
@@ -1561,13 +1561,10 @@
 etry
-Utils
+()
 %0A%09%09%09
@@ -1588,35 +1588,8 @@
 oid(
-boundingBox.buildGeometry()
 );%0A%0A

test update