// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// Copyright 2003 Liam Girdwood
#include "jupiter.hh"
#include <libnova/libnova.h>
namespace Castor
{
Jupiter::Jupiter()
{
}
Jupiter::~Jupiter()
{
}
double Jupiter::get_disk (double JD)
{
return ln_get_jupiter_disk(JD);
}
/*! \fn void Jupiter::get_equ_posn (double JD, ln_equ_posn* posn)
* \brief Get object equatorial position.
*/
void Jupiter::get_equ_posn (double JD, double& ra, double& dec)
{
struct ln_equ_posn equ;
ln_get_jupiter_equ_coords (JD, &equ);
ra = equ.ra;
dec = equ.dec;
}
/*! \fn void Jupiter::get_hrz_posn (double JD, ln_lnlat_posn* observer, ln_hrz_posn* posn)
* \brief Get object horizontal position
*/
void Jupiter::get_hrz_posn (double JD, ln_lnlat_posn* observer, ln_hrz_posn* posn)
{
struct ln_equ_posn equ;
ln_get_jupiter_equ_coords (JD, &equ);
ln_get_hrz_from_equ (&equ, observer, JD, posn);
}
/*! \fn void Jupiter::get_rst_time (double JD, ln_lnlat_posn* observer, ln_rst_time* time)
* \brief Get object rise, transit and set time.
*/
void Jupiter::get_rst_time (double JD, ln_lnlat_posn* observer, ln_rst_time* time)
{
ln_get_jupiter_rst(JD, observer, time);
}
/*! \fn double Jupiter::get_mag(double JD)
* \brief Get object Magnitude
*/
double Jupiter::get_mag(double JD)
{
if (JD == 0)
JD = m_render_JD;
return ln_get_jupiter_magnitude (JD);
}
/*! \fn void Jupiter::get_id(std::string& id)
* \brief Get object identification number.
*/
void Jupiter::get_id(std::string& id)
{
id = "Jupiter";
}
/*! \fn void Jupiter::get_name(std::string& name)
* \brief Get object name.
*/
void Jupiter::get_name(std::string& name)
{
name = "Jupiter";
}
/*! \fn void Jupiter::get_info (std::list<Glib::ustring>& value)
* \brief Get object information
*/
void Jupiter::get_info (std::list<Glib::ustring>& value)
{
}
/*! \fn void Jupiter::render(double x, double y, double mag_max, Gnome::Canvas::Group& group)
* \brief Render object
*/
void Jupiter::render(double x, double y, double mag_max, Gnome::Canvas::Group& group, bool bright, double ppd)
{
// draw object on canvas
double size = (mag_max + 1) - ln_get_jupiter_magnitude(m_render_JD);
double sdiam = (get_equ_sdiam(m_render_JD) / 240.0) * ppd;
if (size < sdiam)
size = sdiam;
double shadow = 1.1 * size;
Gnome::Canvas::Ellipse *ellipse_back, *ellipse;
if (!bright) {
// draw the background shadow object
ellipse_back = Gtk::manage (new Gnome::Canvas::Ellipse(group, x - shadow, y - shadow, x + shadow, y + shadow));
*ellipse_back << Gnome::Canvas::Properties::fill_color("black");
ellipse_back->show();
}
// draw real colour object
ellipse = Gtk::manage (new Gnome::Canvas::Ellipse(group, x - size, y - size, x + size, y + size));
ellipse->set_data (Glib::Quark("object"),(gpointer)this);
*ellipse << Gnome::Canvas::Properties::fill_color("orange");
ellipse->show();
}
double Jupiter::get_earth_dist (double JD)
{
return ln_get_jupiter_earth_dist(JD);
}
double Jupiter::get_sun_dist (double JD)
{
return ln_get_jupiter_solar_dist(JD);
}
double Jupiter::get_equ_sdiam (double JD)
{
return ln_get_jupiter_equ_sdiam(JD);
}
double Jupiter::get_pol_sdiam (double JD)
{
return ln_get_jupiter_pol_sdiam(JD);
}
void Jupiter::get_helio_coords (double JD, struct ln_helio_posn * position)
{
ln_get_jupiter_helio_coords (JD, position);
}
double Jupiter::get_phase (double JD)
{
return ln_get_jupiter_phase (JD);
}
void Jupiter::get_rect_helio (double JD, struct ln_rect_posn * position)
{
ln_get_jupiter_rect_helio (JD, position);
}
void Jupiter::set_render_jd (double JD)
{
m_render_JD = JD;
}
}
syntax highlighted by Code2HTML, v. 0.9.1