Skip to content

Commit

Permalink
Nomenclature: fix search by name
Browse files Browse the repository at this point in the history
The problem is that the initialized of NomenclatureItem are always set
to true in the constructor, but they should be only set once we have
computed the position.

For the moment I add some position length tests, but that is not very
clean.
  • Loading branch information
guillaumechereau committed Oct 30, 2017
1 parent fae6603 commit af2be46
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/modules/NomenclatureMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,10 @@ StelObjectP NomenclatureMgr::searchByName(const QString& englishName) const
{
foreach(const NomenclatureItemP& nItem, nomenclatureItems)
{
if (nItem->getNomenclatureType()!=NomenclatureItem::niSatelliteFeature && nItem->getEnglishName().toUpper() == englishName.toUpper())
if (nItem->initialized && nItem->XYZ.lengthSquared() > 0 && nItem->getNomenclatureType()!=NomenclatureItem::niSatelliteFeature && nItem->getEnglishName().toUpper() == englishName.toUpper())
{
return qSharedPointerCast<StelObject>(nItem);
}
}
}

Expand All @@ -476,8 +478,10 @@ StelObjectP NomenclatureMgr::searchByNameI18n(const QString& nameI18n) const
{
foreach(const NomenclatureItemP& nItem, nomenclatureItems)
{
if (nItem->getNomenclatureType()!=NomenclatureItem::niSatelliteFeature && nItem->getNameI18n().toUpper() == nameI18n.toUpper())
if (nItem->initialized && nItem->XYZ.lengthSquared() > 0 && nItem->getNomenclatureType()!=NomenclatureItem::niSatelliteFeature && nItem->getNameI18n().toUpper() == nameI18n.toUpper())
{
return qSharedPointerCast<StelObject>(nItem);
}
}
}

Expand Down

0 comments on commit af2be46

Please sign in to comment.