NebulaMgr.cpp   NebulaMgr.cpp 
skipping to change at line 44 skipping to change at line 44
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelSkyImageTile.hpp" #include "StelSkyImageTile.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "RefractionExtinction.hpp" #include "RefractionExtinction.hpp"
#include "StelActionMgr.hpp" #include "StelActionMgr.hpp"
#include <algorithm> #include <algorithm>
#include <vector>
#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>
// Define version of valid Stellarium DSO Catalog
// This number must be incremented each time the content or file format of
the stars catalogs change
static const QString StellariumDSOCatalogVersion = "3.2";
void NebulaMgr::setLabelsColor(const Vec3f& c) {Nebula::labelColor = c; emi t labelsColorChanged(c);} void NebulaMgr::setLabelsColor(const Vec3f& c) {Nebula::labelColor = c; emi t labelsColorChanged(c);}
const Vec3f NebulaMgr::getLabelsColor(void) const {return Nebula::labelColo r;} const Vec3f NebulaMgr::getLabelsColor(void) const {return Nebula::labelColo r;}
void NebulaMgr::setCirclesColor(const Vec3f& c) {Nebula::circleColor = c; e mit circlesColorChanged(c); } void NebulaMgr::setCirclesColor(const Vec3f& c) {Nebula::circleColor = c; e mit circlesColorChanged(c); }
const Vec3f NebulaMgr::getCirclesColor(void) const {return Nebula::circleCo lor;} const Vec3f NebulaMgr::getCirclesColor(void) const {return Nebula::circleCo lor;}
void NebulaMgr::setGalaxyColor(const Vec3f& c) {Nebula::galaxyColor = c; em it galaxiesColorChanged(c); } void NebulaMgr::setGalaxyColor(const Vec3f& c) {Nebula::galaxyColor = c; em it galaxiesColorChanged(c); }
const Vec3f NebulaMgr::getGalaxyColor(void) const {return Nebula::galaxyCol or;} const Vec3f NebulaMgr::getGalaxyColor(void) const {return Nebula::galaxyCol or;}
void NebulaMgr::setRadioGalaxyColor(const Vec3f& c) {Nebula::radioGalaxyCol or = c; emit radioGalaxiesColorChanged(c); } void NebulaMgr::setRadioGalaxyColor(const Vec3f& c) {Nebula::radioGalaxyCol or = c; emit radioGalaxiesColorChanged(c); }
const Vec3f NebulaMgr::getRadioGalaxyColor(void) const {return Nebula::radi oGalaxyColor;} const Vec3f NebulaMgr::getRadioGalaxyColor(void) const {return Nebula::radi oGalaxyColor;}
void NebulaMgr::setActiveGalaxyColor(const Vec3f& c) {Nebula::activeGalaxyC olor = c; emit activeGalaxiesColorChanged(c); } void NebulaMgr::setActiveGalaxyColor(const Vec3f& c) {Nebula::activeGalaxyC olor = c; emit activeGalaxiesColorChanged(c); }
const Vec3f NebulaMgr::getActiveGalaxyColor(void) const {return Nebula::act iveGalaxyColor;} const Vec3f NebulaMgr::getActiveGalaxyColor(void) const {return Nebula::act iveGalaxyColor;}
skipping to change at line 84 skipping to change at line 89
void NebulaMgr::setBipolarNebulaColor(const Vec3f& c) {Nebula::bipolarNebul aColor = c; emit bipolarNebulaeColorChanged(c);} void NebulaMgr::setBipolarNebulaColor(const Vec3f& c) {Nebula::bipolarNebul aColor = c; emit bipolarNebulaeColorChanged(c);}
const Vec3f NebulaMgr::getBipolarNebulaColor(void) const {return Nebula::bi polarNebulaColor;} const Vec3f NebulaMgr::getBipolarNebulaColor(void) const {return Nebula::bi polarNebulaColor;}
void NebulaMgr::setEmissionNebulaColor(const Vec3f& c) {Nebula::emissionNeb ulaColor = c; emit emissionNebulaeColorChanged(c);} void NebulaMgr::setEmissionNebulaColor(const Vec3f& c) {Nebula::emissionNeb ulaColor = c; emit emissionNebulaeColorChanged(c);}
const Vec3f NebulaMgr::getEmissionNebulaColor(void) const {return Nebula::e missionNebulaColor;} const Vec3f NebulaMgr::getEmissionNebulaColor(void) const {return Nebula::e missionNebulaColor;}
void NebulaMgr::setDarkNebulaColor(const Vec3f& c) {Nebula::darkNebulaColor = c; emit darkNebulaeColorChanged(c);} void NebulaMgr::setDarkNebulaColor(const Vec3f& c) {Nebula::darkNebulaColor = c; emit darkNebulaeColorChanged(c);}
const Vec3f NebulaMgr::getDarkNebulaColor(void) const {return Nebula::darkN ebulaColor;} const Vec3f NebulaMgr::getDarkNebulaColor(void) const {return Nebula::darkN ebulaColor;}
void NebulaMgr::setHydrogenRegionColor(const Vec3f& c) {Nebula::hydrogenReg ionColor= c; emit hydrogenRegionsColorChanged(c);} void NebulaMgr::setHydrogenRegionColor(const Vec3f& c) {Nebula::hydrogenReg ionColor= c; emit hydrogenRegionsColorChanged(c);}
const Vec3f NebulaMgr::getHydrogenRegionColor(void) const {return Nebula::h ydrogenRegionColor;} const Vec3f NebulaMgr::getHydrogenRegionColor(void) const {return Nebula::h ydrogenRegionColor;}
void NebulaMgr::setSupernovaRemnantColor(const Vec3f& c) {Nebula::supernova RemnantColor = c; emit supernovaRemnantsColorChanged(c);} void NebulaMgr::setSupernovaRemnantColor(const Vec3f& c) {Nebula::supernova RemnantColor = c; emit supernovaRemnantsColorChanged(c);}
const Vec3f NebulaMgr::getSupernovaRemnantColor(void) const {return Nebula: :supernovaRemnantColor;} const Vec3f NebulaMgr::getSupernovaRemnantColor(void) const {return Nebula: :supernovaRemnantColor;}
void NebulaMgr::setSupernovaCandidateColor(const Vec3f& c) {Nebula::superno
vaCandidateColor = c; emit supernovaCandidatesColorChanged(c);}
const Vec3f NebulaMgr::getSupernovaCandidateColor(void) const {return Nebul
a::supernovaCandidateColor;}
void NebulaMgr::setSupernovaRemnantCandidateColor(const Vec3f& c) {Nebula::
supernovaRemnantCandidateColor = c; emit supernovaRemnantCandidatesColorCha
nged(c);}
const Vec3f NebulaMgr::getSupernovaRemnantCandidateColor(void) const {retur
n Nebula::supernovaRemnantCandidateColor;}
void NebulaMgr::setInterstellarMatterColor(const Vec3f& c) {Nebula::interst ellarMatterColor = c; emit interstellarMatterColorChanged(c);} void NebulaMgr::setInterstellarMatterColor(const Vec3f& c) {Nebula::interst ellarMatterColor = c; emit interstellarMatterColorChanged(c);}
const Vec3f NebulaMgr::getInterstellarMatterColor(void) const {return Nebul a::interstellarMatterColor;} const Vec3f NebulaMgr::getInterstellarMatterColor(void) const {return Nebul a::interstellarMatterColor;}
void NebulaMgr::setClusterWithNebulosityColor(const Vec3f& c) {Nebula::clus terWithNebulosityColor= c; emit clusterWithNebulosityColorChanged(c);} void NebulaMgr::setClusterWithNebulosityColor(const Vec3f& c) {Nebula::clus terWithNebulosityColor= c; emit clusterWithNebulosityColorChanged(c);}
const Vec3f NebulaMgr::getClusterWithNebulosityColor(void) const {return Ne bula::clusterWithNebulosityColor;} const Vec3f NebulaMgr::getClusterWithNebulosityColor(void) const {return Ne bula::clusterWithNebulosityColor;}
void NebulaMgr::setClusterColor(const Vec3f& c) {Nebula::clusterColor= c; e mit clustersColorChanged(c);} void NebulaMgr::setClusterColor(const Vec3f& c) {Nebula::clusterColor= c; e mit clustersColorChanged(c);}
const Vec3f NebulaMgr::getClusterColor(void) const {return Nebula::clusterC olor;} const Vec3f NebulaMgr::getClusterColor(void) const {return Nebula::clusterC olor;}
void NebulaMgr::setOpenClusterColor(const Vec3f& c) {Nebula::openClusterCol or = c; emit openClustersColorChanged(c);} void NebulaMgr::setOpenClusterColor(const Vec3f& c) {Nebula::openClusterCol or = c; emit openClustersColorChanged(c);}
const Vec3f NebulaMgr::getOpenClusterColor(void) const {return Nebula::open ClusterColor;} const Vec3f NebulaMgr::getOpenClusterColor(void) const {return Nebula::open ClusterColor;}
void NebulaMgr::setGlobularClusterColor(const Vec3f& c) {Nebula::globularCl usterColor = c; emit globularClustersColorChanged(c);} void NebulaMgr::setGlobularClusterColor(const Vec3f& c) {Nebula::globularCl usterColor = c; emit globularClustersColorChanged(c);}
const Vec3f NebulaMgr::getGlobularClusterColor(void) const {return Nebula:: globularClusterColor;} const Vec3f NebulaMgr::getGlobularClusterColor(void) const {return Nebula:: globularClusterColor;}
skipping to change at line 116 skipping to change at line 125
void NebulaMgr::setYoungStellarObjectColor(const Vec3f& c) {Nebula::youngSt ellarObjectColor = c; emit youngStellarObjectsColorChanged(c);} void NebulaMgr::setYoungStellarObjectColor(const Vec3f& c) {Nebula::youngSt ellarObjectColor = c; emit youngStellarObjectsColorChanged(c);}
const Vec3f NebulaMgr::getYoungStellarObjectColor(void) const {return Nebul a::youngStellarObjectColor;} const Vec3f NebulaMgr::getYoungStellarObjectColor(void) const {return Nebul a::youngStellarObjectColor;}
void NebulaMgr::setPossibleQuasarColor(const Vec3f& c) {Nebula::possibleQua sarColor = c; emit possibleQuasarsColorChanged(c);} void NebulaMgr::setPossibleQuasarColor(const Vec3f& c) {Nebula::possibleQua sarColor = c; emit possibleQuasarsColorChanged(c);}
const Vec3f NebulaMgr::getPossibleQuasarColor(void) const {return Nebula::p ossibleQuasarColor;} const Vec3f NebulaMgr::getPossibleQuasarColor(void) const {return Nebula::p ossibleQuasarColor;}
void NebulaMgr::setPossiblePlanetaryNebulaColor(const Vec3f& c) {Nebula::po ssiblePlanetaryNebulaColor = c; emit possiblePlanetaryNebulaeColorChanged(c );} void NebulaMgr::setPossiblePlanetaryNebulaColor(const Vec3f& c) {Nebula::po ssiblePlanetaryNebulaColor = c; emit possiblePlanetaryNebulaeColorChanged(c );}
const Vec3f NebulaMgr::getPossiblePlanetaryNebulaColor(void) const {return Nebula::possiblePlanetaryNebulaColor;} const Vec3f NebulaMgr::getPossiblePlanetaryNebulaColor(void) const {return Nebula::possiblePlanetaryNebulaColor;}
void NebulaMgr::setProtoplanetaryNebulaColor(const Vec3f& c) {Nebula::proto planetaryNebulaColor = c; emit protoplanetaryNebulaeColorChanged(c);} void NebulaMgr::setProtoplanetaryNebulaColor(const Vec3f& c) {Nebula::proto planetaryNebulaColor = c; emit protoplanetaryNebulaeColorChanged(c);}
const Vec3f NebulaMgr::getProtoplanetaryNebulaColor(void) const {return Neb ula::protoplanetaryNebulaColor;} const Vec3f NebulaMgr::getProtoplanetaryNebulaColor(void) const {return Neb ula::protoplanetaryNebulaColor;}
void NebulaMgr::setStarColor(const Vec3f& c) {Nebula::starColor = c; emit s tarsColorChanged(c);} void NebulaMgr::setStarColor(const Vec3f& c) {Nebula::starColor = c; emit s tarsColorChanged(c);}
const Vec3f NebulaMgr::getStarColor(void) const {return Nebula::starColor;} const Vec3f NebulaMgr::getStarColor(void) const {return Nebula::starColor;}
void NebulaMgr::setSymbioticStarColor(const Vec3f& c) {Nebula::symbioticSta
rColor = c; emit symbioticStarsColorChanged(c);}
const Vec3f NebulaMgr::getSymbioticStarColor(void) const {return Nebula::sy
mbioticStarColor;}
void NebulaMgr::setEmissionLineStarColor(const Vec3f& c) {Nebula::emissionL
ineStarColor = c; emit emissionLineStarsColorChanged(c);}
const Vec3f NebulaMgr::getEmissionLineStarColor(void) const {return Nebula:
:emissionLineStarColor;}
void NebulaMgr::setGalaxyClusterColor(const Vec3f& c) {Nebula::galaxyCluste
rColor = c; emit galaxyClustersColorChanged(c);}
const Vec3f NebulaMgr::getGalaxyClusterColor(void) const {return Nebula::ga
laxyClusterColor;}
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; }
void NebulaMgr::setFlagOutlines(const bool flag) {if(Nebula::flagUseOutline
s!=flag){ Nebula::flagUseOutlines=flag; emit flagOutlinesDisplayedChanged(f
lag);}}
bool NebulaMgr::getFlagOutlines(void) const {return Nebula::flagUseOutlines
;}
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 176 skipping to change at line 192
Nebula::texDiffuseNebula = StelApp::getInstance().get TextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures /neb_dif.png"); // Load diffuse nebula marker texture Nebula::texDiffuseNebula = StelApp::getInstance().get TextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures /neb_dif.png"); // Load diffuse nebula marker texture
Nebula::texDarkNebula = StelApp::getInstance().get TextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures /neb_drk.png"); // Load dark nebula marker texture Nebula::texDarkNebula = StelApp::getInstance().get TextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures /neb_drk.png"); // Load dark nebula marker texture
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());
setFlagOutlines(conf->value("gui/flag_dso_outlines_usage", false).to Bool());
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_ setFlagSurfaceBrightnessArcsecUsage(conf->value("gui/flag_surface_br
brightness_arcsec", false).toBool()); ightness_arcsec", false).toBool());
setFlagSurfaceBrightnessShortNotationUsage(conf->value("gui/flag_sur
face_brightness_short", 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 247 skipping to change at line 265
// Set colors for markers // Set colors for markers
setLabelsColor(StelUtils::strToVec3f(conf->value("color/dso_label_co lor", "0.2,0.6,0.7").toString())); setLabelsColor(StelUtils::strToVec3f(conf->value("color/dso_label_co lor", "0.2,0.6,0.7").toString()));
setCirclesColor(StelUtils::strToVec3f(conf->value("color/dso_circle_ color", "1.0,0.7,0.2").toString())); setCirclesColor(StelUtils::strToVec3f(conf->value("color/dso_circle_ color", "1.0,0.7,0.2").toString()));
QString defaultGalaxyColor = conf->value("color/dso_galaxy_color", " 1.0,0.2,0.2").toString(); QString defaultGalaxyColor = conf->value("color/dso_galaxy_color", " 1.0,0.2,0.2").toString();
setGalaxyColor(StelUtils::strToVec3f(defaultGalaxyColor)); setGalaxyColor(StelUtils::strToVec3f(defaultGalaxyColor));
setRadioGalaxyColor(StelUtils::strToVec3f(conf->value("color/dso_rad io_galaxy_color", "0.3,0.3,0.3").toString())); setRadioGalaxyColor(StelUtils::strToVec3f(conf->value("color/dso_rad io_galaxy_color", "0.3,0.3,0.3").toString()));
setActiveGalaxyColor(StelUtils::strToVec3f(conf->value("color/dso_ac tive_galaxy_color", "1.0,0.5,0.2").toString())); setActiveGalaxyColor(StelUtils::strToVec3f(conf->value("color/dso_ac tive_galaxy_color", "1.0,0.5,0.2").toString()));
setInteractingGalaxyColor(StelUtils::strToVec3f(conf->value("color/d so_interacting_galaxy_color", "0.2,0.5,1.0").toString())); setInteractingGalaxyColor(StelUtils::strToVec3f(conf->value("color/d so_interacting_galaxy_color", "0.2,0.5,1.0").toString()));
setGalaxyClusterColor(StelUtils::strToVec3f(conf->value("color/dso_g alaxy_cluster_color", "0.2,0.8,1.0").toString()));
setQuasarColor(StelUtils::strToVec3f(conf->value("color/dso_quasar_c olor", defaultGalaxyColor).toString())); setQuasarColor(StelUtils::strToVec3f(conf->value("color/dso_quasar_c olor", defaultGalaxyColor).toString()));
setPossibleQuasarColor(StelUtils::strToVec3f(conf->value("color/dso_ possible_quasar_color", defaultGalaxyColor).toString())); setPossibleQuasarColor(StelUtils::strToVec3f(conf->value("color/dso_ possible_quasar_color", defaultGalaxyColor).toString()));
setBlLacObjectColor(StelUtils::strToVec3f(conf->value("color/dso_bl_ lac_color", defaultGalaxyColor).toString())); setBlLacObjectColor(StelUtils::strToVec3f(conf->value("color/dso_bl_ lac_color", defaultGalaxyColor).toString()));
setBlazarColor(StelUtils::strToVec3f(conf->value("color/dso_blazar_c olor", defaultGalaxyColor).toString())); setBlazarColor(StelUtils::strToVec3f(conf->value("color/dso_blazar_c olor", defaultGalaxyColor).toString()));
QString defaultNebulaColor = conf->value("color/dso_nebula_color", " 0.1,1.0,0.1").toString(); QString defaultNebulaColor = conf->value("color/dso_nebula_color", " 0.1,1.0,0.1").toString();
setNebulaColor(StelUtils::strToVec3f(defaultNebulaColor)); setNebulaColor(StelUtils::strToVec3f(defaultNebulaColor));
setPlanetaryNebulaColor(StelUtils::strToVec3f(conf->value("color/dso _planetary_nebula_color", defaultNebulaColor).toString())); setPlanetaryNebulaColor(StelUtils::strToVec3f(conf->value("color/dso _planetary_nebula_color", defaultNebulaColor).toString()));
setReflectionNebulaColor(StelUtils::strToVec3f(conf->value("color/ds o_reflection_nebula_color", defaultNebulaColor).toString())); setReflectionNebulaColor(StelUtils::strToVec3f(conf->value("color/ds o_reflection_nebula_color", defaultNebulaColor).toString()));
setBipolarNebulaColor(StelUtils::strToVec3f(conf->value("color/dso_b ipolar_nebula_color", defaultNebulaColor).toString())); setBipolarNebulaColor(StelUtils::strToVec3f(conf->value("color/dso_b ipolar_nebula_color", defaultNebulaColor).toString()));
setEmissionNebulaColor(StelUtils::strToVec3f(conf->value("color/dso_ emission_nebula_color", defaultNebulaColor).toString())); setEmissionNebulaColor(StelUtils::strToVec3f(conf->value("color/dso_ emission_nebula_color", defaultNebulaColor).toString()));
setDarkNebulaColor(StelUtils::strToVec3f(conf->value("color/dso_dark _nebula_color", "0.3,0.3,0.3").toString())); setDarkNebulaColor(StelUtils::strToVec3f(conf->value("color/dso_dark _nebula_color", "0.3,0.3,0.3").toString()));
setHydrogenRegionColor(StelUtils::strToVec3f(conf->value("color/dso_ hydrogen_region_color", defaultNebulaColor).toString())); setHydrogenRegionColor(StelUtils::strToVec3f(conf->value("color/dso_ hydrogen_region_color", defaultNebulaColor).toString()));
setSupernovaRemnantColor(StelUtils::strToVec3f(conf->value("color/ds o_supernova_remnant_color", defaultNebulaColor).toString())); setSupernovaRemnantColor(StelUtils::strToVec3f(conf->value("color/ds o_supernova_remnant_color", defaultNebulaColor).toString()));
setSupernovaCandidateColor(StelUtils::strToVec3f(conf->value("color/
dso_supernova_candidate_color", defaultNebulaColor).toString()));
setSupernovaRemnantCandidateColor(StelUtils::strToVec3f(conf->value(
"color/dso_supernova_remnant_cand_color", defaultNebulaColor).toString()));
setInterstellarMatterColor(StelUtils::strToVec3f(conf->value("color/ dso_interstellar_matter_color", defaultNebulaColor).toString())); setInterstellarMatterColor(StelUtils::strToVec3f(conf->value("color/ dso_interstellar_matter_color", defaultNebulaColor).toString()));
setClusterWithNebulosityColor(StelUtils::strToVec3f(conf->value("col or/dso_cluster_with_nebulosity_color", defaultNebulaColor).toString())); setClusterWithNebulosityColor(StelUtils::strToVec3f(conf->value("col or/dso_cluster_with_nebulosity_color", defaultNebulaColor).toString()));
setMolecularCloudColor(StelUtils::strToVec3f(conf->value("color/dso_ molecular_cloud_color", defaultNebulaColor).toString())); setMolecularCloudColor(StelUtils::strToVec3f(conf->value("color/dso_ molecular_cloud_color", defaultNebulaColor).toString()));
setPossiblePlanetaryNebulaColor(StelUtils::strToVec3f(conf->value("c olor/dso_possible_planetary_nebula_color", defaultNebulaColor).toString())) ; setPossiblePlanetaryNebulaColor(StelUtils::strToVec3f(conf->value("c olor/dso_possible_planetary_nebula_color", defaultNebulaColor).toString())) ;
setProtoplanetaryNebulaColor(StelUtils::strToVec3f(conf->value("colo r/dso_protoplanetary_nebula_color", defaultNebulaColor).toString())); setProtoplanetaryNebulaColor(StelUtils::strToVec3f(conf->value("colo r/dso_protoplanetary_nebula_color", defaultNebulaColor).toString()));
QString defaultClusterColor = conf->value("color/dso_cluster_color", "1.0,1.0,0.1").toString(); QString defaultClusterColor = conf->value("color/dso_cluster_color", "1.0,1.0,0.1").toString();
setClusterColor(StelUtils::strToVec3f(defaultClusterColor)); setClusterColor(StelUtils::strToVec3f(defaultClusterColor));
setOpenClusterColor(StelUtils::strToVec3f(conf->value("color/dso_ope n_cluster_color", defaultClusterColor).toString())); setOpenClusterColor(StelUtils::strToVec3f(conf->value("color/dso_ope n_cluster_color", defaultClusterColor).toString()));
setGlobularClusterColor(StelUtils::strToVec3f(conf->value("color/dso _globular_cluster_color", defaultClusterColor).toString())); setGlobularClusterColor(StelUtils::strToVec3f(conf->value("color/dso _globular_cluster_color", defaultClusterColor).toString()));
setStellarAssociationColor(StelUtils::strToVec3f(conf->value("color/ dso_stellar_association_color", defaultClusterColor).toString())); setStellarAssociationColor(StelUtils::strToVec3f(conf->value("color/ dso_stellar_association_color", defaultClusterColor).toString()));
setStarCloudColor(StelUtils::strToVec3f(conf->value("color/dso_star_ cloud_color", defaultClusterColor).toString())); setStarCloudColor(StelUtils::strToVec3f(conf->value("color/dso_star_ cloud_color", defaultClusterColor).toString()));
QString defaultStellarColor = conf->value("color/dso_star_color", "1 .0,0.7,0.2").toString(); QString defaultStellarColor = conf->value("color/dso_star_color", "1 .0,0.7,0.2").toString();
setStarColor(StelUtils::strToVec3f(defaultStellarColor)); setStarColor(StelUtils::strToVec3f(defaultStellarColor));
setSymbioticStarColor(StelUtils::strToVec3f(conf->value("color/dso_s
ymbiotic_star_color", defaultStellarColor).toString()));
setEmissionLineStarColor(StelUtils::strToVec3f(conf->value("color/ds
o_emission_star_color", defaultStellarColor).toString()));
setEmissionObjectColor(StelUtils::strToVec3f(conf->value("color/dso_ emission_object_color", defaultStellarColor).toString())); setEmissionObjectColor(StelUtils::strToVec3f(conf->value("color/dso_ emission_object_color", defaultStellarColor).toString()));
setYoungStellarObjectColor(StelUtils::strToVec3f(conf->value("color/ dso_young_stellar_object_color", defaultStellarColor).toString())); setYoungStellarObjectColor(StelUtils::strToVec3f(conf->value("color/ dso_young_stellar_object_color", defaultStellarColor).toString()));
// for DSO convertor (for developers!) // for DSO convertor (for developers!)
flagConverter = conf->value("devel/convert_dso_catalog", false).toBo ol(); flagConverter = conf->value("devel/convert_dso_catalog", false).toBo ol();
flagDecimalCoordinates = conf->value("devel/convert_dso_decimal_coor d", true).toBool(); flagDecimalCoordinates = conf->value("devel/convert_dso_decimal_coor d", true).toBool();
setFlagUseTypeFilters(conf->value("astro/flag_use_type_filter", fals e).toBool()); setFlagUseTypeFilters(conf->value("astro/flag_use_type_filter", fals e).toBool());
Nebula::CatalogGroup catalogFilters = Nebula::CatalogGroup(0); Nebula::CatalogGroup catalogFilters = Nebula::CatalogGroup(0);
skipping to change at line 324 skipping to change at line 347
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()) if (conf->value("flag_show_arp", false).toBool())
catalogFilters |= Nebula::CatArp; catalogFilters |= Nebula::CatArp;
if (conf->value("flag_show_vv", false).toBool()) if (conf->value("flag_show_vv", false).toBool())
catalogFilters |= Nebula::CatVV; catalogFilters |= Nebula::CatVV;
if (conf->value("flag_show_pk", false).toBool()) if (conf->value("flag_show_pk", false).toBool())
catalogFilters |= Nebula::CatPK; catalogFilters |= Nebula::CatPK;
if (conf->value("flag_show_png", false).toBool())
catalogFilters |= Nebula::CatPNG;
if (conf->value("flag_show_snrg", false).toBool())
catalogFilters |= Nebula::CatSNRG;
if (conf->value("flag_show_aco", false).toBool())
catalogFilters |= Nebula::CatACO;
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 350 skipping to change at line 379
if (conf->value("flag_show_bright_nebulae", true).toBool()) if (conf->value("flag_show_bright_nebulae", true).toBool())
typeFilters |= Nebula::TypeBrightNebulae; typeFilters |= Nebula::TypeBrightNebulae;
if (conf->value("flag_show_dark_nebulae", true).toBool()) if (conf->value("flag_show_dark_nebulae", true).toBool())
typeFilters |= Nebula::TypeDarkNebulae; typeFilters |= Nebula::TypeDarkNebulae;
if (conf->value("flag_show_planetary_nebulae", true).toBool()) if (conf->value("flag_show_planetary_nebulae", true).toBool())
typeFilters |= Nebula::TypePlanetaryNebulae; typeFilters |= Nebula::TypePlanetaryNebulae;
if (conf->value("flag_show_hydrogen_regions", true).toBool()) if (conf->value("flag_show_hydrogen_regions", true).toBool())
typeFilters |= Nebula::TypeHydrogenRegions; typeFilters |= Nebula::TypeHydrogenRegions;
if (conf->value("flag_show_supernova_remnants", true).toBool()) if (conf->value("flag_show_supernova_remnants", true).toBool())
typeFilters |= Nebula::TypeSupernovaRemnants; typeFilters |= Nebula::TypeSupernovaRemnants;
if (conf->value("flag_show_galaxy_clusters", true).toBool())
typeFilters |= Nebula::TypeGalaxyClusters;
if (conf->value("flag_show_other", true).toBool()) if (conf->value("flag_show_other", true).toBool())
typeFilters |= Nebula::TypeOther; typeFilters |= Nebula::TypeOther;
conf->endGroup(); conf->endGroup();
setTypeFilters(typeFilters); setTypeFilters(typeFilters);
// TODO: mechanism to specify which sets get loaded at start time. // TODO: mechanism to specify which sets get loaded at start time.
// candidate methods: // candidate methods:
// 1. config file option (list of sets to load at startup) // 1. config file option (list of sets to load at startup)
// 2. load all // 2. load all
// 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 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) if (checkMaxMagHints)
return; return;
Nebula* n = static_cast<Nebula*>(obj); Nebula* n = static_cast<Nebula*>(obj);
float mag = qMin(n->vMag, n->bMag);
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)
float mag = qMin(n->vMag, n->bMag);
if ((drawer->getFlagNebulaMagnitudeLimit()) && (mag > drawer ->getCustomNebulaMagnitudeLimit())) if ((drawer->getFlagNebulaMagnitudeLimit()) && (mag > drawer ->getCustomNebulaMagnitudeLimit()))
return; return;
if (n->majorAxisSize>angularSizeLimit || n->majorAxisSize==0 if (!n->objectInDisplayedCatalog())
.f) return;
{
float refmag_add=0; // value to adjust hints visibil
ity threshold.
if (n->majorAxisSize>angularSizeLimit || n->majorAxisSize==0
.f || mag <= maxMagHints)
{
sPainter->getProjector()->project(n->XYZ,n->XY); sPainter->getProjector()->project(n->XYZ,n->XY);
n->drawLabel(*sPainter, maxMagLabels-refmag_add); n->drawLabel(*sPainter, maxMagLabels);
n->drawHints(*sPainter, maxMagHints -refmag_add); n->drawHints(*sPainter, maxMagHints);
n->drawOutlines(*sPainter, maxMagHints);
} }
} }
float maxMagHints; float maxMagHints;
float maxMagLabels; float maxMagLabels;
StelPainter* sPainter; StelPainter* sPainter;
StelCore* core; StelCore* core;
float angularSizeLimit; float angularSizeLimit;
bool checkMaxMagHints; bool checkMaxMagHints;
}; };
void NebulaMgr::setCatalogFilters(Nebula::CatalogGroup cflags) void NebulaMgr::setCatalogFilters(Nebula::CatalogGroup cflags)
{ {
if(static_cast<int>(cflags) != static_cast<int>(Nebula::catalogFilte rs)) if(static_cast<int>(cflags) != static_cast<int>(Nebula::catalogFilte rs))
{ {
Nebula::catalogFilters = cflags; Nebula::catalogFilters = cflags;
dsoArray.clear();
dsoIndex.clear();
nebGrid.clear();
bool status = getFlagShow();
StelApp::getInstance().getStelObjectMgr().unSelect();
if (flagReloading)
qWarning() << "Reloading DSO data...";
else
qWarning() << "Loading DSO data...";
setFlagShow(false);
loadNebulaSet("default");
setFlagShow(status);
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 473 skipping to change at line 485
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ; const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ;
StelPainter sPainter(prj); StelPainter sPainter(prj);
StelSkyDrawer* skyDrawer = core->getSkyDrawer(); StelSkyDrawer* skyDrawer = core->getSkyDrawer();
Nebula::hintsBrightness = hintsFader.getInterstate()*flagShow.getInt erstate(); Nebula::hintsBrightness = hintsFader.getInterstate()*flagShow.getInt erstate();
sPainter.setBlending(true, GL_ONE, GL_ONE); sPainter.setBlending(true, GL_ONE, GL_ONE);
// Use a 1 degree margin // Use a 4 degree margin (esp. for wide outlines)
const double margin = 1.*M_PI/180.*prj->getPixelPerRadAtCenter(); const double margin = 4.*M_PI/180.*prj->getPixelPerRadAtCenter();
const SphericalRegionP& p = prj->getViewportConvexPolygon(margin, ma rgin); const SphericalRegionP& p = prj->getViewportConvexPolygon(margin, ma rgin);
// Print all the nebulae of all the selected zones // Print all the nebulae of all the selected zones
float maxMagHints = computeMaxMagHint(skyDrawer); float maxMagHints = computeMaxMagHint(skyDrawer);
float maxMagLabels = skyDrawer->getLimitMagnitude()-2.f+(labelsAmoun t*1.2f)-2.f; float maxMagLabels = skyDrawer->getLimitMagnitude()-2.f+(labelsAmoun t*1.2f)-2.f;
sPainter.setFont(nebulaFont); sPainter.setFont(nebulaFont);
DrawNebulaFuncObject func(maxMagHints, maxMagLabels, &sPainter, core , hintsFader.getInterstate()>0.0001); DrawNebulaFuncObject func(maxMagHints, maxMagLabels, &sPainter, core , hintsFader.getInterstate()<=0.f);
nebGrid.processIntersectingPointInRegions(p.data(), func); nebGrid.processIntersectingPointInRegions(p.data(), func);
if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer()) if (GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer())
drawPointer(core, sPainter); drawPointer(core, sPainter);
} }
void NebulaMgr::drawPointer(const StelCore* core, StelPainter& sPainter) void NebulaMgr::drawPointer(const StelCore* core, StelPainter& sPainter)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ; const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ;
skipping to change at line 539 skipping to change at line 551
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|ARP|VV)\\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; //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);
skipping to change at line 565 skipping to change at line 577
if (cat == "VV") return searchVV(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|PK)\\s*(.+)$"); static QRegExp sCatNumRx("^(CED|PK|ACO|ABELL)\\s*(.+)$");
if (sCatNumRx.exactMatch(uname)) if (sCatNumRx.exactMatch(uname))
{ {
QString cat = catNumRx.capturedTexts().at(1); QString cat = sCatNumRx.capturedTexts().at(1);
QString num = catNumRx.capturedTexts().at(2).trimmed(); QString num = sCatNumRx.capturedTexts().at(2).trimmed();
if (cat == "CED") return searchCed(num); if (cat == "CED") return searchCed(num);
if (cat == "PK") return searchPK(num); if (cat == "PK") return searchPK(num);
if (cat == "ACO" || cat == "ABELL") return searchACO(num);
}
static QRegExp gCatNumRx("^(PN|SNR)\\s*G(.+)$");
if (gCatNumRx.exactMatch(uname))
{
QString cat = gCatNumRx.capturedTexts().at(1);
QString num = gCatNumRx.capturedTexts().at(2).trimmed();
if (cat == "PN") return searchPNG(num);
if (cat == "SNR") return searchSNRG(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 dsoOutlinesPath = StelFileMgr::findFile("nebulae/" +
setName + "/outlines.dat");
dsoArray.clear();
dsoIndex.clear();
nebGrid.clear();
if (flagConverter) if (flagConverter)
{ {
if (!srcCatalogPath.isEmpty()) if (!srcCatalogPath.isEmpty())
convertDSOCatalog(srcCatalogPath, StelFileMgr::findF ile("nebulae/" + setName + "/catalog.pack"), flagDecimalCoordinates); 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;
} }
loadDSOCatalog(dsoCatalogPath); loadDSOCatalog(dsoCatalogPath);
if (!dsoOutlinesPath.isEmpty())
loadDSOOutlines(dsoOutlinesPath);
} }
// 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 795 skipping to change at line 825
} }
NebulaP NebulaMgr::searchPK(QString PK) NebulaP NebulaMgr::searchPK(QString PK)
{ {
foreach (const NebulaP& n, dsoArray) foreach (const NebulaP& n, dsoArray)
if (n->PK_nb.trimmed().toUpper() == PK.trimmed().toUpper()) if (n->PK_nb.trimmed().toUpper() == PK.trimmed().toUpper())
return n; return n;
return NebulaP(); return NebulaP();
} }
NebulaP NebulaMgr::searchPNG(QString PNG)
{
foreach (const NebulaP& n, dsoArray)
if (n->PNG_nb.trimmed().toUpper() == PNG.trimmed().toUpper()
)
return n;
return NebulaP();
}
NebulaP NebulaMgr::searchSNRG(QString SNRG)
{
foreach (const NebulaP& n, dsoArray)
if (n->SNRG_nb.trimmed().toUpper() == SNRG.trimmed().toUpper
())
return n;
return NebulaP();
}
NebulaP NebulaMgr::searchACO(QString ACO)
{
foreach (const NebulaP& n, dsoArray)
if (n->ACO_nb.trimmed().toUpper() == ACO.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 839 skipping to change at line 893
} }
// 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, Arp, VV; 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, PK, ra, dec; QString oType, mType, Ced, PK, PNG, SNRG, ACO, 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;
QRegExp version("ersion\\s+([\\d\\.]+)\\s+(\\w+)");
int vp = version.indexIn(record);
if (vp!=-1) // Version of catalog, a first line!
dsoOutStream << version.capturedTexts().at(1).trimme
d() << version.capturedTexts().at(2).trimmed();
// skip comments // skip comments
if (record.startsWith("//") || record.startsWith("#")) if (record.startsWith("//") || record.startsWith("#"))
continue; continue;
++currentRecordNumber; ++currentRecordNumber;
if (!record.isEmpty()) if (!record.isEmpty())
{ {
QStringList list=record.split("\t", QString::KeepEmp tyParts); QStringList list=record.split("\t", QString::KeepEmp tyParts);
id = list.at(0).toInt(); // ID (inner identification number) id = list.at(0).toInt(); // ID (inner identification number)
skipping to change at line 897 skipping to change at line 956
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 Arp = list.at(31).toInt(); // Arp number
VV = list.at(32).toInt(); // VV number VV = list.at(32).toInt(); // VV number
PK = list.at(33).trimmed(); // PK number PK = list.at(33).trimmed(); // PK number
PNG = list.at(34).trimmed(); //
PN G number
SNRG = list.at(35).trimmed(); //
SNR G number
ACO = list.at(36).trimmed(); //
ACO 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 934 skipping to change at line 996
} }
majorAxisSize /= 60.f; // Convert from arcmin to de grees majorAxisSize /= 60.f; // Convert from arcmin to de grees
minorAxisSize /= 60.f; // Convert from arcmin to de grees minorAxisSize /= 60.f; // Convert from arcmin to de grees
// 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 oTypes << "G" << "GX" << "GC" << "OC" << "NB"
" << "DN" << "RN" << "C+N" << "PN" << "DN" << "RN" << "C+N" << "RNE"
<< "RNE" << "HII" << "SNR" << "BN" << "EN" << << "HII" << "SNR" << "BN" << "EN" << "SA"
"SA" << "SC" << "CL" << "IG" << "SC" << "CL" << "IG" << "RG" << "AGX"
<< "RG" << "AGX" << "QSO" << "ISM" << "EMO" < << "QSO" << "ISM" << "EMO" << "GNE" << "RAD"
< "GNE" << "RAD" << "LIN" << "LIN" << "BLL" << "BLA" << "MOC" << "YSO"
<< "BLL" << "BLA" << "MOC" << "YSO" << "Q?" < << "Q?" << "PN?" << "*" << "SFR" << "IR"
< "PN?" << "*" << "SFR" << "**" << "MUL" << "PPN" << "GIG" << "OPC"
<< "IR" << "**" << "MUL" << "PPN" << "GIG"; << "MGR" << "IG2" << "IG3" << "SY*" << "PA*"
<< "CV*" << "Y*?" << "CGB" << "SNRG" << "Y*O"
<< "SR*" << "EM*" << "AB*" << "MI*" << "MI?"
<< "TT*" << "WR*" << "C*" << "WD*" << "EL*"
<< "NL*" << "NO*" << "HS*" << "LP*" << "OH*"
<< "S?R" << "IR*" << "POC" << "PNB" << "GXCL"
<< "AL*" << "PR*" << "RS*" << "S*B" << "SN?"
<< "SR?" << "DNE" << "RG*" << "PSR" << "HH"
<< "V*" << "PA?" << "BUB" << "CLG" << "CGG";
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;
case 3: case 3:
case 39:
nType = (unsigned int)Nebula::NebOc; nType = (unsigned int)Nebula::NebOc;
break; break;
case 4: case 4:
nType = (unsigned int)Nebula::NebN; nType = (unsigned int)Nebula::NebN;
break; break;
case 5: case 5:
case 68:
nType = (unsigned int)Nebula::NebPn; nType = (unsigned int)Nebula::NebPn;
break; break;
case 6: case 6:
case 34: case 34:
case 76:
nType = (unsigned int)Nebula::NebDn; nType = (unsigned int)Nebula::NebDn;
break; break;
case 7: case 7:
case 9: case 9:
nType = (unsigned int)Nebula::NebRn; nType = (unsigned int)Nebula::NebRn;
break; break;
case 8: case 8:
nType = (unsigned int)Nebula::NebCn; nType = (unsigned int)Nebula::NebCn;
break; break;
case 10: case 10:
case 23: case 23:
nType = (unsigned int)Nebula::NebHII ; nType = (unsigned int)Nebula::NebHII ;
break; break;
case 11: case 11:
case 48:
case 78:
nType = (unsigned int)Nebula::NebSNR ; nType = (unsigned int)Nebula::NebSNR ;
break; break;
case 12: case 12:
nType = (unsigned int)Nebula::NebBn; nType = (unsigned int)Nebula::NebBn;
break; break;
case 13: case 13:
nType = (unsigned int)Nebula::NebEn; nType = (unsigned int)Nebula::NebEn;
break; break;
case 14: case 14:
case 40:
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: case 38:
case 41:
case 42:
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:
nType = (unsigned int)Nebula::NebQSO ; nType = (unsigned int)Nebula::NebQSO ;
break; break;
case 21: case 21:
case 24: case 24:
case 47:
case 79:
case 82:
nType = (unsigned int)Nebula::NebISM ; nType = (unsigned int)Nebula::NebISM ;
break; break;
case 22: case 22:
nType = (unsigned int)Nebula::NebEMO ; nType = (unsigned int)Nebula::NebEMO ;
break; break;
case 26: case 26:
nType = (unsigned int)Nebula::NebBLL ; nType = (unsigned int)Nebula::NebBLL ;
break; break;
case 27: case 27:
nType = (unsigned int)Nebula::NebBLA ; nType = (unsigned int)Nebula::NebBLA ;
break; break;
case 28: case 28:
case 33: case 33:
case 67:
nType = (unsigned int)Nebula::NebMol Cld; nType = (unsigned int)Nebula::NebMol Cld;
break; break;
case 29: case 29:
case 46:
case 49:
nType = (unsigned int)Nebula::NebYSO ; nType = (unsigned int)Nebula::NebYSO ;
break; break;
case 30: case 30:
nType = (unsigned int)Nebula::NebPos sQSO; nType = (unsigned int)Nebula::NebPos sQSO;
break; break;
case 31: case 31:
nType = (unsigned int)Nebula::NebPos sPN; nType = (unsigned int)Nebula::NebPos sPN;
break; break;
case 32: case 32:
case 35: case 35:
case 36: case 36:
case 45:
case 50:
case 52:
case 53:
case 54:
case 55:
case 56:
case 58:
case 59:
case 60:
case 61:
case 62:
case 63:
case 64:
case 65:
case 66:
case 70:
case 71:
case 72:
case 73:
case 77:
case 80:
nType = (unsigned int)Nebula::NebSta r; nType = (unsigned int)Nebula::NebSta r;
break; break;
case 37: case 37:
case 44:
case 81:
nType = (unsigned int)Nebula::NebPPN ; nType = (unsigned int)Nebula::NebPPN ;
break; break;
case 43:
nType = (unsigned int)Nebula::NebSym
bioticStar;
break;
case 51:
case 57:
nType = (unsigned int)Nebula::NebEmi
ssionLineStar;
break;
case 74:
nType = (unsigned int)Nebula::NebSNC
;
break;
case 75:
nType = (unsigned int)Nebula::NebSNR
C;
break;
case 69:
case 83:
case 84:
nType = (unsigned int)Nebula::NebGxC
l;
break;
default: default:
{
nType = (unsigned int)Nebula::NebUnk nown; nType = (unsigned int)Nebula::NebUnk nown;
qDebug() << "Record with ID" << id < <"has unknown type of object:" << oType;
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 << B << Sh2 << VdB << RCW << LDN << LB
N << Cr << Mel << PGC << UGC << Ced << Arp << VV << PK; N << Cr << Mel << PGC << UGC << Ced << Arp << VV << PK
<< PNG << SNRG << ACO;
} }
} }
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."; 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;
qDebug() << "Loading DSO data ...";
// Let's begin use gzipped data // Let's begin use gzipped data
QDataStream ins(StelUtils::uncompress(in.readAll())); QDataStream ins(StelUtils::uncompress(in.readAll()));
ins.setVersion(QDataStream::Qt_5_2); ins.setVersion(QDataStream::Qt_5_2);
QString version = "", edition= "";
int totalRecords=0; int totalRecords=0;
while (!ins.atEnd()) while (!ins.atEnd())
{ {
// Create a new Nebula record if (totalRecords==0) // Read the version of catalog
NebulaP e = NebulaP(new Nebula); {
e->readDSO(ins); ins >> version >> edition;
if (version.isEmpty())
if (!objectInDisplayedCatalog(e)) continue; version = "3.1"; // The first version of ext
ended edition of the catalog
dsoArray.append(e); if (edition.isEmpty())
nebGrid.insert(qSharedPointerCast<StelRegionObject>(e)); edition = "unknown";
if (e->DSO_nb!=0) qDebug() << "[...]" << QString("Stellarium DSO Catal
dsoIndex.insert(e->DSO_nb, e); og, version %1 (%2 edition)").arg(version).arg(edition);
if (StelUtils::compareVersions(version, StellariumDS
OCatalogVersion)!=0)
{
qDebug() << "WARNING: Mismatch the version o
f catalog! The expected version of catalog is" << StellariumDSOCatalogVersi
on;
++totalRecords;
break;
}
}
else
{
// Create a new Nebula record
NebulaP e = NebulaP(new Nebula);
e->readDSO(ins);
dsoArray.append(e);
nebGrid.insert(qSharedPointerCast<StelRegionObject>(
e));
if (e->DSO_nb!=0)
dsoIndex.insert(e->DSO_nb, e);
}
++totalRecords; ++totalRecords;
} }
in.close(); in.close();
qDebug() << "Loaded" << totalRecords << "DSO records"; qDebug() << "Loaded" << --totalRecords << "DSO records";
return true; return true;
} }
bool NebulaMgr::objectInDisplayedCatalog(NebulaP n)
{
bool r = false;
Nebula::CatalogGroup catalogFilters = getCatalogFilters();
if ((catalogFilters&Nebula::CatM) && (n->M_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatC) && (n->C_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatNGC) && (n->NGC_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatIC) && (n->IC_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatB) && (n->B_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatSh2) && (n->Sh2_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatVdB) && (n->VdB_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatRCW) && (n->RCW_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatLDN) && (n->LDN_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatLBN) && (n->LBN_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatCr) && (n->Cr_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatMel) && (n->Mel_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatPGC) && (n->PGC_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatUGC) && (n->UGC_nb>0))
r = true;
else if ((catalogFilters&Nebula::CatCed) && !(n->Ced_nb.isEmpty()))
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
if (n->withoutID)
r = true;
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))
{ {
qWarning() << "DSO name data file" << QDir::toNativeSeparato rs(filename) << "not found."; qWarning() << "DSO name data file" << QDir::toNativeSeparato rs(filename) << "not found.";
return false; return false;
} }
// Read the names of the NGC objects // Read the names of the deep-sky objects
QString name, record, ref, cdes; QString name, record, ref, cdes;
QStringList nodata;
nodata.clear();
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("_[(]\"(.*)\"[)](\\s*#.*)?"); // optional comments a fter name. QRegExp transRx("_[(]\"(.*)\"[)](\\s*#.*)?"); // optional comments a fter name.
while (!dsoNameFile.atEnd()) while (!dsoNameFile.atEnd())
{ {
record = QString::fromUtf8(dsoNameFile.readLine()); record = QString::fromUtf8(dsoNameFile.readLine());
skipping to change at line 1175 skipping to change at line 1274
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" << "ARP" << "VV " << "PK"; << "NGC" << "PGC" << "UGC" << "CED" << "ARP" << "VV " << "PK" << "PNG" << "SNRG" << "ACO";
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 1233 skipping to change at line 1332
break; break;
case 15: case 15:
e = searchArp(nb); e = searchArp(nb);
break; break;
case 16: case 16:
e = searchVV(nb); e = searchVV(nb);
break; break;
case 17: case 17:
e = searchPK(cdes); e = searchPK(cdes);
break; break;
case 18:
e = searchPNG(cdes);
break;
case 19:
e = searchSNRG(cdes);
break;
case 20:
e = searchACO(cdes);
break;
default: default:
e = searchDSO(nb); e = searchDSO(nb);
break; break;
} }
if (e) if (!e.isNull())
{ {
if (transRx.exactMatch(name)) if (transRx.exactMatch(name))
{ {
QString propName = transRx.capturedTexts().a t(1).trimmed(); QString propName = transRx.capturedTexts().a t(1).trimmed();
QString currName = e->getEnglishName(); QString currName = e->getEnglishName();
if (currName.isEmpty()) if (currName.isEmpty())
e->setProperName(propName); e->setProperName(propName);
else if (currName!=propName) else if (currName!=propName)
e->addNameAlias(propName); e->addNameAlias(propName);
} }
readOk++; readOk++;
} }
//else else
// qWarning() << "no position data for " << name << "at nodata.append(QString("%1 %2").arg(ref.trimmed(), cd
line" << lineNumber << "of" << QDir::toNativeSeparators(filename); es.trimmed()));
} }
dsoNameFile.close(); dsoNameFile.close();
qDebug() << "Loaded" << readOk << "/" << totalRecords << "DSO name r ecords successfully"; qDebug() << "Loaded" << readOk << "/" << totalRecords << "DSO name r ecords successfully";
int err = nodata.size();
if (err>0)
qDebug() << "WARNING - No position data for" << err << "obje
cts:" << nodata.join(", ");
return true; return true;
} }
void NebulaMgr::updateDSONames() bool NebulaMgr::loadDSOOutlines(const QString &filename)
{ {
updateSkyCulture(StelApp::getInstance().getSkyCultureMgr().getCurren qDebug() << "Loading DSO outline data ...";
tSkyCultureID()); QFile dsoOutlineFile(filename);
updateI18n(); if (!dsoOutlineFile.open(QIODevice::ReadOnly | QIODevice::Text))
{
qWarning() << "DSO outline data file" << QDir::toNativeSepar
ators(filename) << "not found.";
return false;
}
float RA, DE;
int i, readOk = 0;
Vec3f XYZ;
std::vector<Vec3f> *points = Q_NULLPTR;
typedef QPair<float, float> coords;
coords point, fpoint;
QList<coords> outline;
QString record, command, dso;
NebulaP e;
// Read the outlines data of the DSO
QRegExp commentRx("^(\\s*#.*|\\s*)$");
while (!dsoOutlineFile.atEnd())
{
record = QString::fromUtf8(dsoOutlineFile.readLine());
if (commentRx.exactMatch(record))
continue;
// bytes 1 - 8, RA
RA = record.left(8).toFloat();
// bytes 9 -18, DE
DE = record.mid(9, 10).toFloat();
// bytes 19-25, command
command = record.mid(19, 7).trimmed();
// bytes 26, designation of DSO
dso = record.mid(26).trimmed();
RA*=M_PI/12.; // Convert from hours to rad
DE*=M_PI/180.; // Convert from deg to rad
if (command.contains("start", Qt::CaseInsensitive))
{
outline.clear();
e = search(dso);
point.first = RA;
point.second = DE;
outline.append(point);
fpoint = point;
}
if (command.contains("vertex", Qt::CaseInsensitive))
{
point.first = RA;
point.second = DE;
outline.append(point);
}
if (command.contains("end", Qt::CaseInsensitive))
{
point.first = RA;
point.second = DE;
outline.append(point);
outline.append(fpoint);
if (!e.isNull())
{
points = new std::vector<Vec3f>;
for (i = 0; i < outline.size(); i++)
{
// Calc the Cartesian coord with RA
and DE
point = outline.at(i);
StelUtils::spheToRect(point.first, p
oint.second, XYZ);
points->push_back(XYZ);
}
e->outlineSegments.push_back(points);
}
readOk++;
}
}
dsoOutlineFile.close();
qDebug() << "Loaded" << readOk << "DSO outline records successfully"
;
return true;
} }
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())
skipping to change at line 1551 skipping to change at line 1743
// Search by PK numbers // Search by PK numbers
if (objw.left(2) == "PK") if (objw.left(2) == "PK")
{ {
foreach (const NebulaP& n, dsoArray) 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()) 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 qSharedPointerCast<StelObject>(n);
} }
} }
// Search by PN G numbers
if (objw.left(2) == "PN")
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("PNG%1").arg(n->PNG_nb.trimmed().toUpper
()) == objw.trimmed() || QString("PN G%1").arg(n->PNG_nb.trimmed().toUpper(
)) == objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
// Search by SNR G numbers
if (objw.left(3) == "SNR")
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("SNRG%1").arg(n->SNRG_nb.trimmed().toUpp
er()) == objw.trimmed() || QString("SNR G%1").arg(n->SNRG_nb.trimmed().toUp
per()) == objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
// Search by ACO numbers (possible formats are "ACO31", "ACO 31", "A
bell31" or "Abell 31")
if (objw.left(2) == "ACO" || objw.left(5) == "ABELL")
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("ACO%1").arg(n->ACO_nb.trimmed().toUpper
()) == objw.trimmed()
|| QString("ACO %1").arg(n->ACO_nb.trimmed().toUpper
()) == objw.trimmed()
|| QString("ABELL%1").arg(n->ACO_nb.trimmed().toUppe
r()) == objw.trimmed()
|| QString("ABELL %1").arg(n->ACO_nb.trimmed().toUpp
er()) == objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
return StelObjectP(); return StelObjectP();
} }
//! Return the matching Nebula object's pointer if exists or Q_NULLPTR //! 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. //! 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();
skipping to change at line 1759 skipping to change at line 1984
// Search by PK numbers // Search by PK numbers
if (objw.startsWith("PK")) if (objw.startsWith("PK"))
{ {
foreach (const NebulaP& n, dsoArray) 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()) 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 qSharedPointerCast<StelObject>(n);
} }
} }
// Search by PN G numbers
if (objw.startsWith("PN"))
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("PNG%1").arg(n->PNG_nb.trimmed().toUpper
()) == objw.trimmed() || QString("PN G%1").arg(n->PNG_nb.trimmed().toUpper(
)) == objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
// Search by SNR G numbers
if (objw.startsWith("SNR"))
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("SNRG%1").arg(n->SNRG_nb.trimmed().toUpp
er()) == objw.trimmed() || QString("SNR G%1").arg(n->SNRG_nb.trimmed().toUp
per()) == objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
// Search by ACO numbers
if (objw.startsWith("ACO") || objw.startsWith("ABELL"))
{
foreach (const NebulaP& n, dsoArray)
{
if (QString("ACO%1").arg(n->ACO_nb.trimmed().toUpper
()) == objw.trimmed()
|| QString("ACO %1").arg(n->ACO_nb.trimmed().toUpper
()) == objw.trimmed()
|| QString("ABELL%1").arg(n->ACO_nb.trimmed().toUppe
r()) == objw.trimmed()
|| QString("ABELL %1").arg(n->ACO_nb.trimmed().toUpp
er()) == objw.trimmed())
return qSharedPointerCast<StelObject>(n);
}
}
return Q_NULLPTR; 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 2130 skipping to change at line 2388
result << constws; result << constws;
continue; // Prevent adding both forms for name continue; // Prevent adding both forms for name
} }
constw = QString("PK %1").arg(n->PK_nb.trimmed()); constw = QString("PK %1").arg(n->PK_nb.trimmed());
constws = constw.mid(0, objw.size()); constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper()) if (constws.toUpper()==objw.toUpper())
result << constw; result << constw;
} }
} }
// Search by PN G objects number
if (objw.size()>=1 && objw.left(2)=="PN")
{
foreach (const NebulaP& n, dsoArray)
{
if (n->PNG_nb.isEmpty()) continue;
QString constw = QString("PNG%1").arg(n->PNG_nb.trim
med());
QString constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper())
{
result << constws;
continue; // Prevent adding both forms
for name
}
constw = QString("PN G%1").arg(n->PNG_nb.trimmed());
constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper())
result << constw;
}
}
// Search by SNR G objects number
if (objw.size()>=1 && objw.left(3)=="SNR")
{
foreach (const NebulaP& n, dsoArray)
{
if (n->SNRG_nb.isEmpty()) continue;
QString constw = QString("SNRG%1").arg(n->SNRG_nb.tr
immed());
QString constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper())
{
result << constws;
continue; // Prevent adding both forms
for name
}
constw = QString("SNR G%1").arg(n->SNRG_nb.trimmed()
);
constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper())
result << constw;
}
}
// Search by ACO objects number
if (objw.size()>=1 && (objw.left(3)=="ACO" || objw.left(5)=="ABELL")
)
{
foreach (const NebulaP& n, dsoArray)
{
if (n->ACO_nb.isEmpty()) continue;
QString constw = QString("ACO%1").arg(n->ACO_nb.trim
med());
QString constws = constw.mid(0, objw.size());
if (constws.toUpper()==objw.toUpper())
{
result << constws;
continue; // Prevent adding both forms
for name
}
constw = QString("ACO %1").arg(n->ACO_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 2317 skipping to change at line 2635
result << QString("VV %1").arg(n->VV _nb); result << QString("VV %1").arg(n->VV _nb);
} }
break; break;
case 117: // Catalogue of Galactic Planetary Nebulae (PK) case 117: // Catalogue of Galactic Planetary Nebulae (PK)
foreach(const NebulaP& n, dsoArray) foreach(const NebulaP& n, dsoArray)
{ {
if (!n->PK_nb.isEmpty()) if (!n->PK_nb.isEmpty())
result << QString("PK %1").arg(n->PK _nb); result << QString("PK %1").arg(n->PK _nb);
} }
break; break;
case 118: // Strasbourg-ESO Catalogue of Galactic Planetary
Nebulae by Acker et. al. (PN G)
foreach(const NebulaP& n, dsoArray)
{
if (!n->PNG_nb.isEmpty())
result << QString("PN G%1").arg(n->P
NG_nb);
}
break;
case 119: // A catalogue of Galactic supernova remnants by G
reen (SNR G)
foreach(const NebulaP& n, dsoArray)
{
if (!n->SNRG_nb.isEmpty())
result << QString("SNR G%1").arg(n->
SNRG_nb);
}
break;
case 120: // A Catalog of Rich Clusters of Galaxies by Abell
et. al. (ACO)
foreach(const NebulaP& n, dsoArray)
{
if (!n->ACO_nb.isEmpty())
result << QString("ACO %1").arg(n->A
CO_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 2411 skipping to change at line 2750
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);
else if (n->Mel_nb>0) else if (n->Mel_nb>0)
result << QString("Mel %1"). arg(n->Mel_nb); result << QString("Mel %1"). arg(n->Mel_nb);
else if (!n->Ced_nb.isEmpty())
result << QString("Ced %1").
arg(n->Ced_nb);
else if (n->Arp_nb>0)
result << QString("Arp %1").
arg(n->Arp_nb);
else if (n->VV_nb>0)
result << QString("VV %1").a
rg(n->VV_nb);
else if (!n->PK_nb.isEmpty())
result << QString("PK %1").a
rg(n->PK_nb);
else if (!n->PNG_nb.isEmpty())
result << QString("PN G%1").
arg(n->PNG_nb);
else if (!n->SNRG_nb.isEmpty())
result << QString("SNR G%1")
.arg(n->SNRG_nb);
else if (n->PGC_nb>0)
result << QString("PGC %1").
arg(n->PGC_nb);
else if (n->UGC_nb > 0)
result << QString("UGC %1").
arg(n->UGC_nb);
else if (!n->ACO_nb.isEmpty())
result << QString("ACO %1").
arg(n->ACO_nb);
} }
} }
break; break;
} }
} }
result.removeDuplicates(); result.removeDuplicates();
return result; return result;
} }
skipping to change at line 2554 skipping to change at line 2911
dso.append(n); dso.append(n);
} }
break; break;
case 117: // Catalogue of Galactic Planetary Nebulae (PK) case 117: // Catalogue of Galactic Planetary Nebulae (PK)
foreach(const NebulaP& n, dsoArray) foreach(const NebulaP& n, dsoArray)
{ {
if (!n->PK_nb.isEmpty()) if (!n->PK_nb.isEmpty())
dso.append(n); dso.append(n);
} }
break; break;
case 118: // Strasbourg-ESO Catalogue of Galactic Planetary
Nebulae by Acker et. al. (PN G)
foreach(const NebulaP& n, dsoArray)
{
if (!n->PNG_nb.isEmpty())
dso.append(n);
}
break;
case 119: // A catalogue of Galactic supernova remnants by G
reen (SNR G)
foreach(const NebulaP& n, dsoArray)
{
if (!n->SNRG_nb.isEmpty())
dso.append(n);
}
break;
case 120: // A Catalog of Rich Clusters of Galaxies by Abell
et. al. (ACO)
foreach(const NebulaP& n, dsoArray)
{
if (!n->ACO_nb.isEmpty())
dso.append(n);
}
break;
case 150: // Dwarf galaxies case 150: // Dwarf galaxies
{ {
QList<int> dwarfGalaxies; QList<int> dwarfGalaxies;
dwarfGalaxies << 3589 << 3792 << 6830 << 10074 << 19441 << 28913 dwarfGalaxies << 3589 << 3792 << 6830 << 10074 << 19441 << 28913
<< 29194 << 29653 << 50779 << 54074 << 60095 << 63287 << 29194 << 29653 << 50779 << 54074 << 60095 << 63287
<< 69519 << 88608 << 2807155 << 3 097691; << 69519 << 88608 << 2807155 << 3 097691;
NebulaP ds; NebulaP ds;
for (int i=0; i < dwarfGalaxies.size(); i++) for (int i=0; i < dwarfGalaxies.size(); i++)
{ {
ds = searchPGC(dwarfGalaxies.at(i)); ds = searchPGC(dwarfGalaxies.at(i));
 End of changes. 72 change blocks. 
124 lines changed or deleted 591 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/