StarMgr.cpp   StarMgr.cpp 
skipping to change at line 33 skipping to change at line 33
// class used to manage groups of Stars // class used to manage groups of Stars
#include <config.h> #include <config.h>
#include <QTextStream> #include <QTextStream>
#include <QFile> #include <QFile>
#include <QSettings> #include <QSettings>
#include <QString> #include <QString>
#include <QRegExp> #include <QRegExp>
#include <QDebug> #include <QDebug>
#include "Projector.hpp" #include "StelProjector.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "STexture.hpp" #include "StelTexture.hpp"
#include "Navigator.hpp" #include "StelNavigator.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "ToneReproducer.hpp" #include "StelToneReproducer.hpp"
#include "Translator.hpp" #include "StelTranslator.hpp"
#include "GeodesicGrid.hpp" #include "StelGeodesicGrid.hpp"
#include "LoadingBar.hpp" #include "StelLoadingBar.hpp"
#include "Translator.hpp" #include "StelTranslator.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelTextureMgr.hpp" #include "StelTextureMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelFontMgr.hpp" #include "StelFontMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "bytes.h" #include "bytes.h"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelIniParser.hpp" #include "StelIniParser.hpp"
#include "StelStyle.hpp" #include "StelStyle.hpp"
#include "StelPainter.hpp"
#include "ZoneArray.hpp" #include "ZoneArray.hpp"
#include "StringArray.hpp"
#include <list> #include <list>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
using namespace BigStarCatalogExtension; using namespace BigStarCatalogExtension;
static StringArray spectral_array; static QStringList spectral_array;
static StringArray component_array; static QStringList component_array;
QString StarMgr::convertToSpectralType(int index) { QStringList initStringListFromFile(const QString& file_name)
if (index < 0 || index >= spectral_array.getSize()) { {
qDebug() << "convertToSpectralType: bad index: " << index QStringList list;
<< ", max: " << spectral_array.getSize(); QFile f(file_name);
return ""; if (f.open(QIODevice::ReadOnly | QIODevice::Text))
} {
return spectral_array[index]; while (!f.atEnd())
{
QString s = QString::fromUtf8(f.readLine());
s.chop(1);
list << s;
}
f.close();
}
return list;
} }
QString StarMgr::convertToComponentIds(int index) { QString StarMgr::convertToSpectralType(int index)
if (index < 0 || index >= component_array.getSize()) { {
qDebug() << "convertToComponentIds: bad index: " << index if (index < 0 || index >= spectral_array.size())
<< ", max: " << component_array.getSize(); {
return ""; qDebug() << "convertToSpectralType: bad index: " << index <<
} ", max: " << spectral_array.size();
return component_array[index]; return "";
}
return spectral_array.at(index);
}
QString StarMgr::convertToComponentIds(int index)
{
if (index < 0 || index >= component_array.size())
{
qDebug() << "convertToComponentIds: bad index: " << index <<
", max: " << component_array.size();
return "";
}
return component_array.at(index);
} }
void StarMgr::initTriangle(int lev,int index, void StarMgr::initTriangle(int lev,int index,
const Vec3d &c0, const Vec3d &c0,
const Vec3d &c1, const Vec3d &c1,
const Vec3d &c2) { const Vec3d &c2) {
ZoneArrayMap::const_iterator it(zoneArrays.find(lev)); ZoneArrayMap::const_iterator it(zoneArrays.find(lev));
if (it!=zoneArrays.end()) it->second->initTriangle(index,c0,c1,c2); if (it!=zoneArrays.end()) it->second->initTriangle(index,c0,c1,c2);
} }
skipping to change at line 120 skipping to change at line 139
/************************************************************************* /*************************************************************************
Reimplementation of the getCallOrder method Reimplementation of the getCallOrder method
*************************************************************************/ *************************************************************************/
double StarMgr::getCallOrder(StelModuleActionName actionName) const double StarMgr::getCallOrder(StelModuleActionName actionName) const
{ {
if (actionName==StelModule::ActionDraw) if (actionName==StelModule::ActionDraw)
return StelApp::getInstance().getModuleMgr().getModule("Cons tellationMgr")->getCallOrder(actionName)+10; return StelApp::getInstance().getModuleMgr().getModule("Cons tellationMgr")->getCallOrder(actionName)+10;
return 0; return 0;
} }
StarMgr::~StarMgr(void) { StarMgr::~StarMgr(void)
ZoneArrayMap::iterator it(zoneArrays.end()); {
while (it!=zoneArrays.begin()) { delete starSettings;
--it; starSettings=NULL;
delete it->second; ZoneArrayMap::iterator it(zoneArrays.end());
it->second = NULL; while (it!=zoneArrays.begin())
} {
zoneArrays.clear(); --it;
if (hipIndex) delete[] hipIndex; delete it->second;
it->second = NULL;
}
zoneArrays.clear();
if (hipIndex)
delete[] hipIndex;
} }
bool StarMgr::flagSciNames = true; bool StarMgr::flagSciNames = true;
double StarMgr::currentJDay = 0; double StarMgr::currentJDay = 0;
std::map<int,QString> StarMgr::commonNamesMap; std::map<int,QString> StarMgr::commonNamesMap;
std::map<int,QString> StarMgr::commonNamesMapI18n; std::map<int,QString> StarMgr::commonNamesMapI18n;
std::map<QString,int> StarMgr::commonNamesIndex; std::map<QString,int> StarMgr::commonNamesIndex;
std::map<QString,int> StarMgr::commonNamesIndexI18n; std::map<QString,int> StarMgr::commonNamesIndexI18n;
std::map<int,QString> StarMgr::sciNamesMapI18n; std::map<int,QString> StarMgr::sciNamesMapI18n;
skipping to change at line 153 skipping to change at line 177
if (it!=commonNamesMapI18n.end()) return it->second; if (it!=commonNamesMapI18n.end()) return it->second;
return ""; return "";
} }
QString StarMgr::getSciName(int hip) { QString StarMgr::getSciName(int hip) {
std::map<int,QString>::const_iterator it(sciNamesMapI18n.find(hip)); std::map<int,QString>::const_iterator it(sciNamesMapI18n.find(hip));
if (it!=sciNamesMapI18n.end()) return it->second; if (it!=sciNamesMapI18n.end()) return it->second;
return ""; return "";
} }
void StarMgr::init() { void StarMgr::init()
{
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
assert(conf); Q_ASSERT(conf);
loadStarSettings();
loadData(); loadData();
double fontSize = 12; double fontSize = 12;
starFont = &StelApp::getInstance().getFontManager().getStandardFont( StelApp::getInstance().getLocaleMgr().getSkyLanguage(), fontSize); starFont = &StelApp::getInstance().getFontManager().getStandardFont( StelApp::getInstance().getLocaleMgr().getSkyLanguage(), fontSize);
setFlagStars(conf->value("astro/flag_stars", true).toBool()); setFlagStars(conf->value("astro/flag_stars", true).toBool());
setFlagLabels(conf->value("astro/flag_star_name",true).toBool()); setFlagLabels(conf->value("astro/flag_star_name",true).toBool());
setLabelsAmount(conf->value("stars/labels_amount",3).toDouble()); setLabelsAmount(conf->value("stars/labels_amount",3).toDouble());
StelApp::getInstance().getStelObjectMgr().registerStelObjectMgr(this ); StelApp::getInstance().getStelObjectMgr().registerStelObjectMgr(this );
StelApp::getInstance().getTextureManager().setDefaultParams(); StelApp::getInstance().getTextureManager().setDefaultParams();
StelApp::getInstance().getTextureManager().setMinFilter(GL_LINEAR);
texPointer = StelApp::getInstance().getTextureManager().createTextur e("pointeur2.png"); // Load pointer texture texPointer = StelApp::getInstance().getTextureManager().createTextur e("pointeur2.png"); // Load pointer texture
}
void StarMgr::setGrid(GeodesicGrid* geodesicGrid) { StelApp::getInstance().getCore()->getGeodesicGrid(maxGeodesicGridLev
geodesicGrid->visitTriangles(maxGeodesicGridLevel,initTriangleFunc,this); el)->visitTriangles(maxGeodesicGridLevel,initTriangleFunc,this);
for (ZoneArrayMap::const_iterator it(zoneArrays.begin()); for (ZoneArrayMap::const_iterator it(zoneArrays.begin()); it!=zoneAr
it!=zoneArrays.end();it++) { rays.end();it++)
it->second->scaleAxis(); {
} it->second->scaleAxis();
}
} }
void StarMgr::drawPointer(const Projector* prj, const Navigator * nav) void StarMgr::drawPointer(const StelProjectorP& prj, const StelNavigator * nav)
{ {
const QList<StelObjectP> newSelected = StelApp::getInstance().getSte lObjectMgr().getSelectedObject("Star"); const QList<StelObjectP> newSelected = StelApp::getInstance().getSte lObjectMgr().getSelectedObject("Star");
if (!newSelected.empty()) if (!newSelected.empty())
{ {
const StelObjectP obj = newSelected[0]; const StelObjectP obj = newSelected[0];
Vec3d pos=obj->getObsJ2000Pos(nav); Vec3d pos=obj->getJ2000EquatorialPos(nav);
Vec3d screenpos; Vec3d screenpos;
// Compute 2D pos and return if outside screen // Compute 2D pos and return if outside screen
if (!prj->project(pos, screenpos)) return; if (!prj->project(pos, screenpos))
return;
StelPainter sPainter(prj);
glColor3fv(obj->getInfoColor()); glColor3fv(obj->getInfoColor());
float diameter = 26.f; float diameter = 26.f;
texPointer->bind(); texPointer->bind();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transp arency mode glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transp arency mode
prj->drawSprite2dMode(screenpos[0], screenpos[1], diameter, StelApp ::getInstance().getTotalRunTime()*40.); sPainter.drawSprite2dMode(screenpos[0], screenpos[1], diamet er, StelApp::getInstance().getTotalRunTime()*40.);
} }
} }
void StarMgr::setStelStyle(const StelStyle& style) void StarMgr::setStelStyle(const StelStyle& style)
{ {
// Load colors from config file // Load colors from config file
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
QString section = style.confSectionName; QString section = style.confSectionName;
QString defaultColor = conf->value(section+"/default_color").toStrin g(); QString defaultColor = conf->value(section+"/default_color").toStrin g();
setLabelColor(StelUtils::strToVec3f(conf->value(section+"/star_label _color", defaultColor).toString())); setLabelColor(StelUtils::strToVec3f(conf->value(section+"/star_label _color", defaultColor).toString()));
} }
/************************************************************************** void StarMgr::loadStarSettings()
*
Load star catalogue data from files.
If a file is not found, it will be skipped.
***************************************************************************
/
void StarMgr::loadData()
{ {
LoadingBar& lb = *StelApp::getInstance().getLoadingBar();
// Please do not init twice:
assert(maxGeodesicGridLevel < 0);
qDebug() << "Loading star data ...";
QString iniFile; QString iniFile;
try try
{ {
iniFile = StelApp::getInstance().getFileMgr().findFile("star s/default/stars.ini"); iniFile = StelApp::getInstance().getFileMgr().findFile("star s/default/stars.ini");
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "ERROR - could not find stars/default/stars.in i : " << e.what() << iniFile; qWarning() << "ERROR - could not find stars/default/stars.in i : " << e.what() << iniFile;
return; return;
} }
QSettings conf(iniFile, StelIniFormat); starSettings = new QSettings(iniFile, StelIniFormat);
if (conf.status() != QSettings::NoError) if (starSettings->status() != QSettings::NoError)
{ {
qWarning() << "ERROR while parsing " << iniFile; qWarning() << "ERROR while parsing " << iniFile;
return; return;
} }
starSettings->beginGroup("stars");
}
for (int i=0; i<100; i++) /**************************************************************************
{ *
//sprintf(key_name,"cat_file_name_%02d",i); Load star catalogue data from files.
QString keyName = QString("cat_file_name_%1").arg(i,2,10,QCh If a file is not found, it will be skipped.
ar('0')); ***************************************************************************
const QString cat_file_name = conf.value(QString("stars/")+k /
eyName,"").toString(); void StarMgr::loadData()
if (!cat_file_name.isEmpty()) { {
lb.SetMessage(q_("Loading catalog %1").arg(cat_file_ StelLoadingBar& lb = *StelApp::getInstance().getStelLoadingBar();
name));
ZoneArray *const z = ZoneArray::create(*this,cat_fil // Please do not init twice:
e_name,lb); Q_ASSERT(maxGeodesicGridLevel < 0);
if (z)
{ qDebug() << "Loading star data ...";
if (maxGeodesicGridLevel < z->level)
{ qulonglong memoryUsed = 0;
maxGeodesicGridLevel = z->level; const qulonglong maxMemory = StelApp::getInstance().getSettings()->v
} alue("stars/max_memory", 128).toULongLong() * 1024*1024;
ZoneArray *&pos(zoneArrays[z->level]);
if (pos) QStringList cats = starSettings->childGroups();
{ QListIterator<QString> it(cats);
qDebug() << cat_file_name << ", " << StelFileMgr& fileMgr = StelApp::getInstance().getFileMgr();
z->level << ": duplicate level"; while(it.hasNext())
delete z; {
} QString cat = it.next();
else QString cat_file_name = starSettings->value(cat+"/path").toS
{ tring();
pos = z; QString cat_file_path = fileMgr.findFile("stars/default/"+ca
} t_file_name);
lb.SetMessage(q_("Loading catalog %1 from file %2").arg(cat,
cat_file_name));
memoryUsed += fileMgr.size(cat_file_path);
ZoneArray *const z = ZoneArray::create(cat_file_name, memory
Used > maxMemory, lb);
if (z)
{
if (maxGeodesicGridLevel < z->level)
{
maxGeodesicGridLevel = z->level;
}
ZoneArray *&pos(zoneArrays[z->level]);
if (pos)
{
qDebug() << cat_file_name << ", " << z->leve
l << ": duplicate level";
delete z;
}
else
{
pos = z;
} }
} }
} }
for (int i=0; i<=NR_OF_HIP; i++) for (int i=0; i<=NR_OF_HIP; i++)
{ {
hipIndex[i].a = 0; hipIndex[i].a = 0;
hipIndex[i].z = 0; hipIndex[i].z = 0;
hipIndex[i].s = 0; hipIndex[i].s = 0;
} }
for (ZoneArrayMap::const_iterator it(zoneArrays.begin()); for (ZoneArrayMap::const_iterator it(zoneArrays.begin());
it != zoneArrays.end();it++) it != zoneArrays.end();it++)
{ {
it->second->updateHipIndex(hipIndex); it->second->updateHipIndex(hipIndex);
} }
const QString cat_hip_sp_file_name = conf.value("stars/cat_hip_sp_fi le_name","").toString(); const QString cat_hip_sp_file_name = starSettings->value("cat_hip_sp _file_name","").toString();
if (cat_hip_sp_file_name.isEmpty()) if (cat_hip_sp_file_name.isEmpty())
{ {
qWarning() << "ERROR: stars:cat_hip_sp_file_name not found"; qWarning() << "ERROR: stars:cat_hip_sp_file_name not found";
} }
else else
{ {
try try
{ {
spectral_array.initFromFile(StelApp::getInstance().g etFileMgr().findFile("stars/default/" + cat_hip_sp_file_name)); spectral_array = initStringListFromFile(fileMgr.find File("stars/default/" + cat_hip_sp_file_name));
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "ERROR while loading data from " qWarning() << "ERROR while loading data from "
<< ("stars/default/" + cat_hip_sp_file_na me) << ("stars/default/" + cat_hip_sp_file_na me)
<< ": " << e.what(); << ": " << e.what();
} }
} }
const QString cat_hip_cids_file_name = conf.value("stars/cat_hip_cid s_file_name","").toString(); const QString cat_hip_cids_file_name = starSettings->value("cat_hip_ cids_file_name","").toString();
if (cat_hip_cids_file_name.isEmpty()) if (cat_hip_cids_file_name.isEmpty())
{ {
qWarning() << "ERROR: stars:cat_hip_cids_file_name not found "; qWarning() << "ERROR: stars:cat_hip_cids_file_name not found ";
} }
else else
{ {
try try
{ {
component_array.initFromFile(StelApp::getInstance(). component_array = initStringListFromFile(fileMgr.fin
getFileMgr() dFile("stars/default/" + cat_hip_cids_file_name));
.findFile("stars/default/" + cat_hip_cids_fi
le_name));
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "ERROR while loading data from " qWarning() << "ERROR while loading data from "
<< ("stars/default/" + cat_hip_cids_file_ name) << ("stars/default/" + cat_hip_cids_file_ name)
<< ": " << e.what(); << ": " << e.what();
} }
} }
lastMaxSearchLevel = maxGeodesicGridLevel; lastMaxSearchLevel = maxGeodesicGridLevel;
skipping to change at line 497 skipping to change at line 533
if (StelApp::getInstance().getCore()->getSkyDrawer()->computeRCMag(mag_ min,rcmag)==false) if (StelApp::getInstance().getCore()->getSkyDrawer()->computeRCMag(mag_ min,rcmag)==false)
break; break;
rval = it->first; rval = it->first;
} }
return rval; return rval;
} }
// Draw all the stars // Draw all the stars
void StarMgr::draw(StelCore* core) void StarMgr::draw(StelCore* core)
{ {
Navigator* nav = core->getNavigation(); StelNavigator* nav = core->getNavigator();
Projector* prj = core->getProjection(); const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000)
SkyDrawer* skyDrawer = core->getSkyDrawer(); ;
StelSkyDrawer* skyDrawer = core->getSkyDrawer();
currentJDay = nav->getJDay(); currentJDay = nav->getJDay();
// If stars are turned off don't waste time below // If stars are turned off don't waste time below
// projecting all stars just to draw disembodied labels // projecting all stars just to draw disembodied labels
if (!starsFader.getInterstate()) if (!starsFader.getInterstate())
return; return;
int maxSearchLevel = getMaxSearchLevel(); int maxSearchLevel = getMaxSearchLevel();
const GeodesicSearchResult* geodesic_search_result = core->getGeodes icGrid()->search(prj->unprojectViewport(),maxSearchLevel); const GeodesicSearchResult* geodesic_search_result = core->getGeodes icGrid(maxSearchLevel)->search(prj->unprojectViewport(),maxSearchLevel);
// Set temporary static variable for optimization // Set temporary static variable for optimization
const float names_brightness = labelsFader.getInterstate() * starsFader .getInterstate(); const float names_brightness = labelsFader.getInterstate() * starsFader .getInterstate();
prj->setCurrentFrame(Projector::FrameJ2000);
// Prepare openGL for drawing many stars // Prepare openGL for drawing many stars
skyDrawer->preDrawPointSource(); StelPainter* sPainter = new StelPainter(prj);
skyDrawer->preDrawPointSource(sPainter);
Q_ASSERT(sPainter);
// draw all the stars of all the selected zones // draw all the stars of all the selected zones
float rcmag_table[2*256]; float rcmag_table[2*256];
for (ZoneArrayMap::const_iterator it(zoneArrays.begin()); it!=zoneArray s.end();it++) for (ZoneArrayMap::const_iterator it(zoneArrays.begin()); it!=zoneArray s.end();++it)
{ {
const float mag_min = 0.001f*it->second->mag_min; const float mag_min = 0.001f*it->second->mag_min;
const float k = (0.001f*it->second->mag_range)/it->second->m ag_steps; const float k = (0.001f*it->second->mag_range)/it->second->m ag_steps;
for (int i=it->second->mag_steps-1;i>=0;i--) for (int i=it->second->mag_steps-1;i>=0;--i)
{ {
const float mag = mag_min+k*i; const float mag = mag_min+k*i;
if (skyDrawer->computeRCMag(mag,rcmag_table + 2*i)== false) if (skyDrawer->computeRCMag(mag,rcmag_table + 2*i)== false)
{ {
if (i==0) goto exit_loop; if (i==0) goto exit_loop;
} }
if (skyDrawer->getFlagPointStar()) if (skyDrawer->getFlagPointStar())
{ {
rcmag_table[2*i+1] *= starsFader.getIntersta te(); rcmag_table[2*i+1] *= starsFader.getIntersta te();
} }
skipping to change at line 563 skipping to change at line 599
int zone; int zone;
for (GeodesicSearchInsideIterator it1(*geodesic_search_resul t,it->first);(zone = it1.next()) >= 0;) for (GeodesicSearchInsideIterator it1(*geodesic_search_resul t,it->first);(zone = it1.next()) >= 0;)
it->second->draw(zone, true, rcmag_table, prj, maxMa gStarName, names_brightness, starFont); it->second->draw(zone, true, rcmag_table, prj, maxMa gStarName, names_brightness, starFont);
for (GeodesicSearchBorderIterator it1(*geodesic_search_resul t,it->first);(zone = it1.next()) >= 0;) for (GeodesicSearchBorderIterator it1(*geodesic_search_resul t,it->first);(zone = it1.next()) >= 0;)
it->second->draw(zone, false, rcmag_table, prj, maxM agStarName,names_brightness, starFont); it->second->draw(zone, false, rcmag_table, prj, maxM agStarName,names_brightness, starFont);
} }
exit_loop: exit_loop:
// Finish drawing many stars // Finish drawing many stars
skyDrawer->postDrawPointSource(); skyDrawer->postDrawPointSource();
delete sPainter;
sPainter = NULL;
drawPointer(prj, nav); drawPointer(prj, nav);
} }
// Look for a star by XYZ coords // Look for a star by XYZ coords
StelObjectP StarMgr::search(Vec3d pos) const { StelObjectP StarMgr::search(Vec3d pos) const {
assert(0); Q_ASSERT(0);
pos.normalize(); pos.normalize();
QList<StelObjectP > v = searchAround(pos, QList<StelObjectP > v = searchAround(pos,
0.8, // just an arbitrary number 0.8, // just an arbitrary number
NULL); NULL);
StelObjectP nearest; StelObjectP nearest;
double cos_angle_nearest = -10.0; double cos_angle_nearest = -10.0;
for (QList<StelObjectP >::const_iterator it(v.begin());it!=v.end();it++) { for (QList<StelObjectP >::const_iterator it(v.begin());it!=v.end();it++) {
const double c = (*it)->getObsJ2000Pos(0)*pos; const double c = (*it)->getJ2000EquatorialPos(0)*pos;
if (c > cos_angle_nearest) { if (c > cos_angle_nearest) {
cos_angle_nearest = c; cos_angle_nearest = c;
nearest = *it; nearest = *it;
} }
} }
return nearest; return nearest;
} }
// Return a stl vector containing the stars located // Return a stl vector containing the stars located
// inside the limFov circle around position v // inside the limFov circle around position v
skipping to change at line 632 skipping to change at line 671
Vec3d e0 = v + h0; Vec3d e0 = v + h0;
Vec3d e1 = v + h1; Vec3d e1 = v + h1;
Vec3d e2 = v - h0; Vec3d e2 = v - h0;
Vec3d e3 = v - h1; Vec3d e3 = v - h1;
f = 1.0/e0.length(); f = 1.0/e0.length();
e0 *= f; e0 *= f;
e1 *= f; e1 *= f;
e2 *= f; e2 *= f;
e3 *= f; e3 *= f;
// search the triangles // search the triangles
const GeodesicSearchResult* geodesic_search_result = core->getGeodes icGrid()->search(e3,e2,e1,e0,lastMaxSearchLevel); const GeodesicSearchResult* geodesic_search_result = core->getGeodesicGri d(lastMaxSearchLevel)->search(e3,e2,e1,e0,lastMaxSearchLevel);
// iterate over the stars inside the triangles: // iterate over the stars inside the triangles:
f = cos(limFov * M_PI/180.); f = cos(limFov * M_PI/180.);
for (ZoneArrayMap::const_iterator it(zoneArrays.begin()); for (ZoneArrayMap::const_iterator it(zoneArrays.begin());
it!=zoneArrays.end();it++) { it!=zoneArrays.end();it++) {
//qDebug() << "search inside(" << it->first << "):"; //qDebug() << "search inside(" << it->first << "):";
int zone; int zone;
for (GeodesicSearchInsideIterator it1(*geodesic_search_result,it->first ); for (GeodesicSearchInsideIterator it1(*geodesic_search_result,it->first );
(zone = it1.next()) >= 0;) { (zone = it1.next()) >= 0;) {
it->second->searchAround(zone,v,f,result); it->second->searchAround(zone,v,f,result);
//qDebug() << " " << zone; //qDebug() << " " << zone;
skipping to change at line 657 skipping to change at line 696
it->second->searchAround(zone,v,f,result); it->second->searchAround(zone,v,f,result);
//qDebug() << " " << zone; //qDebug() << " " << zone;
} }
} }
return result; return result;
} }
//! Update i18 names from english names according to passed translator. //! Update i18 names from english names according to passed translator.
//! The translation is done using gettext with translated strings defined i n translations.h //! The translation is done using gettext with translated strings defined i n translations.h
void StarMgr::updateI18n() { void StarMgr::updateI18n() {
Translator trans = StelApp::getInstance().getLocaleMgr().getSkyTranslator (); StelTranslator trans = StelApp::getInstance().getLocaleMgr().getSkyTransl ator();
commonNamesMapI18n.clear(); commonNamesMapI18n.clear();
commonNamesIndexI18n.clear(); commonNamesIndexI18n.clear();
for (std::map<int,QString>::iterator it(commonNamesMap.begin()); for (std::map<int,QString>::iterator it(commonNamesMap.begin());
it!=commonNamesMap.end();it++) { it!=commonNamesMap.end();it++) {
const int i = it->first; const int i = it->first;
const QString t(trans.qtranslate(it->second)); const QString t(trans.qtranslate(it->second));
commonNamesMapI18n[i] = t; commonNamesMapI18n[i] = t;
commonNamesIndexI18n[t.toUpper()] = i; commonNamesIndexI18n[t.toUpper()] = i;
} }
starFont = &StelApp::getInstance().getFontManager().getStandardFont(trans .getTrueLocaleName(), fontSize); starFont = &StelApp::getInstance().getFontManager().getStandardFont(trans .getTrueLocaleName(), fontSize);
skipping to change at line 805 skipping to change at line 844
const QString constw(it->first.mid(0,objw.size())); const QString constw(it->first.mid(0,objw.size()));
if (constw==objw) { if (constw==objw) {
if (maxNbItem==0) break; if (maxNbItem==0) break;
result << getSciName(it->second); result << getSciName(it->second);
maxNbItem--; maxNbItem--;
} }
else else
break; break;
} }
// Add exact Hp catalogue numbers
QRegExp hpRx("^HP\\s*(\\d+)\\s*$");
hpRx.setCaseSensitivity(Qt::CaseInsensitive);
if (hpRx.exactMatch(objw))
{
bool ok;
int hpNum = hpRx.capturedTexts().at(1).toInt(&ok);
if (ok)
{
StelObjectP s = searchHP(hpNum);
if (s && maxNbItem>0)
{
result << QString("HP%1").arg(hpNum);
maxNbItem--;
}
}
}
result.sort(); result.sort();
return result; return result;
} }
//! Define font file name and size to use for star names display //! Define font file name and size to use for star names display
void StarMgr::setFontSize(double newFontSize) void StarMgr::setFontSize(double newFontSize)
{ {
fontSize = newFontSize; fontSize = newFontSize;
starFont = &StelApp::getInstance().getFontManager().getStandardFont( starFont = &StelApp::getInstance().getFontManager().getStandardFont(
StelApp::getInstance().getLocaleMgr().getSkyLanguage(),fontS ize); StelApp::getInstance().getLocaleMgr().getSkyLanguage(),fontS ize);
 End of changes. 41 change blocks. 
112 lines changed or deleted 174 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/