129
129
void operator()(StelRegionObject* obj)
131
131
Nebula* n = static_cast<Nebula*>(obj);
132
StelSkyDrawer *drawer = core->getSkyDrawer();
133
// filter out DSOs which are too dim to be seen (e.g. for bino observers)
134
if ((drawer->getFlagNebulaMagnitudeLimit()) && (n->mag > drawer->getCustomNebulaMagnitudeLimit())) return;
132
136
if (n->angularSize>angularSizeLimit || (checkMaxMagHints && n->mag <= maxMagHints))
134
138
float refmag_add=0; // value to adjust hints visibility threshold.
161
165
const SphericalRegionP& p = prj->getViewportConvexPolygon(margin, margin);
163
167
// Print all the nebulae of all the selected zones
164
float maxMagHints = skyDrawer->getLimitMagnitude()*1.2f-2.f+(hintsAmount*1.2f)-2.f;
165
float maxMagLabels = skyDrawer->getLimitMagnitude()-2.f+(labelsAmount*1.2f)-2.f;
168
float maxMagHints = skyDrawer->getLimitMagnitude()*1.2f-2.f+(hintsAmount *1.2f)-2.f;
169
float maxMagLabels = skyDrawer->getLimitMagnitude() -2.f+(labelsAmount*1.2f)-2.f;
167
171
renderer->setFont(nebulaFont);
168
172
nebulaHintTextures.lazyInit(renderer);
245
250
// If no match found, try search by catalog reference
246
static QRegExp catNumRx("^(M|NGC|IC)\\s*(\\d+)$");
251
static QRegExp catNumRx("^(M|NGC|IC|C)\\s*(\\d+)$");
247
252
if (catNumRx.exactMatch(uname))
249
254
QString cat = catNumRx.capturedTexts().at(1);
460
475
// If the name is not a messier number perhaps one is already
461
476
// defined for this object
462
if (name.left(2).toUpper() != "M ")
477
if (name.left(2).toUpper() != "M " && name.left(2).toUpper() != "C ")
464
479
if (transRx.exactMatch(name)) {
465
480
e->englishName = transRx.capturedTexts().at(1).trimmed();
469
484
e->englishName = name;
487
else if (name.left(2).toUpper() != "M " && name.left(2).toUpper() == "C ")
489
// If it's a caldwellnumber, we will call it a caldwell if there is no better name
490
name = name.mid(2); // remove "C "
492
// read the Caldwell number
493
QTextStream istr(&name);
496
if (istr.status()!=QTextStream::Ok)
498
qWarning() << "cannot read Caldwell number at line" << lineNumber << "of" << catNGCNames;
502
e->C_nb=(unsigned int)(num);
503
e->englishName = QString("C%1").arg(num);
505
else if (name.left(2).toUpper() == "M " && name.left(2).toUpper() != "C ")
474
507
// If it's a messiernumber, we will call it a messier if there is no better name
475
508
name = name.mid(2); // remove "M "
578
// Search by Caldwell numbers (possible formats are "C31" or "C 31")
579
if (objw.mid(0, 1) == "C")
581
foreach (const NebulaP& n, nebArray)
583
if (QString("C%1").arg(n->C_nb) == objw || QString("C %1").arg(n->C_nb) == objw)
584
return qSharedPointerCast<StelObject>(n);
544
588
return StelObjectP();
626
// Search by Caldwell numbers (possible formats are "C31" or "C 31")
627
if (objw.mid(0, 1) == "C")
629
foreach (const NebulaP& n, nebArray)
631
if (QString("C%1").arg(n->C_nb) == objw || QString("C %1").arg(n->C_nb) == objw)
632
return qSharedPointerCast<StelObject>(n);
628
682
result << constw;
685
// Search by caldwell objects number (possible formats are "C31" or "C 31")
686
if (objw.size()>=1 && objw[0]=='C')
688
foreach (const NebulaP& n, nebArray)
690
if (n->C_nb==0) continue;
691
QString constw = QString("C%1").arg(n->C_nb);
692
QString constws = constw.mid(0, objw.size());
696
continue; // Prevent adding both forms for name
698
constw = QString("C %1").arg(n->C_nb);
699
constws = constw.mid(0, objw.size());
631
705
// Search by common names
632
706
foreach (const NebulaP& n, nebArray)
719
//! Find and return the list of at most maxNbItem objects auto-completing the passed object English name
720
QStringList NebulaMgr::listMatchingObjects(const QString& objPrefix, int maxNbItem) const
723
if (maxNbItem==0) return result;
725
QString objw = objPrefix.toUpper();
727
// Search by messier objects number (possible formats are "M31" or "M 31")
728
if (objw.size()>=1 && objw[0]=='M')
730
foreach (const NebulaP& n, nebArray)
732
if (n->M_nb==0) continue;
733
QString constw = QString("M%1").arg(n->M_nb);
734
QString constws = constw.mid(0, objw.size());
738
continue; // Prevent adding both forms for name
740
constw = QString("M %1").arg(n->M_nb);
741
constws = constw.mid(0, objw.size());
747
// Search by NGC numbers (possible formats are "NGC31" or "NGC 31")
748
foreach (const NebulaP& n, nebArray)
750
if (n->NGC_nb==0) continue;
751
QString constw = QString("NGC%1").arg(n->NGC_nb);
752
QString constws = constw.mid(0, objw.size());
758
constw = QString("NGC %1").arg(n->NGC_nb);
759
constws = constw.mid(0, objw.size());
764
// Search by caldwell objects number (possible formats are "C31" or "C 31")
765
if (objw.size()>=1 && objw[0]=='C')
767
foreach (const NebulaP& n, nebArray)
769
if (n->C_nb==0) continue;
770
QString constw = QString("C%1").arg(n->C_nb);
771
QString constws = constw.mid(0, objw.size());
775
continue; // Prevent adding both forms for name
777
constw = QString("C %1").arg(n->C_nb);
778
constws = constw.mid(0, objw.size());
784
// Search by common names
785
foreach (const NebulaP& n, nebArray)
787
QString constw = n->englishName.mid(0, objw.size()).toUpper();
789
result << n->englishName;
793
if (result.size()>maxNbItem) result.erase(result.begin()+maxNbItem, result.end());