TelescopeControl.cpp   TelescopeControl.cpp 
skipping to change at line 103 skipping to change at line 103
connectionTypeNames.insert(ConnectionRemote, "remote"); connectionTypeNames.insert(ConnectionRemote, "remote");
} }
TelescopeControl::~TelescopeControl() TelescopeControl::~TelescopeControl()
{ {
} }
/////////////////////////////////////////////////////////////////////////// ///// /////////////////////////////////////////////////////////////////////////// /////
// Methods inherited from the StelModule class // Methods inherited from the StelModule class
// init(), update(), draw(), setStelStyle(), getCallOrder() // init(), update(), draw(), getCallOrder()
void TelescopeControl::init() void TelescopeControl::init()
{ {
//TODO: I think I've overdone the try/catch... //TODO: I think I've overdone the try/catch...
try try
{ {
//Main configuration //Main configuration
loadConfiguration(); loadConfiguration();
//Make sure that such a section is created, if it doesn't ex ist //Make sure that such a section is created, if it doesn't ex ist
saveConfiguration(); saveConfiguration();
skipping to change at line 193 skipping to change at line 193
{ {
qWarning() << "TelescopeControl::init() error: " << e.what() ; qWarning() << "TelescopeControl::init() error: " << e.what() ;
return; return;
} }
GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this); GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
//Initialize style, as it is not called at startup: //Initialize style, as it is not called at startup:
//(necessary to initialize the reticle/label/circle colors) //(necessary to initialize the reticle/label/circle colors)
setStelStyle(StelApp::getInstance().getCurrentStelStyle()); setStelStyle(StelApp::getInstance().getCurrentStelStyle());
connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QSt ring&)), this, SLOT(setStelStyle(const QString&)));
} }
void TelescopeControl::deinit() void TelescopeControl::deinit()
{ {
//Destroy all clients first in order to avoid displaying a TCP error //Destroy all clients first in order to avoid displaying a TCP error
deleteAllTelescopes(); deleteAllTelescopes();
QHash<int, QProcess*>::const_iterator iterator = telescopeServerProc ess.constBegin(); QHash<int, QProcess*>::const_iterator iterator = telescopeServerProc ess.constBegin();
while(iterator != telescopeServerProcess.constEnd()) while(iterator != telescopeServerProcess.constEnd())
{ {
skipping to change at line 232 skipping to change at line 233
{ {
labelFader.update((int)(deltaTime*1000)); labelFader.update((int)(deltaTime*1000));
reticleFader.update((int)(deltaTime*1000)); reticleFader.update((int)(deltaTime*1000));
circleFader.update((int)(deltaTime*1000)); circleFader.update((int)(deltaTime*1000));
// communicate with the telescopes: // communicate with the telescopes:
communicate(); communicate();
} }
void TelescopeControl::draw(StelCore* core) void TelescopeControl::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(labelFont); sPainter.setFont(labelFont);
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
reticleTexture->bind(); reticleTexture->bind();
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode
foreach (const TelescopeClientP& telescope, telescopeClients) foreach (const TelescopeClientP& telescope, telescopeClients)
{ {
if (telescope->isConnected() && telescope->hasKnownPosition( )) if (telescope->isConnected() && telescope->hasKnownPosition( ))
{ {
Vec3d XY; Vec3d XY;
if (prj->projectCheck(telescope->getJ2000EquatorialP os(nav), XY)) if (prj->projectCheck(telescope->getJ2000EquatorialP os(core), XY))
{ {
//Telescope circles appear synchronously wit h markers //Telescope circles appear synchronously wit h markers
if (circleFader.getInterstate() >= 0) if (circleFader.getInterstate() >= 0)
{ {
glColor4f(circleColor[0], circleColo r[1], circleColor[2], circleFader.getInterstate()); glColor4f(circleColor[0], circleColo r[1], circleColor[2], circleFader.getInterstate());
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
foreach (double circle, telescope->g etOculars()) foreach (double circle, telescope->g etOculars())
{ {
sPainter.drawCircle(XY[0], X Y[1], 0.5 * prj->getPixelPerRadAtCenter() * (M_PI/180) * (circle)); sPainter.drawCircle(XY[0], X Y[1], 0.5 * prj->getPixelPerRadAtCenter() * (M_PI/180) * (circle));
} }
skipping to change at line 278 skipping to change at line 278
sPainter.drawText(XY[0], XY[1], tele scope->getNameI18n(), 0, 6 + 10, -4, false); sPainter.drawText(XY[0], XY[1], tele scope->getNameI18n(), 0, 6 + 10, -4, false);
//Same position as the other objects : doesn't work, telescope label overlaps object label //Same position as the other objects : doesn't work, telescope label overlaps object label
//sPainter.drawText(XY[0], XY[1], sc ope->getNameI18n(), 0, 10, 10, false); //sPainter.drawText(XY[0], XY[1], sc ope->getNameI18n(), 0, 10, 10, false);
reticleTexture->bind(); reticleTexture->bind();
} }
} }
} }
} }
if(GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer()) if(GETSTELMODULE(StelObjectMgr)->getFlagSelectedObjectPointer())
drawPointer(prj, nav, sPainter); drawPointer(prj, core, sPainter);
} }
void TelescopeControl::setStelStyle(const QString& section) void TelescopeControl::setStelStyle(const QString& section)
{ {
if (section == "night_color") if (section == "night_color")
{ {
setLabelColor(labelNightColor); setLabelColor(labelNightColor);
setReticleColor(reticleNightColor); setReticleColor(reticleNightColor);
setCircleColor(circleNightColor); setCircleColor(circleNightColor);
} }
skipping to change at line 320 skipping to change at line 320
QList<StelObjectP> TelescopeControl::searchAround(const Vec3d& vv, double l imitFov, const StelCore* core) const QList<StelObjectP> TelescopeControl::searchAround(const Vec3d& vv, double l imitFov, const StelCore* core) const
{ {
QList<StelObjectP> result; QList<StelObjectP> result;
if (!getFlagTelescopeReticles()) if (!getFlagTelescopeReticles())
return result; return result;
Vec3d v(vv); Vec3d v(vv);
v.normalize(); v.normalize();
double cosLimFov = cos(limitFov * M_PI/180.); double cosLimFov = cos(limitFov * M_PI/180.);
foreach (const TelescopeClientP& telescope, telescopeClients) foreach (const TelescopeClientP& telescope, telescopeClients)
{ {
if (telescope->getJ2000EquatorialPos(core->getNavigator()).d ot(v) >= cosLimFov) if (telescope->getJ2000EquatorialPos(core).dot(v) >= cosLimF ov)
{ {
result.append(qSharedPointerCast<StelObject>(telesco pe)); result.append(qSharedPointerCast<StelObject>(telesco pe));
} }
} }
return result; return result;
} }
StelObjectP TelescopeControl::searchByNameI18n(const QString &nameI18n) con st StelObjectP TelescopeControl::searchByNameI18n(const QString &nameI18n) con st
{ {
foreach (const TelescopeClientP& telescope, telescopeClients) foreach (const TelescopeClientP& telescope, telescopeClients)
skipping to change at line 403 skipping to change at line 403
// Find out the coordinates of the target // Find out the coordinates of the target
StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr); StelObjectMgr* omgr = GETSTELMODULE(StelObjectMgr);
if (omgr->getSelectedObject().isEmpty()) if (omgr->getSelectedObject().isEmpty())
return; return;
StelObjectP selectObject = omgr->getSelectedObject().at(0); StelObjectP selectObject = omgr->getSelectedObject().at(0);
if (!selectObject) // should never happen if (!selectObject) // should never happen
return; return;
Vec3d objectPosition = selectObject->getJ2000EquatorialPos(StelApp:: getInstance().getCore()->getNavigator()); Vec3d objectPosition = selectObject->getJ2000EquatorialPos(StelApp:: getInstance().getCore());
telescopeGoto(slotNumber, objectPosition); telescopeGoto(slotNumber, objectPosition);
} }
void TelescopeControl::slewTelescopeToViewDirection() void TelescopeControl::slewTelescopeToViewDirection()
{ {
// Find out for which telescope is the command // Find out for which telescope is the command
if (sender() == NULL) if (sender() == NULL)
return; return;
int slotNumber = sender()->objectName().right(1).toInt(); int slotNumber = sender()->objectName().right(1).toInt();
// Find out the coordinates of the target // Find out the coordinates of the target
Vec3d centerPosition = GETSTELMODULE(StelMovementMgr)->getViewDirect ionJ2000(); Vec3d centerPosition = GETSTELMODULE(StelMovementMgr)->getViewDirect ionJ2000();
telescopeGoto(slotNumber, centerPosition); telescopeGoto(slotNumber, centerPosition);
} }
void TelescopeControl::drawPointer(const StelProjectorP& prj, const StelNav igator * nav, StelPainter& sPainter) void TelescopeControl::drawPointer(const StelProjectorP& prj, const StelCor e* core, StelPainter& sPainter)
{ {
#ifndef COMPATIBILITY_001002 #ifndef COMPATIBILITY_001002
//Leaves this whole routine empty if this is the backport version. //Leaves this whole routine empty if this is the backport version.
//Otherwise, there will be two concentric selection markers drawn ar ound the telescope pointer. //Otherwise, there will be two concentric selection markers drawn ar ound the telescope pointer.
//In 0.10.3, the plug-in unloads the module that draws the surplus m arker. //In 0.10.3, the plug-in unloads the module that draws the surplus m arker.
const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)- >getSelectedObject("Telescope"); const QList<StelObjectP> newSelected = GETSTELMODULE(StelObjectMgr)- >getSelectedObject("Telescope");
if (!newSelected.empty()) if (!newSelected.empty())
{ {
const StelObjectP obj = newSelected[0]; const StelObjectP obj = newSelected[0];
Vec3d pos = obj->getJ2000EquatorialPos(nav); Vec3d pos = obj->getJ2000EquatorialPos(core);
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)) if (!prj->project(pos, screenpos))
return; return;
const Vec3f& c(obj->getInfoColor()); const Vec3f& c(obj->getInfoColor());
sPainter.setColor(c[0], c[1], c[2]); sPainter.setColor(c[0], c[1], c[2]);
selectionTexture->bind(); selectionTexture->bind();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
 End of changes. 9 change blocks. 
8 lines changed or deleted 8 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/