SolarSystem.cpp   SolarSystem.cpp 
skipping to change at line 1362 skipping to change at line 1362
double r_penumbra = shadow.length()*702378.1/AU/e.length() - 696000/ AU; double r_penumbra = shadow.length()*702378.1/AU/e.length() - 696000/ AU;
// modify shadow location for scaled moon // modify shadow location for scaled moon
Vec3d mdist = shadow - mh; Vec3d mdist = shadow - mh;
if(mdist.length() > r_penumbra + 2000/AU) return 0; // not visible so don't bother drawing if(mdist.length() > r_penumbra + 2000/AU) return 0; // not visible so don't bother drawing
return 1; return 1;
} }
//! Find and return the list of at most maxNbItem objects auto-completing t he passed object I18n name //! Find and return the list of at most maxNbItem objects auto-completing t he passed object I18n name
QStringList SolarSystem::listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem) const QStringList SolarSystem::listMatchingObjectsI18n(const QString& objPrefix, int maxNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString sson; QString sson;
bool find;
foreach (const PlanetP& p, systemPlanets) foreach (const PlanetP& p, systemPlanets)
{ {
sson = p->getNameI18n(); sson = p->getNameI18n();
if (sson.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
QString constw = sson.mid(0, objPrefix.size()).toUpp
er();
if (constw==objPrefix.toUpper())
find = true;
}
else
{
if (sson.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << sson; result << sson;
if (result.size()==maxNbItem) if (result.size()==maxNbItem)
return result; return result;
} }
} }
return result; return result;
} }
//! Find and return the list of at most maxNbItem objects auto-completing t he passed object English name //! Find and return the list of at most maxNbItem objects auto-completing t he passed object English name
QStringList SolarSystem::listMatchingObjects(const QString& objPrefix, int maxNbItem) const QStringList SolarSystem::listMatchingObjects(const QString& objPrefix, int maxNbItem, bool useStartOfWords) const
{ {
QStringList result; QStringList result;
if (maxNbItem==0) if (maxNbItem==0)
return result; return result;
QString sson; QString sson;
bool find;
foreach (const PlanetP& p, systemPlanets) foreach (const PlanetP& p, systemPlanets)
{ {
sson = p->getEnglishName(); sson = p->getEnglishName();
if (sson.contains(objPrefix, Qt::CaseInsensitive)) find = false;
if (useStartOfWords)
{
QString constw = sson.mid(0, objPrefix.size()).toUpp
er();
if (constw==objPrefix.toUpper())
find = true;
}
else
{
if (sson.contains(objPrefix, Qt::CaseInsensitive))
find = true;
}
if (find)
{ {
result << sson; result << sson;
if (result.size()==maxNbItem) if (result.size()==maxNbItem)
return result; return result;
} }
} }
return result; return result;
} }
QStringList SolarSystem::listAllObjects(bool inEnglish) const QStringList SolarSystem::listAllObjects(bool inEnglish) const
 End of changes. 7 change blocks. 
4 lines changed or deleted 35 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/