ConstellationMgr.cpp   ConstellationMgr.cpp 
skipping to change at line 58 skipping to change at line 58
// constructor which loads all data from appropriate files // constructor which loads all data from appropriate files
ConstellationMgr::ConstellationMgr(StarMgr *_hip_stars) ConstellationMgr::ConstellationMgr(StarMgr *_hip_stars)
: hipStarMgr(_hip_stars), : hipStarMgr(_hip_stars),
constellationDisplayStyle(ConstellationMgr::constellationsTranslat ed), constellationDisplayStyle(ConstellationMgr::constellationsTranslat ed),
artFadeDuration(1.), artFadeDuration(1.),
artIntensity(0), artIntensity(0),
artDisplayed(0), artDisplayed(0),
boundariesDisplayed(0), boundariesDisplayed(0),
linesDisplayed(0), linesDisplayed(0),
namesDisplayed(0) namesDisplayed(0),
constellationLineThickness(1.f)
{ {
setObjectName("ConstellationMgr"); setObjectName("ConstellationMgr");
Q_ASSERT(hipStarMgr); Q_ASSERT(hipStarMgr);
isolateSelected = false; isolateSelected = false;
constellationPickEnabled = false;
} }
ConstellationMgr::~ConstellationMgr() ConstellationMgr::~ConstellationMgr()
{ {
std::vector<Constellation *>::iterator iter; std::vector<Constellation *>::iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); iter++) for (iter = asterisms.begin(); iter != asterisms.end(); iter++)
{ {
delete(*iter); delete(*iter);
} }
skipping to change at line 97 skipping to change at line 99
lastLoadedSkyCulture = "dummy"; lastLoadedSkyCulture = "dummy";
asterFont.setPixelSize(conf->value("viewing/constellation_font_size" , 14).toInt()); asterFont.setPixelSize(conf->value("viewing/constellation_font_size" , 14).toInt());
setFlagLines(conf->value("viewing/flag_constellation_drawing").toBoo l()); setFlagLines(conf->value("viewing/flag_constellation_drawing").toBoo l());
setFlagLabels(conf->value("viewing/flag_constellation_name").toBool( )); setFlagLabels(conf->value("viewing/flag_constellation_name").toBool( ));
setFlagBoundaries(conf->value("viewing/flag_constellation_boundaries ",false).toBool()); setFlagBoundaries(conf->value("viewing/flag_constellation_boundaries ",false).toBool());
setArtIntensity(conf->value("viewing/constellation_art_intensity", 0 .5f).toFloat()); setArtIntensity(conf->value("viewing/constellation_art_intensity", 0 .5f).toFloat());
setArtFadeDuration(conf->value("viewing/constellation_art_fade_durat ion",2.f).toFloat()); setArtFadeDuration(conf->value("viewing/constellation_art_fade_durat ion",2.f).toFloat());
setFlagArt(conf->value("viewing/flag_constellation_art").toBool()); setFlagArt(conf->value("viewing/flag_constellation_art").toBool());
setFlagIsolateSelected(conf->value("viewing/flag_constellation_isola te_selected", false).toBool()); setFlagIsolateSelected(conf->value("viewing/flag_constellation_isola te_selected", false).toBool());
setFlagConstellationPick(conf->value("viewing/flag_constellation_pic k", false).toBool()); setFlagConstellationPick(conf->value("viewing/flag_constellation_pic k", false).toBool());
setConstellationLineThickness(conf->value("viewing/constellation_lin e_thickness", 1.f).toFloat());
QString starloreDisplayStyle=conf->value("viewing/constellation_name _style", "translated").toString(); QString starloreDisplayStyle=conf->value("viewing/constellation_name _style", "translated").toString();
if (starloreDisplayStyle=="translated") if (starloreDisplayStyle=="translated")
{ {
setConstellationDisplayStyle(constellationsTranslated); setConstellationDisplayStyle(constellationsTranslated);
} }
else if (starloreDisplayStyle=="native") else if (starloreDisplayStyle=="native")
{ {
setConstellationDisplayStyle(constellationsNative); setConstellationDisplayStyle(constellationsNative);
} }
skipping to change at line 362 skipping to change at line 365
{ {
ConstellationDisplayStyle displayStyle = getConstellationDisplayStyl e(); ConstellationDisplayStyle displayStyle = getConstellationDisplayStyl e();
return (displayStyle == constellationsAbbreviated ? "abbreviated" : (displayStyle == constellationsNative ? "native" : "translated")); return (displayStyle == constellationsAbbreviated ? "abbreviated" : (displayStyle == constellationsNative ? "native" : "translated"));
} }
ConstellationMgr::ConstellationDisplayStyle ConstellationMgr::getConstellat ionDisplayStyle() ConstellationMgr::ConstellationDisplayStyle ConstellationMgr::getConstellat ionDisplayStyle()
{ {
return constellationDisplayStyle; return constellationDisplayStyle;
} }
void ConstellationMgr::setConstellationLineThickness(const double thickness
)
{
constellationLineThickness = thickness;
if (constellationLineThickness<=0.f) // The line can not be negative
or zero thickness
constellationLineThickness = 1.f;
}
void ConstellationMgr::loadLinesAndArt(const QString &fileName, const QStri ng &artfileName, const QString& cultureName) void ConstellationMgr::loadLinesAndArt(const QString &fileName, const QStri ng &artfileName, const QString& cultureName)
{ {
QFile in(fileName); QFile in(fileName);
if (!in.open(QIODevice::ReadOnly | QIODevice::Text)) if (!in.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
qWarning() << "Can't open constellation data file" << QDir:: toNativeSeparators(fileName) << "for culture" << cultureName; qWarning() << "Can't open constellation data file" << QDir:: toNativeSeparators(fileName) << "for culture" << cultureName;
Q_ASSERT(0); Q_ASSERT(0);
} }
int totalRecords=0; int totalRecords=0;
skipping to change at line 456 skipping to change at line 466
// ShortName texture_file x1 y1 hp1 x2 y2 hp2 // ShortName texture_file x1 y1 hp1 x2 y2 hp2
// Where : // Where :
// shortname is the international short name (i.e "Lep" for Lepus) // shortname is the international short name (i.e "Lep" for Lepus)
// texture_file is the graphic file of the art texture // texture_file is the graphic file of the art texture
// x1 y1 are the x and y texture coordinates in pixels of the star o f hipparcos number hp1 // x1 y1 are the x and y texture coordinates in pixels of the star o f hipparcos number hp1
// x2 y2 are the x and y texture coordinates in pixels of the star o f hipparcos number hp2 // x2 y2 are the x and y texture coordinates in pixels of the star o f hipparcos number hp2
// The coordinate are taken with (0,0) at the top left corner of the image file // The coordinate are taken with (0,0) at the top left corner of the image file
QString shortname; QString shortname;
QString texfile; QString texfile;
unsigned int x1, y1, x2, y2, x3, y3, hp1, hp2, hp3; unsigned int x1, y1, x2, y2, x3, y3, hp1, hp2, hp3;
QString tmpstr;
currentLineNumber = 0; // line in file currentLineNumber = 0; // line in file
readOk = 0; // count of records processed OK readOk = 0; // count of records processed OK
while (!fic.atEnd()) while (!fic.atEnd())
{ {
++currentLineNumber; ++currentLineNumber;
record = QString::fromUtf8(fic.readLine()); record = QString::fromUtf8(fic.readLine());
if (commentRx.exactMatch(record)) if (commentRx.exactMatch(record))
continue; continue;
skipping to change at line 594 skipping to change at line 603
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
} }
// Draw constellations lines // Draw constellations lines
void ConstellationMgr::drawLines(StelPainter& sPainter, const StelCore* cor e) const void ConstellationMgr::drawLines(StelPainter& sPainter, const StelCore* cor e) const
{ {
sPainter.enableTexture2d(false); sPainter.enableTexture2d(false);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (constellationLineThickness>1.f)
glLineWidth(constellationLineThickness); // set line thickne
ss
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much bett
er.
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSu
rfaceFormat::OpenGL)
glEnable(GL_LINE_SMOOTH);
#endif
const SphericalCap& viewportHalfspace = sPainter.getProjector()->get BoundingCap(); const SphericalCap& viewportHalfspace = sPainter.getProjector()->get BoundingCap();
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{ {
(*iter)->drawOptim(sPainter, core, viewportHalfspace); (*iter)->drawOptim(sPainter, core, viewportHalfspace);
} }
if (constellationLineThickness>1.f)
glLineWidth(1.f); // restore line thickness
// OpenGL ES 2.0 doesn't have GL_LINE_SMOOTH. But it looks much bett
er.
#ifdef GL_LINE_SMOOTH
if (QOpenGLContext::currentContext()->format().renderableType()==QSu
rfaceFormat::OpenGL)
glDisable(GL_LINE_SMOOTH);
#endif
} }
// Draw the names of all the constellations // Draw the names of all the constellations
void ConstellationMgr::drawNames(StelPainter& sPainter) const void ConstellationMgr::drawNames(StelPainter& sPainter) const
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); iter++) for (iter = asterisms.begin(); iter != asterisms.end(); iter++)
 End of changes. 7 change blocks. 
2 lines changed or deleted 33 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/