1
0
Fork 0

Maintenance: gnnode

SPDX tags.
header guard.
reduce variable scope visibility.
This commit is contained in:
scttgs0 2023-05-23 19:40:20 -05:00
parent f69d069175
commit 1dbe8c60f7
2 changed files with 50 additions and 68 deletions

View file

@ -1,59 +1,55 @@
#include "config.h"
#include "gnnode.hxx"
#include "groundnetwork.hxx"
#include <Navaids/NavDataCache.hxx>
#include <Main/globals.hxx>
#include <Navaids/NavDataCache.hxx>
#include <Scenery/scenery.hxx>
#include "gnnode.hxx"
#include "groundnetwork.hxx"
using namespace flightgear;
/**************************************************************************
* FGTaxiNode
*************************************************************************/
FGTaxiNode::FGTaxiNode(FGPositioned::Type ty, int index, const SGGeod& pos,
bool aOnRunway, int aHoldType,
const std::string& ident) :
FGPositioned(TRANSIENT_ID, ty, ident, pos),
m_index(index),
isOnRunway(aOnRunway),
holdType(aHoldType),
m_isPushback(false)
const std::string& ident) : FGPositioned(TRANSIENT_ID, ty, ident, pos),
m_index(index),
isOnRunway(aOnRunway),
holdType(aHoldType),
m_isPushback(false)
{
}
void FGTaxiNode::setElevation(double val)
{
// ignored for the moment
// ignored for the moment
}
double FGTaxiNode::getElevationFt()
{
const SGGeod& pos = geod();
if( pos.getElevationFt() == 0.0)
{
SGGeod center2 = pos;
FGScenery* local_scenery = globals->get_scenery();
center2.setElevationM(SG_MAX_ELEVATION_M);
double elevationEnd = -100;
if(local_scenery) {
if (local_scenery->get_elevation_m( center2, elevationEnd, NULL ))
{
SGGeod newPos = pos;
newPos.setElevationM(elevationEnd);
// this will call modifyPosition to update mPosition
modifyPosition(newPos);
}
} else {
SG_LOG( SG_TERRAIN, SG_ALERT, "Terrain not inited" );
}
}
const SGGeod& pos = geod();
if (pos.getElevationFt() == 0.0) {
SGGeod center2 = pos;
FGScenery* local_scenery = globals->get_scenery();
center2.setElevationM(SG_MAX_ELEVATION_M);
if (local_scenery) {
double elevationEnd = -100;
if (local_scenery->get_elevation_m(center2, elevationEnd, NULL)) {
SGGeod newPos = pos;
newPos.setElevationM(elevationEnd);
// this will call modifyPosition to update mPosition
modifyPosition(newPos);
}
} else {
SG_LOG(SG_TERRAIN, SG_ALERT, "Terrain not inited");
}
}
return pos.getElevationFt();
return pos.getElevationFt();
}
int FGTaxiNode::getIndex() const
@ -68,5 +64,5 @@ void FGTaxiNode::setIsPushback()
double FGTaxiNode::getElevationM()
{
return getElevationFt() * SG_FEET_TO_METER;
return getElevationFt() * SG_FEET_TO_METER;
}

View file

@ -1,52 +1,38 @@
// 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.
//
/*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _GN_NODE_HXX_
#define _GN_NODE_HXX_
#pragma once
#include <simgear/compiler.h>
#include <simgear/structure/SGSharedPtr.hxx>
#include <Navaids/positioned.hxx>
class FGTaxiNode : public FGPositioned
{
protected:
const int m_index;
const bool isOnRunway;
const int holdType;
bool m_isPushback;
const bool isOnRunway;
const int holdType;
bool m_isPushback;
public:
FGTaxiNode(FGPositioned::Type ty, int index, const SGGeod& pos, bool aOnRunway, int aHoldType,
const std::string& ident = {});
public:
FGTaxiNode(FGPositioned::Type ty, int index, const SGGeod& pos, bool aOnRunway, int aHoldType, const std::string& ident = {});
virtual ~FGTaxiNode() = default;
void setElevation(double val);
double getElevationM ();
double getElevationFt();
int getIndex() const;
void setElevation(double val);
int getHoldPointType() const { return holdType; };
bool getIsOnRunway() const { return isOnRunway; };
bool isPushback() const { return m_isPushback; }
double getElevationM();
double getElevationFt();
void setIsPushback();
int getIndex() const;
int getHoldPointType() const { return holdType; };
bool getIsOnRunway() const { return isOnRunway; };
bool isPushback() const { return m_isPushback; }
void setIsPushback();
};
#endif