Reformat whole codebase using Android Studio
This commit is contained in:
parent
d5322667d5
commit
c15913c1ab
161 changed files with 15124 additions and 18537 deletions
|
|
@ -10,11 +10,11 @@ import org.junit.Test;
|
|||
|
||||
public class CheapAngleMeterTest {
|
||||
static int toOsmLon(double lon) {
|
||||
return (int)( ( lon + 180. ) / CheapRuler.ILATLNG_TO_LATLNG + 0.5);
|
||||
return (int) ((lon + 180.) / CheapRuler.ILATLNG_TO_LATLNG + 0.5);
|
||||
}
|
||||
|
||||
static int toOsmLat(double lat) {
|
||||
return (int)( ( lat + 90. ) / CheapRuler.ILATLNG_TO_LATLNG + 0.5);
|
||||
return (int) ((lat + 90.) / CheapRuler.ILATLNG_TO_LATLNG + 0.5);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -79,40 +79,38 @@ public class CheapAngleMeterTest {
|
|||
@Test
|
||||
public void testCalcAngle2() {
|
||||
CheapAngleMeter am = new CheapAngleMeter();
|
||||
int lon1 = 8500000;
|
||||
int lon1 = 8500000;
|
||||
int lat1 = 49500000;
|
||||
|
||||
double[] lonlat2m = CheapRuler.getLonLatToMeterScales( lat1 );
|
||||
|
||||
double[] lonlat2m = CheapRuler.getLonLatToMeterScales(lat1);
|
||||
double lon2m = lonlat2m[0];
|
||||
double lat2m = lonlat2m[1];
|
||||
|
||||
for ( double afrom = -175.; afrom < 180.; afrom += 10. )
|
||||
{
|
||||
double sf = Math.sin( afrom * Math.PI / 180. );
|
||||
double cf = Math.cos( afrom * Math.PI / 180. );
|
||||
|
||||
int lon0 = (int)(0.5+lon1 - cf*150./lon2m );
|
||||
int lat0 = (int)(0.5+lat1 - sf*150./lat2m );
|
||||
|
||||
for ( double ato = -177.; ato < 180.; ato += 10. )
|
||||
{
|
||||
double st = Math.sin( ato * Math.PI / 180. );
|
||||
double ct = Math.cos( ato * Math.PI / 180. );
|
||||
|
||||
int lon2 = (int)(0.5+lon1 + ct*250./lon2m);
|
||||
int lat2 = (int)(0.5+lat1 + st*250./lat2m);
|
||||
|
||||
for (double afrom = -175.; afrom < 180.; afrom += 10.) {
|
||||
double sf = Math.sin(afrom * Math.PI / 180.);
|
||||
double cf = Math.cos(afrom * Math.PI / 180.);
|
||||
|
||||
int lon0 = (int) (0.5 + lon1 - cf * 150. / lon2m);
|
||||
int lat0 = (int) (0.5 + lat1 - sf * 150. / lat2m);
|
||||
|
||||
for (double ato = -177.; ato < 180.; ato += 10.) {
|
||||
double st = Math.sin(ato * Math.PI / 180.);
|
||||
double ct = Math.cos(ato * Math.PI / 180.);
|
||||
|
||||
int lon2 = (int) (0.5 + lon1 + ct * 250. / lon2m);
|
||||
int lat2 = (int) (0.5 + lat1 + st * 250. / lat2m);
|
||||
|
||||
double a1 = afrom - ato;
|
||||
if ( a1 > 180. ) a1 -= 360.;
|
||||
if ( a1 < -180. ) a1 += 360.;
|
||||
double a2 = am.calcAngle( lon0, lat0, lon1, lat1, lon2, lat2 );
|
||||
double c1 = Math.cos( a1 * Math.PI / 180. );
|
||||
if (a1 > 180.) a1 -= 360.;
|
||||
if (a1 < -180.) a1 += 360.;
|
||||
double a2 = am.calcAngle(lon0, lat0, lon1, lat1, lon2, lat2);
|
||||
double c1 = Math.cos(a1 * Math.PI / 180.);
|
||||
double c2 = am.getCosAngle();
|
||||
|
||||
assertEquals( "angle mismatch for afrom=" + afrom + " ato=" + ato, a1, a2, 0.2 );
|
||||
assertEquals( "cosinus mismatch for afrom=" + afrom + " ato=" + ato, c1, c2, 0.001 );
|
||||
assertEquals("angle mismatch for afrom=" + afrom + " ato=" + ato, a1, a2, 0.2);
|
||||
assertEquals("cosinus mismatch for afrom=" + afrom + " ato=" + ato, c1, c2, 0.001);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue