NebulaMgr.cpp   NebulaMgr.cpp 
skipping to change at line 52 skipping to change at line 52
#include <algorithm> #include <algorithm>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QSettings> #include <QSettings>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QRegExp> #include <QRegExp>
#include <QDir> #include <QDir>
void NebulaMgr::setLabelsColor(const Vec3f& c) {Nebula::labelColor = c;} void NebulaMgr::setLabelsColor(const Vec3f& c) {Nebula::labelColor = c; emi
const Vec3f &NebulaMgr::getLabelsColor(void) const {return Nebula::labelCol t labelsColorChanged(c);}
or;} const Vec3f NebulaMgr::getLabelsColor(void) const {return Nebula::labelColo
void NebulaMgr::setCirclesColor(const Vec3f& c) {Nebula::circleColor = c;} r;}
const Vec3f &NebulaMgr::getCirclesColor(void) const {return Nebula::circleC void NebulaMgr::setCirclesColor(const Vec3f& c) {Nebula::circleColor = c; e
olor;} mit circlesColorChanged(c); }
void NebulaMgr::setGalaxyColor(const Vec3f& c) {Nebula::galaxyColor = c;} const Vec3f NebulaMgr::getCirclesColor(void) const {return Nebula::circleCo
const Vec3f &NebulaMgr::getGalaxyColor(void) const {return Nebula::galaxyCo lor;}
lor;} void NebulaMgr::setGalaxyColor(const Vec3f& c) {Nebula::galaxyColor = c; em
void NebulaMgr::setRadioGalaxyColor(const Vec3f& c) {Nebula::radioGalaxyCol it galaxiesColorChanged(c); }
or = c;} const Vec3f NebulaMgr::getGalaxyColor(void) const {return Nebula::galaxyCol
const Vec3f &NebulaMgr::getRadioGalaxyColor(void) const {return Nebula::rad or;}
ioGalaxyColor;} void NebulaMgr::setRadioGalaxyColor(const Vec3f& c) {Nebula::radioGalaxyCol
void NebulaMgr::setActiveGalaxyColor(const Vec3f& c) {Nebula::activeGalaxyC or = c; emit radioGalaxiesColorChanged(c); }
olor = c;} const Vec3f NebulaMgr::getRadioGalaxyColor(void) const {return Nebula::radi
const Vec3f &NebulaMgr::getActiveGalaxyColor(void) const {return Nebula::ac oGalaxyColor;}
tiveGalaxyColor;} void NebulaMgr::setActiveGalaxyColor(const Vec3f& c) {Nebula::activeGalaxyC
void NebulaMgr::setInteractingGalaxyColor(const Vec3f& c) {Nebula::interact olor = c; emit activeGalaxiesColorChanged(c); }
ingGalaxyColor = c;} const Vec3f NebulaMgr::getActiveGalaxyColor(void) const {return Nebula::act
const Vec3f &NebulaMgr::getInteractingGalaxyColor(void) const {return Nebul iveGalaxyColor;}
a::interactingGalaxyColor;} void NebulaMgr::setInteractingGalaxyColor(const Vec3f& c) {Nebula::interact
void NebulaMgr::setQuasarColor(const Vec3f& c) {Nebula::quasarColor = c;} ingGalaxyColor = c; emit interactingGalaxiesColorChanged(c); }
const Vec3f &NebulaMgr::getQuasarColor(void) const {return Nebula::quasarCo const Vec3f NebulaMgr::getInteractingGalaxyColor(void) const {return Nebula
lor;} ::interactingGalaxyColor;}
void NebulaMgr::setBrightNebulaColor(const Vec3f& c) {Nebula::nebulaColor = void NebulaMgr::setQuasarColor(const Vec3f& c) {Nebula::quasarColor = c; em
c;} it quasarsColorChanged(c); }
const Vec3f &NebulaMgr::getBrightNebulaColor(void) const {return Nebula::ne const Vec3f NebulaMgr::getQuasarColor(void) const {return Nebula::quasarCol
bulaColor;} or;}
void NebulaMgr::setNebulaColor(const Vec3f& c) {Nebula::nebulaColor = c;} void NebulaMgr::setBrightNebulaColor(const Vec3f& c) {Nebula::nebulaColor =
const Vec3f &NebulaMgr::getNebulaColor(void) const {return Nebula::nebulaCo c; emit nebulaeColorChanged(c); }
lor;} const Vec3f NebulaMgr::getBrightNebulaColor(void) const {return Nebula::neb
void NebulaMgr::setPlanetaryNebulaColor(const Vec3f& c) {Nebula::planetaryN ulaColor;}
ebulaColor = c;} void NebulaMgr::setNebulaColor(const Vec3f& c) {Nebula::nebulaColor = c; em
const Vec3f &NebulaMgr::getPlanetaryNebulaColor(void) const {return Nebula: it nebulaeColorChanged(c); }
:planetaryNebulaColor;} const Vec3f NebulaMgr::getNebulaColor(void) const {return Nebula::nebulaCol
void NebulaMgr::setReflectionNebulaColor(const Vec3f& c) {Nebula::reflectio or;}
nNebulaColor = c;} void NebulaMgr::setPlanetaryNebulaColor(const Vec3f& c) {Nebula::planetaryN
const Vec3f &NebulaMgr::getReflectionNebulaColor(void) const {return Nebula ebulaColor = c; emit planetaryNebulaeColorChanged(c);}
::reflectionNebulaColor;} const Vec3f NebulaMgr::getPlanetaryNebulaColor(void) const {return Nebula::
void NebulaMgr::setBipolarNebulaColor(const Vec3f& c) {Nebula::bipolarNebul planetaryNebulaColor;}
aColor = c;} void NebulaMgr::setReflectionNebulaColor(const Vec3f& c) {Nebula::reflectio
const Vec3f &NebulaMgr::getBipolarNebulaColor(void) const {return Nebula::b nNebulaColor = c; emit reflectionNebulaeColorChanged(c);}
ipolarNebulaColor;} const Vec3f NebulaMgr::getReflectionNebulaColor(void) const {return Nebula:
void NebulaMgr::setEmissionNebulaColor(const Vec3f& c) {Nebula::emissionNeb :reflectionNebulaColor;}
ulaColor = c;} void NebulaMgr::setBipolarNebulaColor(const Vec3f& c) {Nebula::bipolarNebul
const Vec3f &NebulaMgr::getEmissionNebulaColor(void) const {return Nebula:: aColor = c; emit bipolarNebulaeColorChanged(c);}
emissionNebulaColor;} const Vec3f NebulaMgr::getBipolarNebulaColor(void) const {return Nebula::bi
void NebulaMgr::setDarkNebulaColor(const Vec3f& c) {Nebula::darkNebulaColor polarNebulaColor;}
= c;} void NebulaMgr::setEmissionNebulaColor(const Vec3f& c) {Nebula::emissionNeb
const Vec3f &NebulaMgr::getDarkNebulaColor(void) const {return Nebula::dark ulaColor = c; emit emissionNebulaeColorChanged(c);}
NebulaColor;} const Vec3f NebulaMgr::getEmissionNebulaColor(void) const {return Nebula::e
void NebulaMgr::setHydrogenRegionColor(const Vec3f& c) {Nebula::hydrogenReg missionNebulaColor;}
ionColor= c;} void NebulaMgr::setDarkNebulaColor(const Vec3f& c) {Nebula::darkNebulaColor
const Vec3f &NebulaMgr::getHydrogenRegionColor(void) const {return Nebula:: = c; emit darkNebulaeColorChanged(c);}
hydrogenRegionColor;} const Vec3f NebulaMgr::getDarkNebulaColor(void) const {return Nebula::darkN
void NebulaMgr::setSupernovaRemnantColor(const Vec3f& c) {Nebula::supernova ebulaColor;}
RemnantColor = c;} void NebulaMgr::setHydrogenRegionColor(const Vec3f& c) {Nebula::hydrogenReg
const Vec3f &NebulaMgr::getSupernovaRemnantColor(void) const {return Nebula ionColor= c; emit hydrogenRegionsColorChanged(c);}
::supernovaRemnantColor;} const Vec3f NebulaMgr::getHydrogenRegionColor(void) const {return Nebula::h
void NebulaMgr::setInterstellarMatterColor(const Vec3f& c) {Nebula::interst ydrogenRegionColor;}
ellarMatterColor = c;} void NebulaMgr::setSupernovaRemnantColor(const Vec3f& c) {Nebula::supernova
const Vec3f &NebulaMgr::getInterstellarMatterColor(void) const {return Nebu RemnantColor = c; emit supernovaRemnantsColorChanged(c);}
la::interstellarMatterColor;} const Vec3f NebulaMgr::getSupernovaRemnantColor(void) const {return Nebula:
void NebulaMgr::setClusterWithNebulosityColor(const Vec3f& c) {Nebula::clus :supernovaRemnantColor;}
terWithNebulosityColor= c;} void NebulaMgr::setInterstellarMatterColor(const Vec3f& c) {Nebula::interst
const Vec3f &NebulaMgr::getClusterWithNebulosityColor(void) const {return N ellarMatterColor = c; emit interstellarMatterColorChanged(c);}
ebula::clusterWithNebulosityColor;} const Vec3f NebulaMgr::getInterstellarMatterColor(void) const {return Nebul
void NebulaMgr::setClusterColor(const Vec3f& c) {Nebula::clusterColor= c;} a::interstellarMatterColor;}
const Vec3f &NebulaMgr::getClusterColor(void) const {return Nebula::cluster void NebulaMgr::setClusterWithNebulosityColor(const Vec3f& c) {Nebula::clus
Color;} terWithNebulosityColor= c; emit clusterWithNebulosityColorChanged(c);}
void NebulaMgr::setOpenClusterColor(const Vec3f& c) {Nebula::openClusterCol const Vec3f NebulaMgr::getClusterWithNebulosityColor(void) const {return Ne
or = c;} bula::clusterWithNebulosityColor;}
const Vec3f &NebulaMgr::getOpenClusterColor(void) const {return Nebula::ope void NebulaMgr::setClusterColor(const Vec3f& c) {Nebula::clusterColor= c; e
nClusterColor;} mit clustersColorChanged(c);}
void NebulaMgr::setGlobularClusterColor(const Vec3f& c) {Nebula::globularCl const Vec3f NebulaMgr::getClusterColor(void) const {return Nebula::clusterC
usterColor = c;} olor;}
const Vec3f &NebulaMgr::getGlobularClusterColor(void) const {return Nebula: void NebulaMgr::setOpenClusterColor(const Vec3f& c) {Nebula::openClusterCol
:globularClusterColor;} or = c; emit openClustersColorChanged(c);}
void NebulaMgr::setStellarAssociationColor(const Vec3f& c) {Nebula::stellar const Vec3f NebulaMgr::getOpenClusterColor(void) const {return Nebula::open
AssociationColor = c;} ClusterColor;}
const Vec3f &NebulaMgr::getStellarAssociationColor(void) const {return Nebu void NebulaMgr::setGlobularClusterColor(const Vec3f& c) {Nebula::globularCl
la::stellarAssociationColor;} usterColor = c; emit globularClustersColorChanged(c);}
void NebulaMgr::setStarCloudColor(const Vec3f& c) {Nebula::starCloudColor = const Vec3f NebulaMgr::getGlobularClusterColor(void) const {return Nebula::
c;} globularClusterColor;}
const Vec3f &NebulaMgr::getStarCloudColor(void) const {return Nebula::starC void NebulaMgr::setStellarAssociationColor(const Vec3f& c) {Nebula::stellar
loudColor;} AssociationColor = c; emit stellarAssociationsColorChanged(c);}
void NebulaMgr::setEmissionObjectColor(const Vec3f& c) {Nebula::emissionObj const Vec3f NebulaMgr::getStellarAssociationColor(void) const {return Nebul
ectColor = c;} a::stellarAssociationColor;}
const Vec3f &NebulaMgr::getEmissionObjectColor(void) const {return Nebula:: void NebulaMgr::setStarCloudColor(const Vec3f& c) {Nebula::starCloudColor =
emissionObjectColor;} c; emit starCloudsColorChanged(c);}
void NebulaMgr::setBlLacObjectColor(const Vec3f& c) {Nebula::blLacObjectCol const Vec3f NebulaMgr::getStarCloudColor(void) const {return Nebula::starCl
or = c;} oudColor;}
const Vec3f &NebulaMgr::getBlLacObjectColor(void) const {return Nebula::blL void NebulaMgr::setEmissionObjectColor(const Vec3f& c) {Nebula::emissionObj
acObjectColor;} ectColor = c; emit emissionObjectsColorChanged(c);}
void NebulaMgr::setBlazarColor(const Vec3f& c) {Nebula::blazarColor = c;} const Vec3f NebulaMgr::getEmissionObjectColor(void) const {return Nebula::e
const Vec3f &NebulaMgr::getBlazarColor(void) const {return Nebula::blazarCo missionObjectColor;}
lor;} void NebulaMgr::setBlLacObjectColor(const Vec3f& c) {Nebula::blLacObjectCol
void NebulaMgr::setMolecularCloudColor(const Vec3f& c) {Nebula::molecularCl or = c; emit blLacObjectsColorChanged(c);}
oudColor = c;} const Vec3f NebulaMgr::getBlLacObjectColor(void) const {return Nebula::blLa
const Vec3f &NebulaMgr::getMolecularCloudColor(void) const {return Nebula:: cObjectColor;}
molecularCloudColor;} void NebulaMgr::setBlazarColor(const Vec3f& c) {Nebula::blazarColor = c; em
void NebulaMgr::setYoungStellarObjectColor(const Vec3f& c) {Nebula::youngSt it blazarsColorChanged(c);}
ellarObjectColor = c;} const Vec3f NebulaMgr::getBlazarColor(void) const {return Nebula::blazarCol
const Vec3f &NebulaMgr::getYoungStellarObjectColor(void) const {return Nebu or;}
la::youngStellarObjectColor;} void NebulaMgr::setMolecularCloudColor(const Vec3f& c) {Nebula::molecularCl
void NebulaMgr::setPossibleQuasarColor(const Vec3f& c) {Nebula::possibleQua oudColor = c; emit molecularCloudsColorChanged(c);}
sarColor = c;} const Vec3f NebulaMgr::getMolecularCloudColor(void) const {return Nebula::m
const Vec3f &NebulaMgr::getPossibleQuasarColor(void) const {return Nebula:: olecularCloudColor;}
possibleQuasarColor;} void NebulaMgr::setYoungStellarObjectColor(const Vec3f& c) {Nebula::youngSt
void NebulaMgr::setPossiblePlanetaryNebulaColor(const Vec3f& c) {Nebula::po ellarObjectColor = c; emit youngStellarObjectsColorChanged(c);}
ssiblePlanetaryNebulaColor = c;} const Vec3f NebulaMgr::getYoungStellarObjectColor(void) const {return Nebul
const Vec3f &NebulaMgr::getPossiblePlanetaryNebulaColor(void) const {return a::youngStellarObjectColor;}
Nebula::possiblePlanetaryNebulaColor;} void NebulaMgr::setPossibleQuasarColor(const Vec3f& c) {Nebula::possibleQua
void NebulaMgr::setProtoplanetaryNebulaColor(const Vec3f& c) {Nebula::proto sarColor = c; emit possibleQuasarsColorChanged(c);}
planetaryNebulaColor = c;} const Vec3f NebulaMgr::getPossibleQuasarColor(void) const {return Nebula::p
const Vec3f &NebulaMgr::getProtoplanetaryNebulaColor(void) const {return Ne ossibleQuasarColor;}
bula::protoplanetaryNebulaColor;} void NebulaMgr::setPossiblePlanetaryNebulaColor(const Vec3f& c) {Nebula::po
void NebulaMgr::setStarColor(const Vec3f& c) {Nebula::starColor = c;} ssiblePlanetaryNebulaColor = c; emit possiblePlanetaryNebulaeColorChanged(c
const Vec3f &NebulaMgr::getStarColor(void) const {return Nebula::starColor; );}
} const Vec3f NebulaMgr::getPossiblePlanetaryNebulaColor(void) const {return
Nebula::possiblePlanetaryNebulaColor;}
void NebulaMgr::setProtoplanetaryNebulaColor(const Vec3f& c) {Nebula::proto
planetaryNebulaColor = c; emit protoplanetaryNebulaeColorChanged(c);}
const Vec3f NebulaMgr::getProtoplanetaryNebulaColor(void) const {return Neb
ula::protoplanetaryNebulaColor;}
void NebulaMgr::setStarColor(const Vec3f& c) {Nebula::starColor = c; emit s
tarsColorChanged(c);}
const Vec3f NebulaMgr::getStarColor(void) const {return Nebula::starColor;}
void NebulaMgr::setHintsProportional(const bool proportional) {if(Nebula::d rawHintProportional!=proportional){ Nebula::drawHintProportional=proportion al; emit hintsProportionalChanged(proportional);}} void NebulaMgr::setHintsProportional(const bool proportional) {if(Nebula::d rawHintProportional!=proportional){ Nebula::drawHintProportional=proportion al; emit hintsProportionalChanged(proportional);}}
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)
skipping to change at line 362 skipping to change at line 362
// 3. flag in nebula_textures.fab (yuk) // 3. flag in nebula_textures.fab (yuk)
// 4. info.ini file in each set containing a "load at startup" item // 4. info.ini file in each set containing a "load at startup" item
// 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&)));
GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
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)
skipping to change at line 386 skipping to change at line 387
{ {
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)
{ {
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 awer->getCustomNebulaMagnitudeLimit())) return; if ((drawer->getFlagNebulaMagnitudeLimit()) && (n->vMag > dr awer->getCustomNebulaMagnitudeLimit())) return;
if (n->majorAxisSize>angularSizeLimit || (checkMaxMagHints & & n->vMag <= maxMagHints)) if (n->majorAxisSize>angularSizeLimit || n->majorAxisSize==0 .f || (checkMaxMagHints && n->vMag <= maxMagHints))
{ {
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;
skipping to change at line 559 skipping to change at line 560
if (cat == "CED") return searchCed(num); if (cat == "CED") return searchCed(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");
QString dsoNamesPath = StelFileMgr::findFile("nebulae/" + setName + "/names.dat");
if (flagConverter) if (flagConverter)
{ {
if (!srcCatalogPath.isEmpty()) if (!srcCatalogPath.isEmpty())
convertDSOCatalog(srcCatalogPath, dsoCatalogPath, fl agDecimalCoordinates); convertDSOCatalog(srcCatalogPath, dsoCatalogPath, fl agDecimalCoordinates);
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() || dsoNamesPath.isEmpty()) if (dsoCatalogPath.isEmpty())
{ {
qWarning() << "ERROR while loading deep-sky data set " << se tName; qWarning() << "ERROR while loading deep-sky catalog data set " << setName;
return; return;
} }
loadDSOCatalog(dsoCatalogPath); loadDSOCatalog(dsoCatalogPath);
loadDSONames(dsoNamesPath);
} }
// Look for a nebulae by XYZ coords // Look for a nebulae by XYZ coords
NebulaP NebulaMgr::search(const Vec3d& apos) NebulaP NebulaMgr::search(const Vec3d& apos)
{ {
Vec3d pos = apos; Vec3d pos = apos;
pos.normalize(); pos.normalize();
NebulaP plusProche; NebulaP plusProche;
float anglePlusProche=0.0f; float anglePlusProche=0.0f;
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
skipping to change at line 888 skipping to change at line 887
// Warning: Hyades and LMC has visual magnitude less than 1.0 (0.5^m and 0.9^m) // Warning: Hyades and LMC has visual magnitude less than 1.0 (0.5^m and 0.9^m)
if (bMag <= 0.f) bMag = 99.f; if (bMag <= 0.f) bMag = 99.f;
if (vMag <= 0.f) vMag = 99.f; if (vMag <= 0.f) vMag = 99.f;
QStringList oTypes; QStringList oTypes;
oTypes << "G" << "GX" << "GC" << "OC" << "NB" << "PN " << "DN" << "RN" << "C+N" oTypes << "G" << "GX" << "GC" << "OC" << "NB" << "PN " << "DN" << "RN" << "C+N"
<< "RNE" << "HII" << "SNR" << "BN" << "EN" << "SA" << "SC" << "CL" << "IG" << "RNE" << "HII" << "SNR" << "BN" << "EN" << "SA" << "SC" << "CL" << "IG"
<< "RG" << "AGX" << "QSO" << "ISM" << "EMO" < < "GNE" << "RAD" << "LIN" << "RG" << "AGX" << "QSO" << "ISM" << "EMO" < < "GNE" << "RAD" << "LIN"
<< "BLL" << "BLA" << "MOC" << "YSO" << "Q?" < < "PN?" << "*" << "SFR" << "BLL" << "BLA" << "MOC" << "YSO" << "Q?" < < "PN?" << "*" << "SFR"
<< "IR" << "**" << "MUL" << "PPN"; << "IR" << "**" << "MUL" << "PPN" << "GIG";
switch (oTypes.indexOf(oType.toUpper())) switch (oTypes.indexOf(oType.toUpper()))
{ {
case 0: case 0:
case 1: case 1:
nType = (unsigned int)Nebula::NebGx; nType = (unsigned int)Nebula::NebGx;
break; break;
case 2: case 2:
nType = (unsigned int)Nebula::NebGc; nType = (unsigned int)Nebula::NebGc;
break; break;
skipping to change at line 942 skipping to change at line 941
case 14: case 14:
nType = (unsigned int)Nebula::NebSA; nType = (unsigned int)Nebula::NebSA;
break; break;
case 15: case 15:
nType = (unsigned int)Nebula::NebSC; nType = (unsigned int)Nebula::NebSC;
break; break;
case 16: case 16:
nType = (unsigned int)Nebula::NebCl; nType = (unsigned int)Nebula::NebCl;
break; break;
case 17: case 17:
case 38:
nType = (unsigned int)Nebula::NebIGx ; nType = (unsigned int)Nebula::NebIGx ;
break; break;
case 18: case 18:
nType = (unsigned int)Nebula::NebRGx ; nType = (unsigned int)Nebula::NebRGx ;
break; break;
case 19: case 19:
case 25: // LINER-type active galaxies case 25: // LINER-type active galaxies
nType = (unsigned int)Nebula::NebAGx ; nType = (unsigned int)Nebula::NebAGx ;
break; break;
case 20: case 20:
skipping to change at line 1012 skipping to change at line 1012
dsoOut.close(); dsoOut.close();
qDebug() << "Converted" << readOk << "/" << totalRecords << "DSO rec ords"; qDebug() << "Converted" << readOk << "/" << totalRecords << "DSO rec ords";
} }
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
// QDataStream ins(StelUtils::uncompress(in.readAll()));
QDataStream ins(&in); 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);
skipping to change at line 1173 skipping to change at line 1175
e = searchCed(cdes); e = searchCed(cdes);
break; break;
default: default:
e = searchDSO(nb); e = searchDSO(nb);
break; break;
} }
if (e) if (e)
{ {
if (transRx.exactMatch(name)) if (transRx.exactMatch(name))
e->setProperName(transRx.capturedTexts().at( {
1).trimmed()); QString propName = transRx.capturedTexts().a
t(1).trimmed();
QString currName = e->getEnglishName();
if (currName.isEmpty())
e->setProperName(propName);
else if (currName!=propName)
e->addNameAlias(propName);
}
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::updateSkyCulture(const QString& skyCultureDir)
{
QString namesFile = StelFileMgr::findFile("skycultures/" + skyCultur
eDir + "/dso_names.fab");
foreach (const NebulaP& n, dsoArray)
n->removeAllNames();
if (namesFile.isEmpty())
{
QString setName = "default";
QString dsoNamesPath = StelFileMgr::findFile("nebulae/" + se
tName + "/names.dat");
if (dsoNamesPath.isEmpty())
{
qWarning() << "ERROR while loading deep-sky names da
ta set " << setName;
return;
}
loadDSONames(dsoNamesPath);
}
else
{
// Open file
QFile dsoNamesFile(namesFile);
if (!dsoNamesFile.open(QIODevice::ReadOnly | QIODevice::Text
))
{
qDebug() << "Cannot open file" << QDir::toNativeSepa
rators(namesFile);
return;
}
// Now parse the file
// lines to ignore which start with a # or are empty
QRegExp commentRx("^(\\s*#.*|\\s*)$");
// lines which look like records - we use the RE to extract
the fields
// which will be available in recRx.capturedTexts()
QRegExp recRx("^\\s*([\\w\\s]+)\\s*\\|_[(]\"(.*)\"[)]\\s*([\
\,\\d\\s]*)\\n");
QString record, dsoId, nativeName;
int totalRecords=0;
int readOk=0;
int lineNumber=0;
while (!dsoNamesFile.atEnd())
{
record = QString::fromUtf8(dsoNamesFile.readLine());
lineNumber++;
// Skip comments
if (commentRx.exactMatch(record))
continue;
totalRecords++;
if (!recRx.exactMatch(record))
{
qWarning() << "ERROR - cannot parse record a
t line" << lineNumber << "in native deep-sky object names file" << QDir::to
NativeSeparators(namesFile);
}
else
{
dsoId = recRx.capturedTexts().at(1).trimmed(
);
nativeName = recRx.capturedTexts().at(2).tri
mmed(); // Use translatable text
NebulaP e = search(dsoId);
QString currentName = e->getEnglishName();
if (currentName.isEmpty()) // Set native nam
e of DSO
e->setProperName(nativeName);
else if (currentName!=nativeName) // Add tra
ditional (well-known?) name of DSO as alias
e->addNameAlias(nativeName);
readOk++;
}
}
dsoNamesFile.close();
qDebug() << "Loaded" << readOk << "/" << totalRecords << "na
tive names of deep-sky objects";
}
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 NULL
StelObjectP NebulaMgr::searchByNameI18n(const QString& nameI18n) const StelObjectP NebulaMgr::searchByNameI18n(const QString& nameI18n) const
{ {
skipping to change at line 1215 skipping to change at line 1299
} }
// Search by common names // Search by common names
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
QString objwcap = n->nameI18.toUpper(); QString objwcap = n->nameI18.toUpper();
if (objwcap==objw) if (objwcap==objw)
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
// Search by aliases of common names
foreach (const NebulaP& n, dsoArray)
{
foreach(QString objwcapa, n->nameI18Aliases)
{
if (objwcapa.toUpper()==objw)
return qSharedPointerCast<StelObject>(n);
}
}
// Search by IC numbers (possible formats are "IC466" or "IC 466") // Search by IC numbers (possible formats are "IC466" or "IC 466")
if (objw.left(2) == "IC") if (objw.left(2) == "IC")
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("IC%1").arg(n->IC_nb) == objw || QString ("IC %1").arg(n->IC_nb) == objw) if (QString("IC%1").arg(n->IC_nb) == objw || QString ("IC %1").arg(n->IC_nb) == objw)
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
} }
skipping to change at line 1382 skipping to change at line 1476
} }
// Search by common names // Search by common names
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
QString objwcap = n->englishName.toUpper(); QString objwcap = n->englishName.toUpper();
if (objwcap==objw) if (objwcap==objw)
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
// Search by aliases of common names
foreach (const NebulaP& n, dsoArray)
{
foreach(QString objwcapa, n->englishAliases)
{
if (objwcapa.toUpper()==objw)
return qSharedPointerCast<StelObject>(n);
}
}
// Search by IC numbers (possible formats are "IC466" or "IC 466") // Search by IC numbers (possible formats are "IC466" or "IC 466")
if (objw.startsWith("IC")) if (objw.startsWith("IC"))
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
{ {
if (QString("IC%1").arg(n->IC_nb) == objw || QString ("IC %1").arg(n->IC_nb) == objw) if (QString("IC%1").arg(n->IC_nb) == objw || QString ("IC %1").arg(n->IC_nb) == objw)
return qSharedPointerCast<StelObject>(n); return qSharedPointerCast<StelObject>(n);
} }
} }
skipping to change at line 1843 skipping to change at line 1947
// 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);
} }
} }
// Search by aliases of common names
foreach (const NebulaP& n, dsoArray)
{
QStringList nameList = inEnglish ? n->englishAliases : n->na
meI18Aliases;
foreach(QString name, nameList)
{
if (matchObjectName(name, objPrefix, useStartOfWords
))
result.append(name);
}
}
result.sort(); result.sort();
if (result.size() > maxNbItem) if (result.size() > maxNbItem)
{ {
result.erase(result.begin() + maxNbItem, result.end()); result.erase(result.begin() + maxNbItem, result.end());
} }
return result; return result;
} }
QStringList NebulaMgr::listAllObjects(bool inEnglish) const QStringList NebulaMgr::listAllObjects(bool inEnglish) const
skipping to change at line 1922 skipping to change at line 2037
foreach(const NebulaP& n, dsoArray) foreach(const NebulaP& n, dsoArray)
{ {
if (n->B_nb>0) if (n->B_nb>0)
result << QString("B %1").arg(n->B_n b); result << QString("B %1").arg(n->B_n b);
} }
break; break;
case 103: // Sharpless Catalogue? case 103: // Sharpless Catalogue?
foreach(const NebulaP& n, dsoArray) foreach(const NebulaP& n, dsoArray)
{ {
if (n->Sh2_nb>0) if (n->Sh2_nb>0)
result << QString("Sh 2-%1").arg(n-> Sh2_nb); result << QString("SH 2-%1").arg(n-> Sh2_nb);
} }
break; break;
case 104: // Van den Bergh Catalogue case 104: // Van den Bergh Catalogue
foreach(const NebulaP& n, dsoArray) foreach(const NebulaP& n, dsoArray)
{ {
if (n->VdB_nb>0) if (n->VdB_nb>0)
result << QString("VdB %1").arg(n->V dB_nb); result << QString("VdB %1").arg(n->V dB_nb);
} }
break; break;
case 105: // RCW Catalogue case 105: // RCW Catalogue
skipping to change at line 2034 skipping to change at line 2149
result << QString("NGC %1"). arg(n->NGC_nb); result << QString("NGC %1"). arg(n->NGC_nb);
else if (n->IC_nb>0) else if (n->IC_nb>0)
result << QString("IC %1").a rg(n->IC_nb); result << QString("IC %1").a rg(n->IC_nb);
else if (n->M_nb>0) else if (n->M_nb>0)
result << QString("M %1").ar g(n->M_nb); result << QString("M %1").ar g(n->M_nb);
else if (n->C_nb>0) else if (n->C_nb>0)
result << QString("C %1").ar g(n->C_nb); result << QString("C %1").ar g(n->C_nb);
else if (n->B_nb>0) else if (n->B_nb>0)
result << QString("B %1").ar g(n->B_nb); result << QString("B %1").ar g(n->B_nb);
else if (n->Sh2_nb>0) else if (n->Sh2_nb>0)
result << QString("Sh 2-%1") .arg(n->Sh2_nb); result << QString("SH 2-%1") .arg(n->Sh2_nb);
else if (n->VdB_nb>0) else if (n->VdB_nb>0)
result << QString("VdB %1"). arg(n->VdB_nb); result << QString("VdB %1"). arg(n->VdB_nb);
else if (n->RCW_nb>0) else if (n->RCW_nb>0)
result << QString("RCW %1"). arg(n->RCW_nb); result << QString("RCW %1"). arg(n->RCW_nb);
else if (n->LBN_nb>0) else if (n->LBN_nb>0)
result << QString("LBN %1"). arg(n->LBN_nb); result << QString("LBN %1"). arg(n->LBN_nb);
else if (n->LDN_nb>0) else if (n->LDN_nb>0)
result << QString("LDN %1"). arg(n->LDN_nb); result << QString("LDN %1"). arg(n->LDN_nb);
else if (n->Cr_nb>0) else if (n->Cr_nb>0)
result << QString("Cr %1").a rg(n->Cr_nb); result << QString("Cr %1").a rg(n->Cr_nb);
 End of changes. 17 change blocks. 
130 lines changed or deleted 269 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/