本文整理汇总了C++中StelPainter::drawText方法的典型用法代码示例。如果您正苦于以下问题:C++ StelPainter::drawText方法的具体用法?C++ StelPainter::drawText怎么用?C++ StelPainter::drawText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StelPainter
的用法示例。
在下文中一共展示了StelPainter::drawText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void Galaxy::draw(StelCore* core, StelPainter& painter, float)
{
StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = Vec3f(0.4f,0.5f,1.2f);
if (StelApp::getInstance().getVisionModeNight())
color = StelUtils::getNightColor(color);
double mag = getVMagnitude(core, true);
StelUtils::spheToRect(RA, DE, XYZ);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
painter.setColor(color[0], color[1], color[2], Galaxy::galaxyBrightness);
glColor4f(color[0],color[1],color[2], Galaxy::galaxyBrightness);
if (mag <= sd->getLimitMagnitude())
{
Galaxy::markerTexture->bind();
float size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
float shift = 5.f + size/1.6f;
if (GETSTELMODULE(POGS)->getDisplayMode())
{
painter.drawSprite2dMode(XYZ, 6);
painter.drawText(XYZ, " ", 0, shift, shift, false);
}
else
{
painter.drawSprite2dMode(XYZ, 6);
painter.drawText(XYZ, designation, 0, shift, shift, false);
}
}
}
示例2: draw
void Quasar::draw(StelCore* core, StelPainter& painter)
{
StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = sd->indexToColor(BvToColorIndex(bV))*0.75f;
Vec3f dcolor = Vec3f(1.2f,0.5f,0.4f);
if (StelApp::getInstance().getVisionModeNight())
dcolor = StelUtils::getNightColor(dcolor);
float rcMag[2], size, shift;
double mag;
StelUtils::spheToRect(qRA, qDE, XYZ);
mag = getVMagnitude(core, true);
if (GETSTELMODULE(Quasars)->getDisplayMode())
{
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
painter.setColor(dcolor[0], dcolor[1], dcolor[2], 1);
Quasar::markerTexture->bind();
size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
shift = 5.f + size/1.6f;
if (labelsFader.getInterstate()<=0.f)
{
painter.drawSprite2dMode(XYZ, 4);
painter.drawText(XYZ, " ", 0, shift, shift, false);
}
}
else
{
sd->preDrawPointSource(&painter);
if (mag <= sd->getLimitMagnitude())
{
sd->computeRCMag(mag, rcMag);
//sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1], XYZ[2]), rcMag, sd->indexToColor(BvToColorIndex(bV)), false);
sd->drawPointSource(&painter, XYZ, rcMag, sd->indexToColor(BvToColorIndex(bV)), false);
painter.setColor(color[0], color[1], color[2], 1);
size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
shift = 6.f + size/1.8f;
if (labelsFader.getInterstate()<=0.f)
{
painter.drawText(XYZ, designation, 0, shift, shift, false);
}
}
sd->postDrawPointSource(&painter);
}
}
示例3: draw
void Supernova::draw(StelCore* core, StelPainter& painter)
{
StelSkyDrawer* sd = core->getSkyDrawer();
Vec3f color = Vec3f(1.f,1.f,1.f);
if (StelApp::getInstance().getVisionModeNight())
color = StelUtils::getNightColor(color);
float rcMag[2], size, shift;
double mag;
StelUtils::spheToRect(snra, snde, XYZ);
mag = getVMagnitude(core, true);
sd->preDrawPointSource(&painter);
if (mag <= sd->getLimitMagnitude())
{
sd->computeRCMag(mag, rcMag);
// sd->drawPointSource(&painter, Vec3f(XYZ[0], XYZ[1], XYZ[2]), rcMag, color, false);
sd->drawPointSource(&painter, XYZ, rcMag, color, false);
painter.setColor(color[0], color[1], color[2], 1);
size = getAngularSize(NULL)*M_PI/180.*painter.getProjector()->getPixelPerRadAtCenter();
shift = 6.f + size/1.8f;
if (labelsFader.getInterstate()<=0.f)
{
painter.drawText(XYZ, designation, 0, shift, shift, false);
}
}
sd->postDrawPointSource(&painter);
}
示例4: drawName
void Constellation::drawName(StelPainter& sPainter, ConstellationMgr::ConstellationDisplayStyle style) const
{
if (!nameFader.getInterstate())
return;
if (checkVisibility())
{
QString name;
switch (style)
{
case ConstellationMgr::constellationsTranslated:
name=nameI18;
break;
case ConstellationMgr::constellationsNative:
name=nativeName;
break;
case ConstellationMgr::constellationsEnglish:
name=englishName;
break;
case ConstellationMgr::constellationsAbbreviated:
name=(abbreviation.startsWith('.') ? "" : abbreviation);
break;
Q_ASSERT(0);
}
sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], nameFader.getInterstate());
sPainter.drawText(XYname[0], XYname[1], name, 0., -sPainter.getFontMetrics().width(name)/2, 0, false);
}
}
示例5: drawLabel
void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel)
{
float lim = mag;
if (lim > 50) lim = 15.f;
// temporary workaround of this bug: https://bugs.launchpad.net/stellarium/+bug/1115035 --AW
if (getEnglishName().contains("Pleiades"))
lim = 5.f;
if (lim>maxMagLabel)
return;
Vec3f col(labelColor[0], labelColor[1], labelColor[2]);
sPainter.setColor(col[0], col[1], col[2], hintsBrightness);
float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()->getPixelPerRadAtCenter();
float shift = 4.f + size/1.8f;
QString str;
if (!nameI18.isEmpty())
str = getNameI18n();
else
{
if (M_nb > 0)
str = QString("M %1").arg(M_nb);
else if (C_nb > 0)
str = QString("C %1").arg(C_nb);
else if (NGC_nb > 0)
str = QString("NGC %1").arg(NGC_nb);
else if (IC_nb > 0)
str = QString("IC %1").arg(IC_nb);
}
sPainter.drawText(XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
}
示例6: draw
bool ScreenLabel::draw(StelCore*, StelPainter& sPainter)
{
if (labelFader.getInterstate() <= 0.0)
return false;
sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], labelFader.getInterstate());
sPainter.setFont(labelFont);
sPainter.drawText(screenX, screenY, labelText, 0, 0, 0, false);
return true;
}
示例7: drawLabel
void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel)
{
float lim = mag;
if (lim > 50) lim = 15.f;
// temporary workaround of this bug: https://bugs.launchpad.net/stellarium/+bug/1115035 --AW
if (getEnglishName().contains("Pleiades"))
lim = 5.f;
// Dark nebulae. Not sure how to assess visibility from opacity? --GZ
if (nType==NebDn)
{
// GZ: ad-hoc visibility formula: assuming good visibility if objects of mag9 are visible, "usual" opacity 5 and size 30', better visibility (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)
lim=9.0f;
if (lim>maxMagLabel)
return;
Vec3d win;
// Check visibility of DSO labels
if (!(sPainter.getProjector()->projectCheck(XYZ, win)))
return;
Vec3f col(labelColor[0], labelColor[1], labelColor[2]);
sPainter.setColor(col[0], col[1], col[2], hintsBrightness);
float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()->getPixelPerRadAtCenter();
float shift = 4.f + (drawHintProportional ? size : size/1.8f);
QString str;
if (!nameI18.isEmpty())
str = getNameI18n();
else
{
// On screen label: one only, priority as given here. NGC should win over Sharpless. (GZ)
if (M_nb > 0)
str = QString("M %1").arg(M_nb);
else if (C_nb > 0)
str = QString("C %1").arg(C_nb);
else if (NGC_nb > 0)
str = QString("NGC %1").arg(NGC_nb);
else if (IC_nb > 0)
str = QString("IC %1").arg(IC_nb);
else if (B_nb > 0)
str = QString("B %1").arg(B_nb);
else if (Sh2_nb > 0)
str = QString("Sh 2-%1").arg(Sh2_nb);
else if (VdB_nb > 0)
str = QString("VdB %1").arg(VdB_nb);
else if (RCW_nb > 0)
str = QString("RCW %1").arg(RCW_nb);
else if (LDN_nb > 0)
str = QString("LDN %1").arg(LDN_nb);
else if (LBN_nb > 0)
str = QString("LBN %1").arg(LBN_nb);
else if (Cr_nb > 0)
str = QString("Cr %1").arg(Cr_nb);
else if (Mel_nb > 0)
str = QString("Mel %1").arg(Mel_nb);
}
sPainter.drawText(XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
}