本文整理汇总了C++中StelProjectorP::projectCheck方法的典型用法代码示例。如果您正苦于以下问题:C++ StelProjectorP::projectCheck方法的具体用法?C++ StelProjectorP::projectCheck怎么用?C++ StelProjectorP::projectCheck使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StelProjectorP
的用法示例。
在下文中一共展示了StelProjectorP::projectCheck方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
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);
}
}
}
示例2: drawNames
// Draw the names of all the constellations
void ConstellationMgr::drawNames(StelRenderer* renderer, StelProjectorP projector, QFont& font) const
{
renderer->setBlendMode(BlendMode_Alpha);
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); iter++)
{
// Check if in the field of view
if (projector->projectCheck((*iter)->XYZname, (*iter)->XYname))
{
(*iter)->drawName(renderer, font);\
}
}
}
示例3: draw
void TelescopeControl::draw(StelCore* core)
{
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000);
StelPainter sPainter(prj);
sPainter.setFont(labelFont);
reticleTexture->bind();
foreach (const TelescopeClientP& telescope, telescopeClients)
{
if (telescope->isConnected() && telescope->hasKnownPosition())
{
Vec3d XY;
if (prj->projectCheck(telescope->getJ2000EquatorialPos(core), XY))
{
//Telescope circles appear synchronously with markers
if (circleFader.getInterstate() >= 0)
{
sPainter.setColor(circleColor[0], circleColor[1], circleColor[2], circleFader.getInterstate());
glDisable(GL_TEXTURE_2D);
foreach (double circle, telescope->getOculars())
{
sPainter.drawCircle(XY[0], XY[1], 0.5 * prj->getPixelPerRadAtCenter() * (M_PI/180) * (circle));
}
glEnable(GL_TEXTURE_2D);
}
if (reticleFader.getInterstate() >= 0)
{
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
sPainter.setColor(reticleColor[0], reticleColor[1], reticleColor[2], reticleFader.getInterstate());
sPainter.drawSprite2dMode(XY[0],XY[1],15.f);
glDisable(GL_TEXTURE_2D);
}
if (labelFader.getInterstate() >= 0)
{
sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], labelFader.getInterstate());
//TODO: Different position of the label if circles are shown?
//TODO: Remove magic number (text spacing)
sPainter.drawText(XY[0], XY[1], telescope->getNameI18n(), 0, 6 + 10, -4, false);
//Same position as the other objects: doesn't work, telescope label overlaps object label
//sPainter.drawText(XY[0], XY[1], scope->getNameI18n(), 0, 10, 10, false);
reticleTexture->bind();
}
}
}