PointerCoordinates.cpp   PointerCoordinates.cpp 
skipping to change at line 122 skipping to change at line 122
return; return;
const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000, StelCore::RefractionAuto); const StelProjectorP prj = core->getProjection(StelCore::FrameJ2000, StelCore::RefractionAuto);
StelPainter sPainter(prj); StelPainter sPainter(prj);
sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f); sPainter.setColor(textColor[0], textColor[1], textColor[2], 1.f);
font.setPixelSize(getFontSize()); font.setPixelSize(getFontSize());
sPainter.setFont(font); sPainter.setFont(font);
QPoint p = StelMainView::getInstance().getMousePos(); // get screen coordinates of mouse cursor QPoint p = StelMainView::getInstance().getMousePos(); // get screen coordinates of mouse cursor
Vec3d mousePosition; Vec3d mousePosition;
float wh = prj->getViewportWidth()/2; // get half of width of the sc float wh = prj->getViewportWidth()/2.; // get half of width of the s
reen creen
float hh = prj->getViewportHeight()/2; // get half of height of the float hh = prj->getViewportHeight()/2.; // get half of height of the
screen screen
float mx = p.x()-wh; // point 0 in center of the screen, axis X dire cted to right float mx = p.x()-wh; // point 0 in center of the screen, axis X dire cted to right
float my = p.y()-hh; // point 0 in center of the screen, axis Y dire cted to bottom float my = p.y()-hh; // point 0 in center of the screen, axis Y dire cted to bottom
// calculate position of mouse cursor via position of center of the screen (and invert axis Y) // calculate position of mouse cursor via position of center of the screen (and invert axis Y)
prj->unProject(prj->getViewportPosX()+wh+mx, prj->getViewportPosY()+ hh+1-my, mousePosition); prj->unProject(prj->getViewportPosX()+wh+mx, prj->getViewportPosY()+ hh+1-my, mousePosition);
{ // Nick Fedoseev patch { // Nick Fedoseev patch
Vec3d win; Vec3d win;
prj->project(mousePosition,win); prj->project(mousePosition,win);
float dx = prj->getViewportPosX()+wh+mx - win.v[0]; float dx = prj->getViewportPosX()+wh+mx - win.v[0];
float dy = prj->getViewportPosY()+hh+1-my - win.v[1]; float dy = prj->getViewportPosY()+hh+1-my - win.v[1];
prj->unProject(prj->getViewportPosX()+wh+mx+dx, prj->getViewportP osY()+hh+1-my+dy, mousePosition); prj->unProject(prj->getViewportPosX()+wh+mx+dx, prj->getViewportP osY()+hh+1-my+dy, mousePosition);
} }
bool withDecimalDegree = dynamic_cast<StelGui*>(StelApp::getInstance ().getGui())->getFlagShowDecimalDegrees(); bool withDecimalDegree = StelApp::getInstance().getFlagShowDecimalDe grees();
QString coordsSystem, cxt, cyt; QString coordsSystem, cxt, cyt;
double cx, cy; double cx, cy;
switch (getCurrentCoordinateSystem()) switch (getCurrentCoordinateSystem())
{ {
case RaDecJ2000: case RaDecJ2000:
{ {
StelUtils::rectToSphe(&cx,&cy,mousePosition); // Cal culate RA/DE (J2000.0) and show it... StelUtils::rectToSphe(&cx,&cy,mousePosition); // Cal culate RA/DE (J2000.0) and show it...
coordsSystem = qc_("RA/Dec (J2000.0)", "abbreviated in the plugin"); coordsSystem = qc_("RA/Dec (J2000.0)", "abbreviated in the plugin");
if (withDecimalDegree) if (withDecimalDegree)
skipping to change at line 213 skipping to change at line 213
{ {
cxt = StelUtils::radToDmsStr(cx, true); cxt = StelUtils::radToDmsStr(cx, true);
cyt = StelUtils::radToDmsStr(cy, true); cyt = StelUtils::radToDmsStr(cy, true);
} }
break; break;
} }
case Ecliptic: case Ecliptic:
{ {
double lambda, beta; double lambda, beta;
StelUtils::rectToSphe(&cx,&cy,core->j2000ToEquinoxEq u(mousePosition)); StelUtils::rectToSphe(&cx,&cy,core->j2000ToEquinoxEq u(mousePosition));
StelUtils::ctRadec2Ecl(cx, cy, GETSTELMODULE(SolarSy stem)->getEarth()->getRotObliquity(core->getJDay()), &lambda, &beta); // Ca lculate ecliptic position and show it... StelUtils::equToEcl(cx, cy, core->getCurrentPlanet() ->getRotObliquity(core->getJDay()), &lambda, &beta); // Calculate ecliptic position and show it...
if (lambda<0) lambda+=2.0*M_PI; if (lambda<0) lambda+=2.0*M_PI;
coordsSystem = qc_("Ecl. Long/Lat", "abbreviated in the plugin"); coordsSystem = qc_("Ecl. Long/Lat", "abbreviated in the plugin");
if (withDecimalDegree) if (withDecimalDegree)
{ {
cxt = StelUtils::radToDecDegStr(lambda); cxt = StelUtils::radToDecDegStr(lambda);
cyt = StelUtils::radToDecDegStr(beta); cyt = StelUtils::radToDecDegStr(beta);
} }
else else
{ {
cxt = StelUtils::radToDmsStr(lambda, true); cxt = StelUtils::radToDmsStr(lambda, true);
cyt = StelUtils::radToDmsStr(beta, true); cyt = StelUtils::radToDmsStr(beta, true);
} }
break; break;
} }
case EclipticJ2000: case EclipticJ2000:
{ {
double lambda, beta; double lambda, beta;
StelUtils::rectToSphe(&cx,&cy, mousePosition); StelUtils::rectToSphe(&cx,&cy, mousePosition);
StelUtils::ctRadec2Ecl(cx, cy, GETSTELMODULE(SolarSy stem)->getEarth()->getRotObliquity(2451545.0), &lambda, &beta); // Calculat e ecliptic position and show it... StelUtils::equToEcl(cx, cy, core->getCurrentPlanet() ->getRotObliquity(2451545.0), &lambda, &beta); // Calculate ecliptic positi on and show it...
if (lambda<0) lambda+=2.0*M_PI; if (lambda<0) lambda+=2.0*M_PI;
coordsSystem = qc_("Ecl. Long/Lat (J2000.0)", "abbre viated in the plugin"); coordsSystem = qc_("Ecl. Long/Lat (J2000.0)", "abbre viated in the plugin");
if (withDecimalDegree) if (withDecimalDegree)
{ {
cxt = StelUtils::radToDecDegStr(lambda); cxt = StelUtils::radToDecDegStr(lambda);
cyt = StelUtils::radToDecDegStr(beta); cyt = StelUtils::radToDecDegStr(beta);
} }
else else
{ {
cxt = StelUtils::radToDmsStr(lambda, true); cxt = StelUtils::radToDmsStr(lambda, true);
cyt = StelUtils::radToDmsStr(beta, true); cyt = StelUtils::radToDmsStr(beta, true);
} }
break; break;
} }
case HourAngle: case HourAngle:
{ {
Vec3d v = core->j2000ToAltAz(mousePosition, StelCore ::RefractionAuto); Vec3d v = core->j2000ToAltAz(mousePosition, StelCore ::RefractionAuto);
StelUtils::rectToSphe(&cx,&cy,Mat4d::zrotation(-core ->getLocalSiderealTime()+((core->getDeltaT(core->getJDay())/240.)*M_PI/180. ))*core->altAzToEquinoxEqu(v, StelCore::RefractionOff)); StelUtils::rectToSphe(&cx,&cy,Mat4d::zrotation(-core ->getLocalSiderealTime()+((core->getDeltaT(core->getJDay())/240.)*M_PI/180. ))*core->altAzToEquinoxEqu(v, StelCore::RefractionOff));
cx = 2.*M_PI-cx; cx = 2.*M_PI-cx;
coordsSystem = qc_("HA/Dec", "abbreviated in the plu gin"); coordsSystem = qc_("HA/Dec", "abbreviated in the plu gin");
cxt = StelUtils::radToHmsStr(cx); if (withDecimalDegree)
cyt = StelUtils::radToDmsStr(cy); {
double ha_sidereal = cx*12/M_PI;
if (ha_sidereal>24.)
ha_sidereal -= 24.;
cxt = QString("%1h").arg(ha_sidereal, 0, 'f'
, 5);
cyt = StelUtils::radToDecDegStr(cy);
}
else
{
cxt = StelUtils::radToHmsStr(cx);
cyt = StelUtils::radToDmsStr(cy);
}
break; break;
} }
} }
QString coordsText = QString("%1: %2/%3").arg(coordsSystem).arg(cxt) .arg(cyt); QString coordsText = QString("%1: %2/%3").arg(coordsSystem).arg(cxt) .arg(cyt);
sPainter.drawText(getCoordinatesPlace(coordsText).first, getCoordina tesPlace(coordsText).second, coordsText); sPainter.drawText(getCoordinatesPlace(coordsText).first, getCoordina tesPlace(coordsText).second, coordsText);
} }
void PointerCoordinates::enableCoordinates(bool b) void PointerCoordinates::enableCoordinates(bool b)
{ {
 End of changes. 5 change blocks. 
9 lines changed or deleted 22 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/