ConstellationMgr.cpp   ConstellationMgr.cpp 
skipping to change at line 42 skipping to change at line 42
#include "StelApp.hpp" #include "StelApp.hpp"
#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"
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), flagNames(0),
flagLines(0), flagLines(0),
flagArt(0), flagArt(0),
flagBoundaries(0) flagBoundaries(0)
skipping to change at line 92 skipping to change at line 93
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 _constellation_pick", false).toBool() ).toBool());
GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); StelObjectMgr *objectManager = GETSTELMODULE(StelObjectMgr);
objectManager->registerStelObjectMgr(this);
connect(objectManager, SIGNAL(selectedObjectChanged(StelModule::Stel
ModuleSelectAction)),
this, SLOT(selectedObjectChange(StelModule::StelModu
leSelectAction)));
StelApp *app = &StelApp::getInstance();
connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
connect(app, SIGNAL(skyCultureChanged(const QString&)), this, SLOT(u
pdateSkyCulture(const QString&)));
connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(
setStelStyle(const QString&)));
} }
/************************************************************************* /*************************************************************************
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 169 skipping to change at line 177
{ {
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
// Load colors from config file // Load colors from config file
QString defaultColor = conf->value(section+"/default_color").toStrin g(); QString defaultColor = conf->value(section+"/default_color").toStrin g();
setLinesColor(StelUtils::strToVec3f(conf->value(section+"/const_line s_color", defaultColor).toString())); setLinesColor(StelUtils::strToVec3f(conf->value(section+"/const_line s_color", defaultColor).toString()));
setBoundariesColor(StelUtils::strToVec3f(conf->value(section+"/const _boundary_color", "0.8,0.3,0.3").toString())); setBoundariesColor(StelUtils::strToVec3f(conf->value(section+"/const _boundary_color", "0.8,0.3,0.3").toString()));
setLabelsColor(StelUtils::strToVec3f(conf->value(section+"/const_nam es_color", defaultColor).toString())); setLabelsColor(StelUtils::strToVec3f(conf->value(section+"/const_nam es_color", defaultColor).toString()));
} }
void ConstellationMgr::selectedObjectChangeCallBack(StelModuleSelectAction 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())
{ {
// 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;
skipping to change at line 428 skipping to change at line 436
} }
cons->artTexture = StelApp::getInstance().getTexture Manager().createTextureThread(texturePath); cons->artTexture = StelApp::getInstance().getTexture Manager().createTextureThread(texturePath);
int texSizeX, texSizeY; int texSizeX, texSizeY;
if (cons->artTexture==NULL || !cons->artTexture->get Dimensions(texSizeX, texSizeY)) if (cons->artTexture==NULL || !cons->artTexture->get Dimensions(texSizeX, texSizeY))
{ {
qWarning() << "Texture dimension not availab le"; qWarning() << "Texture dimension not availab le";
} }
const StelNavigator* nav = StelApp::getInstance().ge StelCore* core = StelApp::getInstance().getCore();
tCore()->getNavigator(); Vec3d s1 = hipStarMgr->searchHP(hp1)->getJ2000Equato
Vec3d s1 = hipStarMgr->searchHP(hp1)->getJ2000Equato rialPos(core);
rialPos(nav); Vec3d s2 = hipStarMgr->searchHP(hp2)->getJ2000Equato
Vec3d s2 = hipStarMgr->searchHP(hp2)->getJ2000Equato rialPos(core);
rialPos(nav); Vec3d s3 = hipStarMgr->searchHP(hp3)->getJ2000Equato
Vec3d s3 = hipStarMgr->searchHP(hp3)->getJ2000Equato rialPos(core);
rialPos(nav);
// To transform from texture coordinate to 2d coordi nate we need to find X with XA = B // To transform from texture coordinate to 2d coordi nate we need to find X with XA = B
// A formed of 4 points in texture coordinate, B for med with 4 points in 3d coordinate // A formed of 4 points in texture coordinate, B for med with 4 points in 3d coordinate
// We need 3 stars and the 4th point is deduced from the other to get an normal base // We need 3 stars and the 4th point is deduced from the other to get an normal base
// X = B inv(A) // X = B inv(A)
Vec3d s4 = s1 + ((s2 - s1) ^ (s3 - s1)); Vec3d s4 = s1 + ((s2 - s1) ^ (s3 - s1));
Mat4d B(s1[0], s1[1], s1[2], 1, s2[0], s2[1], s2[2], 1, s3[0], s3[1], s3[2], 1, s4[0], s4[1], s4[2], 1); Mat4d B(s1[0], s1[1], s1[2], 1, s2[0], s2[1], s2[2], 1, s3[0], s3[1], s3[2], 1, s4[0], s4[1], s4[2], 1);
Mat4d A(x1, texSizeY - y1, 0.f, 1.f, x2, texSizeY - y2, 0.f, 1.f, x3, texSizeY - y3, 0.f, 1.f, x1, texSizeY - y1, texSizeX, 1.f ); Mat4d A(x1, texSizeY - y1, 0.f, 1.f, x2, texSizeY - y2, 0.f, 1.f, x3, texSizeY - y3, 0.f, 1.f, x1, texSizeY - y1, texSizeX, 1.f );
Mat4d X = B * A.inverse(); Mat4d X = B * A.inverse();
skipping to change at line 484 skipping to change at line 492
++readOk; ++readOk;
} }
} }
qDebug() << "Loaded" << readOk << "/" << totalRecords << "constellat ion art records successfully for culture" << cultureName; qDebug() << "Loaded" << readOk << "/" << totalRecords << "constellat ion art records successfully for culture" << cultureName;
fic.close(); fic.close();
} }
void ConstellationMgr::draw(StelCore* core) void ConstellationMgr::draw(StelCore* core)
{ {
StelNavigator* nav = core->getNavigator();
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ; const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000) ;
StelPainter sPainter(prj); StelPainter sPainter(prj);
sPainter.setFont(asterFont); sPainter.setFont(asterFont);
drawLines(sPainter, nav); drawLines(sPainter, core);
drawNames(sPainter); drawNames(sPainter);
drawArt(sPainter); drawArt(sPainter);
drawBoundaries(sPainter); drawBoundaries(sPainter);
} }
// Draw constellations art textures // Draw constellations art textures
void ConstellationMgr::drawArt(StelPainter& sPainter) const void ConstellationMgr::drawArt(StelPainter& sPainter) const
{ {
glBlendFunc(GL_ONE, GL_ONE); glBlendFunc(GL_ONE, GL_ONE);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
skipping to change at line 513 skipping to change at line 520
SphericalRegionP region = sPainter.getProjector()->getViewportConvex Polygon(); SphericalRegionP region = sPainter.getProjector()->getViewportConvex Polygon();
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{ {
(*iter)->drawArtOptim(sPainter, *region); (*iter)->drawArtOptim(sPainter, *region);
} }
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
} }
// Draw constellations lines // Draw constellations lines
void ConstellationMgr::drawLines(StelPainter& sPainter, const StelNavigator * nav) const void ConstellationMgr::drawLines(StelPainter& sPainter, const StelCore* cor e) const
{ {
sPainter.enableTexture2d(false); sPainter.enableTexture2d(false);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
const SphericalCap& viewportHalfspace = sPainter.getProjector()->get BoundingCap(); const SphericalCap& viewportHalfspace = sPainter.getProjector()->get BoundingCap();
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
for (iter = asterisms.begin(); iter != asterisms.end(); ++iter) for (iter = asterisms.begin(); iter != asterisms.end(); ++iter)
{ {
(*iter)->drawOptim(sPainter, nav, viewportHalfspace); (*iter)->drawOptim(sPainter, core, viewportHalfspace);
} }
} }
// Draw the names of all the constellations // Draw the names of all the constellations
void ConstellationMgr::drawNames(StelPainter& sPainter) const void ConstellationMgr::drawNames(StelPainter& sPainter) const
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
sPainter.enableTexture2d(true); sPainter.enableTexture2d(true);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
vector < Constellation * >::const_iterator iter; vector < Constellation * >::const_iterator iter;
 End of changes. 8 change blocks. 
14 lines changed or deleted 24 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/