- unify coding style (though not to the last detail)
- remove trailing spaces - fix mixed indentation (tabs -> 8 spaces) - throw out braindead FSF coding style that has somehow sneaked in
This commit is contained in:
parent
2c20ef1c7f
commit
62bdd89fd7
2 changed files with 120 additions and 118 deletions
|
@ -57,8 +57,6 @@ SG_USING_STD(random_shuffle);
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* FGAirport
|
||||
***************************************************************************/
|
||||
|
@ -79,6 +77,7 @@ FGAirport::FGAirport(const string &id, double lon, double lat, double elev, cons
|
|||
dynamics = 0;
|
||||
}
|
||||
|
||||
|
||||
FGAirport::~FGAirport()
|
||||
{
|
||||
delete dynamics;
|
||||
|
@ -87,11 +86,9 @@ FGAirport::~FGAirport()
|
|||
|
||||
FGAirportDynamics * FGAirport::getDynamics()
|
||||
{
|
||||
|
||||
if (dynamics != 0)
|
||||
if (dynamics != 0) {
|
||||
return dynamics;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
FGRunwayPreference rwyPrefs;
|
||||
//cerr << "Trying to load dynamics for " << _id << endl;
|
||||
dynamics = new FGAirportDynamics(_latitude, _longitude, _elevation, _id);
|
||||
|
@ -105,27 +102,25 @@ FGAirportDynamics * FGAirport::getDynamics()
|
|||
rwyPrefPath.append( "/Airports/AI/" );
|
||||
rwyPrefPath.append(_id);
|
||||
rwyPrefPath.append("rwyuse.xml");
|
||||
|
||||
//if (ai_dirs.find(id.c_str()) != ai_dirs.end()
|
||||
// && parkpath.exists())
|
||||
if (parkpath.exists())
|
||||
{
|
||||
if (parkpath.exists()) {
|
||||
try {
|
||||
readXML(parkpath.str(),*dynamics);
|
||||
dynamics->init();
|
||||
}
|
||||
catch (const sg_exception &e) {
|
||||
} catch (const sg_exception &e) {
|
||||
//cerr << "unable to read " << parkpath.str() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
//if (ai_dirs.find(id.c_str()) != ai_dirs.end()
|
||||
// && rwyPrefPath.exists())
|
||||
if (rwyPrefPath.exists())
|
||||
{
|
||||
if (rwyPrefPath.exists()) {
|
||||
try {
|
||||
readXML(rwyPrefPath.str(), rwyPrefs);
|
||||
dynamics->setRwyUse(rwyPrefs);
|
||||
}
|
||||
catch (const sg_exception &e) {
|
||||
} catch (const sg_exception &e) {
|
||||
//cerr << "unable to read " << rwyPrefPath.str() << endl;
|
||||
//exit(1);
|
||||
}
|
||||
|
@ -168,7 +163,8 @@ FGAirportList::FGAirportList()
|
|||
}
|
||||
|
||||
|
||||
FGAirportList::~FGAirportList( void ) {
|
||||
FGAirportList::~FGAirportList( void )
|
||||
{
|
||||
for (unsigned int i = 0; i < airports_array.size(); ++i) {
|
||||
delete airports_array[i];
|
||||
}
|
||||
|
@ -183,7 +179,6 @@ void FGAirportList::add( const string &id, const double longitude,
|
|||
FGRunwayPreference rwyPrefs;
|
||||
FGAirport* a = new FGAirport(id, longitude, latitude, elevation, name, has_metar);
|
||||
|
||||
|
||||
airports_by_id[a->getId()] = a;
|
||||
// try and read in an auxilary file
|
||||
|
||||
|
@ -194,14 +189,16 @@ void FGAirportList::add( const string &id, const double longitude,
|
|||
|
||||
|
||||
// search for the specified id
|
||||
FGAirport* FGAirportList::search( const string& id) {
|
||||
FGAirport* FGAirportList::search( const string& id)
|
||||
{
|
||||
airport_map_iterator itr = airports_by_id.find(id);
|
||||
return (itr == airports_by_id.end() ? NULL : itr->second);
|
||||
}
|
||||
|
||||
|
||||
// search for first subsequent alphabetically to supplied id
|
||||
const FGAirport* FGAirportList::findFirstById( const string& id, bool exact ) {
|
||||
const FGAirport* FGAirportList::findFirstById( const string& id, bool exact )
|
||||
{
|
||||
airport_map_iterator itr;
|
||||
if (exact) {
|
||||
itr = airports_by_id.find(id);
|
||||
|
@ -218,7 +215,8 @@ const FGAirport* FGAirportList::findFirstById( const string& id, bool exact ) {
|
|||
|
||||
// search for the airport nearest the specified position
|
||||
FGAirport* FGAirportList::search( double lon_deg, double lat_deg,
|
||||
bool with_metar ) {
|
||||
bool with_metar )
|
||||
{
|
||||
int closest = -1;
|
||||
double min_dist = 360.0;
|
||||
unsigned int i;
|
||||
|
@ -244,6 +242,7 @@ FGAirportList::size () const
|
|||
return airports_array.size();
|
||||
}
|
||||
|
||||
|
||||
const FGAirport *FGAirportList::getAirport( unsigned int index ) const
|
||||
{
|
||||
if (index < airports_array.size()) {
|
||||
|
@ -257,7 +256,8 @@ const FGAirport *FGAirportList::getAirport( unsigned int index ) const
|
|||
/**
|
||||
* Mark the specified airport record as not having metar
|
||||
*/
|
||||
void FGAirportList::no_metar( const string &id ) {
|
||||
void FGAirportList::no_metar( const string &id )
|
||||
{
|
||||
if(airports_by_id.find(id) != airports_by_id.end()) {
|
||||
airports_by_id[id]->setMetar(false);
|
||||
}
|
||||
|
@ -267,14 +267,17 @@ void FGAirportList::no_metar( const string &id ) {
|
|||
/**
|
||||
* Mark the specified airport record as (yes) having metar
|
||||
*/
|
||||
void FGAirportList::has_metar( const string &id ) {
|
||||
void FGAirportList::has_metar( const string &id )
|
||||
{
|
||||
if(airports_by_id.find(id) != airports_by_id.end()) {
|
||||
airports_by_id[id]->setMetar(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// find basic airport location info from airport database
|
||||
const FGAirport *fgFindAirportID( const string& id) {
|
||||
const FGAirport *fgFindAirportID( const string& id)
|
||||
{
|
||||
const FGAirport* result = NULL;
|
||||
if ( id.length() ) {
|
||||
SG_LOG( SG_GENERAL, SG_BULK, "Searching for airport code = " << id );
|
||||
|
@ -299,10 +302,8 @@ const FGAirport *fgFindAirportID( const string& id) {
|
|||
|
||||
|
||||
// get airport elevation
|
||||
double fgGetAirportElev( const string& id ) {
|
||||
|
||||
// double lon, lat;
|
||||
|
||||
double fgGetAirportElev( const string& id )
|
||||
{
|
||||
SG_LOG( SG_GENERAL, SG_BULK,
|
||||
"Finding elevation for airport: " << id );
|
||||
|
||||
|
@ -314,10 +315,10 @@ double fgGetAirportElev( const string& id ) {
|
|||
}
|
||||
}
|
||||
|
||||
// get airport position
|
||||
Point3D fgGetAirportPos( const string& id ) {
|
||||
// double lon, lat;
|
||||
|
||||
// get airport position
|
||||
Point3D fgGetAirportPos( const string& id )
|
||||
{
|
||||
SG_LOG( SG_ATC, SG_BULK,
|
||||
"Finding position for airport: " << id );
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <simgear/math/point3d.hxx>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
//#include <simgear/xml/easyxml.hxx>
|
||||
|
||||
#include STL_STRING
|
||||
#include <map>
|
||||
|
@ -78,24 +77,27 @@ public:
|
|||
FGAirport(const string& id, double lon, double lat, double elev, const string& name, bool has_metar);
|
||||
~FGAirport();
|
||||
|
||||
string getId() const { return _id;};
|
||||
const string &getName() const { return _name;};
|
||||
double getLongitude() const { return _longitude;};
|
||||
string getId() const { return _id; }
|
||||
const string &getName() const { return _name; }
|
||||
double getLongitude() const { return _longitude; }
|
||||
// Returns degrees
|
||||
double getLatitude() const { return _latitude; };
|
||||
double getLatitude() const { return _latitude; }
|
||||
// Returns ft
|
||||
double getElevation() const { return _elevation;};
|
||||
bool getMetar() const { return _has_metar;};
|
||||
double getElevation() const { return _elevation; }
|
||||
bool getMetar() const { return _has_metar; }
|
||||
|
||||
void setId(const string& id) { _id = id;};
|
||||
void setMetar(bool value) { _has_metar = value; };
|
||||
void setId(const string& id) { _id = id; }
|
||||
void setMetar(bool value) { _has_metar = value; }
|
||||
|
||||
FGAirportDynamics *getDynamics();
|
||||
|
||||
private:
|
||||
FGAirport operator=(FGAirport &other);
|
||||
FGAirport(const FGAirport&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
typedef map < string, FGAirport* > airport_map;
|
||||
typedef airport_map::iterator airport_map_iterator;
|
||||
typedef airport_map::const_iterator const_airport_map_iterator;
|
||||
|
@ -105,8 +107,8 @@ typedef airport_list::iterator airport_list_iterator;
|
|||
typedef airport_list::const_iterator const_airport_list_iterator;
|
||||
|
||||
|
||||
class FGAirportList {
|
||||
|
||||
class FGAirportList {
|
||||
private:
|
||||
|
||||
airport_map airports_by_id;
|
||||
|
@ -114,7 +116,6 @@ private:
|
|||
//set < string > ai_dirs;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor (new)
|
||||
FGAirportList();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue