X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=src%2FAirports%2Fgnnode.cxx;h=41e746305cde34e123f89d50559c41a9e670cf52;hb=b1ff365a8f0bf2f25f030ef2058c42f3052e0d8b;hp=ae37d59594a03b65fc86847563820028659507ba;hpb=63708fb0df81a357173499d0c1950525f387db44;p=flightgear.git diff --git a/src/Airports/gnnode.cxx b/src/Airports/gnnode.cxx index ae37d5959..41e746305 100644 --- a/src/Airports/gnnode.cxx +++ b/src/Airports/gnnode.cxx @@ -1,76 +1,63 @@ #include "gnnode.hxx" -#include "groundnetwork.hxx" -#include -using std::sort; +#include -/***************************************************************************** - * Helper function for parsing position string - ****************************************************************************/ -double processPosition(const string &pos) -{ - string prefix; - string subs; - string degree; - string decimal; - int sign = 1; - double value; - subs = pos; - prefix= subs.substr(0,1); - if (prefix == string("S") || (prefix == string("W"))) - sign = -1; - subs = subs.substr(1, subs.length()); - degree = subs.substr(0, subs.find(" ",0)); - decimal = subs.substr(subs.find(" ",0), subs.length()); - - - //cerr << sign << " "<< degree << " " << decimal << endl; - value = sign * (atof(degree.c_str()) + atof(decimal.c_str())/60.0); - //cerr << value <hasSmallerHeadingDiff(*b); -//} +#include "groundnetwork.hxx" -bool sortByLength(FGTaxiSegment *a, FGTaxiSegment *b) { - return a->getLength() > b->getLength(); -} +#include
+#include /************************************************************************** * FGTaxiNode *************************************************************************/ -void FGTaxiNode::setElevation(double val) + +FGTaxiNode::FGTaxiNode(PositionedID aGuid, int index, const SGGeod& pos, bool aOnRunway, int aHoldType) : + FGPositioned(aGuid, FGPositioned::PARKING, "", pos), + index(index), + isOnRunway(aOnRunway), + holdType(aHoldType) { - geod.setElevationM(val); + } -void FGTaxiNode::setLatitude (double val) +FGTaxiNode::~FGTaxiNode() { - geod.setLatitudeDeg(val); } -void FGTaxiNode::setLongitude(double val) +void FGTaxiNode::setElevation(double val) { - geod.setLongitudeDeg(val); + // ignored for the moment } -void FGTaxiNode::setLatitude (const string& val) +double FGTaxiNode::getElevationFt(double refelev) { - geod.setLatitudeDeg(processPosition(val)); + double elevF = elevation(); +#if 0 + double elevationEnd = 0; + if ((elevF == 0) || (elevF == refelev)) { + SGGeod center2 = mPosition; + FGScenery * local_scenery = globals->get_scenery(); + center2.setElevationM(SG_MAX_ELEVATION_M); + if (local_scenery->get_elevation_m( center2, elevationEnd, NULL )) { + geod.setElevationM(elevationEnd); + } + } +#endif + return mPosition.getElevationFt(); } -void FGTaxiNode::setLongitude(const string& val) +double FGTaxiNode::getElevationM(double refelev) { - geod.setLongitudeDeg(processPosition(val)); + return geod().getElevationM(); } + +FGTaxiSegment* FGTaxiNode::getArcTo(FGTaxiNode* aEnd) const +{ + BOOST_FOREACH(FGTaxiSegment* arc, next) { + if (arc->getEnd() == aEnd) { + return arc; + } + } -//void FGTaxiNode::sortEndSegments(bool byLength) -//{ -// if (byLength) -// sort(next.begin(), next.end(), sortByLength); -// else -// sort(next.begin(), next.end(), sortByHeadingDiff); -//} + return NULL; +}