Nebula.cpp   Nebula.cpp 
skipping to change at line 26 skipping to change at line 26
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include <QTextStream> #include <QTextStream>
#include <QFile> #include <QFile>
#include <QString> #include <QString>
#include "Nebula.hpp" #include "Nebula.hpp"
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "STexture.hpp" #include "StelTexture.hpp"
#include "SFont.hpp" #include "StelFont.hpp"
#include "Navigator.hpp" #include "StelNavigator.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "SFont.hpp" #include "StelFont.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelPainter.hpp"
#include <QDebug> #include <QDebug>
STextureSP Nebula::texCircle; StelTextureSP Nebula::texCircle;
SFont* Nebula::nebulaFont = NULL; StelFont* Nebula::nebulaFont = NULL;
float Nebula::circleScale = 1.f; float Nebula::circleScale = 1.f;
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);
Nebula::Nebula() : Nebula::Nebula() :
M_nb(0), M_nb(0),
NGC_nb(0), NGC_nb(0),
IC_nb(0) IC_nb(0)
{ {
skipping to change at line 108 skipping to change at line 109
oss << getPositionInfoString(core, flags); oss << getPositionInfoString(core, flags);
if (angularSize>0 && flags&Size) if (angularSize>0 && flags&Size)
oss << q_("Size: %1").arg(StelUtils::radToDmsStr(angularSize *M_PI/180.)) << "<br>"; oss << q_("Size: %1").arg(StelUtils::radToDmsStr(angularSize *M_PI/180.)) << "<br>";
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
float Nebula::getSelectPriority(const Navigator *nav) const float Nebula::getSelectPriority(const StelNavigator *nav) const
{ {
if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Ne bulaMgr"))->getFlagHints() ) if( ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Ne bulaMgr"))->getFlagHints() )
{ {
// make very easy to select IF LABELED // make very easy to select IF LABELED
return -10; return -10;
} }
else else
{ {
if (getVMagnitude(nav)>20) return 20; if (getVMagnitude(nav)>20) return 20;
return getVMagnitude(nav); return getVMagnitude(nav);
} }
} }
Vec3f Nebula::getInfoColor(void) const Vec3f Nebula::getInfoColor(void) const
{ {
return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.4) : ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Nebul aMgr"))->getLabelsColor(); return StelApp::getInstance().getVisionModeNight() ? Vec3f(0.6, 0.0, 0.4) : ((NebulaMgr*)StelApp::getInstance().getModuleMgr().getModule("Nebul aMgr"))->getLabelsColor();
} }
double Nebula::getCloseViewFov(const Navigator*) const double Nebula::getCloseViewFov(const StelNavigator*) const
{ {
return angularSize * 4; return angularSize>0 ? angularSize * 4 : 1;
} }
void Nebula::drawHints(const StelCore* core, float maxMagHints) void Nebula::drawHints(const StelPainter& sPainter, float maxMagHints)
{ {
if (mag>maxMagHints) if (mag>maxMagHints)
return; return;
//if (4.f/getOnScreenSize(core)<0.1) return; //if (4.f/getOnScreenSize(core)<0.1) return;
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
float lum = 1.;//qMin(1,4.f/getOnScreenSize(core))*0.8; float lum = 1.;//qMin(1,4.f/getOnScreenSize(core))*0.8;
glColor3f(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hin tsBrightness, circleColor[2]*lum*hintsBrightness); glColor3f(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hin tsBrightness, circleColor[2]*lum*hintsBrightness);
Nebula::texCircle->bind(); Nebula::texCircle->bind();
core->getProjection()->drawSprite2dMode(XY[0], XY[1], 8); sPainter.drawSprite2dMode(XY[0], XY[1], 8);
} }
void Nebula::drawLabel(const StelCore* core, float maxMagLabel) void Nebula::drawLabel(const StelCore* core, const StelPainter& sPainter, f loat maxMagLabel)
{ {
if (mag>maxMagLabel) if (mag>maxMagLabel)
return; return;
glColor4f(labelColor[0], labelColor[1], labelColor[2], hintsBrightne ss); glColor4f(labelColor[0], labelColor[1], labelColor[2], hintsBrightne ss);
float size = getOnScreenSize(core); float size = getAngularSize(core)*M_PI/180.*core->getProjection(Stel Core::FrameJ2000)->getPixelPerRadAtCenter();
float shift = 4.f + size/1.8f; float shift = 4.f + size/1.8f;
QString str; QString str;
if (nameI18!="") if (nameI18!="")
str = getNameI18n(); str = getNameI18n();
else else
{ {
if (M_nb > 0) if (M_nb > 0)
str = QString("M %1").arg(M_nb); str = QString("M %1").arg(M_nb);
else if (NGC_nb > 0) else if (NGC_nb > 0)
str = QString("NGC %1").arg(NGC_nb); str = QString("NGC %1").arg(NGC_nb);
else if (IC_nb > 0) else if (IC_nb > 0)
str = QString("IC %1").arg(IC_nb); str = QString("IC %1").arg(IC_nb);
} }
core->getProjection()->drawText(nebulaFont,XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false); sPainter.drawText(nebulaFont,XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
} }
bool Nebula::readNGC(char *recordstr) bool Nebula::readNGC(char *recordstr)
{ {
int rahr; int rahr;
float ramin; float ramin;
int dedeg; int dedeg;
float demin; float demin;
int nb; int nb;
 End of changes. 12 change blocks. 
14 lines changed or deleted 15 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/