Remove method FGAirport::isAirportType()
FGAirport::isAirportType() was redundant with FGPositioned::isAirportType(). Remove the former and change existing calls to use the latter.
This commit is contained in:
parent
a2254d891a
commit
0537d569d5
4 changed files with 11 additions and 21 deletions
|
@ -107,12 +107,6 @@ bool FGAirport::isHeliport() const
|
||||||
return type() == HELIPORT;
|
return type() == HELIPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Static method
|
|
||||||
bool FGAirport::isAirportType(FGPositioned* pos)
|
|
||||||
{
|
|
||||||
return FGPositioned::isAirportType(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
unsigned int FGAirport::numRunways() const
|
unsigned int FGAirport::numRunways() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,10 +74,6 @@ class FGAirport : public FGPositioned
|
||||||
return mIsClosed;
|
return mIsClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// True for the following types: AIRPORT, HELIPORT, SEAPORT.
|
|
||||||
// False for other types, as well as if pos == nullptr.
|
|
||||||
static bool isAirportType(FGPositioned* pos);
|
|
||||||
|
|
||||||
virtual const std::string& name() const
|
virtual const std::string& name() const
|
||||||
{ return _name; }
|
{ return _name; }
|
||||||
|
|
||||||
|
|
|
@ -254,7 +254,7 @@ void BaseDiagram::splitItems(const FGPositionedList& in, FGPositionedList& navai
|
||||||
{
|
{
|
||||||
FGPositionedList::const_iterator it = in.begin();
|
FGPositionedList::const_iterator it = in.begin();
|
||||||
for (; it != in.end(); ++it) {
|
for (; it != in.end(); ++it) {
|
||||||
if (FGAirport::isAirportType(it->ptr())) {
|
if (FGPositioned::isAirportType(it->ptr())) {
|
||||||
ports.push_back(*it);
|
ports.push_back(*it);
|
||||||
} else {
|
} else {
|
||||||
navaids.push_back(*it);
|
navaids.push_back(*it);
|
||||||
|
@ -370,7 +370,7 @@ void BaseDiagram::paintNavaid(QPainter* painter, const QTransform& t, const FGPo
|
||||||
|
|
||||||
// compute label text so we can measure it
|
// compute label text so we can measure it
|
||||||
QString label;
|
QString label;
|
||||||
if (FGAirport::isAirportType(pos.ptr())) {
|
if (FGPositioned::isAirportType(pos.ptr())) {
|
||||||
label = QString::fromStdString(pos->name());
|
label = QString::fromStdString(pos->name());
|
||||||
label = fixNavaidName(label);
|
label = fixNavaidName(label);
|
||||||
} else {
|
} else {
|
||||||
|
@ -685,7 +685,7 @@ QPixmap BaseDiagram::iconForPositioned(const FGPositionedRef& pos,
|
||||||
bool small = options.testFlag(SmallIcons);
|
bool small = options.testFlag(SmallIcons);
|
||||||
|
|
||||||
bool isTowered = false;
|
bool isTowered = false;
|
||||||
if (FGAirport::isAirportType(pos)) {
|
if (FGPositioned::isAirportType(pos.ptr())) {
|
||||||
FGAirport* apt = static_cast<FGAirport*>(pos.ptr());
|
FGAirport* apt = static_cast<FGAirport*>(pos.ptr());
|
||||||
isTowered = apt->hasTower();
|
isTowered = apt->hasTower();
|
||||||
}
|
}
|
||||||
|
|
|
@ -463,7 +463,7 @@ void LocationWidget::restoreLocation(QVariantMap l)
|
||||||
|
|
||||||
// now we've loaded airport location data (potentially), we can apply
|
// now we've loaded airport location data (potentially), we can apply
|
||||||
// more settings
|
// more settings
|
||||||
if (FGAirport::isAirportType(m_location.ptr())) {
|
if (FGPositioned::isAirportType(m_location.ptr())) {
|
||||||
if (l.contains("location-apt-runway")) {
|
if (l.contains("location-apt-runway")) {
|
||||||
QString runway = l.value("location-apt-runway").toString();
|
QString runway = l.value("location-apt-runway").toString();
|
||||||
int index = m_ui->runwayCombo->findText(runway);
|
int index = m_ui->runwayCombo->findText(runway);
|
||||||
|
@ -494,7 +494,7 @@ bool LocationWidget::shouldStartPaused() const
|
||||||
return false; // defaults to on-ground at KSFO
|
return false; // defaults to on-ground at KSFO
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FGAirport::isAirportType(m_location.ptr())) {
|
if (FGPositioned::isAirportType(m_location.ptr())) {
|
||||||
return m_ui->onFinalCheckbox->isChecked();
|
return m_ui->onFinalCheckbox->isChecked();
|
||||||
} else {
|
} else {
|
||||||
// navaid, start paused
|
// navaid, start paused
|
||||||
|
@ -511,7 +511,7 @@ QVariantMap LocationWidget::saveLocation() const
|
||||||
} else if (m_location) {
|
} else if (m_location) {
|
||||||
locationSet.insert("location-id", static_cast<qlonglong>(m_location->guid()));
|
locationSet.insert("location-id", static_cast<qlonglong>(m_location->guid()));
|
||||||
|
|
||||||
if (FGAirport::isAirportType(m_location.ptr())) {
|
if (FGPositioned::isAirportType(m_location.ptr())) {
|
||||||
locationSet.insert("location-on-final", m_ui->onFinalCheckbox->isChecked());
|
locationSet.insert("location-on-final", m_ui->onFinalCheckbox->isChecked());
|
||||||
locationSet.insert("location-apt-final-distance", m_ui->approachDistanceSpin->value());
|
locationSet.insert("location-apt-final-distance", m_ui->approachDistanceSpin->value());
|
||||||
if (m_ui->runwayRadio->isChecked()) {
|
if (m_ui->runwayRadio->isChecked()) {
|
||||||
|
@ -574,7 +574,7 @@ void LocationWidget::setLocationProperties()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FGAirport::isAirportType(m_location.ptr())) {
|
if (FGPositioned::isAirportType(m_location.ptr())) {
|
||||||
FGAirport* apt = static_cast<FGAirport*>(m_location.ptr());
|
FGAirport* apt = static_cast<FGAirport*>(m_location.ptr());
|
||||||
fgSetString("/sim/presets/airport-id", apt->ident());
|
fgSetString("/sim/presets/airport-id", apt->ident());
|
||||||
fgSetBool("/sim/presets/on-ground", true);
|
fgSetBool("/sim/presets/on-ground", true);
|
||||||
|
@ -685,7 +685,7 @@ void LocationWidget::onCollectConfig()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FGAirport::isAirportType(m_location.ptr())) {
|
if (FGPositioned::isAirportType(m_location.ptr())) {
|
||||||
FGAirport* apt = static_cast<FGAirport*>(m_location.ptr());
|
FGAirport* apt = static_cast<FGAirport*>(m_location.ptr());
|
||||||
m_config->setArg("airport", QString::fromStdString(apt->ident()));
|
m_config->setArg("airport", QString::fromStdString(apt->ident()));
|
||||||
|
|
||||||
|
@ -814,7 +814,7 @@ void LocationWidget::onSearchComplete()
|
||||||
|
|
||||||
void LocationWidget::onLocationChanged()
|
void LocationWidget::onLocationChanged()
|
||||||
{
|
{
|
||||||
bool locIsAirport = FGAirport::isAirportType(m_location.ptr());
|
bool locIsAirport = FGPositioned::isAirportType(m_location.ptr());
|
||||||
if (!m_location) {
|
if (!m_location) {
|
||||||
onBackToSearch();
|
onBackToSearch();
|
||||||
return;
|
return;
|
||||||
|
@ -951,7 +951,7 @@ QString LocationWidget::locationDescription() const
|
||||||
return tr("No location selected");
|
return tr("No location selected");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool locIsAirport = FGAirport::isAirportType(m_location.ptr());
|
bool locIsAirport = FGPositioned::isAirportType(m_location.ptr());
|
||||||
QString ident = QString::fromStdString(m_location->ident()),
|
QString ident = QString::fromStdString(m_location->ident()),
|
||||||
name = QString::fromStdString(m_location->name());
|
name = QString::fromStdString(m_location->name());
|
||||||
|
|
||||||
|
@ -1009,7 +1009,7 @@ QString LocationWidget::locationDescription() const
|
||||||
|
|
||||||
void LocationWidget::updateDescription()
|
void LocationWidget::updateDescription()
|
||||||
{
|
{
|
||||||
bool locIsAirport = FGAirport::isAirportType(m_location.ptr());
|
bool locIsAirport = FGPositioned::isAirportType(m_location.ptr());
|
||||||
if (locIsAirport) {
|
if (locIsAirport) {
|
||||||
FGAirport* apt = static_cast<FGAirport*>(m_location.ptr());
|
FGAirport* apt = static_cast<FGAirport*>(m_location.ptr());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue