1 |
package dk.daoas.fulddaekning;
|
2 |
|
3 |
public class Adresse {
|
4 |
public int id;
|
5 |
public int postnr;
|
6 |
public String adresse;
|
7 |
public int gadeid;
|
8 |
public int husnr;
|
9 |
public String husnrbogstav;
|
10 |
public double latitude;
|
11 |
public double longitude;
|
12 |
public String rute;
|
13 |
|
14 |
|
15 |
@Override
|
16 |
public String toString() {
|
17 |
return "Adresse id=" + id+ " postnr=" + postnr + " adresse=" + adresse;
|
18 |
}
|
19 |
|
20 |
public static double beregnAfstand(Adresse adr1, Adresse adr2) {
|
21 |
//(62.8*sqrt(3.1*(Power(a.Latitude-x.Latitude,2)+Power(a.Longitude-x.Longitude,2)))) as Afstand,
|
22 |
|
23 |
|
24 |
double pwrLat = Math.pow(adr1.latitude - adr2.latitude, 2);
|
25 |
double pwrLng = Math.pow(adr1.longitude-adr2.longitude, 2);
|
26 |
|
27 |
return 62.8 * Math.sqrt( 3.1 * (pwrLat + pwrLng) );
|
28 |
|
29 |
}
|
30 |
|
31 |
|
32 |
|
33 |
}
|