StelObjectMgr.cpp   StelObjectMgr.cpp 
skipping to change at line 49 skipping to change at line 49
setObjectName("StelObjectMgr"); setObjectName("StelObjectMgr");
} }
StelObjectMgr::~StelObjectMgr() StelObjectMgr::~StelObjectMgr()
{ {
} }
/************************************************************************* /*************************************************************************
Add a new StelObject manager into the list of supported modules. Add a new StelObject manager into the list of supported modules.
*************************************************************************/ *************************************************************************/
void StelObjectMgr::registerStelObjectMgr(StelObjectModule* mgr) void StelObjectMgr::registerStelObjectMgr(StelObjectModule* m)
{ {
objectsModule.push_back(mgr); objectsModule.push_back(m);
typeToModuleMap.insert(m->getStelObjectType(),m);
objModulesMap.insert(m->objectName(), m->getName());
//TODO: there should probably be a better way to specify the sub-typ
es
// instead of hardcoding them here
// Celestial objects from Solar system by type
if (m->objectName()=="SolarSystem")
{
objModulesMap["SolarSystem:planet"] = "Planets";
objModulesMap["SolarSystem:moon"] = "Moons";
objModulesMap["SolarSystem:asteroid"] = "Asteroids";
objModulesMap["SolarSystem:comet"] = "Comets";
objModulesMap["SolarSystem:plutino"] = "Plutinos";
objModulesMap["SolarSystem:cubewano"] = "Cubewanos";
objModulesMap["SolarSystem:dwarf planet"] = "Dwarf planets";
objModulesMap["SolarSystem:scattered disc object"] = "Scatte
red disc objects";
objModulesMap["SolarSystem:Oort cloud object"] = "Oort cloud
objects";
objModulesMap["SolarSystem:sednoid"] = "Sednoids";
}
// Deep-sky objects by type + amateur catalogues
if (m->objectName()=="NebulaMgr")
{
objModulesMap["NebulaMgr:0"] = "Bright galaxies";
objModulesMap["NebulaMgr:1"] = "Active galaxies";
objModulesMap["NebulaMgr:2"] = "Radio galaxies";
objModulesMap["NebulaMgr:3"] = "Interacting galaxies";
objModulesMap["NebulaMgr:4"] = "Bright quasars";
objModulesMap["NebulaMgr:5"] = "Star clusters";
objModulesMap["NebulaMgr:6"] = "Open star clusters";
objModulesMap["NebulaMgr:7"] = "Globular star clusters";
objModulesMap["NebulaMgr:8"] = "Stellar associations";
objModulesMap["NebulaMgr:9"] = "Star clouds";
objModulesMap["NebulaMgr:10"] = "Nebulae";
objModulesMap["NebulaMgr:11"] = "Planetary nebulae";
objModulesMap["NebulaMgr:12"] = "Dark nebulae";
objModulesMap["NebulaMgr:13"] = "Reflection nebulae";
objModulesMap["NebulaMgr:14"] = "Bipolar nebulae";
objModulesMap["NebulaMgr:15"] = "Emission nebulae";
objModulesMap["NebulaMgr:16"] = "Clusters associated with ne
bulosity";
objModulesMap["NebulaMgr:17"] = "HII regions";
objModulesMap["NebulaMgr:18"] = "Supernova remnants";
objModulesMap["NebulaMgr:19"] = "Interstellar matter";
objModulesMap["NebulaMgr:20"] = "Emission objects";
objModulesMap["NebulaMgr:21"] = "BL Lac objects";
objModulesMap["NebulaMgr:22"] = "Blazars";
objModulesMap["NebulaMgr:23"] = "Molecular Clouds";
objModulesMap["NebulaMgr:24"] = "Young Stellar Objects";
objModulesMap["NebulaMgr:25"] = "Possible Quasars";
objModulesMap["NebulaMgr:26"] = "Possible Planetary Nebulae"
;
objModulesMap["NebulaMgr:27"] = "Protoplanetary Nebulae";
objModulesMap["NebulaMgr:100"] = "Messier Catalogue";
objModulesMap["NebulaMgr:101"] = "Caldwell Catalogue";
objModulesMap["NebulaMgr:102"] = "Barnard Catalogue";
objModulesMap["NebulaMgr:103"] = "Sharpless Catalogue";
objModulesMap["NebulaMgr:104"] = "Van den Bergh Catalogue";
objModulesMap["NebulaMgr:105"] = "The Catalogue of Rodgers,
Campbell, and Whiteoak";
objModulesMap["NebulaMgr:106"] = "Collinder Catalogue";
objModulesMap["NebulaMgr:107"] = "Melotte Catalogue";
objModulesMap["NebulaMgr:108"] = "New General Catalogue";
objModulesMap["NebulaMgr:109"] = "Index Catalogue";
objModulesMap["NebulaMgr:110"] = "Lynds' Catalogue of Bright
Nebulae";
objModulesMap["NebulaMgr:111"] = "Lynds' Catalogue of Dark N
ebulae";
objModulesMap["NebulaMgr:112"] = "Principal Galaxy Catalog";
objModulesMap["NebulaMgr:113"] = "The Uppsala General Catalo
gue of Galaxies";
objModulesMap["NebulaMgr:114"] = "Cederblad Catalog";
objModulesMap["NebulaMgr:115"] = "The Catalogue of Peculiar
Galaxies";
objModulesMap["NebulaMgr:116"] = "The Catalogue of Interacti
ng Galaxies";
objModulesMap["NebulaMgr:117"] = "The Catalogue of Galactic
Planetary Nebulae";
objModulesMap["NebulaMgr:150"] = "Dwarf galaxies";
objModulesMap["NebulaMgr:151"] = "Herschel 400 Catalogue";
}
// Interesting stars
if (m->objectName()=="StarMgr")
{
objModulesMap["StarMgr:0"] = "Interesting double stars";
objModulesMap["StarMgr:1"] = "Interesting variable stars";
objModulesMap["StarMgr:2"] = "Bright double stars";
objModulesMap["StarMgr:3"] = "Bright variable stars";
objModulesMap["StarMgr:4"] = "Bright stars with high proper
motion";
}
} }
StelObjectP StelObjectMgr::searchByNameI18n(const QString &name) const StelObjectP StelObjectMgr::searchByNameI18n(const QString &name) const
{ {
StelObjectP rval; StelObjectP rval;
foreach (const StelObjectModule* m, objectsModule) foreach (const StelObjectModule* m, objectsModule)
{ {
rval = m->searchByNameI18n(name); rval = m->searchByNameI18n(name);
if (rval) if (rval)
return rval; return rval;
skipping to change at line 79 skipping to change at line 161
StelObjectP rval; StelObjectP rval;
foreach (const StelObjectModule* m, objectsModule) foreach (const StelObjectModule* m, objectsModule)
{ {
rval = m->searchByName(name); rval = m->searchByName(name);
if (rval) if (rval)
return rval; return rval;
} }
return rval; return rval;
} }
StelObjectP StelObjectMgr::searchByID(const QString &type, const QString &i
d) const
{
QMap<QString, StelObjectModule*>::const_iterator it = typeToModuleMa
p.constFind(type);
if(it!=typeToModuleMap.constEnd())
{
return (*it)->searchByID(id);;
}
qWarning()<<"StelObject type"<<type<<"unknown";
return Q_NULLPTR;
}
//! Find and select an object from its translated name //! Find and select an object from its translated name
//! @param nameI18n the case sensitive object translated name //! @param nameI18n the case sensitive object translated name
//! @return true if an object was found with the passed name //! @return true if an object was found with the passed name
bool StelObjectMgr::findAndSelectI18n(const QString &nameI18n, StelModule:: StelModuleSelectAction action) bool StelObjectMgr::findAndSelectI18n(const QString &nameI18n, StelModule:: StelModuleSelectAction action)
{ {
// Then look for another object // Then look for another object
StelObjectP obj = searchByNameI18n(nameI18n); StelObjectP obj = searchByNameI18n(nameI18n);
if (!obj) if (!obj)
return false; return false;
else else
skipping to change at line 193 skipping to change at line 286
return cleverFind(core, v); return cleverFind(core, v);
} }
return StelObjectP(); return StelObjectP();
} }
/************************************************************************* /*************************************************************************
Notify that we want to unselect any object Notify that we want to unselect any object
*************************************************************************/ *************************************************************************/
void StelObjectMgr::unSelect(void) void StelObjectMgr::unSelect(void)
{ {
lastSelectedObjects.clear(); if(!lastSelectedObjects.isEmpty())
emit(selectedObjectChanged(StelModule::RemoveFromSelection)); {
lastSelectedObjects.clear();
emit(selectedObjectChanged(StelModule::RemoveFromSelection))
;
}
} }
/************************************************************************* /*************************************************************************
Notify that we want to select the given object Notify that we want to select the given object
*************************************************************************/ *************************************************************************/
bool StelObjectMgr::setSelectedObject(const StelObjectP obj, StelModule::St elModuleSelectAction action) bool StelObjectMgr::setSelectedObject(const StelObjectP obj, StelModule::St elModuleSelectAction action)
{ {
if (!obj) if (!obj)
{ {
unSelect(); unSelect();
skipping to change at line 269 skipping to change at line 365
maxNbItem-=matchingObj.size(); maxNbItem-=matchingObj.size();
} }
result.sort(); result.sort();
return result; return result;
} }
QStringList StelObjectMgr::listAllModuleObjects(const QString &moduleId, bo ol inEnglish) const QStringList StelObjectMgr::listAllModuleObjects(const QString &moduleId, bo ol inEnglish) const
{ {
// search for module // search for module
StelObjectModule* module = NULL; StelObjectModule* module = Q_NULLPTR;
QStringList result, list; QStringList result, list;
QString objModule, objType; QString objModule, objType;
bool subSet = false; bool subSet = false;
if (moduleId.contains(":")) if (moduleId.contains(":"))
{ {
subSet = true; subSet = true;
list = moduleId.split(":", QString::SkipEmptyParts); list = moduleId.split(":", QString::SkipEmptyParts);
objModule = list.at(0); objModule = list.at(0);
objType = list.at(1); objType = list.at(1);
} }
else else
objModule = moduleId; objModule = moduleId;
foreach(StelObjectModule* m, objectsModule) foreach(StelObjectModule* m, objectsModule)
{ {
if (m->objectName() == objModule) if (m->objectName() == objModule)
{ {
module = m; module = m;
break; break;
} }
} }
if (module == NULL) if (module == Q_NULLPTR)
{ {
qWarning() << "Can't find module with id " << objModule; qWarning() << "Can't find module with id " << objModule;
return QStringList(); return QStringList();
} }
if (subSet) if (subSet)
result = module->listAllObjectsByType(objType, inEnglish); result = module->listAllObjectsByType(objType, inEnglish);
else else
result = module->listAllObjects(inEnglish); result = module->listAllObjects(inEnglish);
return result; return result;
} }
QMap<QString, QString> StelObjectMgr::objectModulesMap() const QMap<QString, QString> StelObjectMgr::objectModulesMap() const
{ {
QMap<QString, QString> result; return objModulesMap;
foreach(const StelObjectModule* m, objectsModule)
{
result[m->objectName()] = m->getName();
// Celestial objects from Solar system by type
if (m->objectName()=="SolarSystem")
{
result["SolarSystem:planet"] = "Planets";
result["SolarSystem:moon"] = "Moons";
result["SolarSystem:asteroid"] = "Asteroids";
result["SolarSystem:comet"] = "Comets";
result["SolarSystem:plutino"] = "Plutinos";
result["SolarSystem:cubewano"] = "Cubewanos";
result["SolarSystem:dwarf planet"] = "Dwarf planets"
;
result["SolarSystem:scattered disc object"] = "Scatt
ered disc objects";
result["SolarSystem:Oort cloud object"] = "Oort clou
d objects";
result["SolarSystem:sednoid"] = "Sednoids";
}
// Deep-sky objects by type + amateur catalogues
if (m->objectName()=="NebulaMgr")
{
result["NebulaMgr:0"] = "Bright galaxies";
result["NebulaMgr:1"] = "Active galaxies";
result["NebulaMgr:2"] = "Radio galaxies";
result["NebulaMgr:3"] = "Interacting galaxies";
result["NebulaMgr:4"] = "Bright quasars";
result["NebulaMgr:5"] = "Star clusters";
result["NebulaMgr:6"] = "Open star clusters";
result["NebulaMgr:7"] = "Globular star clusters";
result["NebulaMgr:8"] = "Stellar associations";
result["NebulaMgr:9"] = "Star clouds";
result["NebulaMgr:10"] = "Nebulae";
result["NebulaMgr:11"] = "Planetary nebulae";
result["NebulaMgr:12"] = "Dark nebulae";
result["NebulaMgr:13"] = "Reflection nebulae";
result["NebulaMgr:14"] = "Bipolar nebulae";
result["NebulaMgr:15"] = "Emission nebulae";
result["NebulaMgr:16"] = "Clusters associated with n
ebulosity";
result["NebulaMgr:17"] = "HII regions";
result["NebulaMgr:18"] = "Supernova remnants";
result["NebulaMgr:19"] = "Interstellar matter";
result["NebulaMgr:20"] = "Emission objects";
result["NebulaMgr:21"] = "BL Lac objects";
result["NebulaMgr:22"] = "Blazars";
result["NebulaMgr:23"] = "Molecular Clouds";
result["NebulaMgr:24"] = "Young Stellar Objects";
result["NebulaMgr:25"] = "Possible Quasars";
result["NebulaMgr:26"] = "Possible Planetary Nebulae
";
result["NebulaMgr:27"] = "Protoplanetary Nebulae";
result["NebulaMgr:100"] = "Messier Catalogue";
result["NebulaMgr:101"] = "Caldwell Catalogue";
result["NebulaMgr:102"] = "Barnard Catalogue";
result["NebulaMgr:103"] = "Sharpless Catalogue";
result["NebulaMgr:104"] = "Van den Bergh Catalogue";
result["NebulaMgr:105"] = "The Catalogue of Rodgers,
Campbell, and Whiteoak";
result["NebulaMgr:106"] = "Collinder Catalogue";
result["NebulaMgr:107"] = "Melotte Catalogue";
result["NebulaMgr:150"] = "Dwarf galaxies";
result["NebulaMgr:151"] = "Herschel 400 Catalogue";
}
// Interesting stars
if (m->objectName()=="StarMgr")
{
result["StarMgr:0"] = "Interesting double stars";
result["StarMgr:1"] = "Interesting variable stars";
}
}
return result;
} }
QVariantMap StelObjectMgr::getObjectInfo(const StelObjectP obj) QVariantMap StelObjectMgr::getObjectInfo(const StelObjectP obj)
{ {
QVariantMap map; QVariantMap map;
if (!obj) if (!obj)
{ {
qDebug() << "getObjectInfo WARNING - object not found"; qDebug() << "getObjectInfo WARNING - object not found";
map.insert("found", false); map.insert("found", false);
} }
 End of changes. 7 change blocks. 
80 lines changed or deleted 119 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/