ConstellationMgr.cpp   ConstellationMgr.cpp 
/* /*
* Stellarium * Stellarium
* Copyright (C) 2002 Fabien Chereau * Copyright (C) 2002 Fabien Chereau
* Copyright (C) 2012 Timothy Reaves
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* 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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include <vector> #include <vector>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QSettings> #include <QSettings>
#include <QRegExp> #include <QRegExp>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
skipping to change at line 47 skipping to change at line 48
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
using namespace std; using namespace std;
// 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),
flagNames(0), artDisplayed(0),
flagLines(0), boundariesDisplayed(0),
flagArt(0), linesDisplayed(0),
flagBoundaries(0) namesDisplayed(0)
{ {
setObjectName("ConstellationMgr"); setObjectName("ConstellationMgr");
Q_ASSERT(hipStarMgr); Q_ASSERT(hipStarMgr);
isolateSelected = false; isolateSelected = false;
asterFont.setPixelSize(15); asterFont.setPixelSize(15);
} }
ConstellationMgr::~ConstellationMgr() ConstellationMgr::~ConstellationMgr()
{ {
std::vector<Constellation *>::iterator iter; std::vector<Constellation *>::iterator iter;
skipping to change at line 91 skipping to change at line 92
lastLoadedSkyCulture = "dummy"; lastLoadedSkyCulture = "dummy";
asterFont.setPixelSize(conf->value("viewing/constellation_font_size" , 16).toInt()); asterFont.setPixelSize(conf->value("viewing/constellation_font_size" , 16).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", setFlagIsolateSelected(conf->value("viewing/flag_constellation_isola te_selected",
conf->value("viewing/flag _constellation_pick", false).toBool() ).toBool()); conf->value("viewing/flag_constel lation_pick", false).toBool() ).toBool());
StelObjectMgr *objectManager = GETSTELMODULE(StelObjectMgr); StelObjectMgr *objectManager = GETSTELMODULE(StelObjectMgr);
objectManager->registerStelObjectMgr(this); objectManager->registerStelObjectMgr(this);
connect(objectManager, SIGNAL(selectedObjectChanged(StelModule::Stel ModuleSelectAction)), connect(objectManager, SIGNAL(selectedObjectChanged(StelModule::Stel ModuleSelectAction)),
this, SLOT(selectedObjectChange(StelModule::StelModu leSelectAction))); this, SLOT(selectedObjectChange(StelModule::StelModu leSelectAction)));
StelApp *app = &StelApp::getInstance(); StelApp *app = &StelApp::getInstance();
connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
connect(app, SIGNAL(skyCultureChanged(const QString&)), this, SLOT(u pdateSkyCulture(const QString&))); connect(app, SIGNAL(skyCultureChanged(const QString&)), this, SLOT(u pdateSkyCulture(const QString&)));
connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT( setStelStyle(const QString&))); connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT( setStelStyle(const QString&)));
} }
skipping to change at line 194 skipping to change at line 195
// Even if do not have anything selected, KEEP constellation selection intact // Even if do not have anything selected, KEEP constellation selection intact
// (allows viewing constellations without distraction from s tar pointer animation) // (allows viewing constellations without distraction from s tar pointer animation)
// setSelected(NULL); // setSelected(NULL);
return; return;
} }
const QList<StelObjectP> newSelectedConst = omgr->getSelectedObject( "Constellation"); const QList<StelObjectP> newSelectedConst = omgr->getSelectedObject( "Constellation");
if (!newSelectedConst.empty()) if (!newSelectedConst.empty())
{ {
// If removing this selection // If removing this selection
if(action == StelModule::RemoveFromSelection) { if(action == StelModule::RemoveFromSelection)
{
unsetSelectedConst((Constellation *)newSelectedConst [0].data()); unsetSelectedConst((Constellation *)newSelectedConst [0].data());
} else { }
else
{
// Add constellation to selected list (do not select a star, just the constellation) // Add constellation to selected list (do not select a star, just the constellation)
setSelectedConst((Constellation *)newSelectedConst[0 ].data()); setSelectedConst((Constellation *)newSelectedConst[0 ].data());
} }
} }
else else
{ {
const QList<StelObjectP> newSelectedStar = omgr->getSelected Object("Star"); const QList<StelObjectP> newSelectedStar = omgr->getSelected Object("Star");
if (!newSelectedStar.empty()) if (!newSelectedStar.empty())
{ {
// if (!added) // if (!added)
skipping to change at line 240 skipping to change at line 244
foreach(const StelObjectP& obj, currSelection) foreach(const StelObjectP& obj, currSelection)
{ {
if (obj->getType() != "Constellation") if (obj->getType() != "Constellation")
{ {
newSelection.push_back(obj); newSelection.push_back(obj);
} }
} }
omgr->setSelectedObject(newSelection, StelModule::ReplaceSelection); omgr->setSelectedObject(newSelection, StelModule::ReplaceSelection);
} }
void ConstellationMgr::setLinesColor(const Vec3f& c) void ConstellationMgr::setLinesColor(const Vec3f& color)
{ {
Constellation::lineColor = c; if (color != Constellation::lineColor)
{
Constellation::lineColor = color;
emit linesColorChanged(color);
}
} }
Vec3f ConstellationMgr::getLinesColor() const Vec3f ConstellationMgr::getLinesColor() const
{ {
return Constellation::lineColor; return Constellation::lineColor;
} }
void ConstellationMgr::setBoundariesColor(const Vec3f& c) void ConstellationMgr::setBoundariesColor(const Vec3f& color)
{ {
Constellation::boundaryColor = c; if (Constellation::boundaryColor != color)
{
Constellation::boundaryColor = color;
emit boundariesColorChanged(color);
}
} }
Vec3f ConstellationMgr::getBoundariesColor() const Vec3f ConstellationMgr::getBoundariesColor() const
{ {
return Constellation::boundaryColor; return Constellation::boundaryColor;
} }
void ConstellationMgr::setLabelsColor(const Vec3f& c) void ConstellationMgr::setLabelsColor(const Vec3f& color)
{ {
Constellation::labelColor = c; if (Constellation::labelColor != color)
{
Constellation::labelColor = color;
emit namesColorChanged(color);
}
} }
Vec3f ConstellationMgr::getLabelsColor() const Vec3f ConstellationMgr::getLabelsColor() const
{ {
return Constellation::labelColor; return Constellation::labelColor;
} }
void ConstellationMgr::setFontSize(float newFontSize) void ConstellationMgr::setFontSize(const float newFontSize)
{ {
asterFont.setPixelSize(newFontSize); if (asterFont.pixelSize() != newFontSize)
{
asterFont.setPixelSize(newFontSize);
emit fontSizeChanged(newFontSize);
}
} }
float ConstellationMgr::getFontSize() const float ConstellationMgr::getFontSize() const
{ {
return asterFont.pixelSize(); return asterFont.pixelSize();
} }
// Load line and art data from files
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" << fileNa me << "for culture" << cultureName; qWarning() << "Can't open constellation data file" << fileNa me << "for culture" << cultureName;
Q_ASSERT(0); Q_ASSERT(0);
} }
int totalRecords=0; int totalRecords=0;
skipping to change at line 322 skipping to change at line 341
while (!in.atEnd()) while (!in.atEnd())
{ {
record = QString::fromUtf8(in.readLine()); record = QString::fromUtf8(in.readLine());
currentLineNumber++; currentLineNumber++;
if (commentRx.exactMatch(record)) if (commentRx.exactMatch(record))
continue; continue;
cons = new Constellation; cons = new Constellation;
if(cons->read(record, hipStarMgr)) if(cons->read(record, hipStarMgr))
{ {
cons->artFader.setMaxValue(artMaxIntensity); cons->artFader.setMaxValue(artIntensity);
cons->setFlagArt(artDisplayed);
cons->setFlagBoundaries(boundariesDisplayed);
cons->setFlagLines(linesDisplayed);
cons->setFlagLabels(namesDisplayed);
asterisms.push_back(cons); asterisms.push_back(cons);
++readOk; ++readOk;
} }
else else
{ {
qWarning() << "ERROR reading constellation rec at li ne " << currentLineNumber << "for culture" << cultureName; qWarning() << "ERROR reading constellation rec at li ne " << currentLineNumber << "for culture" << cultureName;
delete cons; delete cons;
} }
} }
in.close(); in.close();
qDebug() << "Loaded" << readOk << "/" << totalRecords << "constellat ion records successfully for culture" << cultureName; qDebug() << "Loaded" << readOk << "/" << totalRecords << "constellat ion records successfully for culture" << cultureName;
// Set current states // Set current states
setFlagArt(flagArt); setFlagArt(artDisplayed);
setFlagLines(flagLines); setFlagLines(linesDisplayed);
setFlagLabels(flagNames); setFlagLabels(namesDisplayed);
setFlagBoundaries(flagBoundaries); setFlagBoundaries(boundariesDisplayed);
// It's possible to have no art - just constellations // It's possible to have no art - just constellations
if (artfileName.isNull() || artfileName.isEmpty()) if (artfileName.isNull() || artfileName.isEmpty())
return; return;
QFile fic(artfileName); QFile fic(artfileName);
if (!fic.open(QIODevice::ReadOnly | QIODevice::Text)) if (!fic.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
qWarning() << "Can't open constellation art file" << fileNam e << "for culture" << cultureName; qWarning() << "Can't open constellation art file" << fileNam e << "for culture" << cultureName;
return; return;
} }
skipping to change at line 675 skipping to change at line 698
void ConstellationMgr::update(double deltaTime) void ConstellationMgr::update(double deltaTime)
{ {
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
const int delta = (int)(deltaTime*1000); const int delta = (int)(deltaTime*1000);
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{ {
(*iter)->update(delta); (*iter)->update(delta);
} }
} }
void ConstellationMgr::setArtIntensity(double _max) void ConstellationMgr::setArtIntensity(const double intensity)
{ {
artMaxIntensity = _max; if (artIntensity != intensity)
vector < Constellation * >::const_iterator iter; {
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) artIntensity = intensity;
(*iter)->artFader.setMaxValue(_max); vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++it
er)
{
(*iter)->artFader.setMaxValue(artIntensity);
}
emit artIntensityChanged(intensity);
}
} }
void ConstellationMgr::setArtFadeDuration(float duration) double ConstellationMgr::getArtIntensity() const
{ {
artFadeDuration = duration; return artIntensity;
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
(*iter)->artFader.setDuration((int) (duration * 1000.f));
} }
void ConstellationMgr::setFlagLines(bool b) void ConstellationMgr::setArtFadeDuration(const float duration)
{ {
flagLines = b; if(artFadeDuration != duration)
if (selected.begin() != selected.end() && isolateSelected)
{
vector < Constellation * >::const_iterator iter;
for (iter = selected.begin(); iter != selected.end(); ++iter
)
(*iter)->setFlagLines(b);
}
else
{ {
artFadeDuration = duration;
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++it er) for (iter = asterisms.begin(); iter != asterisms.end(); ++it er)
(*iter)->setFlagLines(b); {
(*iter)->artFader.setDuration((int) (duration * 1000
.f));
}
emit artFadeDurationChanged(duration);
} }
} }
void ConstellationMgr::setFlagBoundaries(bool b) float ConstellationMgr::getArtFadeDuration() const
{ {
flagBoundaries = b; return artFadeDuration;
if (selected.begin() != selected.end() && isolateSelected)
{
vector < Constellation * >::const_iterator iter;
for (iter = selected.begin(); iter != selected.end(); ++iter
)
(*iter)->setFlagBoundaries(b);
}
else
{
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++it
er)
(*iter)->setFlagBoundaries(b);
}
} }
void ConstellationMgr::setFlagArt(bool b) void ConstellationMgr::setFlagLines(const bool displayed)
{ {
flagArt = b; if(linesDisplayed != displayed)
if (selected.begin() != selected.end() && isolateSelected)
{ {
vector < Constellation * >::const_iterator iter; linesDisplayed = displayed;
for (iter = selected.begin(); iter != selected.end(); ++iter if (selected.begin() != selected.end() && isolateSelected)
) {
(*iter)->setFlagArt(b); vector < Constellation * >::const_iterator iter;
for (iter = selected.begin(); iter != selected.end()
; ++iter)
{
(*iter)->setFlagLines(linesDisplayed);
}
}
else
{
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end
(); ++iter)
{
(*iter)->setFlagLines(linesDisplayed);
}
}
emit linesDisplayedChanged(displayed);
} }
else }
bool ConstellationMgr::getFlagLines(void) const
{
return linesDisplayed;
}
void ConstellationMgr::setFlagBoundaries(const bool displayed)
{
if (boundariesDisplayed != displayed)
{ {
vector < Constellation * >::const_iterator iter; boundariesDisplayed = displayed;
for (iter = asterisms.begin(); iter != asterisms.end(); ++it if (selected.begin() != selected.end() && isolateSelected)
er) {
(*iter)->setFlagArt(b); vector < Constellation * >::const_iterator iter;
for (iter = selected.begin(); iter != selected.end()
; ++iter)
{
(*iter)->setFlagBoundaries(boundariesDisplay
ed);
}
}
else
{
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end
(); ++iter)
{
(*iter)->setFlagBoundaries(boundariesDisplay
ed);
}
}
emit boundariesDisplayedChanged(displayed);
} }
} }
void ConstellationMgr::setFlagLabels(bool b) bool ConstellationMgr::getFlagBoundaries(void) const
{ {
flagNames = b; return boundariesDisplayed;
if (selected.begin() != selected.end() && isolateSelected) }
void ConstellationMgr::setFlagArt(const bool displayed)
{
if (artDisplayed != displayed)
{ {
vector < Constellation * >::const_iterator iter; artDisplayed = displayed;
for (iter = selected.begin(); iter != selected.end(); ++iter if (selected.begin() != selected.end() && isolateSelected)
) {
(*iter)->setFlagName(b); vector < Constellation * >::const_iterator iter;
for (iter = selected.begin(); iter != selected.end()
; ++iter)
{
(*iter)->setFlagArt(artDisplayed);
}
}
else
{
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end
(); ++iter)
{
(*iter)->setFlagArt(artDisplayed);
}
}
emit artDisplayedChanged(displayed);
} }
else }
bool ConstellationMgr::getFlagArt(void) const
{
return artDisplayed;
}
void ConstellationMgr::setFlagLabels(bool displayed)
{
if (namesDisplayed != displayed)
{ {
vector < Constellation * >::const_iterator iter; namesDisplayed = displayed;
for (iter = asterisms.begin(); iter != asterisms.end(); ++it if (selected.begin() != selected.end() && isolateSelected)
er) {
(*iter)->setFlagName(b); vector < Constellation * >::const_iterator iter;
for (iter = selected.begin(); iter != selected.end()
; ++iter)
(*iter)->setFlagLabels(namesDisplayed);
}
else
{
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end
(); ++iter)
(*iter)->setFlagLabels(namesDisplayed);
}
emit namesDisplayedChanged(displayed);
} }
} }
void ConstellationMgr::setFlagIsolateSelected(bool s) bool ConstellationMgr::getFlagLabels(void) const
{ {
isolateSelected = s; return namesDisplayed;
}
// when turning off isolated selection mode, clear exisiting isolate void ConstellationMgr::setFlagIsolateSelected(const bool isolate)
d selections. {
if (!s) if (isolateSelected != isolate)
{ {
vector < Constellation * >::const_iterator iter; isolateSelected = isolate;
for (iter = asterisms.begin(); iter != asterisms.end(); ++it
er) // when turning off isolated selection mode, clear exisiting
isolated selections.
if (!isolateSelected)
{ {
(*iter)->setFlagLines(getFlagLines()); vector < Constellation * >::const_iterator iter;
(*iter)->setFlagName(getFlagLabels()); for (iter = asterisms.begin(); iter != asterisms.end
(*iter)->setFlagArt(getFlagArt()); (); ++iter)
(*iter)->setFlagBoundaries(getFlagBoundaries()); {
(*iter)->setFlagLines(getFlagLines());
(*iter)->setFlagLabels(getFlagLabels());
(*iter)->setFlagArt(getFlagArt());
(*iter)->setFlagBoundaries(getFlagBoundaries
());
}
} }
emit isolateSelectedChanged(isolate);
} }
} }
bool ConstellationMgr::getFlagIsolateSelected(void) const
{
return isolateSelected;
}
StelObject* ConstellationMgr::getSelected(void) const { StelObject* ConstellationMgr::getSelected(void) const {
return *selected.begin(); // TODO return all or just remove this me thod return *selected.begin(); // TODO return all or just remove this me thod
} }
void ConstellationMgr::setSelected(const QString& abbreviation) void ConstellationMgr::setSelected(const QString& abbreviation)
{ {
Constellation * c = findFromAbbreviation(abbreviation); Constellation * c = findFromAbbreviation(abbreviation);
if(c != NULL) setSelectedConst(c); if(c != NULL) setSelectedConst(c);
} }
StelObjectP ConstellationMgr::setSelectedStar(const QString& abbreviation) StelObjectP ConstellationMgr::setSelectedStar(const QString& abbreviation)
{ {
Constellation * c = findFromAbbreviation(abbreviation); Constellation * c = findFromAbbreviation(abbreviation);
if(c != NULL) { if(c != NULL)
{
setSelectedConst(c); setSelectedConst(c);
return c->getBrightestStarInConstellation(); return c->getBrightestStarInConstellation();
} }
return NULL; return NULL;
} }
void ConstellationMgr::setSelectedConst(Constellation * c) void ConstellationMgr::setSelectedConst(Constellation * c)
{ {
// update states for other constellations to fade them out // update states for other constellations to fade them out
if (c != NULL) if (c != NULL)
{ {
selected.push_back(c); selected.push_back(c);
// Propagate current settings to newly selected constellatio n // Propagate current settings to newly selected constellatio n
c->setFlagLines(getFlagLines()); c->setFlagLines(getFlagLines());
c->setFlagName(getFlagLabels()); c->setFlagLabels(getFlagLabels());
c->setFlagArt(getFlagArt()); c->setFlagArt(getFlagArt());
c->setFlagBoundaries(getFlagBoundaries()); c->setFlagBoundaries(getFlagBoundaries());
if (isolateSelected) if (isolateSelected)
{ {
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)
{ {
bool match = 0; bool match = 0;
skipping to change at line 831 skipping to change at line 934
{ {
match=true; // this is a sel ected constellation match=true; // this is a sel ected constellation
break; break;
} }
} }
if(!match) if(!match)
{ {
// Not selected constellation // Not selected constellation
(*iter)->setFlagLines(false); (*iter)->setFlagLines(false);
(*iter)->setFlagName(false); (*iter)->setFlagLabels(false);
(*iter)->setFlagArt(false); (*iter)->setFlagArt(false);
(*iter)->setFlagBoundaries(false); (*iter)->setFlagBoundaries(false);
} }
} }
Constellation::singleSelected = true; // For bounda ries Constellation::singleSelected = true; // For bounda ries
} }
else else
Constellation::singleSelected = false; // For bounda ries Constellation::singleSelected = false; // For bounda ries
} }
else else
{ {
if (selected.begin() == selected.end()) return; if (selected.begin() == selected.end()) return;
// Otherwise apply standard flags to all constellations // Otherwise apply standard flags to all constellations
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++it er) for (iter = asterisms.begin(); iter != asterisms.end(); ++it er)
{ {
(*iter)->setFlagLines(getFlagLines()); (*iter)->setFlagLines(getFlagLines());
(*iter)->setFlagName(getFlagLabels()); (*iter)->setFlagLabels(getFlagLabels());
(*iter)->setFlagArt(getFlagArt()); (*iter)->setFlagArt(getFlagArt());
(*iter)->setFlagBoundaries(getFlagBoundaries()); (*iter)->setFlagBoundaries(getFlagBoundaries());
} }
// And remove all selections // And remove all selections
selected.clear(); selected.clear();
} }
} }
skipping to change at line 881 skipping to change at line 984
if( (*iter)->getEnglishName() == c->getEnglishName() ) if( (*iter)->getEnglishName() == c->getEnglishName() )
{ {
selected.erase(selected.begin()+n, selected. begin()+n+1); selected.erase(selected.begin()+n, selected. begin()+n+1);
iter--; iter--;
n--; n--;
} }
n++; n++;
} }
// If no longer any selection, restore all flags on all cons tellations // If no longer any selection, restore all flags on all cons tellations
if (selected.begin() == selected.end()) { if (selected.begin() == selected.end())
{
// Otherwise apply standard flags to all constellati ons // Otherwise apply standard flags to all constellati ons
for (iter = asterisms.begin(); iter != asterisms.end (); ++iter) for (iter = asterisms.begin(); iter != asterisms.end (); ++iter)
{ {
(*iter)->setFlagLines(getFlagLines()); (*iter)->setFlagLines(getFlagLines());
(*iter)->setFlagName(getFlagLabels()); (*iter)->setFlagLabels(getFlagLabels());
(*iter)->setFlagArt(getFlagArt()); (*iter)->setFlagArt(getFlagArt());
(*iter)->setFlagBoundaries(getFlagBoundaries ()); (*iter)->setFlagBoundaries(getFlagBoundaries ());
} }
Constellation::singleSelected = false; // For bounda ries Constellation::singleSelected = false; // For bounda ries
} else if(isolateSelected) { }
else if(isolateSelected)
{
// No longer selected constellation // No longer selected constellation
c->setFlagLines(false); c->setFlagLines(false);
c->setFlagName(false); c->setFlagLabels(false);
c->setFlagArt(false); c->setFlagArt(false);
c->setFlagBoundaries(false); c->setFlagBoundaries(false);
Constellation::singleSelected = true; // For bounda ries Constellation::singleSelected = true; // For bounda ries
} }
} }
} }
bool ConstellationMgr::loadBoundaries(const QString& boundaryFile) bool ConstellationMgr::loadBoundaries(const QString& boundaryFile)
{ {
skipping to change at line 933 skipping to change at line 1039
// http://pp3.sourceforge.net // http://pp3.sourceforge.net
QFile dataFile(boundaryFile); QFile dataFile(boundaryFile);
if (!dataFile.open(QIODevice::ReadOnly | QIODevice::Text)) if (!dataFile.open(QIODevice::ReadOnly | QIODevice::Text))
{ {
qWarning() << "Boundary file " << boundaryFile << " not foun d"; qWarning() << "Boundary file " << boundaryFile << " not foun d";
return false; return false;
} }
QTextStream istr(&dataFile); QTextStream istr(&dataFile);
float DE, RA; float DE, RA;
float oDE, oRA;
Vec3f XYZ; Vec3f XYZ;
unsigned num, numc; unsigned num, numc;
vector<Vec3f> *points = NULL; vector<Vec3f> *points = NULL;
QString consname; QString consname;
i = 0; i = 0;
while (!istr.atEnd()) while (!istr.atEnd())
{ {
points = new vector<Vec3f>; points = new vector<Vec3f>;
num = 0; num = 0;
istr >> num; istr >> num;
if(num == 0) continue; // empty line if(num == 0) continue; // empty line
for (j=0;j<num;j++) for (j=0;j<num;j++)
{ {
istr >> RA >> DE; istr >> RA >> DE;
oRA =RA;
oDE= DE;
RA*=M_PI/12.; // Convert from hours to rad RA*=M_PI/12.; // Convert from hours to rad
DE*=M_PI/180.; // Convert from deg to rad DE*=M_PI/180.; // Convert from deg to rad
// Calc the Cartesian coord with RA and DE // Calc the Cartesian coord with RA and DE
StelUtils::spheToRect(RA,DE,XYZ); StelUtils::spheToRect(RA,DE,XYZ);
points->push_back(XYZ); points->push_back(XYZ);
} }
// this list is for the de-allocation // this list is for the de-allocation
allBoundarySegments.push_back(points); allBoundarySegments.push_back(points);
skipping to change at line 1010 skipping to change at line 1112
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)->drawBoundaryOptim(sPainter); (*iter)->drawBoundaryOptim(sPainter);
} }
#ifndef USE_OPENGL_ES2 #ifndef USE_OPENGL_ES2
glDisable(GL_LINE_STIPPLE); glDisable(GL_LINE_STIPPLE);
#endif #endif
} }
///unsigned int ConstellationMgr::getFirstSelectedHP(void) {
/// if (selected) return selected->asterism[0]->get_hp_number();
/// return 0;
///}
StelObjectP ConstellationMgr::searchByNameI18n(const QString& nameI18n) con st StelObjectP ConstellationMgr::searchByNameI18n(const QString& nameI18n) con st
{ {
QString objw = nameI18n.toUpper(); QString objw = nameI18n.toUpper();
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)
{ {
QString objwcap = (*iter)->nameI18.toUpper(); QString objwcap = (*iter)->nameI18.toUpper();
if (objwcap==objw) return *iter; if (objwcap==objw) return *iter;
} }
 End of changes. 55 change blocks. 
114 lines changed or deleted 217 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/