Nebula.cpp   Nebula.cpp 
skipping to change at line 50 skipping to change at line 50
StelTextureSP Nebula::texCircle; StelTextureSP Nebula::texCircle;
StelTextureSP Nebula::texGalaxy; StelTextureSP Nebula::texGalaxy;
StelTextureSP Nebula::texOpenCluster; StelTextureSP Nebula::texOpenCluster;
StelTextureSP Nebula::texGlobularCluster; StelTextureSP Nebula::texGlobularCluster;
StelTextureSP Nebula::texPlanetaryNebula; StelTextureSP Nebula::texPlanetaryNebula;
StelTextureSP Nebula::texDiffuseNebula; StelTextureSP Nebula::texDiffuseNebula;
StelTextureSP Nebula::texDarkNebula; StelTextureSP Nebula::texDarkNebula;
StelTextureSP Nebula::texOpenClusterWithNebulosity; StelTextureSP Nebula::texOpenClusterWithNebulosity;
float Nebula::circleScale = 1.f; float Nebula::circleScale = 1.f;
bool Nebula::drawHintProportional = false; bool Nebula::drawHintProportional = false;
bool Nebula::surfaceBrightnessUsage = false;
float Nebula::hintsBrightness = 0; float Nebula::hintsBrightness = 0;
Vec3f Nebula::labelColor = Vec3f(0.4,0.3,0.5); Vec3f Nebula::labelColor = Vec3f(0.4,0.3,0.5);
Vec3f Nebula::circleColor = Vec3f(0.8,0.8,0.1); Vec3f Nebula::circleColor = Vec3f(0.8,0.8,0.1);
Vec3f Nebula::galaxyColor = Vec3f(1.0,0.2,0.2);
Vec3f Nebula::radioGalaxyColor = Vec3f(0.3,0.3,0.3);
Vec3f Nebula::activeGalaxyColor = Vec3f(0.8,0.8,0.1);
Vec3f Nebula::interactingGalaxyColor = Vec3f(0.8,0.8,0.1);
Vec3f Nebula::brightNebulaColor = Vec3f(0.1,1.0,0.1);
Vec3f Nebula::darkNebulaColor = Vec3f(0.3,0.3,0.3);
Vec3f Nebula::hydrogenRegionColor = Vec3f(0.1,1.0,0.1);
Vec3f Nebula::supernovaRemnantColor = Vec3f(0.1,1.0,0.1);
Vec3f Nebula::clusterColor = Vec3f(1.0,1.0,0.1);
bool Nebula::flagUsageTypeFilter = false;
Nebula::CatalogGroup Nebula::catalogFilters = Nebula::CatalogGroup(0);
Nebula::TypeGroup Nebula::typeFilters = Nebula::TypeGroup(Nebula::AllTypes)
;
Nebula::Nebula() Nebula::Nebula()
: M_nb(0) : DSO_nb(0)
, M_nb(0)
, NGC_nb(0) , NGC_nb(0)
, IC_nb(0) , IC_nb(0)
, C_nb(0) , C_nb(0)
, B_nb(0) , B_nb(0)
, Sh2_nb(0) , Sh2_nb(0)
, VdB_nb(0) , VdB_nb(0)
, RCW_nb(0) , RCW_nb(0)
, LDN_nb(0) , LDN_nb(0)
, LBN_nb(0) , LBN_nb(0)
, Cr_nb(0) , Cr_nb(0)
, Mel_nb(0) , Mel_nb(0)
, mag(99.) , PGC_nb(0)
, UGC_nb(0)
, Ced_nb()
, mTypeString()
, bMag(99.)
, vMag(99.)
, majorAxisSize(0.)
, minorAxisSize(0.)
, orientationAngle(0)
, oDistance(0.)
, oDistanceErr(0.)
, redshift(99.)
, redshiftErr(0.)
, parallax(0.)
, parallaxErr(0.)
, nType() , nType()
, formType()
, structureType()
, brightnessType()
, rcwBrightnessType()
{ {
nameI18 = ""; nameI18 = "";
angularSize = -1;
brightnessClass = -1;
} }
Nebula::~Nebula() Nebula::~Nebula()
{ {
} }
QString Nebula::getInfoString(const StelCore *core, const InfoStringGroup& flags) const QString Nebula::getInfoString(const StelCore *core, const InfoStringGroup& flags) const
{ {
QString str; QString str;
QTextStream oss(&str); QTextStream oss(&str);
double az_app, alt_app;
StelUtils::rectToSphe(&az_app,&alt_app,getAltAzPosApparent(core));
Q_UNUSED(az_app);
if ((flags&Name) || (flags&CatalogNumber)) if ((flags&Name) || (flags&CatalogNumber))
oss << "<h2>"; oss << "<h2>";
if (nameI18!="" && flags&Name) if (!nameI18.isEmpty() && flags&Name)
{ {
oss << getNameI18n(); oss << getNameI18n();
} }
if (flags&CatalogNumber) if (flags&CatalogNumber)
{ {
if (nameI18!="" && flags&Name)
oss << " (";
QStringList catIds; QStringList catIds;
if ((M_nb > 0) && (M_nb < 111)) if (M_nb > 0)
catIds << QString("M %1").arg(M_nb); catIds << QString("M %1").arg(M_nb);
if ((C_nb > 0) && (C_nb < 110)) if (C_nb > 0)
catIds << QString("C %1").arg(C_nb); catIds << QString("C %1").arg(C_nb);
if (NGC_nb > 0) if (NGC_nb > 0)
catIds << QString("NGC %1").arg(NGC_nb); catIds << QString("NGC %1").arg(NGC_nb);
if (IC_nb > 0) if (IC_nb > 0)
catIds << QString("IC %1").arg(IC_nb); catIds << QString("IC %1").arg(IC_nb);
if ((B_nb > 0) && (B_nb <= 370)) if (B_nb > 0)
catIds << QString("B %1").arg(B_nb); catIds << QString("B %1").arg(B_nb);
if ((Sh2_nb > 0) && (Sh2_nb <= 313)) if (Sh2_nb > 0)
catIds << QString("Sh 2-%1").arg(Sh2_nb); catIds << QString("Sh 2-%1").arg(Sh2_nb);
if ((VdB_nb > 0) && (VdB_nb <= 158)) if (VdB_nb > 0)
catIds << QString("VdB %1").arg(VdB_nb); catIds << QString("VdB %1").arg(VdB_nb);
if ((RCW_nb > 0) && (RCW_nb <= 182)) if (RCW_nb > 0)
catIds << QString("RCW %1").arg(RCW_nb); catIds << QString("RCW %1").arg(RCW_nb);
if ((LDN_nb > 0) && (LDN_nb <= 1802)) if (LDN_nb > 0)
catIds << QString("LDN %1").arg(LDN_nb); catIds << QString("LDN %1").arg(LDN_nb);
if ((LBN_nb > 0) && (LBN_nb <= 1125)) if (LBN_nb > 0)
catIds << QString("LBN %1").arg(LBN_nb); catIds << QString("LBN %1").arg(LBN_nb);
if ((Cr_nb > 0) && (Cr_nb <= 471)) if (Cr_nb > 0)
catIds << QString("Cr %1").arg(Cr_nb); catIds << QString("Cr %1").arg(Cr_nb);
if ((Mel_nb > 0) && (Mel_nb <= 245)) if (Mel_nb > 0)
catIds << QString("Mel %1").arg(Mel_nb); catIds << QString("Mel %1").arg(Mel_nb);
oss << catIds.join(" - "); if (PGC_nb > 0)
catIds << QString("PGC %1").arg(PGC_nb);
if (UGC_nb > 0)
catIds << QString("UGC %1").arg(UGC_nb);
if (!Ced_nb.isEmpty())
catIds << QString("Ced %1").arg(Ced_nb);
if (nameI18!="" && flags&Name) if (!nameI18.isEmpty() && !catIds.isEmpty() && flags&Name)
oss << ")"; oss << "<br>";
oss << catIds.join(" - ");
} }
if ((flags&Name) || (flags&CatalogNumber)) if ((flags&Name) || (flags&CatalogNumber))
oss << "</h2>"; oss << "</h2>";
if (flags&ObjectType) if (flags&ObjectType)
oss << q_("Type: <b>%1</b>").arg(getTypeString()) << "<br>"; {
QString mt = getMorphologicalTypeString();
if (mt.isEmpty())
oss << q_("Type: <b>%1</b>").arg(getTypeString()) <<
"<br>";
else
oss << q_("Type: <b>%1</b> (%2)").arg(getTypeString(
)).arg(mt) << "<br>";
}
if (mag < 50 && flags&Magnitude) if (vMag < 50.f && flags&Magnitude)
{ {
if (nType == NebDn) if (nType == NebDn)
{ {
oss << q_("Opacity: <b>%1</b>").arg(getVMagnitude(co re), 0, 'f', 2) << "<br>"; oss << q_("Opacity: <b>%1</b>").arg(getVMagnitude(co re), 0, 'f', 2) << "<br>";
} }
else else
{ {
if (core->getSkyDrawer()->getFlagHasAtmosphere()) if (core->getSkyDrawer()->getFlagHasAtmosphere() && (alt_app>-3.0*M_PI/180.0)) // Don't show extincted magnitude much below hor izon where model is meaningless.
oss << q_("Magnitude: <b>%1</b> (extincted t o: <b>%2</b>)").arg(QString::number(getVMagnitude(core), 'f', 2), oss << q_("Magnitude: <b>%1</b> (extincted t o: <b>%2</b>)").arg(QString::number(getVMagnitude(core), 'f', 2),
QString::number(getVMagnitudeWithExtinction(core), 'f', 2)) << "<br>"; QString::number(getVMagnitudeWithExtinction(core), 'f', 2)) << "<br>";
else else
oss << q_("Magnitude: <b>%1</b>").arg(getVMa gnitude(core), 0, 'f', 2) << "<br>"; oss << q_("Magnitude: <b>%1</b>").arg(getVMa gnitude(core), 0, 'f', 2) << "<br>";
} }
} }
if (nType != NebDn && mag < 50 && flags&Extra) if (bMag < 50.f && vMag > 50.f && flags&Magnitude)
{ {
if (core->getSkyDrawer()->getFlagHasAtmosphere()) oss << q_("Magnitude: <b>%1</b>").arg(bMag, 0, 'f', 2)
<< q_(" (Photometric system: B)")
<< "<br>";
}
if (flags&Extra)
{
if (vMag < 50 && bMag < 50)
oss << q_("Color Index (B-V): <b>%1</b>").arg(QStrin
g::number(bMag-vMag, 'f', 2)) << "<br>";
}
if (nType != NebDn && vMag < 50 && flags&Extra)
{
if (core->getSkyDrawer()->getFlagHasAtmosphere() && (alt_app
>-3.0*M_PI/180.0)) // Don't show extincted surface brightness much below ho
rizon where model is meaningless.
{ {
if (getSurfaceBrightness(core)<99 && getSurfaceBrigh tnessWithExtinction(core)<99) if (getSurfaceBrightness(core)<99 && getSurfaceBrigh tnessWithExtinction(core)<99)
oss << q_("Surface brightness: <b>%1</b> (ex tincted to: <b>%2</b>)").arg(QString::number(getSurfaceBrightness(core), 'f ', 2), oss << q_("Surface brightness: <b>%1</b> (ex tincted to: <b>%2</b>)").arg(QString::number(getSurfaceBrightness(core), 'f ', 2),
QString::number(getSurfaceBrightnessWithExtinc tion(core), 'f', 2)) << "<br>"; QString::number(getSurfaceBrightnessWithExtinc tion(core), 'f', 2)) << "<br>";
} }
else else
{ {
if (getSurfaceBrightness(core)<99) if (getSurfaceBrightness(core)<99)
oss << q_("Surface brightness: <b>%1</b>").a rg(QString::number(getSurfaceBrightness(core), 'f', 2)) << "<br>"; oss << q_("Surface brightness: <b>%1</b>").a rg(QString::number(getSurfaceBrightness(core), 'f', 2)) << "<br>";
} }
} }
if (flags&Extra)
oss << getPositionInfoString(core, flags);
if (majorAxisSize>0 && flags&Size)
{
if (majorAxisSize==minorAxisSize || minorAxisSize==0.f)
oss << q_("Size: %1").arg(StelUtils::radToDmsStr(maj
orAxisSize*M_PI/180.)) << "<br>";
else
{
oss << q_("Size: %1 x %2").arg(StelUtils::radToDmsSt
r(majorAxisSize*M_PI/180.)).arg(StelUtils::radToDmsStr(minorAxisSize*M_PI/1
80.)) << "<br>";
if (orientationAngle>0.f)
oss << q_("Orientation angle: %1%2").arg(ori
entationAngle).arg(QChar(0x00B0)) << "<br>";
}
}
if (flags&Distance)
{ {
if (nType==NebHII) if (parallax!=0.f)
{ {
if (LBN_nb!=0) QString dx;
oss << q_("Brightness: %1").arg(brightnessCl // distance in light years from parallax
ass) << "<br>"; float distance = 3.162e-5/(qAbs(parallax)*4.848e-9);
float distanceErr = 0.f;
if (parallaxErr>0.f)
distanceErr = 3.162e-5/(qAbs(parallaxErr)*4.
848e-9);
if (distanceErr>0.f)
dx = QString("%1%2%3").arg(QString::number(d
istance, 'f', 3)).arg(QChar(0x00B1)).arg(QString::number(distanceErr, 'f',
3));
else else
dx = QString("%1").arg(QString::number(dista
nce, 'f', 3));
if (oDistance==0.f)
{ {
oss << qc_("Form: %1","HII Region").arg(getH //TRANSLATORS: Unit of measure for distance
IIFormTypeString()) << "<br>"; - Light Years
oss << qc_("Structure: %1","HII Region").arg oss << q_("Distance: %1 ly").arg(dx) << "<br
(getHIIStructureTypeString()) << "<br>"; >";
oss << q_("Brightness: %1").arg(getHIIBright
nessTypeString()) << "<br>";
} }
} }
if (nType==NebHa)
if (oDistance>0.f)
{ {
oss << q_("Brightness: %1").arg(getHaBrightnessTypeS QString dx, du;
tring()) << "<br>"; if (oDistanceErr>0.f)
dx = QString("%1%2%3").arg(QString::number(o
Distance, 'f', 3)).arg(QChar(0x00B1)).arg(QString::number(oDistanceErr, 'f'
, 3));
else
dx = QString("%1").arg(QString::number(oDist
ance, 'f', 3));
if (nType==NebAGx || nType==NebGx || nType==NebRGx |
| nType==NebIGx || nType==NebQSO || nType==NebISM)
{
//TRANSLATORS: Unit of measure for distance
- megaparsecs
du = q_("Mpc");
}
else
{
//TRANSLATORS: Unit of measure for distance
- kiloparsecs
du = q_("kpc");
}
oss << q_("Distance: %1 %2").arg(dx).arg(du) << "<br
>";
} }
} }
oss << getPositionInfoString(core, flags);
if (angularSize>0 && flags&Size) if (flags&Extra)
oss << q_("Size: %1").arg(StelUtils::radToDmsStr(angularSize {
*M_PI/180.)) << "<br>"; if (redshift<99.f)
{
QString z;
if (redshiftErr>0.f)
z = QString("%1%2%3").arg(QString::number(re
dshift, 'f', 6)).arg(QChar(0x00B1)).arg(QString::number(redshiftErr, 'f', 6
));
else
z = QString("%1").arg(QString::number(redshi
ft, 'f', 6));
oss << q_("Redshift: %1").arg(z) << "<br>";
}
if (parallax!=0.f)
{
QString px;
if (parallaxErr>0.f)
px = QString("%1%2%3").arg(QString::number(q
Abs(parallax)*0.001, 'f', 5)).arg(QChar(0x00B1)).arg(QString::number(parall
axErr*0.001, 'f', 5));
else
px = QString("%1").arg(QString::number(qAbs(
parallax)*0.001, 'f', 5));
oss << q_("Parallax: %1\"").arg(px) << "<br>";
}
if (!getMorphologicalTypeDescription().isEmpty())
oss << q_("Morphological description: ") << getMorph
ologicalTypeDescription() << ".<br>";
}
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
float Nebula::getVMagnitude(const StelCore* core) const float Nebula::getVMagnitude(const StelCore* core) const
{ {
Q_UNUSED(core); Q_UNUSED(core);
return mag; return vMag;
}
double Nebula::getAngularSize(const StelCore *) const
{
float size = majorAxisSize;
if (majorAxisSize!=minorAxisSize || minorAxisSize>0)
size = (majorAxisSize+minorAxisSize)/2.f;
return size*0.5f;
} }
float Nebula::getSelectPriority(const StelCore* core) const float Nebula::getSelectPriority(const StelCore* core) const
{ {
const NebulaMgr* nebMgr = ((NebulaMgr*)StelApp::getInstance().getMod uleMgr().getModule("NebulaMgr")); const NebulaMgr* nebMgr = ((NebulaMgr*)StelApp::getInstance().getMod uleMgr().getModule("NebulaMgr"));
// minimize unwanted selection of the deep-sky objects
if (!nebMgr->getFlagHints()) if (!nebMgr->getFlagHints())
return StelObject::getSelectPriority(core)-2.f; return StelObject::getSelectPriority(core)+3.f;
if (!objectInDisplayedType())
return StelObject::getSelectPriority(core)+3.f;
const float maxMagHint = nebMgr->computeMaxMagHint(core->getSkyDrawe r()); const float maxMagHint = nebMgr->computeMaxMagHint(core->getSkyDrawe r());
// make very easy to select if labeled // make very easy to select if labeled
float lim=getVMagnitude(core); float lim, mag;
lim = mag = getVMagnitude(core);
if (surfaceBrightnessUsage)
lim = mag = getSurfaceBrightness(core);
if (nType==NebDn) if (nType==NebDn)
lim=15.0f - mag - 2.0f*angularSize; // Note that "mag" field lim=15.0f - mag - 2.0f*qMin(1.5f, majorAxisSize); // Note th
is used for opacity in this catalog! at "mag" field is used for opacity in this catalog!
else if (nType==NebHII) else if (nType==NebHII) // Sharpless and LBN
lim=10.0f - 2.0f*angularSize; // Unfortunately, in Sh catalo lim=10.0f - 2.0f*qMin(1.5f, majorAxisSize); // Unfortunately
g, we always have mag=99=unknown! , in Sh catalog, we always have mag=99=unknown!
if (std::min(15.f, lim)<maxMagHint) if (std::min(15.f, lim)<maxMagHint)
return -10.f; return -10.f;
else else
return StelObject::getSelectPriority(core)-2.f; return StelObject::getSelectPriority(core)-2.f;
} }
Vec3f Nebula::getInfoColor(void) const Vec3f Nebula::getInfoColor(void) const
{ {
return ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule( "NebulaMgr"))->getLabelsColor(); return ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule( "NebulaMgr"))->getLabelsColor();
} }
double Nebula::getCloseViewFov(const StelCore*) const double Nebula::getCloseViewFov(const StelCore*) const
{ {
return angularSize>0 ? angularSize * 4 : 1; return majorAxisSize>0 ? majorAxisSize * 4 : 1;
} }
float Nebula::getSurfaceBrightness(const StelCore* core) const float Nebula::getSurfaceBrightness(const StelCore* core) const
{ {
if (getVMagnitude(core)<99 && angularSize>0 && nType!=NebDn && nType if (getVMagnitude(core)<99.f && majorAxisSize>0 && nType!=NebDn)
!=NebHII) return getVMagnitude(core) + 2.5*log10(getSurfaceArea()*3600
return getVMagnitude(core) + 2.5*log10(M_PI*pow((angularSize .f);
*M_PI/180.)*1800,2));
else else
return 99; return 99.f;
} }
float Nebula::getSurfaceBrightnessWithExtinction(const StelCore* core) cons t float Nebula::getSurfaceBrightnessWithExtinction(const StelCore* core) cons t
{ {
if (getVMagnitudeWithExtinction(core)<99 && angularSize>0 && nType!= if (getVMagnitudeWithExtinction(core)<99.f && majorAxisSize>0 && nTy
NebDn && nType!=NebHII) pe!=NebDn)
return getVMagnitudeWithExtinction(core) + 2.5*log10(M_PI*po return getVMagnitudeWithExtinction(core) + 2.5*log10(getSurf
w((angularSize*M_PI/180.)*1800,2)); aceArea()*3600.f);
else else
return 99; return 99.f;
}
float Nebula::getSurfaceArea(void) const
{
if (majorAxisSize==minorAxisSize || minorAxisSize==0)
return M_PI*(majorAxisSize/2.f)*(majorAxisSize/2.f); // S =
pi*R^2 = pi*(D/2)^2
else
return M_PI*(majorAxisSize/2.f)*(minorAxisSize/2.f); // S =
pi*a*b
} }
void Nebula::drawHints(StelPainter& sPainter, float maxMagHints) void Nebula::drawHints(StelPainter& sPainter, float maxMagHints)
{ {
float lim = mag; StelCore* core = StelApp::getInstance().getCore();
if (lim > 50) lim = 15.f; float lim = qMin(vMag, bMag);
// temporary workaround of this bug: https://bugs.launchpad.net/stel if (surfaceBrightnessUsage)
larium/+bug/1115035 --AW
if (getEnglishName().contains("Pleiades"))
lim = 5.f;
// Dark nebulae. Not sure how to assess visibility from opacity? --G
Z
if (nType==NebDn)
{ {
// GZ: ad-hoc visibility formula: assuming good visibility i lim = getSurfaceBrightness(core) - 3.f;
f objects of mag9 are visible, "usual" opacity 5 and size 30', better visib if (lim > 50) lim = 16.f;
ility (discernability) comes with higher opacity and larger size,
// 9-(opac-5)-2*(angularSize-0.5)
if (angularSize>0 && mag<50)
lim = 15.0f - mag - 2.0f*angularSize;
else
lim = 9.0f;
} }
else if (nType==NebHII || nType==NebHa) else
{ // artificially increase visibility of (most) Sharpless objects? N {
o magnitude recorded:-( float mag = getVMagnitude(core);
lim=9.0f; if (lim > 50) lim = 15.f;
// Dark nebulae. Not sure how to assess visibility from opac
ity? --GZ
if (nType==NebDn)
{
// GZ: ad-hoc visibility formula: assuming good visi
bility if objects of mag9 are visible, "usual" opacity 5 and size 30', bett
er visibility (discernability) comes with higher opacity and larger size,
// 9-(opac-5)-2*(angularSize-0.5)
// GZ Not good for non-Barnards. weak opacity and la
rge surface are antagonists. (some LDN are huge, but opacity 2 is not much
to discern).
// The qMin() maximized the visibility gain for larg
e objects.
if (majorAxisSize>0 && mag<50)
lim = 15.0f - mag - 2.0f*qMin(majorAxisSize,
1.5f);
else if (B_nb>0)
lim = 9.0f;
else
lim= 12.0f; // GZ I assume LDN objects are r
ather elusive.
}
else if (nType==NebHII) // NebHII={Sharpless, LBN, RCW}
{ // artificially increase visibility of (most) Sharpless ob
jects? No magnitude recorded:-(
lim=9.0f;
}
} }
if (lim>maxMagHints) if (lim>maxMagHints)
return; return;
Vec3d win; Vec3d win;
// Check visibility of DSO hints // Check visibility of DSO hints
if (!(sPainter.getProjector()->projectCheck(XYZ, win))) if (!(sPainter.getProjector()->projectCheck(XYZ, win)))
return; return;
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8; float lum = 1.f;//qMin(1,4.f/getOnScreenSize(core))*0.8;
Vec3f col(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hin tsBrightness, circleColor[2]*lum*hintsBrightness);
sPainter.setColor(col[0], col[1], col[2], 1); Vec3f color=circleColor;
switch (nType) switch (nType)
{ {
case NebGx: case NebGx:
Nebula::texGalaxy->bind(); Nebula::texGalaxy->bind();
color=galaxyColor;
break;
case NebIGx:
Nebula::texGalaxy->bind();
color=interactingGalaxyColor;
break;
case NebAGx:
Nebula::texGalaxy->bind();
color=activeGalaxyColor;
break;
case NebQSO:
case NebPossQSO:
case NebBLL:
case NebBLA:
Nebula::texGalaxy->bind();
break;
case NebRGx:
Nebula::texGalaxy->bind();
color=radioGalaxyColor;
break; break;
case NebOc: case NebOc:
case NebSA:
case NebSC:
case NebCl:
Nebula::texOpenCluster->bind(); Nebula::texOpenCluster->bind();
color=clusterColor;
break; break;
case NebGc: case NebGc:
Nebula::texGlobularCluster->bind(); Nebula::texGlobularCluster->bind();
color=clusterColor;
break; break;
case NebN: case NebN:
case NebHII: case NebHII:
case NebMolCld:
case NebYSO:
Nebula::texDiffuseNebula->bind();
color=hydrogenRegionColor;
break;
case NebRn: case NebRn:
case NebSNR:
Nebula::texDiffuseNebula->bind(); Nebula::texDiffuseNebula->bind();
color=supernovaRemnantColor;
break;
case NebBn:
case NebEn:
Nebula::texDiffuseNebula->bind();
color=brightNebulaColor;
break; break;
case NebPn: case NebPn:
case NebPossPN:
case NebPPN:
Nebula::texPlanetaryNebula->bind(); Nebula::texPlanetaryNebula->bind();
color=brightNebulaColor;
break; break;
case NebDn: case NebDn:
Nebula::texDarkNebula->bind(); Nebula::texDarkNebula->bind();
color=darkNebulaColor;
break; break;
case NebCn: case NebCn:
Nebula::texOpenClusterWithNebulosity->bind(); Nebula::texOpenClusterWithNebulosity->bind();
color=clusterColor;
break; break;
default: default:
Nebula::texCircle->bind(); Nebula::texCircle->bind();
} }
if (drawHintProportional) Vec3f col(color[0]*lum*hintsBrightness, color[1]*lum*hintsBrightness
, color[2]*lum*hintsBrightness);
if (!objectInDisplayedType())
col = Vec3f(0.f,0.f,0.f);
sPainter.setColor(col[0], col[1], col[2], 1);
//Q_ASSERT(majorAxisSize>0.); // THIS ASSERT FAILS. Catalog error?
if (drawHintProportional && (majorAxisSize>0.))
{ {
float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProj float size = majorAxisSize *0.5 *M_PI/180.*sPainter.getProje
ector()->getPixelPerRadAtCenter(); ctor()->getPixelPerRadAtCenter();
sPainter.drawSprite2dMode(XY[0], XY[1], qMax(6.0f,size)); // Rotation looks good only for galaxies.
if ((nType <=NebQSO) || (nType==NebBLA) || (nType==NebBLL) )
{
// The rotation angle in drawSprite2dMode() is relat
ive to screen. Make sure to compute correct angle from 90+orientationAngle.
// Find an on-screen direction vector from a point o
ffset somewhat in declination from our object.
Vec3d XYZrel(XYZ);
XYZrel[2]*=0.99;
Vec3d XYrel;
sPainter.getProjector()->project(XYZrel, XYrel);
float screenAngle=atan2(XYrel[1]-XY[1], XYrel[0]-XY[
0]);
sPainter.drawSprite2dMode(XY[0], XY[1], qMax(6.0f,si
ze), screenAngle*180./M_PI + orientationAngle);
}
else // no galaxy
sPainter.drawSprite2dMode(XY[0], XY[1], qMax(6.0f,si
ze));
} }
else else // not proportional or size unknown
sPainter.drawSprite2dMode(XY[0], XY[1], 6.0f); sPainter.drawSprite2dMode(XY[0], XY[1], 6.0f);
} }
void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel) void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel)
{ {
float lim = mag; StelCore* core = StelApp::getInstance().getCore();
if (lim > 50) lim = 15.f;
// temporary workaround of this bug: https://bugs.launchpad.net/stel float lim = qMin(vMag, bMag);
larium/+bug/1115035 --AW
if (getEnglishName().contains("Pleiades")) if (surfaceBrightnessUsage)
lim = 5.f;
// Dark nebulae. Not sure how to assess visibility from opacity? --G
Z
if (nType==NebDn)
{ {
// GZ: ad-hoc visibility formula: assuming good visibility i lim = getSurfaceBrightness(core) - 3.f;
f objects of mag9 are visible, "usual" opacity 5 and size 30', better visib if (lim > 50) lim = 16.f;
ility (discernability) comes with higher opacity and larger size,
// 9-(opac-5)-2*(angularSize-0.5)
if (angularSize>0 && mag<50)
lim = 15.0f - mag - 2.0f*angularSize;
else
lim = 9.0f;
} }
else if (nType==NebHII || nType==NebHa) else
lim=9.0f; {
float mag = getVMagnitude(core);
if (lim > 50) lim = 15.f;
// Dark nebulae. Not sure how to assess visibility from opac
ity? --GZ
if (nType==NebDn)
{
// GZ: ad-hoc visibility formula: assuming good visi
bility if objects of mag9 are visible, "usual" opacity 5 and size 30', bett
er visibility (discernability) comes with higher opacity and larger size,
// 9-(opac-5)-2*(angularSize-0.5)
if (majorAxisSize>0 && mag<50)
lim = 15.0f - mag - 2.0f*qMin(majorAxisSize,
2.5f);
else if (B_nb>0)
lim = 9.0f;
else
lim= 12.0f; // GZ I assume some LDN objects
are rather elusive.
}
else if (nType==NebHII)
lim=9.0f;
}
if (lim>maxMagLabel) if (lim>maxMagLabel)
return; return;
Vec3d win; Vec3d win;
// Check visibility of DSO labels // Check visibility of DSO labels
if (!(sPainter.getProjector()->projectCheck(XYZ, win))) if (!(sPainter.getProjector()->projectCheck(XYZ, win)))
return; return;
Vec3f col(labelColor[0], labelColor[1], labelColor[2]); Vec3f col(labelColor[0], labelColor[1], labelColor[2]);
if (objectInDisplayedType())
sPainter.setColor(col[0], col[1], col[2], hintsBrightness);
else
sPainter.setColor(col[0], col[1], col[2], 0.f);
sPainter.setColor(col[0], col[1], col[2], hintsBrightness);
float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()- >getPixelPerRadAtCenter(); float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()- >getPixelPerRadAtCenter();
float shift = 4.f + (drawHintProportional ? size : size/1.8f); float shift = 4.f + (drawHintProportional ? size : size/1.8f);
QString str;
if (!nameI18.isEmpty()) QString str = getNameI18n();
str = getNameI18n(); if (str.isEmpty())
else
{ {
// On screen label: one only, priority as given here. NGC sh // On screen label: one only, priority as given here.
ould win over Sharpless. (GZ) if (catalogFilters&CatM && M_nb>0)
if (M_nb > 0)
str = QString("M %1").arg(M_nb); str = QString("M %1").arg(M_nb);
else if (C_nb > 0) else if (catalogFilters&CatC && C_nb>0)
str = QString("C %1").arg(C_nb); str = QString("C %1").arg(C_nb);
else if (NGC_nb > 0) else if (catalogFilters&CatNGC && NGC_nb>0)
str = QString("NGC %1").arg(NGC_nb); str = QString("NGC %1").arg(NGC_nb);
else if (IC_nb > 0) else if (catalogFilters&CatIC && IC_nb>0)
str = QString("IC %1").arg(IC_nb); str = QString("IC %1").arg(IC_nb);
else if (B_nb > 0) else if (catalogFilters&CatB && B_nb>0)
str = QString("B %1").arg(B_nb); str = QString("B %1").arg(B_nb);
else if (Sh2_nb > 0) else if (catalogFilters&CatSh2 && Sh2_nb>0)
str = QString("Sh 2-%1").arg(Sh2_nb); str = QString("Sh 2-%1").arg(Sh2_nb);
else if (VdB_nb > 0) else if (catalogFilters&CatVdB && VdB_nb>0)
str = QString("VdB %1").arg(VdB_nb); str = QString("VdB %1").arg(VdB_nb);
else if (RCW_nb > 0) else if (catalogFilters&CatRCW && RCW_nb>0)
str = QString("RCW %1").arg(RCW_nb); str = QString("RCW %1").arg(RCW_nb);
else if (LDN_nb > 0) else if (catalogFilters&CatLDN && LDN_nb>0)
str = QString("LDN %1").arg(LDN_nb); str = QString("LDN %1").arg(LDN_nb);
else if (LBN_nb > 0) else if (catalogFilters&CatLBN && LBN_nb > 0)
str = QString("LBN %1").arg(LBN_nb); str = QString("LBN %1").arg(LBN_nb);
else if (Cr_nb > 0) else if (catalogFilters&CatCr && Cr_nb > 0)
str = QString("Cr %1").arg(Cr_nb); str = QString("Cr %1").arg(Cr_nb);
else if (Mel_nb > 0) else if (catalogFilters&CatMel && Mel_nb > 0)
str = QString("Mel %1").arg(Mel_nb); str = QString("Mel %1").arg(Mel_nb);
else if (catalogFilters&CatPGC && PGC_nb > 0)
str = QString("PGC %1").arg(PGC_nb);
else if (catalogFilters&CatUGC && UGC_nb > 0)
str = QString("UGC %1").arg(UGC_nb);
else if (catalogFilters&CatCed && !Ced_nb.isEmpty())
str = QString("Ced %1").arg(Ced_nb);
} }
sPainter.drawText(XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false); sPainter.drawText(XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
} }
void Nebula::readNGC(QDataStream& in) void Nebula::readDSO(QDataStream &in)
{ {
bool isIc; float ra, dec;
int nb; unsigned int oType;
float ra, dec;
unsigned int type; in >> DSO_nb >> ra >> dec >> bMag >> vMag >> oType >> mTypeStri
in >> isIc >> nb >> ra >> dec >> mag >> angularSize >> type; ng >> majorAxisSize >> minorAxisSize
if (isIc) >> orientationAngle >> redshift >> redshiftErr >> parallax >
{ > parallaxErr >> oDistance >> oDistanceErr
IC_nb = nb; >> NGC_nb >> IC_nb >> M_nb >> C_nb >> B_nb >> Sh2_nb >> VdB_
} nb >> RCW_nb >> LDN_nb >> LBN_nb >> Cr_nb
else >> Mel_nb >> PGC_nb >> UGC_nb >> Ced_nb;
{
NGC_nb = nb;
}
StelUtils::spheToRect(ra,dec,XYZ); StelUtils::spheToRect(ra,dec,XYZ);
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001); Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001);
nType = (Nebula::NebulaType)type; nType = (Nebula::NebulaType)oType;
//if (type >= 5) {
// qDebug()<< (isIc?"IC" : "NGC") << nb << " type " << type ;
//}
// This confirms there are currently no dark nebulae in the NGC list
.
Q_ASSERT(type!=5);
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial Pos(NULL))); pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial Pos(NULL)));
} }
#if 0 bool Nebula::objectInDisplayedType() const
QFile filess("filess.dat");
QDataStream out;
out.setVersion(QDataStream::Qt_4_5);
bool Nebula::readNGC(char *recordstr)
{ {
int rahr; if (!flagUsageTypeFilter)
float ramin; return true;
int dedeg;
float demin;
int nb;
sscanf(&recordstr[1],"%d",&nb);
if (recordstr[0] == 'I') bool r = false;
int cntype = -1;
switch (nType)
{ {
IC_nb = nb; case NebGx:
cntype = 0; // Galaxies
break;
case NebAGx:
case NebRGx:
case NebQSO:
case NebPossQSO:
case NebBLL:
case NebBLA:
cntype = 1; // Active Galaxies
break;
case NebIGx:
cntype = 2; // Interacting Galaxies
break;
case NebOc:
case NebGc:
case NebCl:
case NebSA:
case NebSC:
cntype = 3; // Star Clusters
break;
case NebHII:
case NebISM:
cntype = 4; // Hydrogen regions (include interstella
r matter)
break;
case NebN:
case NebBn:
case NebEn:
case NebRn:
cntype = 5; // Bright Nebulae
break;
case NebDn:
case NebMolCld:
case NebYSO:
cntype = 6; // Dark Nebulae
break;
case NebPn:
case NebPossPN:
case NebPPN:
cntype = 7; // Planetary Nebulae
break;
case NebSNR:
cntype = 8; // Supernova Remnants
break;
case NebCn:
cntype = 9;
break;
default:
cntype = 10;
break;
} }
if (typeFilters&TypeGalaxies && cntype==0)
r = true;
else if (typeFilters&TypeActiveGalaxies && cntype==1)
r = true;
else if (typeFilters&TypeInteractingGalaxies && cntype==2)
r = true;
else if (typeFilters&TypeStarClusters && cntype==3)
r = true;
else if (typeFilters&TypeHydrogenRegions && cntype==4)
r = true;
else if (typeFilters&TypeBrightNebulae && cntype==5)
r = true;
else if (typeFilters&TypeDarkNebulae && cntype==6)
r = true;
else if (typeFilters&TypePlanetaryNebulae && cntype==7)
r = true;
else if (typeFilters&TypeSupernovaRemnants && cntype==8)
r = true;
else if (typeFilters&TypeStarClusters && (typeFilters&TypeBrightNebu
lae || typeFilters&TypeHydrogenRegions) && cntype==9)
r = true;
else if (typeFilters&TypeOther && cntype==10)
r = true;
return r;
}
QString Nebula::getMorphologicalTypeString(void) const
{
return mTypeString;
}
QString Nebula::getMorphologicalTypeDescription(void) const
{
QString m, r = "";
QRegExp GlClRx("\\.*(I|II|III|IV|V|VI|VI|VII|VIII|IX|X|XI|XII)\\.*")
;
int idx = GlClRx.indexIn(mTypeString);
if (idx>0)
m = mTypeString.mid(idx);
else else
{ m = mTypeString;
NGC_nb = nb;
}
sscanf(&recordstr[12],"%d %f",&rahr, &ramin);
sscanf(&recordstr[22],"%d %f",&dedeg, &demin);
float RaRad = (double)rahr+ramin/60;
float DecRad = (float)dedeg+demin/60;
if (recordstr[21] == '-') DecRad *= -1.;
RaRad*=M_PI/12.; // Convert from hours to rad
DecRad*=M_PI/180.; // Convert from deg to rad
// Calc the Cartesian coord with RA and DE
StelUtils::spheToRect(RaRad,DecRad,XYZ);
sscanf(&recordstr[47],"%f",&mag);
if (mag < 1) mag = 99;
// Calc the angular size in radian : TODO this should be independant QStringList glclass;
of tex_angular_size glclass << "I" << "II" << "III" << "IV" << "V" << "VI" << "VII" << "
float size; VIII" << "IX" << "X" << "XI" << "XII";
sscanf(&recordstr[40],"%f",&size);
angularSize = size/60; if (GlClRx.exactMatch(m)) // Globular Clusters
if (angularSize<0)
angularSize=0;
// this is a huge performance drag if called every frame, so cache h
ere
if (!strncmp(&recordstr[8],"Gx",2)) { nType = NebGx;}
else if (!strncmp(&recordstr[8],"OC",2)) { nType = NebOc;}
else if (!strncmp(&recordstr[8],"Gb",2)) { nType = NebGc;}
else if (!strncmp(&recordstr[8],"Nb",2)) { nType = NebN;}
else if (!strncmp(&recordstr[8],"Pl",2)) { nType = NebPn;}
else if (!strncmp(&recordstr[8]," ",2)) { return false;}
else if (!strncmp(&recordstr[8]," -",2)) { return false;}
else if (!strncmp(&recordstr[8]," *",2)) { return false;}
else if (!strncmp(&recordstr[8],"D*",2)) { return false;}
else if (!strncmp(&recordstr[7],"***",3)) { return false;}
else if (!strncmp(&recordstr[7],"C+N",3)) { nType = NebCn;}
else if (!strncmp(&recordstr[8]," ?",2)) { nType = NebUnknown;}
else { nType = NebUnknown;}
if (!filess.isOpen())
{ {
filess.open(QIODevice::WriteOnly); switch(glclass.indexOf(GlClRx.capturedTexts().at(1).trimmed(
out.setDevice(&filess); )))
{
case 0:
r = qc_("high concentration of stars toward
the center", "Shapley–Sawyer Concentration Class");
break;
case 1:
r = qc_("dense central concentration of star
s", "Shapley–Sawyer Concentration Class");
break;
case 2:
r = qc_("strong inner core of stars", "Shapl
ey–Sawyer Concentration Class");
break;
case 3:
r = qc_("intermediate rich concentrations of
stars", "Shapley–Sawyer Concentration Class");
break;
case 4:
case 5:
case 6:
r = qc_("intermediate concentrations of star
s", "Shapley–Sawyer Concentration Class");
break;
case 7:
r = qc_("rather loosely concentration of sta
rs towards the center", "Shapley–Sawyer Concentration Class");
break;
case 8:
r = qc_("loose concentration of stars toward
s the center", "Shapley–Sawyer Concentration Class");
break;
case 9:
r = qc_("loose concentration of stars", "Sha
pley–Sawyer Concentration Class");
break;
case 10:
r = qc_("very loose concentration of stars t
owards the center", "Shapley–Sawyer Concentration Class");
break;
case 11:
r = qc_("almost no concentration towards the
center", "Shapley–Sawyer Concentration Class");
break;
default:
r = qc_("undocumented concentration class",
"Shapley–Sawyer Concentration Class");
break;
}
} }
out << ((bool)(recordstr[0] == 'I')) << nb << RaRad << DecRad << mag
<< angularSize << ((unsigned int)nType);
if (nb==5369 && recordstr[0] == 'I')
filess.close();
return true;
}
#endif
bool Nebula::readBarnard(QString record)
{
// Line Format: "<B>\t<RAh>\t<RAm>\t<RAs>\t[+-]DD MM\t<size>\t<obs>\
t<comment>... ..."
int rahr;
float ramin;
int dedeg;
int demin;
QStringList list=record.split("\t", QString::KeepEmptyParts);
//qDebug() << "Barnard: " << list.at(0) << "RA " << list.at(1) << li QRegExp OClRx("\\.*(I|II|III|IV)(\\d)(p|m|r)(n*)\\.*");
st.at(2) << list.at(3) << idx = OClRx.indexIn(mTypeString);
// "Dec" << list.at(4) << "opac" << list.at(6) << "size" << if (idx>0)
list.at(5); m = mTypeString.mid(idx);
else
B_nb=list.at(0).toInt(); m = mTypeString;
rahr=list.at(1).toInt();
ramin=list.at(2).toInt() + list.at(3).toInt() / 60.0f;
float RaRad = (double)rahr+ramin/60;
QString degString=list.at(4);
dedeg=degString.mid(1,2).toInt();
demin=degString.mid(4,2).toInt();
float DecRad = (float)dedeg+(float)demin/60.0f;
if (degString.at(0) == '-') DecRad *= -1.f;
RaRad*=M_PI/12.f; // Convert from hours to rad
DecRad*=M_PI/180.f; // Convert from deg to rad
// Calc the Cartesian coord with RA and DE
StelUtils::spheToRect(RaRad,DecRad,XYZ);
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001);
// "mag" will receive opacity for dark nebulae.
QString opacityStr=list.at(6);
if (opacityStr.contains('?')) mag=99;
else mag=opacityStr.toFloat();
// Calc the angular size in degrees
float size=list.at(5).toFloat();
angularSize = size/60.0f;
// Barnard are dark nebulae only, so at least type is easy:
nType=NebDn;
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial
Pos(NULL)));
// // Dark nebulae. Not sure how to assess visibility from opacity and
size? --GZ
// float lim;
// // GZ: ad-hoc visibility formula: assuming good visibility if object
s of mag9 are visible, "usual" opacity 5 and size 30', better visibility (d
iscernability) comes with higher opacity and larger size,
// // 9-(opac-5)-2*(angularSize-0.5)
// if (angularSize>0 && mag<50)
// lim = 15.0f - mag - 2.0f*angularSize;
// else
// lim = 9.0f;
// qDebug() << "LIMIT:" << angularSize << "*" << mag << "=" << lim;
return true;
}
bool Nebula::readSharpless(QString record)
{
QStringList list=record.split("\t", QString::KeepEmptyParts);
//qDebug() << "RA:" << list.at(0) << " DE:" << list.at(1) << " Sh2:"
<< list.at(2) << " size:" << list.at(3) << " F:" << list.at(4) << " S:" <<
list.at(5) << " B:" << list.at(6);
float radeg=list.at(0).toFloat();
float dedeg=list.at(1).toFloat();
Sh2_nb=list.at(2).toInt();
float RaRad=radeg*M_PI/180.f; // Convert from degrees to rad
float DecRad=dedeg*M_PI/180.f; // Convert from degrees to rad
// Calc the Cartesian coord with RA and DE
StelUtils::spheToRect(RaRad,DecRad,XYZ);
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001);
mag=99.0f;
// Calc the angular size in degrees
int size=list.at(3).toFloat();
angularSize = size/60.0f;
formType = (Nebula::HIIFormType)list.at(4).toInt();
structureType = (Nebula::HIIStructureType)list.at(5).toInt();
brightnessType = (Nebula::HIIBrightnessType)list.at(6).toInt();
nType=NebHII;
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial
Pos(NULL)));
return true;
}
bool Nebula::readVandenBergh(QString record)
{
QStringList list=record.split("\t", QString::KeepEmptyParts);
VdB_nb=list.at(0).toInt();
mag = list.at(1).toFloat();
if (mag==0.0f)
mag=99.0f;
// Calc the angular size in degrees
float size=list.at(2).toFloat();
angularSize = size/60.0f;
float radeg=list.at(3).toFloat();
float dedeg=list.at(4).toFloat();
float RaRad=radeg*M_PI/180.f; // Convert from degrees to rad
float DecRad=dedeg*M_PI/180.f; // Convert from degrees to rad
// Calc the Cartesian coord with RA and DE
StelUtils::spheToRect(RaRad,DecRad,XYZ);
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001);
nType=NebRn;
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial
Pos(NULL)));
return true;
}
bool Nebula::readRCW(QString record)
{
QStringList list=record.split("\t", QString::KeepEmptyParts);
float radeg=list.at(0).toFloat();
float dedeg=list.at(1).toFloat();
RCW_nb=list.at(2).toInt();
mag = 99.;
// Calc the angular size in degrees
float size=list.at(3).toFloat();
angularSize = size/60.0f;
if (angularSize<0)
angularSize=0;
rcwBrightnessType = (Nebula::HaBrightnessType)list.at(5).toInt();
float RaRad=radeg*M_PI/180.f; // Convert from degrees to rad
float DecRad=dedeg*M_PI/180.f; // Convert from degrees to rad
// Calc the Cartesian coord with RA and DE
StelUtils::spheToRect(RaRad,DecRad,XYZ);
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001);
nType=NebHa;
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial
Pos(NULL)));
return true;
}
bool Nebula::readLDN(QString record)
{
QStringList list=record.split("\t", QString::KeepEmptyParts);
float radeg=list.at(0).toFloat();
float dedeg=list.at(1).toFloat();
LDN_nb=list.at(2).toInt();
// Area in square degrees
angularSize = list.at(3).toFloat();
if (angularSize<0)
angularSize=0;
mag = list.at(4).toInt();
float RaRad=radeg*M_PI/180.f; // Convert from degrees to rad
float DecRad=dedeg*M_PI/180.f; // Convert from degrees to rad
// Calc the Cartesian coord with RA and DE
StelUtils::spheToRect(RaRad,DecRad,XYZ);
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001);
nType=NebDn;
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial
Pos(NULL)));
return true;
}
bool Nebula::readLBN(QString record)
{
QStringList list=record.split("\t", QString::KeepEmptyParts);
float radeg=list.at(0).toFloat();
float dedeg=list.at(1).toFloat();
LBN_nb=list.at(2).toInt(); if (OClRx.exactMatch(m)) // Open Clusters
{
QStringList occlass, ocrich, rtxt;
occlass << "I" << "II" << "III" << "IV";
ocrich << "p" << "m" << "r";
switch(occlass.indexOf(OClRx.capturedTexts().at(1).trimmed()
))
{
case 0:
rtxt << qc_("strong central concentration of
stars", "Trumpler's Concentration Class");
break;
case 1:
rtxt << qc_("little central concentration of
stars", "Trumpler's Concentration Class");
break;
case 2:
rtxt << qc_("no noticeable concentration of
stars", "Trumpler's Concentration Class");
break;
case 3:
rtxt << qc_("a star field condensation", "Tr
umpler's Concentration Class");
break;
default:
rtxt << qc_("undocumented concentration clas
s", "Trumpler's Concentration Class");
break;
}
switch(OClRx.capturedTexts().at(2).toInt())
{
case 1:
rtxt << qc_("small brightness range of clust
er members", "Trumpler's Brightness Class");
break;
case 2:
rtxt << qc_("medium brightness range of clus
ter members", "Trumpler's Brightness Class");
break;
case 3:
rtxt << qc_("large brightness range of clust
er members", "Trumpler's Brightness Class");
break;
default:
rtxt << qc_("undocumented brightness range o
f cluster members", "Trumpler's Brightness Class");
break;
}
switch(ocrich.indexOf(OClRx.capturedTexts().at(3).trimmed())
)
{
case 0:
rtxt << qc_("poor cluster with less than 50
stars", "Trumpler's Number of Members Class");
break;
case 1:
rtxt << qc_("moderately rich cluster with 50
-100 stars", "Trumpler's Number of Members Class");
break;
case 2:
rtxt << qc_("rich cluster with more than 100
stars", "Trumpler's Number of Members Class");
break;
default:
rtxt << qc_("undocumented number of members
class", "Trumpler's Number of Members Class");
break;
}
if (!OClRx.capturedTexts().at(4).trimmed().isEmpty())
rtxt << qc_("the cluster lies within nebulosity", "n
ebulosity factor of open clusters");
// Area in square degrees r = rtxt.join(",<br>");
angularSize = list.at(3).toFloat()/60.f; }
if (angularSize<0)
angularSize=0;
brightnessClass = list.at(4).toInt(); QRegExp VdBRx("\\.*(I|II|I-II|II P|P),\\s+(VBR|VB|BR|M|F|VF|:)\\.*")
;
idx = VdBRx.indexIn(mTypeString);
if (idx>0)
m = mTypeString.mid(idx);
else
m = mTypeString;
float RaRad=radeg*M_PI/180.f; // Convert from degrees to rad if (VdBRx.exactMatch(m)) // Reflection Nebulae
float DecRad=dedeg*M_PI/180.f; // Convert from degrees to rad {
QStringList rnclass, rnbrightness, rtx;
rnclass << "I" << "II" << "I-II" << "II P" << "P";
rnbrightness << "VBR" << "VB" << "BR" << "M" << "F" << "VF"
<< ":";
switch(rnbrightness.indexOf(VdBRx.capturedTexts().at(2).trim
med()))
{
case 0:
case 1:
rtx << qc_("very bright", "Reflection Nebula
e Brightness");
break;
case 2:
rtx << qc_("bright", "Reflection Nebulae Bri
ghtness");
break;
case 3:
rtx << qc_("moderate brightness", "Reflectio
n Nebulae Brightness");
break;
case 4:
rtx << qc_("faint", "Reflection Nebulae Brig
htness");
break;
case 5:
rtx << qc_("very faint", "Reflection Nebulae
Brightness");
break;
case 6:
rtx << qc_("uncertain brightness", "Reflecti
on Nebulae Brightness");
break;
default:
rtx << qc_("undocumented brightness of refle
ction nebulae", "Reflection Nebulae Brightness");
break;
}
switch(rnclass.indexOf(VdBRx.capturedTexts().at(1).trimmed()
))
{
case 0:
rtx << qc_("the illuminating star is embedde
d in the nebulosity", "Reflection Nebulae Classification");
break;
case 1:
rtx << qc_("star is located outside the illu
minated nebulosity", "Reflection Nebulae Classification");
break;
case 2:
rtx << qc_("star is located on the corner of
the illuminated nebulosity", "Reflection Nebulae Classification");
break;
case 3:
rtx << qc_("star is located outside the illu
minated peculiar nebulosity", "Reflection Nebulae Classification");
break;
case 4:
rtx << qc_("the illuminated peculiar nebulos
ity", "Reflection Nebulae Classification");
break;
default:
rtx << qc_("undocumented reflection nebulae"
, "Reflection Nebulae Classification");
break;
}
r = rtx.join(",<br>");
}
// Calc the Cartesian coord with RA and DE QRegExp HIIRx("\\.*(\\d+),\\s+(\\d+),\\s+(\\d+)\\.*");
StelUtils::spheToRect(RaRad,DecRad,XYZ); idx = HIIRx.indexIn(mTypeString);
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001); if (idx>0)
m = mTypeString.mid(idx);
else
m = mTypeString;
nType=NebHII; if (HIIRx.exactMatch(m)) // HII regions
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000Equatorial {
Pos(NULL))); int form = HIIRx.capturedTexts().at(1).toInt();
int structure = HIIRx.capturedTexts().at(2).toInt();
int brightness = HIIRx.capturedTexts().at(3).toInt();
QStringList morph;
switch(form)
{
case 1:
morph << q_("circular form");
break;
case 2:
morph << q_("elliptical form");
break;
case 3:
morph << q_("irregular form");
break;
default:
morph << q_("undocumented form");
break;
}
switch(structure)
{
case 1:
morph << q_("amorphous structure");
break;
case 2:
morph << q_("conventional structure");
break;
case 3:
morph << q_("filamentary structure");
break;
default:
morph << q_("undocumented structure");
break;
}
switch(brightness)
{
case 1:
morph << qc_("faintest", "HII region brightn
ess");
break;
case 2:
morph << qc_("moderate brightness", "HII reg
ion brightness");
break;
case 3:
morph << qc_("brightest", "HII region bright
ness");
break;
default:
morph << q_("undocumented brightness");
break;
}
r = morph.join(",<br>");
}
return true; return r;
} }
QString Nebula::getTypeString(void) const QString Nebula::getTypeString(void) const
{ {
QString wsType; QString wsType;
switch(nType) switch(nType)
{ {
case NebGx: case NebGx:
wsType = q_("Galaxy"); wsType = q_("galaxy");
break;
case NebAGx:
wsType = q_("active galaxy");
break;
case NebRGx:
wsType = q_("radio galaxy");
break;
case NebIGx:
wsType = q_("interacting galaxy");
break;
case NebQSO:
wsType = q_("quasar");
break;
case NebCl:
wsType = q_("star cluster");
break; break;
case NebOc: case NebOc:
wsType = q_("Open cluster"); wsType = q_("open star cluster");
break; break;
case NebGc: case NebGc:
wsType = q_("Globular cluster"); wsType = q_("globular star cluster");
break; break;
case NebN: case NebN:
wsType = q_("Nebula"); wsType = q_("nebula");
break; break;
case NebPn: case NebPn:
wsType = q_("Planetary nebula"); wsType = q_("planetary nebula");
break; break;
case NebDn: case NebDn:
wsType = q_("Dark nebula"); wsType = q_("dark nebula");
break;
case NebIg:
wsType = q_("Irregular galaxy");
break; break;
case NebCn: case NebCn:
wsType = q_("Cluster associated with nebulosity"); wsType = q_("cluster associated with nebulosity");
break; break;
case NebUnknown: case NebBn:
wsType = q_("Unknown"); wsType = q_("bipolar nebula");
break;
case NebEn:
wsType = q_("emission nebula");
break; break;
case NebHII: case NebHII:
wsType = q_("HII region"); wsType = q_("HII region");
break; break;
case NebRn: case NebRn:
wsType = q_("Reflection nebula"); wsType = q_("reflection nebula");
break;
case NebHa:
wsType = q_("H-α emission region");
break;
default:
wsType = q_("Undocumented type");
break;
}
return wsType;
}
QString Nebula::getHIIFormTypeString() const
{
QString wsType;
switch(formType)
{
case FormCir:
wsType = qc_("circular","form");
break; break;
case FormEll: case NebSNR:
wsType = qc_("elliptical","form"); wsType = q_("supernova remnant");
break; break;
case FormIrr: case NebSA:
wsType = qc_("irregular","form"); wsType = q_("stellar association");
break; break;
default: case NebSC:
wsType = qc_("undocumented form","form"); wsType = q_("star cloud");
break; break;
} case NebISM:
return wsType; wsType = q_("interstellar matter");
}
QString Nebula::getHIIStructureTypeString() const
{
QString wsType;
switch(structureType)
{
case StructureAmo:
wsType = qc_("amorphous","structure");
break; break;
case StructureCon: case NebEMO:
wsType = qc_("conventional","structure"); wsType = q_("emission object");
break; break;
case StructureFil: case NebBLL:
wsType = qc_("filamentary","structure"); wsType = q_("BL Lac object");
break; break;
default: case NebBLA:
wsType = qc_("undocumented structure","structure"); wsType = q_("blazar");
break; break;
} case NebMolCld:
return wsType; wsType = q_("molecular cloud");
}
QString Nebula::getHIIBrightnessTypeString() const
{
QString wsType;
switch(brightnessType)
{
case Faintest:
wsType = qc_("faintest", "HII region brightness");
break; break;
case Moderate: case NebYSO:
wsType = qc_("moderate", "HII region brightness"); wsType = q_("young stellar object");
break; break;
case Brightest: case NebPossQSO:
wsType = qc_("brightest", "HII region brightness"); wsType = q_("possible quasar");
break;
default:
wsType = q_("undocumented brightness");
break; break;
} case NebPossPN:
return wsType; wsType = q_("possible planetary nebula");
}
QString Nebula::getHaBrightnessTypeString() const
{
QString wsType;
switch(rcwBrightnessType)
{
case HaVeryBright:
wsType = qc_("very bright", "H-α emission region bri
ghtness");
break; break;
case HaBright: case NebPPN:
wsType = qc_("bright", "H-α emission region brightne wsType = q_("protoplanetary nebula");
ss");
break; break;
case HaMedium: case NebStar:
wsType = qc_("medium", "H-α emission region brightne wsType = q_("star");
ss");
break; break;
case HaFaint: case NebUnknown:
wsType = qc_("faint", "H-α emission region brightnes wsType = q_("object of unknown nature");
s");
break; break;
default: default:
wsType = q_("undocumented brightness"); wsType = q_("undocumented type");
break; break;
} }
return wsType; return wsType;
} }
 End of changes. 130 change blocks. 
537 lines changed or deleted 839 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/