FACT++  1.0
Moon::Moon ( const Time t)
inline

Definition at line 337 of file smartfact.cc.

References Nova::ZdAzPosn::az, Nova::GetHrzFromEqu(), Nova::GetLunarDisk(), Nova::GetLunarEquCoords(), Nova::GetLunarRst(), Time::JD(), HTML::kGreen, HTML::kRed, HTML::kYellow, Time::MinutesTo(), and Nova::ZdAzPosn::zd.

337  : time(t)
338  {
339 #ifdef HAVE_LIBNOVA
340  const double JD = time.JD();
341 
342  Nova::RstTime moon = Nova::GetLunarRst(JD-0.5);
343 
344  fRise = Time(moon.rise);
345  fTransit = Time(moon.transit);
346  fSet = Time(moon.set);
347 
348  //visible =
349  // ((JD>moon.rise && JD<moon.set ) && moon.rise<moon.set) ||
350  // ((JD<moon.set || JD>moon.rise) && moon.rise>moon.set);
351 
352  const bool is_up = JD>moon.rise;
353  const bool is_sinking = JD>moon.transit;
354  const bool is_dn = JD>moon.set;
355 
356  moon = Nova::GetLunarRst(JD+0.5);
357  if (is_up)
358  fRise = Time(moon.rise);
359  if (is_sinking)
360  fTransit = Time(moon.transit);
361  if (is_dn)
362  fSet = Time(moon.set);
363 
364  const Nova::EquPosn pos = Nova::GetLunarEquCoords(JD);
365  const Nova::ZdAzPosn hrz = Nova::GetHrzFromEqu(pos, JD);
366 
367  az = hrz.az;
368  zd = hrz.zd;
369 
370  ra = pos.ra/15;
371  dec = pos.dec;
372 
373  disk = Nova::GetLunarDisk(JD)*100;
374  state = 0;
375  if (fRise <fTransit && fRise <fSet) state = 0; // not visible
376  if (fTransit<fSet && fTransit<fRise) state = 1; // before culm
377  if (fSet <fRise && fSet <fTransit) state = 2; // after culm
378 
379  visible = state!=0;
380 
381  // 0: not visible
382  // 1: visible before cul
383  // 2: visible after cul
384 
385  if (!visible || disk<25)
387  else
389 
390  const string arr = fSet<fRise ?
391  fSet.MinutesTo(time) +"&darr;" :
392  fRise.MinutesTo(time)+"&uarr;";
393 
394  ostringstream out;
395  out << setprecision(2);
396  out << (visible?"visible ":"") << (disk<0.1?0:disk) << "% [" << arr << "]";
397 
398  description = out.str();
399 #endif
400  }
string description
Definition: smartfact.cc:326
int state
Definition: moon.cc:32
static const string kYellow
Definition: smartfact.cc:75
double ra
Definition: moon.cc:18
EquPosn GetLunarEquCoords(double jd, double precision=0)
Definition: nova.h:136
double dec
Definition: moon.cc:19
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
double GetLunarDisk(double jd)
Definition: nova.h:121
double zd
Definition: nova.h:30
double JD() const
Definition: Time.h:87
Time time
Definition: moon.cc:16
double zd
Definition: moon.cc:21
Time fTransit
Definition: moon.cc:29
double az
Definition: moon.cc:22
RstTime GetLunarRst(double jd, const LnLatPosn &obs=ORM())
Definition: nova.h:108
Time fSet
Definition: moon.cc:30
static const string kGreen
Definition: smartfact.cc:77
HrzPosn GetHrzFromEqu(const EquPosn &equ, const LnLatPosn &obs, double jd)
Definition: nova.h:75
double disk
Definition: moon.cc:24
double az
Definition: nova.h:31
Time fRise
Definition: moon.cc:28
ln_rst_time RstTime
Definition: nova.h:13
string color
Definition: smartfact.cc:327
std::string MinutesTo(const Time &=Time()) const
Definition: Time.cc:281
static const string kRed
Definition: smartfact.cc:76
bool visible
Definition: moon.cc:26

+ Here is the call graph for this function: