void NavStars::draw(StelCore* core) { // Drawing is enabled? if (markerFader.getInterstate() <= 0.0) { return; } if (stars.isEmpty()) { StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); stars.fill(StelObjectP(), starNumbers.size()); for (int i = 0; i < starNumbers.size(); ++i) { QString name = QString("HIP %1").arg(starNumbers.at(i)); stars[i] = omgr->searchByName(name); } } StelProjectorP prj = core->getProjection(StelCore::FrameJ2000); StelPainter painter(prj); Vec3d pos; for (int i = 0; i < starNumbers.size(); ++i) { if (stars[i].isNull()) continue; // Get the current position of the navigational star... if (prj->projectCheck(stars[i]->getJ2000EquatorialPos(core), pos)) { // ... and draw a marker around it if (!markerTexture.isNull()) { glEnable(GL_BLEND); painter.enableTexture2d(true); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); painter.setColor(markerColor[0], markerColor[1], markerColor[2], markerFader.getInterstate()); markerTexture->bind(); painter.drawSprite2dMode(pos[0], pos[1], 11.f); } // Draw the localized name of the star and its ordinal number QString label = stars[i]->getNameI18n(); if (label.isEmpty()) label = QString("%1").arg(i+1); else label = QString("%1 (%2)").arg(label).arg(i+1); painter.drawText(pos[0], pos[1], label, 0, 10.f, 10.f, false); } } }
/************************************************************************* Find in a "clever" way an object from its equatorial position *************************************************************************/ StelObjectP StelObjectMgr::cleverFind(const StelCore* core, int x, int y) const { Vec3d v; const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000); if (prj->unProject(x,y,v)) { // Nick Fedoseev patch: improve click match for refracted coordinates Vec3d win; prj->project(v,win); float dx = x - win.v[0]; float dy = y - win.v[1]; prj->unProject(x+dx, y+dy, v); return cleverFind(core, v); } return StelObjectP(); }
StelObjectP Star3::createStelObject(const SpecialZoneArray<Star3> *a, const SpecialZoneData<Star3> *z) const { return StelObjectP(new StarWrapper3(a,z,this), true); }