3
3
* Copyright (C) 2002 Fabien Chereau
5
5
* This program is free software; you can redistribute it and/or
6
6
* modify it under the terms of the GNU General Public License
7
7
* as published by the Free Software Foundation; either version 2
8
8
* of the License, or (at your option) any later version.
10
10
* This program is distributed in the hope that it will be useful,
11
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
13
* GNU General Public License for more details.
15
15
* You should have received a copy of the GNU General Public License
16
16
* along with this program; if not, write to the Free Software
17
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
24
#include "Nebula.hpp"
25
25
#include "NebulaMgr.hpp"
26
26
#include "StelTexture.hpp"
27
#include "StelFont.hpp"
28
27
#include "StelNavigator.hpp"
29
28
#include "StelUtils.hpp"
30
29
#include "StelApp.hpp"
31
30
#include "StelTextureMgr.hpp"
32
#include "StelFont.hpp"
33
31
#include "StelModuleMgr.hpp"
34
32
#include "StelCore.hpp"
35
33
#include "StelPainter.hpp"
39
38
StelTextureSP Nebula::texCircle;
40
StelFont* Nebula::nebulaFont = NULL;
41
39
float Nebula::circleScale = 1.f;
42
40
float Nebula::hintsBrightness = 0;
43
41
Vec3f Nebula::labelColor = Vec3f(0.4,0.3,0.5);
90
88
if ((flags&Name) || (flags&CatalogNumber))
94
92
oss << q_("Type: <b>%1</b>").arg(getTypeString()) << "<br>";
96
if (mag < 50 && flags&Magnitude)
94
if (mag < 50 && flags&Magnitude)
97
95
oss << q_("Magnitude: <b>%1</b>").arg(mag, 0, 'f', 2) << "<br>";
99
97
oss << getPositionInfoString(core, flags);
130
128
return angularSize>0 ? angularSize * 4 : 1;
133
void Nebula::drawHints(const StelPainter& sPainter, float maxMagHints)
131
void Nebula::drawHints(StelPainter& sPainter, float maxMagHints)
135
133
if (mag>maxMagHints)
137
135
//if (4.f/getOnScreenSize(core)<0.1) return;
138
136
glBlendFunc(GL_ONE, GL_ONE);
139
137
float lum = 1.;//qMin(1,4.f/getOnScreenSize(core))*0.8;
140
glColor3f(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hintsBrightness, circleColor[2]*lum*hintsBrightness);
138
sPainter.setColor(circleColor[0]*lum*hintsBrightness, circleColor[1]*lum*hintsBrightness, circleColor[2]*lum*hintsBrightness, 1);
141
139
Nebula::texCircle->bind();
142
sPainter.drawSprite2dMode(XY[0], XY[1], 8);
140
sPainter.drawSprite2dMode(XY[0], XY[1], 4);
145
void Nebula::drawLabel(const StelCore* core, const StelPainter& sPainter, float maxMagLabel)
143
void Nebula::drawLabel(StelPainter& sPainter, float maxMagLabel)
147
145
if (mag>maxMagLabel)
149
glColor4f(labelColor[0], labelColor[1], labelColor[2], hintsBrightness);
150
float size = getAngularSize(core)*M_PI/180.*core->getProjection(StelCore::FrameJ2000)->getPixelPerRadAtCenter();
147
sPainter.setColor(labelColor[0], labelColor[1], labelColor[2], hintsBrightness);
148
float size = getAngularSize(NULL)*M_PI/180.*sPainter.getProjector()->getPixelPerRadAtCenter();
151
149
float shift = 4.f + size/1.8f;
161
159
else if (IC_nb > 0)
162
160
str = QString("IC %1").arg(IC_nb);
165
sPainter.drawText(nebulaFont,XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
163
sPainter.drawText(XY[0]+shift, XY[1]+shift, str, 0, 0, 0, false);
167
void Nebula::readNGC(QDataStream& in)
173
in >> isIc >> nb >> ra >> dec >> mag >> angularSize >> type;
182
StelUtils::spheToRect(ra,dec,XYZ);
183
Q_ASSERT(fabs(XYZ.lengthSquared()-1.)<0.000000001);
184
nType = (Nebula::NebulaType)type;
185
pointRegion = SphericalRegionP(new SphericalPoint(getJ2000EquatorialPos(NULL)));
189
QFile filess("filess.dat");
191
out.setVersion(QDataStream::Qt_4_5);
168
192
bool Nebula::readNGC(char *recordstr)
225
246
else if (!strncmp(&recordstr[8]," ?",2)) { nType = NebUnknown;}
226
247
else { nType = NebUnknown;}
249
if (!filess.isOpen())
251
filess.open(QIODevice::WriteOnly);
252
out.setDevice(&filess);
254
out << ((bool)(recordstr[0] == 'I')) << nb << RaRad << DecRad << mag << angularSize << ((unsigned int)nType);
255
if (nb==5369 && recordstr[0] == 'I')
231
262
QString Nebula::getTypeString(void) const