- Timestamp:
- 06/02/12 16:52:21 (12 years ago)
- Location:
- trunk/FACT++
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r14037 r14040 471 471 // ------------------------------------------------------------------- 472 472 473 string GetDir(const double angle) 474 { 475 static const char *dir[] = 476 { 477 "N", "NNE", "NE", "ENE", 478 "E", "ESE", "SE", "SSE", 479 "S", "SSW", "SW", "WSW", 480 "W", "WNW", "NW", "NNW" 481 }; 482 483 const uint16_t idx = uint16_t(floor(angle/22.5+16.5))%16; 484 return dir[idx]; 485 } 486 487 // ------------------------------------------------------------------- 488 473 489 bool CheckDataSize(const EventImp &d, const char *name, size_t size, bool min=false) 474 490 { … … 713 729 } 714 730 715 static const char *dir[] =716 {717 "N", "NNE", "NE", "ENE",718 "E", "ESE", "SE", "SSE",719 "S", "SSW", "SW", "WSW",720 "W", "WNW", "NW", "NNW"721 };722 723 724 const uint16_t idx = uint16_t(floor(fMagicWeatherHist[kDir].back()/22.5+16.5))%16;725 //const uint16_t idx = uint16_t(floor(fmod(fMagicWeatherHist[kDir].back()/22.5+360+11.25, 360)/22.5))%16;726 727 731 ostringstream out; 728 732 out << d.GetJavaDate() << '\n'; … … 738 742 for (int i=0; i<6; i++) 739 743 out << HTML::kWhite << '\t' << fMagicWeatherHist[i].back() << '\n'; 740 out << HTML::kWhite << '\t' << dir[idx]<< '\n';744 out << HTML::kWhite << '\t' << GetDir(fMagicWeatherHist[kDir].back()) << '\n'; 741 745 out << HTML::kWhite << '\t'; 742 746 if (fTngWeatherDustHist.size()>0) … … 791 795 const double az = d.Get<double>(8); 792 796 793 static const char *dir[] = 794 { 795 "N", "NNE", "NE", "ENE", 796 "E", "ESE", "SE", "SSE", 797 "S", "SSW", "SW", "WSW", 798 "W", "WNW", "NW", "NNW" 799 }; 800 801 const uint16_t idx = uint16_t(floor(az/22.5+16.5))%16; 802 fDriveControlPointingAz = dir[idx]; 797 fDriveControlPointingAz = GetDir(az); 803 798 804 799 ostringstream out; … … 1664 1659 void UpdateAstronomy() 1665 1660 { 1661 const double lon = -(17.+53./60+26.525/3600); 1662 const double lat = 28.+45./60+42.462/3600; 1663 1666 1664 Time now; 1667 1665 1668 fSun = Sun ( -(17.+53./60+26.525/3600), 28.+45./60+42.462/3600);1669 fMoon = Moon( -(17.+53./60+26.525/3600), 28.+45./60+42.462/3600);1666 fSun = Sun (lon, lat, now); 1667 fMoon = Moon(lon, lat, now); 1670 1668 1671 1669 ostringstream out; 1672 1670 out << setprecision(3); 1673 out << fSun.time.JavaDate() << '\n';1671 out << now.JavaDate() << '\n'; 1674 1672 out << HTML::kWhite << '\t' << fSun.fSunRiseDarkTime.GetAsStr("%H:%M") << '\n'; 1675 1673 out << HTML::kWhite << '\t' << fSun.fSunRiseAstronomical.GetAsStr("%H:%M") << '\n'; … … 1682 1680 out << HTML::kWhite << '\t' << fSun.fSunSetDarkTime.GetAsStr("%H:%M") << '\n'; 1683 1681 1682 ofstream(fPath+"/sun.data") << out.str(); 1683 1684 out.str(""); 1685 out << now.JavaDate() << '\n'; 1686 1684 1687 out << HTML::kWhite << '\t' << fMoon.fMoonRise.GetAsStr("%H:%M") << '\n'; 1685 1688 out << HTML::kWhite << '\t' << fMoon.fMoonTransit.GetAsStr("%H:%M") << '\n'; 1686 1689 out << HTML::kWhite << '\t' << fMoon.fMoonSet.GetAsStr("%H:%M") << '\n'; 1690 1691 out << (fSun.visible?HTML::kWhite:fMoon.color) << '\t' << fMoon.description << '\n'; 1687 1692 1688 1693 if (!fMoon.visible) … … 1698 1703 } 1699 1704 1700 out << fMoon.color << '\t' << fMoon.description << '\n'; 1705 ostringstream out2; 1706 out2 << setprecision(3); 1707 out2 << now.JavaDate() << '\n'; 1701 1708 1702 1709 #ifdef HAVE_SQL 1703 1710 try 1704 1711 { 1705 //static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))?");1706 1712 static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))"); 1707 // 2: user1708 // 4: pass1709 // 5: server1710 // 7: port1711 // 9: db1712 1713 1713 1714 boost::smatch what; … … 1723 1724 const string db = what[9]; 1724 1725 const int port = atoi(string(what[7]).c_str()); 1725 /* 1726 ostringstream out; 1727 out << "Connecting to '"; 1728 if (!user.empty()) 1729 out << user << "@"; 1730 out << server; 1731 if (port) 1732 out << ":" << port; 1733 if (!db.empty()) 1734 out << "/" << db; 1735 1736 T::Message(out); 1737 */ 1726 1738 1727 mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port); 1739 1728 … … 1741 1730 conn.query("SELECT fSourceName, fRightAscension, fDeclination FROM source").store(); 1742 1731 1743 out << HTML::kWhite << '\t'; 1732 out << HTML::kWhite << '\t'; 1733 out2 << HTML::kWhite << '\t'; 1744 1734 1745 1735 for (vector<mysqlpp::Row>::const_iterator v=res.begin(); v<res.end(); v++) … … 1748 1738 const double ra = (*v)[1]; 1749 1739 const double dec = (*v)[2]; 1750 1740 #ifdef HAVE_NOVA 1741 ln_lnlat_posn observer; 1742 observer.lng = lon; 1743 observer.lat = lat; 1744 1745 ln_hrz_posn hrz; 1746 ln_equ_posn pos; 1747 pos.ra = ra*15; 1748 pos.dec = dec; 1749 1750 ln_get_hrz_from_equ(&pos, &observer, now.JD(), &hrz); 1751 //az = hrz.az; 1752 1753 string col = HTML::kWhite; 1754 if (hrz.alt>5) 1755 col = HTML::kRed; 1756 if (hrz.alt>25) 1757 col = HTML::kYellow; 1758 if (hrz.alt>60) 1759 col = HTML::kGreen; 1760 1761 out2 << "<tr bgcolor='" << col << "'>"; 1762 out2 << "<td>" << name << "</td>"; 1763 if (hrz.alt>5) 1764 { 1765 out2 << "<td>" << 90-hrz.alt << "°</td>"; 1766 out2 << "<td>" << GetDir(hrz.az) << "</td>"; 1767 } 1768 else 1769 out2 << "<td/><td/>"; 1770 out2 << "</tr>"; 1771 #endif 1751 1772 const int32_t angle = fMoon.Angle(ra, dec); 1752 1773 … … 1756 1777 out << "</tr>"; 1757 1778 } 1758 out << '\n'; 1759 out << HTML::kWhite << '\t' << Time()-now << '\n'; 1779 out << '\n'; 1780 out2 << '\n'; 1781 out << HTML::kWhite << '\t' << Time()-now << '\n'; 1782 out2 << HTML::kWhite << '\t' << Time()-now << '\n'; 1760 1783 } 1761 1784 catch (const exception &e) 1762 1785 { 1763 out << '\n'; 1764 out << HTML::kWhite << '\t' << "ERROR - "+string(e.what()) << '\n'; 1786 out << '\n'; 1787 out2 << '\n'; 1788 out << HTML::kWhite << '\t' << "ERROR - "+string(e.what()) << '\n'; 1789 out2 << HTML::kWhite << '\t' << "ERROR - "+string(e.what()) << '\n'; 1765 1790 } 1766 1791 #endif 1767 1792 1768 ofstream(fPath+"/astro.data") << out.str(); 1793 ofstream(fPath+"/moon.data") << out.str(); 1794 ofstream(fPath+"/source-list.data") << out2.str(); 1769 1795 } 1770 1796 -
trunk/FACT++/www/smartfact/index.css
r14036 r14040 238 238 margin:0; 239 239 } 240 .astro td:nth-child(3) { 241 text-align:center; 242 padding:0px 5px 0px 0px; 243 margin:0; 244 }
Note:
See TracChangeset
for help on using the changeset viewer.