Satellites.cpp   Satellites.cpp 
skipping to change at line 313 skipping to change at line 313
return result; return result;
} }
StelObjectP Satellites::searchByNameI18n(const QString& nameI18n) const StelObjectP Satellites::searchByNameI18n(const QString& nameI18n) const
{ {
if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName()) if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName())
return NULL; return NULL;
QString objw = nameI18n.toUpper(); QString objw = nameI18n.toUpper();
StelObjectP result = searchByNoradNumber(objw);
if (result)
return result;
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sat, satellites)
{ {
if (sat->initialized && sat->visible) if (sat->initialized && sat->visible)
{ {
if (sat->getNameI18n().toUpper() == nameI18n) if (sat->getNameI18n().toUpper() == nameI18n)
return qSharedPointerCast<StelObject>(sat); return qSharedPointerCast<StelObject>(sat);
} }
} }
return NULL; return NULL;
} }
StelObjectP Satellites::searchByName(const QString& englishName) const StelObjectP Satellites::searchByName(const QString& englishName) const
{ {
if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName()) if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName())
return NULL; return NULL;
QString objw = englishName.toUpper(); QString objw = englishName.toUpper();
StelObjectP result = searchByNoradNumber(objw);
if (result)
return result;
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sat, satellites)
{ {
if (sat->initialized && sat->visible) if (sat->initialized && sat->visible)
{ {
if (sat->getEnglishName().toUpper() == englishName) if (sat->getEnglishName().toUpper() == englishName)
return qSharedPointerCast<StelObject>(sat); return qSharedPointerCast<StelObject>(sat);
} }
} }
return NULL; return NULL;
} }
StelObjectP Satellites::searchByNoradNumber(const QString &noradNumber) con
st
{
if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati
on().planetName != earth->getEnglishName())
return NULL;
// If the search string is a catalog number...
QRegExp regExp("^(NORAD)\\s*(\\d+)\\s*$");
if (regExp.exactMatch(noradNumber))
{
QString numberString = regExp.capturedTexts().at(2);
bool ok;
int number = numberString.toInt(&ok);
if (!ok)
return StelObjectP();
foreach(const SatelliteP& sat, satellites)
{
if (sat->initialized && sat->visible)
{
if (sat->getCatalogNumberString() == numberS
tring)
return qSharedPointerCast<StelObject
>(sat);
}
}
}
return StelObjectP();
}
QStringList Satellites::listMatchingObjectsI18n(const QString& objPrefix, i nt maxNbItem) const QStringList Satellites::listMatchingObjectsI18n(const QString& objPrefix, i nt maxNbItem) const
{ {
QStringList result; QStringList result;
if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName()) if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName())
return result; return result;
if (maxNbItem==0) return result; if (maxNbItem==0) return result;
QString objw = objPrefix.toUpper(); QString objw = objPrefix.toUpper();
QString numberPrefix;
QRegExp regExp("^(NORAD)\\s*(\\d+)\\s*$");
if (regExp.exactMatch(objw))
{
QString numberString = regExp.capturedTexts().at(2);
bool ok;
int number = numberString.toInt(&ok);
if (ok)
numberPrefix = numberString;
}
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sat, satellites)
{ {
if (sat->initialized && sat->visible) if (sat->initialized && sat->visible)
{ {
if (sat->getNameI18n().toUpper().left(objw.length()) == objw) if (sat->getNameI18n().toUpper().left(objw.length()) == objw)
{ {
result << sat->getNameI18n().toUpper(); result << sat->getNameI18n().toUpper();
} }
else if (sat->getCatalogNumberString().left(numberPr
efix.length()) == numberPrefix)
{
result << QString("NORAD %1").arg(sat->getCa
talogNumberString());
}
} }
} }
result.sort(); result.sort();
if (result.size()>maxNbItem) result.erase(result.begin()+maxNbItem, result.end()); if (result.size()>maxNbItem) result.erase(result.begin()+maxNbItem, result.end());
return result; return result;
} }
bool Satellites::configureGui(bool show) bool Satellites::configureGui(bool show)
skipping to change at line 1110 skipping to change at line 1161
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sat, satellites)
{ {
if (sat->initialized && sat->visible) if (sat->initialized && sat->visible)
sat->update(deltaTime); sat->update(deltaTime);
} }
} }
void Satellites::draw(StelCore* core) void Satellites::draw(StelCore* core)
{ {
if (core->getCurrentLocation().planetName != earth->getEnglishName() if (core->getCurrentLocation().planetName != earth->getEnglishName()
|| (!hintFader && hintFader.getInterstate() <= 0.)) ||
(core->getJDay()<2436116.3115)
|| // do not draw anything before Oct 4, 1957, 19:28:34GMT ;-)
(!hintFader && hintFader.getInterstate() <= 0.))
return; return;
StelProjectorP prj = core->getProjection(StelCore::FrameAltAz); StelProjectorP prj = core->getProjection(StelCore::FrameAltAz);
StelPainter painter(prj); StelPainter painter(prj);
painter.setFont(labelFont); painter.setFont(labelFont);
Satellite::hintBrightness = hintFader.getInterstate(); Satellite::hintBrightness = hintFader.getInterstate();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
skipping to change at line 1147 skipping to change at line 1200
const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)- >getSelectedObject("Satellite"); const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)- >getSelectedObject("Satellite");
if (!newSelected.empty()) if (!newSelected.empty())
{ {
const StelObjectP obj = newSelected[0]; const StelObjectP obj = newSelected[0];
Vec3d pos=obj->getJ2000EquatorialPos(core); Vec3d pos=obj->getJ2000EquatorialPos(core);
Vec3d screenpos; Vec3d screenpos;
// Compute 2D pos and return if outside screen // Compute 2D pos and return if outside screen
if (!prj->project(pos, screenpos)) if (!prj->project(pos, screenpos))
return; return;
glColor3f(0.4f,0.5f,0.8f); if (StelApp::getInstance().getVisionModeNight())
glColor3f(0.8f,0.0f,0.0f);
else
glColor3f(0.4f,0.5f,0.8f);
texPointer->bind(); texPointer->bind();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transparency mode
// Size on screen // Size on screen
float size = obj->getAngularSize(core)*M_PI/180.*prj->getPix elPerRadAtCenter(); float size = obj->getAngularSize(core)*M_PI/180.*prj->getPix elPerRadAtCenter();
size += 12.f + 3.f*std::sin(2.f * StelApp::getInstance().get TotalRunTime()); size += 12.f + 3.f*std::sin(2.f * StelApp::getInstance().get TotalRunTime());
// size+=20.f + 10.f*std::sin(2.f * StelApp::getInstance().g etTotalRunTime()); // size+=20.f + 10.f*std::sin(2.f * StelApp::getInstance().g etTotalRunTime());
 End of changes. 7 change blocks. 
3 lines changed or deleted 66 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/