Changeset 18827
- Timestamp:
- 04/14/17 17:18:31 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/mcore/nova.h
r18820 r18827 4 4 #include <map> 5 5 #include <string> 6 #include <algorithm> 6 7 7 8 #include <libnova/solar.h> … … 38 39 LnLatPosn() { } 39 40 LnLatPosn(const ln_lnlat_posn &pos) : ln_lnlat_posn(pos) { } 40 LnLatPosn( const std::string &obs)41 LnLatPosn(std::string obs) 41 42 { 42 43 #ifndef __CINT__ 43 44 static const std::map<std::string, ln_lnlat_posn> lut = 44 45 { 45 { " orm", kORM },46 { " hawc", kHAWC },47 { " spm", kSPM },46 { "ORM", kORM }, 47 { "HAWC", kHAWC }, 48 { "SPM", kSPM }, 48 49 }; 49 50 51 for (auto &c: obs) 52 c = toupper(c); 53 50 54 const auto it = lut.find(obs); 51 *this = it==lut.end() ? ln_lnlat_posn({0,0}) : it->second; 52 #endif 55 *this = it==lut.end() ? ln_lnlat_posn({std::numeric_limits<double>::quiet_NaN(),std::numeric_limits<double>::quiet_NaN()}) : it->second; 56 #endif 57 } 58 bool isValid() const 59 { 60 return std::isfinite(lat) && std::isfinite(lng); 53 61 } 54 62 };
Note:
See TracChangeset
for help on using the changeset viewer.