epfl-archive/Alpano/tests/ch/epfl/alpano/dem/ElevationProfileTest.java

50 lines
1.3 KiB
Java
Raw Normal View History

2022-04-07 18:43:21 +02:00
package ch.epfl.alpano.dem;
import static java.lang.Math.toRadians;
import static org.junit.Assert.*;
import java.io.File;
import org.junit.Test;
import ch.epfl.alpano.GeoPoint;
public class ElevationProfileTest {
final static File HGT_FILE = new File("HGT"+File.separatorChar+"N46E006.hgt");
final static double AZIMUTH = toRadians(45.0);
final static double LONGITUDE = toRadians(6.0);
final static double LATITUDE = toRadians(46.0);
final static int LENGTH = 111_000;
@Test
public void testElevationProfile() {
DiscreteElevationModel dDEM =
new HgtDiscreteElevationModel(HGT_FILE);
ContinuousElevationModel cDEM =
new ContinuousElevationModel(dDEM);
GeoPoint o =
new GeoPoint(LONGITUDE, LATITUDE);
ElevationProfile p =
new ElevationProfile(cDEM, o, AZIMUTH, LENGTH);
assertEquals(toRadians(6.09385),p.positionAt(10240).longitude(),0.00001);
assertEquals(toRadians(46.06508),p.positionAt(10240).latitude(),0.00001);
}
/*
@Test
public void testElevationAt() {
fail("Not yet implemented");
}
@Test
public void testPositionAt() {
fail("Not yet implemented");
}
@Test
public void testSlopeAt() {
fail("Not yet implemented");
}
*/
}