Clover coverage report -
Coverage timestamp: Fri Nov 19 2004 13:41:51 PST
file stats: LOC: 57   Methods: 3
NCLOC: 44   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CalculatorTest.java - 100% 100% 100%
coverage
 1    package photospace.space;
 2   
 3    import java.awt.*;
 4    import junit.framework.*;
 5    import geotransform.transforms.*;
 6    import geotransform.ellipsoids.*;
 7    import geotransform.coords.*;
 8   
 9    /**
 10    * See http://www.geovrml.org/geotransform/index.html
 11    */
 12    public class CalculatorTest
 13    extends TestCase
 14    {
 15  1 public void testGeoTransformLatLongToUMT() throws Exception
 16    {
 17  1 Gdc_To_Utm_Converter.Init(new WE_Ellipsoid());
 18   
 19    // 963 hampshire st, san francisco
 20  1 Gdc_Coord_3d gdc_point = new Gdc_Coord_3d(37.7566, -122.4076, 10);
 21  1 Utm_Coord_3d utm_point = new Utm_Coord_3d();
 22   
 23  1 Gdc_To_Utm_Converter.Convert(gdc_point,utm_point);
 24   
 25  1 assertEquals(gdc_point.latitude, 37.7566, .00001);
 26  1 assertEquals(gdc_point.longitude, -122.4076, .00001);
 27  1 assertEquals(gdc_point.elevation, 10, .00001);
 28   
 29  1 assertEquals(552182.81, utm_point.x, .01);
 30  1 assertEquals(4178975.03, utm_point.y, .01);
 31  1 assertEquals(gdc_point.elevation, utm_point.z, .00001);
 32  1 assertEquals(10, utm_point.zone);
 33  1 assertTrue(utm_point.hemisphere_north);
 34    }
 35   
 36  1 public void testPositionToUMTPoint() throws Exception
 37    {
 38  1 Position position = new Position(new Double(37.7566), new Double(-122.4076), null);
 39   
 40  1 UTMPoint utm = Calculator.toUTMPoint(new Position[] { position })[0];
 41  1 assertEquals(552182, utm.getX());
 42  1 assertEquals(4178975, utm.getY());
 43  1 assertEquals(10, utm.getZone());
 44  1 assertTrue(utm.isNorth());
 45    }
 46   
 47  1 public void testGetBounds() throws Exception
 48    {
 49  1 Position position = new Position(new Double(37.997532), new Double(-122.502327), null);
 50  1 UTMPoint[] points = Calculator.toUTMPoint(new Position[] { position } );
 51  1 int metersPerPixel = 2;
 52  1 Dimension size = new Dimension(800, 600);
 53  1 UTMPoint[] bounds = Calculator.getBounds(points, size, metersPerPixel);
 54  1 assertEquals(new UTMPoint(542895, 4205058, 10, true), bounds[0]);
 55  1 assertEquals(new UTMPoint(544495, 4206258, 10, true), bounds[1]);
 56    }
 57    }