StelObject.cpp   StelObject.cpp 
skipping to change at line 21 skipping to change at line 21
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelNavigator.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelSkyDrawer.hpp"
#include "RefractionExtinction.hpp"
#include "StelLocation.hpp"
#include <QRegExp> #include <QRegExp>
#include <QDebug> #include <QDebug>
Vec3d StelObject::getEquinoxEquatorialPos(const StelNavigator* nav) const Vec3d StelObject::getEquinoxEquatorialPos(const StelCore* core) const
{ {
return nav->j2000ToEquinoxEqu(getJ2000EquatorialPos(nav)); return core->j2000ToEquinoxEqu(getJ2000EquatorialPos(core));
} }
// Return the radius of a circle containing the object on screen
// float StelObject::getOnScreenSize(const StelCore* core, const StelProjec
torP& prj) const
// {
// return getAngularSize(core)*M_PI/180.*prj->getPixelPerRadAtCenter();
// }
// Get observer local sideral coordinate // Get observer local sideral coordinate
Vec3d StelObject::getSideralPos(const StelCore* core) const Vec3d StelObject::getSideralPosGeometric(const StelCore* core) const
{
return Mat4d::zrotation(-core->getLocalSideralTime())* getEquinoxEqu
atorialPos(core);
}
// Get observer local sidereal coordinates, deflected by refraction
Vec3d StelObject::getSideralPosApparent(const StelCore* core) const
{
Vec3d v=getAltAzPosApparent(core);
v = core->altAzToEquinoxEqu(v, StelCore::RefractionOff);
return Mat4d::zrotation(-core->getLocalSideralTime())*v;
}
Vec3d StelObject::getAltAzPosGeometric(const StelCore* core) const
{
return core->j2000ToAltAz(getJ2000EquatorialPos(core), StelCore::Ref
ractionOff);
}
// Get observer-centered alt/az position
Vec3d StelObject::getAltAzPosApparent(const StelCore* core) const
{ {
return Mat4d::zrotation(-core->getNavigator()->getLocalSideralTime() )* getEquinoxEquatorialPos(core->getNavigator()); return core->j2000ToAltAz(getJ2000EquatorialPos(core), StelCore::Ref ractionOn);
} }
// Get observer-centered alt/az position // Get observer-centered alt/az position
Vec3d StelObject::getAltAzPos(const StelNavigator* nav) const Vec3d StelObject::getAltAzPosAuto(const StelCore* core) const
{ {
return nav->j2000ToAltAz(getJ2000EquatorialPos(nav)); return core->j2000ToAltAz(getJ2000EquatorialPos(core));
} }
// Format the positional info string contain J2000/of date/altaz/hour angle positions for the object // Format the positional info string contain J2000/of date/altaz/hour angle positions for the object
QString StelObject::getPositionInfoString(const StelCore *core, const InfoS tringGroup& flags) const QString StelObject::getPositionInfoString(const StelCore *core, const InfoS tringGroup& flags) const
{ {
QString res; QString res;
const StelNavigator* nav = core->getNavigator();
if (flags&RaDecJ2000) if (flags&RaDecJ2000)
{ {
double dec_j2000, ra_j2000; double dec_j2000, ra_j2000;
StelUtils::rectToSphe(&ra_j2000,&dec_j2000,getJ2000Equatoria lPos(nav)); StelUtils::rectToSphe(&ra_j2000,&dec_j2000,getJ2000Equatoria lPos(core));
res += q_("RA/DE (J2000): %1/%2").arg(StelUtils::radToHmsStr (ra_j2000,true), StelUtils::radToDmsStr(dec_j2000,true)) + "<br>"; res += q_("RA/DE (J2000): %1/%2").arg(StelUtils::radToHmsStr (ra_j2000,true), StelUtils::radToDmsStr(dec_j2000,true)) + "<br>";
} }
if (flags&RaDecOfDate) if (flags&RaDecOfDate)
{ {
double dec_equ, ra_equ; double dec_equ, ra_equ;
StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP os(nav)); StelUtils::rectToSphe(&ra_equ,&dec_equ,getEquinoxEquatorialP os(core));
res += q_("RA/DE (of date): %1/%2").arg(StelUtils::radToHmsS tr(ra_equ), StelUtils::radToDmsStr(dec_equ)) + "<br>"; res += q_("RA/DE (of date): %1/%2").arg(StelUtils::radToHmsS tr(ra_equ), StelUtils::radToDmsStr(dec_equ)) + "<br>";
} }
if (flags&HourAngle) if (flags&HourAngle)
{ {
double dec_sideral, ra_sideral; double dec_sideral, ra_sideral;
StelUtils::rectToSphe(&ra_sideral,&dec_sideral,getSideralPos StelUtils::rectToSphe(&ra_sideral,&dec_sideral,getSideralPos
(core)); Geometric(core));
ra_sideral = 2.*M_PI-ra_sideral;
res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr
(ra_sideral), StelUtils::radToDmsStr(dec_sideral)) + " " + q_("(geometric)"
) + "<br>";
StelUtils::rectToSphe(&ra_sideral,&dec_sideral,getSideralPos
Apparent(core));
ra_sideral = 2.*M_PI-ra_sideral; ra_sideral = 2.*M_PI-ra_sideral;
res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr (ra_sideral), StelUtils::radToDmsStr(dec_sideral)) + "<br>"; res += q_("Hour angle/DE: %1/%2").arg(StelUtils::radToHmsStr (ra_sideral), StelUtils::radToDmsStr(dec_sideral)) + " " + q_("(apparent)") + "<br>";
} }
if (flags&AltAzi) if (flags&AltAzi)
{ {
// calculate alt az // calculate alt az
double az,alt; double az,alt;
StelUtils::rectToSphe(&az,&alt,getAltAzPos(nav)); StelUtils::rectToSphe(&az,&alt,getAltAzPosGeometric(core));
az = 3.*M_PI - az; // N is zero, E is 90 degrees
if (az > M_PI*2)
az -= M_PI*2;
res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), S
telUtils::radToDmsStr(alt)) + " " + q_("(geometric)") + "<br>";
StelUtils::rectToSphe(&az,&alt,getAltAzPosApparent(core));
az = 3.*M_PI - az; // N is zero, E is 90 degrees az = 3.*M_PI - az; // N is zero, E is 90 degrees
if (az > M_PI*2) if (az > M_PI*2)
az -= M_PI*2; az -= M_PI*2;
res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), S telUtils::radToDmsStr(alt)) + "<br>"; res += q_("Az/Alt: %1/%2").arg(StelUtils::radToDmsStr(az), S telUtils::radToDmsStr(alt)) + " " + q_("(apparent)") + "<br>";
} }
return res; return res;
} }
// Apply post processing on the info string // Apply post processing on the info string
void StelObject::postProcessInfoString(QString& str, const InfoStringGroup& flags) const void StelObject::postProcessInfoString(QString& str, const InfoStringGroup& flags) const
{ {
// chomp trailing line breaks // chomp trailing line breaks
str.replace(QRegExp("<br(\\s*/)?>\\s*$"), ""); str.replace(QRegExp("<br(\\s*/)?>\\s*$"), "");
 End of changes. 16 change blocks. 
23 lines changed or deleted 51 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/