ConstellationMgr.cpp   ConstellationMgr.cpp 
skipping to change at line 36 skipping to change at line 36
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#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"
#include "SolarSystem.hpp"
#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>
#include <QDir> #include <QDir>
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),
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)
{ {
setObjectName("ConstellationMgr"); setObjectName("ConstellationMgr");
Q_ASSERT(hipStarMgr); Q_ASSERT(hipStarMgr);
isolateSelected = false; isolateSelected = false;
skipping to change at line 93 skipping to change at line 95
Q_ASSERT(conf); Q_ASSERT(conf);
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 setFlagIsolateSelected(conf->value("viewing/flag_constellation_isola
te_selected", te_selected", false).toBool());
conf->value("viewing/flag_constellation_pick" setFlagConstellationPick(conf->value("viewing/flag_constellation_pic
, false).toBool() ).toBool()); k", false).toBool());
QString starloreDisplayStyle=conf->value("viewing/constellation_name
_style", "translated").toString();
if (starloreDisplayStyle=="translated")
{
setConstellationDisplayStyle(constellationsTranslated);
}
else if (starloreDisplayStyle=="native")
{
setConstellationDisplayStyle(constellationsNative);
}
else if (starloreDisplayStyle=="abbreviated")
{
setConstellationDisplayStyle(constellationsAbbreviated);
}
else if (starloreDisplayStyle=="english")
{
setConstellationDisplayStyle(constellationsEnglish);
}
else
{
qDebug() << "Warning: viewing/constellation_name_style (" <<
starloreDisplayStyle << ") invalid. Using translated style.";
conf->setValue("viewing/constellation_name_style", "translat
ed");
setConstellationDisplayStyle(constellationsTranslated);
}
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 133 skipping to change at line 159
{ {
// Check if the sky culture changed since last load, if not don't lo ad anything // Check if the sky culture changed since last load, if not don't lo ad anything
if (lastLoadedSkyCulture == skyCultureDir) if (lastLoadedSkyCulture == skyCultureDir)
return; return;
// Find constellation art. If this doesn't exist, warn, but continu e using "" // Find constellation art. If this doesn't exist, warn, but continu e using ""
// the loadLinesAndArt function knows how to handle this (just loads lines). // the loadLinesAndArt function knows how to handle this (just loads lines).
QString conArtFile = StelFileMgr::findFile("skycultures/"+skyCulture Dir+"/constellationsart.fab"); QString conArtFile = StelFileMgr::findFile("skycultures/"+skyCulture Dir+"/constellationsart.fab");
if (conArtFile.isEmpty()) if (conArtFile.isEmpty())
{ {
qDebug() << "No constellationsart.fab file found for sky cul ture " << QDir::toNativeSeparators(skyCultureDir); qDebug() << "No constellationsart.fab file found for sky cul ture dir" << QDir::toNativeSeparators(skyCultureDir);
} }
// first of all, remove constellations from the list of selected obj ects in StelObjectMgr, since we are going to delete them // first of all, remove constellations from the list of selected obj ects in StelObjectMgr, since we are going to delete them
deselectConstellations(); deselectConstellations();
QString fic = StelFileMgr::findFile("skycultures/"+skyCultureDir+"/c onstellationship.fab"); QString fic = StelFileMgr::findFile("skycultures/"+skyCultureDir+"/c onstellationship.fab");
if (fic.isEmpty()) if (fic.isEmpty())
qWarning() << "ERROR loading constellation lines and art fro m file: " << fic; qWarning() << "ERROR loading constellation lines and art fro m file: " << fic;
else else
loadLinesAndArt(fic, conArtFile, skyCultureDir); loadLinesAndArt(fic, conArtFile, skyCultureDir);
skipping to change at line 159 skipping to change at line 185
else else
loadNames(fic); loadNames(fic);
// load seasonal rules // load seasonal rules
loadSeasonalRules(StelFileMgr::findFile("skycultures/" + skyCultureD ir + "/seasonal_rules.fab")); loadSeasonalRules(StelFileMgr::findFile("skycultures/" + skyCultureD ir + "/seasonal_rules.fab"));
// Translate constellation names for the new sky culture // Translate constellation names for the new sky culture
updateI18n(); updateI18n();
// load constellation boundaries // load constellation boundaries
// First try load constellation boundaries from sky culture // First try loading constellation boundaries from sky culture. You may inhibit borders with an empty file.
fic = StelFileMgr::findFile("skycultures/" + skyCultureDir + "/const ellations_boundaries.dat"); fic = StelFileMgr::findFile("skycultures/" + skyCultureDir + "/const ellations_boundaries.dat");
bool existBoundaries = false; bool existBoundaries = false;
if (fic.isEmpty()) if (fic.isEmpty())
{ {
qWarning() << "ERROR loading constellation boundaries file i n sky culture: " << skyCultureDir; qWarning() << "No separate constellation boundaries file in sky culture dir" << skyCultureDir << "- Using generic IAU boundaries.";
// OK, Second try load generic constellation boundaries // OK, Second try load generic constellation boundaries
fic = StelFileMgr::findFile("data/constellations_boundaries. dat"); fic = StelFileMgr::findFile("data/constellations_boundaries. dat");
if (fic.isEmpty()) if (fic.isEmpty())
qWarning() << "ERROR loading main constellation boun daries file: " << fic; qWarning() << "ERROR loading main constellation boun daries file: " << fic;
else else
existBoundaries = true; existBoundaries = true;
} }
else else
existBoundaries = true; existBoundaries = true;
skipping to change at line 314 skipping to change at line 340
asterFont.setPixelSize(newFontSize); asterFont.setPixelSize(newFontSize);
emit fontSizeChanged(newFontSize); emit fontSizeChanged(newFontSize);
} }
} }
float ConstellationMgr::getFontSize() const float ConstellationMgr::getFontSize() const
{ {
return asterFont.pixelSize(); return asterFont.pixelSize();
} }
void ConstellationMgr::setConstellationDisplayStyle(int style)
{
constellationDisplayStyle=(ConstellationMgr::ConstellationDisplaySty
le) style;
if (constellationDisplayStyle==constellationsTranslated)
GETSTELMODULE(SolarSystem)->setFlagTranslatedNames(true);
else
GETSTELMODULE(SolarSystem)->setFlagTranslatedNames(false);
emit constellationsDisplayStyleChanged(constellationDisplayStyle);
}
QString ConstellationMgr::getConstellationDisplayStyleString()
{
ConstellationDisplayStyle displayStyle = getConstellationDisplayStyl
e();
return (displayStyle == constellationsAbbreviated ? "abbreviated" :
(displayStyle == constellationsNative ? "native" : "translated"));
}
ConstellationMgr::ConstellationDisplayStyle ConstellationMgr::getConstellat
ionDisplayStyle()
{
return constellationDisplayStyle;
}
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 342 skipping to change at line 390
in.seek(0); in.seek(0);
// delete existing data, if any // delete existing data, if any
vector < Constellation * >::iterator iter; vector < Constellation * >::iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
delete(*iter); delete(*iter);
asterisms.clear(); asterisms.clear();
Constellation *cons = NULL; Constellation *cons = NULL;
// read the file, adding a record per non-comment line // read the file of line patterns, adding a record per non-comment l ine
int currentLineNumber = 0; // line in file int currentLineNumber = 0; // line in file
int readOk = 0; // count of records processed OK int readOk = 0; // count of records processed OK
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;
skipping to change at line 365 skipping to change at line 413
cons->artFader.setMaxValue(artIntensity); cons->artFader.setMaxValue(artIntensity);
cons->setFlagArt(artDisplayed); cons->setFlagArt(artDisplayed);
cons->setFlagBoundaries(boundariesDisplayed); cons->setFlagBoundaries(boundariesDisplayed);
cons->setFlagLines(linesDisplayed); cons->setFlagLines(linesDisplayed);
cons->setFlagLabels(namesDisplayed); 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 lines rec ord at line " << 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(artDisplayed); setFlagArt(artDisplayed);
setFlagLines(linesDisplayed); setFlagLines(linesDisplayed);
setFlagLabels(namesDisplayed); setFlagLabels(namesDisplayed);
skipping to change at line 565 skipping to change at line 613
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++)
{ {
// Check if in the field of view // Check if in the field of view
if (sPainter.getProjector()->projectCheck((*iter)->XYZname, (*iter)->XYname)) if (sPainter.getProjector()->projectCheck((*iter)->XYZname, (*iter)->XYname))
(*iter)->drawName(sPainter); (*iter)->drawName(sPainter, constellationDisplayStyl e);
} }
} }
Constellation *ConstellationMgr::isStarIn(const StelObject* s) const Constellation *ConstellationMgr::isStarIn(const StelObject* s) const
{ {
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)
{ {
// Check if the star is in one of the constellation // Check if the star is in one of the constellation
if ((*iter)->isStarIn(s)) if ((*iter)->isStarIn(s))
{ {
return (*iter); return (*iter);
} }
} }
return NULL; return NULL;
} }
Constellation* ConstellationMgr::findFromAbbreviation(const QString& abbrev iation) const Constellation* ConstellationMgr::findFromAbbreviation(const QString& abbrev iation) const
{ {
// search in uppercase only // search in uppercase only
QString tname = abbreviation.toUpper(); //QString tname = abbreviation.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)
{ {
if ((*iter)->abbreviation == tname) //if ((*iter)->abbreviation.toUpper() == tname)
if ((*iter)->abbreviation.compare(abbreviation, Qt::CaseInse
nsitive) == 0)
{
//if ((*iter)->abbreviation != abbreviation)
// qDebug() << "ConstellationMgr::findFromAbbre
viation: not a perfect match, but sufficient:" << (*iter)->abbreviation <<
"vs." << abbreviation;
return (*iter); return (*iter);
}
//else qDebug() << "Comparison mismatch: " << abbreviation <
< "vs." << (*iter)->abbreviation;
} }
return NULL; return NULL;
} }
// Can't find constellation from a position because it's not well localized // Can't find constellation from a position because it's not well localized
QList<StelObjectP> ConstellationMgr::searchAround(const Vec3d&, double, con st StelCore*) const QList<StelObjectP> ConstellationMgr::searchAround(const Vec3d&, double, con st StelCore*) const
{ {
return QList<StelObjectP>(); return QList<StelObjectP>();
} }
skipping to change at line 629 skipping to change at line 683
qDebug() << "Cannot open file" << QDir::toNativeSeparators(n amesFile); qDebug() << "Cannot open file" << QDir::toNativeSeparators(n amesFile);
return; return;
} }
// Now parse the file // Now parse the file
// lines to ignore which start with a # or are empty // lines to ignore which start with a # or are empty
QRegExp commentRx("^(\\s*#.*|\\s*)$"); QRegExp commentRx("^(\\s*#.*|\\s*)$");
// lines which look like records - we use the RE to extract the fiel ds // lines which look like records - we use the RE to extract the fiel ds
// which will be available in recRx.capturedTexts() // which will be available in recRx.capturedTexts()
QRegExp recRx("^\\s*(\\w+)\\s+\"(.*)\"\\s+_[(]\"(.*)\"[)]\\n"); // abbreviation is allowed to start with a dot to mark as "hidden".
QRegExp recRx("^\\s*(\\.?\\w+)\\s+\"(.*)\"\\s+_[(]\"(.*)\"[)]\\n");
// Some more variables to use in the parsing // Some more variables to use in the parsing
Constellation *aster; Constellation *aster;
QString record, shortName; QString record, shortName;
// keep track of how many records we processed. // keep track of how many records we processed.
int totalRecords=0; int totalRecords=0;
int readOk=0; int readOk=0;
int lineNumber=0; int lineNumber=0;
while (!commonNameFile.atEnd()) while (!commonNameFile.atEnd())
skipping to change at line 652 skipping to change at line 707
lineNumber++; lineNumber++;
// Skip comments // Skip comments
if (commentRx.exactMatch(record)) if (commentRx.exactMatch(record))
continue; continue;
totalRecords++; totalRecords++;
if (!recRx.exactMatch(record)) if (!recRx.exactMatch(record))
{ {
qWarning() << "ERROR - cannot parse record at line" << lineNumber << "in constellation names file" << QDir::toNativeSeparators( namesFile); qWarning() << "ERROR - cannot parse record at line" << lineNumber << "in constellation names file" << QDir::toNativeSeparators( namesFile) << ":" << record;
} }
else else
{ {
shortName = recRx.capturedTexts().at(1); shortName = recRx.capturedTexts().at(1);
aster = findFromAbbreviation(shortName); aster = findFromAbbreviation(shortName);
// If the constellation exists, set the English name // If the constellation exists, set the English name
if (aster != NULL) if (aster != NULL)
{ {
aster->nativeName = recRx.capturedTexts().at (2); aster->nativeName = recRx.capturedTexts().at (2);
aster->englishName = recRx.capturedTexts().a t(3); aster->englishName = recRx.capturedTexts().a t(3);
readOk++; readOk++;
// Some skycultures already have empty nativ
eNames. Fill those.
if (aster->nativeName.isEmpty())
aster->nativeName=aster->englishName
;
} }
else else
{ {
qWarning() << "WARNING - constellation abbre viation" << shortName << "not found when loading constellation names"; qWarning() << "WARNING - constellation abbre viation" << shortName << "not found when loading constellation names";
} }
} }
} }
commonNameFile.close(); commonNameFile.close();
qDebug() << "Loaded" << readOk << "/" << totalRecords << "constellat ion names"; qDebug() << "Loaded" << readOk << "/" << totalRecords << "constellat ion names";
} }
skipping to change at line 904 skipping to change at line 962
} }
emit artDisplayedChanged(displayed); emit artDisplayedChanged(displayed);
} }
} }
bool ConstellationMgr::getFlagArt(void) const bool ConstellationMgr::getFlagArt(void) const
{ {
return artDisplayed; return artDisplayed;
} }
void ConstellationMgr::setFlagLabels(bool displayed) void ConstellationMgr::setFlagLabels(const bool displayed)
{ {
if (namesDisplayed != displayed) if (namesDisplayed != displayed)
{ {
namesDisplayed = displayed; namesDisplayed = displayed;
if (selected.begin() != selected.end() && isolateSelected) if (selected.begin() != selected.end() && isolateSelected)
{ {
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = selected.begin(); iter != selected.end() ; ++iter) for (iter = selected.begin(); iter != selected.end() ; ++iter)
(*iter)->setFlagLabels(namesDisplayed); (*iter)->setFlagLabels(namesDisplayed);
} }
skipping to change at line 957 skipping to change at line 1015
} }
emit isolateSelectedChanged(isolate); emit isolateSelectedChanged(isolate);
} }
} }
bool ConstellationMgr::getFlagIsolateSelected(void) const bool ConstellationMgr::getFlagIsolateSelected(void) const
{ {
return isolateSelected; return isolateSelected;
} }
StelObject* ConstellationMgr::getSelected(void) const { void ConstellationMgr::setFlagConstellationPick(const bool mode)
{
constellationPickEnabled = mode;
}
bool ConstellationMgr::getFlagConstellationPick(void) const
{
return constellationPickEnabled;
}
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)
skipping to change at line 985 skipping to change at line 1054
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
c->setFlagLines(getFlagLines());
c->setFlagLabels(getFlagLabels());
c->setFlagArt(getFlagArt());
c->setFlagBoundaries(getFlagBoundaries());
if (isolateSelected) if (isolateSelected)
{ {
vector < Constellation * >::const_iterator iter; if (!getFlagConstellationPick())
for (iter = asterisms.begin(); iter != asterisms.end
(); ++iter)
{ {
// Propagate current settings to newly selec
ted constellation
c->setFlagLines(getFlagLines());
c->setFlagLabels(getFlagLabels());
c->setFlagArt(getFlagArt());
c->setFlagBoundaries(getFlagBoundaries());
bool match = 0; vector < Constellation * >::const_iterator i
vector < Constellation * >::const_iterator s ter;
_iter; for (iter = asterisms.begin(); iter != aster
for (s_iter = selected.begin(); s_iter != se isms.end(); ++iter)
lected.end(); ++s_iter)
{ {
if( (*iter)==(*s_iter) ) bool match = false;
vector < Constellation * >::const_it
erator s_iter;
for (s_iter = selected.begin(); s_it
er != selected.end(); ++s_iter)
{ {
match=true; // this is a sel if( (*iter)==(*s_iter) )
ected constellation {
break; match=true; // this
is a selected constellation
break;
}
} }
}
if(!match) if(!match)
{
// Not selected constellatio
n
(*iter)->setFlagLines(false)
;
(*iter)->setFlagLabels(false
);
(*iter)->setFlagArt(false);
(*iter)->setFlagBoundaries(f
alse);
}
}
}
else
{
vector < Constellation * >::const_iterator i
ter;
for (iter = asterisms.begin(); iter != aster
isms.end(); ++iter)
{ {
// Not selected constellation
(*iter)->setFlagLines(false); (*iter)->setFlagLines(false);
(*iter)->setFlagLabels(false); (*iter)->setFlagLabels(false);
(*iter)->setFlagArt(false); (*iter)->setFlagArt(false);
(*iter)->setFlagBoundaries(false); (*iter)->setFlagBoundaries(false);
} }
}
Constellation::singleSelected = true; // For bounda // Propagate current settings to newly selec
ries ted constellation
c->setFlagLines(getFlagLines());
c->setFlagLabels(getFlagLabels());
c->setFlagArt(getFlagArt());
c->setFlagBoundaries(getFlagBoundaries());
} }
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)->setFlagLabels(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();
} }
} }
//! Remove a constellation from the selected constellation list //! Remove a constellation from the selected constellation list
void ConstellationMgr::unsetSelectedConst(Constellation * c) void ConstellationMgr::unsetSelectedConst(Constellation * c)
{ {
if (c != NULL) if (c != NULL)
{ {
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
skipping to change at line 1225 skipping to change at line 1313
QString cn; QString cn;
bool find; bool find;
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)
{ {
cn = (*iter)->getNameI18n(); cn = (*iter)->getNameI18n();
find = false; find = false;
if (useStartOfWords) if (useStartOfWords)
{ {
if (objPrefix.toUpper()==cn.mid(0, objPrefix.size()) //if (objPrefix.toUpper()==cn.mid(0, objPrefix.size(
.toUpper()) )).toUpper()) // WHY SO LONG?
if (cn.startsWith(objPrefix, Qt::CaseInsensitive))
find = true; find = true;
} }
else else
{ {
if (cn.contains(objPrefix,Qt::CaseInsensitive)) if (cn.contains(objPrefix,Qt::CaseInsensitive))
find = true; find = true;
} }
if (find) if (find)
{ {
result << cn; result << cn;
skipping to change at line 1257 skipping to change at line 1346
QString cn; QString cn;
bool find; bool find;
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)
{ {
cn = (*iter)->getEnglishName(); cn = (*iter)->getEnglishName();
find = false; find = false;
if (useStartOfWords) if (useStartOfWords)
{ {
if (objPrefix.toUpper()==cn.mid(0, objPrefix.size()) //if (objPrefix.toUpper()==cn.mid(0, objPrefix.size(
.toUpper()) )).toUpper()) // WHY SO LONG?
if (cn.startsWith(objPrefix, Qt::CaseInsensitive))
find = true; find = true;
} }
else else
{ {
if (cn.contains(objPrefix,Qt::CaseInsensitive)) if (cn.contains(objPrefix,Qt::CaseInsensitive))
find = true; find = true;
} }
if (find) if (find)
{ {
result << cn; result << cn;
 End of changes. 32 change blocks. 
47 lines changed or deleted 158 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/