1
0
Fork 0

Convert remaining runway functions to SGGeod

This commit is contained in:
Christian Schmitt 2012-10-18 13:27:09 +02:00
parent 8d4495d470
commit e4e7d8bffd
3 changed files with 6 additions and 6 deletions

View file

@ -560,8 +560,8 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
int num_samples = 0; int num_samples = 0;
for (unsigned int i=0; i<runways.size(); i++) for (unsigned int i=0; i<runways.size(); i++)
{ {
apt_lon += runways[i]->GetMidpoint().x(); apt_lon += runways[i]->GetMidpoint().getLongitudeDeg();
apt_lat += runways[i]->GetMidpoint().y(); apt_lat += runways[i]->GetMidpoint().getLatitudeDeg();
num_samples++; num_samples++;
} }
for (unsigned int i=0; i<helipads.size(); i++) for (unsigned int i=0; i<helipads.size(); i++)

View file

@ -3,7 +3,7 @@
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/bucket/newbucket.hxx> #include <simgear/bucket/newbucket.hxx>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/SGGeodesy.hxx>
#include <Geometry/poly_support.hxx> #include <Geometry/poly_support.hxx>
#include <Polygon/polygon.hxx> #include <Polygon/polygon.hxx>
@ -46,7 +46,7 @@ Runway::Runway(char* definition)
); );
// calculate runway heading and length (used a lot) // calculate runway heading and length (used a lot)
geo_inverse_wgs_84( rwy.lat[0], rwy.lon[0], rwy.lat[1], rwy.lon[1], &rwy.heading, &az2, &rwy.length ); SGGeodesy::inverse( GetStart(), GetEnd(), rwy.heading, az2, rwy.length );
SG_LOG(SG_GENERAL, SG_DEBUG, "Read runway: (" << rwy.lon[0] << "," << rwy.lat[0] << ") to (" << rwy.lon[1] << "," << rwy.lat[1] << ") heading: " << rwy.heading << " length: " << rwy.length << " width: " << rwy.width ); SG_LOG(SG_GENERAL, SG_DEBUG, "Read runway: (" << rwy.lon[0] << "," << rwy.lat[0] << ") to (" << rwy.lon[1] << "," << rwy.lat[1] << ") heading: " << rwy.heading << " length: " << rwy.length << " width: " << rwy.width );

View file

@ -29,9 +29,9 @@ public:
return SGGeod::fromDeg(rwy.lon[1], rwy.lat[1]); return SGGeod::fromDeg(rwy.lon[1], rwy.lat[1]);
} }
Point3D GetMidpoint(void) SGGeod GetMidpoint()
{ {
return ( Point3D( (rwy.lon[0]+rwy.lon[1])/2.0f, (rwy.lat[0]+rwy.lat[1])/2.0f, 0.0f) ); return SGGeod::fromDeg( (rwy.lon[0]+rwy.lon[1])/2.0f, (rwy.lat[0]+rwy.lat[1])/2.0f);
} }
bool GetsShoulder() bool GetsShoulder()