2000-08-16 01:28:33 +00:00
|
|
|
// runways.hxx -- a simple class to manage airport runway info
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started August 2000.
|
|
|
|
//
|
2004-11-19 22:10:41 +00:00
|
|
|
// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
|
2000-08-16 01:28:33 +00:00
|
|
|
//
|
|
|
|
// 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
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2000-08-16 01:28:33 +00:00
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
#ifndef _FG_RUNWAYS_HXX
|
|
|
|
#define _FG_RUNWAYS_HXX
|
2000-08-16 01:28:33 +00:00
|
|
|
|
|
|
|
#include <simgear/compiler.h>
|
|
|
|
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
#include <simgear/math/sg_geodesy.hxx>
|
|
|
|
|
|
|
|
#include "Navaids/positioned.hxx"
|
|
|
|
|
2008-07-25 18:38:29 +00:00
|
|
|
#include <string>
|
2000-08-16 01:28:33 +00:00
|
|
|
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
// forward decls
|
|
|
|
class FGAirport;
|
|
|
|
|
|
|
|
class FGRunway : public FGPositioned
|
|
|
|
{
|
|
|
|
FGAirport* _airport; ///< owning airport
|
|
|
|
bool _reciprocal;
|
2008-08-14 18:13:39 +00:00
|
|
|
public:
|
|
|
|
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
FGRunway(FGAirport* aAirport, const std::string& rwy_no,
|
2008-08-14 18:13:39 +00:00
|
|
|
const double longitude, const double latitude,
|
|
|
|
const double heading, const double length,
|
|
|
|
const double width,
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
const double displ_thresh,
|
|
|
|
const double stopway,
|
|
|
|
const int surface_code,
|
|
|
|
const bool reciprocal);
|
2008-08-14 18:13:39 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* given a runway identifier (06, 18L, 31R) compute the identifier for the
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
* reciprocal heading runway (24, 36R, 13L) string.
|
2008-08-14 18:13:39 +00:00
|
|
|
*/
|
|
|
|
static std::string reverseIdent(const std::string& aRunayIdent);
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
|
2008-08-14 18:13:39 +00:00
|
|
|
/**
|
|
|
|
* score this runway according to the specified weights. Used by
|
|
|
|
* FGAirport::findBestRunwayForHeading
|
|
|
|
*/
|
|
|
|
double score(double aLengthWt, double aWidthWt, double aSurfaceWt) const;
|
|
|
|
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
/**
|
|
|
|
* 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 _reciprocal; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test if this is a taxiway or not
|
|
|
|
*/
|
2008-08-14 18:13:39 +00:00
|
|
|
bool isTaxiway() const;
|
|
|
|
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
/**
|
|
|
|
* Get the runway threshold point - this is syntatic sugar, equivalent to
|
|
|
|
* calling pointOnCenterline(0.0);
|
|
|
|
*/
|
|
|
|
SGGeod threshold() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the (possibly displaced) threshold point.
|
|
|
|
*/
|
|
|
|
SGGeod displacedThreshold() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the opposite threshold - this is equivalent to calling
|
|
|
|
* pointOnCenterline(lengthFt());
|
|
|
|
*/
|
|
|
|
SGGeod reverseThreshold() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve a position on the extended runway centerline. Positive values
|
|
|
|
* are in the direction of the runway heading, negative values are in the
|
|
|
|
* opposited direction. 0.0 corresponds to the (non-displaced) threshold
|
|
|
|
*/
|
|
|
|
SGGeod pointOnCenterline(double aOffset) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runway length in ft
|
|
|
|
*/
|
|
|
|
double lengthFt() const
|
|
|
|
{ return _length; }
|
|
|
|
|
|
|
|
double lengthM() const
|
|
|
|
{ return _length * SG_FEET_TO_METER; }
|
|
|
|
|
|
|
|
double widthFt() const
|
|
|
|
{ return _width; }
|
|
|
|
|
|
|
|
double widthM() const
|
|
|
|
{ return _width * SG_FEET_TO_METER; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Runway heading in degrees.
|
|
|
|
*/
|
|
|
|
double headingDeg() const
|
|
|
|
{ return _heading; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Airport this runway is located at
|
|
|
|
*/
|
|
|
|
FGAirport* airport() const
|
|
|
|
{ return _airport; }
|
|
|
|
|
|
|
|
// FIXME - should die once airport / runway creation is cleaned up
|
|
|
|
void setAirport(FGAirport* aAirport)
|
|
|
|
{ _airport = aAirport; }
|
|
|
|
|
2008-12-23 12:37:59 +00:00
|
|
|
int surface() const
|
|
|
|
{ return _surface_code; }
|
|
|
|
|
2008-08-14 18:13:39 +00:00
|
|
|
std::string _rwy_no;
|
2004-12-22 23:57:07 +00:00
|
|
|
|
|
|
|
double _lon;
|
|
|
|
double _lat;
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
double _displ_thresh;
|
|
|
|
double _stopway;
|
|
|
|
|
2004-12-22 23:57:07 +00:00
|
|
|
double _heading;
|
|
|
|
double _length;
|
|
|
|
double _width;
|
James Turner:
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
2008-09-11 08:38:09 +00:00
|
|
|
|
2004-12-22 23:57:07 +00:00
|
|
|
int _surface_code;
|
2000-08-16 01:28:33 +00:00
|
|
|
};
|
|
|
|
|
2003-08-29 04:11:23 +00:00
|
|
|
#endif // _FG_RUNWAYS_HXX
|