Cache the parsed navigation and airport data in a binary file to reduce startup times and memory consumption (since only referenced FGPositioned elements are held in memory). Data will be reimported when the mod-time of any input file is changed. If a global file is changed (nav.dat, awy.dat, apt.dat, etc), the cache will be completely rebuilt, which takes approximately 30 seconds on moderate hardware. (Future work may reduce this).
132 lines
3.4 KiB
C++
132 lines
3.4 KiB
C++
// runways.hxx -- a simple class to manage airport runway info
|
|
//
|
|
// Written by Curtis Olson, started August 2000.
|
|
//
|
|
// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
|
|
//
|
|
// This program is free software; you can redistribute it and/or
|
|
// modify it under the terms of the GNU General Public License as
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
// License, or (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful, but
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with this program; if not, write to the Free Software
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
//
|
|
// $Id$
|
|
|
|
|
|
#ifndef _FG_RUNWAYS_HXX
|
|
#define _FG_RUNWAYS_HXX
|
|
|
|
#include <simgear/compiler.h>
|
|
|
|
#include <Airports/runwaybase.hxx>
|
|
|
|
// forward decls
|
|
class FGAirport;
|
|
class FGNavRecord;
|
|
class SGPropertyNode;
|
|
|
|
namespace flightgear {
|
|
class SID;
|
|
class STAR;
|
|
class Approach;
|
|
}
|
|
|
|
class FGRunway : public FGRunwayBase
|
|
{
|
|
PositionedID _airport;
|
|
bool _isReciprocal;
|
|
PositionedID _reciprocal;
|
|
double _displ_thresh;
|
|
double _stopway;
|
|
PositionedID _ils;
|
|
public:
|
|
|
|
FGRunway(PositionedID aGuid,
|
|
PositionedID aAirport, const std::string& rwy_no,
|
|
const SGGeod& aGeod,
|
|
const double heading, const double length,
|
|
const double width,
|
|
const double displ_thresh,
|
|
const double stopway,
|
|
const int surface_code,
|
|
const bool reciprocal);
|
|
|
|
/**
|
|
* given a runway identifier (06, 18L, 31R) compute the identifier for the
|
|
* reciprocal heading runway (24, 36R, 13L) string.
|
|
*/
|
|
static std::string reverseIdent(const std::string& aRunayIdent);
|
|
|
|
/**
|
|
* score this runway according to the specified weights. Used by
|
|
* FGAirport::findBestRunwayForHeading
|
|
*/
|
|
double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
|
|
|
|
/**
|
|
* Test if this runway is the reciprocal. This allows users who iterate
|
|
* over runways to avoid counting runways twice, if desired.
|
|
*/
|
|
bool isReciprocal() const
|
|
{ return _isReciprocal; }
|
|
|
|
/**
|
|
* Get the runway beginning point - this is syntatic sugar, equivalent to
|
|
* calling pointOnCenterline(0.0);
|
|
*/
|
|
SGGeod begin() const;
|
|
|
|
/**
|
|
* Get the (possibly displaced) threshold point.
|
|
*/
|
|
SGGeod threshold() const;
|
|
|
|
/**
|
|
* Get the 'far' end - this is equivalent to calling
|
|
* pointOnCenterline(lengthFt());
|
|
*/
|
|
SGGeod end() const;
|
|
|
|
double displacedThresholdM() const
|
|
{ return _displ_thresh * SG_FEET_TO_METER; }
|
|
|
|
double stopwayM() const
|
|
{ return _stopway * SG_FEET_TO_METER; }
|
|
|
|
/**
|
|
* Airport this runway is located at
|
|
*/
|
|
FGAirport* airport() const;
|
|
|
|
FGNavRecord* ILS() const;
|
|
|
|
void setILS(PositionedID nav) { _ils = nav; }
|
|
|
|
FGRunway* reciprocalRunway() const;
|
|
|
|
void setReciprocalRunway(PositionedID other);
|
|
|
|
/**
|
|
* Get SIDs (DPs) associated with this runway
|
|
*/
|
|
std::vector<flightgear::SID*> getSIDs() const;
|
|
|
|
/**
|
|
* Get STARs associared with this runway
|
|
*/
|
|
std::vector<flightgear::STAR*> getSTARs() const;
|
|
|
|
|
|
std::vector<flightgear::Approach*> getApproaches() const;
|
|
|
|
};
|
|
|
|
#endif // _FG_RUNWAYS_HXX
|