StelMovementMgr.cpp   StelMovementMgr.cpp 
skipping to change at line 651 skipping to change at line 651
if (flagEnableZoomKeys) if (flagEnableZoomKeys)
deltaFov = -1*(s!=0); deltaFov = -1*(s!=0);
} }
void StelMovementMgr::zoomOut(bool s) void StelMovementMgr::zoomOut(bool s)
{ {
if (flagEnableZoomKeys) if (flagEnableZoomKeys)
deltaFov = (s!=0); deltaFov = (s!=0);
} }
void StelMovementMgr::lookEast(void) void StelMovementMgr::lookEast(bool zero)
{ {
float cx, cy; float alt, cy;
Vec3f dir; Vec3f dir;
StelUtils::rectToSphe(&cy,&cx,core->j2000ToAltAz(getViewDirectionJ20
00(), StelCore::RefractionOff)); if (zero)
{
alt = 0.0f;
cy = M_PI/2.;
StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1
], dir[2]), StelCore::RefractionOff));
setViewUpVector(Vec3d(0., 0., 1.));
return;
}
StelUtils::rectToSphe(&cy,&alt,core->j2000ToAltAz(getViewDirectionJ2
000(), StelCore::RefractionOff));
cy = M_PI/2.; cy = M_PI/2.;
StelUtils::spheToRect(cy, cx, dir); StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff)); setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff));
//qDebug() << "Setting East at Alt:" << cx*180./M_PI; //qDebug() << "Setting East at Alt:" << cx*180./M_PI;
if ((mountMode==MountAltAzimuthal) && (cx>M_PI/2-0.0001) && (upVecto rMountFrame[2]<0.001)) if ((mountMode==MountAltAzimuthal) && (fabsf(alt)>M_PI/2-0.0001) && (fabs(upVectorMountFrame[2])<0.001))
{ {
// Special case: we already look into zenith (with rounding tolerance). Bring East to bottom of screen. // Special case: we already look into zenith (with rounding tolerance). Bring East to bottom of screen.
upVectorMountFrame.set(0., -1., 0.); upVectorMountFrame.set(0., -1.*StelUtils::sign(alt), 0.);
//qDebug() << "lookEast: better Up is " << upVectorMountFram e[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2]; //qDebug() << "lookEast: better Up is " << upVectorMountFram e[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
} }
} }
void StelMovementMgr::lookWest(void) void StelMovementMgr::lookWest(bool zero)
{ {
float cx, cy; float alt, cy;
Vec3f dir; Vec3f dir;
StelUtils::rectToSphe(&cy,&cx,core->j2000ToAltAz(getViewDirectionJ20
00(), StelCore::RefractionOff)); if (zero)
{
alt = 0.0f;
cy = 3.*M_PI/2.;
StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1
], dir[2]), StelCore::RefractionOff));
setViewUpVector(Vec3d(0., 0., 1.));
return;
}
StelUtils::rectToSphe(&cy,&alt,core->j2000ToAltAz(getViewDirectionJ2
000(), StelCore::RefractionOff));
cy = 3.*M_PI/2.; cy = 3.*M_PI/2.;
StelUtils::spheToRect(cy, cx, dir); StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff)); setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff));
//qDebug() << "Setting West at Alt:" << cx*180./M_PI; //qDebug() << "Setting West at Alt:" << cx*180./M_PI;
if ((mountMode==MountAltAzimuthal) && (cx>M_PI/2-0.0001) && (upVect orMountFrame[2]<0.001)) if ((mountMode==MountAltAzimuthal) && (fabsf(alt)>M_PI/2-0.0001) && (fabs(upVectorMountFrame[2])<0.001))
{ {
// Special case: we already look into zenith (with rounding tolerance). Bring West to bottom of screen. // Special case: we already look into zenith (with rounding tolerance). Bring West to bottom of screen.
upVectorMountFrame.set(0., 1., 0.); upVectorMountFrame.set(0., StelUtils::sign(alt), 0.);
//qDebug() << "lookEast: better Up is " << upVectorMountFram e[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2]; //qDebug() << "lookEast: better Up is " << upVectorMountFram e[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
} }
} }
void StelMovementMgr::lookNorth(void) void StelMovementMgr::lookNorth(bool zero)
{ {
float cx, cy; float alt, cy;
Vec3f dir; Vec3f dir;
StelUtils::rectToSphe(&cy,&cx,core->j2000ToAltAz(getViewDirectionJ20 00(), StelCore::RefractionOff));
if (zero)
{
alt = 0.0f;
cy = M_PI;
StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1
], dir[2]), StelCore::RefractionOff));
setViewUpVector(Vec3d(0., 0., 1.));
return;
}
StelUtils::rectToSphe(&cy,&alt,core->j2000ToAltAz(getViewDirectionJ2
000(), StelCore::RefractionOff));
cy = M_PI; cy = M_PI;
StelUtils::spheToRect(cy, cx, dir); StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff)); setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff));
//qDebug() << "Setting North at Alt:" << cx*180./M_PI; //qDebug() << "Setting North at Alt:" << cx*180./M_PI;
if ((mountMode==MountAltAzimuthal) && (cx>M_PI/2-0.0001) && (upVect orMountFrame[2]<0.001)) if ((mountMode==MountAltAzimuthal) && (fabsf(alt)>M_PI/2-0.0001) && (fabs(upVectorMountFrame[2])<0.001))
{ {
// Special case: we already look into zenith (with rounding tolerance). Bring North to bottom of screen. // Special case: we already look into zenith (with rounding tolerance). Bring North to bottom of screen.
upVectorMountFrame.set(1., 0., 0.); upVectorMountFrame.set(StelUtils::sign(alt), 0., 0.);
//qDebug() << "lookNorth: better Up is " << upVectorMountFra me[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2]; //qDebug() << "lookNorth: better Up is " << upVectorMountFra me[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
} }
} }
void StelMovementMgr::lookSouth(void) void StelMovementMgr::lookSouth(bool zero)
{ {
float cx, cy; float alt, cy;
Vec3f dir; Vec3f dir;
StelUtils::rectToSphe(&cy,&cx,core->j2000ToAltAz(getViewDirectionJ20 00(), StelCore::RefractionOff));
cy = 0.; if (zero)
StelUtils::spheToRect(cy, cx, dir); {
alt = 0.0f;
cy = 0.0f;
StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1
], dir[2]), StelCore::RefractionOff));
setViewUpVector(Vec3d(0., 0., 1.));
return;
}
StelUtils::rectToSphe(&cy,&alt,core->j2000ToAltAz(getViewDirectionJ2
000(), StelCore::RefractionOff));
cy = 0.f;
StelUtils::spheToRect(cy, alt, dir);
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff)); setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff));
//qDebug() << "Setting South at Alt:" << cx*180./M_PI; //qDebug() << "Setting South at Alt:" << cx*180./M_PI;
if ((mountMode==MountAltAzimuthal) && (cx>M_PI/2-0.0001) && (upVect orMountFrame[2]<0.001)) if ((mountMode==MountAltAzimuthal) && (fabsf(alt)>M_PI/2-0.0001) && (fabs(upVectorMountFrame[2])<0.001))
{ {
// Special case: we already look into zenith (with rounding tolerance). Bring South to bottom of screen. // Special case: we already look into zenith (with rounding tolerance). Bring South to bottom of screen.
upVectorMountFrame.set(-1., 0., 0.); upVectorMountFrame.set(-1.*StelUtils::sign(alt), 0., 0.);
//qDebug() << "lookSouth: better Up is " << upVectorMountFra me[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2]; //qDebug() << "lookSouth: better Up is " << upVectorMountFra me[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
} }
} }
void StelMovementMgr::lookZenith(void) void StelMovementMgr::lookZenith(void)
{ {
Vec3f dir; Vec3f dir;
StelUtils::spheToRect(M_PI, M_PI/2., dir); StelUtils::spheToRect(M_PI, M_PI/2., dir);
//qDebug() << "lookZenith: Up is " << upVectorMountFrame[0] << "/" < < upVectorMountFrame[1] << "/" << upVectorMountFrame[2]; //qDebug() << "lookZenith: Up is " << upVectorMountFrame[0] << "/" < < upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff)); setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2 ]), StelCore::RefractionOff));
//qDebug() << "lookZenith: View is " << viewDirectionMountFrame[0] < < "/" << viewDirectionMountFrame[1] << "/" << viewDirectionMountFrame[2]; //qDebug() << "lookZenith: View is " << viewDirectionMountFrame[0] < < "/" << viewDirectionMountFrame[1] << "/" << viewDirectionMountFrame[2];
if (mountMode==MountAltAzimuthal) if (mountMode==MountAltAzimuthal)
{ // ensure a stable up vector that makes the bottom of the sc reen point south. { // ensure a stable up vector that makes the bottom of the sc reen point south.
upVectorMountFrame.set(-1., 0., 0.); upVectorMountFrame.set(-1., 0., 0.);
//qDebug() << "lookZenith: better Up is " << upVectorMountFr ame[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2]; //qDebug() << "lookZenith: better Up is " << upVectorMountFr ame[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
} }
}
void StelMovementMgr::lookNadir(void)
{
Vec3f dir;
StelUtils::spheToRect(M_PI, -M_PI/2., dir);
//qDebug() << "lookNadir: Up is " << upVectorMountFrame[0] << "/" <<
upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
setViewDirectionJ2000(core->altAzToJ2000(Vec3d(dir[0], dir[1], dir[2
]), StelCore::RefractionOff));
//qDebug() << "lookNadir: View is " << viewDirectionMountFrame[0] <<
"/" << viewDirectionMountFrame[1] << "/" << viewDirectionMountFrame[2];
if (mountMode==MountAltAzimuthal)
{ // ensure a stable up vector that makes the top of the scree
n point south.
upVectorMountFrame.set(-1., 0., 0.);
//qDebug() << "lookNadir: better Up is " << upVectorMountFra
me[0] << "/" << upVectorMountFrame[1] << "/" << upVectorMountFrame[2];
}
} }
void StelMovementMgr::lookTowardsNCP(void) void StelMovementMgr::lookTowardsNCP(void)
{ {
setViewDirectionJ2000(core->equinoxEquToJ2000(Vec3d(0,0,1))); setViewDirectionJ2000(core->equinoxEquToJ2000(Vec3d(0,0,1), StelCore ::RefractionOff));
} }
void StelMovementMgr::lookTowardsSCP(void) void StelMovementMgr::lookTowardsSCP(void)
{ {
setViewDirectionJ2000(core->equinoxEquToJ2000(Vec3d(0,0,-1))); setViewDirectionJ2000(core->equinoxEquToJ2000(Vec3d(0,0,-1), StelCor e::RefractionOff));
} }
// Increment/decrement smoothly the vision field and position // Increment/decrement smoothly the vision field and position
void StelMovementMgr::updateMotion(double deltaTime) void StelMovementMgr::updateMotion(double deltaTime)
{ {
updateVisionVector(deltaTime); updateVisionVector(deltaTime);
const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000 ); const StelProjectorP proj = core->getProjection(StelCore::FrameJ2000 );
// the more it is zoomed, the lower the moving speed is (in angle) // the more it is zoomed, the lower the moving speed is (in angle)
double depl=keyMoveSpeed*deltaTime*1000*currentFov; double depl=keyMoveSpeed*deltaTime*1000*currentFov;
skipping to change at line 792 skipping to change at line 851
} }
else if (deltaAlt>0) else if (deltaAlt>0)
{ {
deltaAlt = depl/30; deltaAlt = depl/30;
if (deltaAlt>0.2) if (deltaAlt>0.2)
deltaAlt = 0.2; deltaAlt = 0.2;
} }
if (deltaFov<0) if (deltaFov<0)
{ {
// deltaFov = -deplzoom*5;
// if (deltaFov<-0.15*currentFov)
// deltaFov = -0.15*currentFov;
deltaFov=qMax(-0.15*currentFov, -deplzoom*5); deltaFov=qMax(-0.15*currentFov, -deplzoom*5);
} }
else if (deltaFov>0) else if (deltaFov>0)
{ {
deltaFov = qMin(20., deplzoom*5.); deltaFov = qMin(20., deplzoom*5.);
} }
if (deltaFov != 0 ) if (deltaFov != 0 )
{ {
changeFov(deltaFov); changeFov(deltaFov);
skipping to change at line 832 skipping to change at line 888
// In case we have offset center, we want object sti ll visible in center. // In case we have offset center, we want object sti ll visible in center.
// Note that if we do not center on an object, we se t view direction of the potentially offset screen center! // Note that if we do not center on an object, we se t view direction of the potentially offset screen center!
// This is by design, to allow accurate setting of d isplay coordinates. // This is by design, to allow accurate setting of d isplay coordinates.
Vec3d v; Vec3d v;
switch (mountMode) switch (mountMode)
{ {
case MountAltAzimuthal: case MountAltAzimuthal:
v = move.targetObject->getAltAzPosAu to(core); v = move.targetObject->getAltAzPosAu to(core);
break; break;
case MountEquinoxEquatorial: case MountEquinoxEquatorial:
v = move.targetObject->getEquinoxEqu atorialPos(core); v = move.targetObject->getEquinoxEqu atorialPosAuto(core); // ..Auto! Fix Bug LP:#1484976
break; break;
case MountGalactic: case MountGalactic:
v = move.targetObject->getGalacticPo s(core); v = move.targetObject->getGalacticPo s(core);
break; break;
case MountSupergalactic: case MountSupergalactic:
v = move.targetObject->getSupergalac ticPos(core); v = move.targetObject->getSupergalac ticPos(core);
break; break;
default: default:
qWarning() << "StelMovementMgr: unex pected mountMode" << mountMode; qWarning() << "StelMovementMgr: unex pected mountMode" << mountMode;
Q_ASSERT(0); Q_ASSERT(0);
skipping to change at line 952 skipping to change at line 1008
{ {
if (flagTracking && objectMgr->getWasSelected()) // Equatori al vision vector locked on selected object if (flagTracking && objectMgr->getWasSelected()) // Equatori al vision vector locked on selected object
{ {
Vec3d v; Vec3d v;
switch (mountMode) switch (mountMode)
{ {
case MountAltAzimuthal: case MountAltAzimuthal:
v = objectMgr->getSelectedObject()[0 ]->getAltAzPosAuto(core); v = objectMgr->getSelectedObject()[0 ]->getAltAzPosAuto(core);
break; break;
case MountEquinoxEquatorial: case MountEquinoxEquatorial:
v = objectMgr->getSelectedObject()[0 ]->getEquinoxEquatorialPos(core); v = objectMgr->getSelectedObject()[0 ]->getEquinoxEquatorialPosAuto(core);
break; break;
case MountGalactic: case MountGalactic:
v = objectMgr->getSelectedObject()[0 ]->getGalacticPos(core); v = objectMgr->getSelectedObject()[0 ]->getGalacticPos(core);
break; break;
case MountSupergalactic: case MountSupergalactic:
v = objectMgr->getSelectedObject()[0 ]->getSupergalacticPos(core); v = objectMgr->getSelectedObject()[0 ]->getSupergalacticPos(core);
break; break;
default: default:
qWarning() << "StelMovementMgr: unex pected mountMode" << mountMode; qWarning() << "StelMovementMgr: unex pected mountMode" << mountMode;
Q_ASSERT(0); Q_ASSERT(0);
skipping to change at line 1184 skipping to change at line 1240
// qDebug() << "StelMovementMgr::moveToAltAzi() from alt:" << c urrAlt*(180./M_PI) << "/azi" << currAzi*(180./M_PI) << "to alt:" << newAlt *(180./M_PI) << "azi" << newAzi*(180./M_PI) ; // qDebug() << "StelMovementMgr::moveToAltAzi() from alt:" << c urrAlt*(180./M_PI) << "/azi" << currAzi*(180./M_PI) << "to alt:" << newAlt *(180./M_PI) << "azi" << newAzi*(180./M_PI) ;
} }
Vec3d StelMovementMgr::j2000ToMountFrame(const Vec3d& v) const Vec3d StelMovementMgr::j2000ToMountFrame(const Vec3d& v) const
{ {
switch (mountMode) switch (mountMode)
{ {
case MountAltAzimuthal: case MountAltAzimuthal:
return core->j2000ToAltAz(v, StelCore::RefractionOff ); // TODO: Decide if RefractionAuto? return core->j2000ToAltAz(v, StelCore::RefractionOff ); // TODO: Decide if RefractionAuto?
case MountEquinoxEquatorial: case MountEquinoxEquatorial:
return core->j2000ToEquinoxEqu(v); return core->j2000ToEquinoxEqu(v, StelCore::Refracti onOff);
case MountGalactic: case MountGalactic:
return core->j2000ToGalactic(v); return core->j2000ToGalactic(v);
case MountSupergalactic: case MountSupergalactic:
return core->j2000ToSupergalactic(v); return core->j2000ToSupergalactic(v);
} }
Q_ASSERT(0); Q_ASSERT(0);
return Vec3d(0); return Vec3d(0);
} }
Vec3d StelMovementMgr::mountFrameToJ2000(const Vec3d& v) const Vec3d StelMovementMgr::mountFrameToJ2000(const Vec3d& v) const
{ {
switch (mountMode) switch (mountMode)
{ {
case MountAltAzimuthal: case MountAltAzimuthal:
return core->altAzToJ2000(v, StelCore::RefractionOff ); // TODO: Decide if RefractionAuto? return core->altAzToJ2000(v, StelCore::RefractionOff ); // TODO: Decide if RefractionAuto?
case MountEquinoxEquatorial: case MountEquinoxEquatorial:
return core->equinoxEquToJ2000(v); return core->equinoxEquToJ2000(v, StelCore::Refracti onOff);
case MountGalactic: case MountGalactic:
return core->galacticToJ2000(v); return core->galacticToJ2000(v);
case MountSupergalactic: case MountSupergalactic:
return core->supergalacticToJ2000(v); return core->supergalacticToJ2000(v);
} }
Q_ASSERT(0); Q_ASSERT(0);
return Vec3d(0); return Vec3d(0);
} }
void StelMovementMgr::setViewDirectionJ2000(const Vec3d& v) void StelMovementMgr::setViewDirectionJ2000(const Vec3d& v)
skipping to change at line 1352 skipping to change at line 1408
// In case we have offset center, we want object still visib le in center. // In case we have offset center, we want object still visib le in center.
if (flagTracking && objectMgr->getWasSelected()) // vision v ector locked on selected object if (flagTracking && objectMgr->getWasSelected()) // vision v ector locked on selected object
{ {
Vec3d v, vUp; Vec3d v, vUp;
switch (mountMode) switch (mountMode)
{ {
case MountAltAzimuthal: case MountAltAzimuthal:
v = objectMgr->getSelectedObject()[0 ]->getAltAzPosAuto(core); v = objectMgr->getSelectedObject()[0 ]->getAltAzPosAuto(core);
break; break;
case MountEquinoxEquatorial: case MountEquinoxEquatorial:
v = objectMgr->getSelectedObject()[0 ]->getEquinoxEquatorialPos(core); v = objectMgr->getSelectedObject()[0 ]->getEquinoxEquatorialPosAuto(core);
break; break;
case MountGalactic: case MountGalactic:
v = objectMgr->getSelectedObject()[0 ]->getGalacticPos(core); v = objectMgr->getSelectedObject()[0 ]->getGalacticPos(core);
break; break;
case MountSupergalactic: case MountSupergalactic:
v = objectMgr->getSelectedObject()[0 ]->getSupergalacticPos(core); v = objectMgr->getSelectedObject()[0 ]->getSupergalacticPos(core);
break; break;
default: default:
qWarning() << "StelMovementMgr: unex pected mountMode" << mountMode; qWarning() << "StelMovementMgr: unex pected mountMode" << mountMode;
Q_ASSERT(0); Q_ASSERT(0);
 End of changes. 35 change blocks. 
37 lines changed or deleted 104 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/