2374 CalcCoordinates(now.
JD());
2383 out << setprecision(3);
2385 out <<
color[4] <<
'\t' << fSun.fSunRise18.GetAsStr(
"%H:%M") <<
'\n';
2386 out <<
color[5] <<
'\t' << fSun.fSunRise12.GetAsStr(
"%H:%M") <<
'\n';
2387 out <<
color[6] <<
'\t' << fSun.fSunRise06.GetAsStr(
"%H:%M") <<
'\n';
2388 out <<
color[7] <<
'\t' << fSun.fSunRise00.GetAsStr(
"%H:%M") <<
'\n';
2390 out <<
color[0] <<
'\t' << fSun.fSunSet00.GetAsStr(
"%H:%M") <<
'\n';
2391 out <<
color[1] <<
'\t' << fSun.fSunSet06.GetAsStr(
"%H:%M") <<
'\n';
2392 out <<
color[2] <<
'\t' << fSun.fSunSet12.GetAsStr(
"%H:%M") <<
'\n';
2393 out <<
color[3] <<
'\t' << fSun.fSunSet18.GetAsStr(
"%H:%M") <<
'\n';
2395 ofstream(
fPath+
"/sun.data") << out.str();
2427 ostringstream out2, out3, out4;
2428 out2 << setprecision(3);
2438 Entry(
const string &n,
float v,
int c) : name(n), value(v), color(c%8) { }
2440 const string &Col()
const 2444 static const string hcol[] = {
"888",
"8cf",
"c8f",
"bbb",
"8fc",
"cf8",
"f8c",
"fc8" };
2448 vector<float> GetColor(
double scale,
double offset=0)
const 2450 vector<float> rc(3);
2451 rc[0] = double(Col()[0])*scale/126+offset;
2452 rc[1] = double(Col()[1])*scale/126+offset;
2453 rc[2] = double(Col()[2])*scale/126+offset;
2458 multimap<Time, Entry> culmination;
2459 multimap<Time, Entry> lightcond;
2460 vector<vector<float>> alt;
2461 vector<vector<float>> cur;
2467 pair<vector<float>, pair<Time, float>> vism = GetVisibility();
2468 if (!vism.first.empty())
2470 const Entry entry(
"Moon", vism.second.second, ccol);
2471 culmination.insert(make_pair(vism.second.first, entry));
2472 const vector<float> col = entry.GetColor(75, 15);
2473 vism.first.insert(vism.first.begin(), col.begin(), col.end());
2474 alt.push_back(vism.first);
2483 const mysqlpp::StoreQueryResult res =
2484 Database(
fDatabase).query(
"SELECT fSourceName, fRightAscension, fDeclination FROM Source WHERE fSourceTypeKEY=1").store();
2486 out << HTML::kWhite <<
'\t';
2487 out2 << HTML::kWhite <<
'\t';
2488 out3 << HTML::kWhite <<
'\t';
2489 out4 << HTML::kWhite <<
'\t';
2491 for (vector<mysqlpp::Row>::const_iterator v=res.begin(); v<res.end(); v++)
2493 const string name = (*v)[0].c_str();
2494 const double ra = (*v)[1];
2495 const double dec = (*v)[2];
2503 pair<vector<float>, pair<Time, float>> vis = GetVisibility(&pos);
2504 if (!vis.first.empty())
2506 const Entry entry(name, vis.second.second, ccol);
2507 culmination.insert(make_pair(vis.second.first, entry));
2508 const vector<float> col = entry.GetColor(75, 15);
2509 vis.first.insert(vis.first.begin(), col.begin(), col.end());
2510 alt.push_back(vis.first);
2514 pair<vector<float>, pair<Time, float>> lc = GetLightCondition(pos);
2515 if (!lc.first.empty())
2517 const Entry entry2(name, lc.second.second, lcol);
2518 lightcond.insert(make_pair(lc.second.first, entry2));
2519 const vector<float> col2 = entry2.GetColor(100);
2520 lc.first.insert(lc.first.begin(), col2.begin(), col2.end());
2521 cur.push_back(lc.first);
2535 out2 <<
"<tr bgcolor='" << col <<
"'>";
2536 out2 <<
"<td>" << name <<
"</td>";
2539 out2 <<
"<td>" << hrz.
zd <<
"°</td>";
2540 out2 <<
"<td>" <<
GetDir(hrz.
az) <<
"</td>";
2543 out2 <<
"<td/><td/>";
2548 out <<
"<tr bgcolor='" <<
Moon::Color(angle) <<
"'>";
2549 out <<
"<td>" << name <<
"</td>";
2550 out <<
"<td>" << round(angle) <<
"°</td>";
2554 for (
auto it=culmination.begin(); it!=culmination.end(); it++)
2556 const Entry &e = it->second;
2557 if (it!=culmination.begin())
2559 out3 <<
"<B#" << e.Col() <<
">" << e.name <<
"</B>";
2561 out3 <<
" [" << nearbyint(90-e.value) <<
"°]";
2564 out4 << setprecision(3);
2566 for (
auto it=lightcond.begin(); it!=lightcond.end(); it++)
2568 const Entry &e = it->second;
2569 if (it!=lightcond.begin())
2571 out4 <<
"<B#" << e.Col() <<
">" << e.name <<
"</B>";
2573 out4 <<
" [" << nearbyint(e.value) <<
"]";
2576 const Time st = fSun.fSunSet12;;
2577 const Time rs = fSun.fSunRise12;
2579 ostringstream title;
2582 title << ((rs>st?rs-st:st-rs)/20).minutes();
2590 out << HTML::kWhite <<
'\t' <<
Time()-now <<
'\n';
2591 out2 << HTML::kWhite <<
'\t' <<
Time()-now <<
'\n';
2593 WriteBinaryVec(now,
"hist-visibility", alt, 75, 15,
"Alt "+title.str());
2594 WriteBinaryVec(now,
"hist-current-prediction", cur, 100, 0,
"I " +title.str());
2596 catch (
const exception &e)
2600 out << HTML::kWhite <<
'\t' <<
"ERROR - "+string(e.what()) <<
'\n';
2601 out2 << HTML::kWhite <<
'\t' <<
"ERROR - "+string(e.what()) <<
'\n';
2602 out3 << HTML::kWhite <<
'\t' <<
"ERROR - "+string(e.what()) <<
'\n';
2603 out4 << HTML::kWhite <<
'\t' <<
"ERROR - "+string(e.what()) <<
'\n';
2607 ofstream(
fPath+
"/moon.data") << out.str();
2608 ofstream(
fPath+
"/source-list.data") << out2.str();
2609 ofstream(
fPath+
"/visibility.data") << out3.str();
2610 ofstream(
fPath+
"/current-prediction.data") << out4.str();
static const string kYellow
uint64_t JavaDate() const
Adds some functionality to boost::posix_time::ptime for our needs.
void WriteBinaryVec(const Time &tm, const string &fname, const vector< T > &vec, double scale, double offset=0, const string &title="", const string &col="")
static const string kBlue
static const string kWhite
static const string kGreen
HrzPosn GetHrzFromEqu(const EquPosn &equ, const LnLatPosn &obs, double jd)
static string Color(double angle)
string GetDir(const double angle)
double Angle(double r, double d) const
std::string GetAsStr(const char *fmt="%Y-%m-%d %H:%M:%S") const