Satellites.cpp   Satellites.cpp 
skipping to change at line 143 skipping to change at line 143
// absolute file name for qs.mag file // absolute file name for qs.mag file
qsMagFilePath = dataDir.absoluteFilePath("qs.mag"); qsMagFilePath = dataDir.absoluteFilePath("qs.mag");
// Load and find resources used in the plugin // Load and find resources used in the plugin
texPointer = StelApp::getInstance().getTextureManager().crea teTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png"); texPointer = StelApp::getInstance().getTextureManager().crea teTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png");
Satellite::hintTexture = StelApp::getInstance().getTextureMa nager().createTexture(":/satellites/hint.png"); Satellite::hintTexture = StelApp::getInstance().getTextureMa nager().createTexture(":/satellites/hint.png");
// key bindings and other actions // key bindings and other actions
QString satGroup = N_("Satellites"); QString satGroup = N_("Satellites");
addAction("actionShow_Satellite_Hints", satGroup, N_("Satell ite hints"), "hintsVisible", "Ctrl+Z"); addAction("actionShow_Satellite_Hints", satGroup, N_("Satell ite hints"), "hintsVisible", "Ctrl+Z");
addAction("actionShow_Satellite_Labels", satGroup, N_("Satel lite labels"), "labelsVisible", "Shift+Z"); addAction("actionShow_Satellite_Labels", satGroup, N_("Satel lite labels"), "labelsVisible", "Alt+Shift+Z");
addAction("actionShow_Satellite_ConfigDialog_Global", satGro up, N_("Satellites configuration window"), configDialog, "visible", "Alt+Z" ); addAction("actionShow_Satellite_ConfigDialog_Global", satGro up, N_("Satellites configuration window"), configDialog, "visible", "Alt+Z" );
// Gui toolbar button // Gui toolbar button
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui()); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui());
if (gui!=NULL) if (gui!=NULL)
{ {
toolbarButton = new StelButton(NULL, toolbarButton = new StelButton(NULL,
QPixmap(":/satellites /bt_satellites_on.png"), QPixmap(":/satellites /bt_satellites_on.png"),
QPixmap(":/satellites /bt_satellites_off.png"), QPixmap(":/satellites /bt_satellites_off.png"),
QPixmap(":/graphicGui /glow32x32.png"), QPixmap(":/graphicGui /glow32x32.png"),
skipping to change at line 354 skipping to change at line 354
{ {
if (sat->getCatalogNumberString() == numberS tring) if (sat->getCatalogNumberString() == numberS tring)
return qSharedPointerCast<StelObject >(sat); return qSharedPointerCast<StelObject >(sat);
} }
} }
} }
return StelObjectP(); return StelObjectP();
} }
QStringList Satellites::listMatchingObjectsI18n(const QString& objPrefix, i nt maxNbItem, bool useStartOfWords) const QStringList Satellites::listMatchingObjects(const QString& objPrefix, int m axNbItem, bool useStartOfWords, bool inEnglish) const
{ {
QStringList result; QStringList result;
if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati if (!hintFader
on().planetName != earth->getEnglishName() || !isValidRangeDates()) || maxNbItem <= 0
return result; || StelApp::getInstance().getCore()->getCurrentLocation().pl
if (maxNbItem==0) return result; anetName != earth->getEnglishName()
|| !isValidRangeDates())
QString objw = objPrefix.toUpper();
QString numberPrefix;
QRegExp regExp("^(NORAD)\\s*(\\d+)\\s*$");
if (regExp.exactMatch(objw))
{
QString numberString = regExp.capturedTexts().at(2);
numberPrefix = numberString;
}
bool find;
foreach(const SatelliteP& sat, satellites)
{ {
if (sat->initialized && sat->displayed)
{
find = false;
if (useStartOfWords)
{
if (sat->getNameI18n().toUpper().left(objw.l
ength()) == objw)
{
find = true;
}
}
else
{
if (sat->getNameI18n().toUpper().contains(ob
jw, Qt::CaseInsensitive))
{
find = true;
}
}
if (find)
{
result << sat->getNameI18n().toUpper();
}
else if (!numberPrefix.isEmpty() && sat->getCatalogN
umberString().left(numberPrefix.length()) == numberPrefix)
{
result << QString("NORAD %1").arg(sat->getCa
talogNumberString());
}
}
}
result.sort();
if (result.size()>maxNbItem) result.erase(result.begin()+maxNbItem,
result.end());
return result;
}
QStringList Satellites::listMatchingObjects(const QString& objPrefix, int m
axNbItem, bool useStartOfWords) const
{
QStringList result;
if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati
on().planetName != earth->getEnglishName() || !isValidRangeDates())
return result; return result;
if (maxNbItem==0) return result; }
QString objw = objPrefix.toUpper(); QString objw = objPrefix.toUpper();
QString numberPrefix; QString numberPrefix;
QRegExp regExp("^(NORAD)\\s*(\\d+)\\s*$"); QRegExp regExp("^(NORAD)\\s*(\\d+)\\s*$");
if (regExp.exactMatch(objw)) if (regExp.exactMatch(objw))
{ {
QString numberString = regExp.capturedTexts().at(2); QString numberString = regExp.capturedTexts().at(2);
bool ok; bool ok;
/* int number = */ numberString.toInt(&ok); /* int number = */ numberString.toInt(&ok);
if (ok) if (ok)
numberPrefix = numberString; numberPrefix = numberString;
} }
bool find;
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sobj, satellites)
{ {
if (sat->initialized && sat->displayed) if (!sobj->initialized || !sobj->displayed)
{ {
find = false; continue;
if (useStartOfWords) }
{
if (sat->getEnglishName().toUpper().left(obj QString name = inEnglish ? sobj->getEnglishName() : sobj->ge
w.length()) == objw) tNameI18n();
{ if (matchObjectName(name, objPrefix, useStartOfWords))
find = true; {
} result.append(name);
} }
else else if (!numberPrefix.isEmpty() && sobj->getCatalogNumberSt
{ ring().startsWith(numberPrefix))
if (sat->getEnglishName().toUpper().contains {
(objw, Qt::CaseInsensitive)) result.append(QString("NORAD %1").arg(sobj->getCatal
{ ogNumberString()));
find = true; }
}
} if (result.size() >= maxNbItem)
if (find) {
{ break;
result << sat->getEnglishName().toUpper();
}
else if (find==false && !numberPrefix.isEmpty() && s
at->getCatalogNumberString().left(numberPrefix.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());
return result; return result;
} }
QStringList Satellites::listAllObjects(bool inEnglish) const QStringList Satellites::listAllObjects(bool inEnglish) const
{ {
QStringList result; QStringList result;
if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName() || !isValidRangeDates()) if (!hintFader || StelApp::getInstance().getCore()->getCurrentLocati on().planetName != earth->getEnglishName() || !isValidRangeDates())
return result; return result;
if (inEnglish) if (inEnglish)
skipping to change at line 847 skipping to change at line 788
if (satelliteListModel) if (satelliteListModel)
satelliteListModel->endSatellitesChange(); satelliteListModel->endSatellitesChange();
} }
QVariantMap Satellites::createDataMap(void) QVariantMap Satellites::createDataMap(void)
{ {
QVariantMap map; QVariantMap map;
QVariantList defHintCol; QVariantList defHintCol;
defHintCol << Satellite::roundToDp(defaultHintColor[0],3) defHintCol << Satellite::roundToDp(defaultHintColor[0],3)
<< Satellite::roundToDp(def << Satellite::roundToDp(defaultHintColor[1],3)
aultHintColor[1],3) << Satellite::roundToDp(defaultHintColor[2],3);
<< Satellite::roundToDp(def
aultHintColor[2],3);
map["creator"] = QString("Satellites plugin version %1 (updated)").a rg(SATELLITES_PLUGIN_VERSION); map["creator"] = QString("Satellites plugin version %1 (updated)").a rg(SATELLITES_PLUGIN_VERSION);
map["hintColor"] = defHintCol; map["hintColor"] = defHintCol;
map["shortName"] = "satellite orbital data"; map["shortName"] = "satellite orbital data";
QVariantMap sats; QVariantMap sats;
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sat, satellites)
{ {
QVariantMap satMap = sat->getMap(); QVariantMap satMap = sat->getMap();
if (satMap["orbitColor"] == satMap["hintColor"]) if (satMap["orbitColor"] == satMap["hintColor"])
skipping to change at line 877 skipping to change at line 818
sats[sat->id] = satMap; sats[sat->id] = satMap;
} }
map["satellites"] = sats; map["satellites"] = sats;
return map; return map;
} }
void Satellites::markLastUpdate() void Satellites::markLastUpdate()
{ {
lastUpdate = QDateTime::currentDateTime(); lastUpdate = QDateTime::currentDateTime();
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
conf->setValue("Satellites/last_update", conf->setValue("Satellites/last_update", lastUpdate.toString(Qt::ISO
lastUpdate.toString(Qt::ISODate)); Date));
} }
QSet<QString> Satellites::getGroups() const QSet<QString> Satellites::getGroups() const
{ {
return groups; return groups;
} }
QStringList Satellites::getGroupIdList() const QStringList Satellites::getGroupIdList() const
{ {
QStringList groupList(groups.values()); QStringList groupList(groups.values());
skipping to change at line 911 skipping to change at line 851
{ {
QHash<QString,QString> result; QHash<QString,QString> result;
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sat, satellites)
{ {
if (sat->initialized) if (sat->initialized)
{ {
if ((group.isEmpty() || sat->groups.contains(group)) && ! result.contains(sat->id)) if ((group.isEmpty() || sat->groups.contains(group)) && ! result.contains(sat->id))
{ {
if (vis==Both || if (vis==Both ||
(vis==Visible && sat->displa (vis==Visible && sat->displayed) ||
yed) || (vis==NotVisible && !sat->displayed) ||
(vis==NotVisible && !sat->di (vis==OrbitError && !sat->orbitValid) ||
splayed) || (vis==NewlyAdded && sat->isNew()))
(vis==OrbitError && !sat->or
bitValid) ||
(vis==NewlyAdded && sat->isN
ew()))
result.insert(sat->id, sat->name); result.insert(sat->id, sat->name);
} }
} }
} }
return result; return result;
} }
SatellitesListModel* Satellites::getSatellitesListModel() SatellitesListModel* Satellites::getSatellitesListModel()
{ {
if (!satelliteListModel) if (!satelliteListModel)
skipping to change at line 1136 skipping to change at line 1076
Satellite::realisticModeFlag = b; Satellite::realisticModeFlag = b;
emit settingsChanged(); emit settingsChanged();
} }
} }
void Satellites::setFlagHints(bool b) void Satellites::setFlagHints(bool b)
{ {
if (hintFader != b) if (hintFader != b)
{ {
hintFader = b; hintFader = b;
emit settingsChanged(); emit settingsChanged(); // GZ IS THIS REQUIRED/USEFUL??
emit hintsVisibleChanged(b);
} }
} }
void Satellites::setFlagLabels(bool b) void Satellites::setFlagLabels(bool b)
{ {
if (Satellite::showLabels != b) if (Satellite::showLabels != b)
{ {
Satellite::showLabels = b; Satellite::showLabels = b;
emit settingsChanged(); emit settingsChanged(); // GZ IS THIS REQUIRED/USEFUL??
emit labelsVisibleChanged(b);
} }
} }
void Satellites::setLabelFontSize(int size) void Satellites::setLabelFontSize(int size)
{ {
if (labelFont.pixelSize() != size) if (labelFont.pixelSize() != size)
{ {
labelFont.setPixelSize(size); labelFont.setPixelSize(size);
emit settingsChanged(); emit settingsChanged();
} }
skipping to change at line 1599 skipping to change at line 1541
QString id = line.mid(0,5).trimmed(); QString id = line.mid(0,5).trimmed();
QString smag = line.mid(33,4).trimmed(); QString smag = line.mid(33,4).trimmed();
if (!smag.isEmpty()) if (!smag.isEmpty())
qsMagList.insert(id, smag.toDouble()); qsMagList.insert(id, smag.toDouble());
} }
qsmFile.close(); qsmFile.close();
} }
void Satellites::update(double deltaTime) void Satellites::update(double deltaTime)
{ {
if (StelApp::getInstance().getCore()->getCurrentLocation().planetNam // Separated because first test should be very fast.
e != earth->getEnglishName() || !isValidRangeDates() || (!hintFader && hint if (!hintFader && hintFader.getInterstate() <= 0.)
Fader.getInterstate() <= 0.)) return;
if (StelApp::getInstance().getCore()->getCurrentLocation().planetNam
e != earth->getEnglishName() || !isValidRangeDates())
return; return;
hintFader.update((int)(deltaTime*1000)); hintFader.update((int)(deltaTime*1000));
foreach(const SatelliteP& sat, satellites) foreach(const SatelliteP& sat, satellites)
{ {
if (sat->initialized && sat->displayed) if (sat->initialized && sat->displayed)
sat->update(deltaTime); sat->update(deltaTime);
} }
} }
void Satellites::draw(StelCore* core) void Satellites::draw(StelCore* core)
{ {
if (core->getCurrentLocation().planetName != earth->getEnglishName() // Separated because first test should be very fast.
|| !isValidRangeDates() || (!hintFader && hintFader.getInterstate() <= 0.) if (!hintFader && hintFader.getInterstate() <= 0.)
) return;
if (core->getCurrentLocation().planetName != earth->getEnglishName()
|| !isValidRangeDates())
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);
 End of changes. 16 change blocks. 
120 lines changed or deleted 52 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/