ConstellationMgr.cpp   ConstellationMgr.cpp 
skipping to change at line 53 skipping to change at line 53
#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),
isolateSelected(false),
constellationPickEnabled(false),
constellationDisplayStyle(ConstellationMgr::constellationsTranslat ed), constellationDisplayStyle(ConstellationMgr::constellationsTranslat ed),
artFadeDuration(1.), artFadeDuration(2.),
artIntensity(0), artIntensity(0),
artIntensityMinimumFov(1.0), artIntensityMinimumFov(1.0),
artIntensityMaximumFov(2.0), artIntensityMaximumFov(2.0),
artDisplayed(0), artDisplayed(0),
boundariesDisplayed(0), boundariesDisplayed(0),
linesDisplayed(0), linesDisplayed(0),
namesDisplayed(0), namesDisplayed(0),
constellationLineThickness(1.) constellationLineThickness(1.)
{ {
setObjectName("ConstellationMgr"); setObjectName("ConstellationMgr");
Q_ASSERT(hipStarMgr); Q_ASSERT(hipStarMgr);
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 148 skipping to change at line 148
StelApp *app = &StelApp::getInstance(); StelApp *app = &StelApp::getInstance();
connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n())); connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
connect(&app->getSkyCultureMgr(), SIGNAL(currentSkyCultureChanged(QS tring)), this, SLOT(updateSkyCulture(const QString&))); connect(&app->getSkyCultureMgr(), SIGNAL(currentSkyCultureChanged(QS tring)), this, SLOT(updateSkyCulture(const QString&)));
QString displayGroup = N_("Display Options"); QString displayGroup = N_("Display Options");
addAction("actionShow_Constellation_Lines", displayGroup, N_("Conste llation lines"), "linesDisplayed", "C"); addAction("actionShow_Constellation_Lines", displayGroup, N_("Conste llation lines"), "linesDisplayed", "C");
addAction("actionShow_Constellation_Art", displayGroup, N_("Constell ation art"), "artDisplayed", "R"); addAction("actionShow_Constellation_Art", displayGroup, N_("Constell ation art"), "artDisplayed", "R");
addAction("actionShow_Constellation_Labels", displayGroup, N_("Const ellation labels"), "namesDisplayed", "V"); addAction("actionShow_Constellation_Labels", displayGroup, N_("Const ellation labels"), "namesDisplayed", "V");
addAction("actionShow_Constellation_Boundaries", displayGroup, N_("C onstellation boundaries"), "boundariesDisplayed", "B"); addAction("actionShow_Constellation_Boundaries", displayGroup, N_("C onstellation boundaries"), "boundariesDisplayed", "B");
addAction("actionShow_Constellation_Isolated", displayGroup, N_("Sel ect single constellation"), "isolateSelected"); // no shortcut, sync with G UI addAction("actionShow_Constellation_Isolated", displayGroup, N_("Sel ect single constellation"), "isolateSelected"); // no shortcut, sync with G UI
addAction("actionShow_Constellation_Deselect", displayGroup, N_("Rem ove selection of constellations"), this, "deselectConstellations()", "Tab") ;
} }
/************************************************************************* /*************************************************************************
Reimplementation of the getCallOrder method Reimplementation of the getCallOrder method
*************************************************************************/ *************************************************************************/
double ConstellationMgr::getCallOrder(StelModuleActionName actionName) cons t double ConstellationMgr::getCallOrder(StelModuleActionName actionName) cons t
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("Grid LinesMgr")->getCallOrder(actionName)+10; return StelApp::getInstance().getModuleMgr().getModule("Grid LinesMgr")->getCallOrder(actionName)+10;
return 0; return 0;
skipping to change at line 197 skipping to change at line 198
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 loading constellation boundaries from sky culture. You StelApp *app = &StelApp::getInstance();
may inhibit borders with an empty file. int idx = app->getSkyCultureMgr().getCurrentSkyCultureBoundariesIdx(
fic = StelFileMgr::findFile("skycultures/" + skyCultureDir + "/const );
ellations_boundaries.dat"); if (idx>=0)
bool existBoundaries = false;
if (fic.isEmpty())
{ {
qWarning() << "No separate constellation boundaries file in // OK, the current sky culture has boundaries!
sky culture dir" << skyCultureDir << "- Using generic IAU boundaries."; if (idx==1)
// OK, Second try load generic constellation boundaries {
fic = StelFileMgr::findFile("data/constellations_boundaries. // boundaries = own
dat"); fic = StelFileMgr::findFile("skycultures/" + skyCult
ureDir + "/constellations_boundaries.dat");
}
else
{
// boundaries = generic
fic = StelFileMgr::findFile("data/constellations_bou
ndaries.dat");
}
if (fic.isEmpty()) if (fic.isEmpty())
qWarning() << "ERROR loading main constellation boun daries file: " << fic; qWarning() << "ERROR loading constellation boundarie s file: " << fic;
else else
existBoundaries = true; loadBoundaries(fic);
}
else
existBoundaries = true;
if (existBoundaries) }
loadBoundaries(fic);
lastLoadedSkyCulture = skyCultureDir; lastLoadedSkyCulture = skyCultureDir;
} }
void ConstellationMgr::selectedObjectChange(StelModule::StelModuleSelectAct ion action) void ConstellationMgr::selectedObjectChange(StelModule::StelModuleSelectAct ion action)
{ {
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
Q_ASSERT(omgr); Q_ASSERT(omgr);
const QList<StelObjectP> newSelected = omgr->getSelectedObject(); const QList<StelObjectP> newSelected = omgr->getSelectedObject();
if (newSelected.empty()) if (newSelected.empty())
skipping to change at line 248 skipping to change at line 253
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 QList<StelObjectP> newSelectedObject;
Object("Star"); if (StelApp::getInstance().getSkyCultureMgr().getCurrentSkyC
if (!newSelectedStar.empty()) ultureBoundariesIdx()==0) // generic IAU boundaries
newSelectedObject = omgr->getSelectedObject();
else
newSelectedObject = omgr->getSelectedObject("Star");
if (!newSelectedObject.empty())
{ {
// if (!added) setSelected(newSelectedObject[0].data());
// setSelected(NULL);
setSelected(newSelectedStar[0].data());
} }
else else
{ {
// if (!added) setSelected(NULL);
setSelected(NULL);
} }
} }
} }
void ConstellationMgr::deselectConstellations(void) void ConstellationMgr::deselectConstellations(void)
{ {
selected.clear(); selected.clear();
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
Q_ASSERT(omgr); Q_ASSERT(omgr);
const QList<StelObjectP> currSelection = omgr->getSelectedObject(); const QList<StelObjectP> currSelection = omgr->getSelectedObject();
skipping to change at line 419 skipping to change at line 426
{ {
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(artIntensity); cons->artFader.setMaxValue(artIntensity);
cons->artFader.setDuration((int) (artFadeDuration * 1000.f));
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 lines rec ord at line " << currentLineNumber << "for culture" << cultureName; qWarning() << "ERROR reading constellation lines rec ord at line " << currentLineNumber << "for culture" << cultureName;
skipping to change at line 1404 skipping to change at line 1412
} }
else else
{ {
foreach(Constellation* constellation, asterisms) foreach(Constellation* constellation, asterisms)
{ {
result << constellation->getNameI18n(); result << constellation->getNameI18n();
} }
} }
return result; return result;
} }
void ConstellationMgr::setSelected(const StelObject *s)
{
if (!s)
setSelectedConst(NULL);
else
{
if (StelApp::getInstance().getSkyCultureMgr().getCurrentSkyC
ultureBoundariesIdx()==0) // generic IAU boundaries
setSelectedConst(isObjectIn(s));
else
setSelectedConst(isStarIn(s));
}
}
Constellation* ConstellationMgr::isObjectIn(const StelObject *s) const
{
StelCore *core = StelApp::getInstance().getCore();
QString IAUConst = core->getIAUConstellation(s->getJ2000EquatorialPo
s(core));
vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{
// Check if the object is in the constellation
if ((*iter)->getShortName().toUpper()==IAUConst.toUpper())
return (*iter);
}
return NULL;
}
 End of changes. 14 change blocks. 
29 lines changed or deleted 36 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/