NebulaMgr.cpp   NebulaMgr.cpp 
skipping to change at line 127 skipping to change at line 127
bool NebulaMgr::getHintsProportional(void) const {return Nebula::drawHintPr oportional;} bool NebulaMgr::getHintsProportional(void) const {return Nebula::drawHintPr oportional;}
void NebulaMgr::setDesignationUsage(const bool flag) {if(Nebula::designatio nUsage!=flag){ Nebula::designationUsage=flag; emit designationUsageChanged( flag);}} void NebulaMgr::setDesignationUsage(const bool flag) {if(Nebula::designatio nUsage!=flag){ Nebula::designationUsage=flag; emit designationUsageChanged( flag);}}
bool NebulaMgr::getDesignationUsage(void) const {return Nebula::designation Usage; } bool NebulaMgr::getDesignationUsage(void) const {return Nebula::designation Usage; }
NebulaMgr::NebulaMgr(void) NebulaMgr::NebulaMgr(void)
: nebGrid(200) : nebGrid(200)
, hintsAmount(0) , hintsAmount(0)
, labelsAmount(0) , labelsAmount(0)
, flagConverter(false) , flagConverter(false)
, flagDecimalCoordinates(true) , flagDecimalCoordinates(true)
, flagReloading(false)
{ {
setObjectName("NebulaMgr"); setObjectName("NebulaMgr");
} }
NebulaMgr::~NebulaMgr() NebulaMgr::~NebulaMgr()
{ {
Nebula::texCircle = StelTextureSP(); Nebula::texCircle = StelTextureSP();
Nebula::texGalaxy = StelTextureSP(); Nebula::texGalaxy = StelTextureSP();
Nebula::texOpenCluster = StelTextureSP(); Nebula::texOpenCluster = StelTextureSP();
Nebula::texGlobularCluster = StelTextureSP(); Nebula::texGlobularCluster = StelTextureSP();
skipping to change at line 177 skipping to change at line 178
Nebula::texOpenClusterWithNebulosity = StelApp::getInstance().get TextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures /neb_ocln.png"); // Load Ocl/Nebula marker texture Nebula::texOpenClusterWithNebulosity = StelApp::getInstance().get TextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures /neb_ocln.png"); // Load Ocl/Nebula marker texture
texPointer = StelApp::getInstance().getTextureManager().createTextur e(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png"); // Load p ointer texture texPointer = StelApp::getInstance().getTextureManager().createTextur e(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png"); // Load p ointer texture
setFlagShow(conf->value("astro/flag_nebula",true).toBool()); setFlagShow(conf->value("astro/flag_nebula",true).toBool());
setFlagHints(conf->value("astro/flag_nebula_name",false).toBool()); setFlagHints(conf->value("astro/flag_nebula_name",false).toBool());
setHintsAmount(conf->value("astro/nebula_hints_amount", 3).toFloat() ); setHintsAmount(conf->value("astro/nebula_hints_amount", 3).toFloat() );
setLabelsAmount(conf->value("astro/nebula_labels_amount", 3).toFloat ()); setLabelsAmount(conf->value("astro/nebula_labels_amount", 3).toFloat ());
setHintsProportional(conf->value("astro/flag_nebula_hints_proportion al", false).toBool()); setHintsProportional(conf->value("astro/flag_nebula_hints_proportion al", false).toBool());
setDesignationUsage(conf->value("gui/flag_dso_designation_usage", fa lse).toBool()); setDesignationUsage(conf->value("gui/flag_dso_designation_usage", fa lse).toBool());
setFlagSurfaceBrightnessUsage(conf->value("astro/flag_surface_bright ness_usage", false).toBool()); setFlagSurfaceBrightnessUsage(conf->value("astro/flag_surface_bright ness_usage", false).toBool());
setFlagSurfaceBrightnessArcsecUsage(conf->value("astro/flag_surface_ brightness_arcsec", false).toBool());
// Load colors from config file // Load colors from config file
// Upgrade config keys // Upgrade config keys
if (conf->contains("color/nebula_label_color")) if (conf->contains("color/nebula_label_color"))
{ {
conf->setValue("color/dso_label_color", conf->value("color/n ebula_label_color", "0.4,0.3,0.5").toString()); conf->setValue("color/dso_label_color", conf->value("color/n ebula_label_color", "0.4,0.3,0.5").toString());
conf->remove("color/nebula_label_color"); conf->remove("color/nebula_label_color");
} }
if (conf->contains("color/nebula_circle_color")) if (conf->contains("color/nebula_circle_color"))
{ {
skipping to change at line 316 skipping to change at line 318
if (conf->value("flag_show_cr", false).toBool()) if (conf->value("flag_show_cr", false).toBool())
catalogFilters |= Nebula::CatCr; catalogFilters |= Nebula::CatCr;
if (conf->value("flag_show_mel", false).toBool()) if (conf->value("flag_show_mel", false).toBool())
catalogFilters |= Nebula::CatMel; catalogFilters |= Nebula::CatMel;
if (conf->value("flag_show_pgc", false).toBool()) if (conf->value("flag_show_pgc", false).toBool())
catalogFilters |= Nebula::CatPGC; catalogFilters |= Nebula::CatPGC;
if (conf->value("flag_show_ced", false).toBool()) if (conf->value("flag_show_ced", false).toBool())
catalogFilters |= Nebula::CatCed; catalogFilters |= Nebula::CatCed;
if (conf->value("flag_show_ugc", false).toBool()) if (conf->value("flag_show_ugc", false).toBool())
catalogFilters |= Nebula::CatUGC; catalogFilters |= Nebula::CatUGC;
if (conf->value("flag_show_arp", false).toBool())
catalogFilters |= Nebula::CatArp;
if (conf->value("flag_show_vv", false).toBool())
catalogFilters |= Nebula::CatVV;
if (conf->value("flag_show_pk", false).toBool())
catalogFilters |= Nebula::CatPK;
conf->endGroup(); conf->endGroup();
// NB: nebula set loaded inside setter of catalog filter // NB: nebula set loaded inside setter of catalog filter
setCatalogFilters(catalogFilters); setCatalogFilters(catalogFilters);
Nebula::TypeGroup typeFilters = Nebula::TypeGroup(0); Nebula::TypeGroup typeFilters = Nebula::TypeGroup(0);
conf->beginGroup("dso_type_filters"); conf->beginGroup("dso_type_filters");
if (conf->value("flag_show_galaxies", true).toBool()) if (conf->value("flag_show_galaxies", true).toBool())
typeFilters |= Nebula::TypeGalaxies; typeFilters |= Nebula::TypeGalaxies;
skipping to change at line 364 skipping to change at line 372
// For now (0.9.0), just load the default set // For now (0.9.0), just load the default set
// NB: nebula set loaded inside setter of catalog filter --AW // NB: nebula set loaded inside setter of catalog filter --AW
// loadNebulaSet("default"); // loadNebulaSet("default");
updateI18n(); updateI18n();
StelApp *app = &StelApp::getInstance(); StelApp *app = &StelApp::getInstance();
connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
connect(&app->getSkyCultureMgr(), SIGNAL(currentSkyCultureChanged(QS tring)), this, SLOT(updateSkyCulture(const QString&))); connect(&app->getSkyCultureMgr(), SIGNAL(currentSkyCultureChanged(QS tring)), this, SLOT(updateSkyCulture(const QString&)));
GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
connect(this, SIGNAL(catalogFiltersChanged(Nebula::CatalogGroup)), t his, SLOT(updateDSONames()));
addAction("actionShow_Nebulas", N_("Display Options"), N_("Deep-sky objects"), "flagHintDisplayed", "D", "N"); addAction("actionShow_Nebulas", N_("Display Options"), N_("Deep-sky objects"), "flagHintDisplayed", "D", "N");
addAction("actionSet_Nebula_TypeFilterUsage", N_("Display Options"), N_("Toggle DSO type filter"), "flagTypeFiltersUsage"); addAction("actionSet_Nebula_TypeFilterUsage", N_("Display Options"), N_("Toggle DSO type filter"), "flagTypeFiltersUsage");
} }
struct DrawNebulaFuncObject struct DrawNebulaFuncObject
{ {
DrawNebulaFuncObject(float amaxMagHints, float amaxMagLabels, StelPa inter* p, StelCore* aCore, bool acheckMaxMagHints) DrawNebulaFuncObject(float amaxMagHints, float amaxMagLabels, StelPa inter* p, StelCore* aCore, bool acheckMaxMagHints)
: maxMagHints(amaxMagHints) : maxMagHints(amaxMagHints)
, maxMagLabels(amaxMagLabels) , maxMagLabels(amaxMagLabels)
, sPainter(p) , sPainter(p)
, core(aCore) , core(aCore)
, checkMaxMagHints(acheckMaxMagHints) , checkMaxMagHints(acheckMaxMagHints)
{ {
angularSizeLimit = 5.f/sPainter->getProjector()->getPixelPer RadAtCenter()*180.f/M_PI; angularSizeLimit = 5.f/sPainter->getProjector()->getPixelPer RadAtCenter()*180.f/M_PI;
} }
void operator()(StelRegionObject* obj) void operator()(StelRegionObject* obj)
{ {
if (!checkMaxMagHints)
return;
Nebula* n = static_cast<Nebula*>(obj); Nebula* n = static_cast<Nebula*>(obj);
StelSkyDrawer *drawer = core->getSkyDrawer(); StelSkyDrawer *drawer = core->getSkyDrawer();
// filter out DSOs which are too dim to be seen (e.g. for bi no observers) // filter out DSOs which are too dim to be seen (e.g. for bi no observers)
if ((drawer->getFlagNebulaMagnitudeLimit()) && (n->vMag > dr float mag = qMin(n->vMag, n->bMag);
awer->getCustomNebulaMagnitudeLimit())) return; if ((drawer->getFlagNebulaMagnitudeLimit()) && (mag > drawer
->getCustomNebulaMagnitudeLimit()))
return;
if (n->majorAxisSize>angularSizeLimit || n->majorAxisSize==0 .f || (checkMaxMagHints && n->vMag <= maxMagHints)) if (n->majorAxisSize>angularSizeLimit || n->majorAxisSize==0 .f)
{ {
float refmag_add=0; // value to adjust hints visibil ity threshold. float refmag_add=0; // value to adjust hints visibil ity threshold.
sPainter->getProjector()->project(n->XYZ,n->XY); sPainter->getProjector()->project(n->XYZ,n->XY);
n->drawLabel(*sPainter, maxMagLabels-refmag_add); n->drawLabel(*sPainter, maxMagLabels-refmag_add);
n->drawHints(*sPainter, maxMagHints -refmag_add); n->drawHints(*sPainter, maxMagHints -refmag_add);
} }
} }
float maxMagHints; float maxMagHints;
float maxMagLabels; float maxMagLabels;
StelPainter* sPainter; StelPainter* sPainter;
StelCore* core; StelCore* core;
float angularSizeLimit; float angularSizeLimit;
skipping to change at line 416 skipping to change at line 431
{ {
Nebula::catalogFilters = cflags; Nebula::catalogFilters = cflags;
dsoArray.clear(); dsoArray.clear();
dsoIndex.clear(); dsoIndex.clear();
nebGrid.clear(); nebGrid.clear();
bool status = getFlagShow(); bool status = getFlagShow();
StelApp::getInstance().getStelObjectMgr().unSelect(); StelApp::getInstance().getStelObjectMgr().unSelect();
qWarning() << "Reloading DSO data..."; if (flagReloading)
qWarning() << "Reloading DSO data...";
else
qWarning() << "Loading DSO data...";
setFlagShow(false); setFlagShow(false);
loadNebulaSet("default"); loadNebulaSet("default");
setFlagShow(status); setFlagShow(status);
updateI18n(); // OK, update localized names of DSO updateI18n(); // OK, update localized names of DSO
flagReloading = true; // OK, first load is complete
emit catalogFiltersChanged(cflags); emit catalogFiltersChanged(cflags);
} }
} }
void NebulaMgr::setTypeFilters(Nebula::TypeGroup tflags) void NebulaMgr::setTypeFilters(Nebula::TypeGroup tflags)
{ {
if(static_cast<int>(tflags) != static_cast<int>(Nebula::typeFilters) ) if(static_cast<int>(tflags) != static_cast<int>(Nebula::typeFilters) )
{ {
Nebula::typeFilters = tflags; Nebula::typeFilters = tflags;
emit typeFiltersChanged(tflags); emit typeFiltersChanged(tflags);
skipping to change at line 513 skipping to change at line 533
{ {
QString uname = name.toUpper(); QString uname = name.toUpper();
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
QString testName = n->getEnglishName().toUpper(); QString testName = n->getEnglishName().toUpper();
if (testName==uname) return n; if (testName==uname) return n;
} }
// If no match found, try search by catalog reference // If no match found, try search by catalog reference
static QRegExp catNumRx("^(M|NGC|IC|C|B|VDB|RCW|LDN|LBN|CR|MEL|PGC|U GC)\\s*(\\d+)$"); static QRegExp catNumRx("^(M|NGC|IC|C|B|VDB|RCW|LDN|LBN|CR|MEL|PGC|U GC|ARP|VV)\\s*(\\d+)$");
if (catNumRx.exactMatch(uname)) if (catNumRx.exactMatch(uname))
{ {
QString cat = catNumRx.capturedTexts().at(1); QString cat = catNumRx.capturedTexts().at(1);
int num = catNumRx.capturedTexts().at(2).toInt(); int num = catNumRx.capturedTexts().at(2).toInt();
qWarning() << "[SEARCH]" << cat << num;
if (cat == "M") return searchM(num); if (cat == "M") return searchM(num);
if (cat == "NGC") return searchNGC(num); if (cat == "NGC") return searchNGC(num);
if (cat == "IC") return searchIC(num); if (cat == "IC") return searchIC(num);
if (cat == "C") return searchC(num); if (cat == "C") return searchC(num);
if (cat == "B") return searchB(num); if (cat == "B") return searchB(num);
if (cat == "VDB") return searchVdB(num); if (cat == "VDB") return searchVdB(num);
if (cat == "RCW") return searchRCW(num); if (cat == "RCW") return searchRCW(num);
if (cat == "LDN") return searchLDN(num); if (cat == "LDN") return searchLDN(num);
if (cat == "LBN") return searchLBN(num); if (cat == "LBN") return searchLBN(num);
if (cat == "CR") return searchCr(num); if (cat == "CR") return searchCr(num);
if (cat == "MEL") return searchMel(num); if (cat == "MEL") return searchMel(num);
if (cat == "PGC") return searchPGC(num); if (cat == "PGC") return searchPGC(num);
if (cat == "UGC") return searchUGC(num); if (cat == "UGC") return searchUGC(num);
if (cat == "ARP") return searchArp(num);
if (cat == "VV") return searchVV(num);
} }
static QRegExp dCatNumRx("^(SH)\\s*\\d-\\s*(\\d+)$"); static QRegExp dCatNumRx("^(SH)\\s*\\d-\\s*(\\d+)$");
if (dCatNumRx.exactMatch(uname)) if (dCatNumRx.exactMatch(uname))
{ {
QString dcat = dCatNumRx.capturedTexts().at(1); QString dcat = dCatNumRx.capturedTexts().at(1);
int dnum = dCatNumRx.capturedTexts().at(2).toInt(); int dnum = dCatNumRx.capturedTexts().at(2).toInt();
if (dcat == "SH") return searchSh2(dnum); if (dcat == "SH") return searchSh2(dnum);
} }
static QRegExp sCatNumRx("^(CED)\\s*(.+)$"); static QRegExp sCatNumRx("^(CED|PK)\\s*(.+)$");
if (sCatNumRx.exactMatch(uname)) if (sCatNumRx.exactMatch(uname))
{ {
QString cat = catNumRx.capturedTexts().at(1); QString cat = catNumRx.capturedTexts().at(1);
QString num = catNumRx.capturedTexts().at(2).trimmed(); QString num = catNumRx.capturedTexts().at(2).trimmed();
if (cat == "CED") return searchCed(num); if (cat == "CED") return searchCed(num);
if (cat == "PK") return searchPK(num);
} }
return NebulaP(); return NebulaP();
} }
void NebulaMgr::loadNebulaSet(const QString& setName) void NebulaMgr::loadNebulaSet(const QString& setName)
{ {
QString srcCatalogPath = StelFileMgr::findFile("nebulae/" + setName + "/catalog.txt"); QString srcCatalogPath = StelFileMgr::findFile("nebulae/" + setName + "/catalog.txt");
QString dsoCatalogPath = StelFileMgr::findFile("nebulae/" + setName + "/catalog.dat"); QString dsoCatalogPath = StelFileMgr::findFile("nebulae/" + setName + "/catalog.dat");
if (flagConverter) if (flagConverter)
{ {
if (!srcCatalogPath.isEmpty()) if (!srcCatalogPath.isEmpty())
convertDSOCatalog(srcCatalogPath, dsoCatalogPath, fl agDecimalCoordinates); convertDSOCatalog(srcCatalogPath, StelFileMgr::findF ile("nebulae/" + setName + "/catalog.pack"), flagDecimalCoordinates);
else else
qWarning() << "ERROR convert catalogue, because sour ce data set is not exists for " << setName; qWarning() << "ERROR convert catalogue, because sour ce data set is not exists for " << setName;
} }
if (dsoCatalogPath.isEmpty()) if (dsoCatalogPath.isEmpty())
{ {
qWarning() << "ERROR while loading deep-sky catalog data set " << setName; qWarning() << "ERROR while loading deep-sky catalog data set " << setName;
return; return;
} }
skipping to change at line 746 skipping to change at line 771
} }
NebulaP NebulaMgr::searchCed(QString Ced) NebulaP NebulaMgr::searchCed(QString Ced)
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
if (n->Ced_nb.trimmed().toUpper() == Ced.trimmed().toUpper() ) if (n->Ced_nb.trimmed().toUpper() == Ced.trimmed().toUpper() )
return n; return n;
return NebulaP(); return NebulaP();
} }
NebulaP NebulaMgr::searchArp(unsigned int Arp)
{
foreach (const NebulaP& n, dsoArray)
if (n->Arp_nb == Arp)
return n;
return NebulaP();
}
NebulaP NebulaMgr::searchVV(unsigned int VV)
{
foreach (const NebulaP& n, dsoArray)
if (n->VV_nb == VV)
return n;
return NebulaP();
}
NebulaP NebulaMgr::searchPK(QString PK)
{
foreach (const NebulaP& n, dsoArray)
if (n->PK_nb.trimmed().toUpper() == PK.trimmed().toUpper())
return n;
return NebulaP();
}
QString NebulaMgr::getLatestSelectedDSODesignation() QString NebulaMgr::getLatestSelectedDSODesignation()
{ {
QString result = ""; QString result = "";
const QList<StelObjectP> selected = GETSTELMODULE(StelObjectMgr)->ge tSelectedObject("Nebula"); const QList<StelObjectP> selected = GETSTELMODULE(StelObjectMgr)->ge tSelectedObject("Nebula");
if (!selected.empty()) if (!selected.empty())
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
if (n==selected[0]) if (n==selected[0])
result = n->getDSODesignation(); // Get desi gnation for latest selected DSO result = n->getDSODesignation(); // Get desi gnation for latest selected DSO
skipping to change at line 769 skipping to change at line 818
} }
void NebulaMgr::convertDSOCatalog(const QString &in, const QString &out, bo ol decimal=false) void NebulaMgr::convertDSOCatalog(const QString &in, const QString &out, bo ol decimal=false)
{ {
QFile dsoIn(in); QFile dsoIn(in);
if (!dsoIn.open(QIODevice::ReadOnly | QIODevice::Text)) if (!dsoIn.open(QIODevice::ReadOnly | QIODevice::Text))
return; return;
QFile dsoOut(out); QFile dsoOut(out);
if (!dsoOut.open(QIODevice::WriteOnly)) if (!dsoOut.open(QIODevice::WriteOnly))
{
qDebug() << "Error converting DSO data! Cannot open file" <<
QDir::toNativeSeparators(out);
return; return;
}
int totalRecords=0; int totalRecords=0;
QString record; QString record;
while (!dsoIn.atEnd()) while (!dsoIn.atEnd())
{ {
dsoIn.readLine(); dsoIn.readLine();
++totalRecords; ++totalRecords;
} }
// rewind the file to the start // rewind the file to the start
dsoIn.seek(0); dsoIn.seek(0);
QDataStream dsoOutStream(&dsoOut); QDataStream dsoOutStream(&dsoOut);
dsoOutStream.setVersion(QDataStream::Qt_5_2); dsoOutStream.setVersion(QDataStream::Qt_5_2);
int id, orientationAngle, NGC, IC, M, C, B, Sh2, VdB, RCW, LDN, LBN, Cr, Mel, PGC, UGC; int id, orientationAngle, NGC, IC, M, C, B, Sh2, VdB, RCW, LDN, LBN, Cr, Mel, PGC, UGC, Arp, VV;
float raRad, decRad, bMag, vMag, majorAxisSize, minorAxisSize, dis t, distErr, z, zErr, plx, plxErr; float raRad, decRad, bMag, vMag, majorAxisSize, minorAxisSize, dis t, distErr, z, zErr, plx, plxErr;
QString oType, mType, Ced, ra, dec; QString oType, mType, Ced, PK, ra, dec;
unsigned int nType; unsigned int nType;
int currentLineNumber = 0; // what input line we are on int currentLineNumber = 0; // what input line we are on
int currentRecordNumber = 0; // what record number we are on int currentRecordNumber = 0; // what record number we are on
int readOk = 0; // how many records weree rad withou t problems int readOk = 0; // how many records weree rad withou t problems
while (!dsoIn.atEnd()) while (!dsoIn.atEnd())
{ {
record = QString::fromUtf8(dsoIn.readLine()); record = QString::fromUtf8(dsoIn.readLine());
++currentLineNumber; ++currentLineNumber;
skipping to change at line 842 skipping to change at line 894
Sh2 = list.at(21).toInt(); // Sh2 number Sh2 = list.at(21).toInt(); // Sh2 number
VdB = list.at(22).toInt(); // VdB number VdB = list.at(22).toInt(); // VdB number
RCW = list.at(23).toInt(); // RCW number RCW = list.at(23).toInt(); // RCW number
LDN = list.at(24).toInt(); // LDN number LDN = list.at(24).toInt(); // LDN number
LBN = list.at(25).toInt(); // LBN number LBN = list.at(25).toInt(); // LBN number
Cr = list.at(26).toInt(); // Cr number (alias: Col) Cr = list.at(26).toInt(); // Cr number (alias: Col)
Mel = list.at(27).toInt(); // Mel number Mel = list.at(27).toInt(); // Mel number
PGC = list.at(28).toInt(); // PGC number (subset) PGC = list.at(28).toInt(); // PGC number (subset)
UGC = list.at(29).toInt(); // UGC number (subset) UGC = list.at(29).toInt(); // UGC number (subset)
Ced = list.at(30).trimmed(); // Ced number Ced = list.at(30).trimmed(); // Ced number
Arp = list.at(31).toInt(); //
Arp number
VV = list.at(32).toInt(); //
VV number
PK = list.at(33).trimmed(); //
PK number
if (decimal) if (decimal)
{ {
// Convert from deg to rad // Convert from deg to rad
raRad = ra.toFloat()*M_PI/180.; raRad = ra.toFloat()*M_PI/180.;
decRad = dec.toFloat()*M_PI/180.; decRad = dec.toFloat()*M_PI/180.;
} }
else else
{ {
QStringList raLst; QStringList raLst;
skipping to change at line 993 skipping to change at line 1048
break; break;
default: default:
nType = (unsigned int)Nebula::NebUnk nown; nType = (unsigned int)Nebula::NebUnk nown;
break; break;
} }
++readOk; ++readOk;
dsoOutStream << id << raRad << decRad << bMag << vMa g << nType << mType << majorAxisSize << minorAxisSize dsoOutStream << id << raRad << decRad << bMag << vMa g << nType << mType << majorAxisSize << minorAxisSize
<< orientationAngle << z << zErr << plx << plxErr << dist << distErr << NGC << IC << M << C << orientationAngle << z << zErr << plx << plxErr << dist << distErr << NGC << IC << M << C
<< B << Sh2 << VdB << RCW << LDN << LB N << Cr << Mel << PGC << UGC << Ced; << B << Sh2 << VdB << RCW << LDN << LB N << Cr << Mel << PGC << UGC << Ced << Arp << VV << PK;
} }
} }
dsoIn.close(); dsoIn.close();
dsoOut.flush(); dsoOut.flush();
dsoOut.close(); dsoOut.close();
qDebug() << "Converted" << readOk << "/" << totalRecords << "DSO rec ords"; qDebug() << "Converted" << readOk << "/" << totalRecords << "DSO rec ords";
qDebug() << "[...] Please use 'gzip -nc catalog.pack > catalog.dat' to pack the catalog.";
} }
bool NebulaMgr::loadDSOCatalog(const QString &filename) bool NebulaMgr::loadDSOCatalog(const QString &filename)
{ {
QFile in(filename); QFile in(filename);
if (!in.open(QIODevice::ReadOnly)) if (!in.open(QIODevice::ReadOnly))
return false; return false;
// TODO: Let's begin use gzipped data // Let's begin use gzipped data
// QDataStream ins(StelUtils::uncompress(in.readAll())); QDataStream ins(StelUtils::uncompress(in.readAll()));
QDataStream ins(&in);
ins.setVersion(QDataStream::Qt_5_2); ins.setVersion(QDataStream::Qt_5_2);
int totalRecords=0; int totalRecords=0;
while (!ins.atEnd()) while (!ins.atEnd())
{ {
// Create a new Nebula record // Create a new Nebula record
NebulaP e = NebulaP(new Nebula); NebulaP e = NebulaP(new Nebula);
e->readDSO(ins); e->readDSO(ins);
if (!objectInDisplayedCatalog(e)) continue; if (!objectInDisplayedCatalog(e)) continue;
skipping to change at line 1067 skipping to change at line 1122
else if ((catalogFilters&Nebula::CatCr) && (n->Cr_nb>0)) else if ((catalogFilters&Nebula::CatCr) && (n->Cr_nb>0))
r = true; r = true;
else if ((catalogFilters&Nebula::CatMel) && (n->Mel_nb>0)) else if ((catalogFilters&Nebula::CatMel) && (n->Mel_nb>0))
r = true; r = true;
else if ((catalogFilters&Nebula::CatPGC) && (n->PGC_nb>0)) else if ((catalogFilters&Nebula::CatPGC) && (n->PGC_nb>0))
r = true; r = true;
else if ((catalogFilters&Nebula::CatUGC) && (n->UGC_nb>0)) else if ((catalogFilters&Nebula::CatUGC) && (n->UGC_nb>0))
r = true; r = true;
else if ((catalogFilters&Nebula::CatCed) && !(n->Ced_nb.isEmpty())) else if ((catalogFilters&Nebula::CatCed) && !(n->Ced_nb.isEmpty()))
r = true; r = true;
else if ((catalogFilters&Nebula::CatArp) && (n->Arp_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatVV) && (n->VV_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatPK) && !(n->PK_nb.isEmpty()))
r = true;
// Special case: objects without ID from current catalogs // Special case: objects without ID from current catalogs
if (catalogFilters==Nebula::AllCatalogs) if (n->withoutID)
r = true; r = true;
return r; return r;
} }
bool NebulaMgr::loadDSONames(const QString &filename) bool NebulaMgr::loadDSONames(const QString &filename)
{ {
qDebug() << "Loading DSO name data ..."; qDebug() << "Loading DSO name data ...";
QFile dsoNameFile(filename); QFile dsoNameFile(filename);
if (!dsoNameFile.open(QIODevice::ReadOnly | QIODevice::Text)) if (!dsoNameFile.open(QIODevice::ReadOnly | QIODevice::Text))
skipping to change at line 1093 skipping to change at line 1154
} }
// Read the names of the NGC objects // Read the names of the NGC objects
QString name, record, ref, cdes; QString name, record, ref, cdes;
int totalRecords=0; int totalRecords=0;
int lineNumber=0; int lineNumber=0;
int readOk=0; int readOk=0;
int nb; int nb;
NebulaP e; NebulaP e;
QRegExp commentRx("^(\\s*#.*|\\s*)$"); QRegExp commentRx("^(\\s*#.*|\\s*)$");
QRegExp transRx("_[(]\"(.*)\"[)]"); QRegExp transRx("_[(]\"(.*)\"[)](\\s*#.*)?"); // optional comments a fter name.
while (!dsoNameFile.atEnd()) while (!dsoNameFile.atEnd())
{ {
record = QString::fromUtf8(dsoNameFile.readLine()); record = QString::fromUtf8(dsoNameFile.readLine());
lineNumber++; lineNumber++;
if (commentRx.exactMatch(record)) if (commentRx.exactMatch(record))
continue; continue;
totalRecords++; totalRecords++;
// bytes 1 - 5, designator for catalogue (prefix) // bytes 1 - 5, designator for catalogue (prefix)
ref = record.left(5).trimmed(); ref = record.left(5).trimmed();
// bytes 6 -20, identificator for object in the catalog // bytes 6 -20, identificator for object in the catalog
cdes = record.mid(5, 15).trimmed().toUpper(); cdes = record.mid(5, 15).trimmed().toUpper();
// bytes 21-80, proper name of the object (translatable) // bytes 21-80, proper name of the object (translatable)
name = record.mid(21).trimmed(); // Let gets the name with t rimmed whitespaces name = record.mid(21).trimmed(); // Let gets the name with t rimmed whitespaces
nb = cdes.toInt(); nb = cdes.toInt();
QStringList catalogs; QStringList catalogs;
catalogs << "IC" << "M" << "C" << "CR" << "MEL" << "B" << "S H2" << "VDB" << "RCW" << "LDN" << "LBN" catalogs << "IC" << "M" << "C" << "CR" << "MEL" << "B" << "S H2" << "VDB" << "RCW" << "LDN" << "LBN"
<< "NGC" << "PGC" << "UGC" << "CED"; << "NGC" << "PGC" << "UGC" << "CED" << "ARP" << "VV " << "PK";
switch (catalogs.indexOf(ref.toUpper())) switch (catalogs.indexOf(ref.toUpper()))
{ {
case 0: case 0:
e = searchIC(nb); e = searchIC(nb);
break; break;
case 1: case 1:
e = searchM(nb); e = searchM(nb);
break; break;
case 2: case 2:
skipping to change at line 1163 skipping to change at line 1224
break; break;
case 12: case 12:
e = searchPGC(nb); e = searchPGC(nb);
break; break;
case 13: case 13:
e = searchUGC(nb); e = searchUGC(nb);
break; break;
case 14: case 14:
e = searchCed(cdes); e = searchCed(cdes);
break; break;
case 15:
e = searchArp(nb);
break;
case 16:
e = searchVV(nb);
break;
case 17:
e = searchPK(cdes);
break;
default: default:
e = searchDSO(nb); e = searchDSO(nb);
break; break;
} }
if (e) if (e)
{ {
if (transRx.exactMatch(name)) if (transRx.exactMatch(name))
{ {
QString propName = transRx.capturedTexts().a t(1).trimmed(); QString propName = transRx.capturedTexts().a t(1).trimmed();
skipping to change at line 1190 skipping to change at line 1260
readOk++; readOk++;
} }
//else //else
// qWarning() << "no position data for " << name << "at line" << lineNumber << "of" << QDir::toNativeSeparators(filename); // qWarning() << "no position data for " << name << "at line" << lineNumber << "of" << QDir::toNativeSeparators(filename);
} }
dsoNameFile.close(); dsoNameFile.close();
qDebug() << "Loaded" << readOk << "/" << totalRecords << "DSO name r ecords successfully"; qDebug() << "Loaded" << readOk << "/" << totalRecords << "DSO name r ecords successfully";
return true; return true;
} }
void NebulaMgr::updateDSONames()
{
updateSkyCulture(StelApp::getInstance().getSkyCultureMgr().getCurren
tSkyCultureID());
updateI18n();
}
void NebulaMgr::updateSkyCulture(const QString& skyCultureDir) void NebulaMgr::updateSkyCulture(const QString& skyCultureDir)
{ {
QString namesFile = StelFileMgr::findFile("skycultures/" + skyCultur eDir + "/dso_names.fab"); QString namesFile = StelFileMgr::findFile("skycultures/" + skyCultur eDir + "/dso_names.fab");
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
n->removeAllNames(); n->removeAllNames();
if (namesFile.isEmpty()) if (namesFile.isEmpty())
{ {
QString setName = "default"; QString setName = "default";
skipping to change at line 1272 skipping to change at line 1348
updateI18n(); updateI18n();
} }
void NebulaMgr::updateI18n() void NebulaMgr::updateI18n()
{ {
const StelTranslator& trans = StelApp::getInstance().getLocaleMgr(). getSkyTranslator(); const StelTranslator& trans = StelApp::getInstance().getLocaleMgr(). getSkyTranslator();
foreach (NebulaP n, dsoArray) foreach (NebulaP n, dsoArray)
n->translateName(trans); n->translateName(trans);
} }
//! Return the matching Nebula object's pointer if exists or NULL //! Return the matching Nebula object's pointer if exists or an "empty" Ste lObjectP
StelObjectP NebulaMgr::searchByNameI18n(const QString& nameI18n) const StelObjectP NebulaMgr::searchByNameI18n(const QString& nameI18n) const
{ {
QString objw = nameI18n.toUpper(); QString objw = nameI18n.toUpper();
// Search by NGC numbers (possible formats are "NGC31" or "NGC 31") // Search by NGC numbers (possible formats are "NGC31" or "NGC 31")
if (objw.left(3) == "NGC") if (objw.left(3) == "NGC")
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("NGC%1").arg(n->NGC_nb) == objw || QStri ng("NGC %1").arg(n->NGC_nb) == objw) if (QString("NGC%1").arg(n->NGC_nb) == objw || QStri ng("NGC %1").arg(n->NGC_nb) == objw)
skipping to change at line 1435 skipping to change at line 1511
// Search by UGC numbers (possible formats are "UGC31" or "UGC 31") // Search by UGC numbers (possible formats are "UGC31" or "UGC 31")
if (objw.left(3) == "UGC") if (objw.left(3) == "UGC")
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("UGC%1").arg(n->UGC_nb) == objw || QStri ng("UGC %1").arg(n->UGC_nb) == objw) if (QString("UGC%1").arg(n->UGC_nb) == objw || QStri ng("UGC %1").arg(n->UGC_nb) == objw)
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
} }
// Search by Arp numbers (possible formats are "ARP31" or "ARP 31")
if (objw.left(3) == "ARP")
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("ARP%1").arg(n->Arp_nb) == objw || QStri
ng("ARP %1").arg(n->Arp_nb) == objw)
return qSharedPointerCast<StelObject>(n);
}
}
// Search by VV numbers (possible formats are "VV31" or "VV 31")
if (objw.left(2) == "VV")
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("VV%1").arg(n->VV_nb) == objw || QString
("VV %1").arg(n->VV_nb) == objw)
return qSharedPointerCast<StelObject>(n);
}
}
// Search by Cederblad numbers (possible formats are "Ced31" or "Ced 31") // Search by Cederblad numbers (possible formats are "Ced31" or "Ced 31")
if (objw.left(3) == "CED") if (objw.left(3) == "CED")
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("CED%1").arg(n->Ced_nb.trimmed().toUpper ()) == objw.trimmed() || QString("CED %1").arg(n->Ced_nb.trimmed().toUpper( )) == objw.trimmed()) if (QString("CED%1").arg(n->Ced_nb.trimmed().toUpper ()) == objw.trimmed() || QString("CED %1").arg(n->Ced_nb.trimmed().toUpper( )) == objw.trimmed())
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
} }
// Search by PK numbers
if (objw.left(2) == "PK")
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("PK%1").arg(n->PK_nb.trimmed().toUpper()
) == objw.trimmed() || QString("PK %1").arg(n->PK_nb.trimmed().toUpper()) =
= objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
return StelObjectP(); return StelObjectP();
} }
//! Return the matching Nebula object's pointer if exists or NULL //! Return the matching Nebula object's pointer if exists or Q_NULLPTR
//! TODO split common parts of this and I18 fn above into a separate fn. //! TODO split common parts of this and I18 fn above into a separate fn.
//! TODO Decide whether empty StelObjectP or Q_NULLPTR is the better return type and select the same for both.
StelObjectP NebulaMgr::searchByName(const QString& name) const StelObjectP NebulaMgr::searchByName(const QString& name) const
{ {
QString objw = name.toUpper(); QString objw = name.toUpper();
// Search by NGC numbers (possible formats are "NGC31" or "NGC 31") // Search by NGC numbers (possible formats are "NGC31" or "NGC 31")
if (objw.startsWith("NGC")) if (objw.startsWith("NGC"))
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("NGC%1").arg(n->NGC_nb) == objw || QStri ng("NGC %1").arg(n->NGC_nb) == objw) if (QString("NGC%1").arg(n->NGC_nb) == objw || QStri ng("NGC %1").arg(n->NGC_nb) == objw)
skipping to change at line 1612 skipping to change at line 1719
// Search by UGC numbers (possible formats are "UGC31" or "UGC 31") // Search by UGC numbers (possible formats are "UGC31" or "UGC 31")
if (objw.startsWith("UGC")) if (objw.startsWith("UGC"))
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("UGC%1").arg(n->UGC_nb) == objw || QStri ng("UGC %1").arg(n->UGC_nb) == objw) if (QString("UGC%1").arg(n->UGC_nb) == objw || QStri ng("UGC %1").arg(n->UGC_nb) == objw)
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
} }
// Search by Arp numbers (possible formats are "Arp31" or "Arp 31")
if (objw.startsWith("ARP"))
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("ARP%1").arg(n->Arp_nb) == objw || QStri
ng("ARP %1").arg(n->Arp_nb) == objw)
return qSharedPointerCast<StelObject>(n);
}
}
// Search by VV numbers (possible formats are "VV31" or "VV 31")
if (objw.startsWith("VV"))
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("VV%1").arg(n->VV_nb) == objw || QString
("VV %1").arg(n->VV_nb) == objw)
return qSharedPointerCast<StelObject>(n);
}
}
// Search by Cederblad numbers (possible formats are "Ced31" or "Ced 31") // Search by Cederblad numbers (possible formats are "Ced31" or "Ced 31")
if (objw.startsWith("CED")) if (objw.startsWith("CED"))
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("CED%1").arg(n->Ced_nb.trimmed().toUpper ()) == objw.trimmed() || QString("CED %1").arg(n->Ced_nb.trimmed().toUpper( )) == objw.trimmed()) if (QString("CED%1").arg(n->Ced_nb.trimmed().toUpper ()) == objw.trimmed() || QString("CED %1").arg(n->Ced_nb.trimmed().toUpper( )) == objw.trimmed())
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
} }
return NULL; // Search by PK numbers
if (objw.startsWith("PK"))
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("PK%1").arg(n->PK_nb.trimmed().toUpper()
) == objw.trimmed() || QString("PK %1").arg(n->PK_nb.trimmed().toUpper()) =
= objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
return Q_NULLPTR;
} }
//! Find and return the list of at most maxNbItem objects auto-completing t he passed object name //! Find and return the list of at most maxNbItem objects auto-completing t he passed object name
QStringList NebulaMgr::listMatchingObjects(const QString& objPrefix, int ma xNbItem, bool useStartOfWords, bool inEnglish) const QStringList NebulaMgr::listMatchingObjects(const QString& objPrefix, int ma xNbItem, bool useStartOfWords, bool inEnglish) const
{ {
QStringList result; QStringList result;
if (maxNbItem <= 0) if (maxNbItem <= 0)
{ {
return result; return result;
} }
skipping to change at line 1798 skipping to change at line 1935
if (constws==objw) if (constws==objw)
result << constw; result << constw;
} }
} }
// Search by Ced objects number (possible formats are "Ced31" or "Ce d 31") // Search by Ced objects number (possible formats are "Ced31" or "Ce d 31")
if (objw.size()>=1 && objw.left(3)=="CED") if (objw.size()>=1 && objw.left(3)=="CED")
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (n->Ced_nb==0) continue; if (n->Ced_nb.isEmpty()) continue;
QString constw = QString("Ced%1").arg(n->Ced_nb.trim med()); QString constw = QString("Ced%1").arg(n->Ced_nb.trim med());
QString constws = constw.mid(0, objw.size()); QString constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper()) if (constws.toUpper()==objw.toUpper())
{ {
result << constws; result << constws;
continue; // Prevent adding both forms for name continue; // Prevent adding both forms for name
} }
constw = QString("Ced %1").arg(n->Ced_nb.trimmed()); constw = QString("Ced %1").arg(n->Ced_nb.trimmed());
constws = constw.mid(0, objw.size()); constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper()) if (constws.toUpper()==objw.toUpper())
skipping to change at line 1933 skipping to change at line 2070
result << constws; result << constws;
continue; // Prevent adding both forms for name continue; // Prevent adding both forms for name
} }
constw = QString("LBN %1").arg(n->LBN_nb); constw = QString("LBN %1").arg(n->LBN_nb);
constws = constw.mid(0, objw.size()); constws = constw.mid(0, objw.size());
if (constws==objw) if (constws==objw)
result << constw; result << constw;
} }
} }
// Search by Arp objects number
if (objw.size()>=1 && objw.left(3)=="ARP")
{
foreach (const NebulaP& n, dsoArray)
{
if (n->Arp_nb==0) continue;
QString constw = QString("ARP%1").arg(n->Arp_nb);
QString constws = constw.mid(0, objw.size());
if (constws==objw)
{
result << constws;
continue; // Prevent adding both forms
for name
}
constw = QString("ARP %1").arg(n->Arp_nb);
constws = constw.mid(0, objw.size());
if (constws==objw)
result << constw;
}
}
// Search by VV objects number
if (objw.size()>=1 && objw.left(2)=="VV")
{
foreach (const NebulaP& n, dsoArray)
{
if (n->VV_nb==0) continue;
QString constw = QString("VV%1").arg(n->VV_nb);
QString constws = constw.mid(0, objw.size());
if (constws==objw)
{
result << constws;
continue; // Prevent adding both forms
for name
}
constw = QString("VV %1").arg(n->VV_nb);
constws = constw.mid(0, objw.size());
if (constws==objw)
result << constw;
}
}
// Search by PK objects number
if (objw.size()>=1 && objw.left(2)=="PK")
{
foreach (const NebulaP& n, dsoArray)
{
if (n->PK_nb.isEmpty()) continue;
QString constw = QString("PK%1").arg(n->PK_nb.trimme
d());
QString constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper())
{
result << constws;
continue; // Prevent adding both forms
for name
}
constw = QString("PK %1").arg(n->PK_nb.trimmed());
constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper())
result << constw;
}
}
// Search by common names // Search by common names
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
QString name = inEnglish ? n->englishName : n->nameI18; QString name = inEnglish ? n->englishName : n->nameI18;
if (matchObjectName(name, objPrefix, useStartOfWords)) if (matchObjectName(name, objPrefix, useStartOfWords))
{ {
result.append(name); result.append(name);
} }
} }
skipping to change at line 2064 skipping to change at line 2261
result << QString("Cr %1").arg(n->Cr _nb); result << QString("Cr %1").arg(n->Cr _nb);
} }
break; break;
case 107: // Melotte Catalogue case 107: // Melotte Catalogue
foreach(const NebulaP& n, dsoArray) foreach(const NebulaP& n, dsoArray)
{ {
if (n->Mel_nb>0) if (n->Mel_nb>0)
result << QString("Mel %1").arg(n->M el_nb); result << QString("Mel %1").arg(n->M el_nb);
} }
break; break;
case 108: // New General Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->NGC_nb>0)
result << QString("NGC %1").arg(n->N
GC_nb);
}
break;
case 109: // Index Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->IC_nb>0)
result << QString("IC %1").arg(n->IC
_nb);
}
break;
case 110: // Lynds' Catalogue of Bright Nebulae
foreach(const NebulaP& n, dsoArray)
{
if (n->LBN_nb>0)
result << QString("LBN %1").arg(n->L
BN_nb);
}
break;
case 111: // Lynds' Catalogue of Dark Nebulae
foreach(const NebulaP& n, dsoArray)
{
if (n->LDN_nb>0)
result << QString("LDN %1").arg(n->L
DN_nb);
}
break;
case 114: // Cederblad Catalog
foreach(const NebulaP& n, dsoArray)
{
if (!n->Ced_nb.isEmpty())
result << QString("Ced %1").arg(n->C
ed_nb);
}
break;
case 115: // Atlas of Peculiar Galaxies (Arp)
foreach(const NebulaP& n, dsoArray)
{
if (n->Arp_nb>0)
result << QString("Arp %1").arg(n->A
rp_nb);
}
break;
case 116: // The Catalogue of Interacting Galaxies by Voront
sov-Velyaminov (VV)
foreach(const NebulaP& n, dsoArray)
{
if (n->VV_nb>0)
result << QString("VV %1").arg(n->VV
_nb);
}
break;
case 117: // Catalogue of Galactic Planetary Nebulae (PK)
foreach(const NebulaP& n, dsoArray)
{
if (!n->PK_nb.isEmpty())
result << QString("PK %1").arg(n->PK
_nb);
}
break;
case 150: // Dwarf galaxies case 150: // Dwarf galaxies
{ {
QStringList dwarfGalaxies; QStringList dwarfGalaxies;
dwarfGalaxies << "PGC 3589" << "PGC 3792" << "PGC 6 830" << "PGC 10074" << "PGC 19441" dwarfGalaxies << "PGC 3589" << "PGC 3792" << "PGC 6 830" << "PGC 10074" << "PGC 19441"
<< "PGC 28913" << "PGC 29194" << "PGC 29653" << "PGC 50779" << "PGC 54074" << "PGC 28913" << "PGC 29194" << "PGC 29653" << "PGC 50779" << "PGC 54074"
<< "PGC 60095" << "PGC 63287" << "PGC 69519" << "PGC 88608" << "PGC 2807155" << "PGC 60095" << "PGC 63287" << "PGC 69519" << "PGC 88608" << "PGC 2807155"
<< "PGC 3097691"; << "PGC 3097691";
result = dwarfGalaxies; result = dwarfGalaxies;
break; break;
} }
skipping to change at line 2168 skipping to change at line 2421
} }
} }
break; break;
} }
} }
result.removeDuplicates(); result.removeDuplicates();
return result; return result;
} }
QList<NebulaP> NebulaMgr::getDeepSkyObjectsByType(const QString &objType)
{
QList<NebulaP> dso;
int type = objType.toInt();
switch (type)
{
case 100: // Messier Catalogue?
foreach(const NebulaP& n, dsoArray)
{
if (n->M_nb>0)
dso.append(n);
}
break;
case 101: // Caldwell Catalogue?
foreach(const NebulaP& n, dsoArray)
{
if (n->C_nb>0)
dso.append(n);
}
break;
case 102: // Barnard Catalogue?
foreach(const NebulaP& n, dsoArray)
{
if (n->B_nb>0)
dso.append(n);
}
break;
case 103: // Sharpless Catalogue?
foreach(const NebulaP& n, dsoArray)
{
if (n->Sh2_nb>0)
dso.append(n);
}
break;
case 104: // Van den Bergh Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->VdB_nb>0)
dso.append(n);
}
break;
case 105: // RCW Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->RCW_nb>0)
dso.append(n);
}
break;
case 106: // Collinder Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->Cr_nb>0)
dso.append(n);
}
break;
case 107: // Melotte Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->Mel_nb>0)
dso.append(n);
}
break;
case 108: // New General Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->NGC_nb>0)
dso.append(n);
}
break;
case 109: // Index Catalogue
foreach(const NebulaP& n, dsoArray)
{
if (n->IC_nb>0)
dso.append(n);
}
break;
case 110: // Lynds' Catalogue of Bright Nebulae
foreach(const NebulaP& n, dsoArray)
{
if (n->LBN_nb>0)
dso.append(n);
}
break;
case 111: // Lynds' Catalogue of Dark Nebulae
foreach(const NebulaP& n, dsoArray)
{
if (n->LDN_nb>0)
dso.append(n);
}
break;
case 112: // Principal Galaxy Catalog
foreach(const NebulaP& n, dsoArray)
{
if (n->PGC_nb>0)
dso.append(n);
}
break;
case 113: // The Uppsala General Catalogue of Galaxies
foreach(const NebulaP& n, dsoArray)
{
if (n->UGC_nb>0)
dso.append(n);
}
break;
case 114: // Cederblad Catalog
foreach(const NebulaP& n, dsoArray)
{
if (!n->Ced_nb.isEmpty())
dso.append(n);
}
break;
case 115: // Atlas of Peculiar Galaxies (Arp)
foreach(const NebulaP& n, dsoArray)
{
if (n->Arp_nb>0)
dso.append(n);
}
break;
case 116: // The Catalogue of Interacting Galaxies by Voront
sov-Velyaminov (VV)
foreach(const NebulaP& n, dsoArray)
{
if (n->VV_nb>0)
dso.append(n);
}
break;
case 117: // Catalogue of Galactic Planetary Nebulae (PK)
foreach(const NebulaP& n, dsoArray)
{
if (!n->PK_nb.isEmpty())
dso.append(n);
}
break;
case 150: // Dwarf galaxies
{
QList<int> dwarfGalaxies;
dwarfGalaxies << 3589 << 3792 << 6830 <<
10074 << 19441 << 28913
<< 29194 << 29653 << 50779 <<
54074 << 60095 << 63287
<< 69519 << 88608 << 2807155 << 3
097691;
NebulaP ds;
for (int i=0; i < dwarfGalaxies.size(); i++)
{
ds = searchPGC(dwarfGalaxies.at(i));
if (!ds.isNull())
dso.append(ds);
}
break;
}
case 151: // Herschel 400 Catalogue
{
QList<int> h400list;
h400list << 40 << 129 << 136 << 157 << 185 <<
205 << 225 << 246 << 247 << 253
<< 278 << 288 << 381 << 404 << 436 <<
457 << 488 << 524 << 559 << 584
<< 596 << 598 << 613 << 615 << 637 <<
650 << 654 << 659 << 663 << 720
<< 752 << 772 << 779 << 869 << 884 <<
891 << 908 << 936 << 1022 << 1023
<< 1027 << 1052 << 1055 << 1084 << 1245 <<
1342 << 1407 << 1444 << 1501 << 1502
<< 1513 << 1528 << 1535 << 1545 << 1647 <<
1664 << 1788 << 1817 << 1857 << 1907
<< 1931 << 1961 << 1964 << 1980 << 1999 <<
2022 << 2024 << 2126 << 2129 << 2158
<< 2169 << 2185 << 2186 << 2194 << 2204 <<
2215 << 2232 << 2244 << 2251 << 2264
<< 2266 << 2281 << 2286 << 2301 << 2304 <<
2311 << 2324 << 2335 << 2343 << 2353
<< 2354 << 2355 << 2360 << 2362 << 2371 <<
2372 << 2392 << 2395 << 2403 << 2419
<< 2420 << 2421 << 2422 << 2423 << 2438 <<
2440 << 2479 << 2482 << 2489 << 2506
<< 2509 << 2527 << 2539 << 2548 << 2567 <<
2571 << 2613 << 2627 << 2655 << 2681
<< 2683 << 2742 << 2768 << 2775 << 2782 <<
2787 << 2811 << 2841 << 2859 << 2903
<< 2950 << 2964 << 2974 << 2976 << 2985 <<
3034 << 3077 << 3079 << 3115 << 3147
<< 3166 << 3169 << 3184 << 3190 << 3193 <<
3198 << 3226 << 3227 << 3242 << 3245
<< 3277 << 3294 << 3310 << 3344 << 3377 <<
3379 << 3384 << 3395 << 3412 << 3414
<< 3432 << 3486 << 3489 << 3504 << 3521 <<
3556 << 3593 << 3607 << 3608 << 3610
<< 3613 << 3619 << 3621 << 3626 << 3628 <<
3631 << 3640 << 3655 << 3665 << 3675
<< 3686 << 3726 << 3729 << 3810 << 3813 <<
3877 << 3893 << 3898 << 3900 << 3912
<< 3938 << 3941 << 3945 << 3949 << 3953 <<
3962 << 3982 << 3992 << 3998 << 4026
<< 4027 << 4030 << 4036 << 4039 << 4041 <<
4051 << 4085 << 4088 << 4102 << 4111
<< 4143 << 4147 << 4150 << 4151 << 4179 <<
4203 << 4214 << 4216 << 4245 << 4251
<< 4258 << 4261 << 4273 << 4274 << 4278 <<
4281 << 4293 << 4303 << 4314 << 4346
<< 4350 << 4361 << 4365 << 4371 << 4394 <<
4414 << 4419 << 4429 << 4435 << 4438
<< 4442 << 4448 << 4449 << 4450 << 4459 <<
4473 << 4477 << 4478 << 4485 << 4490
<< 4494 << 4526 << 4527 << 4535 << 4536 <<
4546 << 4548 << 4550 << 4559 << 4565
<< 4570 << 4594 << 4596 << 4618 << 4631 <<
4636 << 4643 << 4654 << 4656 << 4660
<< 4665 << 4666 << 4689 << 4697 << 4698 <<
4699 << 4725 << 4753 << 4754 << 4762
<< 4781 << 4800 << 4845 << 4856 << 4866 <<
4900 << 4958 << 4995 << 5005 << 5033
<< 5054 << 5195 << 5248 << 5273 << 5322 <<
5363 << 5364 << 5466 << 5473 << 5474
<< 5557 << 5566 << 5576 << 5631 << 5634 <<
5676 << 5689 << 5694 << 5746 << 5846
<< 5866 << 5897 << 5907 << 5982 << 6118 <<
6144 << 6171 << 6207 << 6217 << 6229
<< 6235 << 6284 << 6287 << 6293 << 6304 <<
6316 << 6342 << 6355 << 6356 << 6369
<< 6401 << 6426 << 6440 << 6445 << 6451 <<
6514 << 6517 << 6520 << 6522 << 6528
<< 6540 << 6543 << 6544 << 6553 << 6568 <<
6569 << 6583 << 6624 << 6629 << 6633
<< 6638 << 6642 << 6645 << 6664 << 6712 <<
6755 << 6756 << 6781 << 6802 << 6818
<< 6823 << 6826 << 6830 << 6834 << 6866 <<
6882 << 6885 << 6905 << 6910 << 6934
<< 6939 << 6940 << 6946 << 7000 << 7006 <<
7008 << 7009 << 7044 << 7062 << 7086
<< 7128 << 7142 << 7160 << 7209 << 7217 <<
7243 << 7296 << 7331 << 7380 << 7448
<< 7479 << 7510 << 7606 << 7662 << 7686 <<
7723 << 7727 << 7789 << 7790 << 7814;
NebulaP ds;
for (int i=0; i < h400list.size(); i++)
{
ds = searchNGC(h400list.at(i));
if (!ds.isNull())
dso.append(ds);
}
break;
}
default:
{
foreach (const NebulaP& n, dsoArray)
{
if (n->nType==type)
dso.append(n);
}
break;
}
}
return dso;
}
 End of changes. 42 change blocks. 
20 lines changed or deleted 299 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/